pax_global_header00006660000000000000000000000064121657575340014531gustar00rootroot0000000000000052 comment=3a80c38f20bc654c1874c10d982fce6404d285d5 itpp-4.3.1/000077500000000000000000000000001216575753400125125ustar00rootroot00000000000000itpp-4.3.1/AUTHORS000066400000000000000000000024131216575753400135620ustar00rootroot00000000000000IT++ People =========== Project Admins -------------- o Bogdan Cristea (cristeab) o Tony Ottosson (tonyottosson) o Adam Piatyszek (ediap) Developers ---------- o Mirsad Čirkić (mirsadcirkic) o Johan Bergman (emwjohb) o Thomas Eriksson (thomases2) o Pal Frenger (frenger) o Fredrik Huss (frehu) o Erik G. Larsson (erik_g_larsson) o Stephan Ludwig (donludovico) o Robert Orzechowski (tytusz) o Andy Panov (andypanov) o Conrad Sanderson (conrad_s) o Andreas Wolfgang (andreas-w) o Simon Wood (sgwoodjr) Retired Developers ------------------ o Hakan Eriksson (hakanbe) o Thomas Lemaire o Anders Persson o Tobias Ringstrom o Jonas Samuelsson Contributors ------------ o Mattias Andersson o Kumar Appaiah o Francois Cayre o Zbigniew Dlugaszewski o Mark Dobossy o Sean Finney o Teddy Furon o Bjorn Furugard o Kenneth Hilmersson o Peter Klotz o Krister Norlund o Steve Peters o Gorka Prieto o Martin Senst o Svante Signell o Vasek Smidl o Erik Stoy o Tobias Tynderfeldt Distribution Maintainers ------------------------ o Kumar Appaiah - Debian o Gunter Dannoritzer (dannori) - openSUSE o Markus Dittrich - Gentoo Linux o Ed Hill (edhill) - Fedora Extras itpp-4.3.1/CMakeLists.txt000066400000000000000000000167551216575753400152700ustar00rootroot00000000000000# # \file CMakeLists.txt # \brief main cmake configuration file # \author Bogdan Cristea # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- cmake_minimum_required ( VERSION 2.8.6 ) set ( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/ ${CMAKE_MODULE_PATH} ) project(ITPP) #check for BLAS library find_package ( BLAS ) if (BLAS_FOUND) if (BLA_VENDOR MATCHES "^ACML") set (HAVE_ACML 1)#TODO: for Windows only set (HAVE_BLAS_ACML 1) set (HAVE_BLAS 1) elseif (BLA_VENDOR MATCHES "^Intel") set (HAVE_MKL 1)#TODO: for Windows only set (HAVE_BLAS_MKL 1) set (HAVE_BLAS 1) elseif (BLA_VENDOR MATCHES "^ATLAS") set (HAVE_BLAS_ATLAS 1) set (HAVE_BLAS 1) elseif( (BLA_VENDOR STREQUAL "Generic") OR (BLA_VENDOR STREQUAL "All") ) set (HAVE_BLAS 1) else() message (WARNING "Unknown BLAS vendor: ${BLA_VENDOR}") set(BLAS_FOUND FALSE) endif() endif(BLAS_FOUND) #check for LAPACK library find_package ( LAPACK ) if (LAPACK_FOUND) if ((BLA_VENDOR MATCHES "^ACML") OR (BLA_VENDOR MATCHES "^Intel") OR (BLA_VENDOR MATCHES "^ATLAS") OR ( BLA_VENDOR STREQUAL "Generic" ) OR (BLA_VENDOR STREQUAL "All")) set (HAVE_LAPACK 1) else() message (WARNING "Unknown LAPACK vendor: ${BLA_VENDOR}") set(LAPACK_FOUND FALSE) endif() endif(LAPACK_FOUND) #check for FFT library find_package ( FFT ) if (FFT_FOUND) if (FFT_VENDOR MATCHES "^ACML") set (HAVE_FFT_ACML 1) set (HAVE_FFT 1) elseif (FFT_VENDOR MATCHES "^Intel") set (HAVE_FFT_MKL 1) set (HAVE_FFT 1) elseif (FFT_VENDOR MATCHES "^FFTW3") set (HAVE_FFTW3 1) set (HAVE_FFT 1) else() message (WARNING "Unknown FFT vendor: ${FFT_VENDOR}") set(FFT_FOUND FALSE) endif() endif(FFT_FOUND) #check for OpenMP support find_package ( OpenMP ) if (OPENMP_FOUND) set (CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS} ${CMAKE_CXX_FLAGS}") if (MINGW) set (CMAKE_SHARED_LINKER_FLAGS "${OpenMP_CXX_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") endif() endif() #check for Doxygen and LaTeX find_package ( Doxygen ) find_package ( LATEX ) #check for header files include ( CheckIncludeFile ) include ( CheckIncludeFiles ) CHECK_INCLUDE_FILES ( "sys/time.h;time.h" TIME_WITH_SYS_TIME ) CHECK_INCLUDE_FILE ( "dlfcn.h" HAVE_DLFCN_H ) CHECK_INCLUDE_FILE ( "ieeefp.h" HAVE_IEEEFP_H ) CHECK_INCLUDE_FILE ( "inttypes.h" HAVE_INTTYPES_H ) CHECK_INCLUDE_FILE ( "memory.h" HAVE_MEMORY_H ) CHECK_INCLUDE_FILE ( "stdint.h" HAVE_STDINT_H ) CHECK_INCLUDE_FILE ( "stdlib.h" HAVE_STDLIB_H ) CHECK_INCLUDE_FILE ( "strings.h" HAVE_STRINGS_H ) CHECK_INCLUDE_FILE ( "string.h" HAVE_STRING_H ) CHECK_INCLUDE_FILE ( "sys/stat.h" HAVE_SYS_STAT_H ) CHECK_INCLUDE_FILE ( "sys/types.h" HAVE_SYS_TYPES_H ) CHECK_INCLUDE_FILE ( "unistd.h" HAVE_UNISTD_H ) include ( CheckIncludeFileCXX ) CHECK_INCLUDE_FILE_CXX ( "cmath" HAVE_CMATH ) CHECK_INCLUDE_FILE_CXX ( "complex" HAVE_COMPLEX ) #check for symbols include (CheckCXXSymbolExists) CHECK_CXX_SYMBOL_EXISTS ( isfinite "cmath" HAVE_DECL_ISFINITE ) CHECK_CXX_SYMBOL_EXISTS ( isinf "cmath" HAVE_DECL_ISINF ) CHECK_CXX_SYMBOL_EXISTS ( isnan "cmath" HAVE_DECL_ISNAN ) CHECK_CXX_SYMBOL_EXISTS ( signgam "cmath" HAVE_DECL_SIGNGAM ) #check for functions set(CMAKE_REQUIRED_LIBRARIES m) include (CheckFunctionExists) CHECK_FUNCTION_EXISTS ( acosh HAVE_ACOSH ) CHECK_FUNCTION_EXISTS ( asinh HAVE_ASINH ) CHECK_FUNCTION_EXISTS ( atanh HAVE_ATANH ) CHECK_FUNCTION_EXISTS ( cbrt HAVE_CBRT ) CHECK_FUNCTION_EXISTS ( erf HAVE_ERF ) CHECK_FUNCTION_EXISTS ( erfc HAVE_ERFC ) CHECK_FUNCTION_EXISTS ( expm1 HAVE_EXPM1 ) CHECK_FUNCTION_EXISTS ( finite HAVE_FPCLASS ) CHECK_FUNCTION_EXISTS ( fpclass HAVE_FPCLASS ) CHECK_FUNCTION_EXISTS ( isfinite HAVE_ISFINITE ) CHECK_FUNCTION_EXISTS ( isinf HAVE_ISINF ) CHECK_FUNCTION_EXISTS ( isnan HAVE_ISNAN ) CHECK_FUNCTION_EXISTS ( lgamma HAVE_LGAMMA ) CHECK_FUNCTION_EXISTS ( log1p HAVE_LOG1P ) CHECK_FUNCTION_EXISTS ( log2 HAVE_LOG2 ) CHECK_FUNCTION_EXISTS ( rint HAVE_RINT ) CHECK_FUNCTION_EXISTS ( tgamma HAVE_TGAMMA ) include (CheckCXXFunctionExists) CHECK_CXX_FUNCTION_EXISTS ( std::isfinite HAVE_STD_ISFINITE ) CHECK_CXX_FUNCTION_EXISTS ( std::isinf HAVE_STD_ISINF ) CHECK_CXX_FUNCTION_EXISTS ( std::isnan HAVE_STD_ISNAN ) #package related variables set (PACKAGE "itpp") set (PACKAGE_BUGREPORT "http://sourceforge.net/projects/itpp/forums/forum/115656") set (PACKAGE_NAME "IT++") set (PACKAGE_VERSION "4.3.1") set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set (PACKAGE_TARNAME ${PACKAGE}) set (PACKAGE_URL "") if (UNIX) EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE PACKAGE_DATE) string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" PACKAGE_DATE "${PACKAGE_DATE}") else() set(PACKAGE_DATE "") endif() if (WIN32 AND NOT MINGW) #TODO: remove this from future versions CONFIGURE_FILE ( ${CMAKE_SOURCE_DIR}/itpp/config.h.cmake ${CMAKE_BINARY_DIR}/itpp/config_msvc.h ) else() CONFIGURE_FILE ( ${CMAKE_SOURCE_DIR}/itpp/config.h.cmake ${CMAKE_BINARY_DIR}/itpp/config.h ) endif() #set library type: shared or static option(ITPP_SHARED_LIB "Building IT++ as shared library" on) #set library name here to be available for all targets if (ITPP_SHARED_LIB) if ((CMAKE_BUILD_TYPE STREQUAL Release) OR (NOT CMAKE_BUILD_TYPE)) set (libitpp_target itpp) set (CMAKE_CXX_FLAGS "-DNDEBUG ${CMAKE_CXX_FLAGS}") else() set (libitpp_target itpp_debug) endif() else() set (libitpp_target itpp_static) endif() CONFIGURE_FILE (${CMAKE_SOURCE_DIR}/itpp/itexports.h.cmake ${CMAKE_BINARY_DIR}/itpp/itexports.h) #build HTML docs option(HTML_DOCS "Building HTML documentation with Doxygen if available" on) #display summary set(DISP_GENERIC_WARNING FALSE) if (NOT BLAS_FOUND) message(WARNING "BLAS library not found.") set(DISP_GENERIC_WARNING TRUE) endif() if (NOT LAPACK_FOUND) message(WARNING "LAPACK library not found.") set(DISP_GENERIC_WARNING TRUE) endif() if (NOT FFT_FOUND) message(WARNING "FFT library not found.") set(DISP_GENERIC_WARNING TRUE) endif() if (DISP_GENERIC_WARNING) message(WARNING "You can still compile IT++ but the functionality will be reduced.") else() message(STATUS "BLAS vendor: ${BLA_VENDOR}") endif() #set external link libraries set(ITPP_LIBS "") if (BLAS_LIBRARIES) set(ITPP_LIBS ${BLAS_LIBRARIES} ${ITPP_LIBS}) endif() if (LAPACK_LIBRARIES) set(ITPP_LIBS ${LAPACK_LIBRARIES} ${ITPP_LIBS}) endif() if (FFT_LIBRARIES) set(ITPP_LIBS ${FFT_LIBRARIES} ${ITPP_LIBS}) endif() #add it++ sources add_subdirectory ( itpp ) #add unit tests option(OLD_TESTS "Building old unit tests (no longer maintained). Use extras/check_tests.py script to run the tests." off) if (OLD_TESTS) add_subdirectory ( tests ) endif() if (GTEST_DIR) add_subdirectory (gtests) endif() itpp-4.3.1/COPYING000066400000000000000000001045131216575753400135510ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . itpp-4.3.1/ChangeLog000066400000000000000000000262401216575753400142700ustar00rootroot000000000000002013-07-04 Bogdan Cristea * cmake/Modules/FindBLAS.cmake, cmake/Modules/FindLAPACK.cmake, doc/local/installation.doc: add support for detecting itpp-external compiled as static libraries 2013-07-03 Bogdan Cristea * doc/local/installation.doc: add install instructions with cmake using external libraries without being root 2013-06-16 Bogdan Cristea * itpp.pc.cmake.in, itpp/CMakeLists.txt: generate and install itpp.pc 2013-06-02 Andy Panov * itpp/base/math/log_exp.h pow2 overloads for integer arguments added. 2013-05-24 Bogdan Cristea * CMakeLists.txt, itpp-config.cmake.in, itpp/CMakeLists.txt: add configuration script generation for UNIX-like systems (bug #221) 2013-05-24 Bogdan Cristea * doc/local/authors.doc, doc/local/index.doc.in, doc/local/installation.doc, doc/local/test.doc, doc/local/verification.doc: documentation updates 2013-05-24 Andy Panov * itpp/srccode/audiofile.cpp, itpp/srccode/audiofile.h, itpp/srccode/audiosample.h, gtests/audiofile_test.cpp: itpp/base/binfile.h, itpp/base/binfile.cpp refactoring of audio streams. 2013-05-24 Bogdan Cristea * CMakeLists.txt, doc/local/installation.doc, gtests/commfunc_test.cpp, gtests/vec_test.cpp, itpp/CMakeLists.txt: corrections for cygwin and mingw 2013-05-23 Bogdan Cristea * itpp/base/itfile.cpp, itpp/base/parser.cpp, itpp/base/vec.cpp, itpp/itexports.h.cmake, itpp/protocol/events.h, itpp/protocol/front_drop_queue.h, itpp/protocol/packet.h, itpp/protocol/packet_channel.h, itpp/protocol/packet_generator.h, itpp/protocol/selective_repeat.h, itpp/protocol/signals_slots.h, itpp/protocol/tcp.h, itpp/srccode/audiofile.h: corrected shared library compilation with MSVC in debug mode 2013-05-23 Bogdan Cristea * itpp/signal/fastica.cpp: corrected bug #206 2013-05-22 Bogdan Cristea * gtests/fastmath_test.cpp, gtests/filter_design_test.cpp, gtests/filter_test.cpp, gtests/fix_test.cpp, gtests/freq_filt_test.cpp, gtests/galois_test.cpp, gtests/gf2mat_test.cpp, gtests/histogram_test.cppgtests/histogram_test.cpp, gtests/interleaver_test.cpp, gtests/inv_test.cpp, gtests/ldpc_test.cpp, gtests/linspace_test.cppgtests/linspace_test.cpp, gtests/llr_test.cpp, gtests/ls_solve_test.cpp, gtests/lu_test.cpp, gtests/mat_test.cpp, gtests/matfunc_test.cpp, gtests/modulator_nd_test.cpp, gtests/modulator_test.cpp, gtests/newton_search_test.cpp, gtests/operators_test.cpp, gtests/parser_test.cpp, gtests/poly_test.cpp, gtests/pulse_shape_test.cpp, gtests/qr_test.cpp, gtests/rec_syst_conv_code_test.cpp, gtests/reedsolomon_test.cpp, gtests/schur_test.cpp, gtests/sigfun_test.cpp, gtests/siso_test.cpp, gtests/sort_test.cpp, gtests/source_test.cpp, gtests/sparse_test.cpp, gtests/specmat_test.cpp, gtests/stat_test.cpp, gtests/stc_test.cpp, gtests/svd_test.cpp, gtests/timer_test.cpp, gtests/turbo_test.cpp, gtests/vec_test.cpp, gtests/window_test.cpp: ported all unit tests to Google framework. Old tests are obsolete and will be no longer maintained. 2013-04-16 Andy Panov * itpp/srccode/g711.cpp, itpp/srccode/g711.h, itpp/itsrccode.h, gtests/g711_test.cpp: G.711 audio codecs implementation is added 2013-04-09 Bogdan Cristea * itpp/base/random.cpp, itpp/base/random.h: fix thread-safety issue in Gamma_RNG, thanks to Andy Panov for providing the patch 2013-04-09 Bogdan Cristea * doc/local/installation.doc, itpp/signal/transforms.cpp: updated installation instructions and corrected FFT bug when using MKL 11 (thanks to Andy Panov for providing the patch) 2013-04-07 Bogdan Cristea * cmake/Modules/FindBLAS.cmake, cmake/Modules/FindFFT.cmake, cmake/Modules/FindLAPACK.cmake, itpp/base/algebra/lapack.h, itpp/signal/transforms.cpp: add support for MKL 11, FFT transform does not work 2013-04-06 Bogdan Cristea * itpp/itexports.h.cmake: corrected regression that generates error when compiling as static library on UNIX systems 2013-04-05 Bogdan Cristea * gtests/multilateration_test.cpp, itpp/comm/multilateration.cpp, itpp/comm/multilateration.h, itpp/itcomm.h: add Multilateration class for indoor localization 2013-04-02 Bogdan Cristea * gtests/CMakeLists.txt, gtests/bch_test.cpp, gtests/itfile_test.cpp, itpp/base/base_exports.h, itpp/base/binfile.cpp, itpp/base/binfile.h, itpp/base/gf2mat.h, itpp/base/itfile.cpp, itpp/base/itfile.h, itpp/comm/channel.h, itpp/comm/convcode.h, itpp/comm/crc.h, itpp/comm/egolay.h, itpp/comm/galois.h, itpp/comm/hammcode.h, itpp/comm/ldpc.h, itpp/comm/llr.h, itpp/comm/modulator.h, itpp/comm/modulator_nd.h, itpp/comm/punct_convcode.h, itpp/comm/rec_syst_conv_code.h, itpp/comm/sequence.h, itpp/comm/siso.h, itpp/comm/spread.h, itpp/comm/stc.h, itpp/comm/turbo.h, itpp/itbase.h, itpp/optim/newton_search.h, itpp/stat/mog_diag_kmeans.h, itpp/stat/mog_generic.h: binfile and itfile classes have been rewritten in order to be exportable from shared library build with MSVC. Some code refactoring has been done. Thanks to Andy Panov for providing the patch. 2013-03-10 Bogdan Cristea * CMakeLists.txt, doc/local/installation.doc, doc/tutorial/src/pccc_bersim_awgn.cpp, doc/tutorial/src/sccc_bersim_awgn.cpp, doc/tutorial/src/stbicm.cpp, doc/tutorial/src/turbo_equalizer_bersim_multipath.cpp, gtests/exit_test.cpp, itpp/CMakeLists.txt, itpp/base/algebra/cholesky.h, itpp/base/algebra/det.h, itpp/base/algebra/eigen.h, itpp/base/algebra/inv.h, itpp/base/algebra/ls_solve.h, itpp/base/algebra/lu.h, itpp/base/algebra/qr.h, itpp/base/algebra/schur.h, itpp/base/algebra/svd.h, itpp/base/bessel.h, itpp/base/binary.h, itpp/base/binfile.h, itpp/base/converters.cpp, itpp/base/converters.h, itpp/base/copy_vector.h, itpp/base/factory.h, itpp/base/fastmath.h, itpp/base/gf2mat.h, itpp/base/help_functions.cpp, itpp/base/help_functions.h, itpp/base/itassert.h, itpp/base/itfile.h, itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/matfunc.cpp, itpp/base/matfunc.h, itpp/base/math/elem_math.h, itpp/base/math/error.h, itpp/base/math/integration.h, itpp/base/math/log_exp.h, itpp/base/math/misc.h, itpp/base/math/trig_hyp.h, itpp/base/operators.h, itpp/base/parser.h, itpp/base/random.h, itpp/base/random_dsfmt.h, itpp/base/smat.cpp, itpp/base/smat.h, itpp/base/specmat.cpp, itpp/base/specmat.h, itpp/base/svec.cpp, itpp/base/svec.h, itpp/base/timing.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/comm/bch.h, itpp/comm/channel.cpp, itpp/comm/channel.h, itpp/comm/channel_code.h, itpp/comm/commfunc.h, itpp/comm/convcode.h, itpp/comm/crc.h, itpp/comm/egolay.h, itpp/comm/error_counters.h, itpp/comm/exit.cpp, itpp/comm/exit.h, itpp/comm/galois.cpp, itpp/comm/galois.h, itpp/comm/hammcode.h, itpp/comm/interleave.cpp, itpp/comm/interleave.h, itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, itpp/comm/llr.h, itpp/comm/modulator.cpp, itpp/comm/modulator.h, itpp/comm/modulator_nd.cpp, itpp/comm/modulator_nd.h, itpp/comm/ofdm.h, itpp/comm/pulse_shape.cpp, itpp/comm/pulse_shape.h, itpp/comm/punct_convcode.h, itpp/comm/rec_syst_conv_code.h, itpp/comm/reedsolomon.h, itpp/comm/sequence.h, itpp/comm/siso.h, itpp/comm/siso_dem.cpp, itpp/comm/siso_eq.cpp, itpp/comm/siso_mud.cpp, itpp/comm/siso_nsc.cpp, itpp/comm/siso_rsc.cpp, itpp/comm/spread.h, itpp/comm/stc.cpp, itpp/comm/stc.h, itpp/comm/turbo.cpp, itpp/comm/turbo.h, itpp/fixed/cfix.h, itpp/fixed/cfixed.cpp, itpp/fixed/cfixed.h, itpp/fixed/fix.h, itpp/fixed/fix_base.h, itpp/fixed/fix_factory.h, itpp/fixed/fix_functions.h, itpp/fixed/fix_operators.h, itpp/fixed/fixed.cpp, itpp/fixed/fixed.h, itpp/itexports.h.cmake, itpp/optim/newton_search.h, itpp/protocol/events.h, itpp/protocol/front_drop_queue.h, itpp/protocol/packet.h, itpp/protocol/packet_channel.h, itpp/protocol/packet_generator.h, itpp/protocol/selective_repeat.h, itpp/protocol/signals_slots.h, itpp/protocol/tcp.h, itpp/protocol/tcp_client_server.h, itpp/signal/fastica.h, itpp/signal/filter.cpp, itpp/signal/filter.h, itpp/signal/filter_design.h, itpp/signal/freq_filt.cpp, itpp/signal/freq_filt.h, itpp/signal/poly.h, itpp/signal/resampling.cpp, itpp/signal/resampling.h, itpp/signal/sigfun.h, itpp/signal/source.h, itpp/signal/transforms.cpp, itpp/signal/transforms.h, itpp/signal/window.h, itpp/srccode/audiofile.h, itpp/srccode/gmm.h, itpp/srccode/lpcfunc.h, itpp/srccode/pnm.h, itpp/srccode/vq.h, itpp/srccode/vqtrain.h, itpp/stat/misc_stat.h, itpp/stat/mog_diag.h, itpp/stat/mog_diag_em.h, itpp/stat/mog_diag_kmeans.h, itpp/stat/mog_generic.h, tests/CMakeLists.txt, tests/exit_test.cpp, tests/itfile_test.cpp, tests/siso_test.cpp: add support for shared library using MS Visual Studio (feature request #84). Thanks to Andy Panov for providing the patch. The following classes are not exported in the shared library: audiofile, gf2mat, binfile, itfile, packet_generator, signals_slots, front_drop_queue, tcp_client_server, packet, selective_repeat, tcp, events, packet_channel. Note that some minor changes and code refactoring were also needed. 2013-01-21 Bogdan Cristea * CMakeLists.txt, itpp/CMakeLists.txt, itpp/itexports.h.cmake: add itexports.h for exporting/importing IT++ library symbols when compiled as shared library on Visual Studio C++. 2013-01-20 Bogdan Cristea * gtests/integration_test.cpp, itpp/base/help_functions.h, itpp/base/math/integration.cpp, itpp/base/math/integration.h: add numerical integration with function objects as integrands. Thanks to Andy Panov for providing the patch. 2013-01-19 Bogdan Cristea * CMakeLists.txt, doc/local/installation.doc, doc/tutorial/src/CMakeLists.txt, extras/setenv.bat, gtests/CMakeLists.txt, gtests/bch_test.cpp, gtests/bessel_test.cpp, gtests/blas_test.cpp, gtests/channel_test.cpp, gtests/cholesky_test.cpp, gtests/circular_buffer_test.cpp, gtests/commfunc_test.cpp, gtests/convcode_test.cpp, gtests/converters_test.cpp, gtests/demapper_test.cpp, gtests/det_test.cpp, gtests/eigen_test.cpp, gtests/error_count_test.cpp, gtests/exit_test.cpp, gtests/fastica_test.cpp, gtests/fastica_test_data.txt, gtests/itfile_test_data.it, gtests/parser_test_data.txt, gtests/rand_test.cpp, itpp/CMakeLists.txt: add more unit tests using Google framework. Add options for compiling unit tests, for building shared or static library and for generating the HTML help. 2013-01-12 Bogdan Cristea * doc/doxygen_html.cfg.cmake.in, itpp/CMakeLists.txt, itpp/base/parser.cpp, tests/modulator_nd_test.cpp: corrected compilation errors with MS Visual Studio 2010 2013-01-12 Bogdan Cristea * gtests/transforms_test.cpp, itpp/signal/transforms.cpp, itpp/signal/transforms.h: add thread-safe Fourier and cosine transforms. Thanks to Andy Panov for providing the patch (feature request #92). itpp-4.3.1/ChangeLog-2005000066400000000000000000000511611216575753400146540ustar00rootroot000000000000002005-12-29 Adam Piatyszek * NEWS, configure.ac, doc/local/index.doc.in: Updated for the future release * itpp.spec.in: Minor fixes ============================================================================== 2005-12-28 Adam Piatyszek * IT++ 3.9.0 released (CVS tag: release-3-9-0) 2005-12-28 Adam Piatyszek * itpp/base/mat.h, itpp/base/vec.h: Added a `value_type' typedef, which provides a similar notation to the std::vector<> class. Requested by Christian Stimming in patch report [1387075]. * doc/local/index.doc.in: `https://' links changed to `http://' ones * itpp/base/parser.cpp: Implemented feature request [1167378]. An error message is displayed if the Parser's init() functions can not open a file. * extras/itload.m, extras/itsave.m, extras/Makefile.am, Makefile.am, configure.ac: Added missing `itload.m' and `itsave.m' files for loading and saving an itfile in Matlab/Octave (function and file names changed from `load_it.m' and `save_it.m'). 2005-12-23 Adam Piatyszek * README, doc/local/index.doc.in: Introduction text updated * itpp.spec.in: Initial spec file prepared. Not yet included in the package. * itpp.pc.in: Cosmetic changes * doc/local/verification.doc: Updated with new information from testers * NEWS: Updated to reflect recent changes * itpp/base/transforms.cpp, tests/transforms_test.ref: Fixed bug [1388024]. Both versions of fft_real() and ifft_real() functions (based on FFTW3 and MKL) worked differently than the reference Matlab's fft()/ifft() functions. It seems to be fixed now, but an additional code overhead was added. 2005-12-22 Erik G. Larsson * tests/gf2mat_test.cpp: New short test program for GF2mat class 2005-12-22 Adam Piatyszek * tests/*.cpp, tests/*.ref: Fixed some of the test programs when IT++ uses the MKL. Real IFFT function gives incorrect results for MKL!!! * configure.ac: Updated version number to the upcomming final 3.9.0 release * doc/local/index.doc.in: Added "What's New" links to the NEWS and ChangeLog files in the CVS * Makefile.am, doc/Makefile.am: Added `disthtml' target for preparing packages with HTML documentation * doc/sourceforge/howto_release_itpp.html: Updated the documentation ============================================================================== 2005-12-21 Adam Piatyszek * IT++ 3.9.0-rc2 released (CVS tag: release-3-9-0-rc2) 2005-12-21 Adam Piatyszek * doc/local/index.doc.in: Relative URL address replaced with a full one * itpp/config_msvc.h: Updated due to recent modifications of the configure.ac file. Undefined HAVE_CBLAS, HAVE_FFTW and HAVE_LAPACK, since HAVE_MKL is defined. * itpp/comm/error_counters.cpp, itpp/comm/error_counters.h: Changed `long' to `int', since they have the same size on most 32-bit platforms. Fixed bugs in `if' statements (lack of casting to `short'). * NEWS: Updated to include recent changes * configure.ac: Updated version number and fixed header files' checks * itpp/base/binfile.cpp, itpp/base/timing.cpp, itpp/comm/modulator.cpp: Updated include statements due to `configure.ac' changes * doc/local/verification.doc: Updated according to the latest test * tests/turbo_test.cpp: Minor fix and cosmetic changes * TODO: Updated to include recent changes * itpp/protocol/packet.h, itpp/protocol/selective_repeat.h: Removed unnecessary include preprocessor commands * itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h, itpp/base/scalfunc.cpp, itpp/base/scalfunc.h: Added `round_to_zero()' function, which rounds arguments below a certain threshold to zero. This function is useful for test programs. * tests/Makefile.am: Reverted to revision 1.7 * tests/*.cpp, tests/*.ref: Updated test programs to make them robust for precision differences on various platforms. 2005-12-20 Adam Piatyszek * tests/Makefile.am: Added support for redesigned tests, which should be more robust to negligible precison errors, ie. plus/minus zero. * tests/pulse_shape_test2.cpp, tests/pulse_shape_test2.ref: Redesined tests of pulse shaping classes added. * itpp/comm/error_counters.cpp, itpp/comm/error_counters.h: Error and correct bit/packet counters are now of `double' type instead of `long'. * configure.ac, itpp/base/lapack.h: Fixed bug [1385960]. Although the MKL library was detected properly, the IT++ compilation failed on files that use `itpp/base/lapack.h'. The patch attached to the bug-report fixes this problem. 2005-12-19 Adam Piatyszek * itpp/base/specmat.cpp, itpp/base/specmat.h: Cosmetic changes - removed e-mail address and updated author's info * doc/sourceforge/howto_release_itpp.html: Source of the "How to release a new version of IT++" documentation added ============================================================================== 2005-12-18 Adam Piatyszek * IT++ 3.9.0-rc1 released (CVS tag: release-3-9-0-rc1) 2005-12-18 Adam Piatyszek * NEWS: Updated for itpp-3.9.0 release * configure.ac, doc/doxygen_html.cfg.in, doc/local/index.doc.in, doc/local/sources.mk: Changed the HTML main page to automatically update the download links based on the PACKAGE_VERSION. 2005-12-16 Adam Piatyszek * configure.ac, Makefile.am, INSTALL, doc/local/installation.doc: Changed the name of the switch `--disable-html-docs' into `--disable-html-doc' 2005-12-16 Tony Ottosson * itpp/base/specmat.{h,cpp}: Added real Toeplitz matrices using the function toeplitz(mat, mat). Generalized also to be valid for non-square matrices. 2005-12-16 Adam Piatyszek * itpp/comm/channel.cpp, itpp/comm/channel.h: Interface of function `set_channel_profile_exponential' changed. Function still not implemented. * doc/local/installation.doc: Minor cosmetic changes in the MSVC++ and MKL part 2005-12-15 Thomas Eriksson * Updated the documentation on IT++ and MKL setup for MSVC++. * Function `kurtosis' renamed to `kurtosisexcess' for MATLAB compability and conformance to literature. A new function `kurtosis' is defined. 2005-12-15 Adam Piatyszek * itpp/base/scalfunc.cpp, itpp/base/source.cpp, itpp/base/timing.cpp: Minor cosmetic changes (math.h -> cmath; 3.1415 -> pi) * Makefile.am, itpp/Makefile.am: Added missing filenames to EXTRA_DIST 2005-12-14 Thomas Eriksson * itpp.sln, itpp.vcproj, itpp/config_msvc.h: Changes and additions for compability with Microsoft Visual C++ (MSVC) 2005-12-13 Adam Piatyszek * Created lists of source files in `sources.mk' files, which are included by `Makefile.am' files. This solves the problem of doubled dependency information in `doc/Makefile.am'. * doc/local/documentation.doc: Some minor fixes in the code examples * doc/local/itpp_header.html: Added `tabs.css' stylesheet compatible with Doxygen 1.4.5 * itpp.pc.in: Fixed a typo in the URL address * itpp/comm/error_counters.cpp: Fixed incorrect order in BLERC constructor's initialisation list 2005-12-12 Adam Piatyszek * itpp/itconfig.h: Doxygen modules moved from `alpha_modules.h' into this file * itpp/Makefile.am, doc/Makefile.am, doc/doxygen_html.cfg.in: Minor updates in lists of `*.h' and `*.cpp' sources * tests/filter_design_test.ref, tests/poly_test.ref: Added missing reference files * tests/filter_design_test.cpp: `NO_LAPACK' and `NO_CBLAS' definitions replaced with `HAVE_LAPACK' and `HAVE_CBLAS' * doc/Makefile.am: Updated with new files 2005-12-12 Tony Ottosson * itpp/base/matfunc.h: Added functions is_hermitian() and is_unitary() contributed by M. Szalay 2005-12-07 Tony Ottosson * itpp/base/poly.{h,cpp}: New files added with support for polynomials. For now poly(), polyval(), and roots(). * itpp/base/filter_design.{h,cpp}: New files added with support for filter design. For now only polystab() and freqz(). * itpp/itbase.h: Updated includes with new files * itpp/base/Makefile.am: Updated with new files * itpp/tests/{poly_test.cpp,filter_design_test.cpp}: New test files * itpp/tests/Makefile.am: Updated with new files 2005-12-07 Tony Ottosson * itpp/base/matfunc.{h,cpp}: diag() now takes a second argument stating which diagonal to fill with values (matlab compatible). 2005-12-07 Tony Ottosson * itpp/protocol/{events.h,signals_slots.h}: Documentation updates 2005-11-30 Adam Piatyszek * itpp/base/itfile.cpp: Fixed bug [1333897]. The problem with infinite loop in `it_file::seek(...)' function has been solved by fixing `it_file::write_data_header(...)' function. See the bug report for more details. Thanks to Bjorn Furugard (luminosity) for having reported this problem and solution for it. 2005-11-25 Adam Piatyszek * itpp/base/gf2mat.{h,cpp}: Added `namespace itpp'. Fixed improper way of including header files. File comments addapted to the IT++ standard. * itpp/itbase.h: Included `gf2mat.h'. * tests/Makefile.am: Commented out gf2mat_test program, since it is prepared in a different way than the standard IT++ testing programs. 2005-11-23 Adam Piatyszek * itpp/comm/channel.cpp: Fixed two minor bugs in COST channels' specifications 2005-11-23 Erik Larsson * itpp/base/gf2mat.{h,cpp}: Added a new GF2 matrix module * tests/gf2mat_test.cpp: added a test program for GF2 matrix module 2005-11-23 Adam Piatyszek * configure.ac: Removed some cpu-specific optimise flags from CXXFLAGS. The default optimisation is `-O2'. When using GCC compiler CXXFLAGS is extended with `-pipe -fomit-frame-pointer'. Moreover, `--with-cpu' switch has been renamed to `--with-march', which is more intuitive. * INSTALL, doc/local/installation.doc: Documentation updated due to the changes in `configure.ac'. 2005-11-18 Adam Piatyszek * itpp/comm/error_counters.{h.cpp}: Fixed a bug in the BLERC counter, which caused that errors were not measured if the blocksize was longer then the minimum length of input bit vectors. Cosmetics changes in the BERC class. 2005-11-17 Adam Piatyszek * itpp/comm/punct_convcode.{h,cpp}, itpp/comm/convcode.h: Fixed bug [1358858]. Now it is possible to use decode_tailbite() method for a punctured code. * itpp/comm/channel.{h,cpp}: Fixed bug [1358861]. Now the destructor properly deletes the fading generators dynamically created. 2005-11-11 Adam Piatyszek * itpp/comm/error_counters.{h,cpp}: BLERC class improved by adding setup and clear flags and non default constructor. Now it is possible to measure BLER for changing block sizes, e.g. in an adaptive transmission. 2005-11-10 Adam Piatyszek * itpp/comm/channel.cpp: Fixed a minor problem with documentation parsing by Doxygen (added a few lacking parentheses) 2005-10-17 Adam Piatyszek * Makefile.common: AM_CPPFLAGS fixed to support building in a separate directory (required by rpm-build) 2005-10-16 Adam Piatyszek * doc/local/*.doc: Documentation files updated in order to release version 3.9.0 2005-10-14 Adam Piatyszek * configure.ac: Fixed a bug with ATLAS/BLAS library detection * doc/local/installation.doc: Description updated to reflect recent changes in configuration process * itpp/*/*.{h,cpp}: Cosmetic changes in copyright notes 2005-10-13 Adam Piatyszek * configure.ac: Fixed a problem with linking when using gcc-4.0.x with its gfortran compiler (tested on SuSE 10.0) * configure.ac: Fixed a bug with proper detection of FFTW and LAPACK libraries when neither ATLAS nor CBLAS is installed 2005-10-12 Adam Piatyszek * itpp/base/stat.h: Added `within_tolerance' function for double and complex arguments and fixed minor documentation errors 2005-09-26 Johan Bergman * Fixed bug [1302350]. Corrected behavior of operator<< in itpp/itconfig.h when the imaginary part equals "minus zero". 2005-09-21 Adam Piatyszek * test/Makefile.am: Fixed testing routine execution parameters - there is no `-q' option of diff on Solaris 5.9 2005-09-16 Adam Piatyszek * tests/turbo_test.cpp: Added `using namespace std' statement * itpp/comm/turbo.*, itpp/comm/rec_syst_conv_code.*: Fixed minor bug (string -> std::string) * itpp/*/*.{h,cpp}: File descriptions and copyright notes updated 2005-09-15 Adam Piatyszek * TODO: Updated to reflect recent changes * configure.ac, Makefile.common: Now $FLIBS are not added to default $LIBS, but set as $AM_LDFLAGS * Added autoheader file `itpp/config.h' that collects all DEFS used in the project * COPYING: Updated with pure GPL2 license text * itpp/base/*.{h,cpp}: File descriptions and copyright notes updated * configure.ac: `--enable-pedantic' switch removed 2005-09-15 Tony Ottosson * itpp/base/itfile.{h,cpp}: Changed exceptions into it_error. it_ifile::seek(string) now returns bool indicating if the variable is found. 2005-09-14 Tony Ottosson * itpp/comm/ofdm.cpp: Fixed bug on line 45, sqrt() should be std::sqrt() * Added the functions within_tolerance(x, xref, tol) in stat.h 2005-09-01 Adam Piatyszek * Removed unnecessary `tests/plot_pdf_test.{cpp,ref}' files after libharu removal 2005-08-31 Adam Piatyszek * Support for libharu removed definitely. Documentation updated to remove references to libharu. * autogen.sh: Script modifications based on autogen.sh from Gaim project * TODO list updated 2005-08-30 Adam Piatyszek * AUTHORS: Updated developer's list * COPYING: Converted from UTF-8 to ASCII; GNU GPL-2 license text updated 2005-08-29 Adam Piatyszek * itpp/graphics/Makefile.am, itpp/protocol/Makefile.am: Fixed small bugs in `*.cpp' source file listings 2005-08-27 Adam Piatyszek * itpp/comm/ofdm.cpp: Fixed a bug in the oversampling of the OFDM class (bugfix submitted by Thomas Eriksson) 2005-08-26 Adam Piatyszek * Fixed bug [1254814]. Added `itpp::' explicit scope for `it_assert_f', `it_warning_f' and `it_error_f' functions. Now the macros that use them work properly without `using namespace itpp' in the application file. 2005-08-25 Adam Piatyszek * configure.ac, doc/Makefile.am: `--with-docdir' option added to the configure script. This option can be used to decide where the html documentation will be installed. 2005-08-23 Adam Piatyszek * Added an implementation of error function erf(z) for complex argument z. This code is based on one unofficial octave function by John Smith . 2005-08-18 Tony Ottosson * Fixed bug for Vec<>::operator(const int, const int) changing input parameters. 2005-08-10 Adam Piatyszek * Fixed reopened bug [1094934]. Now endianity of x86_64 platforms can be successfully detected. 2005-08-04 Adam Piatyszek * Fixed bug [1251878]. `min' and `max' functions did not return indexes properly due to the lack of reference in functions' arguments. 2005-07-27 Adam Piatyszek * Fixed bug [1084246]. Operators and other functions in Vec, Mat and Array revised to follow standard C++ conventions. Now operators provide an lvalue and also check against self- assignment. 2005-07-22 Adam Piatyszek * configure.ac: Fixed a bug that prevented detection of nonstandard CBLAS and LAPACK libraries ($FLIBS has not been used where neccessary) 2005-07-21 Adam Piatyszek * configure.ac: Changed version number to `3.9.0' * doc/Makefile.am: Added dependencies for `html/index.html' rule * All instances of `"itpp/h_file.h"' replaced with `' * Added `using namespace itpp;' to the tutorial source files 2005-07-20 Adam Piatyszek * tests/pulse_shape_test.{cpp,ref}: Fixed different floating-point numbers' precision in `cout' output problem by using `setprecision()' manipulator * tests/Makefile.am: Cygwin's `.exe' extension problem in test programs' filenames * TODO updated 2005-07-19 Adam Piatyszek * INSTALL: Part of the doc/local/installation.doc modified file inserted before original GNU generic installation description * configure.ac: Added check for Dvips needed for HTML documentation generation * Added `tests' directory with IT++ library modules test programs. Some tests need to be revised and fixed, since failures occur. Testing is started with `make check' command and depends on `diff' program. 2005-07-18 Adam Piatyszek * configure.ac: Added check for Ghostscript needed for HTML documentation generation; configure output message extended with "Documentation tools:" * HAVE_DOT is now set to NO by default in doxygen configuration file * doc/local/installation.doc: Minor updates in the Requirements Section * autogen.sh: Removed --force option 2005-07-17 Adam Piatyszek * Fixed checks for documentation tools in configure.ac; now Doxygen and LaTeX are both required for HTML docs generation * Modified configure.ac checking rutines to provide detection of Cygwin's CBLAS library in it's lapack-3.0-2 package * Fixed a small documentation bug in itpp/itconfig.h 2005-07-16 Adam Piatyszek * Updated cblas.h and libharu.h header files to their latest stable versions (atlas-3.6.0, libharu-1.2.2) * Recursive processing of doxygen replaced with a fixed set of paths * doc/local/installation.doc, doc/local/index.doc: Documentation files updated 2005-07-13 Adam Piatyszek * Removed unnecessary config/acx_*.m4 macros * Imported Autoconf/Automake based IT++ library project sources into SourceForge CVS * Removed doc/doxygen_get_start.cfg.in * TODO list updated * configure.ac rewriten to provide Intel Math Kernel Library (MKL) detection * ITPP_FLAGS replaced by CXXFLAGS 2005-07-12 Adam Piatyszek * Added itpp-config script 2005-07-11 Adam Piatyszek * Fixed a bug in configure.ac by adding AC_LANG([C++]) 2005-07-08 Adam Piatyszek * HTML documentation generation method changed; now it is generated after library compilation by default, unless --disable-html-docs switch used * Extended configure output message * TODO list updated * Added --enable-pedantic and --with-cpu=CPU switches to configure.ac * Removed unnecessary AM_ENABLE_SHARED statement * Commented AM_MAINTAINER_MODE, since it might cause some dependency problems 2005-07-08 Adam Piatyszek * Updated libs and flags settings in configure.ac, Makefile.common and itpp.pc.in * Corrected some obsolete constructs by autoupdate (requires autoconf 2.59) 2005-07-07 Adam Piatyszek * Changed version number to 3.9.0 in configure.ac * Updated AUTHORS, ChangeLog, NEWS and TODO files * FFTW, HARU, CBLAS and LAPACK libraries checking rules rewriten to use --with-library[=name] or --without-library configure switches * Removed unnecessary Makefile.am in config subdirectory 2005-07-06 Adam Piatyszek * Updated documentation generation rules * Added uninstall-local rule for removing ${includedir}/itpp directory * Removed scripts generated by autotools 2005-07-05 Adam Piatyszek * Changed the way the documentation is generated using doxygen * Improved HTML header and footer of documentation webside itpp-4.3.1/ChangeLog-2006000066400000000000000000002402241216575753400146550ustar00rootroot000000000000002006-12-30 Adam Piatyszek * itpp/base/array.h, itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h: Improved the consistency of alloc(), free() and set_size() methods in Array, Mat and Vec classes. Further cosmetic changes of separating class interfaces from their implementation in these base classes. 2006-12-29 Adam Piatyszek * itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h: Cosmetic changes in order to separate class interfaces from implementation. BTW, private init() function replaced with initialisation list. * doc/Makefile.am, itpp/base/algebra/Makefile.am, itpp/base/algebra/sources.mk, itpp/base/bessel/Makefile.am, itpp/base/bessel/sources.mk: Removed "lapack.h" and "bessel_internal.h" from the list of installed headers. BTW, cleaned up the dependency list in the documentation Makefile. 2006-12-28 Adam Piatyszek * itpp/base/random.cpp, itpp/base/random.h, tests/bch_test.ref, tests/channel_test.ref, tests/cholesky_test.ref, tests/circular_buffer_test.ref, tests/convcode_test.ref, tests/det_test.ref, tests/eigen_test.ref, tests/fastica_test.ref, tests/filter_design_test.ref, tests/filter_test.ref, tests/histogram_test.ref, tests/interleaver_test.ref, tests/inv_test.ref, tests/ls_solve_test.ref, tests/lu_test.ref, tests/matfunc_test.ref, tests/mat_test.ref, tests/modulator_nd_test.ref, tests/modulator_test.ref, tests/poly_test.ref, tests/pulse_shape_test.ref, tests/qr_test.ref, tests/rand_test.ref, tests/reedsolomon_test.ref, tests/schur_test.ref, tests/sigfun_test.ref, tests/source_test.ref, tests/sparse_test.ref, tests/stat_test.ref, tests/svd_test.ref, tests/transforms_test.ref, tests/turbo_test.ref, tests/vec_test.ref, TODO: Updated Mersenne Twister random number generator sources to the latest version 1.0 published by Richard J. Wagner on 15th May, 2003. * configure.ac: Minor fix in CXXFLAGS_DEBUG settings. * doc/local/installation.doc, INSTALL: Minor documentation update. * itpp/base/math/min_max.h, itpp/base/math/sources.mk, itpp/base/svec.h, itpp/comm/channel.cpp, itpp/comm/modulator.h, itpp/itbase.h, itpp/itstat.h, itpp/protocol/packet_channel.cpp, itpp/signal/fastica.cpp, itpp/signal/freq_filt.h, itpp/srccode/vqtrain.cpp, itpp/stat/misc_stat.h, itpp/stat/sources.mk: Minimum and maximum functions moved back to the "base" module, because they are widely used in all modules. 2006-12-27 Adam Piatyszek * itpp/base/bessel/hyperg.cpp, itpp/base/bessel/iv.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/struve.cpp, itpp/base/matfunc.h, itpp/base/math/elem_math.cpp, itpp/base/math/elem_math.h, itpp/base/math/error.cpp, itpp/base/math/integration.cpp, itpp/base/math/sources.mk, itpp/base/random.cpp, itpp/base/sources.mk, itpp/base/specmat.cpp, itpp/comm/channel.h, itpp/comm/modulator.cpp, itpp/comm/modulator.h, itpp/comm/modulator_nd.cpp, itpp/itbase.h, itpp/signal/filter_design.cpp, itpp/signal/freq_filt.cpp, itpp/signal/freq_filt.h, itpp/signal/sigfun.cpp, itpp/signal/transforms.cpp, itpp/srccode/gmm.cpp, itpp/stat/misc_stat.h: Moved elementary mathematical functions into the "math" group under the "base" module. * itpp/srccode/pnm.cpp, itpp/srccode/pnm.h: Exception handling commands replaced with "it_error()" macros. * configure.ac, itpp/base/itassert.cpp: Added GCC specific "-fno-exceptions" flag to CXXFLAGS_OPT and CXXFLAGS_DEBUG when "--enable-exceptions" is not used. * configure.ac, itpp/base/sources.mk, itpp/base/specmat.cpp, itpp/base/svec.h, itpp/comm/channel.cpp, itpp/comm/convcode.cpp, itpp/comm/modulator.h, itpp/comm/spread.cpp, itpp/fixed/fix_base.h, itpp/itbase.h, itpp/itstat.h, itpp/Makefile.am, itpp/optim/newton_search.cpp, itpp/protocol/packet_channel.cpp, itpp/signal/fastica.cpp, itpp/signal/freq_filt.h, itpp/signal/sigfun.cpp, itpp/sources.mk, itpp/srccode/lpcfunc.cpp, itpp/srccode/vqtrain.cpp, itpp/stat/histogram.h, itpp/stat/min_max.h, itpp/stat/misc_stat.cpp, itpp/stat/misc_stat.h, itpp/stat/sources.mk, tests/cholesky_test.cpp, tests/det_test.cpp, tests/eigen_test.cpp, tests/lu_test.cpp, tests/Makefile.am, tests/matfunc_test.cpp, tests/qr_test.cpp, tests/rand_test.cpp, tests/schur_test.cpp, tests/source_test.cpp, tests/stat_test.cpp, tests/svd_test.cpp: Moved the rest of statistical routines from "base/stat.*" to the "stat" module. Because these functions are commonly used in all other mudules, the "stat" module is now compulsory as the "base" one. 2006-12-20 Adam Piatyszek * itpp/comm/channel.cpp: Fixed a minor problem in merging process of tap Doppler spectra. BTW, improved the related conditional warning messages. * configure.ac: Updated version numbers. 2006-12-20 Conrad Sanderson * doc/tutorial/src/mog.cpp, itpp/itstat.h, itpp/stat/mog_generic.cpp, itpp/stat/mog_generic.h, itpp/stat/mog_diag_kmeans.cpp, itpp/stat/mog_diag.cpp, itpp/stat/mog_diag_em.cpp, itpp/stat/mog_diag_kmeans.h, itpp/stat/mog_diag.h, itpp/stat/mog_diag_em.h: Added wrapper functions for training MOG models, simplified header files and updated associated documentation. 2006-12-19 Erik G. Larsson * itpp/base/math/integration.cpp, itpp/comm/modulator_nd.cpp, itpp/signal/fastica.cpp, itpp/signal/filter_design.cpp, poly.cpp, itpp/stat/mog_generic.cpp: Fixed include statement 2006-12-19 Adam Piatyszek 2006-12-19 Conrad Sanderson * configure.ac, doc/doxygen_html.cfg.in, doc/Makefile.am, itpp/base/array.h, itpp/base/binfile.cpp, itpp/base/converters.cpp, itpp/base/converters.h, itpp/base/Makefile.am, itpp/base/matfunc.h, itpp/base/mat.h, itpp/base/math/error.cpp, itpp/base/math/error.h, itpp/base/math/integration.cpp, itpp/base/math/integration.h, itpp/base/math/log_exp.h, itpp/base/math/misc.cpp, itpp/base/math/misc.h, itpp/base/math/sources.mk, itpp/base/math/trig_hyp.h, itpp/base/sources.mk, itpp/base/specmat.cpp, itpp/base/vec.h, itpp/comm/channel.cpp, itpp/comm/galois.cpp, itpp/comm/hammcode.cpp, itpp/comm/modulator.h, itpp/comm/pulse_shape.h, itpp/comm/reedsolomon.cpp, itpp/comm/sequence.cpp, itpp/itbase.h, itpp/itcomm.h, itpp/signal/fastica.cpp, itpp/signal/filter.cpp, itpp/signal/filter_design.cpp, itpp/srccode/audiofile.h, itpp/srccode/vq.h, itpp/stat/mog_diag_em.cpp, itpp/stat/mog_generic.cpp, itpp/stat/mog_generic.h: Various math functions grouped in a new "Basic and Miscellaneous Functions" module in the "base/math" sub-directory. BTW, renamed "logexpfunc.h" to "log_exp.h", "trihypfunc.h" to "trig_hyp.h" and "errorfunc.*" to "error.*". 2006-12-18 Adam Piatyszek * itpp/base/matfunc.cpp, itpp/base/matfunc.h, itpp/comm/channel.cpp, itpp/comm/channel.h, itpp/comm/pulse_shape.cpp, itpp/comm/pulse_shape.h, itpp/itbase.h, itpp/itsignal.h, itpp/signal/fastica.cpp, itpp/signal/fastica.h, itpp/signal/resampling.cpp, itpp/signal/resampling.h, itpp/signal/sources.mk: Resampling and interpolation functions moved to the "signal processing" module. 2006-12-18 Conrad Sanderson * itpp/itbase.h, itpp/base/array.h, itpp/base/vec.h, itpp/base/mat.h: Minor documentation changes to allow the array class to be visible from the Modules section. * itpp/stat/mog_generic.h, itpp/stat/mog_generic.cpp, itpp/stat/mog_diag.h: Minor changes to allow default values in initialisation functions. 2006-12-16 Adam Piatyszek * itpp/base/matfunc.cpp, itpp/base/stat.cpp: Fixed minor bugs related to a wrong "#include" target. 2006-12-14 Adam Piatyszek * itpp/itbase.h, itpp/itcomm.h, itpp/itfixed.h, itpp/itmex.h, itpp/itoptim.h, itpp/itprotocol.h, itpp/itsignal.h, itpp/itsrccode.h, itpp/itstat.h: Fixed Doxygen's grouping problems of hierarchical modules. * configure.ac, doc/doxygen_html.cfg.in, doc/Makefile.am, itpp/base/algebra/cholesky.cpp, itpp/base/algebra/cholesky.h, itpp/base/algebra/det.cpp, itpp/base/algebra/det.h, itpp/base/algebra/eigen.cpp, itpp/base/algebra/eigen.h, itpp/base/algebra/inv.cpp, itpp/base/algebra/inv.h, itpp/base/algebra/lapack.h, itpp/base/algebra/ls_solve.cpp, itpp/base/algebra/ls_solve.h, itpp/base/algebra/lu.cpp, itpp/base/algebra/lu.h, itpp/base/algebra/Makefile.am, itpp/base/algebra/qr.cpp, itpp/base/algebra/qr.h, itpp/base/algebra/schur.cpp, itpp/base/algebra/schur.h, itpp/base/algebra/sources.mk, itpp/base/algebra/svd.cpp, itpp/base/algebra/svd.h, itpp/base/Makefile.am, itpp/base/sources.mk, itpp/itbase.h: Linear algebra related functions (LAPACK dependent) grouped in a new "algebra" subdirectory in the "base" module. 2006-12-13 Adam Piatyszek * itpp/base/source.cpp, itpp/base/source.h, itpp/base/sources.mk, itpp/itbase.h, itpp/itsignal.h, itpp/signal/source.cpp, itpp/signal/source.h, itpp/signal/sources.mk, tests/Makefile.am, tests/source_test.cpp: Moved deterministic sources classes from the "Base" module into the "Signal Processing" module. * configure.ac, doc/doxygen_html.cfg.in, doc/Makefile.am, itpp/base/newton_search.cpp, itpp/base/newton_search.h, itpp/base/sources.mk, itpp/itbase.h, itpp/itoptim.h, itpp/Makefile.am, itpp/optim, itpp/optim/Makefile.am, itpp/optim/newton_search.cpp, itpp/optim/newton_search.h, itpp/optim/sources.mk, itpp/sources.mk, tests/Makefile.am, tests/newton_search_test.cpp: Created a new "Numerical Optimizations" module ("optim") and moved there the Newton Search algorithm sources from the base module. 2006-12-13 Conrad Sanderson * itpp/itbase.h, itpp/base/mat.h, itpp/base/vec.h: Small changes to the documentation to allow the vector and matrix classes to be visible from the Modules section (helps new users) 2006-12-12 Conrad Sanderson * itpp/base/vec.h, itpp/base/vec.cpp: Added vector versions of elem_mult_inplace(), elem_mult_out(), elem_div_out(), elem_mult_sum() and elem_div_sum(). See the 2006-12-07 entry by Conrad for more information. 2006-12-11 Adam Piatyszek * itpp/signal/transforms.cpp, itpp/signal/transforms.h: Minor documentation fixes. 2006-12-07 Erik G. Larsson * itpp/base/gf2mat.h, itpp/base/svec.h, itpp/base/smat.h: documentation update * itpp/base/svec.h: minor fix in + operator 2006-12-07 Adam Piatyszek * configure.ac, itpp/base/converters.cpp, itpp/base/converters.h, itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h, itpp/base/errorfunc.cpp, itpp/base/errorfunc.h, itpp/base/itmisc.h, itpp/base/operators.h, itpp/config_msvc.h: Added some missing function checks to configure.ac, which should improve the portability of the library on various platforms. * itpp/comm/channel.cpp, tests/channel_test.ref: Fixed a bug that resulted in different output samples of the IFFT fading generator on SPARC Solaris using GCC 3.4.5, than the ones obtained in other enviroments. The problem was probably caused by a different order of calculating the random arguments of the concat() function. Do not know if this is a bug of GCC for Solaris, or it is not fully specified behaviour in C/C++ standards. 2006-12-07 Conrad Sanderson * itpp/base/mat.h, itpp/base/mat.cpp: Added elem_mult_inplace(), elem_mult_out(), elem_div_out(), elem_mult_sum() and elem_div_sum(). Descriptions: elem_mult_inplace() is a fast version of B = elem_mult(A,B). elem_mult_out() and elem_div_out(): element-wise multiplication and division of matrices, respectively, with the result stored in a matrix given as an argument. elem_mult_sum() and elem_div_sum(): element-wise multiplication and division of matrices, followed by summation of the resultant elements. * itpp/base/matfunc.h, itpp/base/matfunc.cpp: Added sumsum(), which is a fast version of sum(sum(A)) (i.e. calculates the total of all elements in a matrix). * itpp/stat/mog_diag.h: Fixed a small typo. 2006-12-06 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Conrad Sanderson added to the list of developers. 2006-12-05 Adam Piatyszek * itpp/base/itmisc.h, itpp/stat/mog_generic.cpp, itpp/stat/mog_generic.h, itpp/stat/mog_diag_kmeans.cpp, itpp/stat/mog_diag.cpp, itpp/stat/mog_diag_em.cpp, itpp/stat/mog_diag_kmeans.h, itpp/stat/mog_diag.h, itpp/stat/mog_diag_em.h: Fixes in MOG classes related to compilation errors under Cygwin, Solaris and MSVC++ .NET. Thanks to Conrad Sanderson for providing patches. * configure.ac, itpp/config_msvc.h, itpp/base/bessel.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/struve.cpp: Configuration changes related to MSVC++ .NET differences. * win32/itpp.vcproj: Include recently created statistics module sources. ============================================================================== 2006-12-04 Adam Piatyszek * IT++ 3.10.7 released (SVN tag: release-3-10-7) (merged rev. 725:729 from the itpp-3-10 branch) * NEWS, TODO: Updated to reflect recent changes. (merged rev. 725:729 from the itpp-3-10 branch) * config/acx_blas.m4: Fixed a problem with detection of the ACML library on 64-bit platforms. (merged rev. 725:729 from the itpp-3-10 branch) 2006-12-02 Adam Piatyszek * doc/local/index.doc.in: Updated SVN repository and bug tracker links. (merged rev. 725:729 from the itpp-3-10 branch) 2006-12-02 Erik G. Larsson * itpp/comm/modulator_nd.*: changed short -> int 2006-11-30 Adam Piatyszek * itpp/itfixed.h, itpp/fixed/cfix.h, itpp/fixed/fixed.h, itpp/fixed/cfixed.h, itpp/fixed/fix_factory.h, itpp/fixed/fix_functions.h, itpp/fixed/fix_base.h, itpp/fixed/fix_operators.h, itpp/fixed/fix.h, itpp/protocol/packet_channel.h, itpp/protocol/events.h, itpp/protocol/packet.h, itpp/protocol/tcp_client_server.h, itpp/protocol/packet_generator.h, itpp/protocol/front_drop_queue.h, itpp/protocol/selective_repeat.h, itpp/protocol/signals_slots.h, itpp/protocol/tcp.h: Fixed and improved Doxygen documentation grouping. * tests/stat_test.ref, tests/histogram_test.cpp, tests/stat_test.cpp, tests/histogram_test.ref, tests/Makefile.am, itpp/itstat.h, itpp/base/stat.h, itpp/stat/histogram.h, itpp/stat/sources.mk: Histogram class moved to the statistics module. 2006-11-28 Adam Piatyszek * configure.ac, doc/tutorial/mog.doc, doc/tutorial/src/sources.mk, doc/tutorial/src/mog.cpp, doc/tutorial/sources.mk, doc/tutorial/tutorial.doc, doc/doxygen_html.cfg.in, doc/Makefile.am, itpp/sources.mk, itpp/itstat.h, itpp/Makefile.am, itpp/stat, itpp/stat/mog_generic.cpp, itpp/stat/mog_generic.h, itpp/stat/mog_diag_kmeans.cpp, itpp/stat/mog_diag.cpp, itpp/stat/mog_diag_em.cpp, itpp/stat/Makefile.am, itpp/stat/sources.mk, itpp/stat/mog_diag_kmeans.h, itpp/stat/mog_diag.h, itpp/stat/mog_diag_em.h: Created a new "Statistics" module, which contains an initial set of Mixture of Gaussians (MOG) classes written by Conrad Sanderson. 2006-11-26 Erik G. Larsson * itpp/comm/modulator_nd.*: Minor code readability and efficiency improvements 2006-11-10 Adam Piatyszek * itpp/srccode/gmm.h: Fixed bug [1570388] by adding a warning message to `get_no_mixtures()' function saying that it is deprecated and that `get_no_gaussians()' should be used instead (merged rev. 713:714 from itpp-3-10 branch). * itpp/comm/channel.cpp: Fixed default initialisations and checks in particular fading related methods (set_no_frequencies(), set_filter_length(), etc.). (merged rev. 657:716 from the channel-update branch) 2006-11-09 Adam Piatyszek * itpp/comm/channel.cpp: Removed wrong and unnecessary checks for positive time offsets. (merged rev. 657:716 from the channel-update branch) 2006-11-07 Adam Piatyszek * itpp/comm/channel.h: Minor documentation changes. (merged rev. 657:716 from the channel-update branch) * itpp/comm/channel.cpp, itpp/comm/channel.h: The channel discretization function improved and moved to the TDL_Channel class. An additional parameter `sampling_time' is required when setting the channel profile using the Channel_Specification object. (merged rev. 657:716 from the channel-update branch) * itpp/comm/channel.cpp: Simplified GaussI and GaussII Doppler spectra calculations. (merged rev. 657:716 from the channel-update branch) 2006-11-06 Adam Piatyszek * itpp/comm/channel.cpp, itpp/comm/channel.h: Improved interface for setting various fading parameters in Channel_Specification and TDL_Channel classes. Relative Doppler is set to 0.7 by default, when only relative power (Rice factors) is specified. BTW, the documentation was revised. (merged rev. 657:716 from the channel-update branch) * itpp/comm/channel.cpp, tests/channel_test.ref: Fixed a bug in LOS process generation in the Independent and Static fading generators. (merged rev. 657:716 from the channel-update branch) * tests/channel_test.cpp, tests/channel_test.ref, itpp/comm/channel.cpp, itpp/comm/channel.h, tests/Makefile.am: Fading generators inheritance model redesigned. Now there are three types of fading: Independent, Static and Correlated. The Correlated fading can be generated using Rice (MEDS), FIR or IFFT methods. A basic test program of channel classes added. (merged rev. 657:716 from the channel-update branch) 2006-11-02 Adam Piatyszek * itpp/comm/channel.cpp, itpp/comm/channel.h: A set of new features and improvements added: - `Rice' keyword removed from the DOPPLER_SPECTRUM enum; `Jakes' or `Classic' should be used instead. - Explicit selection of a fading type implemented. When fading_type is equal to `Correlated', non-zero normalised Doppler needs to be specified. The default fading type is set to `Independent'. - Better implementation of independent fading generator. - Added missing initialisations of time_offset in FIR and IFFT fading generators. - Removed the `decimation_factor' parameter, since its use was bad in a few places. (merged rev. 657:716 from the channel-update branch) * itpp/comm/rec_syst_conv_code.cpp: To avoid code duplication, the local `com_logmap()' function replaced with its safer implementation `log_add()' from "itpp/base/logexpfunc.h". Thanks to Erik G. Larsson for pointing this out. 2006-11-01 Adam Piatyszek * AUTHORS, configure.ac, doc/local/authors.doc, itpp/base/logexpfunc.h, itpp/config_msvc.h: New `log_add()' function implemented, which calculates safely the following expression: log(exp(log_a) + exp(log_b)). Thanks to Conrad Sanderson for his patches. 2006-10-31 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Developers Thomas Lemaire and Anders Persson retired. * doc/local/index.doc.in, doc/local/itpp_footer.html, doc/local/itpp_header.html: Main documentation page layout redesigned (should look better in higher resolutions). 2006-10-24 Adam Piatyszek * itpp/base/converters.cpp, itpp/base/logexpfunc.h, itpp/base/matfunc.h, itpp/base/specmat.cpp, itpp/comm/channel.cpp, itpp/comm/modulator.cpp, itpp/comm/modulator.h, itpp/comm/modulator_nd.cpp, itpp/signal/sigfun.cpp, itpp/signal/transforms.cpp, itpp/srccode/vq.h, tests/convcode_test.cpp: Function `needed_bits()' marked as deprecated, because its name was a bit misleading (see bug [1480535]). Instead of it the following two functions were added: `int2bits()' and `levels2bits()'. The first one returns the number of beed required for representing an unsigned integer, e.g. "int2bits(0) = 1", "int2bits(2) = 2". The latter one returns the number of bits to code a certain, positive number of values (levels). For example: "levels2bits(1) = 1", "levels2bits(2) = 1". 2006-10-18 Adam Piatyszek * AUTHORS, doc/local/authors.doc, doc/local/installation.doc, INSTALL: Documentation improvements and author list update. * configure.ac: Building of the static library disabled for systems that support shared libraries. * configure.ac, itpp-config.in, itpp.pc.in: Cleaned up the detected library flags necessary to link with static libraries. 2006-10-17 Erik G. Larsson * doc/tutorial/src/mimoconv.cpp: Fixed minor bug in tutorial 2006-10-17 Adam Piatyszek * itpp/comm/channel.cpp: Readded init_flag resets, which have been removed by mistake. (merged rev. 657:716 from the channel-update branch) 2006-10-15 Adam Piatyszek * ChangeLog, ChangeLog-2005, NEWS, NEWS-3.9, Makefile.am: ChangeLog and NEWS files split according to dates and versions. ============================================================================== 2006-10-15 Adam Piatyszek * IT++ 3.10.6 released (SVN tag: release-3-10-6) * NEWS: Updated to reflect recent changes (merged rev. 679:681 from itpp-3-10 branch). * itpp/Makefile.am: Fixed bug [1576333]. The problem with undefined non-weak symbols has been solved according to the solution from Section 7.3.5 "Libtool Convenience Libraries" of automake manual. Thanks to Ed Hill for reporting this bug and his work on RPM package for Fedora Core (merged rev. 676:677 from itpp-3-10 branch). 2006-10-14 Erik G. Larsson * doc/tutorial/src/mimoconv.doc: Improvement to tutorial example * doc/local/installation.doc: Minor update * itpp/comm/modulator_nd.*, tests/modulator_nd_test.*: Fixed an error in ND_UQAM 2006-10-13 Erik G. Larsson * doc/tutorial/src/mimoconv.doc: Update to reflect the change in LLR convention. 2006-10-12 Erik G. Larsson * itpp/comm/llr.h, itpp/comm/modulator_nd.*: Changed the definition of LLRs from log(P(b=1)/P(b=0)) to log(P(b=0)/P(b=1)) in the LLR and Modulator_ND classes. This was done to conform to the conventions in the scalar modulator class. (Note the interface change.) * doc/tutorial/tutorial.doc, doc/tutorial/mimoconv.doc, doc/tutorial/src/mimoconv.cpp: Added first version of new MIMO tutorial. 2006-10-08 Adam Piatyszek * itpp/comm/modulator.h: Additional check added to prevent improper initialisation of symbols and bit2symbols in the Modulator class. This fix is related to bug [1572807]. 2006-10-06 Adam Piatyszek * itpp/base/itassert.cpp, itpp/base/itassert.h: Implemented feature request [1569867]. Now, it_assert(), it_warning() and it_error() functions can use stream operators like `<<' or `std::endl' in a concatenation with strings, e.g. `it_error("Wrong value x = " << oct << x)'. Thanks to George Jongren for submitting a patch. 2006-09-18 Adam Piatyszek * itpp/comm/channel.cpp: Removed redundant concat() functions in Gauss Doppler spectra's initialisation. (merged rev. 657:716 from the channel-update branch) * itpp/comm/channel.cpp, itpp/comm/channel.h: Implemented missing "Gauss I" and "Gauss II" Doppler spectra required by a few COST207 channel models. These Gaussian spectra are only available in the Rice_Fading_Generator class (merged rev. 657:716 from the channel-update branch) 2006-09-05 Adam Piatyszek * itpp/comm/channel.cpp, itpp/comm/channel.h: Added additional assertion checks for undersampled cases in Channel_Specification's discretize() function. It is now possible to discretize the channel with too low sampling frequency, but only if all taps except the first one use the default Jakes Doppler spectrum and has no LOS (Rice) parameters. (merged rev. 657:716 from the channel-update branch) * itpp/comm/channel.cpp, itpp/comm/channel.h: Fixed improper initialisation of los_power and los_dopp variables in TDL_Channel class. (merged rev. 657:716 from the channel-update branch) 2006-09-04 Adam Piatyszek * itpp/comm/channel.cpp, itpp/comm/channel.h: Implemented exponential channel profile generation function. Cleaned up the interface of various fading generator classes: - only one generate() function with additional default parameter decimation_factor (instead of misleading name upsampling_factor) - implemented add_LOS() function in the base class, which is reused by the child classes - global jake_filter() function moved into FIR_Fading_Generator class - all get_*() functions changed to the const ones - base class `init_flag' is now set in the initialisation list of the constructor. (merged rev. 657:716 from the channel-update branch) 2006-09-03 Adam Piatyszek * itpp/comm/channel.cpp, itpp/comm/channel.h: Channel_Specification and TDL_Channel classes extended with support of LOS (Rice) fading for any tap. Doppler spectrum of type `Rice' is now merged with `Jakes' or `Classic', since the generation method is the same. To obtain `Rice' spectrum relative_power and relative_doppler needs to be defined for a certain tap(s). (merged rev. 657:716 from the channel-update branch) 2006-09-03 Erik G. Larsson * doc/tutorial/matlab_itpp.doc: Expanded the Matlab/IT++ conversion table. 2006-09-02 Erik G. Larsson * itpp/comm/modulator.h, modulator_nd.h, modulator_nd.cpp: Documentation update and improvement of range checking in interface. 2006-09-01 Adam Piatyszek * Makefile.am: Added new `snapshot', `snapshot-src' and `snapshot-html' targets for automatic creation of snapshot distribution packages. 2006-08-31 Tony Ottosson * doc/tutorial/itfile.doc: Fixed small documentation bug. 2006-08-24 Adam Piatyszek * itpp/base/svec.h: Fixed bug [1545798]. Sparse vectors are now correctly compared using `==' operator. Thanks to Timo for reporting this bug. 2006-08-22 Adam Piatyszek * itpp/comm/modulator.cpp, itpp/comm/modulator.h: Added simplified versions of demodulate_soft_bits() functions to the QPSK modulator class. This gave about 40% improvement in the demodulation performance. 2006-08-21 Adam Piatyszek * itpp/comm/modulator.h, tests/modulator_test.cpp: Added deprecated demodulate_soft_bits_approx() functions with a warning message for backward compatibility reasons. Besides, the default soft demodulation method of demodulate_soft_bits() functions is now log-MAP. 2006-08-19 Adam Piatyszek * itpp/comm/channel.cpp: Fixed bug [1542064]. The problem was that the index in the tap_doppler_spectrum array in the TDL_Channel::init() function could go out of bounds, if the TDL_Channel class was used with two different channel profile lengths. Thanks to Jordy Potman for reporting this bug and providing a patch with a solution (merged rev. 645:646 from itpp-3-10 branch). * itpp/comm/modulator.cpp, itpp/comm/modulator.h, tests/modulator_test.cpp: Further redesign of 1D and 2D modulator classes. From now, there is only one templated base class Modulator, which can handle 1D (real) and 2D (complex) constellations. BPSK and PAM modulators are split into: BPSK_c/PAM_c classes which use complex valued interface but only real part of the signal is used, and BPSK/PAM classes that have real valued interface. Besides, demodulate_soft_bits() functions use additional parameter "method" to switch between Log-MAP or approximate demodulation algorithm. * itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h: Reverted the previous interface of binomial functions. "double binom()" defined for higher range of calculated results. 2006-08-19 Erik G. Larsson * itpp/comm/egolay.cpp: Included "converters.h". 2006-08-19 Adam Piatyszek * itpp/comm/egolay.cpp: Minor fix - "(int)floor()" replaced with "floor_i()". 2006-08-18 Adam Piatyszek * itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h, itpp/base/itmisc.cpp, itpp/base/itmisc.h: Fixed bug [1542482]. Now binom(n, k) works properly. "double binom(int, int)" was redundant, because the result of this function was always integral. Therefore it was replaced with "int binom(int, int)". BTW, moved fact(), binom(), log_binom() and gcd() functions from itmisc.{cpp,h} to elmatfunc.{cpp,h}. 2006-08-16 Adam Piatyszek * tests/modulator_test.cpp, tests/modulator_test.ref: Updated tests of 1D and 2D modulators due to the recent redesign of these classes. * doc/local/index.doc.in: Minor fix ("CVS" -> "SVN") (merged rev. 633:634 from itpp-3-10 branch). * doc/doxygen_html.cfg.in: Include files and file list now contain a relative path. * itpp/comm/modulator.cpp, itpp/comm/modulator.h, tests/modulator_test.cpp, tests/modulator_test.ref, tests/pulse_shape_test.ref: Major redesign of one- and two-dimensional modulator classes. Modulator_2D is now a base class for QAM, PSK and PAM modulators. Moreover, QPSK and PSK inherits from the PSK class. Please note that input signal for Modulator_2D has now slightly different meaning. BTW, improper definition of QPSK constellation is fixed (it was in fact 4-QAM modulator previously). * itpp/comm/bch.cpp, itpp/comm/egolay.cpp: Added missing include files. * doc/doxygen_html.cfg.in, doc/local/itpp_header.html: Minor fixes in Doxygen config file. 2006-08-15 Adam Piatyszek * TODO: Updated to reflect recent changes. ============================================================================== 2006-08-15 Adam Piatyszek * IT++ 3.10.5 released (SVN tag: release-3-10-5) * doc/local/index.doc.in, README: Updated reference documentation index page (merged rev. 617:621 from itpp-3-10 branch). * NEWS: Updated to reflect recent changes (merged rev. 617:621 from itpp-3-10 branch). 2006-08-12 Erik G. Larsson * itpp/comm/modulator_nd.{cpp,h}, itpp/comm/llr.{cpp,h}, tests/modulator_nd_test.ref, tests/llr_test.ref: Documentation updates and cosmetic changes. 2006-08-11 Adam Piatyszek * doc/local/verification.doc: Updated with Windows tests (merged rev. 612:613 from itpp-3-10 branch). * itpp/base/parser.cpp: Minor fix of uninitialised bool variable. * itpp/base/itmisc.h, itpp/base/random.h: Replaced deprecated hypot(x, y) function with std::sqrt(x*x + y*y) calculation. BTW, macro definition M_2PI replaced with a global constant m_2pi. * itpp/base/mat.cpp, itpp/base/mat.h: Fixed a minor problem of uninitialised matrix elements, when parsing values from a string literal. * itpp/signal/sigfun.cpp: Fixed bug [1538210], caused by uninitialised variable `m2' used for covariance calculation. Thanks to Max Moorkamp for reporting this bug. * itpp/comm/modulator.cpp, itpp/comm/modulator.h, tests/modulator_test.ref: Further cosmetic changes and minor fixes in QPSK, PSK and QAM modulator classes. Use the new trunc_log() function when calculating log-likelihood ratio. Reference data for test program updated accordingly. 2006-08-10 Adam Piatyszek * itpp/comm/modulator.cpp, itpp/comm/modulator.h: Minor fixes in BPSK and PAM modulator classes. Now use the new trunc_log() function when calculating log-likelihood ratio. 2006-08-10 Erik G. Larsson * itpp/comm/rec_syst_conv_code.cpp: Now use the new trunc_exp() and trunc_log() functions instead of macros. 2006-08-10 Adam Piatyszek * itpp/comm/modulator.cpp, itpp/comm/modulator.h: Modulator_1d and Modulator_2d classes revised with respect to bug [1456235]. The precision problems for high SNR have been solved by using the trunc_log() function recently defined in "logexpfunc.h" file. Thanks to Erik for his help in solving this problem. This fix closes the bug report [1456235]. * itpp/base/logexpfunc.h: Added special truncated versions of log() and exp() functions, which might be used instead of the macros in modulator.cpp and rec_syst_conv_code.cpp (more stable and portable solution). These functions check if floating-point arithmetic is conforming to IEC 559 standard. If not, standard log()/exp() functions are used. 2006-08-09 Erik G. Larsson * itpp/comm/rec_syst_conv_code.cpp: Changed functions into macros to handle truncation of argument of exp() and log(). * itpp/comm/modulator.cpp, itpp/comm/modulator.h: Documentation updates and polishing of code. 2006-08-09 Adam Piatyszek * configure.ac, doc/Makefile.am, Makefile.am: Added `upload', `upload-src' and `upload-html' targets for automatic upload tarballs into SourceForge ftp server. 2006-08-08 Adam Piatyszek * itpp/base/parser.cpp: Fixed a minor bug in get() function caused by too early execution of it_assert() check function. * itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp: Fixed a minor bug in string parsing functions that prevented initialisation of a vector/matrix with an empty string "". 2006-08-08 Erik G. Larsson * itpp/comm/rec_syst_conv_code.cpp, itpp/comm/rec_syst_conv_code.h: Added floating point range tests when using exponential and logarithm functions to avoid numerical errors at high SNR in map_decode(), to address bug [1088420]. Updated documentation to suggest that the QLLR based decoders are used instead for maximum runtime efficiency and numerical stability. 2006-08-08 Adam Piatyszek * itpp/base/array.h, tests/array_test.cpp, tests/array_test.ref: Added new constructors and operator `=' which use string literals for Array initialisation. There is no need to use `set_array()' function any more. Test program improved as well. Source code of "array.h" beautified by the way. * tests/vec_test.cpp: Fixed improper file description. * tests/parser_test.cpp: Fixed minor compilation problem caused by passing C-style string as an argument of init(std::string) function. ============================================================================== 2006-08-07 Adam Piatyszek * IT++ 3.10.4 released (SVN tag: release-3-10-4) * NEWS: Updated to reflect recent changes (merged rev. 579:581 from itpp-3-10 branch). * itpp/base/bessel.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/struve.cpp, itpp/base/random.h, itpp/protocol/tcp.cpp: Removed most of the "#pragma warning" statements needed by MSVC++ .NET compiler (merged rev. 577:578 from itpp-3-10 branch). * win32/itpp.vcproj: Added _CRT_SECURE_NO_DEPRECATE and _CRT_NONSTDC_NO_DEPRECATE definitions that disable warnings on some deprecated C standard library and POSIX-compilant functions (merged rev. 577:578 from itpp-3-10 branch). 2006-08-04 Adam Piatyszek * itpp/base/parser.cpp, itpp/base/parser.h, tests/parser_test.cpp, tests/parser_test_data.txt: Added support for decimal, hexadecimal and octal notation in get_int() and get(int) parser functions. Also support added for "true" and "false" strings in get_bool() and get(bool) functions. 2006-08-03 Adam Piatyszek * doc/local/installation.doc: Updated installation manual using MSVC++ with MKL. 2006-08-03 Erik G. Larsson * itpp/signal/transforms.*: Documentation update to comment on the the issues with memory alignment for FFTW (cf. bug/feature request [1418707]). 2006-08-03 Adam Piatyszek * itpp/base/vec.cpp: Changed the way "a:b:c" format is parsed when (b = 0) and (a = c). Now it returns "a". Thanks to Erik for finding this bug (merged rev. 556:566 from a temporary sandbox branch). 2006-08-03 Erik G. Larsson * itpp/comm/rec_syst_conv_code.h: Documentation update (fixes bug [1532371]). 2006-07-26 Adam Piatyszek * tests/rec_syst_conv_code_test.cpp, tests/rec_syst_conv_code_test.ref: Fixed a minor bug in the RSC code test program. The generator polynomials were initialised with a string using octal notation, which is not supported by Vec<> parser yet. * itpp/base/parser.cpp: Minor change in findname() function to adapt the parser to recent changes in Vec and Mat classes. Now fields in a temporary parsed string are separated with spaces instead of commas (merged rev. 556:566 from a temporary sandbox branch). * tests/mat_test.cpp, tests/mat_test.ref, tests/vec_test.cpp, tests/vec_test.ref: Added vector and matrix initialisation tests with strings (merged rev. 556:566 from a temporary sandbox branch). 2006-07-25 Adam Piatyszek * itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h (merged rev. 556:566 from a temporary sandbox branch): New functions for initialising vectors and matrices from strings implemented. Main features of the improved parser are as follows: - Decimal, octal and hexadecimal notation support according to C/C++ conventions, i.e. octal number starts with `0' (e.g. `0133', `077'), decimal number starts with `1-9' or is a single `0' digit, hexadecimal number starts with `0x' or `0X' prefix and has at least one `0-9', `a-f'or `A-F' digit after (e.g. 0xFF, 0x0, 0x070). Various representations can be mixed in one string. - Signed numbers supported, i.e. with `+', `-' or nothing in front, e.g. `-1000', `+0133', `-0x1' - Vector values can be separated with spaces ` ', tabs `\t' or comma `,', e.g. " -1 22, 47 0x5, 077" - Matlab's "a:b" or "a:b:c" notation for both increasing and decreasing values supported, e.g. "0:2:10", "-9:-18", "4:-1:0", "0x0:0x8:0xFF" - Matrix rows separated with a single semicolon `;' - Detection of syntax errors during parsing 2006-07-19 Adam Piatyszek * INSTALL: Updated to reflect recent changes in installation.doc. * doc/local/installation.doc: Installation documentation updted according to the recent changes in fortran compiler detection. * configure.ac: Added explicit check for a fortran compiler. If not found, BLAS, CBLAS and LAPACK are not checked. BTW, obsolete AC_HELP_STRING macros replaced with AS_HELP_STRING. 2006-07-18 Adam Piatyszek * itpp/base/vec.cpp, itpp/base/vec.h: Minor fixes of a few wrong template declarations, which caused warnings and errors under MSVC++ .NET compiler. * doc/local/installation.doc: Updated installation document - the section about using MSVC++ .NET compiler and Intel MKL external library. * itpp/Makefile.am, itpp/sources.mk: Fixed Makefiles so the generated `config.h' file is not distributed. * itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h: Added a dirty hack for MSVC++ .NET compilation problems of vector and matrix based conj() function. MSVC++ .NET crashed without this hack. 2006-07-17 Adam Piatyszek * win32/itpp.vcproj: Updated source and header file lists in the project. * win32/Makefile.am, Makefile.am, configure.ac: Added and updated Makefiles and configuration script (merged rev. 539:541 from itpp-3-10 branch). * itpp.sln, itpp.vcproj: Moved MSVC++ .NET project files into win32 subdirectory. Removed project files for MSVC++ 2003 .NET (merged rev. 539:541 from itpp-3-10 branch). * itpp/base/itassert.cpp: Conversion from integer to std::string implemented in pure C++ by using std::stringstream class (merged rev. 536:538 from itpp-3-10 branch). * itpp/base/itfile.h: Fixed a minor problem with overloaded virtual function open() (merged rev. 536:538 from itpp-3-10 branch). * itpp/comm/modulator_nd.cpp, itpp/comm/modulator.h, itpp/base/newton_search.cpp: Minor cleanup fixes of warnings detected under MSVC++ .NET compiler. 2006-07-16 Adam Piatyszek * itpp/base/newton_search.cpp: Logical variables initialised with `true or `false' instead of inteager numbers. * itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h: Fixed a minor problem with duplicated declaration of tgamma(), lgamma() and cbrt() functions. 2006-07-12 Adam Piatyszek * itpp/Makefile.am: Fixed a bug that caused multiple definition errors during linking the IT++ debugging library. * configure.ac: Fixed a minor problem with using AC_DISABLE_SHARED macro for Windows environments. * **/*.{h,cpp}: Copyright date updated to `1995-2006'. * configure.ac: Version numbers and Copyright date updated. ============================================================================== 2006-07-11 Adam Piatyszek * IT++ 3.10.3 released (SVN tag: release-3-10-3) * NEWS: Updated to reflect recent fixes. * configure.ac: Increased itpp-external version number to 2.3.0. 2006-07-04 Adam Piatyszek * tests/eigen_test.cpp: Fixed bug [1516976] by setting the threshold of round_to_zero() function to 1e-13. Thanks to Rosario for reporting this bug. 2006-06-18 Adam Piatyszek * configure.ac, Makefile.am, itpp/Makefile.am, itpp/sources.mk, tests/Makefile.am, doc/local/installation.doc, INSTALL, TODO: Modularisation of the IT++ library implemented. It is now possible to skip the building of various modules using a set of `--disable-*' switches with the configure script. The documentation has been updated accordingly. 2006-06-15 Adam Piatyszek * itpp/comm/convcode.h, itpp/comm/convcode.cpp: Fixed bug [1506524]. The `K' variable is now initialised in the Convolutional_Code default constructor. Thanks to Hakan Eriksson for finding this bug. 2006-06-01 Adam Piatyszek * doc/local/index.doc.in: Cosmetic changes in page layout. 2006-05-31 Adam Piatyszek * tests/gf2mat_test.cpp: Missing initialisation added. 2006-05-21 Adam Piatyszek * AUTHORS, doc/local/authors.doc, itpp/comm/bch.cpp, itpp/comm/bch.h, itpp/comm/reedsolomon.cpp, itpp/comm/reedsolomon.h, tests/bch_test.cpp, tests/reedsolomon_test.cpp: Added Steve Peters as a co-author of the BCH and Reed_Solomon classes. BTW, updated IT++ authors list. * tests/reedsolomon_test.cpp, tests/reedsolomon_test.ref, itpp/comm/reedsolomon.cpp, itpp/comm/reedsolomon.h, tests/Makefile.am: Added systematic option to the Reed_Solomon class, which produces codewords in a systematic form. BTW, added a missing test program. Thanks to Steve, aka "michboy", for providing patches and en example test file. * itpp/comm/bch.cpp, itpp/comm/bch.h, tests/bch_test.cpp, tests/bch_test.ref: BCH related patches from Feature Request [1418250] applied. Now, BCH encoder/decoder class can be set to produce codewords in a systematic order. Thanks to Steve, aka "michboy", for providing patches and a simple test file. 2006-05-19 Adam Piatyszek * tests/timer_test.cpp: Minor fix to avoid a hazard in timing test. * configure.ac, itpp/base/binfile.cpp, itpp/config_msvc.h: Removed checks for . Now using iostream based method for checking if a file exists. * itpp/srccode/audiofile.cpp, itpp/srccode/audiofile.h, itpp/srccode/sources.mk: Added templated read_endian and write_endian functions, which replaced the old macro based read/write ones. Finally removed `machdep.h', because endianness is now handled run-time. 2006-05-18 Adam Piatyszek * itpp/base/sources.mk, itpp/srccode/audiofile.cpp, itpp/srccode/machdep.h, itpp/srccode/sources.mk: Moved `machdep.h' into `itpp/srccode', since it is only included in `audiofile.cpp'. Cleaned up the `machdep.h' code, by the way. * itpp/base/binfile.cpp, itpp/base/binfile.h, itpp/base/itfile.cpp, itpp/base/itfile.h, itpp/base/itmisc.cpp, itpp/base/itmisc.h, itpp/itbase.h: Changed the method of detecting the endianness of a system - `itpp/base/machdep.h' is not used any more in the base module. * doc/local/verification.doc: Updated to reflect recent tests under Windows (MinGW with IT++ External). ============================================================================== 2006-05-15 Adam Piatyszek * IT++ 3.10.2 released (SVN tag: release-3-10-2) * NEWS: Updated to reflect recent changes. * doc/local/index.doc.in, doc/local/installation.doc, INSTALL: Updated according to the recent changes. * doc/local/authors.doc: Cosmetic changes. * doc/local/verification.doc: Updated to reflect recent tests under Windows (Cygwin and MinGW with ACML). * configure.ac, itpp/base/trihypfunc.h: Added checks for acosh(), asinh() and atanh() functions. * itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h: Finally fixed the declaration of `signgam' and definition and lgamma() function. This should solve problems on systems where lgamma() does not set `signgam' variable, e.g. under MinGW. 2006-05-11 Adam Piatyszek * tests/fix_test.cpp, tests/fix_test.ref, tests/llr_test.cpp, tests/llr_test.ref, tests/window_test.cpp, tests/window_test.ref: More "dirty" hacks added due to a floating-point rounding error under MinGW compiler. * doc/local/installation.doc, INSTALL: Updated documentation according to the recent changes. * config/acx_fft.m4: Changed the order of checking for FFT libraries. 2006-05-10 Adam Piatyszek * tests/source_test.cpp, tests/source_test.ref, tests/window_test.cpp, tests/window_test.ref: Minor fixes in test programs due to different formatting under MinGW environment. * test/Makefile.am: Added a dirty hack using sed regular expresion that ensures floating point output in the form of `e-06' instead of `e-006', which is default for the MinGW compiler. * configure.ac: Check for a host added, which is used to disable building of a shared library on Windows based platforms. 2006-05-09 Adam Piatyszek * itpp/config_msvc.h: Manually updated the config header for MSVC++ .NET with MKL. * itpp/base/timing.cpp: Fixed gettimeofday() function definition for Windows based platforms (MinGW, MSVC++). No need for MINGW definition any more. * configure.ac, itpp/base/elmatfunc.cpp, itpp/base/elmatfunc.h: Added checks for `lgamma' and `tgamma' functions, and `signgam' declaration. This solves problems on some platforms where these declaration and/or functions are not available. * itpp/base/random.cpp: Added missing include file (undefined gamma function). * configure.ac, Makefile.am, tests/Makefile.am: Fixed a problem with different line endings on Windows based platforms. Now, sed program is necessary for performing tests. 2006-05-08 Adam Piatyszek * itpp/base/cblas.cpp: Fixed bug [1483125]. Now a complex dot product is properly returned by a dot function when using ACML blas libraries. Thanks to Danilo Zanatta for this bug report. 2006-05-04 Adam Piatyszek * itpp/itmex.h: Fixed missing std:: specifiers before complex<> types. 2006-05-03 Adam Piatyszek * itpp/base/logexpfunc.h, itpp/base/matfunc.h, itpp/base/specmat.cpp, itpp/comm/channel.cpp, itpp/comm/modulator.cpp, itpp/signal/sigfun.cpp, itpp/signal/transforms.cpp, itpp/srccode/vq.h: Fixed bug [1480535]. Now needed_bits() returns a proper number of bits required to represent integer `n', e.g. "needed_bits(0) = 1", "needed_bits(7) = 3" and "needed_bits(8) = 4". * itpp/itmex.h: Fixed a small bug related to missing #include statement and cleaned up the code. 2006-05-02 Erik G. Larsson * itpp/base/svec.h: Fixed a bug in the == operator. Thanks to Mattias Andersson for discovering the bug. 2006-04-29 Adam Piatyszek * doc/local/authors.doc, doc/local/index.doc.in, doc/local/sources.mk: Added AUTHORS page. * doc/local/help_wanted.doc: Cosmetic changes. 2006-04-27 Adam Piatyszek * itpp/comm/galois.cpp: Added missing include file with log2() function declaration. * doc/sourceforge/howto_release_itpp.html: Updated due to CVS to SVN repository migration. * Redesign, separation and regrouping of some functions from the base module. The following changes have been applied: - Now using one overloaded and templated "apply_function" instead of a set of various "vec_function" and "mat_function" in "help_functions.*". Such a templated "apply_function", with the same functionality, was implemented in "matfunc.*". Thus, removed. - Moved trigonometric and hyperbolic functions (all inline, and both ones for scalars and vectors) to a separate header file "trihypfunc.h". - Moved logarithmic and exponential functions to a separate header file "logexpfunc.h". - Moved error functions to separate files "errorfunc.*". - Merged elementary mathematics functions from "scalfunc.*" with the content of elmatfunct.*". The rest of scalfunc.* content moved to "itmisc.*". "scalfunc.*" removed. - A lot of minor changes that should improve the readability of the base module. 2006-04-21 Adam Piatyszek * doc/local/index.doc.in, doc/local/itpp_header.html, /doc/local/itpp_footer.html: Added links to Feature Requests, IT++ at freshmeat and Newcom project (logo). 2006-04-20 Adam Piatyszek * itpp/base/stat.h: Added Histogram class setup function provided by Jordy Potman. This closes Feature Request [1473059]. 2006-04-13 Adam Piatyszek * itpp/signal/filter.cpp: Fixed bug [1469860]. Now fir1() declaration matches its definition. Thanks to Jordy Potman for reporting this bug. 2006-04-12 Adam Piatyszek * doc/doxygen_html.cfg.in: Doxygen configuration changed to generate detailed documentation at the top of pages. ============================================================================== 2006-04-11 Adam Piatyszek * IT++ 3.10.1 released (SVN tag: release-3-10-1) * NEWS: Updated to reflect recent changes. * configure.ac: Updated IT++ External package version number. * itpp/base/ls_solve.cpp: Fixed a bug caused by improper wrapping of backslash functions using it_assert1() macro. * itpp/signal/filter.cpp, itpp/signal/filter.h: Fixed bug [1468011], so AR_Filter now works when using a single coefficient value, e.g. a = "0.5". Minor cosmetic changes applied by the way. 2006-04-10 Adam Piatyszek * itpp/comm/convcode.cpp, itpp/comm/convcode.h, tests/convcode_test.cpp, tests/convcode_test.ref: Fixed improper behaviour of the encode_trunc() and decode_trunc() functions. Now, each execution of these functions does not reset the encoder and decoder states, so it can be used to perform continous decoding process. An additional reset() function has been added to reset the encoder and decoder states. 2006-04-07 Adam Piatyszek * doc/local/verification.doc, doc/local/installation.doc: Minor documentation updates. 2006-04-05 Adam Piatyszek * itpp/itcomm.h, itpp/itfixed.h, itpp/itprotocol.h, itpp/itsignal.h, itpp/itsrccode.h: Readded inclusion of dependent header files (`itpp/itbase.h' or `itpp/itsignal.h'). 2006-04-04 Adam Piatyszek * itpp/base/bessel/jv.cpp, itpp/base/scalfunc.cpp, itpp/base/scalfunc.h: Fixed lgamma() and gamma() functions definitions for MSVC++ .NET. 2006-04-03 Adam Piatyszek * itpp/base/bessel/airy.cpp, itpp/base/bessel/chbevl.cpp, itpp/base/bessel.cpp, itpp/base/bessel/hyperg.cpp, itpp/base/bessel/i0.cpp, itpp/base/bessel/i1.cpp, itpp/base/bessel/iv.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/k0.cpp, itpp/base/bessel/k1.cpp, itpp/base/bessel/kn.cpp, itpp/base/bessel/polevl.cpp, itpp/base/bessel/struve.cpp: Fixed a problem with a few Bessel functions provided by under MSVC++ (different naming conventions). BTW, file headers updated. * itpp/itbase.h: Minor fix - including `itmisc.h' file. 2006-03-31 Adam Piatyszek * doc/local/verification.doc: Updated IT++ Supported Systems page with new tests. * config/acx_fft.m4: Improvements and fixes in external FFT library detection. * config/acx_cblas.m4: Added check for acml.h header file when checking for ACML's CBLAS library. * itpp/base/cblas.cpp, config/acx_cblas.m4, configure.ac, doc/doxygen_html.cfg.in, itpp/base/sources.mk: Fixed CBLAS interface when using ACML BLAS implementation. ACML C interface is not the same as in other implementation, so a limited set of wrapper functions has been created in `cblas.cpp' file. 2006-03-28 Adam Piatyszek * TODO: Updated to reflect recent changes. * itpp/base/itpp_version.cpp, itpp/base/itpp_version.h, itpp/itconfig.h, itpp/base/array.h, itpp/base/mat.h, itpp/base/newton_search.cpp, itpp/base/newton_search.h, itpp/base/sources.mk, itpp/base/vec.h, itpp/sources.mk: Merged the content of itpp/itconfig.h and itpp/base/itpp_version.{cpp,h} files into new files itpp/base/itmisc.{cpp,h}. The new files should include miscleaneous functions related to IT++ library. 2006-03-27 Adam Piatyszek * configure.ac, itpp-config.in: Minor fix in the itpp-config script. Now `itpp-config --libs-debug' uses `-litpp' when the debug library is not available. 2006-03-25 Adam Piatyszek * itpp/comm/commfunc.h, itpp/comm/sequence.h, itpp/fixed/fix_base.h, itpp/itbase.h, itpp/itcomm.h, itpp/itconfig.h, itpp/itfixed.h, itpp/itprotocol.h, itpp/itsignal.h, itpp/itsrccode.h: Documentation of IT++ modules divided into modules. Minor fixes in various places. 2006-03-24 Adam Piatyszek * doc/local/features.doc: Statistics classes and functions moved from signal-processing to base math module. * itpp/sources.mk: Added missing "itpp/itsignal.h" file. * itpp/srccode/lpcfunc.cpp, itpp/signal/fastica.cpp: Fixed improper include statements after moving signal-processing related classes and functions to a separate subdirectory. * config/acx_blas.m4: Removed unnecessary check for "libblas", beside "libf77blas" in ATLAS detection routines. This fixes a configuration problem in the case when both the ATLAS and NetLib's blas libraries are installed. 2006-03-23 Adam Piatyszek * configure.ac: Changed CBLAS and LAPACK library detection order due to linking problems under Cygwin. 2006-03-21 Adam Piatyszek * AUTHORS: Andy Panov included in a list of contributors. * itpp/base/stat.h, tests/stat_test.cpp, tests/stat_test.ref: Added templated Histogram class provided by Andy Panov. This closes feature request [1451288]. * Moved signal processing related sources to a separate "signal" subdirectory. Test programs updated accordingly. Please note that now is not included automatically in "itcomm.h", "itfixed.h", "itprotocol.h", "itsignal.h" and "itsrccode.h". 2006-03-20 Adam Piatyszek * configure.ac, doc/Makefile.am, itpp/Makefile.am, itpp/signal/Makefile.am, itpp/signal/sources.mk: Added signal subdirectory and modified make files for a new signal processing module. 2006-03-19 Adam Piatyszek * configure.ac: Version numbers updated. * Renamed `fixedpoint' subdirectory into `fixed'. * doc/local/index.doc.in: Changed CVS related links to SVN ones (merged rev. 361:372 from itpp-3-10 branch). 2006-03-17 Adam Piatyszek * CVS->SVN repository conversion. 2006-03-16 Adam Piatyszek * tests/modulator_nd_test.cpp: Fixed minor bug with namespace and cerr (merged from itpp-3-10-branch). * itpp/protocol/selective_repeat.cpp: Fixed improper logical check in the `it_assert' macro (merged from itpp-3-10-branch). * itpp/base/scalfunc.h: Added `#include ', which solves compilation problems using MSVC++ .NET 2005 (merged from itpp-3-10-branch). * AUTHORS: Updated to reflect recent staff changes (merged from itpp-3-10-branch). * Created CVS branch `itpp-3-10-branch' for bug-fixes in this release. ============================================================================== 2006-03-15 Adam Piatyszek * IT++ 3.10.0 released (CVS tag: release-3-10-0) * configure.ac: Cosmetic changes in CXXFLAGS settings. * doc/doxygen_html.cfg.in, itpp/base/binary.h, itpp/base/binfile.cpp, itpp/base/converters.cpp, itpp/base/converters.h, itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/parser.cpp, itpp/base/sigfun.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/comm/llr.cpp, itpp/comm/llr.h, itpp/comm/modulator_nd.h, itpp/comm/rec_syst_conv_code.cpp, itpp/comm/rec_syst_conv_code.h, itpp/srccode/audiofile.cpp: Minor fixes related to Doxygen warnings. * itpp/itconfig.h, itpp/base/newton_search.h, itpp/base/poly.h: Documentation fixes related to Doxygen groups (modules). 2006-03-14 Adam Piatyszek * doc/local/installation.doc: Added installation instructions for MacOS X users based on the discussion from the Help forum: "3.9.1 on MacOS X doesn't compile". 2006-03-13 Adam Piatyszek * doc/Makefile.am, doc/images/Makefile.am, doc/images/itpp_logo.png, doc/images/newcom_logo.png, doc/local/itpp_header.html: Added Newcom project logo to the IT++ home pages. 2006-03-12 Adam Piatyszek * NEWS, TODO, configure.ac: Final cosmetic changes before 3.10.0 release scheduled for March 15th. * AUTHORS: Moved not active developers to "Retired Developers" section. 2006-03-07 Adam Piatyszek * doc/local/installation.doc, doc/local/linking.doc, doc/local/users_guide.doc: Added Table of Contents and revised some parts of the documentation. * doc/local/verification.doc: Added tests for Fedora Core 4 with ATLAS and FFTW. 2006-03-03 Adam Piatyszek * tests/modulator_nd_test.cpp, tests/modulator_nd_test.ref: Minor fixes in modulator_nd_test program (check if HAVE_LAPACK is defined). * config/acx_fft.m4: Fixed a bug in detection of FFT library when explicit `--with-fft=-lfftw3' was used. 2006-03-02 Adam Piatyszek * doc/local/features.doc, doc/local/index.doc.in: Cosmetic documentation changes. ============================================================================== 2006-03-02 Adam Piatyszek * IT++ 3.10.0-rc1 released (CVS tag: release-3-10-0-rc1) * NEWS: Updated to include changes since IT++ 3.9.1 was released. 2006-03-01 Adam Piatyszek * Makefile.am, doc/Makefile.am: Beside `*.gzip' distribution packages `*.bzip2' packages will be produced automatically. * configure.ac, doc/local/index.doc.in: ITPP_EXTERNAL_VERSION variable added in the configure.ac file to set IT++ External package version in download links automatically. * config/acx_cblas.m4: Fixed a bug in cblas library detection when using BLAS and CBLAS from IT++ External package on Cygwin. * doc/local/verification.doc: Added tests for SUSE 10.0 (x86_64) and SunOS 5.9 (SPARC). 2006-02-28 Adam Piatyszek * doc/local/verification.doc: Verification pages redesigned to include more information. Added tests statuses for Gentoo Linux and Cygwin operating systems. 2006-02-20 Tony Ottosson * doc/local/{features.doc, index.doc, sources.mk}: Added a list of features of IT++. 2006-02-17 Erik G. Larsson * doc/tutorial/matlab_itpp.doc, doc/tutorial/tutorial.doc, doc/tutorial/sources.mk: Added first draft of how a Matlab/IT++ conversion table can look like, more to be added later. Restructured the tutorial page. 2006-02-17 Adam Piatyszek * configure.ac: Fixed a problem with the same ASSERT_LEVEL definition in both debug and standard target libraries. * TODO: Updated to reflect recent brainstorming among developers. * doc/local/linking.doc: Minor updates to reflect recent changes. * itpp-config.in, itpp.pc.in: Added `--cflags-opt' and `--debug-opt' switches to `itpp-config' script. Simple `--cflags' switch does not include any optimisation flags in both script. * INSTALL, README, doc/local/installation.doc, doc/local/linking.doc: Documentation updated to reflect recent changes in the configuration process. * configure.ac, **/Makefile.am, itpp-config.in, itpp.pc.in: Major changes in the configuration process. Since now it is possible to build and install two separate libraries: the optimised `libitpp.*' and debug `libitpp_debug.*'. The latter one is only build when `--enable-debug' switch is used during configuration. `itpp-config' script has been extended with `--cflags-debug' and `--libs-debug' switches. Besides, if CXXFLAGS is not set in the shell environment, it is initialised with "-O3 -pipe" or "-O3" flags by default. 2006-02-16 Adam Piatyszek * tests/matfunc_test.cpp: Minor fix of rounding precision. * itpp-config.in, itpp.pc.in: Readded CXXFLAGS to the configuration scripts. * configure.ac, INSTALL, doc/local/installation.doc: Removed `--with-march' GCC-specific optimisation switch. CXXFLAGS should be used instead. 2006-02-16 Erik G. Larsson * doc/local/installation.doc, doc/local/index.doc.in: Minor update * itpp/comm/llr.*, tests/llr_test.ref: Minor updates * itpp/comm/modulator_nd.*, tests/modulator_nd.*, itpp/comm/sources.mk, tests/Makefile.am: First version of the vector/MIMO modulator class added 2006-02-14 Adam Piatyszek * tests/Makefile.am: Removed limits_test, which was only useful on 32-bit platforms * Makefile.common: Fixed a bug that caused that the improper header file was used during compilation * config/acx_lapack.m4: Small fix in the automatic MKL's LAPACK library detection. Now using shared libraries `-lmkl_lapack32' and `-lmkl_lapack64' instead of a static one by default. * config/acx_blas.m4: Small fix in the automatic MKL's BLAS library detection (added missing -lpthread) 2006-02-13 Adam Piatyszek * itpp.spec.in: Created subpackage with the HTML documentation * configure.ac, itpp-config.in, itpp.pc.in, tests/Makefile.am: Reverted some receent changes in the configuration scripts, bacause linking problems with Fortran libraries under x86_64 platform were caused by an outdated libtool. 2006-02-10 Adam Piatyszek * itpp.spec.in: Added missing files in the `%files' section * Makefile.common: Unneccessary AM_LDFLAGS removed * configure.ac: Using ITPP_LIBS instead of global LIBS due to linking problems with Fortran libs under x86_64 platform * itpp-config.in, itpp.pc.in: Flags updated because of the changes in the configure script * tests/Makefile.am: Locally defined LIBS flag to properly link to external libraries * tests/newton_search_test.cpp: Cosmetic changes - removed unneccessary variables * itpp/base/filter.h, itpp/comm/channel_code.h: Added virtual destructor to base classes. This prevents warnings during compilation with gcc-4.0.x. 2006-02-09 Adam Piatyszek * itpp.spec.in: Changes in `Name', `Version' and `Release' definitions. Removed distribution dependent release settings. Added DESTDIR to make install command. * configure.ac, Makefile.am: Added RPM's spec file to the distribution package. Added RPM_RELEASE variable to the configure.ac. * config/acx_cblas.m4: Added support for detecting libgslcblas * config/acx_fft.m4: Minor fixes to the FFT detection routines. Now, MKL and ACML FFT routines are searched in the default BLAS library first; even if BLAS was defined explicitly using `--with-blas' switch. 2006-02-08 Adam Piatyszek * doc/tutorial/itfile.doc, doc/tutorial/rayleigh.doc, doc/tutorial/src/Makefile.am, doc/tutorial/src/rayleigh.cpp, doc/tutorial/src/read_it_file.cpp, doc/tutorial/src/sources.mk, doc/tutorial/src/write_it_file.cpp: Updated tutorial example programs and their description. Removed unnecessary reference files for the tutorial programs. (merged from itpp-3-9-branch) * extras/Makefile.am: Matlab/Octave itload.m and itsave.m scripts are now installed into $PREFIX/share/doc (merged from itpp-3-9-branch) 2006-02-07 Adam Piatyszek * tests/newton_search_test.cpp, tests/newton_search_test.ref: Fixed precision problems when using MKL 2006-02-06 Adam Piatyszek * itpp/base/transforms.cpp, tests/transforms_test.cpp, tests/transforms_test.ref: Bug-fixes in FFT/IFFT functions based on ACML library. Temporary `comm' vectors are now allocated dynamically when neccessary. This fixes segmentation faults in sigfun and filter_design test programs. 2006-02-05 Adam Piatyszek * INSTALL, doc/local/index.doc.in, doc/local/installation.doc: Documentation updated to reflect recent changes in configuration's scripts * configure.ac: Cosmetic changes in displayed report * README: Updated with the content from IT++ html main page 2006-02-03 Adam Piatyszek * itpp/base/newton_search.cpp, itpp/base/newton_search.h: Minor fixes in overloaded search functions (added returned bool value) * itpp/base/transforms.cpp, itpp/base/transforms.h, tests/transforms_test.cpp, tests/transforms_test.ref: Added IDCT implementation to idct() functions based on the MKL and ACML. Test program updated as well. * doc/local/index.doc.in: IT++ main html page updated (using CSS instead of tables for layout) 2006-02-02 Tony Ottosson * itpp/base/newton_search.{h,cpp}, tests/newton_search_test.cpp: Newton search optimization routines. For now the BFGS algorithm and line-search. For matlab compatibility the fminunc() is implemented. 2006-02-02 Adam Piatyszek * itpp/base/transforms.cpp: Added DCT implementation based on the ACML library * configure.ac, config/acx_fft.m4, itpp/base/transforms.cpp, tests/transforms_test.cpp, tests/transforms_test.ref: New FFT and IFFT implementations added, based on the external ACML library. DCT and IDCT are still missing. * tests/Makefile.am, tests/fft_test.cpp, tests/fft_test.ref: Removed fft tests because they duplicated transform tests * itpp/protocols/tcp.cpp: Small fix that solves MSVC++ .NET compilation problem (#include ) (merged from itpp-3-9-branch) 2006-02-01 Adam Piatyszek * itpp/base/transforms.cpp: Fixed bug [1418707] by adding the FFTW_UNALIGNED option to the plan creation flags, which allows a standard memory allocation of input and output data. This temporary solution reduces performance on processors that use SSE and SSE2 instructions. (merged from itpp-3-9-branch) * configure.ac, NEWS: Updated for the next bug-fix release (merged from itpp-3-9-branch) 2006-01-31 Adam Piatyszek * configure.ac, config/*.m4, itpp-config.in, itpp.pc.in, doc/doxygen_html.cfg.in, itpp/config_msvc.h, itpp/base/*.{cpp,h}, tests/*.cpp: Major redesign of the configuration scripts. The following things changed: - added support for ACML (AMD Core Math Library) - checks for BLAS now detect MKL, ACML, ATLAS and reference (from Netlib) BLAS implementations; if found, HAVE_BLAS is defined - checks for LAPACK also detect MKL, ACML, ATLAS and reference LAPACK library; if found, HAVE_LAPACK is defined - checks for CBLAS detect MKL, ATLAS and reference implementation, however CBLAS is fully optional; if found, HAVE_CBLAS is defined - new checks for FFT: detects MKL or FFTW3 implementation; if found, HAVE_FFT and either HAVE_FFTW3 or HAVE_FFT_MKL8 are defined - new checks for and header files provided by external libraries; not using any more. It is now possible to mix various implementation of BLAS, LAPACK and FFT routines, e.g.: - use MKL for BLAS, reference Netlib's LAPACK and FFTW3, - use ACML for BLAS and LAPACK, reference Netlib's CBLAS and FFTW3. This redesign has been tested using Cygwin and Gentoo Linux. The latter one had MKL v8.0.1, ACML v3.0.0, ATLAS v3.6.0, FFTW v3.0.1 and Netlib's BLAS, CBLAS and LAPACK v3.0 libraries installed. TODO: Update installation instructions in the documentation. Test if the changes did not cause any problems for MSVC++ .NET users. 2006-01-29 Erik G. Larsson * itpp/doc/local/installation.doc: Documentation update ============================================================================== 2006-01-28 Adam Piatyszek * IT++ 3.9.1 released (CVS tag: release-3-9-1) * configure.ac, config/acx_blas.m4, config/acx_cblas.m4, config/acx_fftw.m4, config/acx_lapack.m4: Final bug-fixes before release 3.9.1 in the configuration scripts (merged from itpp-3-9-branch) 2006-01-28 Erik G. Larsson * itpp/**/*.{cpp,h}: Replaced "assert()" with "it_assert()", multiple instances, to solve a problem with compilation errors; probably a consequence of the revision of #include statements. * itpp/comm/llr.h: Cosmetic changes 2006-01-27 Adam Piatyszek * INSTALL, doc/local/installation.doc: Updated to reflect recent modifications in configuration scripts (merged from itpp-3-9-branch) * autogen.sh, configure.ac, config/acx_blas.m4, config/acx_cblas.m4, config/acx_lapack.m4: Scripts modified to simplify the configuration process (merged from itpp-3-9-branch) 2006-01-26 Adam Piatyszek * doc/local/verification.doc: Test results of version 3.9.1 included (merged from itpp-3-9-branch) * NEWS, TODO: Updated before releasing verision 3.9.1 (merged from itpp-3-9-branch) * itpp/**/*.{cpp,h}: Revised all "#include" commands to minimise the number of dependencies between various sources and modules. Please report any compilation and linking problems, which might occure after this mass update. 2006-01-25 Erik G. Larsson * itpp/comm/turbo.h, itpp/comm/turbo.cpp: Added support for table-lookup based decoding (in LLR domain) * itpp/comm/rec_syst_conv_code.h, itpp/comm/rec_syst_conv_code.cpp: Added support for table-lookup based decoding (in LLR domain) * tests/turbo_test.cpp: Revised test program for turbo codes * itpp/base/gf2mat.h, itpp/comm/llr.h: Documentation updates 2006-01-25 Adam Piatyszek * tests/cholesky_test.cpp, tests/cholesky_test.ref, tests/det_test.cpp, tests/det_test.ref, tests/eigen_test.cpp, tests/eigen_test.ref, tests/inv_test.cpp, tests/lu_test.cpp, tests/lu_test.ref, tests/qr_test.cpp, tests/qr_test.ref, tests/svd_test.cpp, tests/svd_test.ref: Modified test rutines based on LAPACK to make them robust to non-unique results (merged from itpp-3-9-branch) * itpp/base/elmatfunc.h, itpp/base/scalfunc.h, itpp/base/stat.h: Changed the default floating-point precision threshold from 1e-15 to 1e-14 (merged from itpp-3-9-branch) * tests/timer_test.cpp: Minor fixes in the order of logical tests occurence (merged from itpp-3-9-branch) * doc/local/index.doc.in, doc/local/itpp_header.html: Cosmetic changes: "Version" -> "Stable Release" (merged from itpp-3-9-branch) * configure.ac, itpp/config_msvc.h, itpp/base/itassert.h: Fixed a bug with redefinition of NDEBUG and ASSERT_LEVEL in the and CXXFLAGS (merged from itpp-3-9-branch) 2006-01-24 Adam Piatyszek * tests/matfunc_test.cpp, tests/matfunc_test.ref: Fixed the problem with two possible solutions of a complex matrix square root - `sqrtm()' function * itpp/base/stat.cpp, itpp/base/stat.h: `norm()' functions revised - from now the implementation is similar to the Octave one, i.e. both vector- and matrix-based functions accept "fro" argument to choose the Frobenius norm. `frob_norm()' functions removed. 2006-01-24 Erik G. Larsson * itpp/itcomm.h: Included * itpp/comm/llr.h, itpp/comm/llr.cpp: Added new LLR algebra class * tests/llr_test.cpp, tests/llr_test.ref: Added test program for LLR class * itpp/comm/sources.mk, tests/Makefile.am: Updated accordingly 2006-01-24 Adam Piatyszek * tests/schur_test.cpp, tests/schur_test.ref: Fixed the schur test program so now it should pass for different BLAS/LAPACK implementations 2006-01-23 Adam Piatyszek * itpp/base/converters.cpp: Fixed bug [1412383]. The dec2bin() functions appended en extra zero in front of the bit vector. This wrong behaviour has been fixed. (merged from itpp-3-9-branch) * tests/matfunc_test.cpp: Added a check for LAPACK or MKL libraries, which are needed by the sqrtm() funciton * itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h: Fixed a problem with non existing specialisation of the `operator*' and `dot' function when linking without CBLAS 2006-01-22 Adam Piatyszek * itpp/base/converters.h: Removed strange `#if 0 ... #endif' statements * Makefile.am: Added itpp_msvc2003.* files to EXTRA_DIST variable * INSTALL, doc/local/installation.doc: Updated to reflect recent changes in configuration script * configure.ac, itpp/itconfig.h, itpp/base/itassert.cpp, itpp/base/itassert.h: Added `--enable-exceptions' switch to configure handling of exceptions 2006-01-22 Thomas Eriksson * Added module "protocol" to msvc project files * Some changes of protocol module for msvc compability 2006-01-22 Thomas Eriksson * itpp_msvc2003.sln, itpp_msvc2003.vcproj: Added project files to keep MSVC.net 2003 compability 2006-01-22 Adam Piatyszek * itpp/comm/hammcode.cpp, itpp/comm/reedsolomon.cpp, itpp/comm/sequence.cpp: Minor improvements, e.g. changing `round_i(pow(2,m)' to `pow2i(m)' * itpp/base/filter_design.cpp: Cosmetic change - unused variable commented out * itpp/base/sources.mk: Added missing window.{cpp,h} files * itpp/base/bessel.cpp, itpp/base/random.h, itpp/base/bessel/jv.cpp, itpp/base/bessel/struve.cpp: Fixed a problem with "#pragma" warnings during compilation with GCC 2006-01-21 Thomas Eriksson * A lot of changes for MSVC.net 2005 compability Removed warnings on depreceated functions j0, j1, hypot etc. (using #pragma directives) These functions should not be used in the next ISO C++ standard. 2006-01-21 Adam Piatyszek * itpp/base/binfile.cpp, itpp/base/cholesky.cpp, itpp/base/copy_vector.h, itpp/base/eigen.cpp, itpp/base/inv.cpp, itpp/base/lapack.h, itpp/base/ls_solve.cpp, itpp/base/lu.cpp, itpp/base/mat.h, itpp/base/qr.cpp, itpp/base/svd.cpp, itpp/base/timing.cpp, itpp/base/transforms.cpp, itpp/base/vec.h: Including a proper configuration header depending on _MSC_VER definition (merged from itpp-3-9-branch) 2006-01-19 Tony Ottosson * itpp/base/window.{h,cpp}, tests/window_test.cpp: New files. Some code moved from base/specmat.{h,cpp}. Also added blackman() and increased the documentation. 2006-01-18 Tony Ottosson * itpp/base/elmatfunc.h: Added log() for cvec and cmat. * itpp/base/filter_design.{h,cpp}: Added modified_yulewalker(), arma_estimator(), and yulewalk(). * test/filter_design_test.{cpp,ref}: Updated for new functions. 2006-01-14 Adam Piatyszek * itpp/base/schur.cpp, tests/schur_test.cpp: Fixed a bug that caused compilation error when LAPACK was not installed * itpp/base/matfunc.cpp (sqrtm): Removed unnecessary to_cmat() conversion * tests/matfunc_test.ref: Updated improper reference file 2006-01-13 Adam Piatyszek * tests/*.cpp, tests/transforms_test.ref: Fixed incorrect preprocessor checks for defined external libraries. One reference file updated. (merged from itpp-3-9-branch) * itpp/base/transform.cpp: Fixed improper error messages (merged from itpp-3-9-branch) * configure.ac: Fixed a minor bug, which prevented disabling CBLAS support using `--without-cblas' configure switch (merged from itpp-3-9-branch) 2006-01-11 Tony Ottosson * itpp/base/transforms.{h,cpp}: Added zero-padding for fft_real() and ifft_real(). Also made all size input variables const. * itpp/base/poly.{h,cpp}: Added polyval() for vec and cvec input combinations. 2006-01-11 Adam Piatyszek * itpp/base/matfunc.cpp, itpp/base/matfunc.h, tests/matfunc_test.cpp, tests/matfunc_test.ref: Added sqrtm() function that calculates the matrix square root for real and complex matrices. Based on Octave implementation. * itpp/base/stat.cpp, itpp/base/stat.h: Added frob_norm() functions that calculate Frobenius norm of matrices * itpp/base/machdep.h: Reverted back recent changes due to compilation problems under MSVC++ .NET (merged from itpp-3-9-branch) 2006-01-10 Thomas Eriksson * itpp/base/machdep.h: Was changed in an undocumented way. I had to change back one line ("#elif defined(__i386__) .....") to make it compile in MSVC++. 2006-01-10 Adam Piatyszek * itpp/base/matfunc.cpp, itpp/base/matfunc.h: Cosmetic changes - removed unnecessary definition and updated author's list (merged from itpp-3-9-branch) 2006-01-09 Adam Piatyszek * INSTALL: Updated fragment with GCC version recommendations (merged from itpp-3-9-branch) * configure.ac, doc/local/index.doc.in: Updated for the next minor release (3.10.0) * NEWS: Merged changes from itpp-3-9-branch into the trunk 2006-01-08 Adam Piatyszek * doc/images/favicon.ico, doc/images/itpp_logga.jpg, doc/images/itpp_logga.xcf: Changed keyword expansion mode for binary files * doc/local/installation.doc: Updated fragment with GCC version recommendations * tests/Makefile.am, tests/rec_syst_conv_code_test.cpp, tests/rec_syst_conv_code_test.ref: Minor cosmetic changes (renamed some test files) * itpp/base/fastica.cpp, itpp/base/gf2mat.cpp, itpp/base/gf2mat.h, itpp/base/machdep.h, itpp/base/scalfunc.h, itpp/comm/interleave.h, itpp/protocol/packet_generator.cpp, tests/gf2mat_test.cpp: Minor cosmetic changes, e.g. removing inappropriate semicolons (detected when compiling with `-ansi' and `-pedantic' flags). * itpp/base/mat.h, itpp/base/vec.h: Fixed bug [1399822]. The problem was caused by explicit specialisation of some templated operators, when HAVE_CBLAS or HAVE_MKL are defined. In such a case, the following forward declarations of explicit instantiations (with extern) of these operators should be switched off. 2006-01-07 Adam Piatyszek * itpp/itbase.h, itpp/base/lapack.h, itpp/base/schur.cpp, itpp/base/schur.h, itpp/base/sources.mk, tests/Makefile.am, tests/schur_test.cpp, tests/schur_test.ref: Implemented Schur decomposition functions for real and complex matrices using LAPACK's DGEES and ZGEES routines. Test file prepared as well. 2006-01-06 Adam Piatyszek * doc/images/favicon.ico, doc/images/Makefile.am, doc/local/itpp_header.html, doc/Makefile.am: Added IT++ favicon 2006-01-04 Adam Piatyszek * extras/itsave.m: Fixed bug [1396020]. Now itsave() works properly in both Matlab and Octave. Thanks to Jordy Potman for providing a patch. 2006-01-01 Adam Piatyszek * autogen.sh: Reordering of the invoked commands itpp-4.3.1/ChangeLog-2007000066400000000000000000002525601216575753400146640ustar00rootroot000000000000002007-12-30 Erik G. Larsson * doc/local/verification.doc: Documentation update 2007-12-24 Adam Piatyszek * configure.ac.in, itpp/base/Makefile.am, itpp/base/sources.mk, itpp/base/zdotusub.f, m4/acx_blas.m4: Removed redundant zdotusub_ Fortran wrapper to zdotu_ function Now, the proper calling conventions of zdotu_ Fortran function should be detected properly in all cases. Therefore, the zdotusub_ wrapper function, which was a temporary workaround solution, should not be required any more. 2007-12-23 Adam Piatyszek * m4/ax_func_zdotu.m4: Improved zdotu_ calling convention tests The previous tests did not work properly on Debian unstable (sid) and SUSE 10.0 64-bit architectures. The improved tests work as expected. 2007-12-21 Adam Piatyszek * itpp/base/blas.h, itpp/base/vec.h: Fix wrong zdotu_ calling convention on Debian amd64 This patch promotes the calling convention of BLAS zdotu_ function that returns its result through the first function argument. This is the default method used by older GCC Fortran compiler (version 3). On Debian amd64, the configure-time detection of the proper calling convention results in both methods working. However, the method that returns the complex result by value, like standard C/C++ functions, causes failures of blas_test and vec_test. This patch fixes bug report [1855481]. 2007-12-17 Adam Piatyszek * doc/local/linking.doc: Cosmetic documentation fixes ------------------------------------------------------------------------------ 2007-12-15 Adam Piatyszek * IT++ 4.0.1 released (SVN tag: release-4-0-1) * NEWS: Release notes for IT++ 4.0.1 added 2007-12-13 Adam Piatyszek * doc/Makefile.am, doc/tutorial/src/Makefile.am: Build tutorial examples when doing "make check" Compile and link time incompatibilities between the library interfaces and tutorial example programs should now be detected during the standard check procedure. * doc/local/installation.doc, doc/local/linking.doc: Documentation updated to reflect changes in MSVC++ project files * win32/itpp_acml.vcproj, win32/itpp_acml_tests/*.vcproj, win32/itpp_mkl.vcproj, win32/itpp_mkl_tests/*.vcproj: Replace explicit paths with LIB and INCLUDE environment variables With this change the user is responsible for setting the LIB and INCLUDE environment variables with proper directories to MKL or ACML librarary and include files. Besides, build multi-threaded DLL libraries by default. * itpp/base/binfile.cpp, itpp/base/copy_vector.h: Include missing header files to fix compilation using GCC 4.3 2007-12-11 Erik G. Larsson * itpp/comm/ldpc.h, itpp/comm/ldpc.cpp: Improvements to the generation of regular LDPC codes 2007-12-10 Erik G. Larsson * doc/tutorial/src/ldpc_bersim_awgn.cpp: Changed tutorial so it counts bit errors in entire block, not only systematic bits * itpp/comm/ldpc.cpp, tests/ldpc_test.ref: Fixed spelling error 2007-12-10 Adam Piatyszek * m4/acx_blas.m4: Improve autodetection of ACML libraries * itpp/base/algebra/qr.cpp: Fix incorrect precalculation of the workspace size for QR decomp. The size of the workspace memory is now checked for each of [dz]gerf_, [dz]orgqr_, [dz]geqp3_ and [dz]ungqr_ funcitions separately, because they operate on different matrices. Besides, R is now correctly initialised with A before quering for the workspace size. * itpp/base/algebra/svd.cpp: Improvements in calculation of the SVD workspace size Before resizing the current memory allocated for SVD workspace, check if the workspace query was sucessful. If not, use the default, but not optimum workspace size. 2007-12-09 Simon Wood * itpp/base/algebra/qr.cpp, itpp/base/algebra/svd.cpp: Added a workspace query for each of the SVD and QR routines The query returns the optimal value of the memory workspace size used in SVD and QR decompositions. Setting the workspace size to an optimum value greatly improves the speed of calculations. 2007-12-08 Erik G. Larsson * doc/tutorial/src/ldpc_bersim_awgn.cpp: Fixes in tutorial examples. 2007-12-07 Adam Piatyszek * Makefile.am, configure.ac.in, doc/local/linking.doc, itpp_debug.pc.in: Provide itpp_debug.pc pkg-config's file This additional file can be used to obtain the debugging compiler flags and libraries. It is only installed, when IT++ is configured with the --enable-debug option. 2007-12-06 Adam Piatyszek * INSTALL, doc/local/installation.doc: Installation manual updated to reflect recent changes * itpp/base/math/misc.h, itpp/srccode/audiofile.h: Fix minor Doxygen warnings * configure.ac.in, itpp/base/converters.h, itpp/config_msvc.h: Move GCC_VERSION macro to the generated config.h file * itpp/comm/convcode.cpp: Replace ambiguous expression with a correct one "i = ++i;" is ambiguous in C/C++. For more information, see question 3.3 of the comp.lang.c FAQ list: http://c-faq.com/expr/ieqiplusplus.html * configure.ac.in: Use AC_MSG_NOTICE for printing configuration summary Thanks to this change, the configuration summary is automatically included in config.log, so there is no need to create a separate config_summary.log file. * configure.ac.in: Simplify detection of explicit library dependencies There is no need to check for "deplibs_check_method" by executing the "./libtool --config" command. This information is already available in a cached variable "lt_cv_deplibs_check_method" provided by the AC_PROG_LIBTOOL macro. 2007-12-05 Adam Piatyszek * configure.ac.in: Use "host_os" instead of "host" to simplify case statements * configure.ac.in: Enable explicit library dependencies on Mac OS X Dynamic linking on Mac OS X requires passing explicit library dependencies to the linker, even if libtool thinks it is not necessary. Therefore "enable_explicit_deps" is set to "yes" for this operating system. The solution is taken from pkg-config Portfile from macports. * itpp/base/random.cpp: Use tgamma() function instead of deprecated ambiguous gamma() * itpp/base/math/elem_math.h: Make sure itpp::gamma() use correct gamma implementation BTW, denote that this function name is deprecated due to its different implementation (and meaning) in BSD and glibc. * configure.ac.in: std::isfinite, std::isinf and std::isnan are broken on FreeBSD The use of these functions on FreeBSD with GCC 3.4.x compilers causes infinite loops or segmentation faults in bessel_test. Therefore, do not check for these functions and override them with local inlined implementations defined in itpp/base/math/main.h. * configure.ac.in, itpp/base/bessel/gamma.cpp itpp/base/math/misc.h itpp/config_msvc.h itpp/stat/mog_generic.cpp: Add full support of std::isfinite(), std::isinf() and std::isnan() Instead of using isnan(), isinf() C99 macros and deprecated finite() function switch to their equivalents in std library. This should solve recent portability problems under MinGW/MSYS. * itpp/base/bessel/hyperg.cpp, itpp/base/bessel/iv.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/k1.cpp, itpp/base/bessel/kn.cpp: Unify warning messages * itpp/base/bessel/airy.cpp, itpp/base/bessel/bessel_internal.h, itpp/base/bessel/chbevl.cpp, itpp/base/bessel/hyperg.cpp, itpp/base/bessel/i0.cpp, itpp/base/bessel/i1.cpp, itpp/base/bessel/iv.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/k0.cpp, itpp/base/bessel/k1.cpp, itpp/base/bessel/kn.cpp, itpp/base/bessel/polevl.cpp: Clean up "include" and "using namespace" statements * itpp/base/bessel/bessel_internal.h, itpp/base/bessel/gamma.cpp, itpp/base/bessel/hyperg.cpp, itpp/base/bessel/iv.cpp, itpp/base/bessel/jv.cpp, itpp/base/bessel/sources.mk, itpp/base/bessel/struve.cpp, win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Fixed wrong calculation of bessely() detected on Intel C++ compiler When IT++ was compiled with Intel C++ (icpc) compiler, the bessel_test failed on calculation of bessely() function for non-integer orders. This bug was caused by the fact that the ported bessel functions from Cephes Math Library should use a gamma function, which sets "signgam" global variable. But instead C99 tgamma() was used, which does not set "signgam". This patch adds explicit gam() and lgam() definitions, ported from the original Cephes Math Library, so all bessel functions in IT++ now use the proper gamma implementations. 2007-12-04 Adam Piatyszek * itpp/optim/newton_search.cpp: Initialize variables with zeros to suppress compiler warnings * itpp/base/math/misc.h: Add missing right parenthesis in isnan() definition 2007-12-03 Adam Piatyszek * configure.ac.in, itpp/base/math/misc.h, itpp/config_msvc.h: Fix improper use of HAVE_DECL_XXX definitions HAVE_DECL_XXX are always defined as 0 or 1, so one can not simply check if these names are defined. 2007-11-30 Adam Piatyszek * configure.ac.in, m4/acx_blas.m4, m4/acx_lapack.m4: Do not require Fortran compiler for BLAS/LAPACK linking BLAS and LAPACK libraries should be checked even if no Fortran compiler is available. For instance, BLAS/LAPACK routines from MKL can be used without additional Fortran libraries. This patch changes IT++ configuration scripts to make this possible. * m4/acx_blas.m4: Add support for MKL 10 MKL 10 requires explicit linking to -lguide and -lpthread libraries. With this patch MKL 8.1.1 or newer versions should be automatically detected on both 32- and 64-bit (em64t) Linux systems. 2007-11-26 Adam Piatyszek * configure.ac.in, itpp/config_msvc.h: Get rid of "min" and "max" macro definitions MSVC++ compiler defines these two macros and they might clash with our proper C++ code using std::min() and std::max() functions only. This patch removes such macros conditionally in the generated config.h and config_msvc.h header files. * m4/ax_func_zdotu.m4: Cosmetic changes in printed messages 2007-11-23 Adam Piatyszek * configure.ac.in, itpp/base/blas.h, itpp/base/vec.h, itpp/config_msvc.h, m4/acx_blas.m4, m4/ax_func_zdotu.m4: Detect incompatible g77/gfortran calling conventions of zdotu_ The calling conventions of zdotu_ BLAS function are different for g77 and gfortran compilers. In the case of g77, the result is passed using a first argument of zdotu_ function, whereas for gfortran the result is simply returned. To avoid building an extra Fortran wrapper, which workarounds this issue, IT++ needs to know which calling convention should be used. This patch adds two macros to the configure scripts that compile and try to run simple C++ programs using zdotu_ BLAS function, As a result of these checks the correct calling convention is used in itpp::dot() function. The Fortran zdotusub_ wrapper function can still be linked and used as a fallback solution. For more information on this issue, please have a look at this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178 * itpp/base/factory.h: Add explicit constructor definition in a default Factory class Without this explicit empty constructor in the Factory class, some compilers (PGI, HP C/aC++) give warnings or errors on a constant DEFAULT_FACTORY. * configure.ac.in, itpp/base/math/misc.h, itpp/config_msvc.h: Add additional checks for isinf() and isfinite() macros Without these new checks the compilation might fail on redeclaration of these macros with inline functions in itpp/base/math/misc.h. This problem occurs for instance on a HP-UX system. 2007-11-21 Adam Piatyszek * configure.ac.in, itpp/base/math/misc.h, itpp/config_msvc.h: Clean up checks for finite(), isfinite() and isnan() isnan() is defined as a macro on some systems in , so we should check for it. BTW, removed macro definition of finite(), which is also defined as inline function in "itpp/base/math/misc.h". * configure.ac.in: Removed duplicated checks AC_HEADER_STDC is invoked when AC_LANG([C++]) is used, whereas AC_PROG_MAKE_SET is executed by AM_INIT_AUTOMAKE. * m4/ac_cxx_extern_template.m4: Obsolete macros replaced with the ones recommended by autoconf AC_LANG_SAVE + AC_LANG_CPLUSPLUS -> AC_LANG_PUSH([C++]) AC_LANG_RESTORE -> AC_LANG_POP([C++]) AC_TRY_COMPILE -> AC_COMPILE_IFELSE + AC_LANG_PROGRAM * configure.ac.in, m4/acx_blas.m4, m4/acx_lapack.m4, m4/acx_fft.m4: Use AS_HELP_STRING macros instead of obsolete AC_HELP_STRING ones * Makefile.am, autogen.sh, configure.ac.in, m4/ac_cxx_extern_template.m4, m4/acx_blas.m4, m4/acx_lapack.m4, m4/acx_fft.m4: Renamed "config" directory to "m4" to reflect its contents * autogen.sh, configure.ac.in: Use "build-aux" directory for auxiliary building scripts This directory name is suggested in the autoconf manual as a standard placeholder for auxiliary build scripts. If this directory does not exist, create it before invoking autotools. * autogen.sh: On error return the exit code of the failing command * autogen.sh: Allow runing autogen.sh using an absolute path After checking the necessary tools the script now enters the IT++ source directory for the bootstrap process. * configure.ac.in: Report all automake warnings and treat them as errors This should give the maintainer and people building IT++ from SVN a better detection of possible bugs in Makefiles. 2007-11-16 Adam Piatyszek * configure.ac.in, tests/Makefile.am: Bump autoconf requirement to 2.60 and use AC_PROG_SED The $datarootdir and $docdir variables, which are used for HTML documentation installation, were introduced in autoconf 2.60. Therefore we need to check for this version. Besides, manual check for sed program is now replaced with AC_PROG_SED macro, which makes sed as a required dependency. Additionally, gdiff and gnudiff are searched as diff replacement. * tests/parser_test.cpp: Prevent warnings about string to char* conversions GCC >=4.2 uses "-Wwrite-string" in when "-Wall" flag is used and this results in warnings about deprecated conversions from constant strings to char*. This patch workarounds this problem by a bit different initialisation of arrays of char* strings. 2007-11-12 Adam Piatyszek * itpp/base/binfile.h: Fixed invalid cast from bool to enum The Apple's g++3.3 compiler from Mac Developer Tools v1.2 reports an error on a static cast from bool to enum. This patch changes the problematic code, so it should be accepted by older compilers. 2007-11-02 Adam Piatyszek * Makefile.am, configure.ac.in: Save configuration summary to config_summary.log file * configure.ac.in, itpp-config.in, itpp.pc.in: Improved itpp-config and itpp.pc scripts This patch adds an additional configure check to see whether external libraries' dependencies need to be explicitly added to the output of "itpp-config --libs" command. As a result it should be always possible to use "itpp-config --libs" or "pkg-config itpp --libs" without adding an extra --static switch. Besides, "itpp-config --libs" should now return exactly the same libraries as "pkg-config itpp --libs" on Mac OS X. * doc/tutorial/src/mimoconv.cpp: Updated MIMO with convolutional coding example program 2007-11-01 Erik G. Larsson * doc/local/installation.doc: Updated the "no root" installation description 2007-10-30 Adam Piatyszek * itpp/base/mat.h: operator*(Vec &v, Mat &m) documented as deprecated The existence of this operator in IT++ is questionable, since its behaviour is equivalent to "outer_product(v, m.get_row(0))". Moreover, the documentation was wrong so many users had problems using it correctly. This patch marks this operator as deprecated, both in the documentation and through a run-time warning message. 2007-10-25 Adam Piatyszek * AUTHORS, doc/local/authors.doc: List of authors updated * configure.ac.in: Do not use "-Werror" flag for debugging library by default This flag was propagated into itpp-config and itpp.pc scripts and this resulted in reporting each warning in users' programs as an error. 2007-10-23 Adam Piatyszek * tests/gf2mat_test.cpp: Suppress compilation warning about string to "char*" conversion * itpp/base/converters.cpp, itpp/base/converters.h: Workaround for compilation errors when using GCC 3.3.x GCC 3.3.x has problems with compilation of a few explicit instantiations in converters.cpp from IT++ 4.0.0. This only happens when -finline-functions flag is used. This flag is included in -03 optimisations. This patch conditionally disables these problematic instantiation when GCC version < 3.4.0. 2007-10-22 Adam Piatyszek * itpp/base/algebra/svd.h, itpp/base/matfunc.h: Documentation of diag() and svd() updated * itpp/base/matfunc.h: Fixed a bug in rank() function The order of checks in a while loop was wrong and it caused assertion when accessing a non-existing element in a vector of singular values. This patch fixes this problem. 2007-10-18 Adam Piatyszek * doc/doxygen_html.cfg.in: Reset TAB_SIZE to 8 spaces Some of the IT++ codes still use tabs of 8 spaces for indenting. Thus this patch resets the TAB_SIZE to 8 (default value) in Doxygen's configuration file. 2007-10-16 Adam Piatyszek * Makefile.am, VERSION, autogen.sh, configure.ac.in extras/itpp-config.t2t, itpp-config.1.in, itpp.spec.in: Changed the way version numbers are handled This patch fixes the problem of removing the "itpp.spec" and "itpp-config.1" files during "make distclean". These files should not be removed, since they are distributed in packages. Since now, version numbers in these two files and in "configure.ac" are updated according to a VERSION file content, when "autogen.sh" bootstrapping script is executed. ------------------------------------------------------------------------------ 2007-10-14 Adam Piatyszek * IT++ 4.0.0 released (SVN tag: release-4-0-0) * NEWS: Updated for 4.0.0 stable release 2007-10-12 Adam Piatyszek * itpp/base/converters.h, itpp/base/help_functions.h, itpp/base/mat.h, itpp/base/matfunc.cpp, itpp/base/matfunc.h, itpp/base/smat.cpp, itpp/base/smat.h, itpp/base/svec.cpp, itpp/base/svec.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/comm/error_counters.cpp, itpp/comm/interleave.cpp, itpp/comm/interleave.h, itpp/comm/pulse_shape.cpp, itpp/comm/pulse_shape.h, itpp/fixed/cfixed.h, itpp/fixed/fix_operators.h, itpp/fixed/fixed.h, itpp/signal/filter.cpp, itpp/signal/filter.h, itpp/signal/transforms.cpp, itpp/signal/transforms.h: Use HAVE_EXTERN_TEMPLATE where necessary 2007-10-11 Adam Piatyszek * config/ac_cxx_extern_template.m4, configure.ac, itpp/config_msvc.h: Check for C++ "extern template" when configuring IT++ Previously, it was assumed that all C++ compilers except MSVC++ support extern template instantiation. Now this feature is checked with the configure script and HAVE_EXTERN_TEMPLATE is defined accordingly. * doc/doxygen_html.cfg.in: Doxygen configuration updated with Doxygen 1.4.7 * doc/local/authors.doc, itpp/base/bessel/bessel_internal.h, itpp/base/blas.h, itpp/base/converters.cpp, itpp/base/converters.h, itpp/base/copy_vector.h, itpp/base/factory.cpp, itpp/base/help_functions.cpp, itpp/base/help_functions.h, itpp/base/itassert.cpp, itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/matfunc.h, itpp/base/math/elem_math.h, itpp/base/specmat.cpp, itpp/base/vec.cpp, itpp/base/vec.h, itpp/comm/convcode.cpp, itpp/comm/crc.cpp, itpp/comm/ldpc.h, itpp/comm/rec_syst_conv_code.cpp, itpp/fixed/cfixed.h, itpp/fixed/fix_factory.h, itpp/fixed/fix_functions.h, itpp/fixed/fixed.h, itpp/protocol/events.h, itpp/protocol/front_drop_queue.h, itpp/protocol/packet.h, itpp/protocol/packet_channel.h, itpp/protocol/packet_generator.h, itpp/protocol/selective_repeat.cpp, itpp/protocol/selective_repeat.h, itpp/protocol/signals_slots.h, itpp/protocol/tcp.cpp, itpp/protocol/tcp.h, itpp/protocol/tcp_client_server.h, itpp/signal/freq_filt.cpp, itpp/srccode/audiofile.cpp, itpp/srccode/audiofile.h, itpp/srccode/gmm.cpp, itpp/srccode/gmm.h, itpp/srccode/lpcfunc.cpp, itpp/srccode/pnm.cpp, itpp/srccode/pnm.h, itpp/srccode/vq.cpp, itpp/srccode/vq.h, itpp/srccode/vqtrain.cpp, itpp/srccode/vqtrain.h, itpp/stat/mog_diag.h, itpp/stat/mog_diag_em.h, itpp/stat/mog_diag_kmeans.h, itpp/stat/mog_generic.h: Cleanup of Doxygen documentation Missing documentation reported by Doxygen have been marked by "ADD DOCUMENTATION HERE" string. Besides, code fragments that do not require documentation have been disabled from parsing by using "\cond" and "\endcond" Doxygen's commands. * itpp/base/converters.cpp, itpp/base/converters.h: Moved templated functions' definitions into a header file 2007-10-10 Adam Piatyszek * itpp/base/vec.cpp, itpp/base/vec.cpp: Removed unnecessary conditional checks for MKL & MSVC++ 2007-10-09 Adam Piatyszek * INSTALL, configure.ac, doc/Makefile.am, doc/local/installation.doc: Removed redundant "--with-docdir=DIR" switch This switch is not needed any more, because recent autoconf provides "--docdir=DIR" switch with the same functionality by default. Installation manual updated accordingly. Thanks to Guenter Dannoritzer for reporting this problem. * itpp/base/matfunc.h: Disabled incorrect specialisation of rank() function The rank() function specialisation for binary GF(2) matrices returned incorrect results. Now it is disabled - the specialisation results in an error message. ------------------------------------------------------------------------------ 2007-10-06 Adam Piatyszek * IT++ 4.0.0-rc2 released (SVN tag: release-4-0-0-rc2) * NEWS: Updated to reflect recent changes 2007-10-05 Adam Piatyszek * configure.ac: Changed version number of the trunk sources The version number of SVN trunk sources is now of the form: "major.minor-dev", e.g. "4.1-dev". * itpp/base/matfunc.h, tests/matfunc_test.cpp, tests/matfunc_test.ref: Added templated rank() function The rank() function calculates the rank of a matrix by counting the number of non-zero singular values. LAPACK's SVD function is thus required by this function. Thanks to Martin Senst for submitting the patch. * INSTALL, doc/local/installation.doc: Installation manual updated to reflect recent changes 2007-10-04 Adam Piatyszek * itpp/base/binary.cpp, itpp/base/binary.h: Check for allowed 0 or 1 values in ">>" operator of bin class Without this patch it was possible to initialise binary vectors or matrices with values other than 0 or 1, when linking to the IT++ library build without "-DNDEBUG" flag. BTW, performed a set of cosmetic changes in bin class operators and constructors. 2007-10-02 Adam Piatyszek * INSTALL, doc/local/installation.doc, config/acx_fft.m4: Added --with-fft-include=DIR option to the configure command This option can be used instead of CPPFLAGS to pass non standard paths to include files required by IT++ FFT routines (using ACML, MKL or FFTW). * config/acx_blas.m4, config/acx_fft.m4, config/acx_lapack.m4: Cosmetic changes in --with-PACKAGE strings of the configure command 2007-10-01 Adam Piatyszek * tests/Makefile.am: All test programs needs to be declared in ALL_TESTS Without this change, some reference files (*.ref) might not have been included in the distribution package when --without-lapack or --without-fft switch was used. * config/acx_fft.m4: Do not set blas_xxx_ok=yes when detecting FFT libraries This patch fixes FFT library detection macros, so they do not set blas_mkl_ok or blas_acml_ok variables. Without this fix, it might happened that even if BLAS detection was disabled (e.g. by using `--without-blas'), an ACML or MKL BLAS library was indicated as found. * config/acx_blas.m4, itpp/base/blas.h, itpp/base/vec.h, itpp/config_msvc.h: Fixed failing blas_test and vec_test when linking with MKL There was a problem with using zdotusub_ Fortran wrapper with Intel's MKL library, which resulted in segmentation faults in blas_test and vec_test programs. Now zdotusub_ is defined as zdotu_ when MKL BLAS is used, and zdotusub.f is not built in such a case. BTW, the detection of MKL, ACML and ATLAS BLAS libraries is improved (additional HAVE_BLAS_MKL, HAVE_BLAS_ACML and HAVE_BLAS_ATLAS definitions are available). * configure.ac, itpp/base/Makefile.am: Fixed linking problem with zdotu_ when not using BLAS If an external BLAS library is not used, do not compile and link the zdotusub_ Fortran wrapper, since it requires an external zdotu_ function to exist. ------------------------------------------------------------------------------ 2007-09-28 Adam Piatyszek * IT++ 4.0.0-rc1 released (SVN tag: release-4-0-0-rc1) * NEWS: Updated to reflect recent changes * tests/itfile_test.cpp: Fixed a minor bug in itfile_test program This test program opened the reference data file from source directory in read/write mode, which was wrong, because source directory can be located on read-only file system. This patch fixes this bug. 2007-09-27 Adam Piatyszek * tests/modulator_nd_test.cpp, tests/modulator_nd_test.ref: Test program updated to use ZF Log-MAP demodulation method 2007-09-26 Adam Piatyszek * itpp/comm/modulator_nd.cpp, itpp/comm/modulator_nd.h: Implemented Zero-Forcing (ZF) Log-MAP soft demodulation method Zero-Forcing approximate demodulation method can be used instead of a brute-force optimum enumeration of all constellation points in both real- and complex-valued MIMO demodulators. Thanks to Erik G. Larsson, who provided the draft implementation and reviewed the code. 2007-09-07 Adam Piatyszek * itpp/comm/modulator_nd.cpp, itpp/comm/modulator_nd.h, tests/modulator_nd_test.cpp: Interface improvements in Modulator_ND classes The interfaces of Modulator_ND class and its descendants were redesigned to be more similar to 1D and 2D modulators' interfaces. BTW, revised the documentation and performed a set of cosmetic changes. 2007-09-06 Adam Piatyszek * itpp/comm/channel.h: Documentation improvements in AWGN_Channel Described clearly what is the meaning of the AWGN_Channel's "noisevar" input parameter for real- and complex-valued signals. 2007-09-04 Adam Piatyszek * itpp/base/math/elem_math.h: Added sign_i() and sgn_i() functions These new functions calculates the sign of an integer or double argument and return -1, 0 or 1 integer value. 2007-08-30 Adam Piatyszek * configure.ac, itpp/base/math/log_exp.h, itpp/base/specmat.cpp, itpp/comm/galois.cpp, itpp/comm/modulator_nd.cpp, itpp/signal/sigfun.cpp: Improved log2() and log1p() portability Additional checks for log2() and log1p() functions have been added to the configure script. If they are not found, local implementations are used. Besides, log2() is now in a global scope, not in the "itpp" namespace, which is consistent with GCC. BTW, removed unnecessary checks for C++ standard header files. * itpp/itmex.h: Added missing mxArray2string() and string2mxArray() functions Thanks to Bogdan Cristea for reporting this issue and providing the patch. * doc/local/linking.doc, extras/itpp-config.t2t, itpp-config.1.in, itpp-config.in, itpp.pc.in: Improvements in itpp-config and pkg-config's itpp.pc scripts These changes are intended to follow the distinction between linking to a static and shared version of the library, which is used in pkg-config's itpp.pc file. By default "itpp-config --libs" returns "-I${prefix}/lib -litpp", whereas when "--static" is added in front of "--libs", the returned string is extended with a set of external library names required for proper static linking. Moreover, an additional "--debug" switch has been added, which changes the output of "itpp-config --cflags" and "itpp-config --libs" by providing debugging flags and debugging library name. For backward compatibility "--cflags-opt", "--cflags-debug", "--libs-opt" and "--libs-debug" still exist, but they are not documented and their use is deprecated. 2007-08-28 Adam Piatyszek * config/acx_blas.m4, config/acx_fft.m4, config/acx_lapack.m4, configure.ac, itpp-config.in, itpp.pc.in: Break configuration when BLAS, LAPACK or FFT not found If the required external libraries are not found, stop configuration process and print an error message informing that one can use "--without-{blas,lapack,fft}" option, but IT++ functionality will be limited. BTW, removal of redundant spaces from CXXFLAGS_OPT, CXXFLAGS_DEBUG CPPFLAGS, LDFLAGS and LIBS has been implemented in the configure script. 2007-08-27 Adam Piatyszek * configure.ac, tests/Makefile.am, tests/cholesky_test.cpp, tests/det_test.cpp, tests/eigen_test.cpp, tests/fastica_test.cpp, tests/filter_design_test.cpp, tests/freq_filt_test.cpp, tests/inv_test.cpp, tests/ls_solve_test.cpp, tests/lu_test.cpp, tests/matfunc_test.cpp, tests/modulator_nd_test.cpp, tests/poly_test.cpp, tests/qr_test.cpp, tests/schur_test.cpp, tests/sigfun_test.cpp, tests/stat_test.cpp, tests/svd_test.cpp, tests/transforms_test.cpp: Made LAPACK and FFT dependent tests conditional If linking to an optional LAPACK or FFT external library is not configured, do not compile and run the test programs that depends on these libraries. This results in all tests passed when "--without-{blas,lapack,fft}" configure switch is intentionally used. * itpp/base/factory.cpp, itpp/base/factory.h, itpp/fixed/fix_factory.cpp: Cosmetic changes in memory allocation Instead of using "new char[size]" for raw memory allocation, use more generic "operator new(size)". Similarly, use "operator delete(p)" instead of "delete [] (p)". This makes the code consistent with 16-byte aligned create_elements() and destroy_elements() specialisations. * itpp/base/array.h, itpp/base/factory.cpp, itpp/base/factory.h, itpp/base/mat.h, itpp/base/vec.h, itpp/fixed/fix_factory.cpp: Improved memory allocation routines Following the idea proposed in feature request [1277721] implementation of create_elements() functions was improved. First the memory for an Array, Vec or Mat is allocated and then the constructor of each element is executed, but only if necessary. For simple types like bin, int, double, etc., the constructor is not invoked. Moreover, in the previous implementation the constructor of each Array, Array or Array element was invoked twice. Now this is fixed. Thanks to George Jongren for submitting this feature request. * itpp/base/factory.cpp, itpp/base/factory.h, itpp/base/sources.mk, itpp/signal/transforms.cpp, win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Solved FFTW alignment issue By implementing new specialisations of create_elements() and destroy_elements() functions, 16-byte memory alignment of Array, Vec and Mat data is used for double and complex types. With this new implementation, fft(), ifft(), dct() and idct() functions using FFTW external library run up to 30% faster than with non-aligned data structures. This fix closes feature request [1418707]. * itpp/base/array.h, itpp/base/factory.h, itpp/base/mat.h, itpp/base/vec.h: Added destroy_elements() function The destroy_elements() function accompanies create_elements() used for memory allocation. Future changes to memory allocation scheme (e.g. memory alignment) for Array, Vec and Mat classes will only require redefinition of these two methods. BTW, removed inlining of alloc(), free(), create_elements() and destroy_elements() functions, which does not give any real performance gain but the code is bigger than necessary. 2007-08-26 Adam Piatyszek * itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/fixed/cfix.cpp, itpp/fixed/cfix.h, itpp/fixed/fix.cpp, itpp/fixed/fix.h: Improvements in string parsers Added support for NaN (not a number) and Inf (infinity) for parsed Vec arguments. This fixes feature request [1066711]. Changed "bool Vec<>::set()" into "void Vec<>::set(), because returned value was always true. Reused Vec::set() specialisation in Vec::set() implementation. Simplified implementation of Vec::set() specialisation. 2007-08-25 Adam Piatyszek * itpp/base/mat.h, tests/mat_test.cpp, tests/mat_test.ref: Added set_rows() and set_cols() methods to Mat These new set functions match existing get_rows() and get_cols() methods. This patch fixes feature request [711263]. 2007-08-24 Andreas Wolfgang * extras/itsave.m Fixed script to be compatible with Matlab V7.3 Since Matlab does not support sizeof(...), it was replaced by a new function itsizeof(...). In addition logical expressions have been made Matlab compatible (only variables with identical dimensions are used in logical expressions). The patch was tested using Matlab V7.3 and Octave V2.9.9. 2007-08-22 Adam Piatyszek * itpp/base/random.h: Fine tuning of random generators When generating a vector or matrix of random samples, it is more efficient to use "*=" and "+=" operators on the same allocated memory pool than create temporary copies of vectors and matrices. Moreover, for double and complex types, "*=" operator can employ optimised BLAS implementation. * itpp/comm/channel.cpp, itpp/comm/channel.h: Fine tuning of AWGN_Channel operator() performance Instead of using randn() and randn_c() global functions, Normal_RNG and Complex_Normal_RNG generators are declared as class objects. This reduces the number of generator's constructor executions to minimum. 2007-08-23 Adam Piatyszek * tests/Makefile.am: Return non-zero exit status on make check failure If not all test programs pass, output a short status message with the number of tests failed and return non-zero exit status to make. 2007-08-21 Adam Piatyszek * doc/local/installation.doc, doc/local/linking.doc: Documentation updated to reflect recent changes * win32/itpp_acml_tests/fastica_test.vcproj, win32/itpp_acml_tests/itfile_test.vcproj, win32/itpp_acml_tests/parser_test.vcproj, win32/itpp_mkl_tests/*.vcproj: Final problems fixed in the MSVC++ project files for test programs The fastica_test, itfile_test and parser_test projects require additional preprocessor definitions of some test data files. Besides, all project files in win32/itpp_mkl_tests directory were missing ProjectGUID, which is normally automatically added by the MSVC++ IDE environment. All test programs should now compile and run without any problems. 2007-08-20 Adam Piatyszek * extras/acml_tests_vcproj.template, extras/mkl_tests_vcproj.template, win32/**/*.vcproj: Removed versions from MKL and ACML directories To prevent unnecessary updates of MSVC++ project files, the installation directories of MKL and ACML libraries under windows do not contain version numbers, i.e. "C:\Program Files\Intel\MKL" and "C:\Program Files\AMD\acml". MKL and ACML libraries should be installed into these directories in order to work with the prepared project files without any modifications. * itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h: Fixed problems with comma in Vec::set() parser The previous string parser implementation in Vec class was not fully functional when using MSVC++ compiler. The problem was that commas just after a parsed value caused application crash. For instance "1 , 0 1 " was parsed fine, but parsing "1, 0,1" resulted in a crash. Fixed this issue by replacing all commas with spaces before actual parsing is done, except the complex vector case, where "(1,0.2)" are valid complex values. BTW, the Mat::set() parsing function was rewritten to reuse the Vec::set() method. * extras/acml_tests_vcproj.template, extras/gen_vcproj_tests.sh, extras/mkl_tests_vcproj.template, win32/itpp_acml.vcproj, win32/itpp_acml_tests/*.vcproj, win32/itpp_acml_tests/Makefile.am, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_mkl.vcproj, win32/itpp_mkl_tests/*.vcproj, win32/itpp_mkl_tests/Makefile.am, win32/itpp_mkl_tests/itpp_mkl_tests.sln: Prepared MSVC++ project files for test programs These project files were generated from two template files with "gen_vcproj_tests.sh" script. Then, they were included in appropriate solutions: "itpp_acml_tests.sln" and "itpp_mkl_tests.sln", for external ACML and MKL libraries respectively. * itpp/base/blas.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/base/zdotusub.f: Modified zdotusub_() function to match ACML interface The Fortran wrapper zdodusub_() of BLAS zdotu_() function used CBLAS inteface, which was incompatible with ACML implementation. Fixed this, so the native ACML function can be used under MSVC++ compiler. Besides, disabled this function when using IT++ with Intel MKL under MSVC++. * tests/fastica_test.cpp, tests/itfile_test.cpp, tests/parser_test.cpp, tests/turbo_test.cpp: Cosmetic changes in a few test programs Compilation of turbo_test and itfile_test programs under MSVC++ resulted in some warnings related to the use of variable `i' and initialisation of a float variable `f_ref'. These issues are now fixed. BTW, error messages in fastica_test, itfile_test and parser_test were changed to use `cerr' output stream, instead of `cout'. 2007-08-18 Adam Piatyszek * tests/rand_test.cpp, tests/rand_test.ref: Fixed a bug in rand_test program The rand_test implementation was not deterministic, which resulted in a failed test result on SunOS SPARC platform. Generation of scalars, vectors and matrices of random numbers in separate "cout" commands fixes this problem. * doc/local/linking.doc: Documentation updated Reflected recent changes in the pkg-config's itpp.pc file in the "Linking with IT++" documentation. BTW, revised the section about using itload.m and itsave.m m-files in Matlab/Octave. * itpp/base/vec.cpp, itpp/base/vec.h: Fixed regressions related to the specialised operator*() The templated friend operator*() for two vectors, which calculates the dot product, needs to be instantiated in the same way as the dot() function. Besides, the declaration of the friend operator*() included the definition. This definition is now moved below dot() function definition. Without these two changes, a segmentation fault occurred in vec_test under Cygwin. * itpp.pc.in: Improvements in pkg-config's itpp.pc script "Libs" variable settings in the itpp.pc pkg-config's file are now split into "Libs" and "Libs.private". The latter one is only used when doing a static linking (using "--static" pkg-config switch). * config/acx_blas.m4, config/acx_fft.m4, config/acx_lapack.m4: Cosmetic changes - deleted trailing whitespace * configure.ac: Let the user override the default CXXFLAGS_DEBUG The CXXFLAGS_DEBUG environment variable can be used to override the default settings of this flag. BTW, added "-Werror" to the default debug flags. 2007-08-13 Adam Piatyszek * itpp/base/random.cpp, itpp/base/random.h, tests/rand_test.cpp, tests/rand_test.ref, tests/source_test.cpp, tests/source_test.ref: Simplified and optimised RNG implementations Rayleigh_RNG and Rice_RNG now use Normal_RNG for efficient generation of samples (new implementation is about 4 times faster). Minor code optimisations in Laplace_RNG, Weibull_RNG and AR1_Normal_RNG. Test programs for RNG and deterministic sources updated accordingly. 2007-08-11 Adam Piatyszek * Makefile.am: Added NEWS-3.99 to EXTRA_DIST * tests/stat_test.cpp: Check for LAPACK This test requires svd() function, which is provided by an external LAPACK library. Therefore we have to check for HAVE_LAPACK definition like in other LAPACK-related test programs. * configure.ac: Version bump * NEWS, NEWS-3.99: Renamed NEWS file to NEWS-3.99 * NEWS-3.10: Updated to include 3.10.12 release notes ------------------------------------------------------------------------------ 2007-08-10 Adam Piatyszek * IT++ 3.99.3.1 released (SVN tag: release-3-99-3-1) * NEWS: Updated to reflect recent changes * configure.ac: Version bump * configure.ac, itpp/base/Makefile.am, itpp/base/blas.h, itpp/base/sources.mk, itpp/base/vec.h, itpp/base/zdotusub.f: Fixed a bug related to zdotu_() BLAS function Wrong declaration of zdotu_() BLAS function interface caused segmentation faults when IT++ was compiled with "-fomit-frame-pointer" flag. To fix this problem a Fortran wrapper function zdotusub_() has been added to IT++. This wrapper function comes from NetLib's CBLAS package. ------------------------------------------------------------------------------ 2007-08-10 Adam Piatyszek * IT++ 3.99.3 released (SVN tag: release-3-99-3) * NEWS: Updated to reflect recent changes 2007-08-09 Adam Piatyszek * configure.ac, win32/Makefile.am, win32/itpp_acml_tests/Makefile.am, win32/itpp_acml_tests/array_test.vcproj, win32/itpp_acml_tests/bch_test.vcproj, win32/itpp_acml_tests/bessel_test.vcproj, win32/itpp_acml_tests/blas_test.vcproj, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_mkl.vcproj, win32/itpp_mkl_tests/Makefile.am, win32/itpp_mkl_tests/array_test.vcproj, win32/itpp_mkl_tests/bch_test.vcproj, win32/itpp_mkl_tests/bessel_test.vcproj, win32/itpp_mkl_tests/blas_test.vcproj, win32/itpp_mkl_tests/itpp_mkl_tests.sln: Added MSVC++ project files for test programs This patch includes MSVC++ project files for easy building and linking a few test programs with IT++ and MKL or ACML libraries. The project files are configured to use 32-bit versions of MKL 9.1.025 and ACML 3.6.0 PGI libraries installed into their default locations on Windows platforms. 2007-08-08 Adam Piatyszek * itpp/base/blas.h, itpp/base/vec.h, tests/blas_test.cpp, tests/blas_test.ref: Fixed a bug in dot() for complex arguments Declaration of BLAS zdotu_() method changed so, the first argument now passes the complex result. This fixes segmentation fault of blas_test and vec_test when using GCC 3.4.5 under SunOS 5.9 on SPARC. It also makes workaround for MSVC++ warning C4190 redundant. * tests/mat_test.cpp, tests/mat_test.ref: Improvements in mat_test Perform more consistent tests of the templated Mat class for bin, int, double and std::complex arguments. 2007-08-06 Adam Piatyszek * AUTHORS, doc/Makefile.am, doc/images/Makefile.am, doc/images/newcom_logo.png, doc/local/authors.doc, doc/local/itpp_header.html: NEWCOM logo removed Since the NEWCOM project ended in March 2007, the existence of its logo in IT++ HTML documentation is not necessary any more. * tests/vec_test.cpp, tests/vec_test.ref: Improvements in vec_test Perform more consistent tests of the templated Vec class for bin, int, double and std::complex arguments. * itpp/base/mat.h, itpp/base/vec.h: Code cleanup in Vec/Mat's multiply and division operators Used BLAS-aided scal_vector() method in multiplication by constant operator in Mat class. Replaced duplicated implementation with executions of inlined multiplication operators in both Vec and Mat classes. Simplified Vec's division operators by removal of unnecessary checks for special cases. * itpp/base/vec.h: Added missing initialization command Output matrix has to be initialised with zeros in BLAS-based Vec::outer_product() function specializations. 2007-08-03 Erik G. Larsson * itpp/comm/ldpc.h: Documentation updates 2007-07-21 Adam Piatyszek * AUTHORS, doc/local/authors.doc, itpp/base/sort.h, tests/Makefile.am, tests/sort_test.cpp, tests/sort_test.ref: Sorting functions revised The sort() and sort_index() functions can now use four different algorithms: Introsort, Quicksort, Heapsort and Insertion Sort, which are implemented in a common Sort class. The Introsort is the default method. The revised implementation is much faster because it uses pointers for accessing the data to be sorted. Sorting test program is included in this commit as well. Thanks to Mark Dobossy for this improved implementation. This commit closes feature request [1746876]. 2007-07-20 Adam Piatyszek * itpp/base/blas.h, itpp/base/copy_vector.h, itpp/base/vec.h: Added scal_vector() and axpy_vector() low level functions These two functions uses BLAS methods for double and std::complex types of a vector. The function scal_vector() realizes "x *= alpha", whereas axpy_vector() realizes "y = alpha*x + y". Vector x and y are of the same size. BTW, improved performance of Vec's "*=" and "/=" operators with scalar arguments by using scal_vector() method. * INSTALL, README, configure.ac, doc/doxygen_html.cfg.in, doc/local/index.doc.in, doc/local/installation.doc, itpp/base/blas.h, itpp/base/copy_vector.h, itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/sources.mk, itpp/base/vec.cpp, itpp/base/vec.h, itpp/config_msvc.h, itpp/signal/transforms.cpp, tests/Makefile.am, tests/blas_test.cpp, tests/blas_test.ref, win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Removed CBLAS dependency To limit the number of external libraries required by IT++ CBLAS interfaces have been replaced with a Fortran BLAS. Besides, vec and cvec specialisation of the outer_product() method using BLAS functions has been added. To verify BLAS-aided routines, an extra blas_test has been added. This commit closes feature request [1746876]. 2007-07-19 Adam Piatyszek * itpp/base/mat.h: Fixed a bug in set_size() method When resizing a smaller matrix into a bigger one with copying the content, the unused entries were not initialised to zeros properly. Besides, the use of a copy_vector() function instead of nested loops with element by element copying increases the overall performance of various operations on matrices. Therefore, this patch improves performance of set_size(), transpose(), hermitian_transpose(), concat_horizontal() and concat_vertical() functions. * itpp/base/vec.h : Fixed assertion check in operator "/=" 2007-07-18 Adam Piatyszek * itpp/base/vec.h: Use copy_vector() where possible This patch improves the consistency and possibly the performance of various Vec's methods by using copy_vector() instead of explicit copying of elements in a loop. It also fixes a minor bug in "/=" operator for the case of division of a vector with itself, i.e. "v /= v;". Finally, this patch adds missing friend declarations for concat() functions and improves if statements in the alloc() function. 2007-07-17 Adam Piatyszek * **/*: Removed trailing whitespace Trailing whitespace (spaces and tabs at the end of each line) does not contain any information. Moreover, it sometimes causes conflicts when applying patches or merging branches. Therefore, let's get rid of it from the code and other text files. Trailing whitespace can be easily removed with sed or perl and their regular expressions: % sed -i -e 's/[ \t]*$//' source.cpp % perl -i -p -e 's/[ \t]*$//' source.cpp 2007-07-16 Adam Piatyszek * doc/local/documentation.doc, extras/itload.m, extras/itsave.m, itpp/**/*.cpp, itpp/**/*.h, tests/*.cpp: Removed $Revision: 1418 $ and $Date: 2008-02-15 15:03:10 +0100 (Fri, 15 Feb 2008) $ keywords The $Revision: 1418 $ and $Date: 2008-02-15 15:03:10 +0100 (Fri, 15 Feb 2008) $ keywords in each file comment sometimes cause errors when trying to apply patches or merged branches. Therefore, IT++ sources will not use them any more. * itpp/**/*.cpp, itpp/**/*.h: Removed trailing whitespace Trailing whitespace (spaces and tabs at the end of each line) does not contain any information. Moreover, it sometimes causes conflicts when applying patches or merging branches. Therefore, let's get rid of it from the code. * itpp/base/mat.h: Improved del_rows() performance The more optimum but not working implementation of del_rows() has been fixed and uncommented, so it now replaces the slow execution of del_row() method for each deleted row in a loop. 2007-07-11 Adam Piatyszek * itpp/comm/commfunc.cpp: Compilation warning suppressed by initializing the lambda variable 2007-07-04 Adam Piatyszek * itpp/base/matfunc.cpp, itpp/base/matfunc.h: Added repmat() function for vectors Matrin Senst provided a new repmat() implementation which concatenates a multiple number of vectors. It extends the functionality of recently added repmat() functions for matrices. 2007-06-29 Adam Piatyszek * itpp/signal/resampling.h: Minor spelling fixes in documentation * tests/*.cpp: Copyright dates updated * configure.ac: Version number updated * itpp/base/matfunc.cpp, itpp/base/matfunc.h, tests/matfunc_test.cpp, tests/matfunc_test.ref: Added repmat() function (feature request [1744527]) This functions is a clone of a Matlab's repmat function. It expands an input matrix or vector to a larger matrix by concatenating (m x n) copies of the input matrix (vector). Thanks to Mark Dobossy for providing a patch. 2007-06-22 Adam Piatyszek * itpp/comm/ldpc.cpp: Improved LDPC binary files versioning A global static const variable LDPC_binary_file_version has been defined, which is now used in load/save methods of LDPC_Generator and LDPC_Code classes. Besides, H_defined and G_defined boolean variables are loaded/saved using the new stream operators of it_file and it_ifile classes. * TODO, itpp/base/binfile.cpp, itpp/base/binfile.h, itpp/base/itfile.cpp, itpp/base/itfile.h, tests/itfile_test.cpp, tests/itfile_test.ref, tests/itfile_test_data.it: Added support for bool variables in it_file class It is now possible to read and write bool variables using standard stream operators ">>" and "<<" of the it_file and it_ifile classes. Boolean variables are stored in a binary file using a char datatype. ------------------------------------------------------------------------------ 2007-06-20 Adam Piatyszek * IT++ 3.99.2 released (SVN tag: release-3-99-2) * NEWS, TODO: Updated to reflect recent changes * itpp/comm/ldpc.cpp: Fixed a minor bug reported as error in MSVC++ The implicit cast of int variables to bool results in compilation errors under MS Visual C++ .NET 2005 compiler. The applied fix is a workaround solution. In future fstream operators ">>" and "<<" for bool variables should be implemented in it_file class. * configure.ac: Removed "-fno-exceptions" flag from CXXFLAGS This conditional flag was added to CXXFLAGS and CXXFLAGS_DEBUG when "--enable-exceptions" switch was passed to configure. However, it is better not to use it by default, since it might cause problems when linking the IT++ library with other programs that use exceptions. 2007-06-19 Adam Piatyszek * itpp/base/specmat.cpp, itpp/base/specmat.h: Fixed bug [1739500] in hadamard() function The initial recursion for creating Hadamard matrices has to start with a 1x1 matrix H = [1], not with a 2x2 matrix. This fix provides correct solution for imat H = hadamard(1). Thanks to Matthias for reporting this problem. 2007-06-18 Adam Piatyszek * itpp/base/math/elem_math.cpp: Fixed bug [1739267] in binom() and binom_i() The binomial coefficient was calculated wrongly for n = k. Instead of 1 the functions result was n+1. 2007-06-16 Adam Piatyszek * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h: Added B-LDPC Codes implementation B-LDPC Codes implementation in IT++ consists of a BLDPC_Parity and BLDPC_Generator classes. The former one can be used for constructing the parity-check matrix from so-called base-matrix. Base matrix can be saved and loaded from a text file. The BLDPC_Generator class implements an efficient encoding algorithm using a preprocessed version of the parity-check matrix. 2007-06-10 Adam Piatyszek * INSTALL, config/acx_blas.m4, config/acx_fft.m4, config/acx_lapack.m4, configure.ac, doc/local/installation.doc, itpp/config_msvc.h, itpp/signal/transforms.cpp: Improvements in MKL detection macros The latest MKL release 9.1.018 has different naming of a lapack shared library (libmkl_lapack32.so and libmkl_lapack64.so -> libmkl_lapack.so). Cosmetic changes in MKL's FFT macro and variable names (MKL8 -> MKL) 2007-06-04 Adam Piatyszek * itpp/srccode/pnm.cpp: The functions for reading ppm and pgm images have to use binary mode when opening files. This fixes bug [1730610]. Thanks to Thomas Andersson for reporting this problem. ------------------------------------------------------------------------------ 2007-06-02 Adam Piatyszek * IT++ 3.10.11 released (SVN tag: release-3-10-11) (merged rev. 1050:1051 from itpp-3-10 branch) * NEWS-3.10: Updated to reflect recent changes (merged rev. 1050:1051 from itpp-3-10 branch) * itpp/base/vec.h: The outer_product() function now uses an extra argument "hermitian", which controls the calculation for complex vectors. By default "hermitian" is set to false, which results in (x * y^T) calculation. If "hermitian" is true, (x * y^H) is calculated. This solution is backward compatible with 3.10.x interface of outer_product(). Final fix for bug [1727923]. 2007-05-29 Adam Piatyszek * itpp/base/vec.h: Added specialisation of the outer_product() method for complex vector arguments. This fixes bug [1727923]. Thanks to Yngve Selen for reporting this issue. * itpp/signal/transforms.cpp: Fixed bug [1724746], i.e. a problem with modified input data in ifft_real() function. Additional FFTW_PRESERVE_INPUT flag used during FFTW plan creation solves this problem. Thanks to Klaas Hofstra for reporting this bug. 2007-05-22 Adam Piatyszek * tests/schur_test.cpp, tests/schur_test.ref: Schur decomposition is not unique, therefore the comparision of the non-zero norm of the lower triangular part of matrix T was not a good idea. Fixed this problem in the schur_test program. 2007-05-15 Adam Piatyszek * itpp/signal/transforms.cpp, itpp/signal/transforms.h: Fixed linking errors when trying to use Hadamard and Walsh-Hadamard transform functions. This fixes bug report [1719146] submitted by Stephan Ludwig. 2007-05-03 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Sean Finney added to the list of contributors * itpp/base/random.h, tests/channel_test.ref, tests/cholesky_test.ref, tests/det_test.ref, tests/eigen_test.ref, tests/filter_design_test.ref, tests/filter_test.ref, tests/inv_test.ref, tests/ls_solve_test.ref, tests/lu_test.ref, tests/matfunc_test.ref, tests/modulator_nd_test.ref, tests/modulator_test.ref, tests/poly_test.ref, tests/qr_test.ref, tests/schur_test.ref, tests/source_test.ref, tests/svd_test.ref, tests/transforms_test.ref: New implementation of the Complex_Normal_RNG class, which now uses the improved Normal_RNG for generating the real and imaginary parts of the complex random sample. The new generator is about four times faster than the previous implementation. This closes feature request [1711727]. Thanks to Sean Finney for providing a patch. * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h: Now the decode() methods return only systematic bits, to be symetric with the encode() methods. New methods decode_soft_out() added, which return soft LLR values for all bits in a codeword. 2007-05-02 Erik G. Larsson * itpp/tests/commfunc_test.cpp, itpp/tests/commfunc_test.ref: Added missing test program * itpp/comm/commfunc.cpp: Fixed missing memory allocation 2007-04-30 Erik G. Larsson * itpp/comm/commfunc.h, itpp/comm/commfunc.cpp: Added a new function "waterfilling()" to solve water-filling problems 2007-04-29 Adam Piatyszek * itpp/base/random.cpp, itpp/base/random.h, tests/cholesky_test.ref, tests/circular_buffer_test.ref, tests/det_test.ref, tests/eigen_test.ref, tests/filter_design_test.ref, tests/filter_test.ref, tests/histogram_test.ref, tests/inv_test.ref, tests/ldpc_test.cpp, tests/ldpc_test.ref, tests/ls_solve_test.ref, tests/lu_test.ref, tests/matfunc_test.ref, tests/mat_test.ref, tests/modulator_nd_test.ref, tests/modulator_test.ref, tests/poly_test.ref, tests/qr_test.ref, tests/rand_test.ref, tests/schur_test.ref, tests/sigfun_test.ref, tests/source_test.ref, tests/sparse_test.ref, tests/stat_test.ref, tests/svd_test.ref, tests/transforms_test.ref, tests/turbo_test.ref, tests/vec_test.ref: New implementation of the Normal_RNG sample() function, which uses the so-called Ziggurat algorithm. The new generator is about five times faster than the previous one using the Box-Mueller method. This fixes feature request [1707969]. Thanks to Sean Finney for providing a patch. 2007-04-26 Adam Piatyszek * doc/tutorial/src/ldpc_bersim_awgn.cpp, itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, tests/ldpc_test.ref: Fixed bugs in LDPC_Code::load_code() and LDPC_Code::save_code() functions. It could happen that LDPC generator object might be left uninitialised when loading the coded from a binary file. Removed unnecessary integrity_check() execution from the load_code() function. setup_decoder() method replaced with three separate methods, which are more flexible to use. Tutorial example updated to reflect recent changes. 2007-04-23 Adam Piatyszek * itpp/itmex.h: Fixed bug [1703731] by implementing the missing double2mxArray() and double_complex2mxArray() functions. Thanks to Danilo Zanatta Filho for providing a patch. 2007-04-18 Adam Piatyszek * itpp/**/*.{cpp,h}: Copyright dates updated to `1995-2007' * itpp/base/svec.h, itpp/protocol/selective_repeat.cpp, itpp/stat/mog_diag.cpp: Once again added missing #include statements 2007-04-17 Adam Piatyszek * itpp/base/itassert.cpp, itpp/base/math/elem_math.h, itpp/base/parser.cpp, itpp/comm/error_counters.cpp, itpp/comm/llr.h, itpp/protocol/selective_repeat.cpp, itpp/protocol/tcp.cpp, itpp/srccode/vq.cpp: Added missing #include and header files. This fixes problems with building using GCC 4.3 snapshot. Thanks to Martin Michlmayr from the Debian project for reporting this bug. (merged rev. 1005:1006 from the itpp-3-10 branch) 2007-04-12 Adam Piatyszek * itpp/base/itassert.cpp: Fixed a problem with not displayed assert and error messages, which was introduced in rev. 982. ------------------------------------------------------------------------------ 2007-04-10 Adam Piatyszek * IT++ 3.10.10 released (SVN tag: release-3-10-10) (merged rev. 999:1000 from the itpp-3-10 branch) * NEWS-3.10: Updated to reflect recent changes (merged rev. 999:1000 from the itpp-3-10 branch) * TODO: Updated to reflect recent changes in IT++ file format (merged rev. 986:997 from the it_file-v3 temporary branch) * extras/itload.m, extras/itsave.m: Updated to be compatible with IT++ file format version 3. Implemented missing load functions for Array >, Array > and Array types. Function itsave() detects the type of a saved vector or matrix and uses bvec, bmat, ivec, imat, vec, mat, cvec or cmat types respecively. (merged rev. 986:997 from the it_file-v3 temporary branch) * itpp/base/binfile.cpp, itpp/base/binfile.h, itpp/base/gf2mat.cpp, itpp/base/itfile.cpp, itpp/base/itfile.h, tests/itfile_test.cpp, tests/itfile_test.ref, tests/itfile_test_data.it: Major changes in IT++ file format related classes: - the new file format (version 3) is incompatible with version 2, which was used in IT++ 3.10.x series; for backward compatibility the previous format can be handled using the it_file_old and it_ifile_old classes, which are considered as deprecated and will be removed from the library in future - data is always saved using a little endian byte ordering; files files written on machines using big or little endian ordering should be identical; endianity variable removed from the data_header structure - all size variables are stored using fixed-width 64-bit unsigned integer type, and therefore are independent of the architecture word size (32- or 64-bit) - short and int data types are explicitly casted to fixed-with types int16_t, uint16_t, int32_t and uint32_t, since C/C++ standards do not assume fixed widths of these types - cleaner and more efficient implementation of the write_data_header() function - added missing implementation of a pack() function, which compacts an opened it_file by removing free space between data blocks - added optional description filed which can be saved with each variable - added missing operators and methods for reading and writing svec and smat data types (merged rev. 986:997 from the it_file-v3 temporary branch) * tests/timer_test.cpp, tests/timer_test.ref: CPU_Timer test is now independent of a Real_Timer test. This should solve test failures in some specific cases (high load of CPU, etc.). (merged rev. 993:994 from the itpp-3-10 branch) 2007-04-07 Erik G. Larsson * itpp/ldpc/ldpc.cpp, tests/ldpc_test.ref: "<=" changed to "<" in iteration count in decoder. Thanks to M. Senst for reporting this. 2007-04-06 Adam Piatyszek * itpp/base/vec.cpp, tests/vec_test.cpp, tests/vec_test.ref: Fixed a minor bug in the set() method, when parsing an "a:b" or "a:b:c" fromat. Due to precision problems the last value from some specific ranges was not included in the result, e.g. "0:0.2:3" resulted in a vector with 2.8 at the end (instead of 3). Thanks to Martin Senst for reporting this issue. 2007-04-04 Adam Piatyszek * tests/itfile_test.cpp, tests/itfile_test_data.it, tests/itfile_test.ref: IT++ file format test program improved 2007-04-03 Adam Piatyszek * itpp/base/itassert.cpp: Fixed a compilation problem when IT++ is configured with the "--enable-exceptions" switch * itpp/base/itfile.cpp: Fixed bug [1693384] caused by a missing explicit cast of string size to int * configure.ac, itpp.spec.in: Minor cleanups and improvements * AUTHORS, doc/local/authors.doc: Added Gunter Dannoritzer as openSUSE distribution packages maintainer 2007-04-01 Erik G. Larsson * itpp/comm/ldpc.h: Documentation updates 2007-03-30 Adam Piatyszek * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h: Fixed a small bug in the integrity_check() function. Some of the private data and methods made protected to allow access by the classes who might inherit from the LDPC_Code. 2007-03-27 Adam Piatyszek * itpp/base/gf2mat.cpp, itpp/base/gf2mat.h: Added set_size() method to the GF2mat class, which is compatible with Mat's set_size() function. * configure.ac: Version bump ------------------------------------------------------------------------------ 2007-03-22 Adam Piatyszek * IT++ 3.99.1 released (SVN tag: release-3-99-1) * NEWS: Updated to reflect recent changes * doc/local/verification.doc: Added a new verification report for MSVC++ .NET and IT++ with ACML 2007-03-21 Adam Piatyszek * win32/itpp_acml.sln, win32/itpp_acml.vcproj, win32/itpp_mkl.sln, win32/itpp_mkl.vcproj, doc/local/installation.doc, doc/local/linking.doc, itpp/config_msvc.h, win32/itpp.sln, win32/itpp.vcproj, win32/Makefile.am: Added a new MSVC++ project file for linking IT++ with ACML (PGI build for Windows). Installation manual and "Linking with IT++" document updated to reflect these changes. 2007-03-20 Adam Piatyszek * itpp/base/random.cpp, itpp/base/random.h: Added rand53_01_lclosed() function for 53-bit resolution [0,1) random numbers generator. Global static initialization flag moved into Random_Generator class. 2007-03-09 Adam Piatyszek * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h: "std::string" replaced with "const std::string&" in function arguments to prevent passing by value. Cosmetic changes related to line wrapping. 2007-03-08 Adam Piatyszek * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h: "init_state" variable renamed to "init_flag". Cosmetic changes in the integrity_check() function. 2007-03-07 Adam Piatyszek * doc/tutorial/src/ldpc_bersim_awgn.cpp, doc/tutorial/src/ldpc_gen_codes.cpp, itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, tests/ldpc_test.cpp: LDPC_Parity_Matrix class split into a set of classes, which inherits from the new base class LDPC_Parity. Test and tutorials programs updated accordingly. 2007-03-06 Adam Piatyszek * itpp/base/svec.h: Added a new method get_nz_indices(), which returns the indices of non-zero values in a sparse vector. 2007-03-02 Adam Piatyszek * config/acx_blas.m4: Fixed a bug in BLAS detection, when an explicit library is passed to configure using "--with-blas=..." option. 2007-03-01 Adam Piatyszek * itpp/base/gf2mat.cpp, itpp/base/gf2mat.h: Portability improved by replacing "unsigned short int" with 8-bit "unsigned char" type for storing data bits. Implemented missing GF2mat constructor that uses bmat as an argument. A few other cosmetic changes and documentation improvements done. * itpp/base/itfile.cpp, itpp/base/itfile.h: Added missing read/write operators for the char type 2007-03-01 Erik G. Larsson * itpp/comm/modulator_nd.h: Added a function set_llrcalc() 2007-02-28 Adam Piatyszek * tests/Makefile.am: Test programs are now linked to the optimised library by default. Fixed the problem of missing "*.ref" files in the distribution package, when some modules were disabled during the configuration process. * tests/gf2mat_test.cpp: Added EXTENSIVE_TESTS macro definition, which turns on/off extensive tests. 2007-02-22 Adam Piatyszek * doc/tutorial/src/ldpc_bersim_awgn.cpp: Changed the Nbits type to 64-bit int64_t * itpp/comm/ldpc.cpp: Fixed a problem in the integrity_check() function when no generator is defined. 2007-02-21 Adam Piatyszek * doc/tutorial/src/ldpc_bersim_awgn.cpp, doc/tutorial/src/ldpc_gen_codes.cpp, itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, tests/ldpc_test.cpp: LDPC_Generator abstract base class added. It provides a common interface for user defined generators. LDPC_Generator_Matrix replaced with the LDPC_Generator_Systematic class derived from the LDPC_Generator. Improved the interface of LDPC_Code class. Tutorial examples and test program updated accordingly. 2007-02-18 Erik G. Larsson * itpp/comm/ldpc.h, itpp/comm/ldpc.cpp, tests/ldpc_test.cpp: Added a feature to generator matrix computation (minor interface change) 2007-02-17 Adam Piatyszek * config/acx_blas.m4, config/acx_cblas.m4, config/acx_fft.m4, config/acx_lapack.m4, configure.ac: Improved the speed and portability of external libraries detection macros 2007-02-16 Erik G. Larsson * itpp/comm/ldpc.cpp: Fixed some assertions 2007-02-16 Adam Piatyszek * itpp/comm/modulator.h: Fixed bug [1661419] by adding default constructors to the QAM, PSK, PAM_c and PAM modulator classes. Thanks to Jordy Potman for reporting this bug. 2007-02-12 Adam Piatyszek * doc/Makefile.am, Makefile.am: Changed the naming scheme of snapshots to "itpp-VERSION_preYYYYMMDD" ------------------------------------------------------------------------------ 2007-02-10 Adam Piatyszek * IT++ 3.10.9 released (SVN tag: release-3-10-9) (merged rev. 929:930 from the itpp-3-10 branch) * NEWS: Updated to include recent changes (merged rev. 929:930 from the itpp-3-10 branch) 2007-02-09 Adam Piatyszek * itpp/base/gf2mat.cpp: Replaced it_info() with it_info_debug() to disable information messages when using an optimized library 2007-02-08 Adam Piatyszek * itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/signal/freq_filt.cpp: Fixed improper changes in template specializations * doc/doxygen_html.cfg.in, itpp/base/binary.h, itpp/base/circular_buffer.h, itpp/base/gf2mat.h, itpp/base/itfile.h, itpp/base/mat.cpp, itpp/base/mat.h, itpp/base/parser.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/comm/channel.h, itpp/comm/channel_code.h, itpp/comm/convcode.cpp, itpp/comm/convcode.h, itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, itpp/comm/llr.h, itpp/comm/modulator.h, itpp/comm/modulator_nd.h, itpp/comm/reedsolomon.h, itpp/comm/spread.h, itpp/comm/turbo.h, itpp/fixed/cfix.h, itpp/fixed/cfixed.h, itpp/fixed/fix.h, itpp/fixed/fix_base.h, itpp/fixed/fix_factory.h, itpp/fixed/fixed.h, itpp/optim/newton_search.h, itpp/signal/fastica.cpp, itpp/signal/filter.h, itpp/signal/filter_design.h, itpp/signal/freq_filt.cpp, itpp/signal/freq_filt.h, itpp/signal/poly.h, itpp/signal/sigfun.h, itpp/signal/transforms.cpp, itpp/stat/histogram.h: Fixed Doxygen warnings by adding or correcting the documentation syntax * doc/local/installation.doc: Updated CXXFLAGS description * configure.ac, Makefile.am: "upload" target removed * itpp/comm/rec_syst_conv_code.cpp, itpp/comm/rec_syst_conv_code.h: "INF" preprocessor definition replaced with a private constant "infinity" * itpp/comm/bch.h, itpp/comm/channel_code.h, itpp/comm/convcode.h, itpp/comm/egolay.h, itpp/comm/hammcode.h, itpp/comm/ldpc.h, itpp/comm/punct_convcode.h, itpp/comm/reedsolomon.h, itpp/comm/turbo.h: Changed get_rate() functions into const ones 2007-02-07 Adam Piatyszek * itpp/base/fastmath.h, itpp/base/gf2mat.h, itpp/base/ittypes.h, itpp/base/mat.h, itpp/base/matfunc.h, itpp/base/math/elem_math.h, itpp/base/math/error.cpp, itpp/base/math/integration.cpp, itpp/base/operators.h, itpp/base/parser.h, itpp/base/smat.h, itpp/base/svec.h, itpp/base/vec.h: Fixed Doxygen warnings by adding or correcting the documentation 2007-02-06 Adam Piatyszek * itpp/base/itassert.h: Added missing documentation for macros * itpp/base/converters.cpp, itpp/base/converters.h: Fixed Doxygen errors and improved the implementation of to_cvec() and to_cmat() functions 2007-02-05 Adam Piatyszek * itpp/base/array.h, itpp/base/binfile.cpp, itpp/base/binfile.h, itpp/base/converters.cpp: Documentation fixes related to Doxygen warnings and errors * itpp/base/algebra/ls_solve.h: Fixed improper declarations of ls_solve_od() and ls_solve_ud() methods * itpp/base/itfile.h: Replaced "uint32_t" with "unsigned int", which is a workaroud for the compilation problem under Cygwin. 2007-02-04 Erik G. Larsson * itpp/comm/ldpc.cpp, tests/ldpc_test.ref: Updated information messages 2007-02-04 Adam Piatyszek * tests/Makefile.am: Redirecting stderr to /dev/null during "make check" * itpp/base/itassert.h, itpp/base/itassert.cpp: Added it_info_no_endl() and it_info_no_endl_debug() macros, which does not append "std::endl" at the end of message. 2007-02-03 Adam Piatyszek * itpp/base/algebra/ls_solve.cpp: Minor fixes to prevent "unused variable" warnings when NDEBUG flag is defined. 2007-02-03 Erik G. Larsson * itpp/base/gf2mat.cpp, itpp/comm/llr.cpp, itpp/comm/ldpc.cpp: Updated some assertions and information messages 2007-02-02 Adam Piatyszek * itpp/base/algebra/det.cpp, itpp/base/algebra/eigen.cpp, itpp/base/algebra/inv.cpp, itpp/base/algebra/ls_solve.cpp, itpp/base/algebra/lu.cpp, itpp/base/algebra/schur.cpp, itpp/base/array.h, itpp/base/binary.h, itpp/base/circular_buffer.h, itpp/base/converters.cpp, itpp/base/gf2mat.cpp, itpp/base/gf2mat.h, itpp/base/mat.cpp, itpp/base/matfunc.h, itpp/base/mat.h, itpp/base/operators.cpp, itpp/base/smat.h, itpp/base/specmat.cpp, itpp/base/stack.h, itpp/base/svec.h, itpp/base/vec.h, itpp/comm/commfunc.cpp, itpp/comm/convcode.cpp, itpp/comm/galois.h, itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, itpp/comm/llr.cpp, itpp/comm/llr.h, itpp/comm/modulator.cpp, itpp/comm/modulator.h, itpp/fixed/cfix.cpp, itpp/fixed/cfix.h, itpp/fixed/fix_base.cpp, itpp/fixed/fix.cpp, itpp/fixed/fix_functions.h, itpp/fixed/fix.h, itpp/fixed/fix_operators.cpp, itpp/signal/resampling.h, itpp/signal/sigfun.cpp, itpp/signal/transforms.cpp, itpp/srccode/audiofile.cpp, itpp/srccode/pnm.cpp: Mass replace of the depreceted it_assert0() and it_assert1() macros with it_assert_debug() * itpp/base/itassert.h: Fixed a small bug in the it_info_debug() macro definition. Documentation improved. 2007-02-01 Adam Piatyszek * configure.ac, itpp/base/itassert.cpp, itpp/base/itassert.h: Improved and reorganised existing error handling macros: - using standard NDEBUG flag for controlling it_assert_debug() macro, which replaced a three-level ASSERT_LEVEL definition - for backward compatibility it_assert0() and it_assert1() now behaves the same as it_assert_debug() - added new it_info() and it_info_debug() macros for printing information messages; it_info_debug() is also dependent on the NDEBUG compile-time definition - added it_error_msg_style() function for changing the format of it_assert(), it_error() and it_warning() messages; if style is set to Minimum, file name and line number of the error/assert/warning macro is not printed 2007-02-01 Erik G. Larsson * itpp/comm/ldpc.cpp: Fix in the standard constructor 2007-01-31 Erik G. Larsson * itpp/comm/ldpc.h, itpp/comm/ldpc.cpp: Added some initialization functions for completeness of the class hierarchy 2007-01-31 Adam Piatyszek * itpp/comm/punct_convcode.h: Protected inheritance of the Convolutional_Code class replaced with a public one. This fixes the problem of assigning the Punctured_Convolutional_Code class object to a pointer of Channel_Code class. * itpp/base/gf2mat.cpp: Fixed improper reading and writing functions of the alist file format 2007-01-30 Adam Piatyszek * configure.ac, extras/itpp-config.t2t, extras/txt2man.sh, itpp-config.1.in, Makefile.am: Added man page for itpp-config script 2007-01-29 Adam Piatyszek * itpp/comm/ldpc.cpp: Replaced long with int, since long and int have the same sizes on most IT++ supported architectures. If there is a need for 64-bit integers, (u)int64_t type should be used instead of long. 2007-01-28 Adam Piatyszek * itpp/base/random.cpp, itpp/base/random.h: Replaced "unsigned long" type of "seed" argument of function reset() with "unsigned int", because the rest of Random_Generator implementation uses "unsigned int" type. * itpp/base/itfile.cpp, itpp/comm/convcode.cpp, itpp/comm/convcode.h, itpp/comm/interleave.h, itpp/comm/punct_convcode.cpp, itpp/comm/punct_convcode.h, itpp/comm/turbo.cpp, itpp/comm/turbo.h, itpp/signal/resampling.h, itpp/srccode/gmm.cpp: Replaced long with int, since long and int have the same sizes on most IT++ supported architectures. If there is a need for 64-bit integers, due to portability reasons (u)int64_t type should be used instead of long. 2007-01-27 Adam Piatyszek * itpp/base/bessel/hyperg.cpp, itpp/comm/modulator_nd.cpp: Fixes to avoid warnings on possibly uninitialised variables 2007-01-26 Adam Piatyszek * itpp/base/math/elem_math.cpp, itpp/base/math/elem_math.h: Replaced long with int in binom_i() and gcd() functions, since long and int have the same sizes on most IT++ supported architectures. If there is a need for 64-bit integers, (u)int64_t type should be used instead of long. 2007-01-26 Erik G. Larsson * itpp/comm/ldpc.cpp: Fix to avoid compiler warning 2007-01-26 Adam Piatyszek * itpp/base/binfile.cpp: Fixed a minor bug, which caused infinite loop of itfile_test on Solaris SPARC with GCC 3.4.5 * itpp/base/mat.h, itpp/base/vec.h, itpp/comm/crc.cpp, itpp/comm/crc.h: Added some missing const keywords, as suggested in feature request [1644569]. Thanks to Christian for providing a patch. * itpp/base/binfile.cpp, itpp/base/binfile.h, itpp/base/itfile.h: long type replaced with int or int64_t where necessary due to portability issues. Fixed assumptions of type sizes in << and >> operators replaced with size dependent read_endian() and write_endian() templated functions. Minor cosmetic changes. 2007-01-25 Adam Piatyszek * configure.ac, itpp/base/ittypes.h, itpp/config_msvc.h, win32/itpp.vcproj: Improved portability by adding checks for sizes of short, int, long and "long long" integer types. Assuming that short has always 2 bytes and int has always 4 bytes. Instead of long or "long long" types, an int64_t type should be used, which has always 8 bytes on both 32- and 64-bit platforms. MSVC++ project file and configuration header updated accordingly. 2007-01-24 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Added Kumar Appaiah (Debian packages maintainer) to the list of authors * itpp/base/sort.h: Minor documentation improvements * tests/Makefile.am: Added missing "tests/itfile_test_data.it" file * itpp/base/sources.mk: Added missing "ittp/base/ittypes.h" file 2007-01-23 Adam Piatyszek * configure.ac: IT++ version incremented 2007-01-23 Erik G. Larsson * itpp/comm/modulator_nd.cpp: Fixed an incorrect assertion check 2007-01-23 Adam Piatyszek * itpp/base/itfile.cpp, itpp/base/itfile.h, itpp/base/ittypes.h, itpp/fixed/fix_base.cpp, itpp/fixed/fix_base.h, itpp/itbase.h: Improved inter-platform portability by using fixed-length integer types where needed. * itpp/base/binfile.cpp, itpp/base/binfile.h: Documentation improvements and minor cosmetic changes * tests/itfile_test.cpp, tests/itfile_test_data.it, tests/itfile_test.ref: Improved it_file tests 2007-01-22 Adam Piatyszek * tests/itfile_test.cpp, tests/itfile_test_data.it, tests/itfile_test.ref, tests/Makefile.am: Added test file for a binary it_file format. It is supposed to detect wrong endianness detection on various platforms. (merged rev. 860:863 from the itpp-3-10 branch) * itpp/comm/modulator.cpp: Fixed wrong assertion check in QAM modulator set_M() function ------------------------------------------------------------------------------ 2007-01-21 Adam Piatyszek * IT++ 3.99.0 released (SVN tag: release-3-99-0) * Makefile.am: Added missing files to EXTRA_DIST 2007-01-20 Adam Piatyszek * ChangeLog-2006: ChangeLog entries from year 2006 moved to a separate file * doc/local/verification.doc: Updated to include tests under Solaris SunOS with ATLAS 2007-01-19 Adam Piatyszek * doc/local/verification.doc: Updated to include recent tests under Cygwin/Windows XP and Solaris SunOS 2007-01-18 Adam Piatyszek * doc/local/verification.doc: Updated to include recent test under Gentoo Linux with Intel MKL 2007-01-18 Erik G. Larsson * itpp/comm/ldpc.h, itpp/comm/ldpc.cpp: Changed one function name and updated documentation * doc/local/verification.doc: Updated 2007-01-17 Adam Piatyszek * doc/local/verification.doc: Updated to reflect recent tests * NEWS: Consistancy and language improved. Thanks to Erik for his valuable comments. 2007-01-17 Erik G. Larsson * itpp/base/gf2mat.h, itpp/base/gf2mat.cpp, itpp/comm/ldpc.cpp: Changed int to bool and vice versa for code portability 2007-01-17 Adam Piatyszek * itpp/base/random.h: Fixed bug [1635988] by implementing the twist() function in a similar way as the original TWIST() macro from Takuji Nishimura's and Makoto Matsumoto's C sources. * win32/itpp.vcproj: Updated to reflect recent changes in source files' locations 2007-01-16 Erik G. Larsson * itpp/comm/ldpc.cpp, tests/ldpc_test.ref: Changed rand() to randi() for code portability and to use it++ routines for random numbers * itpp/comm/llr.h: C convention for INT_MAX changed to C++ 2007-01-16 Adam Piatyszek * tests/Makefile.am: Fixed non-portable parts of the Makefile reported by the latest stable automake 1.10 2007-01-14 Adam Piatyszek * NEWS, NEWS-3.10: NEWS file with 3.10 series information copied to NEWS-3.10. Preliminary information for 3.99.x development releases prepared in NEWS. ------------------------------------------------------------------------------ 2007-01-14 Adam Piatyszek * IT++ 3.10.8 released (SVN tag: release-3-10-8) (merged rev. 828:830 from the itpp-3-10 branch) 2007-01-13 Adam Piatyszek * NEWS: Updated to reflect recent changes (merged rev. 828:830 from the itpp-3-10 branch) * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, tests/channel_test.cpp, tests/ldpc_test.cpp: Added missing SVN properties 2007-01-13 Erik G. Larsson * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h, itpp/comm/modulator_nd.h, itpp/comm/modulator_nd.cpp: Code cleanup, removing local declarations, etc. 2007-01-11 Erik G. Larsson * itpp/comm/ldpc.cpp, tests/ldpc_test.ref: Minor enhancements * itpp/base/specmat.h, itpp/base/specmat.cpp: Added function "zigzag_space()" 2007-01-09 Conrad Sanderson * itpp/base/itassert.cpp: Changed "Assertation" to "Assertion" 2007-01-07 Erik G. Larsson * AUTHORS, doc/local/authors.doc, itpp/comm/ldpc.h, itpp/comm/ldpc.cpp, itpp/itcomm.h, itpp/tests/ldpc_test.cpp, itpp/tests/ldpc_test.ref, itpp/comm/sources.mk, tests/Makefile.am, doc/tutorial/tutorial.doc, doc/tutorial/sources.mk, doc/tutorial/src/sources.mk, doc/tutorial/ldpc_gen_codes.doc, doc/tutorial/ldpc_bersim_awgn.doc, doc/tutorial/src/ldpc_gen_codes.cpp, doc/tutorial/src/ldpc_bersim_awgn.cpp: Added first version of the LDPC codec class * itpp/comm/llr.h, itpp/comm/llr.cpp, itpp/tests/llr_test.ref, itpp/tests/modulator_nd_test.ref: Minor updates * itpp/base/smat.h: Minor efficiency improvements * itpp/comm/error_counters.h: Added function get_total_bits() and get_total_blocks() * itpp/base/gf2mat.h: Documentation updates * TODO: Updated 2007-01-05 Erik G. Larsson * itpp/base/gf2mat.h: Clarification in documentation 2007-01-04 Erik G. Larsson * itpp/base/gf2mat.h, itpp/base/gf2mat.cpp, tests/Makefile.am: Code readability and documentation improvements. Minor fixes. 2007-01-03 Erik G. Larsson * itpp/base/gf2mat.h, itpp/base/gf2mat.cpp, tests/gf2mat_test.cpp, tests/gf2mat_test.ref: Added support for "alist" representation (based on code provided by Adam P) of sparse GF(2) matrices. Implemented minor improvements. * doc/tutorial/src/mimoconv.cpp: Minor improvements * itpp/base/random.h: Minor documentation improvement 2007-01-02 Adam Piatyszek * itpp/base/mat.h: Implemented feature request [1216416]. Multiply operator `*' of a vector `v' and single-row matrix `m' now works for any size of vector `v'. This change is backward compatible with the previous implementation. * itpp/base/array.h: Fixed a small bug caused by a missing "const" keyword in in_range() inline function. 2007-01-01 Adam Piatyszek * itpp/base/array.h, tests/array_test.cpp, tests/array_test.ref, TODO: Added missing left(), right() and mid() methods to the Array class. itpp-4.3.1/ChangeLog-2008000066400000000000000000001474301216575753400146640ustar00rootroot000000000000002008-12-11 Adam Piatyszek * itpp/base/matfunc.cpp, itpp/base/matfunc.h: Add missing template instantiations. The templates is_hermitian() and is_unitary() had extern instantiations in the header file, but were never instantiated in the corresponding source file, which lead to linking errors when using these functions. This patch fixes this bug (#2392728) by adding the corresponding template instantiations in matfunc.cpp. Signed-off-by: David Hammarwall * itpp/stat/misc_stat.cpp, itpp/stat/misc_stat.h: Improve performance of the Frobenius norm. The implementation of the Frobenius norm calculation for matrix M was done by multiplying M' times M and then throwing away everything but the diagonal. This was definitely not the optimum way to calculate. Signed-off-by: Bo Lincoln 2008-12-02 Adam Piatyszek * tests/bch_test.ref, tests/blas_test.ref, tests/channel_test.ref, tests/cholesky_test.ref, tests/circular_buffer_test.ref, tests/convcode_test.ref, tests/converters_test.ref, tests/det_test.ref, tests/eigen_test.ref, tests/fastica_test.ref, tests/filter_design_test.ref, tests/filter_test.ref, tests/histogram_test.ref, tests/interleaver_test.ref, tests/inv_test.ref, tests/ldpc_test.ref, tests/ls_solve_test.ref, tests/lu_test.ref, tests/mat_test.ref, tests/matfunc_test.ref, tests/modulator_nd_test.ref, tests/modulator_test.ref, tests/poly_test.ref, tests/pulse_shape_test.ref, tests/qr_test.ref, tests/rand_test.ref, tests/reedsolomon_test.ref, tests/schur_test.ref, tests/sigfun_test.ref, tests/sort_test.ref, tests/sparse_test.ref, tests/specmat_test.ref, tests/stat_test.ref, tests/svd_test.ref, tests/transforms_test.ref, tests/turbo_test.ref, tests/vec_test.ref: Update test reference files for the new RNG implementation. * itpp/base/random.cpp, itpp/base/random.h: Replace random_01* with genrand_* methods. random_01(), random_01_lclosed() and random_01_rclosed() methods are only backward compatible wrappers for genrand_open_open(), genrand_close_open() and genrand_open_close(). Besides, the semi-closed methods are a little bit faster, therefore prefer genrand_close_open() and genrand_open_close() where appropriate. * itpp/base/random.cpp, itpp/base/random.h, itpp/base/random_dsfmt.h, itpp/base/sources.mk: Add DSFMT implementation of random number generator. The DSFMT class implements parts of the Double precision SIMD-oriented Fast Mersenne Twister (dSFM) random number generator. DSFMT directly generates double precision floating point random numbers, which have the IEEE 754 floating-point format. Besides, unsigned integer numbers can also be directly generated using genrand_uin32() method. This implementation is 1.8-2.4 times faster than the previous MT implementation. Thanks to Mutsuo Saito and Makoto Matsumoto from Hiroshima University for their original implementation in C, which is a base for this C++ DSFMT class. 2008-12-01 Adam Piatyszek * itpp/base/binfile.cpp, itpp/base/math/misc.cpp, itpp/base/math/misc.h, itpp/srccode/audiofile.cpp: Rename check_big_endianness() to is_bigendian(). check_big_endianness() function is still available for backward compatibility, but marked as deprecated. 2008-11-13 Adam Piatyszek * itpp/base/timing.cpp, itpp/base/vec.cpp, itpp/fixed/cfix.cpp, itpp/fixed/fix.cpp: Add missing #include files required by GCC 4.4 GCC 4.4 cleaned up some more C++ headers. Required header files have to be included explicitly. Signed-off-by: Martin Michlmayr 2008-11-12 Adam Piatyszek * itpp/signal/transforms.cpp: Let IT++ compile and link with MKL 10.1. The updated MKL 10.1 package defines DftiCreateDescriptor macro in mkl_dfti.h header file, which caused compilation errors in IT++ transforms.cpp file. This patch fixes this problem. ------------------------------------------------------------------------------- 2008-10-08 Adam Piatyszek * IT++ 4.0.6 release (SVN tag: release-4-0-6) * NEWS, VERSION: Add release notes and update version number for IT++ 4.0.6. * itpp/itpp_acml_tests/Makefile.am, itpp/itpp_mkl_tests/Makefile.am: Add specmat_test.vcproj files to the list of distributed files. 2008-10-05 Erik G. Larsson * doc/local/verification.doc: Added Ubuntu 8.04 to list of tested systems * doc/local/installation.doc: Minor fix 2008-09-17 Adam Piatyszek * itpp/base/mat.h, itpp/base/vec.h: Do not explicitly inline elem_mult_inplace() when using MSVC++. This is a workaround for a warning reported by Microsoft Visual C++ Express 2008. * win32/itpp_acml.sln, win32/itpp_mkl.sln: Use CRLF line endings in MSVC++ solution files. * win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_acml_tests/specmat_test.vcproj, win32/itpp_mkl_tests/itpp_mkl_tests.sln, win32/itpp_mkl_tests/specmat_test.vcproj: Add MSVC++ project files for specmat_test. 2008-09-12 Adam Piatyszek * tests/Makefile.am, tests/specmat_test.cpp, tests/specmat_test.ref: Add specmat_test program for testing special vectors and matrices. Initially only toeplitz() function is tested. * itpp/base/specmat.cpp, itpp/base/specmat.h: Fix broken implementation of toeplitz() function. The previous implementation generated incorrect matrices for two complex-valued input vectors. This patch fixes this problem. BTW, the implementation is now based on a template function, so bmat, smat and imat matrices can now be generated. Thanks to Niklas Johansson for reporting this issue. This closes bug report [2110119]. 2008-09-01 Adam Piatyszek * test/vec_test.cpp, test/vec_test.ref: Revert part of SVN revision 1613. I/O stream labels for infinity and not-a-number have different case sensitivity in various supported GCC versions ("inf" vs. "Inf", "nan" vs. "NaN"). Thus we can not test for them in a vector initialisation from string. 2008-08-30 Adam Piatyszek * itpp/base/itassert.h: Get rid of config.h dependency from itassert.h header file. * itpp/comm/galois.cpp: Fix bug in GF::set_size() method, which was reported by Stephan Ludwig. Because "alphapow" and "logalpha" are static variables, every instantiation of the GF class uses the very same of them. If different instantiations of different Galois fields access this (e.g. 2^8 and 2^6, while 2^6 has been created first), the latter might overwrite/delete the log table of the previous while calling GF::set_size() method (2^8 widens the array to m+1=9, while not copying the 2^6 entries). The solution is to copy the contents of "alphapow" and "logalpha" when resizing them. Thanks to Stephan Ludwig for noticing this problem and also to EndZone for confirming it. * itpp/base/sort.h: Make sort() and sort_index() work for vectors with less than two elements. Without this patch, the above two functions resulted in an assertion error. Thanks to Yngve Seln for reporting this problem. 2008-08-18 Erik G. Larsson * extras/gdb_macros_for_itpp, extras/Makefile.am: added GDB debugger display macros for it++ data types. This closes feature request [1913404]. Thanks to Vasek for providing an initial version of the macros. 2008-08-11 Adam Piatyszek * tests/vec_test.cpp, tests/vec_test.ref: Modified existing and added new tests of vector initialisations with string * tests/vec_test.cpp, tests/vec_test.ref: Fix vector initialisation test with "a:b" format when a > b This test is not valid with the new string parser implementation, because negative decrements have to be explicitly gived as 'b' in "a:b:c" format string. This is consistant with GNU Octave way of parsing such strings. * itpp/base/vec.cpp, itpp/base/vec.h: String parser reimplemented to support multiple "a:b:c" format strings The new implementation supports multiple "a:b[:c]" formats in one string. For instance: ivec v = "1:2:5, 6 8 9:-1:0"; now works. Memory handling is also more efficient, i.e. for the cases when "a:b:c" format is not used, memory is allocated only once. Besides, the new implementation should be easier to maintain, because the code is much more modular. This patch resolves feature request [2041480]. * win32/itpp_acml.vcproj, win32/itpp_acml_tests/*.vcproj, win32/itpp_mkl.vcproj, win32/itpp_mkl_tests/*.vcproj: Suppress warnings about deprecated "/Wp64" options in MSVC++ project files 2008-08-10 Adam Piatyszek * doc/tutorial/src/ldpc_bersim_awgn.cpp: Add missing "LL" suffix to 64-bit inteager initialisation This eventually fixes integer overflow error in LDPC BER simulation tutorial example. 2008-08-09 Adam Piatyszek * itpp/stat/mog_diag.h: Suppress a minor warning reported by Doxygen * doc/tutorial/src/ldpc_bersim_awgn.cpp: Fix minor problem with integer overflow in expression The initialisation of int64_t variable with a multiplied inteager constants caused an integer overflow of the temporary calculation result. This patch fixes this issue by using one big constant in the initialisation. 2008-08-07 Adam Piatyszek * itpp/base/vec.h, tests/vec_test.cpp, tests/vec_test.ref: Fix regression [2041474] in Vec<>::split() method In IT++ 3.10.x releases it was possible to split a vector at its end, e.g.: vec v1 = "1 2 3 4 5"; vec v2 = v1.split(5); In the current stable branch (4.0.x) the above code results in an assertion. This patch fixes this regression and also improves the documentation, so it is clearly explained which elements are returned and which are stored in the original vector. Besides, the vec_test program now includes a new test for splitting a vector at pos = 0 and pos = datasize. Thanks to Yngve Selén for reporting this bug. 2008-08-02 Adam Piatyszek * m4/acx_blas.m4: MKL requires zdotusub Fortran wrapper function on x86_64 architecture This fixes broken blas_test and vector_test on 64-bit linux architectures when IT++ is linked to Intel MKL BLAS library. This fix is equivalent to passing "--with-zdotu=zdotusub" option to configure. ------------------------------------------------------------------------------- 2008-07-18 Adam Piatyszek * NEWS, VERSION: Add release notes and update version number for IT++ 4.0.5 * tests/vec_test.cpp, tests/vec_test.ref: Add a test-case to reproduce bug [2017948] * itpp/base/vec.cpp: Fix bug [2017948] in parsing error of "a:b:c" ivec initialisation There was a bug in vec.cpp that caused an assertion error when integer vectors were initialized using the "a:b:c" notation. For example: ivec iv = "0:2:4"; raised an exception. This patch fixes this bug by removing an unnecessary "seekg" operation. Thanks to David Hammarwall for reporting the problem and solution to it. 2008-07-11 Adam Piatyszek * itpp/base/mat.h: Fix bug [2004345] causing incorrect result of Mat::concat_vertical() In case when one of the input matrices to concat_horizontal() or concat_vertical() functions was empty, an error occurred. With this patch the result of concatenating an empty matrix with some other matrix is defined and a copy of the other matrix is returned. This fixes bug [2004345]. Thanks to Carlos Pineda for reporting this problem. * itpp/base/mat.h: Reset number of rows/columns if one of the dimensions given to Mat::set_size() is zero Without this patch, the Mat::set_size() function set number of rows or cols to non zero value, even if the other matrix dimension was zero. This was not compatible with the constructor. Besides, setting one of the dimensions of a matrix to non zero value, if the other one is zero does not makes sense and might cause problems with other functions operating on matrices. This patch fixes this problem. 2008-06-17 Adam Piatyszek * itpp/comm/bch.cpp: Fix bug [1995743] in BCH::decode() function The second argument of if ((delta == GF(n + 1, -1)) || (OldLambda.get_degree() > kk)) takes the degree of OldLambda. But get_degree() does not return the true degree of that polynomial but its allocated space. GFX::get_true_degree() does what we want. If OldLambda's "degree" is larger than its "true degree", a wrong decision is made in the if statement, resulting in a wrong Lambda(x), which in general leads to a decoding failure, while the code word should have been correctable in theory. This patch fixes this bug and also removes a redundant "temp" variable. Signed-off-by: Stephan Ludwig 2008-06-12 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Add Stephan Ludwig (donludovico) to the list of contributors * itpp/comm/bch.cpp, itpp/comm/bch.h, tests/bch_test.cpp: Auto-calculate the BCH generator polynomial from (n, t) parameters This patch improves the previous patch, so only n (codeword length) and t (error-correcting capability) parameters are required to specify a particular BCH code. The generator polynomial and k (message word length) are calculated automatically. The new constructor does no longer break the implicit cast ivec("...") of the generator polynomial parameter in the old constructor. Signed-off-by: Stephan Ludwig 2008-06-09 Adam Piatyszek * itpp/comm/bch.cpp, itpp/comm/bch.h, tests/bch_test.cpp: Auto-calculate the BCH generator polynomial from (n, k, t) parameters Beside the known Parameters n (codeword length), k (message word length), t (designed error-correcting capability) the actual BCH class needs to be handed over the generator polynomial in octal form. This can be very long for some codes and thus hard-copying from textbooks often leads to copying errors. Since the generator polynomial is unique (as far as I know) for given parameters n, k, t, this generator polynomial can be calculated during instantiation of the BCH class - given the parameters n, k, t. Thus, copying errors can be avoided. This new feature is supplied as a second constructor for the BCH class by the attached patch. In other words: With the new constructor, you no longer have to pass on the generator polynomial but only the parameters n, k, and t. The constructor generates the generator polynomials according to Wicker: "Error control systems for digital communication and storage" as given in Appendix E of this book. The polynomials are also the same as in Lin/Costello: "Error control coding". Unfortunately, the usual call (cf. IT++ documentation), i.e. BCH bch(31, 21, 2, "3 5 5 1"); does no longer work, since both constructors confuse at run-time: The new constructor is called and the string is interpreted as bool systematic. The correct usage would now be: BCH bch(31, 21, 2, ivec("3 5 5 1")); Signed-off-by: Stephan Ludwig 2008-06-05 Adam Piatyszek * itpp/comm/hammcode.cpp, itpp/comm/hammcode.h, itpp/comm/sequence.cpp, itpp/comm/spread.h: Replace "short" variables with "int" to prevent implicit conversions MSVC++ warns about implicit conversions between "int" and "short" types, which can cause lost of data. Therefore use "int" type for indexing purposes as most of the IT++ codes do. * itpp/comm/modulator.cpp, itpp/comm/modulator.h: Remove redundant argument from calculate_softbit_matrices() function Since calculate_softbit_matrices() is a private method of a class, in which "bits2symbols" variable is also declared, there is no need to pass this variable as an argument of this method. * itpp/base/itfile.h, itpp/base/random.h, itpp/comm/bch.h, itpp/comm/rec_syst_conv_code.h, itpp/comm/reedsolomon.h: Suppress MSVC++ warning C4512: "assignment operator could not be generated" MSVC++ warns when an assignment operator can not be automatically generated because of constant variables existing in a class. To suppress this warning an dummy assignment operator can be added as in this patch. * itpp/base/vec.cpp, itpp/fixed/fix.cpp: Suppress MSVC++ warning C4701: "potentially uninitialized local variable..." * itpp/base/gf2mat.cpp, itpp/base/itfile.cpp, itpp/base/mat.h, itpp/base/math/misc.h, itpp/base/vec.h, itpp/comm/galois.cpp, itpp/srccode/audiofile.cpp, itpp/srccode/pnm.cpp: Suppress MSVC++ warning C4244: "conversion from 'int' to 'char'..." Some of the expressions require explicit casts to "char". Where appropriate "int get()" method of iostream class is replaced with "get(char &)" function. Besides, GF::set_size() method is re-factored a little bit, so the "mtemp" integer variable is no longer necessary. * itpp/base/factory.h, itpp/base/mat.h, itpp/base/matfunc.h, itpp/base/timing.cpp, itpp/base/vec.h, itpp/comm/bch.cpp, itpp/comm/channel.cpp, itpp/comm/convcode.cpp, itpp/comm/egolay.cpp, itpp/comm/hammcode.cpp, itpp/comm/ldpc.h, itpp/comm/modulator.cpp, itpp/comm/punct_convcode.cpp, itpp/comm/reedsolomon.cpp, itpp/fixed/cfix.h, itpp/fixed/cfixed.h, itpp/fixed/fix.h, itpp/fixed/fix_functions.h, itpp/protocol/tcp.cpp, itpp/protocol/tcp.h, itpp/stat/misc_stat.cpp, itpp/stat/mog_diag.cpp, itpp/stat/mog_diag.h, itpp/stat/mog_diag_em.cpp: Suppress MSVC++ warning C4100: "unreferenced formal parameter" This warning is suppressed by omitting named parameters in arguments of functions. Only types of parameters are passed. * configure.ac.in: Change default debugging flags to "-g -O1" or "-Wall -ggdb -O1 -pipe" The latter set is only used when GCC compiler is used, so it implicitly assumes that GDB debugger will be used in such a case. 2008-05-30 Adam Piatyszek * itpp/comm/bch.cpp, itpp/comm/bch.h, tests/bch_test.cpp: Auto-calculate the BCH generator polynomial from (n, k, t) parameters Beside the known parameters n (codeword length), k (message word length) and t (error-correcting capability), a generator polynomial in octal form needs to be handed over to the actual BCH class. This generator can be very long for some codes and thus copying by hand from textbooks often leads to errors. Since the generator polynomial is unique for given parameters (n, k, t), this generator polynomial can be calculated during instantiation of the BCH class. This new feature is supplied as a second constructor for the BCH class in this patch. The constructor generates the generator polynomials according to Wicker: "Error control systems for digital communication and storage" as given in Appendix E of this book. The polynomials are also the same as in Lin/Costello: "Error control coding". Unfortunately, the usual call BCH bch(31, 21, 2, "3 5 5 1"); does no longer work, since both constructors confuse at run-time: The new constructor is called and the string is interpreted as bool systematic (that's what I guess). The correct usage of the old constructor would now be BCH bch(31, 21, 2, ivec("3 5 5 1")); Signed-off-by: Stephan Ludwig * itpp/base/math/log_exp.h, itpp/srccode/gmm.h: Remove functions marked as deprecated before 3.10.7 release GMM::get_no_mixtures() was replaced a long time ago with GMM::get_no_gaussians(), whereas needed_bits() was replaced with either int2bits() or levels2bits(). Therefore it is the highest time to remove the deprecated interfaces in our development branch. 2008-05-21 Adam Piatyszek * doc/local/users_guide.doc: Minor documentation fix in Users Guide There is no such functions as swap_row() and swap_col() in IT++. swap_rows() and swap_cols() are the proper ones. This fixes bug [1968377]. Thanks to Allan Murray for reporting this issue. 2008-05-17 Adam Piatyszek * itpp/base/bessel/hyperg.cpp, itpp/base/itfile.cpp, itpp/base/random.cpp, itpp/comm/punct_convcode.cpp, itpp/fixed/cfix.cpp, itpp/fixed/fix.cpp, itpp/srccode/pnm.cpp, itpp/stat/mog_diag_em.cpp, itpp/stat/mog_diag_kmeans.cpp, itpp/stat/mog_generic.cpp: Fix GCC 4.3 warnings on "ambiguous else" due to missing braces The latest GCC compiler is much more picky when it comes to if/else statements without explicit braces. This results in a lot of warnings when "-Wall" flag is used. This patch adds missing braces or refactors code for which such warnings were reported by GCC 4.3. 2008-05-15 Adam Piatyszek * configure.ac.in: Set CXXFLAGS_DEBUG to CXXFLAGS when --enable-debug is not used This new behaviour is consistent with setting the same set of libraries for both the debug and optimised cases, when --enable-debug is not used. Besides, the CXXFLAGS_DEBUG variable is now documented when "configure --help" is used. 2008-05-09 Erik G. Larsson * doc/tutorial/matlab_itpp.doc: Documentation improvement 2008-04-25 Adam Piatyszek * tests/modulator_nd_test.cpp: Cosmetic fix - remove doubled semicolon * Unify coding style using an astyle source code formatter This huge patch is intended to unify the coding style for all IT++ source and header files. The formatting has been performed with the astyle v1.22 program, using the configuration stored in extras/astylerc file. 2008-04-15 Adam Piatyszek * itpp/base/vec.h: Fix regression of a missing inline keyword in outer_product() specialisation The inline keyword is necessary for template specialisations that are defined in the header file. This bug resulted in linking problems without any external BLAS library, when this particular specialisation was used. Thanks to Markus Dittrich for investigating this problem and providing a patch for it on Gentoo Bugzilla (bug #217621). 2008-04-14 Adam Piatyszek * itpp/signal/fastica.cpp: Fix broken initialisation of Fast_ICA::set_init_guess() method The set_init_guess() now changes initState, which is checked in separate(), so that the provided guess is passed into the solver, rather than a zero matrix as before. This patch fixes bug report [1941219]. Signed-off-by: Matthew Chaudhuri 2008-04-09 Adam Piatyszek * itpp/base/converters.cpp, itpp/base/converters.h, itpp/base/itcompat.cpp, itpp/base/itcompat.h: Move rint() to itcompat.{cpp,h} This function is conditionally defined on platforms, which do not provide their own implementation. Therefore the best place for it is in itcompat.{cpp,h} files. * itpp/base/itcompat.h, itpp/base/math/trig_hyp.h, itpp/signal/poly.cpp, itpp/signal/window.cpp, itpp/base/itcompat.cpp: Move asinh(), acosh() and atanh() to itcompat.{cpp,h} These functions are conditionally defined on platforms, which do not provide their own implementations. Therefore the best place for them is in itcompat.{cpp,h} files. * itpp/base/itcompat.h, itpp/base/math/log_exp.h: Move log1p() and log2() definitions from log_exp.h to itcompat.h BTW, log2() now uses "static const double" variable initialised with the result of "1.0 / std::log(2.0)" division. * itpp/base/itcompat.cpp, itpp/base/itcompat.h, itpp/base/math/error.cpp, itpp/base/math/error.h: Move erf(double) and erfc(double) error functions to itcompat.{cpp,h} These functions are conditionally defined on platforms, which do not provide their own implementations. Therefore the best place for them is in itcompat.{cpp,h} files. * itpp/base/itcompat.cpp, itpp/base/itcompat.h, itpp/base/math/elem_math.cpp, itpp/base/math/elem_math.h: Move tgamma(), lgamma() and cbrt() definitions to itcompat.{cpp,h} These three functions are conditionally defined on platforms, which do not provide their own implementations. Therefore the best place for them is in itcompat.{cpp,h} files. * configure.ac.in, itpp/base/converters.h, itpp/base/itcompat.h, itpp/config_msvc.h: Move portability related definitions from config.h to itcompat.h * itpp/base/bessel/gamma.cpp, itpp/base/itcompat.h, itpp/base/math/log_exp.h, itpp/base/math/misc.cpp, itpp/base/math/misc.h, itpp/base/random.cpp, itpp/stat/mog_generic.cpp: Move isinf(), isnan() and isfinite() definitions to itcompat.h These three functions are conditionally defined on platforms, which do not have them in standard headers. Therefore, the best location for them in IT++ is the itcompat.h header file. * configure.ac.in, itpp/base/itcompat.cpp, itpp/base/itcompat.h, itpp/base/random.cpp, itpp/base/sources.mk, itpp/config_msvc.h, win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Add implementation of expm1() function The expm1() function from C99 standard is not available in MSVC++ compiler. This implementation is taken from the GNU Scientific Library (GSL) and will be only used on platforms that do not have their own expm1() function. * itpp/base/binfile.h, itpp/base/itcompat.h, itpp/base/itfile.h, itpp/base/ittypes.h, itpp/base/sources.mk, itpp/fixed/fix_base.h, itpp/itbase.h, win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Rename ittypes.h to itcompat.h Beside fixed size integer type definitions, the new file itcompat.h will include all conditional implementations of functions, which are non available on various platforms and compilers, e.g. std::isfinite() or expm1(). 2008-04-08 Adam Piatyszek * README, doc/local/index.doc.in: Reworded and rearranged the brief description of the IT++ library Thanks to Kumar Appaiah for some language suggestions. ------------------------------------------------------------------------------- 2008-03-31 Adam Piatyszek * IT++ 4.0.4 release (SVN tag: release-4-0-4) * NEWS, VERSION: Add release notes and update version number for IT++ 4.0.4 * win32/itpp_acml_tests/Makefile.am, win32/itpp_mkl_tests/Makefile.am: Add converters_test.vcproj to EXTRA_DISTS variable of Makefiles Without this patch, the project files for converters_test were not included in the distribution package. 2008-03-26 Adam Piatyszek * tests/itfile_test.cpp: Remove setf(ios::scientific) and setf(ios::fixed) from itfile_test.cpp These two formatting options causes broken output of floating-point data when using MSVC++ Express 2008. In spite of the fact that this seems to be a bug in MSVC++ Express 2008, removal of these formatting options fixes this problem. 2008-03-25 Adam Piatyszek * tests/itfile_test.cpp, tests/itfile_test_data.it: Improve itfile_test by using a non-continuous reference data file Such a data file is prepared by first saving a longer data structure (ivec in this case), then deleting it and finally saving a shorter data structure in the same place. * itpp/base/itfile.cpp: Do not duplicate seek operation after reading data_header fields When reading each field of a data_header structure of an IT++ file, the reading position is automatically incremented. So, the additional seekg() operation afterwards is redundant. This small modification fixes a problem with endless loop while reading an itfile in programs compiled with MSVC++ 2008. Previous MSVC++ version (2005) does not show this strange behaviour. * tests/Makefile.am, tests/converters_test.cpp, tests/converters_test.ref, win32/itpp_acml_tests/converters_test.vcproj, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_mkl_tests/converters_test.vcproj, win32/itpp_mkl_tests/itpp_mkl_tests.sln: Create a simple test program of various conversion functions This test should catch possible incompatible implementation of the rint() function, which is not available under MSVC++ compiler. * itpp/base/converters.cpp, itpp/base/converters.h: Fix incorrect implementation of rint() function used under MSVC++ The rint() function is not available under MSVC++ compiler. Thus, the local implementation has to be conditionally enabled for this compiler. This patch fixes the incorrect implementation of rint() function, which behaved like a similar round() function. It also moves the "double rint(double)" definition out of the itpp namespace. 2008-03-20 Adam Piatyszek * win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Do not treat warnings as errors in MSVC++ projects This is a workaround for MS Visual C++ Express 2008 problem in compiling a correct piece of templated code. * itpp/base/algebra/cholesky.h, itpp/base/algebra/det.h, itpp/base/algebra/eigen.h, itpp/base/algebra/ls_solve.h, itpp/base/algebra/lu.h, itpp/base/algebra/qr.h, itpp/base/binary.h, itpp/base/binfile.h, itpp/base/copy_vector.h, itpp/base/gf2mat.h, itpp/base/itassert.h, itpp/base/itfile.h, itpp/base/ittypes.h, itpp/base/mat.h, itpp/base/sort.h, itpp/base/svec.h, itpp/base/vec.h: Minor spelling fixes in IT++ base module documentation This commit fixes several little spelling mistakes in the IT++ base module documentation. Signed-off-by: Kumar Appaiah 2008-03-18 Adam Piatyszek * tests/ldpc_test.cpp, tests/ldpc_test.ref: Minor workaround for a failing ldpc_test on win32 platforms MinGW and MSVC++ produce win32 executables, which use slightly different rounding approach for real numbers output through cout or cerr I/O streams. This patch just changes the precision of the output values, so the problematic case does not occur any more. * itpp/base/random.cpp, itpp/base/random.h, tests/rand_test.cpp, tests/rand_test.ref: Add implementation of Gamma(alpha, beta) random number generator The implementation of the Gamma_RNG::sample() function is taken from the R statistical language. Thanks to Vasek Smidl for providing the initial patch in feature request [1913411]. * AUTHORS, doc/local/authors.doc: Add Vasek Smidl to the list of contributors * itpp/base/operators.cpp: Fix complex constructors in operators.cpp to build with g++ 4.3 It appears that g++ 4.3 is a bit more strict with respect to type checking when we attempt to overload the std::complex constructor for use with non-double types. Use of an explicit static_cast is needed to overcome this restriction. This patch does the needful by converting those constructors to use static_casts. Signed-off-by: Kumar Appaiah * itpp/base/algebra/qr.cpp, itpp/base/algebra/qr.h, tests/qr_test.cpp, tests/qr_test.ref: Add qr() overloaded function that do not compute Q. For some tasks (triangularization) the Q matrix is not really needed. This patch implements an overloaded version of the qr() function that does not compute Q. Thanks to Vasek Smidl for submitting the patch. 2008-03-13 Adam Piatyszek * itpp/base/mat.h, itpp/base/vec.h: Fix it_assert_debug() conditions in elem_mult_out() methods of the Vec and Mat classes The checks for equal sizes of three and more variables can not be written like this: "a.size == b.size == c.size". The proper form is: "(a.size == b.size) && (a.size == c.size)". This patch fixes this bug. It also removes the redundant checks for different dimensions of a matrix before invoking the set_size(rows, cols) method. Thanks to Martin Senst for reporting this bug. 2008-03-12 Adam Piatyszek * itpp/comm/ldpc.cpp, itpp/comm/ldpc.h: Simplify BLDPC_Parity::calculate_base_matrix() function The previous implementation used to create a temporary dense parity check matrix and then extracted Z by Z submatrices from it for further processing. With this patch, the temporary Z by Z submatrices are sparse and extracted directly from the sparse parity check matrix H. Besides, the checks for cyclic-shifted identity matrices are simplified. Therefore, an additional method circular_eye_b() is no longer needed. * itpp/comm/ldpc.cpp: Simplify BLDPC_Parity::expand_base() implementation The previous implementation used to create a temporary dense parity check matrix and then copied its ones to the final sparse matrix. This patch changes the code so the sparse parity check matrix is constructed directly from the input base matrix. * tests/ldpc_test.cpp, tests/ldpc_test.ref: Add simple tests of BLDPC_Parity and BLDPC_Generator classes 2008-03-11 Adam Piatyszek * itpp/base/random.cpp, itpp/base/random.h: Move the implementation of Normal_RNG::sample() to the source file The implementation of Normal_RNG::sample() function is too complicated for inlining, so it should not be included inside the class declaration. This patch moves the actual code from the header file to the source file. * itpp/base/vec.h: Remove checks for different sizes before invoking set_size() function set_size() methods first checks if the requested new size differs from the current one. Therefore, there is no need to check this condition explicitly before invoking set_size() method. 2008-03-10 Adam Piatyszek * itpp/base/mat.h, itpp/base/vec.h: Decrease the number of inline functions in the Vec and Mat classes Overusing the inline keyword usually causes unnecessary code bloat, which results in a rather slower performance of the resulting code. Therefore, this patch reduces the number of inline functions and lefts only the ones which are really trivial or frequently reused. * itpp/base/factory.cpp, itpp/base/factory.h, itpp/base/sources.mk, win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Mark all create_elements() functions as inline ones These functions have 2-4 lines and are only used by alloc() and free() methods only, so we might gain more by inlining them instead of more general functions of Vec, Mat and Array classes. 2008-03-06 Adam Piatyszek * itpp/base/mat.h: Add missing get(int i) method to the Mat class This method returns a copy of the i-th element of the matrix using linear addressing, which is what the const version of operator()(int i) does. * itpp/base/mat.h: Add missing operator=(const std::string &) to the Mat class There is a Mat(const std::string &) constructor but the assignment operator for this type of argument has not been implemented. This patch adds this missing operator. * itpp/base/mat.cpp, itpp/base/mat.h: Add element-wise division operator with a scalar as the dividend This new operator complements a similar one, which performs element-wise division of a matrix by a scalar. * itpp/base/mat.h, itpp/base/matfunc.h, itpp/base/specmat.cpp, tests/mat_test.cpp, tests/mat_test.ref: Deprecate Mat<>::set_submatrix(r1,r2,c1,c2,m) function This function provides identical results as set_submatrix(r,c,m). Moreover, the r2 and c2 indexing arguments are redundant, because their values are determined by the size of the input matrix m. This patch marks this function as deprecated, for possible removal from future IT++ major releases. * itpp/base/mat.cpp, itpp/base/mat.h: Add in_range(r,c), col_in_range(c) and row_in_range(r) inline methods This is a pure clean-up patch which simplifies it_assert_debug() checks. BTW, it also includes a few cosmetic changes to other assertion checks. * itpp/base/mat.cpp, itpp/base/mat.h: Make consistent naming of variables used in the Mat class interface This patch unifies the variable names in the Mat class interface. The following names are now commonly used: - m, m1, m2, etc.: matrix - v: vector - t: simple numeric type Num_T, e.g. bin, int, double - r, r1, r2: row index - c, c1, c2: column index - i: generic index * itpp/base/mat.cpp, itpp/base/mat.h: Clean-up redundant use of "const" keyword in the Mat class There is no need for declaring the returned by value types with an additional "const" keyword. Moreover, Num_T is assumed a simple or built in type for the Mat class, i.e. bin, short int, int, double and complex. Therefore it might be more efficient to pass arguments of this type by value, in which case the "const" keyword is also redundant. * itpp/base/vec.h: Deprecate elem_div(t,v) function of the Vec class This function is only an alias to operator/(t,v). Besides, no similar methods for operator/(v,t), operator*(t,v) and operator*(v,t) exist. * itpp/comm/modulator.h, tests/modulator_test.cpp, tests/modulator_test.ref: Fix bug [1908644] in Modulator<>::set(symbols, bits2symbols) function The bitmap matrix used in the demodulate_bits() function of the Modulator<> base class was improperly constructed from the input bits2symbols mapping vector. This resulted in demodulation errors for some constellations, e.g. 64-QAM or 8-PSK. This patch fixes this problem. Thanks to Yann Cocheril for reporting this problem. 2008-03-04 Adam Piatyszek * itpp/comm/llr.cpp, itpp/comm/llr.h: In case of an overflow saturate QLLR values instead of aborting An overflow may occur when converting real-valued LLR values into QLLR ones and also when calculating the Hagenauer's "boxplus" operator. This patch implements a conditional QLLR saturation in such cases. Moreover, the Boxplus() function is no longer an inline function, because this actually caused performance loss of the LDPC codes decoder. Finally, make the argument of to_double(QLLR) and to_qllr(double) pass-by-value instead of const-reference, since that's faster for POD like double and int. Thanks to Martin Senst for providing the initial patch. 2008-03-02 Adam Piatyszek * itpp/base/vec.cpp, itpp/base/vec.h: Clean-up redundant use of "const" keyword in the Vec class There is no need for declaring the returned by value types with an additional "const" keyword. Moreover, Num_T is assumed a simple or built in type for the Vec class, i.e. bin, short int, int, double and complex. Therefore it might be more efficient to pass arguments of this type by value, in which case the "const" keyword is also redundant. Logical operators (==, !=, >, >=, < and <=) no longer create a local copy of the vector contents. By the way, use consistent name "t" for Num_T variables and wrap long lines before 80 column. * itpp/base/vec.h: Add missing operator=(const std::string &) to the Vec class There is a Vec(const std::string &) constructor but the assignment operator for this type of argument has not been implemented. This patch fixes this problem and unifies the argument names by the way. * doc/local/users_guide.doc, itpp/base/vec.h, tests/vec_test.cpp, tests/vec_test.ref: Add missing operator(bin_list) and get(index_list) methods to the Vec class This patch also simplifies the implementation so get() methods just call inline indexing "()" operators. The documentation and vec_test program are updated accordingly. * itpp/base/vec.h: Replace ((i < datasize) && (i >= 0)) with in_range(i) inline method This is a pure clean-up patch which simplifies it_assert_debug() checks. BTW, it also includes a few cosmetic changes to other assertion checks. 2008-02-28 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Update list of contributors with Martin Senst and Kumar Appaiah * win32/itpp_acml_tests/Makefile.am, win32/itpp_acml_tests/error_count_test.vcproj, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_mkl_tests/Makefile.am, win32/itpp_mkl_tests/error_count_test.vcproj, win32/itpp_mkl_tests/itpp_mkl_tests.sln: Add MSVC++ project files for test program of BERC and BLERC classes * tests/error_count_test.cpp: Clean-up redundant casts to short integer * tests/error_count_test.cpp: Use constructor's initialisation list in BERC and BLERC constructors * tests/Makefile.am, tests/error_count_test.cpp, tests/error_count_test.ref: Add simple test program for BERC and BLERC error counters * itpp/comm/error_counters.cpp, itpp/comm/error_counters.h: Make const member functions actually const Introduce the keyword const for member functions like get_errorrate() that do not change any member variables. Patch submitted by Martin Senst. * itpp/comm/channel.h: Unhide Fading_Generator::generate(int) method for derived classes The "cvec Fading_Generator::generate(int no_samples)" function used to be hidden. This change makes it accessible from derived classes. Patch submitted by Martin Senst. * itpp/base/converters.h: Add specialisations of to_cvec(cvec) and to_cmat(cmat) These specialisations make it possible to call to_cvec() and to_cmat() with complex arguments. The functions then simply return their argument. This fixes the problem with instantiating the Freq_Filt class with std::complex type. Patch submitted by Martin Senst. * itpp/base/math/elem_math.h: Documentation improvements Clarify that sqr(cvec) and sqr(cmat) compute the absolute square, not simply the square. Patch submitted by Martin Senst. * itpp/comm/ldpc.h: Introduce LDPC_Code::get_ninfo() member function This function returns the number of information bits in a codeword. Thanks to Martin Senst for submitting this patch. * itpp/comm/ldpc.cpp: Correct the length of the result of decode() The decode() function used to return the first "ncheck" bits of the decoded codeword, but we want the first "nvar-ncheck" bits. Thanks to Martin Senst for submitting this patch. 2008-02-25 Adam Piatyszek * doc/local/users_guide.doc, doc/tutorial/src/mimoconv.cpp, itpp/base/matfunc.h, itpp/base/vec.h, itpp/comm/crc.cpp, itpp/signal/filter_design.cpp, itpp/signal/freq_filt.cpp, itpp/signal/poly.cpp, itpp/signal/transforms.cpp, tests/vec_test.cpp, tests/vec_test.ref: Revert deprecation of replace_mid() method of Vec class Do not deprecate the replace_mid() method, because it is commonly used in many present codes. Just make it an alias function of set_subvector() one. BTW, replace all occurrences of set_subvector(i1, i2, &v) with set_subvector(i, &v). * itpp/base/vec.h: Add support for "-1" indexing in Vec<>::del(i1, i2) method The indexing operator(i1, i2) of Vec class supports "-1" indexes denoting the last element of a vector. This feature was missing in the del(i1, i2) method, and this patch fixes this. It also fixes the incorrect range check (i1 <= i2). By the way, remove the redundant local variables ii1 and ii2 from the operator(i1, i2) method. * itpp/base/vec.h: Deprecate set_subvector(i1, i2, &v) and replace_mid(i, &v) functions These two methods of the Vec class do exactly the same what the set_subvector(i, &v) function does. Therefore it seems to be a good idea to mark them as deprecated for possible removal from future major releases of IT++. 2008-02-24 Adam Piatyszek * itpp/comm/modulator.h: Remove the deprecated demodulate_soft_bits_approx() functions Since IT++ 3.99.0 was releases, these functions have been marked as deprecated. The demodulate_soft_bits() functions should be used instead. This patch removes them from the current development branch. * itpp/base/mat.cpp, itpp/base/mat.h, tests/mat_test.cpp, tests/mat_test.ref: Remove the deprecated multiplication operator The multiplication operator of a vector times a matrix with only one row was marked as deprecated in the current stable branch (itpp-4-0). Its functionality is identical to the outer_product of two vectors. It is time to remove it from our development branch. ------------------------------------------------------------------------------- 2008-02-21 Adam Piatyszek * IT++ 4.0.3 released (SVN tag: release-4-0-3) * NEWS, VERSION: Release notes added and version number updated for IT++ 4.0.3 * itpp/base/vec.h: Minor documentation fixes to prevent warnings of the Doxygen 2008-02-20 Adam Piatyszek * INSTALL, doc/local/installation.doc, itpp/base/blas.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/config_msvc.h, m4/acx_blas.m4: Removed non-portable "--with-zdotu=complex" method It seems that there is no portable solution for calling from C++ the Fortran functions that returns a complex value. C99 introduces "double _Complex" type, which is compatible with Fortran COMPLEX. But this C99 type is not a valid C++ type. Therefore this patch removes the "complex" method from "--with-zdotu" option. The valid methods are now: - "zdotusub" - use a zdotusub_ Fortran wrapper function - "void" - compatible with BLAS libraries built with g77 compiler - "none" - do not use zdotu_ function at all 2008-02-19 Adam Piatyszek * INSTALL, configure.ac.in, doc/local/installation.doc, itpp/base/blas.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/config_msvc.h, m4/acx_blas.m4: Add "--with-zdotu" option to select zdotu_ calling convention The "--with-zdotu=" option can be used to change the default calling convention of BLAS zdotu_ Fortran function. The BLAS libraries built with g77 compiler do not return the complex result of a function, but pass it via the first argument of the function. The implementations compiled with gfortran and other vendor compilers return complex result as a typical function. By using a "void" method with the "--with-zdotu=" option, the former approach is used (g77 compatible). To use the zdotu_ call that returns the result by value, a "complex" method should be passed. Without setting any of the two methods explicitly, IT++ tries to guess the proper method based on the detected BLAS implementation. Otherwise, a Fortran wrapper function zdotusub_ is used, which requires a working Fortran compiler. Finally, if this is not the case, the zdotu_ BLAS method is not used at all and a relevant warning message is displayed during the configuration step. 2008-02-18 Adam Piatyszek * autogen.sh: Cosmetic improvements Replace back-ticks `...` with POSIX shell syntax $(...). BTW, improve generation of a snapshot version string. * itpp/base/blas.h, itpp/base/vec.cpp, itpp/base/vec.h, itpp/config_msvc.h, m4/acx_blas.m4, m4/ax_func_zdotu.m4: Use zdotusub_ Fortran wrapper by default This patch removes the run-time checks for correct zdotu_ calling conventions, which caused a lot of portability problems in IT++ 4.0.1 and 4.0.2 releases. The preferred method is now to use the locally provided zdotusub_ Fortran wrapper (as in 4.0.0 release). This requires the availability of a Fortran compiler, unless an Intel MKL library is used, in which zdotu_ can be called directly from C++ without any problems. If no Fortran compiler is available and Intel MKL is not used, the zdotu_ function is not called at all. In such case, a relevant warning message is printed during the configuration step. * configure.ac.in, itpp/base/Makefile.am, itpp/base/sources.mk, itpp/base/zdotusub.f, m4/acx_blas.m4: Revert "Removed redundant zdotusub_ Fortran wrapper to zdotu_ function" ------------------------------------------------------------------------------- 2008-02-15 Adam Piatyszek * IT++ 4.0.2 released (SVN tag: release-4-0-2) * NEWS, VERSION: Release notes added and version number updated for IT++ 4.0.2 * ChangeLog-2007: Archive ChangeLog entries from year 2007 2008-02-14 Adam Piatyszek * itpp/base/parser.cpp, tests/parser_test.cpp, tests/parser_test.ref: Fix wrong verbose output of Parser's get() function for int and bool types When Parser was used to scan an already defined int or bool variable and the parsed variable was not found, the verbose output was wrong. Here is a minimum example: Parser p(argc, argv); int i = 5; bool b = true; p.get(a, "a"); p.get(b, "b"); The wrong output of this program was: i = []; b = ; instead of: i = 5; b = 1; This patch fixes this problem and also improves the parser_test program, to detect such issues in future. Thanks to Jia-Yin for reporting this problem. * itpp/comm/convcode.h: Documentation improvements related to encoder state. This patch improves the documentation of the encoding and decoding functions. Especially, it clarifies why set_start_state() and init_encoder() methods have no effect on encode_tail() and encode_tailbite() functions. * itpp/comm/modulator.h: Improve the documentation of Modulator::get_bits2symbols() function 2008-01-31 Adam Piatyszek * itpp/base/gf2mat.cpp: Fix GF2mat_sparse_alist::from_sparse() conversion function The conversion function from GF2mat_sparse format to "alist" text file format could incorrectly create the "mlist" and "nlist" matrices with indexes of non-zero entries. This patch fixes this bug and also improves the conversion speed by using the get_nz_indices() function from Sparse_Vec class and set_row() instead of append_row() where possible. 2008-01-23 Adam Piatyszek * Makefile.am, VERSION, autogen.sh: Optionally append SVN revision to IT++ package version When bootstrapping IT++ sources from SVN or Git repositories append the SVN revision number to the package version string. This feature is triggered by including the additional "svn" keyword in at the end of the first line of the VERSION file. BTW, remove snapshot and snapshot-html top Makefile's targets. 2008-01-18 Adam Piatyszek * tests/poly_test.cpp, tests/poly_test.ref, tests/window_test.cpp, tests/window_test.ref: Change cout format to "fixed" and workaround precision problem on MinGW With this change, we can get rid of round_to_zero() workaround functions preventing precision differences when using MinGW. BTW, limit precision to 6 in poly_test to workaround precision problems when using MinGW/MSYS. * itpp/signal/poly.cpp: Add missing include file required when using MSVC++ Without including itpp/base/math/trig_hyp.h, ::acosh() function is undefined under MSVC++. 2008-01-17 Adam Piatyszek * configure.ac.in, itpp/Makefile.am: Fix improper default shared and static settings Besides, do not add "-no-undefined" libtool switch to global LDFLAGS. Use NO_UNDEFINED substituted variable instead. * itpp/signal/window.cpp, itpp/signal/window.h, tests/window_test.cpp, tests/window_test.ref: Add Dolph-Chebyshev window Add the chebwin() function to evaluate the coefficients of the Dolph-Chebyshev window. Testing routines implemented as well. The tests check the values output by the Dolph-Chebyshev window function for lengths 32 and 33 for 50 dB suppression and for lengths 127 and 128 at 25 dB suppression. Thanks to Kumar Appaiah for providing and improving the patches. This commit closes feature request [1869927]. * itpp/signal/poly.cpp, itpp/signal/poly.h, tests/poly_test.cpp, tests/poly_test.ref: Add cheb() functions - first order Chebyshev polynomial The cheb() functions evaluates a first order Chebyshev polynomial at a specific point (or set of points in a vector/matrix). Also add a simple set of tests for the cheb() functions, and regenerate the reference results to match the new format output in fixed format. Thanks to Kumar Appaiah for providing and improving the initial patches from feature request [1869927]. 2008-01-06 Adam Piatyszek * itpp/base/math/log_exp.h: Fix bug [1863940] in log_add() function for infinite arguments When both arguments of log_add() function were either inf or -inf, the result was NaN instead of +/-inf. This patch fixes this issue. 2008-01-04 Adam Piatyszek * itpp/base/math/misc.h: Add missing itpp namespace description Without this patch, Doxygen 1.5.4 did not generate any documentation for the itpp namespace. 2008-01-01 Adam Piatyszek * License change: GPLv2 -> GPLv3 BTW, update Copyright years to `1995-2008' * configure.ac.in: Add support for building a DLL library on Cygwin When libblas and liblapack are installed from Cygwin repository, it is possible to build IT++ as a DLL library. This requires "-no-undefined" flag to be passed to the linker. itpp-4.3.1/ChangeLog-2009000066400000000000000000000050151216575753400146550ustar00rootroot000000000000002009-12-28 Adam Piatyszek * doc/local/index.doc.in: Update links * AUTHORS, doc/local/authors.doc: Update the list of developers ------------------------------------------------------------------------------- 2009-12-27 Adam Piatyszek * IT++ 4.0.7 release (SVN tag: release-4-0-7) * NEWS, VERSION: Add release notes and update version number for IT++ 4.0.7 release. * configure.ac.in: Do not enable any optimization for the debug build 2009-12-26 Adam Piatyszek * tests/fastica_test.cpp: Suppress a warning message of GCC 4.4 * itpp/base/vec.cpp, itpp/base/vec.h, tests/vec_test.cpp, tests/vec_test.ref: Support equality "==" and inequality "!=" operators for cvec type. This patch fixes bug report #2909998. 2009-12-12 Erik G. Larsson * itpp/comm/llr.h, itpp/comm/turbo.h, itpp/comm/ldpc.h, itpp/comm/modulator_nd.h: Improved documentation on the accuracy of LLR calculations. 2009-10-11 Adam Piatyszek * itpp/base/array.h: Pass by reference, not by value 2009-09-29 Adam Piatyszek * m4/acx_blas.m4: Add support for detecting MKL 10.2 libraries using GCC 2009-08-06 Adam Piatyszek * configure.ac.in, doc/local/documentation.doc, extras/*, itpp-config.1.in, itpp/**/*.cpp, itpp/**/*.h, tests/*.cpp: Copyright dates updated to `1995-2009' 2009-05-12 Erik G. Larsson * doc/local/verification.doc: Added Ubuntu 9.04 to list of tested systems 2009-03-17 Adam Piatyszek * itpp/comm/bch.cpp, tests/bch_test.ref: Change polynomial bit mapping convention in BCH code. Matlab (and the DVB-T standard) use different mapping of the bits to polynomial representation: - Matlab maps highest order first: 1010 <-> i(x)=1*x^3 + 0*x^2 + 1*x^1 + 0*x^0 = x^3 + x - IT++ maps lowest order first: 1010 <-> i(x)= 1*x^0 + 0*x^1 + 1*x^2 + 0*x^3 = x^2 + 1 This is because the GFX class indexes the coefficients according to their powers (i[0] <-> x^0), which is again intuitive. The attached patches changes the IT++ behaviour to the approach used in Matlab, in order to become consistent with the more common way. 2009-01-30 Adam Piatyszek * itpp/base/itfile.h, itpp/base/vec.h: Minor spelling and grammar fixes itpp-4.3.1/ChangeLog-2010000066400000000000000000000310311216575753400146420ustar00rootroot000000000000002010-12-31 Bogdan Cristea * win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_mkl_tests/itpp_mkl_tests.sln: corrected solution files for ACML and MKL for backward compatibility 2010-12-31 Bogdan Cristea * ChangeLog, ChangeLog-2009: separated ChangeLog file into ChangeLog-2009 and ChangeLog (contains only logs from 2010) 2010-12-31 Bogdan Cristea * itpp/base/specmat.cpp, tests/linspace_test.cpp, tests/linspace_test.ref: changed algorithm for linspace_fixed_step so that it works when generating vectors in ascending or descending order 2010-12-04 Bogdan Cristea * itpp/base/specmat.cpp, itpp/base/specmat.h, tests/linspace_test.cpp, tests/linspace_test.ref: linspace_fixed_step() is now a templated function 2010-12-03 Bogdan Cristea * win32/itpp_mkl.sln, win32/itpp_mkl_tests/itpp_mkl_tests.sln, win32/itpp_mkl_tests/linspace_test.vcproj: added tests for Visual Studio C++ with MKL 2010-12-03 Bogdan Cristea * tests/linspace_test.cpp, win32/itpp_acml.sln, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_acml_tests/linspace_test.vcproj: added test support for Visual Studio C++ with ACML 2010-12-03 Bogdan Cristea * itpp/base/specmat.cpp, itpp/base/specmat.h, tests/Makefile.am, tests/linspace_test.ref, tests/linspace_test.cpp: changed linspace() in order to have MATLAB like behavior, added linspace_fixed_step() in order to provide an equivalent for from:step:to from MATLAB 2010-10-28 Bogdan Cristea * itpp/comm/rec_syst_conv_code.cpp, itpp/comm/rec_syst_conv_code.h: data members of the Rec_Syst_Conv_Code class used as internal variables of the MAP algorithm (alpha, beta, gamma and denom) are now declared local to each decode method, thus the allocated heap memory is immediately freed when the MAP algorithm ends 2010-10-12 Bogdan Cristea * NEWS: updated NEWS file 2010-10-12 Bogdan Cristea * tests/fastica_test.cpp, tests/fastica_test.ref: improved fastica test 2010-10-12 Bogdan Cristea * itpp/signal/fastica.cpp, itpp/signal/fastica.h, tests/fastica_test.cpp, tests/fastica_test.ref: Solved bug report: FastICA may run forever with APPROACH_DEFL - ID 3028968 Thanks to Gert Wollny for the patch 2010-09-26 Erik G. Larsson * itpp/base/math/log_exp.h: Fix spelling error in documentation This closes #3075538 2010-09-22 Adam Piatyszek * doc/Makefile.am: Improve installation target for HTML documentation 2010-09-22 Bogdan Cristea * doc/Makefile.am: add support for copying search index which now is found in search folder under html folder 2010-09-22 Bogdan Cristea * doxygen_html.cfg.in: updated doxygen configuration 2010-09-21 Bogdan Cristea * VERSION: add version number for development version after releasing IT++ 4.2.0 ------------------------------------------------------------------------------- 2010-09-21 Bogdan Cristea * IT++ 4.2.0 release (SVN tag: release-4-2-0) * NEWS, VERSION: Add release notes and update version number for IT++ 4.2.0 release. 2010-09-05 Bogdan Cristea * extras/itload.m: corrected case when loading arrays of cvec, bug ID 3035034 2010-08-30 Bogdan Cristea * itpp/base/binfile.cpp, itpp/base/itfile.cpp, itpp/comm/exit.cpp, itpp/comm/exit.h, itpp/comm/siso.h, itpp/comm/siso_dem.cpp, itpp/comm/siso_eq.cpp, itpp/comm/siso_mud.cpp, itpp/comm/siso_nsc.cpp, itpp/comm/siso_rsc.cpp, itpp/comm/stc.h, itpp/srccode/audiofile.cpp: corrected warnings in VS 2010 moved itcompat.h include to cpp files 2010-08-28 Adam Piatyszek * doc/local/linking.doc: Update ToC of the "Linking with IT++..." webpage 2010-08-28 Adam Piatyszek * doc/local/index.doc.in: Remove dead link to NEWCOM web page 2010-04-25 Erik G. Larsson * itpp/comm/exit.h, itpp/comm/siso.h: remove unnecessary include statement 2010-04-19 Bogdan Cristea * itpp/base/array.h: corrected concat(const T &e, const Array &a) definition in order to match its forward declaration 2010-04-05 Bogdan Cristea * doc/tutorial/sccc_bersim_awgn.doc, doc/tutorial/sources.mk, doc/tutorial/src/Makefile.am, doc/tutorial/src/sccc_bersim_awgn.cpp, doc/tutorial/src/turbo_equalizer_bersim_multipath.cpp, doc/tutorial/turbo_equalizer_bersim_multipath.doc, doc/tutorial/tutorial.doc: added tutorials for SCCCs and turbo equalizer 2010-04-04 Bogdan Cristea * doc/tutorial/vector_and_matrix.doc: corrected minor typo: matrices instead of matries 2010-04-04 Bogdan Cristea * doc/tutorial/exit_pccc.doc, doc/tutorial/sources.mk, doc/tutorial/src/Makefile.am, doc/tutorial/src/exit_pccc.cpp, doc/tutorial/tutorial.doc: added tutorial for EXIT chart of PCCCs 2010-04-04 Bogdan Cristea * doc/tutorial/pccc_bersim_awgn.doc, doc/tutorial/sources.mk, doc/tutorial/src/Makefile.am, doc/tutorial/src/pccc_bersim_awgn.cpp, doc/tutorial/tutorial.doc, itpp/comm/siso.h, itpp/comm/siso_rsc.cpp: added tutorial for PCCCs 2010-04-03 Bogdan Cristea * tests/matfunc_test.cpp: changed for compatibility with Visual C++ 2010 2010-03-18 Bogdan Cristea * win32/itpp_acml_tests/exit_test.vcproj, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_acml_tests/siso_test.vcproj, win32/itpp_mkl.vcproj, win32/itpp_mkl_tests/exit_test.vcproj win32/itpp_mkl_tests/itpp_mkl_tests.sln, win32/itpp_mkl_tests/siso_test.vcproj: added Visual Studio projects for ACML and MKL. 2010-03-14 Bogdan Cristea * itpp/comm/siso.h, itpp/comm/siso_rsc.cpp, itpp/comm/siso_nsc.cpp, itpp/comm/siso_mud.cpp, itpp/comm/siso_eq.cpp, itpp/comm/siso_dem.cpp, itpp/comm/exit.h, itpp/comm/exit.cpp, itpp/comm/stc.h, itpp/comm/stc.cpp, tests/exit_test.cpp, tests/siso_test.cpp: added Soft Input Soft Output (SISO) class for turbo receivers design, EXtrinsic Information Transfer (EXIT) class for studying the convergence of turbo receivers and Space-Time Codes (STC) class, implementing space-time codes used in Multiple-Input Multiple-Output (MIMO) systems with turbo receivers implemented by SISO class. Two new tests were added, siso_test.cpp and exit_test.cpp with their corresponding *.ref files. 2010-03-04 Bogdan Cristea * itpp/base/converters.cpp, itpp/base/converters.h: added round_to_infty() function, changed threshold value in round_to_infty() from 1e6 to 1e9 2010-03-03 Bogdan Cristea * itpp/tests/bessel_test.cpp, itpp/tests/newton_search_test.cpp: changed tests files in order to pass tests under Ubuntu. The corresponding *.ref files were also changed. 2010-02-24 Bogdan Cristea * itpp/tests/bessel_test.cpp, itpp/tests/filter_design_test.cpp, itpp/tests/itfile_test.cpp, itpp/tests/newton_search_test.cpp, itpp/tests/pulse_shape_test.cpp: fixed format is used instead of scientific format in order to pass tests checking in Visual C++. As a consequence, the itpp/tests/*.ref files corresponding to the above tests are also changed. * itpp/win32/itpp_acml.vcproj, itpp/win32/itpp_acml_tests/*vcproj, itpp/win32/itpp_mkl.vcproj, itpp/win32/itpp_mkl_tests/*vcproj: added automatic test checking in Visual C++, project files are converted to Visual C++ 2008. The tests checking is implemented for each project as a "Post-Build Event". * itpp/extras/check_tests.bat: added batch file for checking test results in Windows 2010-02-08 Robert Orzechowski * AUTHORS, itpp/comm/galois.h: Fixes bug report #2936395 2010-01-24 Erik G. Larsson * AUTHORS, itpp/comm/ldpc.h, itpp/comm/ldpc.cpp: Improvements to the LDPC decoder. 1) Generalization to handle codes with arbitrary check node degrees. 2) Efficiency improvements for large node degrees. Thanks to Gorka Prieto for this patch. 2010-01-10 Adam Piatyszek * itpp/base/algebra/lapack.h, itpp/base/blas.h: Support latest ACML built with Intel Fortran compiler. It uses uppercase naming conventions for BLAS and LAPACK routines. This is only required on MS Windows (MSVC++). * configure.ac.in, itpp/base/Makefile.am, itpp/base/blas.h, itpp/base/sources.mk, itpp/base/vec.cpp, itpp/base/vec.h, itpp/base/zdotusub.f, m4/acx_blas.m4: Do not use zdotusub.f Fortran function for complex version of dot(). The call of Fortran zdotusub_() caused portability problems, which were difficult to debug and fix on all platforms. * win32/itpp_acml.vcproj, win32/itpp_mkl.vcproj: Update MSVC++ project files to include recently added source files * configure.ac.in, itpp/Makefile.am, itpp/base/binfile.h, itpp/base/itcompat.h, itpp/base/itfile.h, itpp/base/ittypes.h, itpp/base/math/elem_math.cpp, itpp/base/math/elem_math.h, itpp/base/math/error.cpp, itpp/base/math/error.h, itpp/base/math/log_exp.cpp, itpp/base/math/log_exp.h, itpp/base/math/sources.mk, itpp/base/math/trig_hyp.cpp, itpp/base/math/trig_hyp.h, itpp/base/sources.mk, itpp/base/specmat.cpp, itpp/comm/galois.cpp, itpp/comm/modulator_nd.cpp, itpp/fixed/fix_base.h, itpp/itbase.h, itpp/signal/sigfun.cpp: Make itcompat.h a private (non-installable) header file. For the purpose of non-standard integer type definitions, a new header file ittypes.h is introduced. A few inlined functions from the math submodule are moved to newly created source files. * itpp/base/converters.cpp, itpp/base/converters.h: Remove workaround for GCC 3.3 error for a few template instantiations * configure.ac.in, itpp/base/converters.h, itpp/base/help_functions.h, itpp/base/mat.h, itpp/base/matfunc.h, itpp/base/smat.h, itpp/base/svec.h, itpp/base/vec.h, itpp/comm/interleave.h, itpp/comm/pulse_shape.h, itpp/fixed/cfixed.h, itpp/fixed/fixed.h, itpp/signal/filter.h, itpp/signal/transforms.h, m4/ac_cxx_extern_template.m4: Do not check for "extern template" in configure script. Instead, switch this C++ extension for MSVC++ compiler only. * itpp/base/converters.cpp, itpp/base/converters.h: Make converters.h public header file independent of itcompat.h * itpp/base/Makefile.am, itpp/base/sources.mk: Do not install blas.h header file * itpp/base/mat.cpp, itpp/base/mat.h: Move configure dependent implementations to mat.cpp file * itpp/base/copy_vector.cpp, itpp/base/copy_vector.h, itpp/base/sources.mk, itpp/base/vec.cpp: Move configure dependent implementations to copy_vector.cpp file * itpp/base/vec.cpp, itpp/base/vec.h: Move dot() and outer_product() specialisations to vec.cpp * win32/itpp_mkl_tests/*.vcproj: Update MKL libraries in MSVC++ project files for test programs 2010-01-06 Adam Piatyszek * configure.ac.in, itpp/base/itcompat.h, itpp/config_msvc.h: Undefine min, max and log2 macros. If these macros were defined they would collide with our overloaded functions. 2010-01-05 Erik G. Larsson * doc/local/verification.doc: Added Ubuntu 9.10 to list of tested systems 2010-01-05 Adam Piatyszek * AUTHORS, doc/local/authors.doc: Add Bogdan to the list of developers * Makefile.am: Do not install itpp-config.1 man page two times. This resulted in installation errors on Ubuntu 9.10. By the way, add missing files to the distribution package. 2010-01-02 Bogdan Cristea * itpp/base/itcompat.h: Fixes bug report #2924984 2010-01-02 Adam Piatyszek * NEWS: Prepare release notes for the new stable release * NEWS, NEWS-4.0: Move 4.0.x release notes to a separate file * configure.ac.in: Update bugs reporting link * configure.ac.in, itpp-config.1.in, extras/*, itpp/**/*.cpp, itpp/**/*.h, tests/*.cpp: Update copyright dates to `1995-2010'itpp-4.3.1/ChangeLog-2011000066400000000000000000000106121216575753400146450ustar00rootroot000000000000002011-12-25 Bogdan Cristea * doc/tutorial/demapper_mimo.doc, doc/tutorial/sources.mk, doc/tutorial/src/Makefile.am, doc/tutorial/src/demapper_mimo.cpp, itpp/comm/siso.h: added explanations about the overlap in functionality between the SISO class and the Modulator_ND class. Added an usage example for SISO demappers when using ST codes in MIMO channels. 2011-11-25 Bogdan Cristea * itpp/base/vec.h: initialization of local variable in order to close bug ID: 3425833 2011-11-20 Erik G. Larsson * itpp/comm/ldpc.h, itpp/comm/ldpc.cpp: New function for soft syndrome check calculation in the LDPC class 2011-11-20 Erik G. Larsson * itpp/comm/error_counters.h, itpp/comm/error_counters.cpp: Minor feature enhancement in the error counter classes 2011-11-06 Bogdan Cristea * itpp/comm/siso_dem.cpp: corrected Alamouti_maxlogMAP. Thanks to tytusz for pointing this bug 2011-09-15 Erik G. Larsson * itpp/base/gf2mat.cpp: Fixed assertion in GF2mat_sparse_alist::read(). This closes bug report #3408884. Thanks to Laurent Schmalen for providing the patch. 2011-06-02 Erik G. Larsson * itpp/comm/ldpc.h, itpp/comm/ldpc.cpp: Added the possibility to disable integrity checking when initiating an LDPC code. This closes feature request #3309430. Thanks to Laurent Schmalen for providing the patch. 2011-05-19 Erik G. Larsson * itpp/comm/ldpc.cpp: Fixed a bug in the LDPC decoder, that occurs in the special case of a lonely variable node (i.e. a variable node that is connected to only one check node) in the LDPC decoder. The incoming C->V message was missing in the outgoing LLR value. This special case is very rare but apparently occurs for some codes in the DVB-T2 standard. We thank Gorka Agujeta and Daniel Ansorregui for pointing out this error. 2011-05-05 Bogdan Cristea * itpp/comm/convcode.cpp, tests/convcode_test.cpp, tests/convcode_test.ref: fixed bug ID 3297666. Thanks Stephan Ludwig for providing the patch 2011-04-13 Bogdan Cristea * itpp/base/operators.h, tests/Makefile.am, tests/operators_test.cpp, tests/operators_test.ref: corrected bug with ID 3180562 2011-02-27 Bogdan Cristea * itpp/comm/stc.cpp, itpp/comm/stc.h, tests/stc_test.cpp, tests/stc_test.ref: changed STC interface, added error checking using it_assert() 2011-02-21 Bogdan Cristea * itpp/comm/stc.cpp, itpp/comm/stc.h, tests/stc_test.cpp: added more error checking on input parameters 2011-02-20 Bogdan Cristea * tests/stc_test.cpp, win32/itpp_acml_tests/itpp_acml_tests.sln, win32/itpp_mkl.sln, win32/itpp_mkl_tests/itpp_mkl_tests.sln: added tests for Visual Studio projects, corrected minor error in stc_test.cpp 2011-02-20 Bogdan Cristea * itpp/comm/stc.cpp, itpp/comm/stc.h, tests/Makefile.am, tests/stc_test.cpp, tests/stc_test.ref: Corrected error in STC class when generating V-BLAST code. Simplified STC interface. Added test file for STC class. 2011-02-17 Robert Orzechowski * itpp/comm/modulator_nd.h, itpp/comm/modulator_nd.cpp: get_symbols() return symbols without additional 0.0 symbol. * itpp/comm/modulator_nd.h, itpp/comm/modulator_nd.cpp, itpp/comm/modulator.h: added few getters to have similar ND_UQAM class usage as QAM class (both can be used with SISO class since now). 2011-01-09 Robert Orzechowski * itpp/comm/modulator_nd.h, itpp/comm/modulator_nd.cpp: added set_constellation_points method to ND_UQAM modulator class. 2011-01-01 Bogdan Cristea * doc/local/linking.doc, doc/tutorial/pccc_bersim_awgn.doc: added help for pyitpp module 2011-01-01 Bogdan Cristea * extras/Makefile.am, extras/gen_test_itload.cpp, extras/pyitpp.py, extras/test_pyitpp.it, extras/test_pyitpp.py: added pyitpp module providing itload() function for python, similar to MATLAB itload.mitpp-4.3.1/ChangeLog-2012000066400000000000000000000275771216575753400146700ustar00rootroot000000000000002012-12-23 Bogdan Cristea * doc/local/index.doc.in: updated links to IT++ site 2012-12-11 Stephan Ludwig * itpp/comm/reedsolomon.cpp, itpp/comm/reedsolomon.h, tests/reedsolomon_test.cpp, tests/reedsolomon_test.ref: added feature #91: erasure decoding with Reed-Solomon codes and non-narrow-sense RS codes. added unit test cases that checks both features. 2012-12-01 Bogdan Cristea * CMakeLists.txt, extras/check_tests.py, gtests/CMakeLists.txt, gtests/rand_core_test.cpp, itpp/base/random.cpp, itpp/base/random.h, itpp/base/random_dsfmt.h, tests/rand_core_test.cpp, tests/rand_core_test.ref: add thread-safe generation of random numbers using OpenMP (feature #90). Thanks to Andy Panov for providing the patch. 2012-10-30 Erik G. Larsson * doc/tutorial/src/ldpc_gen_codes.cpp: Corrected the degree distribution table in LDPC coding tutorial example 2012-09-12 Bogdan Cristea * cmake/Modules/FindFFT.cmake, cmake/Modules/FindBLAS.cmake, cmake/Modules/CheckFunctionExists.cpp, cmake/Modules/CheckCXXFunctionExists.cmake, cmake/Modules/FindLAPACK.cmake, tests/CMakeLists.txt, doc/doxygen_html.cfg.cmake.in, doc/local/index.doc.in, doc/local/installation.doc, extras/check_tests.py, gtests/bch_test.cpp, gtests/CMakeLists.txt, gtests/array_test.cpp, itpp/protocol/tcp.cpp, itpp/base/binfile.h, itpp/base/vec.cpp, itpp/base/bessel.cpp, itpp/base/bessel/struve.cpp, itpp/config.h.cmake, itpp/CMakeLists.txt, CMakeLists.txt: add generic build system based on cmake, add unit test support using Google framework, corrected compilation errors/warnings when using Visual Studio 2012. Known issues: unit tests are not completely ported to gtest, MKL library detection does not work on Windows with cmake. Old build system and the associated unit tests are still in place, but they will be no longer maintained. 2012-09-12 Mirsad Čirkić * itpp/comm/modulator_nd.h, itpp/comm/modulator_nd.cpp, tests/modulator_nd_test.ref, tests/modulator_nd_test.cpp: Fixed the failing modulator_nd test. So far, this implementation is complete for the NRD demodulator only. Some minor modifications are still needed for the NCD demodulator. 2012-08-30 Bogdan Cristea * README: fixed minor typos (#3538128). Thanks to Kumar Appaiah for providing the patch. 2012-08-19 Bogdan Cristea * tests/modulator_nd_test.ref, tests/modulator_nd_test.cpp, itpp/comm/modulator_nd.cpp, itpp/comm/modulator_nd.h: add faster LLR demod. Thanks to Mirsad Čirkić for providing the patch. Some issues related to unit tests need to be solved. 2012-08-19 Stephan Ludwig * itpp/comm/turbo.cpp, itpp/comm/turbo.h, tests/turbo_test.cpp, tests/turbo_test.ref: fixed an integer overflow error in LTE interleaver, since the product of index i*i gets larger than range(int). added an unit tests case that cross-checks the punctured turbo decode results with all-one puncture matrix (no puncturing) with the turbo_codec. 2012-08-19 Bogdan Cristea * tests/turbo_test.cpp: add unit tests for WCDMA and LTE interleavers * extras/astylerc, extras/astylerc_old: updated astyle configuration file for version 2.02.1. For backward compatibility old settings are kept in astylerc_old (compatible with 1.x releases of astyle). 2012-08-16 Stephan Ludwig * itpp/comm/turbo.cpp, itpp/comm/turbo.h, tests/turbo_test.cpp, tests/turbo_test.ref: adding a punctured turbo codec (PTC) class according to feature request #1151067 had to change turbo codec private variables to protected ones for inheritance in PTC * itpp/comm/turbo.cpp, itpp/comm/turbo.h, tests/turbo_test.cpp, tests/turbo_test.ref: committing feature request 3348928: LTE sequence interleaver with amended test case * itpp/comm/ofdm.h: fixing bug #3512455 with a misleading help in ofdm.h * itpp/comm/bch.cpp, itpp/comm/bch.h, itpp/comm/reedsolomon.cpp, itpp/comm/reedsolomon.h, tests/bch_test.cpp, tests/bch_test.ref, tests/reedsolomon_test.cpp, tests/reedsolomon_test.ref: fixes bug #3471451, see also Forum on topics on - systematic reed-solomon dec. behaves incorrect - bug in reed-solom decoder 2012-03-31 Bogdan Cristea * itpp/base/random_dsfmt.h, itpp/comm/exit.cpp, itpp/comm/exit.h, win32/itpp_acml.vs2005.sln, win32/itpp_acml.vs2005.vcproj, win32/itpp_acml_tests/array_test.vs2005.vcproj, win32/itpp_acml_tests/bch_test.vs2005.vcproj, win32/itpp_acml_tests/bessel_test.vs2005.vcproj, win32/itpp_acml_tests/blas_test.vs2005.vcproj, win32/itpp_acml_tests/channel_test.vs2005.vcproj, win32/itpp_acml_tests/cholesky_test.vs2005.vcproj, win32/itpp_acml_tests/circular_buffer_test.vs2005.vcproj, win32/itpp_acml_tests/commfunc_test.vs2005.vcproj, win32/itpp_acml_tests/convcode_test.vs2005.vcproj, win32/itpp_acml_tests/converters_test.vs2005.vcproj, win32/itpp_acml_tests/demapper_test.vs2005.vcproj, win32/itpp_acml_tests/det_test.vs2005.vcproj, win32/itpp_acml_tests/eigen_test.vs2005.vcproj, win32/itpp_acml_tests/error_count_test.vs2005.vcproj, win32/itpp_acml_tests/exit_test.vs2005.vcproj, win32/itpp_acml_tests/fastica_test.vs2005.vcproj, win32/itpp_acml_tests/fastmath_test.vs2005.vcproj, win32/itpp_acml_tests/filter_design_test.vs2005.vcproj, win32/itpp_acml_tests/filter_test.vs2005.vcproj, win32/itpp_acml_tests/fix_test.vs2005.vcproj, win32/itpp_acml_tests/freq_filt_test.vs2005.vcproj, win32/itpp_acml_tests/galois_test.vs2005.vcproj, win32/itpp_acml_tests/gf2mat_test.vs2005.vcproj, win32/itpp_acml_tests/histogram_test.vs2005.vcproj, win32/itpp_acml_tests/integration_test.vs2005.vcproj, win32/itpp_acml_tests/interleaver_test.vs2005.vcproj, win32/itpp_acml_tests/inv_test.vs2005.vcproj, win32/itpp_acml_tests/itfile_test.vs2005.vcproj, win32/itpp_acml_tests/itpp_acml_tests.vs2005.sln, win32/itpp_acml_tests/ldpc_test.vs2005.vcproj, win32/itpp_acml_tests/linspace_test.vs2005.vcproj, win32/itpp_acml_tests/llr_test.vs2005.vcproj, win32/itpp_acml_tests/ls_solve_test.vs2005.vcproj, win32/itpp_acml_tests/lu_test.vs2005.vcproj, win32/itpp_acml_tests/mat_test.vs2005.vcproj, win32/itpp_acml_tests/matfunc_test.vs2005.vcproj, win32/itpp_acml_tests/modulator_nd_test.vs2005.vcproj, win32/itpp_acml_tests/modulator_test.vs2005.vcproj, win32/itpp_acml_tests/newton_search_test.vs2005.vcproj, win32/itpp_acml_tests/parser_test.vs2005.vcproj, win32/itpp_acml_tests/poly_test.vs2005.vcproj, win32/itpp_acml_tests/pulse_shape_test.vs2005.vcproj, win32/itpp_acml_tests/qr_test.vs2005.vcproj, win32/itpp_acml_tests/rand_test.vs2005.vcproj, win32/itpp_acml_tests/rec_syst_conv_code_test.vs2005.vcproj, win32/itpp_acml_tests/reedsolomon_test.vs2005.vcproj, win32/itpp_acml_tests/schur_test.vs2005.vcproj, win32/itpp_acml_tests/sigfun_test.vs2005.vcproj, win32/itpp_acml_tests/siso_test.vs2005.vcproj, win32/itpp_acml_tests/sort_test.vs2005.vcproj, win32/itpp_acml_tests/source_test.vs2005.vcproj, win32/itpp_acml_tests/sparse_test.vs2005.vcproj, win32/itpp_acml_tests/specmat_test.vs2005.vcproj, win32/itpp_acml_tests/stat_test.vs2005.vcproj, win32/itpp_acml_tests/stc_test.vs2005.vcproj, win32/itpp_acml_tests/svd_test.vs2005.vcproj, win32/itpp_acml_tests/timer_test.vs2005.vcproj, win32/itpp_acml_tests/transforms_test.vs2005.vcproj, win32/itpp_acml_tests/turbo_test.vs2005.vcproj, win32/itpp_acml_tests/vec_test.vs2005.vcproj, win32/itpp_acml_tests/window_test.vs2005.vcproj, win32/itpp_mkl.sln, win32/itpp_mkl.vs2005.sln, win32/itpp_mkl.vs2005.vcproj, win32/itpp_mkl_tests/array_test.vs2005.vcproj, win32/itpp_mkl_tests/bch_test.vs2005.vcproj, win32/itpp_mkl_tests/bessel_test.vs2005.vcproj, win32/itpp_mkl_tests/blas_test.vs2005.vcproj, win32/itpp_mkl_tests/channel_test.vs2005.vcproj, win32/itpp_mkl_tests/cholesky_test.vs2005.vcproj, win32/itpp_mkl_tests/circular_buffer_test.vs2005.vcproj, win32/itpp_mkl_tests/commfunc_test.vs2005.vcproj, win32/itpp_mkl_tests/convcode_test.vs2005.vcproj, win32/itpp_mkl_tests/converters_test.vs2005.vcproj, win32/itpp_mkl_tests/demapper_test.vs2005.vcproj, win32/itpp_mkl_tests/det_test.vs2005.vcproj, win32/itpp_mkl_tests/eigen_test.vs2005.vcproj, win32/itpp_mkl_tests/error_count_test.vs2005.vcproj, win32/itpp_mkl_tests/exit_test.vs2005.vcproj, win32/itpp_mkl_tests/fastica_test.vs2005.vcproj, win32/itpp_mkl_tests/fastmath_test.vs2005.vcproj, win32/itpp_mkl_tests/filter_design_test.vs2005.vcproj, win32/itpp_mkl_tests/filter_test.vs2005.vcproj, win32/itpp_mkl_tests/fix_test.vs2005.vcproj, win32/itpp_mkl_tests/freq_filt_test.vs2005.vcproj, win32/itpp_mkl_tests/galois_test.vs2005.vcproj, win32/itpp_mkl_tests/gf2mat_test.vs2005.vcproj, win32/itpp_mkl_tests/histogram_test.vs2005.vcproj, win32/itpp_mkl_tests/integration_test.vs2005.vcproj, win32/itpp_mkl_tests/interleaver_test.vs2005.vcproj, win32/itpp_mkl_tests/inv_test.vs2005.vcproj, win32/itpp_mkl_tests/itfile_test.vs2005.vcproj, win32/itpp_mkl_tests/itpp_mkl_tests.vs2005.sln, win32/itpp_mkl_tests/ldpc_test.vs2005.vcproj, win32/itpp_mkl_tests/linspace_test.vs2005.vcproj, win32/itpp_mkl_tests/llr_test.vs2005.vcproj, win32/itpp_mkl_tests/ls_solve_test.vs2005.vcproj, win32/itpp_mkl_tests/lu_test.vs2005.vcproj, win32/itpp_mkl_tests/mat_test.vs2005.vcproj, win32/itpp_mkl_tests/matfunc_test.vs2005.vcproj, win32/itpp_mkl_tests/modulator_nd_test.vs2005.vcproj, win32/itpp_mkl_tests/modulator_test.vs2005.vcproj, win32/itpp_mkl_tests/newton_search_test.vs2005.vcproj, win32/itpp_mkl_tests/parser_test.vs2005.vcproj, win32/itpp_mkl_tests/poly_test.vs2005.vcproj, win32/itpp_mkl_tests/pulse_shape_test.vs2005.vcproj, win32/itpp_mkl_tests/qr_test.vs2005.vcproj, win32/itpp_mkl_tests/rand_test.vs2005.vcproj, win32/itpp_mkl_tests/rec_syst_conv_code_test.vs2005.vcproj, win32/itpp_mkl_tests/reedsolomon_test.vs2005.vcproj, win32/itpp_mkl_tests/schur_test.vs2005.vcproj, win32/itpp_mkl_tests/sigfun_test.vs2005.vcproj, win32/itpp_mkl_tests/siso_test.vs2005.vcproj, win32/itpp_mkl_tests/sort_test.vs2005.vcproj, win32/itpp_mkl_tests/source_test.vs2005.vcproj, win32/itpp_mkl_tests/sparse_test.vs2005.vcproj, win32/itpp_mkl_tests/specmat_test.vs2005.vcproj, win32/itpp_mkl_tests/stat_test.vs2005.vcproj, win32/itpp_mkl_tests/stc_test.vs2005.vcproj, win32/itpp_mkl_tests/svd_test.vs2005.vcproj, win32/itpp_mkl_tests/timer_test.vs2005.vcproj, win32/itpp_mkl_tests/transforms_test.vs2005.vcproj, win32/itpp_mkl_tests/turbo_test.vs2005.vcproj, win32/itpp_mkl_tests/vec_test.vs2005.vcproj, win32/itpp_mkl_tests/window_test.vs2005.vcproj: add vs2005 project files for backward compatilityi, corrected some compilation warnings in Visual Studio 2010 2012-03-25 Bogdan Cristea * itpp/base/itassert.h, itpp/base/itfile.cpp, itpp/comm/ldpc.cpp, itpp/signal/sigfun.cpp, itpp/srccode/vqtrain.cpp, tests/parser_test.cpp: corrected compilation warnings with gcc 4.6.2 2012-03-15 Bogdan Cristea * doc/tutorial/src/stbicm.cpp, itpp/comm/siso.h, itpp/comm/siso_dem.cpp: corrected bug in stbicm example, optimization of MIMO demappers 2012-03-14 Bogdan Cristea * doc/tutorial/demapper_mimo.doc, doc/tutorial/src/Makefile.am, doc/tutorial/src/demapper_mimo.cpp, doc/tutorial/src/dump_it_file.cpp, doc/tutorial/src/stbicm.cpp, itpp/comm/siso_dem.cpp, tests/Makefile.am, tests/demapper_test.cpp, tests/demapper_test.ref: corrected bug in MIMO demappers, add example for dumping the content of an itfileitpp-4.3.1/INSTALL000066400000000000000000000223021216575753400135420ustar00rootroot00000000000000IT++ Installation ***************** IT++ Requirements ================= IT++ should compile without errors or warnings on most GNU/Linux, BSD and UNIX systems, and on POSIX based environments for Microsoft Windows like Cygwin or MinGW with MSYS. It can be also built on Microsoft Windows NT/2000/ XP/Vista/7/8 using Microsoft's Visual C++ (or Express). For GNU/Linux, FreeBSD, Solaris SunOS, Cygwin and MinGW we assume that you have at least the following GNU software installed on your computer: o GNU make, version 3.77 or later (check version with `make --version' or `gmake --version`) o GCC - GNU Compilers Collection including C (gcc) and C++ (g++) compilers, version 3.3.x or later (check version with `gcc --version') In most cases, a Fortran compiler is also required for proper linking of IT++ with external BLAS and LAPACK libraries. GCC provides g77 (versions 3.x.x) or gfortran (versions 4.x.x) compilers. We strongly recommend that you use recent stable releases of the GCC, if possible. We do not actively work on supporting older versions of the GCC, and they may therefore (without prior notice) become unsupported in future releases of IT++. Instead of using GCC, you might try to build and link the IT++ library using other C/C++/Fortran compilers. For instance, Intel C++ (icpc) and Fortran (ifc) compilers are known to work well. To perform tests you need Google C++ Testing Framework sources (https://code.google.com/p/googletest/). Optionally, you might need a few additional programs, i.e. Doxygen, LaTeX, Dvips and Ghostscript, to generate the HTML documentation. The HTML documentation for each release is also available as separate packages for download, so you do not need to generate it during the installation. In order to use all functionality provided by the IT++ library, it is recommended that you have some external libraries compiled and installed in your computer. The basic set of them is: BLAS, LAPACK and FFTW (version 3.0.0 or later). Instead of NetLib's reference BLAS and LAPACK implementations, some optimized platform-specific libraries can be used as well, i.e.: o ATLAS (Automatically Tuned Linear Algebra Software) - includes optimised BLAS and a limited set of LAPACK routines (version 3.6.0 or later) o MKL (Intel Math Kernel Library) - includes all required BLAS, LAPACK and FFT routines (version 8.1.1 or later; FFTW not required) o ACML (AMD Core Math Library) - includes BLAS, LAPACK and FFT routines (version 2.5.3 or later; FFTW not required) Except the Intel MKL, the above mentioned BLAS/LAPACK implementations require additional support libraries provided by a Fortran compiler. To use them with IT++, please make sure that you have the compatible Fortran compiler installed. For instance, if your system BLAS and LAPACK libraries were compiled and linked with GNU g77, you should have the same compiler installed on your system before starting the IT++ configuration process. It is possible to compile and use IT++ without these external libraries, but the functionality will be reduced. Therefore, we recommend that you take some time and effort to provide these external libraries in your system. Please note that the basic set of them (FFTW, BLAS and LAPACK) is usually included in most modern Linux distributions. Obtaining the IT++ Source Codes =============================== IT++ is released under the terms of the GNU General Public License (GPL) and hence the source code of the IT++ library is available for free download. To obtain the IT++ source code, visit the project pages on SourceForge: o http://sourceforge.net/projects/itpp/ and download the file named itpp-.tar.gz or itpp-.tar.bz2, where is the latest release number, e.g. 4.3.0. IT++ Configuration and Installation Instructions ================================================ Assuming that you have already downloaded the latest IT++ sources, untar and unpack the sources, and enter the unpacked directory. Depending on the package type you have downloaded, use the following commands: % gzip -cd itpp-.tar.gz | tar xf - % cd itpp- % bzip2 -cd itpp-.tar.bz2 | tar xf - % cd itpp- Since version 4.3.0, the IT++ library uses cmake compilation system for preparing Makefiles, so the compilation procedure is as follows: % mkdir build && cd build % cmake .. The `cmake' command can be invoked with additional switches and options (see cmake help for a full list of them). The most important are: o `-DITPP_SHARED_LIB=off', allows to compile the static version of IT++ library. By default this option is set to `on'. o `-DBLA_VENDOR=vendor', where vendor can be `ACML', `Intel11' or `ATLAS'. This is helpful in selecting a specific external library (ACML or MKL 11). If these libraries are installed in nonstandard locations, on Linux, set `LD_LIBRARY_PATH' environment variable to the location where the libraries are installed. For Windows `PATH' environment variable should be set, while Mac OS X users should use `DYLD_LIBRARY_PATH'. o `-DGTEST_DIR=/path/to/gtest/sources' is used to specify the path to Google unit test framework (gtest) sources. Thus the unit tests are compiled and can be run separately to check IT++ library. o `-DOLD_TESTS=on' is used to activate the compilation of older unit tests (no unit test framework required). By default this option is set to `off'. These tests are no longer maintained, so it is recommended to use the tests based on Google framework. In order to run these tests use `check_tests.py' script found in extras folder (Python is required). o `-DHTML_DOCS=off' allows to disable the generation of HTML documentation. Default option is `on' provided that Doxygen is found. o `-DCMAKE_BUILD_TYPE=Release' allows to specify the build type: Release (default) or Debug. The library name in Debug mode is itpp_debug.*, so that both Release and Debug versions could exist in the installation folder. o `-DCMAKE_INSTALL_PREFIX=/install/path' allows to specify the installation path. This is used when installing IT++, either from command line, with 'make install', either using the INSTALL project from Visual Studio. Note that the user should have write permissions to the installation folder. External Libraries ------------------ By default, cmake checks for a few external libraries, which might be used by the IT++ library (cf. IT++ Requirements). The detection procedure is as follows: 1. First, the presence of a BLAS library among MKL, ACML, ATLAS and NetLib's reference BLAS is checked. If one of the above mentioned can be used, HAVE_BLAS is defined. 2. Next, some LAPACK library is being searched, but only if BLAS is available. Full set of LAPACK routines can be found in the MKL, ACML and NetLib's reference LAPACK libraries. Besides, ATLAS contains a subset of optimised LAPACK routines, which can be used with NetLib's LAPACK library (this is described in the ATLAS documentation). If some LAPACK library can be found, HAVE_LAPACK is defined. 3. Finally, a set of separate checks for FFT libraries is executed. Currently three different libraries providing FFT/IFFT routines can be used: MKL, ACML and FFTW. If at least one of them is found, HAVE_FFT id defined. Besides, one of the following: HAVE_FFT_MKL, HAVE_FFT_ACML or HAVE_FFTW3 is defined, respectively. If some external libraries are installed in a non-standard location in your system, e.g. MKL in `/opt/intel/mkl/9.1', cmake will not detect them automatically. In such a case, you should use LD_LIBRARY_PATH environment variable to define additional directories to be searched for libraries and headers. For instance, to configure IT++ to link to 32-bit version of MKL 11.0 external libraries, you should use the following commands: % export LD_LIBRARY_PATH=/opt/intel/composer_xe_2013.2.146/mkl/lib/intel64/ % cmake .. -DBLA_VENDOR=Intel11 Compilation ----------- Now, it is time for compiling and linking the IT++ library. To do so, please simply run the following command: % make IT++ should compile without any errors or warnings. If this is not the case, please report the problem on the IT++ Help forum at SourceForge. Please include information about your OS, compiler version, external libraries and their versions, etc. Testing the Compiled Library ---------------------------- It is recommended that you check if your library has been compiled and linked properly and works as expected. To do so, you need to specify the path to the Google C++ Test Framework sources as: % cmake .. -DGTEST_DIR=/path/to/gtest % make % gtests/itpp_gtests As a result, you should obtain a report with test results. If not all tests passed please report the problem on the IT++ Help forum. Installation ------------ Finally, you should install the compiled and linked library, include files and HTML documentation (optionally) by typing: % make install Depending on the CMAKE_INSTALL_PREFIX settings during configuration, you might need the root (administrator) access to perform this step. Eventually, you might invoke the following command % make clean to remove all files created during compilation process. Alternatively you could remove build folder: % cd .. % rm -rf build itpp-4.3.1/Makefile.am000066400000000000000000000014331216575753400145470ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-bzip2 if HTML_DOC HTML_DOC_DIR = doc endif if RUN_TESTS TEST_DIR = tests endif SUBDIRS = itpp extras win32 $(HTML_DOC_DIR) $(TEST_DIR) EXTRA_DIST = \ autogen.sh \ ChangeLog-2005 \ ChangeLog-2006 \ ChangeLog-2007 \ ChangeLog-2008 \ configure.ac.in \ itpp-config.1.in \ itpp.spec \ itpp.spec.in \ Makefile.common \ NEWS-3.10 \ NEWS-3.9 \ NEWS-3.99 \ NEWS-4.0 \ TODO \ VERSION dist_man_MANS = itpp-config.1 bin_SCRIPTS = itpp-config pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = itpp.pc if ENABLE_DEBUG pkgconfig_DATA += itpp_debug.pc endif clean-local: rm -f config_summary.log uninstall-local: rm -rf $(DESTDIR)$(includedir)/itpp dist-html: $(MAKE) -C doc dist-html itpp-4.3.1/Makefile.common000066400000000000000000000000731216575753400154410ustar00rootroot00000000000000@SET_MAKE@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) itpp-4.3.1/Makefile.in000066400000000000000000001002101216575753400145510ustar00rootroot00000000000000# Makefile.in generated by automake 1.12.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/itpp-config.in $(srcdir)/itpp.pc.in \ $(srcdir)/itpp_debug.pc.in $(top_srcdir)/Makefile.common \ $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/install-sh \ $(top_srcdir)/build-aux/ltmain.sh \ $(top_srcdir)/build-aux/missing $(top_srcdir)/configure \ AUTHORS COPYING ChangeLog INSTALL NEWS build-aux/config.guess \ build-aux/config.sub build-aux/depcomp build-aux/install-sh \ build-aux/ltmain.sh build-aux/missing @ENABLE_DEBUG_TRUE@am__append_1 = itpp_debug.pc subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = itpp.pc itpp_debug.pc itpp-config CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ cscope distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = itpp extras win32 doc tests DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best DIST_TARGETS = dist-bzip2 dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-bzip2 @HTML_DOC_TRUE@HTML_DOC_DIR = doc @RUN_TESTS_TRUE@TEST_DIR = tests SUBDIRS = itpp extras win32 $(HTML_DOC_DIR) $(TEST_DIR) EXTRA_DIST = \ autogen.sh \ ChangeLog-2005 \ ChangeLog-2006 \ ChangeLog-2007 \ ChangeLog-2008 \ configure.ac.in \ itpp-config.1.in \ itpp.spec \ itpp.spec.in \ Makefile.common \ NEWS-3.10 \ NEWS-3.9 \ NEWS-3.99 \ NEWS-4.0 \ TODO \ VERSION dist_man_MANS = itpp-config.1 bin_SCRIPTS = itpp-config pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = itpp.pc $(am__append_1) all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.common: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): itpp.pc: $(top_builddir)/config.status $(srcdir)/itpp.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ itpp_debug.pc: $(top_builddir)/config.status $(srcdir)/itpp_debug.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ itpp-config: $(top_builddir)/config.status $(srcdir)/itpp-config.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done cscopelist-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist-recursive cscopelist cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically 'make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-man install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binSCRIPTS uninstall-local uninstall-man \ uninstall-pkgconfigDATA uninstall-man: uninstall-man1 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ cscopelist-recursive ctags-recursive install-am install-strip \ tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-cscope \ clean-generic clean-libtool clean-local cscope cscopelist \ cscopelist-recursive ctags ctags-recursive dist dist-all \ dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-binSCRIPTS uninstall-local uninstall-man \ uninstall-man1 uninstall-pkgconfigDATA @SET_MAKE@ clean-local: rm -f config_summary.log uninstall-local: rm -rf $(DESTDIR)$(includedir)/itpp dist-html: $(MAKE) -C doc dist-html # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/NEWS000066400000000000000000000032461216575753400132160ustar00rootroot00000000000000=============================================================================== IT++ version 4.3.0 Released: 2013-05-25 ------------------------------------------------------------------------------- IT++ 4.3.0 is the next release based on the IT++ stable master branch from git repository. A list of new features and modifications is presented below: New features: ------------- * The compilation system is replaced with cmake. Thus compilation and installation on supported OSs (Linux, Windows, MacOS) is handled in an unified way. * IT++ library can be compiled as shared library on Windows. This removes an important limitation of previous releases. * Added unit testing support based on Google C++ Testing Framework * Added multilateration class for indoor localization * Added numerical integration with function objects as integrands * Added thread-safe Fourier and cosine transforms * Added thread-safe generation of random numbers * Added faster LLR demodulator * Added non-narrow-sense Reed-Solomon and Erasure Decoding * Added lte_turbo_interleaver_sequence * Added pyitpp module providing itload() function for Python, similar to MATLAB itload.m * Added punctured turbo codec (PTC) class Modifications: -------------- * fixed errors in Read Solomon and BCH decoders * fixed FastICA accesses unallocated memory/ bails out if whitenig * fixed help for OFDM class * extras/astylerc is now compatible with astyle 2.02.1 * fixed systematic Reed-Solomon decoding * fixed convolutional Decoder for certain generators * added operator +- between scalar and complex * fixed bug in FastICA with APPROACH_DEFL * added new linspace function itpp-4.3.1/NEWS-3.10000066400000000000000000000514231216575753400135750ustar00rootroot00000000000000=============================================================================== IT++ version 3.10.12 Released: 2007-07-12 ------------------------------------------------------------------------------- This bug-fix release is intended to be the final release of 3.10.x stable branch. The current development branch 3.99.x will soon become a new stable branch, starting from version 4.0.0. Therefore, we recommend to start using 3.99.x releases instead of 3.10.x ones. As usual, this release includes only bug-fixes and minor modifications that do not change the interface. Modifications: -------------- * Improvements in MKL detection macros: MKL release 9.1.018 has different naming of a lapack shared library (-lmkl_lapack32 and -lmkl_lapack64 replaced with -lmkl_lapack). * Not setting "-fno-exceptions" flag in CXXFLAGS and CXXFLAGS_DEBUG, even if "--disable-exceptions" switch is used. Bug-fixes: ---------- * Fixed bug [1752576] in operators "+=" and "-=", which gave wrong results when adding or substracting a vector from itself. * Fixed bug [1739500] in hadamard() function. The initial recursion for creating Hadamard matrices has to start with a 1x1 matrix H = [1], not with a 2x2 matrix. * Fixed bug [1739267] in binom() and binom_i() functions, which gave wrong results for n=k. * Fixed bug [1738716] by correcting the MSVC++ project files to include proper source and header files * Fixed bug [1730610] by using binary mode when opening *.pnm and *.pgm image files for reading (Source coding module) =============================================================================== IT++ version 3.10.11 Released: 2007-06-02 ------------------------------------------------------------------------------- This is the next bug-fix release of the stable IT++ library. As usually, no new features have been added since our previous release 3.10.10. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Fixed bug [1727923]. Actually the behaviour of the function is not changed at all. Instead, the documentation is improved to clearly describe what this method does. * Fixed bug [1724746], i.e. a problem with modified input data in ifft_real() function. * Fixed a minor problem in the schur_test program, which caused failed test when linking IT++ with some LAPACK implementations * Fixed linking errors when trying to use Hadamard and Walsh-Hadamard transform functions. This fixes bug [1719146]. * Fixed bug [1703731] by implementing the missing double2mxArray() and double_complex2mxArray() functions * Added missing #include and header files. This fixes problems when building using GCC 4.3 snapshot. =============================================================================== IT++ version 3.10.10 Released: 2007-04-10 ------------------------------------------------------------------------------- This is the next bug-fix release of the stable IT++ library. Therefore, no new features have been added since 3.10.9 was released. Only minor modifications and bug-fixes have been done. Modifications: -------------- * Test programs are linked to the optimised library by default. * A separate MSVC++ project file created to simplify linking the IT++ library with ACML (PGI build) under Windows. Documentation updated accordingly. * Speed and portability improvements in the configuration scripts backported from the development branch. Bug-fixes: ---------- * Fixed bug [1693384] in it_file low_level_write(std::string) method caused by a missing explicit cast of string size to 32-bit int. Only 64-bit architectures were affected by this bug. * CPU_Timer and Real_Timer tests are now independent of each other. This should solve possible test failures in specific cases (e.g. high CPU load). =============================================================================== IT++ version 3.10.9 Released: 2007-02-10 ------------------------------------------------------------------------------- This is the next bug-fix release of the stable IT++ library. Therefore, no new features have been added since 3.10.8 was released. Only minor modifications and bug-fixes have been done. Modifications: -------------- * Added test file for a binary it_file format. It is supposed to assert wrong endianness detection on various platforms. * Added a manual page for itpp-config script * Improved portability by adding support for system header, available at least on Linux systems. Bug-fixes: ---------- * Fixed bug [1635988] by implementing the twist() function in a similar way as the original TWIST() macro from Takuji Nishimura's and Makoto Matsumoto's C sources. * Fixed wrong assertion check in QAM modulator set_M() function. This problem was reported on the Help forum. * Protected inheritance of the Convolutional_Code class replaced with a public one. This fixes the problem of assigning the Punctured_Convolutional_Code class object to a pointer of Channel_Code class. * Added missing architecture checks, which should fix bugs [1641691] and [1640347]. * Minor fixes to prevent "unused variable" warnings when ASSERT_LEVEL flag is not defined. * Fixed non-portable parts of the Makefile reported by the latest stable automake 1.10 =============================================================================== IT++ version 3.10.8 Released: 2007-01-14 ------------------------------------------------------------------------------- This is the next bug-fix release of a stable IT++ library. Therefore, no new features have been added since 3.10.7 release. Only minor modifications and bug-fixes have been done. Modifications: -------------- * Implemented feature request [1216416]. Multiply operator `*' of a vector `v' and single-row matrix `m' now works for any size of vector `v'. This change is backward compatible with the previous implementation. * Cleaned up the exception handling in the PNM class and added GCC specific "-fno-exceptions" flag to CXXFLAGS_OPT and CXXFLAGS_DEBUG when "--enable-exceptions" is not used. Bug-fixes: ---------- * Updated Mersenne Twister random number generator sources to the latest version 1.0 published by Richard J. Wagner on 15th May, 2003. * Fixed a problem with discretization of the TDL_Channel delay profile in the case when the sampling frequency is too low, as compared to the delay profile resolution. * A few other minor fixes. For a full list of them, please check the ChangeLog file. =============================================================================== IT++ version 3.10.7 Released: 2006-12-04 ------------------------------------------------------------------------------- This is the next bug-fix release of a stable IT++ library. Therefore, no new features have been added since 3.10.6 release. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Fixed a problem with detection of the ACML library on 64-bit platforms. * Minor code readability and efficiency improvements in modulator_nd.cpp file. * Fixed bug [1570388] by adding a warning message to `get_no_mixtures()' function saying that it is deprecated and that `get_no_gaussians()' should be used instead. * Function `needed_bits()' marked as deprecated, because its name was misleading (see bug [1480535]). The following two functions were added instead: `int2bits()' and `levels2bits()'. The first one returns the number of bits required for representing an unsigned integer, e.g. "int2bits(0) = 1", "int2bits(2) = 2". The latter one returns the number of bits to code a certain, positive number of values (levels). For example: "levels2bits(1) = 1", "levels2bits(2) = 1". * Fixed auto-detected library flags, which are required for linking with a static IT++ library. =============================================================================== IT++ version 3.10.6 Released: 2006-10-15 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.10.5. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Fixed bug [1576333]. The problem with undefined non-weak symbols has been solved according to the solution from Section 7.3.5 "Libtool Convenience Libraries" of automake manual. Thanks to Ed Hill for reporting this bug and his work on RPM package for Fedora Core. * Fixed an error in ND_UQAM class. * Changed the definition of LLRs from log(P(b=1)/P(b=0)) to log(P(b=0)/P(b=1)) in the LLR and Modulator_ND classes. This was done to conform to the conventions in the scalar modulator class. * Fixed bug [1572807]. Modulator_2d can not be initialised with non-even number of symbols. Therefore, additional checks have been added to the set() function. Thanks to George Jongren for reporting this bug. * Added a check for undersampled PDP in Channel_Specification::discretize() function. Non default Doppler spectrum can not be used when sampling frequency is too low. * Fixed bug [1545798]. Sparse vectors are now correctly compared using `==' operator. Thanks to Timo for reporting this bug. * Fixed bug [1542064]. The problem was that the index in the tap_doppler_spectrum array in the TDL_Channel::init() function could go out of bounds, if the TDL_Channel class was used with two different channel profile lengths. Thanks to Jordy Potman for reporting this bug and providing a patch with a solution. * Fixed bug [1542482]. Now binom_i(n, k) works properly and gives the same results as binom(n, k). =============================================================================== IT++ version 3.10.5 Released: 2006-08-15 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.10.4. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Documentation improvements in modulator_nd.{cpp,h}, llr.{cpp,h} and verification.doc. * Replaced deprecated hypot(x, y) function with std::sqrt(x*x + y*y) calculation. BTW, macro definition `M_2PI' replaced with a global constant `m_2pi'. This prevents compilation warnings under MSVC++ .NET compiler. * Fixed bug [1538210], caused by an uninitialised variable `m2' used for covariance calculation. Thanks to Max Moorkamp for reporting this bug. * Fixed bugs [1088420] and [1456235]. The problems reported in these bug reports were caused by calculation of the log() or exp() function using `Inf', `NaN' or `zero' argument, which came from previous calculation. Two special functions `trunc_log()' and `trunc_exp()' have been implemented, which performs some checks of their argument and eventually truncate or saturate the result. This fixes all problems in MAP-decode function of the RSC decoder and soft demodulate functions in various modulators. * Fixed a problem in Parser initialisation caused by passing a C-style string as the argument of init(std::string) function. =============================================================================== IT++ version 3.10.4 Released: 2006-08-07 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.10.3. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * A set of changes in the MSVC++ .NET project file, which is now located in a separate `win32' subdirectory. Now IT++ should compile and link without any warnings under MSVC++ compiler. Installation manual updated accordingly. * Fixed a minor bug in the RSC code test program. The generator polynomials were initialised with a string using octal notation, which is not supported by Vec<> parser yet. * Added explicit check for a fortran compiler. If not found, BLAS, CBLAS and LAPACK are not checked. * Fixed a bug that caused unresolved erfc() function under MSVC++ .NET compiler. The function definition is now outside namespace itpp. * Fixed a minor problem with overloaded virtual function open() (itfile.h). * Conversion from integer to std::string implemented in pure C++ by using std::stringstream class (itassert.cpp). * Fixed a minor problem with duplicated declaration of tgamma(), lgamma() and cbrt() functions. =============================================================================== IT++ version 3.10.3 Released: 2006-07-11 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.10.2. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Fixed bug [1516976] by setting the threshold of round_to_zero() function to 1e-13. Thanks to Rosario for reporting this bug. * Fixed bug [1506524]. The `K' variable is now initialised in the Convolutional_Code default constructor. Thanks to Hakan Eriksson for finding this bug. * Fixed a small problem with possible hazard in timing test. =============================================================================== IT++ version 3.10.2 Released: 2006-05-15 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.10.1. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Fixed gettimeofday() function definition for Windows based platforms (MinGW, MSVC++). No need for MINGW definition any more. * Added checks for `acosh', `asinh', `atanh', `lgamma' and `tgamma' functions, and `signgam' declaration. This solves problems on some platforms where these declaration and/or functions are not available. * Fixed a problem with different line endings on Windows based platforms. Now, sed program is necessary for performing tests. * Fixed bug [1483125]. Now a complex dot product is properly returned by a `dot' function when using ACML blas libraries. Thanks to Danilo Zanatta for reporting this bug. * Fixed bug [1480535]. Now needed_bits() returns a proper number of bits required to represent integer `n', e.g. "needed_bits(0) = 1", "needed_bits(7) = 3", "needed_bits(8) = 4". * Fixed a small bug related to missing #include statement and cleaned up the code of `itpp/itmex.h'. * Fixed a bug in the `==' operator in `itpp/base/svec.h'. Thanks to Mattias Andersson for discovering the bug. * Fixed bug [1469860]. Now fir1() declaration matches its definition. Thanks to Jordy Potman for reporting this bug. * A few other minor bug-fixes. For a full list of them, please check the ChangeLog file. =============================================================================== IT++ version 3.10.1 Released: 2006-04-11 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.10.0. Only minor modifications and bug-fixes have been done. Bug-fixes: ---------- * Fixed a bug caused by improper wrapping of backslash functions using it_assert1() macro. * Fixed bug [1468011], so AR_Filter now works when using a single coefficient value, e.g. a = "0.5". * Fixed improper behaviour of the encode_trunc() and decode_trunc() functions. Now, each execution of these functions does not reset the encoder and decoder states, so it can be used to perform continous decoding process. An additional reset() function has been added to reset the encoder and decoder states. * Fixed lgamma() and gamma() functions definitions for MSVC++ .NET. * Fixed a problem with a few Bessel functions provided by under MSVC++ .NET (different naming conventions). * Fixed CBLAS interface when using ACML's BLAS implementation. * Fixes in configuration scripts due to linking problems uder Cygwin. * A few other minor bug-fixes. For a full list of them, please check the ChangeLog file. =============================================================================== IT++ version 3.10.0 Released: 2006-03-15 ------------------------------------------------------------------------------- This is a final release of the IT++ version 3.10.0. Here is a brief summary of the new features, modifications and bug fixes since IT++ version 3.9.1 was released: New features: ------------- * Documentation improvements: - added a list of features of IT++ - added first draft of how a Matlab/IT++ conversion table can look like; more to be added later - verification pages redesigned to include more information * First version of the vector/MIMO modulator class added. * Added support for creating RPM packages using the itpp.spec file. * Added Newton search optimization routines (BFGS algorithm and line-search). For matlab compatibility the fminunc() is implemented. * Added IDCT implementation based on Intel MKL library. * Added support for AMD Core Math Library (ACML): FFT/IFFT and DCT/IDCT. * New Log-Likelihood Ratio (LLR) algebra class added. * The turbo decoders can use table-lookup based computation of Jacobian logarithm (set metric to "TABLE") * New blackman() windowing function added. * Added log() funtion for complex vectors and matrices. * New modified_yulewalker(), arma_estimator() and yulewalk() filter design functions added. * New polyval() functions for vec and cvec input combinations added. * Implemented sqrtm() function that calculates the matrix square root for real and complex matrices. Based on Octave implementation. * Implemented Schur decomposition functions for real and complex matrices using LAPACK's DGEES and ZGEES routines. Modifications: -------------- * Changes in the configuration process. It is now possible to build and install two separate libraries: an optimised `libitpp.*' and debug `libitpp_debug.*'. The latter one is only build when `--enable-debug' switch is used during configuration. * Removed `--with-march' GCC-specific optimisation switch. CXXFLAGS should be used instead. * Removed limits_test, which was only useful on 32-bit platforms. * Updated tutorial example programs and their description. Removed unnecessary reference files for the tutorial programs. * Matlab/Octave itload.m and itsave.m scripts are now installed in $PREFIX/share/doc. * Major redesign of the configuration scripts. The following things changed: - checks for BLAS now detect MKL, ACML, ATLAS and reference (NetLib's) BLAS implementations; if found, HAVE_BLAS is defined - checks for LAPACK also detect MKL, ACML, ATLAS and reference LAPACK library; if found, HAVE_LAPACK is defined - checks for CBLAS detect MKL, ATLAS and reference implementation, however CBLAS is fully optional; if found, HAVE_CBLAS is defined - new checks for FFT: detects MKL or FFTW3 implementation; if found, HAVE_FFT and either HAVE_FFTW3 or HAVE_FFT_MKL8 are defined - new checks for and header files provided by external libraries; not using any more. It is now possible to mix various implementation of BLAS, LAPACK and FFT routines, e.g.: - use MKL's BLAS, reference NetLib's LAPACK and FFTW3, - use ACML for BLAS and LAPACK, reference NetLib's CBLAS and FFTW3. * Statistical norm() functions revised - from now the implementation is similar to the one in Octave, i.e. both vector- and matrix-based functions accept "fro" argument to choose the Frobenius norm. * Project files for MS Visual C++ .NET 2003/2005 updated and added. * Windowing function moved from specmat.{h,cpp} to new files window.{h,cpp}. Documentation improved by the way. * Added zero-padding for fft_real() and ifft_real() functions. Bug-fixes: --------- * Fixed a bug in cblas library detection when using BLAS and CBLAS from IT++ External package on Cygwin. * Fixed a bug in Makefile.common that caused that an improper header file was used during compilation. * Small fix in the automatic MKL's LAPACK library detection. Now using shared libraries `-lmkl_lapack32' and `-lmkl_lapack64' instead of a static one by default. * Small fix that solves MSVC++ .NET compilation problem (#include ) * Fixed bug [1418707] by adding the FFTW_UNALIGNED option to the plan creation flags, which allows a standard memory allocation of input and output data. This temporary solution reduces performance on processors that use SSE and SSE2 instructions. * A lot of other minor bug-fixes. For a full list of them, please check the ChangeLog file. itpp-4.3.1/NEWS-3.9000066400000000000000000000115111216575753400135170ustar00rootroot00000000000000=============================================================================== IT++ version 3.9.1 Released: 2006-01-28 ------------------------------------------------------------------------------- This is a bug-fix release. Therefore, no new features have been added since release 3.9.0. Only minor modifications and bug-fixes have been done. Bug-fixes: --------- * Fixed a few test programs that use LAPACK, so now they are robust to non-unique results and floating-point precision differences on different platforms. * Protocol sources are now included in the MSVC++ project file. * Fixed bug [1412383]. The dec2bin() functions appended en extra zero in front of the bit vector. This wrong behaviour has been fixed. * Fixed bug [1399822]. The problem was caused by explicit specialisation of some templated operators, when HAVE_CBLAS or HAVE_MKL are defined. In such a case, the following forward declarations of explicit instantiations (with extern) of these operators should be switched off. * Fixed bug [1396020]. Now itsave() works properly in both Matlab and Octave. Thanks to Jordy Potman for providing a patch. * A lot of other minor bug-fixes. For a full list of them, please check the ChangeLog file. =============================================================================== IT++ version 3.9.0 Released: 2005-12-28 ------------------------------------------------------------------------------- New features: ------------- * Completely new configuration, compilation and installation approach based on the GNU Autotools: Autoconf, Automake and Libtool. External libraries (FFTW, CBLAS and LAPACK) installed system-wide are detected by the configure script. * Instead of `itpp-config' script, the `pkg-config' (http://pkgconfig.freedesktop.org/wiki/) tool can be used for linking with the IT++ library. * Implementation of `erf(z)' function for complex argument `z' added. * New statistical functions `within_tolerance(x, xref, tol)' added. * New GF2 matrix class added, which is designed for a memory efficient representation of binary matrices. * Polynomials support and filter design functions added. * Added real Toeplitz matrices using the function toeplitz(mat, mat). Generalized also to be valid for non-square matrices. Modifications: -------------- * Removed support for libharu PDF generation library. External tools can be used instead, for instance: - Gnuplot - http://www.gnuplot.info/ - Mathplotlib - http://matplotlib.sourceforge.net/ - Asymptote - http://asymptote.sourceforge.net/ * Documentation is now provided in HTML format only. It is generated and installed automatically if the following tools are available: Doxygen, LaTeX, Dvips and Ghostscript. * BLERC class improved by adding setup and clear flags and non default constructor. Now it is possible to measure BLER for changing block sizes, e.g. in an adaptive transmission. * diag() function now takes a second argument stating which diagonal to fill with values (Matlab compatible). * Implemented feature request [1167378]. An error message is displayed if the Parser's init() functions can not open a file. Bug-fixes: --------- * Fixed bug [1388024]. `fft_real()' and `ifft_real()' functions now work correctly for both external libraries: FFTW3 and MKL. They are also compatible to Matlab's implementation. * Fixed test programs failures due to minor precision differences on different platforms. * Fixed bug [1333897]. The problem with infinite loop in `it_file::seek(...)' function has been solved by fixing `it_file::write_data_header(...)' function. * Fixed bug [1358858]. Now it is possible to use decode_tailbite() method for a punctured code. * Fixed bug [1358861]. Now the destructor properly deletes the fading generators dynamically created. * Fixed bug [1302350]. Corrected behavior of operator<< in `itpp/itconfig.h' when the imaginary part equals "minus zero". * Fixed a bug in the oversampling of the OFDM class. * Fixed bug [1254814]. Added `itpp::' explicit scope for `it_assert_f', `it_warning_f' and `it_error_f' functions. Now the macros that use them work properly without `using namespace itpp' in the application file. * Fixed reopened bug [1094934]. Now endianity of x86_64 platforms can be successfully detected. * Fixed bug [1251878]. `min' and `max' functions did not return indexes properly due to the lack of references in functions' arguments. * Fixed bug [1084246]. Operators and other functions in Vec, Mat and Array revised to follow standard C++ conventions. Now operators provide an lvalue and also check against self-assignment. * A lot of other minor bug-fixes. For a full list of them, please check the ChangeLog file. =============================================================================== itpp-4.3.1/NEWS-3.99000066400000000000000000000436261216575753400136240ustar00rootroot00000000000000=============================================================================== IT++ version 3.99.3.1 Released: 2007-08-10 ------------------------------------------------------------------------------- This minor bug-fix release fixes a serious regression, which appeared in just released 3.99.3 development version. Here is a short description of the fixed problem: * Wrong declaration of zdotu_() BLAS function interface caused segmentation faults when IT++ was compiled with "-fomit-frame-pointer" flag. To fix this problem a Fortran wrapper function zdotusub_() has been added to IT++. This wrapper function comes from NetLib's CBLAS package. =============================================================================== IT++ version 3.99.3 Released: 2007-08-10 ------------------------------------------------------------------------------- This is the last development release of IT++ 3.99.x series. The upcoming 4.0.0 stable release will be based on this version after a certain stabilisation period. Therefore we encourage everyone to switch to this version and report any problems and bugs on the IT++ Help forum. The interface of this release should be compatible with the planned 4.0.x stable releases. Below you can find a short summary of the recent additions, modifications and bug-fixes included in this release. New features: ------------- * New Sort class implementation included with four different algorithms: Introsort, Heap sort, Quick sort and Insertion sort. The implementation of the new sorting functions is much faster than our previous QS() implementation due to the use of low level pointer arithmetic (feature request [1746876]). * Added repmat() functions, which expand an input matrix or vector to a larger one by concatenating multiple copies of the input one. * Added low level functions scal_vector() and axpy_vector(), which use BLAS methods for double and complex vector arguments. The scal_vector() function is now used by "*=" and "/=" operators. * Added support for reading and writing bool variables in it_file class * Added a few MSVC++ project files for test programs. The project files are configured to use 32-bit versions of MKL 9.1.025 and ACML 3.6.0 PGI libraries installed into their default locations on Windows platforms. Modifications: -------------- * Removed dependency on the external CBLAS library by providing direct interfaces to Fortran BLAS routines (feature request [1746876]). * General performance improvements of various operators in Vec and Mat classes by using a copy_vector() function where possible. The copy_vector() function use BLAS 1 routines for double and complex arguments. * BLAS-aided specialisation of the Vec::outer_product() method for vec and cvec arguments added. * More consistent test programs for Mat and Vec classes. Now all operators and methods are tested. Bug-fixes: ---------- * Fixed a bug in Mat::set_size() method. When resizing a smaller matrix into a bigger one with copying the content, the unused entries were not initialised to zeros properly. =============================================================================== IT++ version 3.99.2 Released: 2007-06-20 ------------------------------------------------------------------------------- This is the next development release of the IT++ library. As usual, below is a list of the most important features, modifications and bug-fixes, since version 3.99.1 was released. As this is a development version, some interfaces have changed. Therefore, you might need to update your programs using this library. New features: ------------- * Added B-LDPC Codes implementation, which consists of a BLDPC_Parity and BLDPC_Generator classes. The former one can be used for constructing the parity-check matrix from so-called base-matrix. Base matrix can be saved and loaded from a text file. The BLDPC_Generator class implements an efficient encoding algorithm using a preprocessed version of the parity-check matrix. * New implementation of the Normal_RNG sample() function, which uses the so-called Ziggurat algorithm. The new generator is about five times faster than the previous one using the Box-Mueller method. This fixes feature request [1707969]. * New implementation of the Complex_Normal_RNG class, which now uses the improved Normal_RNG for generating the real and imaginary parts of the complex random sample. The new generator is about four times faster than the previous implementation. This closes feature request [1711727]. * Added a new function waterfilling() to solve water-filling problems * Implemented set_size() method in the GF2mat class Modifications: -------------- * LDPC_Code::decode() methods changed to return only systematic bits, to be compatible with the encode() methods. New methods decode_soft_out() added, which return soft LLR values for all bits in a codeword. * Removed unnecessary integrity_check() execution from the LDPC_Code::load_code() function. setup_decoder() method replaced with three separate methods, which are more flexible to use. Tutorial example updated to reflect recent changes. * Major changes in IT++ file format related classes: - the new file format (version 3) is incompatible with version 2, which was used in IT++ 3.10.x series; for backward compatibility the previous format can be handled using the it_file_old and it_ifile_old classes, which are considered as deprecated and will be removed from the library in future - data is always saved using a little endian byte ordering; files files written on machines using big or little endian ordering should be identical; endianity variable removed from the data_header structure - all size variables are stored using fixed-width 64-bit unsigned integer type, and therefore are independent of the architecture word size (32- or 64-bit) - short and int data types are explicitly casted to fixed-with types int16_t, uint16_t, int32_t and uint32_t, since C/C++ standards do not assume fixed widths of these types - cleaner and more efficient implementation of the write_data_header() function - added missing implementation of a pack() function, which compacts an opened it_file by removing free space between data blocks - added optional description filed which can be saved with each variable - added missing operators and methods for reading and writing svec and smat data types - test program improved - itload.m and itsave.m M-files updated to be compatible with the latest IT++ file format * The outer_product() function now uses an extra argument "hermitian", which controls the calculation for complex vectors. By default "hermitian" is set to false, which results in (x * y^T) calculation. If "hermitian" is true, (x * y^H) is calculated. This solution is backward compatible with 3.10.x interface of outer_product(). Final fix for bug [1727923]. * Improvements in MKL detection macros. The latest MKL release 9.1.018 has different naming of a lapack shared library (libmkl_lapack32.so and libmkl_lapack64.so -> libmkl_lapack.so). * Removed "-fno-exceptions" flag from CXXFLAGS and CXXFLAGS_DEBUG Bug-fixes: ---------- * Fixed bug [1739500] in hadamard() function. The initial recursion for creating Hadamard matrices has to start with a 1x1 matrix H = [1], not with a 2x2 matrix. This fix provides correct solution for imat H = hadamard(1). * Fixed bug [1739267] in binom() and binom_i(). The binomial coefficient was calculated wrongly for n = k. Instead of 1 the functions result was n+1. * The functions for reading ppm and pgm images have to use binary mode when opening files. This fixes bug [1730610]. * Fixed bug [1724746], i.e. a problem with modified input data in ifft_real() function. Additional FFTW_PRESERVE_INPUT flag used during FFTW plan creation solves this problem. * Fixed linking errors when trying to use Hadamard and Walsh-Hadamard transform functions. This fixes bug report [1719146]. * Fixed bugs in LDPC_Code::load_code() and LDPC_Code::save_code() functions. It could happen that LDPC generator object might be left uninitialised when loading the coded from a binary file. * Fixed the actual number of iterations of the LDPC decoding algorithm. It was using one more then expected. * Fixed bug [1703731] by implementing the missing double2mxArray() and double_complex2mxArray() functions in itmex.h * Included missing and header files where necessary. This fixes problems with building using GCC 4.3 snapshot. * Fixed a minor bug in the set() method, when parsing an "a:b" or "a:b:c" format. Due to precision problems, the last value from some specific ranges was not included in the result, e.g. "0:0.2:3" resulted in a vector with 2.8 at the end (instead of 3). =============================================================================== IT++ version 3.99.1 Released: 2007-03-22 ------------------------------------------------------------------------------- This is the next development release of the IT++ 3.99.x series. Below is a brief summary of the most important new features, modifications and bug fixes, as compared to the previous release 3.99.0. Please note that some interfaces have changed, so you might need to update your programs linking to this version. New features: ------------- * Random number generator extended with random53_01_lclosed() function, which generates [0,1) values in 53-bit resolution. * Added missing read/write operators for char variables in it_file and it_ifile classes * MS Visual C++ .NET project file for linking IT++ with ACML added * Added man page for itpp-config script * Added test file for a binary it_file format. It is supposed to detect wrong endianness detection on various platforms. Modifications: -------------- * LDPC_Parity_Matrix and LDPC_Generator_Matrix classes split into a set of specialized classes, which inherits from the base classes LDPC_Parity and LDPC_Generator. The new inheritance model provides a flexible interface for creating new generation methods and parity check matrix representations by end users. * Improved and reorganised existing error handling macros: - using standard NDEBUG flag for controlling it_assert_debug() macro, which replaced a three-level ASSERT_LEVEL definition - for backward compatibility it_assert0() and it_assert1() now behaves the same as it_assert_debug() - added new it_info() and it_info_debug() macros for printing information messages; it_info_debug() is also dependent on the NDEBUG compile-time definition - added it_error_msg_style() function for changing the format of it_assert(), it_error() and it_warning() messages; if style is set to Minimum, file name and line number of the error/assert/warning macro is not printed * Portability improved by replacing "unsigned short int" with 8-bit "unsigned char" type for storing data bits in GF2mat * Improved the speed and portability of external libraries detection macros * Replaced long with int in many sources, since long and int have the same sizes on most IT++ supported architectures. If there is a need for 64-bit integers, due to portability reasons (u)int64_t type should be used instead of long. Bug-fixes: --------- * Fixed bug [1661419] by adding default constructors to the QAM, PSK, PAM_c and PAM modulator classes. Thanks to Jordy Potman for reporting this bug. * Fixed a bug in BLAS detection, when an explicit library is passed to the script configure using "--with-blas=" option. * Fixed improper declarations of ls_solve_od() and ls_solve_ud() methods * Protected inheritance of the Convolutional_Code class replaced with a public one. This fixes the problem of assigning the Punctured_Convolutional_Code class object to a pointer of Channel_Code class. * Minor documentation fixes in many places =============================================================================== IT++ version 3.99.0 Released: 2007-01-21 ------------------------------------------------------------------------------- This is the first release of the IT++ 3.99.x development series, which is based on sources from the main SVN branch (trunk). After some period of stabilization, a new stable release will be created from this branch (IT++ 4.0.0). Since this is a development branch, some interfaces might be changed in future releases. Moreover, some interfaces have changed with respect to the stable 3.10.x series. Below is a brief summary of the most important new features, modifications and bug fixes, as compared to the recent stable 3.10.x releases. All minor modifications and bug-fixes from 3.10.x series are included in this release as well. New features: ------------- * New functions for initializing vectors and matrices from strings implemented. Main features of the improved parser are as follows: - Decimal, octal and hexadecimal notation support according to C/C++ conventions, i.e. octal numbers starts with `0' (e.g. `0133', `077'), decimal numbers starts with `1-9' or are single `0' digits, hexadecimal numbers starts with `0x' or `0X' prefix and have at least one `0-9', `a-f' or `A-F' digit after (e.g. 0xFF, 0x0, 0x070). - Mixing of various representations in one string - Signed numbers supported, i.e. with leading `+', `-' signs, e.g. `-1000', `+0133', `-0x1' - Vector values separated with spaces ` ', tabs `\t' or comma `,' - Matlab's "a:b" or "a:b:c" notation for increasing and decreasing values, e.g. "0:2:10", "-9:-18", "4:-1:0", "0x0:0x8:0xFF" - Matrix rows separated with a single semicolon `;' - Detection of syntax errors during parsing * New features of the communication channels: - Implemented missing "Gauss I" and "Gauss II" Doppler spectra required by a few COST207 channel models - Channel_Specification and TDL_Channel classes extended with support of LOS (Rice) fading for any tap. Removed Doppler spectrum of type `Rice', since its generation method was the same as of the `Jakes' one. To obtain the `Rice' spectrum, a relative power, and optionally relative Doppler, needs to be defined for certain taps. - Implemented exponential channel profile generation function * Created a new set of Mixture of Gaussians (MOG) classes written by Conrad Sanderson (Statistics module) * Added templated Histogram class provided by Andy Panov (feature request [1451288]) * Added new classes for Low-Density Parity Check (LDPC) codes * Added support for MacKay's "alist" representation of sparse GF(2) matrices * Systematic codewords support in BCH and RS encoder/decoder classes contributed by Steve Peters (feature request [1418250]) * New methods in Vec and Mat classes: elem_mult_inplace(), elem_mult_out(), elem_div_out(), elem_mult_sum(), elem_div_sum() and sumsum() * Added missing left(), right() and mid() methods to the Array class Modifications: -------------- * New "Signal Processing", "Statistics" and "Numerical Optimization" modules created from a subset of classes and functions from the "Base" module * Modularization added to the configuration scripts. It is now possible to select a limited set of modules, which will be built and installed as the IT++ library. * Restructuring of the source files in the "Base" module. Some of the functions grouped in "Linear Algebra" and "Mathematical and Miscellaneous Functions" sub-modules. * Major redesign of 1D and 2D modulator classes. From now, there is only one templated base class Modulator, which can handle 1D (real) and 2D (complex) constellations. Other modulators inherits from this base class. BPSK and PAM modulators are split into: BPSK_c/PAM_c classes which have complex-valued interfaces, and BPSK/PAM that have real-valued interfaces. Besides, demodulate_soft_bits() functions take an additional parameter "method" to switch between Log-MAP or approximate demodulation. The input signal for the Modulator_2D has now a slightly different meaning. Also an improper definition of the QPSK constellation is fixed (it was a 4-QAM modulator previously). * Important updates in the communication channels: - Fading generators inheritance model redesigned. Now there are three types of fading: Independent, Static and Correlated. The Correlated fading can be generated using Rice (MEDS), FIR or IFFT methods. The default fading type is set to `Independent'. - The delay profile discretization function is improved and moved to the TDL_Channel class. An additional parameter `sampling_time' is required when setting the channel profile using the Channel_Specification object. It is now possible to discretize the channel with too low sampling frequency, but only if the taps being merged into a new single tap use the same Doppler spectrum type. - Cleaned up the interfaces of various fading generator classes * Improved the consistency of the alloc(), free() and set_size() methods in the Array, Mat and Vec classes * Error functions it_assert(), it_warning() and it_error() extended to handle stream operators like `<<' or `std::endl' in concatenation with strings, e.g. `it_error("Wrong value x = " << oct << x)' (feature request [1569867] by George Jongren) * Changed the method of detecting the endianness of a system - "itpp/base/machdep.h" is no longer used. Bug-fixes: --------- * Fixed a bug that resulted in different output samples of the IFFT fading generator on SPARC Solaris 9 using GCC 3.4.5, than the ones obtained in other environments. The problem was caused by a different order of calculating the random arguments of the concat() function. This is either a bug of GCC for Solaris or its dependence on different endianness, or it is not fully specified behavior of C/C++ standards. * Several other bug-fixes and improvements. For a full list of them, see the ChangeLog and NEWS-3.10 files. itpp-4.3.1/NEWS-4.0000066400000000000000000000547771216575753400135340ustar00rootroot00000000000000=============================================================================== IT++ version 4.0.7 Released: 2009-12-27 ------------------------------------------------------------------------------- IT++ 4.0.7 is the next maintenance release based on the IT++ stable branch itpp-4-0. A list of modifications and bug-fixes is presented below: Modifications: -------------- * Added support for automatic detection of MKL 10.2 libraries when using GCC * Improved performance of the Frobenious norm function * Improved documentation on the accuracy of LLR calculations * Disabled optimization flag "-O1" for the debug builds Bug-fixes: ---------- * Added equality and inequality operators for Vec> type (bug report #2909998) * Added missing templated instantiations of is_hermitian() and is_unitary() functions (bug report #2392728) * Added missing include files, so IT++ compiles cleanly with GCC 4.4 (bug report #2780001) =============================================================================== IT++ version 4.0.6 Released: 2008-10-08 ------------------------------------------------------------------------------- IT++ 4.0.6 is the next maintenance release based on the current IT++ stable branch (itpp-4-0). As usual, a brief list of modifications and bug-fixes is presented below: Modifications: -------------- * Added GDB debugger helper display macros for IT++ data types (feature request [1913404]) * Reduced number of divisions in a sinc() function implementation * "itpp/config.h" no longer included in "itpp/base/itassert.h" header file Bug-fixes: ---------- * Fixed broken implementation of toeplitz() function for the case when two different complex-valued input vectors are used as input arguments (bug report [2110119]). * Fixed a minor bug in GF::set_size() method: the content of "alphapow" and "logalpha" static variables is now properly copied when resizing them. * Fixed sort() and sort_index() so they again work for vectors with less than two elements. * Fixed bug [2041474] in Vec<>::split() method, which was a regression with respect to the previous 3.10.x stable releases. * Fixed incorrect usage of ZDOTU BLAS function when linking to 64-bit MKL library for GNU/Linux (zdotusub Fortran wrapper function is required) * Suppressed warnings about deprecated "/Wp64" option when compiling with MS Visual C++ Express 2008 =============================================================================== IT++ version 4.0.5 Released: 2008-07-19 ------------------------------------------------------------------------------- IT++ 4.0.5 is the next maintenance release of the current IT++ stable branch (itpp-4-0). As usual, a brief list of modifications and bug-fixes is presented below: Modifications: -------------- * Mat<>::set_size() method now resets the number of rows/columns, if one of the dimensions of a matrix is zero. This is consistent with the constructor behaviour. * Suppressed a few MSVC++ warnings (C4512, C4701, C4244 and C4100) by minor re-factoring of some code fragments * Changed the default debugging CFLAGS to "-g -O1" or "-Wall -ggdb -O1 -pipe", where the latter set is used with GCC. * Suppressed GCC 4.3 warnings on "ambiguous else" due to missing braces * Coding style unified and beautified using Artistic Style (astyle) source code formatter Bug-fixes: ---------- * Fixed bug [2017948] in parsing from string routine of Vec for "a:b:c" format specifier * Fixed bug [2004345] causing incorrect result of Mat::concat_vertical(), when one of the input matrices was empty. In such case the result is now a copy of the other (non-empty) matrix. * Fixed bug [1995743] in BCH::decode() function, which resulted in a decoding failure, while a codeword should have been correctable in theory. * Fixed one regression due to a missing "inline" keyword in Vec<>::outer_product() specialisation * Fixed bug [1941219], which reports broken initialisation of Fast_ICA::set_init_guess() method. =============================================================================== IT++ version 4.0.4 Released: 2008-03-31 ------------------------------------------------------------------------------- IT++ 4.0.4 is the next bug-fix release of the current IT++ stable branch (itpp-4-0). As usual, a brief list of modifications and bug-fixes in this maintenance release is presented below: Modifications: -------------- * Added support for "-1" indexing in Vec<>::del(i1, i2) method. For instance, v.del(4, -1) should delete all elements of v starting from the fourth one. * In case of an overflow saturate QLLR values instead of aborting. * Improved performance of expand_base() and calculate_base_matrix() methods of the BLDPC_Parity class * Const member functions in BERC and BLERC classes are now really "const". * Added new tests for error counters, converting functions and block LDPC code classes * Clean-ups of the Vec and Mat classes (removed unnecessary "const" keywords, use consistent naming, use in_range() private methods, revise inlining of functions) * Minor documentation improvements (spelling fixes in the base module and improved sqr() documentation). Bug-fixes: ---------- * Fixed bug [1908644] in Modulator<>::set(symbols, bits2symbols) function. The bitmap matrix used in the demodulate_bits() function of the Modulator<> base class was improperly constructed from the input bits2symbols mapping vector. This resulted in demodulation errors for some constellations, e.g. 64-QAM or 8-PSK. * Fixed wrong size of the resulting bit vector of the LDPC_Code::decode() function * Fixed wrong conditions in it_assert_debug() calls of elem_mult_out() methods of the Vec and Math classes * Fading_Generator::generate(int) methods in the derived classes are no longer hidden. * Warnings are no longer treated as errors under MSVC++ compiler. This should workaround the bug [1900236]. * Fixed incorrect implementation of rint() function not available under MSVC++ compiler * Fixed complex constructors in operators.cpp to build with g++ 4.3 =============================================================================== IT++ version 4.0.3 Released: 2008-02-21 ------------------------------------------------------------------------------- This bug-fix release is only intended to fix the wrong calling method of BLAS zdotu_ function, used in IT++ 4.0.1 and 4.0.2 releases. The problem is due to the fact that a std::complex C++ type is not compatible with COMPLEX in Fortran. This appears to be especially visible when calling the Fortran functions that return a complex result. Therefore, the most portable solution to call such functions from C++ is to use a Fortran wrapper function that passes the complex result as the function argument. For this particular problem, the zdotusub_ wrapper function is provided. Besides, the configure script provides a new "--with-zdotu=" option to override the default calling method of zdotu_ function. The valid options are as follows: - "zdotusub" - use the zdotusub_ Fortran wrapper function (default, if a Fortran compiler is available) - "void" - compatible with BLAS libraries built with g77 compiler and BLAS provided by Intel MKL - "none" - not using the zdotu_ function at all Please note that if IT++ 4.0.2 release works fine for you (all tests pass), you do not need to update IT++ to version 4.0.3. =============================================================================== IT++ version 4.0.2 Released: 2008-02-15 ------------------------------------------------------------------------------- This is the second bug-fix release of the current IT++ stable branch (itpp-4-0). A brief list of modifications and bug-fixes in this maintenance release is as follows: Modifications: -------------- * Documentation improvements: - better description of the encoding/decoding and encoder state setting functions of the Convolutional_Code class - detailed description added to the get_bits2symbols() method of the Modulator base class - missing itpp namespace documentation is now generated (due to the Doxygen's changes) * Added support for building a DLL library on Cygwin (IT++ has to be linked to Cygwin's libblas and liblapack DLLs). Bug-fixes: ---------- * Fixed wrong result of the log_add() function for infinite arguments (bug report [1863940]) * Fixed GF2mat_sparse_alist::from_sparse() conversion function, which was not usable for most of non-regular sparse matrices. * Fixed wrong verbose output of the Parser::get() function for "int" and "bool" types of the parsed variables * Improved zdotu_ calling convention tests, which should solve problems with blas_test and vec_test reported for 64-bit versions of Debian and SUSE Linux systems (bug report [1855481]). A Fortran wrapper function zdotusub_ is no longer distributed with IT++. =============================================================================== IT++ version 4.0.1 Released: 2007-12-15 ------------------------------------------------------------------------------- This is the first bug-fix release of the current stable itpp-4-0 branch. As usual, the maintenance release of the IT++ library is backward compatible with previous versions from the same branch (4.0.x), because only bug-fixes and modifications that do not break the interface have been included. Here is a brief summary of the most important changes included in this release: Modifications: -------------- * Fortran compiler is no longer required for detection of some BLAS/LAPACK implementations. For instance, the BLAS and LAPACK libraries provided by Intel MKL or Apple's Accelerate Framework can be used without Fortran compiler installed. * Flags and libraries returned by itpp-config and "pkg-config itpp" commands are adjusted to the linker requirements of a particular platform and library type. With this change, the use of "--static" switch should be no longer necessary. This should also fix linking problems to a shared library on Mac OS X. * Major improvement in calculation performance of SVD and QR decomposition routines, especially for larger matrices. * "operator*(Vec &v, Mat &m)" documented as deprecated, because its behaviour is equivalent to "outer_product(v, m.get_row(0))". * "-Werror" flag is not used any more by default when compiling the debugging library. * Documentation improvements of svd() and diag() functions * Latest MKL and ACML libraries should be automatically detected on both 32- and 64-bit systems. * The MS Visual C++ project files now use environment variables (INCLUDE, LIB and PATH) to find the location of header and library files of MKL and ACML. Besides, multi-threaded DLL libraries are built by default. * "min" and "max" macros are now unconditionally undefined in config.h and config_msvc.h. IT++ uses std::min() and std::max() functions. * Autoconf 2.60 is now required when building from SVN. * Improved configure checks for isfinite(), isinf() and isnan() functions. This should improve portability of the library on other UNIX and BSD systems. * The configuration summary is logged in the config.log file. * Added "itpp_debug.pc" pkg-config's file for linking with the debugging library. Bug-fixes: ---------- * Fixed compilation errors when using GCC 4.3 (bug-report [1848375]) * Fixed LDPC tutorial examples (bug-report [1827041]) * Added a workaround for a compilation error of a few explicit instantiations in converters.cpp when using GCC 3.3.x with "-finline-functions" flag enabled (bug-report [1818395]) * The distributed files "itpp.spec" and "itpp-config.1" are no longer removed when invoking a "make distclean" command (bug-report [1818391]). * Fixed wrong calculation of bessely() caused by incompatible implementations of gamma() and lgamma() functions. This problem was only visible when using an Intel C++ compiler. * Prevent warnings about string to char* conversions when using GCC >= 4.2 =============================================================================== IT++ version 4.0.0 Released: 2007-10-14 ------------------------------------------------------------------------------- IT++ 4.0.0 is the new stable release based on itpp-3-99 development branch. It supersedes our previous 3.10.x stable versions. After over one and a half year of intensive development it includes a lot of new features and improvements with respect to IT++ 3.10.12 release (the previous stable version). A brief summary of the most important additions and changes is listed below. Should you need more detailed history of changes that are new in this release, please have a look at the NEWS-3.99 and ChangeLog files. New features: ------------- ### Base module: ### * New functions for initializing vectors and matrices from strings implemented. Main features of the improved parser are as follows: - Decimal, octal and hexadecimal notation support according to C/C++ conventions, i.e. octal numbers starts with `0' (e.g. `0133', `077'), decimal numbers starts with `1-9' or are single `0' digits, hexadecimal numbers starts with `0x' or `0X' prefix and have at least one `0-9', `a-f' or `A-F' digit after (e.g. 0xFF, 0x0, 0x070). - Mixing of various representations in one string - Signed numbers supported, i.e. with leading `+', `-' signs, e.g. `-1000', `+0133', `-0x1' - Vector values separated with spaces ` ', tabs `\t' or comma `,' - Matlab's "a:b" or "a:b:c" notation for increasing and decreasing values, e.g. "0:2:10", "-9:-18", "4:-1:0", "0x0:0x8:0xFF" - Matrix rows separated with a single semicolon `;' - `NaN' (not a number) and `Inf' (infinity) values properly interpreted - Detection of syntax errors during parsing * New features of the communication channels: - Implemented missing "Gauss I" and "Gauss II" Doppler spectra required by a few COST207 channel models - Channel_Specification and TDL_Channel classes extended with support of LOS (Rice) fading for any tap. Removed Doppler spectrum of type `Rice', since its generation method was the same as of the `Jakes' one. To obtain the `Rice' spectrum, a relative power, and optionally relative Doppler, needs to be defined for certain taps. - Implemented exponential channel profile generation function * New implementation of the Normal_RNG and Complex_Normal_RNG classes, which uses so-called Ziggurat algorithm. The new generators are about 4-5 times faster than the previous ones using Box-Mueller method (feature request [1707969] and [1711727]). * New Sort class implementation included with four different algorithms: Introsort, Heap sort, Quick sort and Insertion sort. The implementation of the new sorting functions is much faster than our previous QS() implementation due to the use of low level pointer arithmetic (feature request [1746876]). * Added repmat() functions, which expand an input matrix or vector to a larger one by concatenating multiple copies of the input one. * New methods in Vec and Mat classes: elem_mult_inplace(), elem_mult_out(), elem_div_out(), elem_mult_sum(), elem_div_sum() and sumsum() * New methods: set_rows() and set_cols() implemented in the Mat class * Added missing left(), right() and mid() methods to the Array class ### Communications module: ### * Added new classes for Low-Density Parity Check (LDPC) codes. So-called Block LDPC (B-LDPC) codes, or Quasi-Cyclic LDPC codes are supported as well. * Added support for MacKay's "alist" representation of sparse GF(2) matrices * Added systematic codewords support in BCH and RS encoder/decoder classes (feature request [1418250]) * Added a new function waterfilling() to solve water-filling problems ### Statistics module: ### * Created a new set of Mixture of Gaussians (MOG) classes (Statistics module) * Added templated Histogram class provided (feature request [1451288]) ### Other: ### * MS Visual C++ .NET project file for linking IT++ with ACML added. Also added MSVC++ project files for building test programs. Modifications: -------------- ### Base module: ### * Major changes in IT++ file format related classes: - the new file format (version 3) is incompatible with version 2, which was used in IT++ 3.10.x series; for backward compatibility the previous format can be handled using the it_file_old and it_ifile_old classes, which are considered as deprecated and will be removed from the library in future - data is always saved using a little endian byte ordering; files files written on machines using big or little endian ordering should be identical; endianity variable removed from the data_header structure - all size variables are stored using fixed-width 64-bit unsigned integer type, and therefore are independent of the architecture word size (32- or 64-bit) - short and int data types are explicitly casted to fixed-with types int16_t, uint16_t, int32_t and uint32_t, since C/C++ standards do not assume fixed widths of these types - cleaner and more efficient implementation of the write_data_header() function - added missing implementation of a pack() function, which compacts an opened it_file by removing free space between data blocks - added optional description filed which can be saved with each variable - added missing operators and methods for reading and writing svec and smat data types - test program improved - itload.m and itsave.m M-files updated to be compatible with the latest IT++ file format * Improved and reorganised existing error handling macros: - using standard NDEBUG flag for controlling it_assert_debug() macro, which replaced a three-level ASSERT_LEVEL definition - for backward compatibility it_assert0() and it_assert1() now behaves the same as it_assert_debug() - added new it_info() and it_info_debug() macros for printing information messages; it_info_debug() is also dependent on the NDEBUG compile-time definition - added it_error_msg_style() function for changing the format of it_assert(), it_error() and it_warning() messages; if style is set to Minimum, file name and line number of the error/assert/warning macro is not printed - error functions extended to handle stream operators like `<<' or `std::endl' in concatenation with strings (feature request [1569867]) * Improved the consistency of the alloc(), free() and set_size() methods in the Array, Mat and Vec classes * General performance improvements of various operators in Vec and Mat classes by using a copy_vector() function where possible. The copy_vector() function use BLAS 1 routines for double and complex arguments. * The outer_product() function now uses an extra argument "hermitian", which controls the calculation for complex vectors. By default "hermitian" is set to false, which results in (x * y^T) calculation. If "hermitian" is true, (x * y^H) is calculated. This solution is backward compatible with 3.10.x interface of outer_product(). Final fix for bug [1727923]. ### Communications module: ### * Major redesign of 1D and 2D modulator classes. From now, there is only one templated base class Modulator, which can handle 1D (real) and 2D (complex) constellations. Other modulators inherits from this base class. BPSK and PAM modulators are split into: BPSK_c/PAM_c classes which have complex-valued interfaces, and BPSK/PAM that have real-valued interfaces. Besides, demodulate_soft_bits() functions take an additional parameter "method" to switch between Log-MAP or approximate demodulation. The input signal for the Modulator_2D has now a slightly different meaning. Also an improper definition of the QPSK constellation is fixed (it was a 4-QAM modulator previously). * Important updates in the communication channels: - Fading generators inheritance model redesigned. Now there are three types of fading: Independent, Static and Correlated. The Correlated fading can be generated using Rice (MEDS), FIR or IFFT methods. The default fading type is set to `Independent'. - The delay profile discretization function is improved and moved to the TDL_Channel class. An additional parameter `sampling_time' is required when setting the channel profile using the Channel_Specification object. It is now possible to discretize the channel with too low sampling frequency, but only if the taps being merged into a new single tap use the same Doppler spectrum type. - Cleaned up the interfaces of various fading generator classes * Improved interfaces of Modulator_ND classes, so they are now more similar to 1D and 2D modulators. BTW, implemented Zero-Forcing (ZF) Log-MAP soft demodulator. ### Signal processing module: ### * Memory allocation for double and complex based vectors and matrices uses 16-byte alignment. This results in much better performance (up to 30% improvement) of FFT/IFFT and DCT/IDCT operations when using FFTW external library (feature request [1418707]). ### Other: ### * Removed dependency on the external CBLAS library by providing direct interfaces to Fortran BLAS routines (feature request [1746876]). * New "Signal Processing", "Statistics" and "Numerical Optimization" modules created from a subset of classes and functions from the "Base" module * Restructuring of the source files in the "Base" module. Some of the functions grouped in "Linear Algebra" and "Mathematical and Miscellaneous Functions" sub-modules. * Modularization added to the configuration scripts. It is now possible to select a limited set of modules, which will be built and installed as the IT++ library. * Improvements in itpp-config and pkg-config's itpp.pc scripts. The changes are intended to follow the distinction between linking to a static and shared version of the library, which is used in pkg-config's itpp.pc file. By default "itpp-config --libs" returns "-I${prefix}/lib -litpp", whereas when "--static" is added in front of "--libs", the returned string is extended with a set of external library names required for proper static linking. Moreover, an additional "--debug" switch has been added, which changes the output of "itpp-config --cflags" and "itpp-config --libs" by providing debugging flags and debugging library name. For backward compatibility "--cflags-opt", "--cflags-debug", "--libs-opt" and "--libs-debug" still exist, but they are not documented and their use is deprecated. itpp-4.3.1/NEWS-4.2000066400000000000000000000062651216575753400135230ustar00rootroot00000000000000=============================================================================== IT++ version 4.2.0 Released: 2010-09-21 ------------------------------------------------------------------------------- IT++ 4.2.0 is a new stable release based on the SVN development branch (trunk). Additionally to the new features and modifications listed below, it comprises all bug fixes included in the previous 4.0.x stable releases. New features: ------------- * Added SISO class implementing several algorithms used in turbo decoders/ receivers * Added EXIT class for EXIT chart computation of turbo receivers * Added STC class for the generation of Space Time block codes used in MIMO systems with turbo receivers * Added support for testing IT++ library in Visual C++ (2008 and 2010). Current approach relies on fc (file compare) utility. * Added rank() function, which calculates the rank of a matrix by counting the number of non-zero singular values. SVD function from LAPACK is thus required by this function. * Added implementation of Gamma(alpha, beta) random number generator. The implementation of the Gamma_RNG::sample() function was taken from the R statistical language. * Added qr() overloaded function that does not compute Q. For some tasks (triangularization) the Q matrix is not really needed. * Added missing get(int i) method and operator=(const std::string &) to the Mat class * Added element-wise division operator with a scalar as the dividend to the Mat class * Added missing operator=(const std::string &) to the Vec class * Added missing operator(bin_list) and get(index_list) methods to the Vec class * Added LDPC_Code::get_ninfo() function, which returns the number of information bits in a codeword. * Added cheb() and chebwin() function to evaluate the coefficients of the Dolph-Chebyshev window. Modifications: -------------- * License updated from "GPLv2 or later" to "GPLv3 or later" * Mersenne Twister core random number generator replaced with an improved Double-precision SIMD-oriented Fast Mersenne Twister (dSFMT) implementation, which is 1.8-2.4 times faster than the previous code. * Vector string parser reimplemented to support multiple "a:b:c" format strings. For instance: ivec v = "1:2:5, 6 8 9:-1:0"; now works. Memory handling is also more efficient, i.e. for the cases when "a:b:c" format is not used, memory is allocated only once. This solves feature request #2041480. * Auto-calculate the BCH generator polynomial from (n, t) parameters. With this change, the generator polynomial and 'k' (message word length) parameters do not have to be explicitly passed to the class constructor. * Moved portability related definitions from config.h and other header files to a common system and architecture dependent header itcompat.h * Deprecated Mat<>::set_submatrix(r1,r2,c1,c2,m) function * Deprecated elem_div(t,v) and set_subvector(i1, i2, &v) function of the Vec class * Removed previously deprecated demodulate_soft_bits_approx() functions * Removed the deprecated multiplication operator of a column vector and a matrix with only one row * Renamed check_big_endianness() to a simpler is_bigendian() itpp-4.3.1/README000066400000000000000000000036721216575753400134020ustar00rootroot00000000000000Introduction ************ IT++ is a C++ library of mathematical, signal processing and communication classes and functions. Its main use is in simulation of communication systems and for performing research in the area of communications. The kernel of the library consists of generic vector and matrix classes, and a set of accompanying routines. Such a kernel makes IT++ similar to MATLAB or GNU Octave. The IT++ library originates from the former department of Information Theory at the Chalmers University of Technology, Gothenburg, Sweden. Because the library is coded in C++, the name IT++ seemed like a good idea at the time. While departments come and go, IT++ have developed a life of it's own and is now released under the terms of the GNU General Public License (GPL) for you to enjoy. IT++ is being developed and widely used by researchers who work in the area of communications, both in the industry and at universities. In 2005, 2006 and 2007, IT++ was developed as a part of the European Network of Excellence in Wireless Communications (NEWCOM). IT++ makes extensive use of existing open-source or commercial libraries for increased functionality, speed and accuracy. In particular BLAS, LAPACK and FFTW libraries can be used. Instead of the reference BLAS and LAPACK implementations, some optimized platform-specific libraries can be used as well, i.e.: o ATLAS (Automatically Tuned Linear Algebra Software) - includes optimised BLAS and a limited set of LAPACK routines o MKL (Intel Math Kernel Library) - includes all required BLAS, LAPACK and FFT routines (FFTW not required) o ACML (AMD Core Math Library) - includes BLAS, LAPACK and FFT routines (FFTW not required) It is possible to compile and use IT++ without any of the above listed libraries, but the functionality will be reduced. IT++ should work on GNU/Linux, Sun Solaris, Microsoft Windows (with Cygwin, MinGW/MSYS or Microsoft Visual C++) and Mac OS X operating systems. itpp-4.3.1/VERSION000066400000000000000000000000161216575753400135570ustar00rootroot000000000000004.3 8:2:0 git itpp-4.3.1/autogen.sh000077500000000000000000000027711216575753400145220ustar00rootroot00000000000000#!/bin/sh # Run this to generate all the initial makefiles, etc. DIE=no check_tool() { ($1 --version) /dev/null 2>&1 || { echo "*** Error: You must have \"$1\" installed to compile IT++ SVN sources" DIE=yes } } check_tool "autoconf" check_tool "automake" check_tool "libtoolize" check_tool "sed" test "$DIE" = yes && exit 1 srcdir=$(dirname $0) test -z "${srcdir}" && srcdir=. ORIGDIR=$(pwd) cd "${srcdir}" || exit $? PV=$(cat VERSION | cut -d' ' -f1) LV=$(cat VERSION | cut -d' ' -f2) if test "x$(cat VERSION | cut -d' ' -f3)" = "xsvn"; then if test -d ".git/svn"; then REV=$(LC_ALL=C git svn find-rev HEAD) elif test -d ".svn"; then REV=$(LC_ALL=C svn info $0 | sed -n 's/^Revision: //p') fi if test "x${REV}" != x; then PV="${PV}.r${REV}" else PV="${PV}.d`LC_ALL=C date +%Y%m%d`" fi fi PD=$(LC_ALL=C date +"%B %Y") echo "Bootstapping IT++ version ${PV}" sed -e "s/@PACKAGE_VERSION@/${PV}/" -e "s/@LIBRARY_VERSION@/${LV}/" \ < configure.ac.in > configure.ac || exit $? sed -e "s/@PACKAGE_VERSION@/${PV}/" \ < itpp.spec.in > itpp.spec || exit $? sed -e "s/@PACKAGE_VERSION@/${PV}/" -e "s/@PACKAGE_DATE@/${PD}/" \ < itpp-config.1.in > itpp-config.1 || exit $? test ! -d build-aux && (mkdir build-aux || exit $?) aclocal -I m4 || exit $? libtoolize --copy --force --automake || exit $? aclocal -I m4 || exit $? autoconf || exit $? autoheader || exit $? automake --add-missing --copy || exit $? cd "${ORIGDIR}" || exit $? itpp-4.3.1/cmake/000077500000000000000000000000001216575753400135725ustar00rootroot00000000000000itpp-4.3.1/cmake/Modules/000077500000000000000000000000001216575753400152025ustar00rootroot00000000000000itpp-4.3.1/cmake/Modules/CheckCXXFunctionExists.cmake000066400000000000000000000064051216575753400225170ustar00rootroot00000000000000# - Check if a C++ functions std::isfinite, std::isinf and std::isnan can be linked # CHECK_CXX_FUNCTION_EXISTS( ) # # Check that the is provided by libraries on the system and # store the result in a . This does not verify that any # system header file declares the function, only that it can be found # at link time (considure using CheckSymbolExists). # # The following variables may be set before calling this macro to # modify the way the check is run: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link #============================================================================= # Copyright 2002-2011 Kitware, Inc. # Copyright 2012 Bogdan Cristea # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) MACRO(CHECK_CXX_FUNCTION_EXISTS FUNCTION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${FUNCTION}") IF(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) IF(CMAKE_REQUIRED_INCLUDES) SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") ELSE(CMAKE_REQUIRED_INCLUDES) SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES) ENDIF(CMAKE_REQUIRED_INCLUDES) TRY_COMPILE(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/Modules/CheckFunctionExists.cpp COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" "${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) IF(${VARIABLE}) SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") MESSAGE(STATUS "Looking for ${FUNCTION} - found") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} - not found") SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") ENDIF(${VARIABLE}) ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") ENDMACRO(CHECK_CXX_FUNCTION_EXISTS) itpp-4.3.1/cmake/Modules/CheckFunctionExists.cpp000066400000000000000000000006731216575753400216370ustar00rootroot00000000000000#ifdef CHECK_FUNCTION_EXISTS //only for std:isfinite, std::isinf and std::isnan #include #ifdef __CLASSIC_C__ int main(){ int ac; char*av[]; #else int main(int ac, char*av[]){ #endif double arg = 0.0; CHECK_FUNCTION_EXISTS(arg); if(ac > 1000) { return *av[0]; } return 0; } #else /* CHECK_FUNCTION_EXISTS */ # error "CHECK_FUNCTION_EXISTS has to specify the function" #endif /* CHECK_FUNCTION_EXISTS */ itpp-4.3.1/cmake/Modules/FindBLAS.cmake000066400000000000000000000424011216575753400175270ustar00rootroot00000000000000# - Find BLAS library # This module finds an installed fortran library that implements the BLAS # linear-algebra interface (see http://www.netlib.org/blas/). # The list of libraries searched for is taken # from the autoconf macro file, acx_blas.m4 (distributed at # http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). # # This module sets the following variables: # BLAS_FOUND - set to true if a library implementing the BLAS interface # is found # BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l # and -L). # BLAS_LIBRARIES - uncached list of libraries (using full path name) to # link against to use BLAS # BLAS95_LIBRARIES - uncached list of libraries (using full path name) # to link against to use BLAS95 interface # BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface # is found # BLA_STATIC if set on this determines what kind of linkage we do (static) # BLA_VENDOR if set checks only the specified vendor, if not set checks # all the possibilities # BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK ########## ### List of vendors (BLA_VENDOR) valid in this module ## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), ## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model), ## Intel11 (intel mkl v11) ## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic # C/CXX should be enabled to use Intel mkl #============================================================================= # Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(CheckFunctionExists) include(CheckFortranFunctionExists) set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Check the language being used get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) if( _LANGUAGES_ MATCHES Fortran ) set( _CHECK_FORTRAN TRUE ) elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) set( _CHECK_FORTRAN FALSE ) else() if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") else() message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") return() endif() endif() macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) # This macro checks for the existence of the combination of fortran libraries # given by _list. If the combination is found, this macro checks (using the # Check_Fortran_Function_Exists macro) whether can link against that library # combination using the name of a routine given by _name using the linker # flags given by _flags. If the combination of libraries is found and passes # the link test, LIBRARIES is set to the list of complete library paths that # have been found. Otherwise, LIBRARIES is set to FALSE. # N.B. _prefix is the prefix applied to the names of all cached variables that # are generated internally and marked advanced by this macro. set(_libdir ${ARGN}) set(_libraries_work TRUE) set(${LIBRARIES}) set(_combined_name) if (NOT _libdir) if (WIN32) set(_libdir ENV LIB) elseif (APPLE) set(_libdir ENV DYLD_LIBRARY_PATH) else () set(_libdir ENV LD_LIBRARY_PATH) endif () endif () foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) if(_libraries_work) if (BLA_STATIC) if (WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif () if (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) else () set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif () else () if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () if (WIN32) if (BLA_VENDOR MATCHES "^ACML") #ACML library has a different naming convention set(_library lib${_library}_dll) endif() endif() endif () find_library(${_prefix}_${_library}_LIBRARY NAMES ${_library} PATHS ${_libdir} ) mark_as_advanced(${_prefix}_${_library}_LIBRARY) if(${_prefix}_${_library}_LIBRARY) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) endif() endif() endforeach() if(NOT ${LIBRARIES}) set(_libraries_work false) endif() if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (_CHECK_FORTRAN) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) elseif(WIN32) check_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) endif() set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) endif() if(NOT _libraries_work) set(${LIBRARIES} FALSE) endif() #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endmacro() set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) set(BLAS95_LIBRARIES) if ($ENV{BLA_VENDOR} MATCHES ".+") set(BLA_VENDOR $ENV{BLA_VENDOR}) else () if(NOT BLA_VENDOR) set(BLA_VENDOR "All") endif() endif () if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "goto2" "" ) endif() endif () if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) check_fortran_libraries( BLAS_LIBRARIES BLAS dgemm "gfortran" "f77blas;satlas;tatlas;atlas" "" ) endif() endif () # BLAS in PhiPACK libraries? (requires generic BLAS lib, too) if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "sgemm;dgemm;blas" "" ) endif() endif () # BLAS in Alpha CXML library? if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "cxml" "" ) endif() endif () # BLAS in Alpha DXML library? (now called CXML, see above) if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "dxml" "" ) endif() endif () # BLAS in Sun Performance library? if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "-xlic_lib=sunperf" "sunperf;sunmath" "" ) if(BLAS_LIBRARIES) set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") endif() endif() endif () # BLAS in SCSL library? (SGI/Cray Scientific Library) if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "scsl" "" ) endif() endif () # BLAS in SGIMATH library? if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "complib.sgimath" "" ) endif() endif () # BLAS in IBM ESSL library? (requires generic BLAS lib, too) if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "essl;blas" "" ) endif() endif () #BLAS in acml library? if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) ) # try to find acml in "standard" paths if( WIN32 ) file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) else() file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) endif() if( WIN32 ) file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) else() file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) endif() if( _ACML_GPU_ROOT ) list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) endif() if( _ACML_ROOT ) list(GET _ACML_ROOT 0 _ACML_ROOT) get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) if( SIZEOF_INTEGER EQUAL 8 ) set( _ACML_PATH_SUFFIX "_int64" ) else() set( _ACML_PATH_SUFFIX "" ) endif() if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) set( _ACML_COMPILER32 "ifort32" ) set( _ACML_COMPILER64 "ifort64" ) elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) set( _ACML_COMPILER32 "sun32" ) set( _ACML_COMPILER64 "sun64" ) elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) set( _ACML_COMPILER32 "pgi32" ) if( WIN32 ) set( _ACML_COMPILER64 "win64" ) else() set( _ACML_COMPILER64 "pgi64" ) endif() elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) # 32 bit builds not supported on Open64 but for code simplicity # We'll just use the same directory twice set( _ACML_COMPILER32 "open64_64" ) set( _ACML_COMPILER64 "open64_64" ) elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) set( _ACML_COMPILER32 "nag32" ) set( _ACML_COMPILER64 "nag64" ) else() set( _ACML_COMPILER32 "gfortran32" ) set( _ACML_COMPILER64 "gfortran64" ) endif() if( BLA_VENDOR STREQUAL "ACML_MP" ) set(_ACML_MP_LIB_DIRS "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) else() set(_ACML_LIB_DIRS "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) endif() endif() elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) endif() if( BLA_VENDOR STREQUAL "ACML_MP" ) foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) check_fortran_libraries ( BLAS_LIBRARIES BLAS sgemm "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} ) if( BLAS_LIBRARIES ) break() endif() endforeach() elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) check_fortran_libraries ( BLAS_LIBRARIES BLAS sgemm "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} ) if( BLAS_LIBRARIES ) break() endif() endforeach() else() foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) check_fortran_libraries ( BLAS_LIBRARIES BLAS sgemm "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} ) if( BLAS_LIBRARIES ) break() endif() endforeach() endif() # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "acml;acml_mv" "" ) endif() if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "acml_mp;acml_mv" "" ) endif() if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" "acml;acml_mv;CALBLAS" "" ) endif() endif () # ACML # Apple BLAS library? if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS dgemm "" "Accelerate" "" ) endif() endif () if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") if ( NOT BLAS_LIBRARIES ) check_fortran_libraries( BLAS_LIBRARIES BLAS dgemm "" "vecLib" "" ) endif () endif () # Generic BLAS library? if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) if (BLA_STATIC) set(_flags "gfortran") #needed by itpp-external else() set(_flags " ") endif() check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm ${_flags} "blas" "" ) endif() endif () #BLAS in intel mkl 10, 11 library? (em64t 64bit) if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") if (NOT WIN32) set(LM "-lm") endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) else() find_package(Threads REQUIRED) endif() set(BLAS_SEARCH_LIBS "") if(BLA_F95) set(BLAS_mkl_SEARCH_SYMBOL SGEMM) set(_LIBRARIES BLAS95_LIBRARIES) if (WIN32) list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40") else () if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") endif () if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") # mkl >= 10.3 if (CMAKE_C_COMPILER MATCHES ".+gcc.*") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") else () list(APPEND BLAS_SEARCH_LIBS "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") endif () endif () endif () if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core") endif () else () set(BLAS_mkl_SEARCH_SYMBOL sgemm) set(_LIBRARIES BLAS_LIBRARIES) if (WIN32) # mkl >= 11 if (BLA_VENDOR MATCHES "Intel11*") list(APPEND BLAS_SEARCH_LIBS "mkl_rt") else() list(APPEND BLAS_SEARCH_LIBS "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40") endif() else () if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_intel mkl_intel_thread mkl_core guide") endif () if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_intel_thread mkl_core guide") # mkl >= 10.3 if (CMAKE_C_COMPILER MATCHES ".+gcc.*") list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") else () list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") endif () endif () #mkl 11 if (BLA_VENDOR MATCHES "Intel11*") list(APPEND BLAS_SEARCH_LIBS "mkl_rt") endif() #older vesions of intel mkl libs if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl") list(APPEND BLAS_SEARCH_LIBS "mkl_ia32") list(APPEND BLAS_SEARCH_LIBS "mkl_em64t") endif () endif () if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_sequential mkl_core") endif () endif () foreach (IT ${BLAS_SEARCH_LIBS}) string(REPLACE " " ";" SEARCH_LIBS ${IT}) if (${_LIBRARIES}) else () check_fortran_libraries( ${_LIBRARIES} BLAS ${BLAS_mkl_SEARCH_SYMBOL} "" "${SEARCH_LIBS}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif () endforeach () endif () endif () if(BLA_F95) if(BLAS95_LIBRARIES) set(BLAS95_FOUND TRUE) set(BLAS_FOUND TRUE) else() set(BLAS95_FOUND FALSE) set(BLAS_FOUND FALSE) endif() if(NOT BLAS_FIND_QUIETLY) if(BLAS95_FOUND) message(STATUS "A library with BLAS95 API found.") else() if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "A required library with BLAS95 API not found. Please specify library location.") else() message(STATUS "A library with BLAS95 API not found. Please specify library location.") endif() endif() endif() set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") else() if(BLAS_LIBRARIES) set(BLAS_FOUND TRUE) else() set(BLAS_FOUND FALSE) endif() if(NOT BLAS_FIND_QUIETLY) if(BLAS_FOUND) message(STATUS "A library with BLAS API found.") else() if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "A required library with BLAS API not found. Please specify library location." ) else() message(STATUS "A library with BLAS API not found. Please specify library location." ) endif() endif() endif() endif() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) itpp-4.3.1/cmake/Modules/FindFFT.cmake000066400000000000000000000151221216575753400174250ustar00rootroot00000000000000# File: FindFFT.cmake # Brief: Find the FFT includes and library # Author: Bogdan Cristea and Jed Brown # # Usage: Use the following line in your CMakeLists file: find_package(FFT) # # This script tries to find the path to FFT libraries and header files. The # following variables are set: # FFT_VENDOR - Possible values: ACML, MKL, FFTW3 # FFT_INCLUDES - where to find header file # FFT_LIBRARIES - List of libraries # FFT_FOUND - True if FFT found. # # The original version of this script can be found at: # https://github.com/jedbrown/cmake-modules/blob/master/FindFFTW.cmake # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- #TODO: check for fft function in each library macro(Check_fft_Libraries LIBRARIES _prefix _name _list) set(_libraries_work TRUE) set(${LIBRARIES}) set(_combined_name) if (NOT _libdir) if (WIN32) set(_libdir $ENV{LIB}) elseif (APPLE) set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 $ENV{DYLD_LIBRARY_PATH}) else () set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 $ENV{LD_LIBRARY_PATH}) endif () endif () foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) if(_libraries_work) if (BLA_STATIC) if (WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif ( WIN32 ) if (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) else (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif (APPLE) else (BLA_STATIC) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () endif (BLA_STATIC) find_library(${_prefix}_${_library}_LIBRARY NAMES ${_library} PATHS ${_libdir} ) mark_as_advanced(${_prefix}_${_library}_LIBRARY) if (${_prefix}_${_library}_LIBRARY) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) endif() endif(_libraries_work) endforeach(_library ${_list}) if(_libraries_work) # Test this combination of libraries. if(UNIX AND BLA_STATIC) set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) else(UNIX AND BLA_STATIC) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) endif(UNIX AND BLA_STATIC) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (NOT _LANGUAGES_ MATCHES Fortran) if (BLA_VENDOR MATCHES "Intel11*") #MKL 11 check_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else () check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) endif() else (NOT _LANGUAGES_ MATCHES Fortran) check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) endif (NOT _LANGUAGES_ MATCHES Fortran) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endif(_libraries_work) if(_libraries_work) set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) else(_libraries_work) set(${LIBRARIES} FALSE) endif(_libraries_work) endmacro(Check_fft_Libraries) if (FFT_INCLUDES) # Already in cache, be silent set (FFT_FIND_QUIETLY TRUE) else(FFT_INCLUDES) set (FFT_FOUND FALSE) endif (FFT_INCLUDES) #check for FFTW3 if (NOT FFT_FOUND) if (BLA_VENDOR MATCHES "^ACML") find_package(BLAS) if (BLAS_LIBRARIES) set (FFT_VENDOR "ACML") set (FFT_LIBRARIES ${BLAS_LIBRARIES}) get_filename_component (PARENT_PATH ${BLAS_LIBRARIES} PATH ) find_path (FFT_INCLUDES acml.h PATH "${PARENT_PATH}/../include") set (FFT_INCLUDES ${BLAS_INCLUDES}) endif() elseif (BLA_VENDOR MATCHES "^Intel") find_package(BLAS) if (BLAS_LIBRARIES) set (FFT_VENDOR "Intel") set (FFT_LIBRARIES ${BLAS_LIBRARIES}) foreach (lib ${BLAS_LIBRARIES}) get_filename_component (PARENT_PATH ${lib} PATH ) find_path (FFT_INCLUDES mkl_dfti.h PATH "${PARENT_PATH}/../../include") if (FFT_INCLUDES) break() endif() endforeach() if (FFT_INCLUDES) find_path(TEMP_INC fftw3.h PATH ${FFT_INCLUDES}/fftw NO_DEFAULT_PATH) if (TEMP_INC) set(FFT_INCLUDES ${TEMP_INC} ${FFT_INCLUDES}) else() set(FFT_INCLUDES "") endif() endif() endif() mark_as_advanced (TEMP_INC) #need to find MKL FFT library check_fft_libraries( FFT_LIBRARIES FFT DftiCommitDescriptor "mkl_rt" ) else() #check for generic FFT find_path (FFT_INCLUDES fftw3.h) find_library (FFT_LIBRARIES NAMES fftw3) if (FFT_INCLUDES AND FFT_LIBRARIES) set (FFT_VENDOR "FFTW3") endif() endif() endif() # handle the QUIETLY and REQUIRED arguments and set FFT_FOUND to TRUE if # all listed variables are TRUE include (FindPackageHandleStandardArgs) find_package_handle_standard_args (FFT DEFAULT_MSG FFT_LIBRARIES FFT_INCLUDES) if (FFT_FOUND) message(STATUS "A library with FFT API found.") else() if(FFT_FIND_REQUIRED) message(ERROR_FATAL "A required library with FFT API not found. Please specify library location.") else() message(STATUS "A library with FFT API not found. Please specify library location.") endif() endif() if (FFT_LIBRARIES MATCHES "NOTFOUND$") set(FFT_LIBRARIES "") endif() if (FFT_INCLUDES MATCHES "NOTFOUND$") set(FFT_INCLUDES "") endif() mark_as_advanced (FFT_LIBRARIES FFT_INCLUDES) itpp-4.3.1/cmake/Modules/FindLAPACK.cmake000066400000000000000000000261701216575753400177460ustar00rootroot00000000000000# - Find LAPACK library # This module finds an installed fortran library that implements the LAPACK # linear-algebra interface (see http://www.netlib.org/lapack/). # # The approach follows that taken for the autoconf macro file, acx_lapack.m4 # (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). # # This module sets the following variables: # LAPACK_FOUND - set to true if a library implementing the LAPACK interface # is found # LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l # and -L). # LAPACK_LIBRARIES - uncached list of libraries (using full path name) to # link against to use LAPACK # LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to # link against to use LAPACK95 # LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 # interface is found # BLA_STATIC if set on this determines what kind of linkage we do (static) # BLA_VENDOR if set checks only the specified vendor, if not set checks # all the possibilities # BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK ### List of vendors (BLA_VENDOR) valid in this module ## Intel(mkl), ACML,Apple, NAS, Generic #============================================================================= # Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) if (NOT _LANGUAGES_ MATCHES Fortran) include(CheckFunctionExists) else (NOT _LANGUAGES_ MATCHES Fortran) include(CheckFortranFunctionExists) endif (NOT _LANGUAGES_ MATCHES Fortran) set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) # TODO: move this stuff to separate module macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads) # This macro checks for the existence of the combination of fortran libraries # given by _list. If the combination is found, this macro checks (using the # Check_Fortran_Function_Exists macro) whether can link against that library # combination using the name of a routine given by _name using the linker # flags given by _flags. If the combination of libraries is found and passes # the link test, LIBRARIES is set to the list of complete library paths that # have been found. Otherwise, LIBRARIES is set to FALSE. # N.B. _prefix is the prefix applied to the names of all cached variables that # are generated internally and marked advanced by this macro. set(_libraries_work TRUE) set(${LIBRARIES}) set(_combined_name) if (NOT _libdir) if (WIN32) set(_libdir $ENV{LIB}) elseif (APPLE) set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 $ENV{DYLD_LIBRARY_PATH}) else () set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 $ENV{LD_LIBRARY_PATH}) endif () endif () foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) if(_libraries_work) if (BLA_STATIC) if (WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif ( WIN32 ) if (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) else (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif (APPLE) else (BLA_STATIC) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () endif (BLA_STATIC) find_library(${_prefix}_${_library}_LIBRARY NAMES ${_library} PATHS ${_libdir} ) mark_as_advanced(${_prefix}_${_library}_LIBRARY) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) endif(_libraries_work) endforeach(_library ${_list}) if(_libraries_work) # Test this combination of libraries. if(UNIX AND BLA_STATIC) set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) else(UNIX AND BLA_STATIC) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) endif(UNIX AND BLA_STATIC) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (NOT _LANGUAGES_ MATCHES Fortran) if (BLA_VENDOR MATCHES "Intel11*") #MKL 11 check_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else () check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) endif() else (NOT _LANGUAGES_ MATCHES Fortran) check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) endif (NOT _LANGUAGES_ MATCHES Fortran) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endif(_libraries_work) if(_libraries_work) set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) else(_libraries_work) set(${LIBRARIES} FALSE) endif(_libraries_work) endmacro(Check_Lapack_Libraries) set(LAPACK_LINKER_FLAGS) set(LAPACK_LIBRARIES) set(LAPACK95_LIBRARIES) if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_package(BLAS) else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_package(BLAS REQUIRED) endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) if(BLAS_FOUND) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) if ($ENV{BLA_VENDOR} MATCHES ".+") set(BLA_VENDOR $ENV{BLA_VENDOR}) else ($ENV{BLA_VENDOR} MATCHES ".+") if(NOT BLA_VENDOR) set(BLA_VENDOR "All") endif(NOT BLA_VENDOR) endif ($ENV{BLA_VENDOR} MATCHES ".+") if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "goto2" "${BLAS_LIBRARIES}" "" ) endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") #acml lapack if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") if (BLAS_LIBRARIES MATCHES ".+acml.+") set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif () endif () # Apple LAPACK library? if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "Accelerate" "${BLAS_LIBRARIES}" "" ) endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") if ( NOT LAPACK_LIBRARIES ) check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "vecLib" "${BLAS_LIBRARIES}" "" ) endif ( NOT LAPACK_LIBRARIES ) endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") # Generic LAPACK library? if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if (BLA_STATIC) set(_flags "gfortran;m")#needed by itpp-external else() set(_flags " ") endif() if ( NOT LAPACK_LIBRARIES ) check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev ${_flags} "lapack" "${BLAS_LIBRARIES}" "" ) endif ( NOT LAPACK_LIBRARIES ) endif () #intel lapack if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") if (NOT WIN32) set(LM "-lm") endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_PACKAGE(Threads) else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_package(Threads REQUIRED) endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) if (BLA_F95) if(NOT LAPACK95_LIBRARIES) # old check_lapack_libraries( LAPACK95_LIBRARIES LAPACK cheev "" "mkl_lapack95" "${BLAS95_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT LAPACK95_LIBRARIES) if(NOT LAPACK95_LIBRARIES) # new >= 10.3 check_lapack_libraries( LAPACK95_LIBRARIES LAPACK CHEEV "" "mkl_intel_lp64" "${BLAS95_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT LAPACK95_LIBRARIES) else(BLA_F95) if(NOT LAPACK_LIBRARIES) # old check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "mkl_lapack" "${BLAS_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT LAPACK_LIBRARIES) if(NOT LAPACK_LIBRARIES) # new >= 10.3 check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "mkl_gf_lp64" "${BLAS_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT LAPACK_LIBRARIES) if(NOT LAPACK_LIBRARIES) # new >= 11 check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "mkl_rt" "${BLAS_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif() endif(BLA_F95) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FOUND) message(STATUS "LAPACK requires BLAS") endif(BLAS_FOUND) if(BLA_F95) if(LAPACK95_LIBRARIES) set(LAPACK95_FOUND TRUE) else(LAPACK95_LIBRARIES) set(LAPACK95_FOUND FALSE) endif(LAPACK95_LIBRARIES) if(NOT LAPACK_FIND_QUIETLY) if(LAPACK95_FOUND) message(STATUS "A library with LAPACK95 API found.") else(LAPACK95_FOUND) if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR "A required library with LAPACK95 API not found. Please specify library location." ) else(LAPACK_FIND_REQUIRED) message(STATUS "A library with LAPACK95 API not found. Please specify library location." ) endif(LAPACK_FIND_REQUIRED) endif(LAPACK95_FOUND) endif(NOT LAPACK_FIND_QUIETLY) set(LAPACK_FOUND "${LAPACK95_FOUND}") set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") else(BLA_F95) if(LAPACK_LIBRARIES) set(LAPACK_FOUND TRUE) else(LAPACK_LIBRARIES) set(LAPACK_FOUND FALSE) endif(LAPACK_LIBRARIES) if(NOT LAPACK_FIND_QUIETLY) if(LAPACK_FOUND) message(STATUS "A library with LAPACK API found.") else(LAPACK_FOUND) if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR "A required library with LAPACK API not found. Please specify library location." ) else(LAPACK_FIND_REQUIRED) message(STATUS "A library with LAPACK API not found. Please specify library location." ) endif(LAPACK_FIND_REQUIRED) endif(LAPACK_FOUND) endif(NOT LAPACK_FIND_QUIETLY) endif(BLA_F95) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) itpp-4.3.1/configure.ac.in000066400000000000000000000322371216575753400154140ustar00rootroot00000000000000# Process this file with autoconf to produce a configure script #------------------------------------------------------------------- AC_PREREQ([2.60]) AC_INIT([IT++],[@PACKAGE_VERSION@],[http://sourceforge.net/projects/itpp/forums/forum/115656],[itpp]) AC_COPYRIGHT([ Copyright (C) 2006-2010 Adam Piatyszek This file is part of IT++ - a C++ library of mathematical, signal processing, speech processing, and communications classes and functions. IT++ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. IT++ 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 General Public License for more details. You should have received a copy of the GNU General Public License along with IT++. If not, see . ]) AC_CONFIG_HEADER([itpp/config.h]) AC_CONFIG_SRCDIR([itpp/base/vec.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([-Wall -Werror]) # Shared library versioning GENERIC_LIBRARY_VERSION="@LIBRARY_VERSION@" # | | | # +------+ | +---+ # | | | # current:revision:age # | | | # | | +- increment if interfaces have been added; # | | set to zero if interfaces have been # | | removed or changed # | +- increment if source code has changed; # | set to zero if current is incremented # +- increment if interfaces have been added, removed # or changed AC_SUBST(GENERIC_LIBRARY_VERSION) # Check for host and disable building a shared library in Windows AC_CANONICAL_HOST case $host_os in cygwin* | mingw*) AC_DISABLE_SHARED AC_ENABLE_STATIC if test "x$enable_shared" = xyes; then NO_UNDEFINED="-no-undefined" AC_SUBST(NO_UNDEFINED) fi ;; freebsd5* | freebsd6*) AC_ENABLE_SHARED AC_DISABLE_STATIC freebsd_broken_std_isnan=yes ;; darwin*) AC_ENABLE_SHARED AC_DISABLE_STATIC enable_explicit_deps=yes ;; *) AC_ENABLE_SHARED AC_DISABLE_STATIC ;; esac # Checks for programs save_CXXFLAGS="$CXXFLAGS" AC_PROG_CXX AC_PROG_CXXCPP CXXFLAGS="$save_CXXFLAGS" AC_PROG_F77 AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_LN_S AC_PROG_SED # See whether to include shared library dependencies (taken from gtk+) AC_ARG_ENABLE(explicit-deps, [AS_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@], [use explicit dependencies in .pc files [default=auto]])],, [enable_explicit_deps=auto]) AC_MSG_CHECKING([whether to use explicit library dependencies]) case $enable_explicit_deps in auto) if test "x$lt_cv_deplibs_check_method" != xpass_all || \ test "x$enable_shared" = xno; then enable_explicit_deps=yes else enable_explicit_deps=no fi ;; yes|no) ;; *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto]) ;; esac AC_MSG_RESULT($enable_explicit_deps) # Set default language to C++ AC_LANG([C++]) # Check for debug switch AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [build additional debugging library])]) test "x$enable_debug" != xyes && enable_debug=no AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = xyes]) # Check for exceptions switch AC_ARG_ENABLE(exceptions, [AS_HELP_STRING([--enable-exceptions], [enable exceptions handling mechanizm])], [AC_DEFINE([ITPP_EXCEPTIONS], [1], [Define if you want exceptions handling])]) test "x$enable_exceptions" != xyes && enable_exceptions=no # Check for html-doc switch AC_ARG_ENABLE(html-doc, [AS_HELP_STRING([--disable-html-doc], [do not generate HTML documentation])]) test "x$enable_html_doc" != xno && enable_html_doc=yes # Check for optional modules AC_ARG_ENABLE(comm, [AS_HELP_STRING([--disable-comm], [do not include communications module])]) AC_ARG_ENABLE(fixed, [AS_HELP_STRING([--disable-fixed], [do not include fixed-point module])]) AC_ARG_ENABLE(optim, [AS_HELP_STRING([--disable-optim], [do not include optimization module])]) AC_ARG_ENABLE(protocol, [AS_HELP_STRING([--disable-protocol], [do not include protocol module])]) AC_ARG_ENABLE(signal, [AS_HELP_STRING([--disable-signal], [do not include signal processing module])]) AC_ARG_ENABLE(srccode, [AS_HELP_STRING([--disable-srccode], [do not include source coding module])]) test "x$enable_fixed" != xno && enable_fixed=yes test "x$enable_optim" != xno && enable_optim=yes test "x$enable_protocol" != xno && enable_protocol=yes test "x$enable_signal" != xno && enable_signal=yes if test "x$enable_comm" != xno; then enable_signal=yes enable_comm=yes fi if test "x$enable_srccode" != xno; then enable_signal=yes enable_srccode=yes fi AM_CONDITIONAL([ENABLE_COMM], [test "x$enable_comm" = xyes]) AM_CONDITIONAL([ENABLE_FIXED], [test "x$enable_fixed" = xyes]) AM_CONDITIONAL([ENABLE_OPTIM], [test "x$enable_optim" = xyes]) AM_CONDITIONAL([ENABLE_PROTOCOL], [test "x$enable_protocol" = xyes]) AM_CONDITIONAL([ENABLE_SIGNAL], [test "x$enable_signal" = xyes]) AM_CONDITIONAL([ENABLE_SRCCODE], [test "x$enable_srccode" = xyes]) # Set optimised flags if test "x$CXXFLAGS" = x; then CXXFLAGS_OPT="-DNDEBUG -O3" # Only for GCC compiler if test "x$GXX" = xyes; then CXXFLAGS_OPT="$CXXFLAGS_OPT -pipe" fi else CXXFLAGS_OPT="$CXXFLAGS" CXXFLAGS="" fi # Remove redundant whitespace CXXFLAGS_OPT="`echo \"$CXXFLAGS_OPT\" | $SED -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`" AC_SUBST(CXXFLAGS_OPT) # Set debugging flags if test "x$CXXFLAGS_DEBUG" = x; then # Only for GCC compiler if test "x$GXX" = xyes; then CXXFLAGS_DEBUG="-Wall -ggdb -pipe" else CXXFLAGS_DEBUG="-g" fi fi # Remove redundant whitespace CXXFLAGS_DEBUG="`echo \"$CXXFLAGS_DEBUG\" | $SED -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`" AC_ARG_VAR(CXXFLAGS_DEBUG, [C++ compiler flags for the debugging library]) # Set debugging library name if test "x$enable_debug" = xyes; then PACKAGE_DEBUG="$PACKAGE"_debug else PACKAGE_DEBUG="$PACKAGE" fi AC_SUBST(PACKAGE_DEBUG) # Checks for documentation build tools AC_CHECK_PROG([doxygen_ok], [doxygen], [yes], [no]) AC_CHECK_PROG([latex_ok], [latex], [yes], [no]) AC_CHECK_PROG([dvips_ok], [dvips], [yes], [no]) AC_CHECK_PROG([gs_ok], [gs], [yes], [no]) if test "x$enable_html_doc" != xno; then test "x$doxygen_ok" != xyes && enable_html_doc=no test "x$latex_ok" != xyes && enable_html_doc=no test "x$dvips_ok" != xyes && enable_html_doc=no test "x$gs_ok" != xyes && enable_html_doc=no AC_PATH_PROG([PERL], [perl], []) fi AM_CONDITIONAL([HTML_DOC], [test "x$enable_html_doc" = xyes]) # Check for diff program used for tests AC_PATH_PROGS(DIFF, [gdiff gnudiff diff], [no]) diff_ok=no test "$DIFF" != no && diff_ok=yes AM_CONDITIONAL([RUN_TESTS], [test "$DIFF" != no]) # Checks for header files AC_HEADER_TIME AC_CHECK_HEADERS([cmath \ complex \ ieeefp.h]) # Checks for global declarations AC_CHECK_DECLS([signgam, isfinite, isinf, isnan],,, [#if defined(HAVE_CMATH) # include #endif #if defined(HAVE_IEEEFP_H) # include #endif ]) # Check for isfinite, isnan and isinf in std namespace # except FreeBSD 5-6, where these functions are broken if test "x$freebsd_broken_std_isnan" != xyes; then for f in std::isfinite std::isinf std::isnan; do AC_MSG_CHECKING([for $f]) AC_LINK_IFELSE([AC_LANG_SOURCE( [[#include int main() { return $f(0.7) ? 1 : 0; } ]])], [AC_MSG_RESULT([yes]) if test $f = "std::isfinite"; then AC_DEFINE(HAVE_STD_ISFINITE, 1, [Define to 1 if you have the `std::isfinite' function.]) elif test $f = "std::isinf"; then AC_DEFINE(HAVE_STD_ISINF, 1, [Define to 1 if you have the `std::isinf' function.]) elif test $f = "std::isnan"; then AC_DEFINE(HAVE_STD_ISNAN, 1, [Define to 1 if you have the `std::isnan' function.]) fi], [AC_MSG_RESULT([no])]) done fi # Checks for functions AC_CHECK_FUNCS([asinh \ acosh \ atanh \ cbrt \ erf \ erfc \ expm1 \ finite \ fpclass \ isfinite \ isinf \ isnan \ lgamma \ log1p \ log2 \ rint \ tgamma]) # If we have a Fortran compiler if test "x$F77" != x; then # Check for additional libs required for linking C/C++ with Fortran AC_F77_LIBRARY_LDFLAGS # Clean up -L/../.. paths from FLIBS MY_FLIBS="`echo \"$FLIBS\" | sed 's/-L[[^ ]]* //g'`" # Check for a Fortran name mangling scheme AC_F77_FUNC(sgemm) AC_F77_FUNC(dgemm) AC_F77_FUNC(cheev) fi # Checks for BLAS (ACML, MKL, ATLAS or NetLib's reference) ACX_BLAS # Checks for LAPACK (ACML, MKL, ATLAS or NetLib's reference) ACX_LAPACK # Checks for FFT (ACML, MKL or FFTW3) ACX_FFT # Set LIBS test "x$BLAS_LIBS" != x && LIBS="$BLAS_LIBS $LIBS" test "x$LAPACK_LIBS" != x && LIBS="$LAPACK_LIBS $LIBS" test "x$FFT_LIBS" != x && LIBS="$FFT_LIBS $LIBS" # Remove unnecesary white spaces from CPPFLAGS, LDFLAGS and LIBS CPPFLAGS="`echo \"$CPPFLAGS\" | sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`" LDFLAGS="`echo \"$LDFLAGS\" | sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`" LIBS="`echo \"$LIBS\" | sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`" LDLIBS="`echo \"$LDFLAGS $LIBS\" | sed -e 's/^ //' -e 's/ $//'`" if test $enable_explicit_deps = yes; then EXPLICIT_LIBS=" $LDLIBS" # the leading space is important here... PRIVATE_LIBS="" else EXPLICIT_LIBS="" PRIVATE_LIBS=" $LDLIBS" # ... and also here! fi AC_SUBST(EXPLICIT_LIBS) AC_SUBST(PRIVATE_LIBS) # Set conditionals for runing test programs AM_CONDITIONAL([RUN_LAPACK_TESTS], [test "x$acx_lapack_ok" = xyes]) AM_CONDITIONAL([RUN_FFT_TESTS], [test "x$acx_fft_ok" = xyes]) # config.h top and bottom AH_TOP([ #ifndef CONFIG_H #define CONFIG_H ]) AH_BOTTOM([ #if defined(HAVE_CMATH) # include #endif #endif /* #ifndef CONFIG_H */ ]) # Define configured files AC_CONFIG_FILES([Makefile \ itpp/Makefile \ itpp/base/Makefile \ itpp/base/algebra/Makefile \ itpp/base/bessel/Makefile \ itpp/base/math/Makefile \ itpp/comm/Makefile \ itpp/fixed/Makefile \ itpp/optim/Makefile \ itpp/protocol/Makefile \ itpp/signal/Makefile \ itpp/srccode/Makefile \ itpp/stat/Makefile \ doc/Makefile \ doc/images/Makefile \ doc/tutorial/Makefile \ doc/tutorial/src/Makefile \ doc/local/Makefile \ doc/local/index.doc \ doc/doxygen_html.cfg \ extras/Makefile \ tests/Makefile \ win32/Makefile \ win32/itpp_acml_tests/Makefile \ win32/itpp_mkl_tests/Makefile \ itpp.pc \ itpp_debug.pc \ itpp-config]) AC_OUTPUT # Display configuration summary AC_MSG_NOTICE([displaying configuration summary ------------------------------------------------------------------------------ $PACKAGE-$VERSION library configuration: ------------------------------------------------------------------------------ Directories: - prefix ......... : ${prefix} - exec_prefix .... : ${exec_prefix} - includedir ..... : ${includedir} - libdir ......... : ${libdir} - datarootdir .... : ${datarootdir} - docdir ......... : ${docdir} Switches: - debug .......... : ${enable_debug} - exceptions ..... : ${enable_exceptions} - html-doc ....... : ${enable_html_doc} - shared ......... : ${enable_shared} - static ......... : ${enable_static} - explicit deps .. : ${enable_explicit_deps} Documentation tools: - doxygen ........ : ${doxygen_ok} - latex .......... : ${latex_ok} - dvips .......... : ${dvips_ok} - ghostscript .... : ${gs_ok} Testing tools: - diff ........... : ${diff_ok} Optional modules: - comm ........... : ${enable_comm} - fixed .......... : ${enable_fixed} - optim .......... : ${enable_optim} - protocol ....... : ${enable_protocol} - signal ......... : ${enable_signal} - srccode ........ : ${enable_srccode} External libs: - BLAS ........... : ${acx_blas_ok} * MKL .......... : ${blas_mkl_ok} * ACML ......... : ${blas_acml_ok} * ATLAS ........ : ${blas_atlas_ok} - LAPACK ......... : ${acx_lapack_ok} - FFT ............ : ${acx_fft_ok} * MKL .......... : ${fft_mkl_ok} * ACML ......... : ${fft_acml_ok} * FFTW ......... : ${fftw3_ok} Compiler/linker flags/libs/defs: - CXX ............ : ${CXX} - F77 ............ : ${F77} - CXXFLAGS ....... : ${CXXFLAGS_OPT} - CXXFLAGS_DEBUG . : ${CXXFLAGS_DEBUG} - CPPFLAGS ....... : ${CPPFLAGS} - LDFLAGS ........ : ${LDFLAGS} - LIBS ........... : ${LIBS} ------------------------------------------------------------------------------ Now type 'make && make install' to build and install $PACKAGE-$VERSION library ------------------------------------------------------------------------------ ]) itpp-4.3.1/doc/000077500000000000000000000000001216575753400132575ustar00rootroot00000000000000itpp-4.3.1/doc/Makefile.am000066400000000000000000000041511216575753400153140ustar00rootroot00000000000000include $(top_srcdir)/doc/local/sources.mk include $(top_srcdir)/doc/tutorial/sources.mk include $(top_srcdir)/itpp/sources.mk include $(top_srcdir)/itpp/base/sources.mk include $(top_srcdir)/itpp/base/algebra/sources.mk include $(top_srcdir)/itpp/base/math/sources.mk include $(top_srcdir)/itpp/comm/sources.mk include $(top_srcdir)/itpp/fixed/sources.mk include $(top_srcdir)/itpp/optim/sources.mk include $(top_srcdir)/itpp/protocol/sources.mk include $(top_srcdir)/itpp/signal/sources.mk include $(top_srcdir)/itpp/srccode/sources.mk include $(top_srcdir)/itpp/stat/sources.mk SUBDIRS = images tutorial local distdir_html = @PACKAGE@-html-doc-@VERSION@ all-local: html-local html-local: html/index.html html/index.html: doxygen_html.cfg \ $(doc_local_sources) $(html_local_sources) \ $(doc_tutorial_sources) \ $(h_sources) $(cpp_sources) \ $(h_base_sources) $(cpp_base_sources) \ $(h_base_algebra_sources) $(cpp_base_algebra_sources) \ $(h_base_math_sources) $(cpp_base_math_sources) \ $(h_comm_sources) $(cpp_comm_sources) \ $(h_fixed_sources) $(cpp_fixed_sources) \ $(h_optim_sources) $(cpp_optim_sources) \ $(h_protocol_sources) $(cpp_protocol_sources) \ $(h_signal_sources) $(cpp_signal_sources) \ $(h_srccode_sources) $(cpp_srccode_sources) \ $(h_stat_sources) $(cpp_stat_sources) doxygen $<; \ if test -d html; then \ cp $(srcdir)/images/itpp_logo.png html; \ cp $(srcdir)/images/favicon.ico html; \ fi dist-html: html-local cp -a $(top_builddir)/doc/html $(top_builddir)/$(distdir_html) tar chof - $(top_builddir)/$(distdir_html) | \ gzip --best -c > $(top_builddir)/$(distdir_html).tar.gz tar chof - $(top_builddir)/$(distdir_html) | \ bzip2 -9 -c > $(top_builddir)/$(distdir_html).tar.bz2 rm -rf $(top_builddir)/$(distdir_html) install-data-local: html-local if test -d html; then \ $(mkinstalldirs) $(DESTDIR)$(docdir); \ for d in `find html -type d`; do \ $(mkinstalldirs) $(DESTDIR)$(docdir)/$$d; \ done; \ for f in `find html -type f`; do \ $(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f; \ done \ fi uninstall-local: rm -rf $(DESTDIR)$(docdir) clean-local: rm -rf html *.log *.tag itpp-4.3.1/doc/Makefile.in000066400000000000000000001007031216575753400153250ustar00rootroot00000000000000# Makefile.in generated by automake 1.12.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/doxygen_html.cfg.in \ $(top_srcdir)/doc/local/sources.mk \ $(top_srcdir)/doc/tutorial/sources.mk \ $(top_srcdir)/itpp/base/algebra/sources.mk \ $(top_srcdir)/itpp/base/math/sources.mk \ $(top_srcdir)/itpp/base/sources.mk \ $(top_srcdir)/itpp/comm/sources.mk \ $(top_srcdir)/itpp/fixed/sources.mk \ $(top_srcdir)/itpp/optim/sources.mk \ $(top_srcdir)/itpp/protocol/sources.mk \ $(top_srcdir)/itpp/signal/sources.mk \ $(top_srcdir)/itpp/sources.mk \ $(top_srcdir)/itpp/srccode/sources.mk \ $(top_srcdir)/itpp/stat/sources.mk @ENABLE_COMM_TRUE@am__append_1 = $(top_srcdir)/itpp/itcomm.h @ENABLE_FIXED_TRUE@am__append_2 = $(top_srcdir)/itpp/itfixed.h @ENABLE_OPTIM_TRUE@am__append_3 = $(top_srcdir)/itpp/itoptim.h @ENABLE_PROTOCOL_TRUE@am__append_4 = $(top_srcdir)/itpp/itprotocol.h @ENABLE_SIGNAL_TRUE@am__append_5 = $(top_srcdir)/itpp/itsignal.h @ENABLE_SRCCODE_TRUE@am__append_6 = $(top_srcdir)/itpp/itsrccode.h subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = doxygen_html.cfg CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ doc_local_sources = \ $(top_srcdir)/doc/local/authors.doc \ $(top_srcdir)/doc/local/codingrules.doc \ $(top_srcdir)/doc/local/copyright.doc \ $(top_srcdir)/doc/local/documentation.doc \ $(top_srcdir)/doc/local/features.doc \ $(top_srcdir)/doc/local/help_wanted.doc \ $(top_srcdir)/doc/local/installation.doc \ $(top_srcdir)/doc/local/linking.doc \ $(top_srcdir)/doc/local/test.doc \ $(top_srcdir)/doc/local/users_guide.doc \ $(top_srcdir)/doc/local/verification.doc html_local_sources = \ $(top_srcdir)/doc/local/itpp_footer.html \ $(top_srcdir)/doc/local/itpp_header.html doc_tutorial_sources = \ $(top_srcdir)/doc/tutorial/bpsk.doc \ $(top_srcdir)/doc/tutorial/convcode.doc \ $(top_srcdir)/doc/tutorial/interleaver.doc \ $(top_srcdir)/doc/tutorial/itfile.doc \ $(top_srcdir)/doc/tutorial/qpsk_simulation.doc \ $(top_srcdir)/doc/tutorial/rayleigh.doc \ $(top_srcdir)/doc/tutorial/reedsolomon.doc \ $(top_srcdir)/doc/tutorial/spread.doc \ $(top_srcdir)/doc/tutorial/timer.doc \ $(top_srcdir)/doc/tutorial/tutorial.doc \ $(top_srcdir)/doc/tutorial/vector_and_matrix.doc \ $(top_srcdir)/doc/tutorial/mimoconv.doc \ $(top_srcdir)/doc/tutorial/demapper_mimo.doc \ $(top_srcdir)/doc/tutorial/matlab_itpp.doc \ $(top_srcdir)/doc/tutorial/mog.doc \ $(top_srcdir)/doc/tutorial/ldpc_gen_codes.doc \ $(top_srcdir)/doc/tutorial/ldpc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/pccc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/exit_pccc.doc \ $(top_srcdir)/doc/tutorial/sccc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/turbo_equalizer_bersim_multipath.doc h_sources = $(top_srcdir)/itpp/itbase.h $(top_srcdir)/itpp/itstat.h \ $(top_srcdir)/itpp/itmex.h $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) \ $(am__append_6) noinst_h_base_sources = \ $(top_srcdir)/itpp/base/blas.h \ $(top_srcdir)/itpp/base/itcompat.h h_base_sources = \ $(top_srcdir)/itpp/base/array.h \ $(top_srcdir)/itpp/base/bessel.h \ $(top_srcdir)/itpp/base/binary.h \ $(top_srcdir)/itpp/base/binfile.h \ $(top_srcdir)/itpp/base/circular_buffer.h \ $(top_srcdir)/itpp/base/converters.h \ $(top_srcdir)/itpp/base/copy_vector.h \ $(top_srcdir)/itpp/base/factory.h \ $(top_srcdir)/itpp/base/fastmath.h \ $(top_srcdir)/itpp/base/gf2mat.h \ $(top_srcdir)/itpp/base/help_functions.h \ $(top_srcdir)/itpp/base/itassert.h \ $(top_srcdir)/itpp/base/itfile.h \ $(top_srcdir)/itpp/base/ittypes.h \ $(top_srcdir)/itpp/base/matfunc.h \ $(top_srcdir)/itpp/base/mat.h \ $(top_srcdir)/itpp/base/operators.h \ $(top_srcdir)/itpp/base/parser.h \ $(top_srcdir)/itpp/base/random.h \ $(top_srcdir)/itpp/base/random_dsfmt.h \ $(top_srcdir)/itpp/base/smat.h \ $(top_srcdir)/itpp/base/sort.h \ $(top_srcdir)/itpp/base/specmat.h \ $(top_srcdir)/itpp/base/stack.h \ $(top_srcdir)/itpp/base/svec.h \ $(top_srcdir)/itpp/base/timing.h \ $(top_srcdir)/itpp/base/vec.h cpp_base_sources = \ $(top_srcdir)/itpp/base/bessel.cpp \ $(top_srcdir)/itpp/base/binary.cpp \ $(top_srcdir)/itpp/base/binfile.cpp \ $(top_srcdir)/itpp/base/converters.cpp \ $(top_srcdir)/itpp/base/copy_vector.cpp \ $(top_srcdir)/itpp/base/fastmath.cpp \ $(top_srcdir)/itpp/base/gf2mat.cpp \ $(top_srcdir)/itpp/base/help_functions.cpp \ $(top_srcdir)/itpp/base/itassert.cpp \ $(top_srcdir)/itpp/base/itcompat.cpp \ $(top_srcdir)/itpp/base/itfile.cpp \ $(top_srcdir)/itpp/base/mat.cpp \ $(top_srcdir)/itpp/base/matfunc.cpp \ $(top_srcdir)/itpp/base/operators.cpp \ $(top_srcdir)/itpp/base/parser.cpp \ $(top_srcdir)/itpp/base/random.cpp \ $(top_srcdir)/itpp/base/smat.cpp \ $(top_srcdir)/itpp/base/specmat.cpp \ $(top_srcdir)/itpp/base/svec.cpp \ $(top_srcdir)/itpp/base/timing.cpp \ $(top_srcdir)/itpp/base/vec.cpp noinst_h_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/lapack.h h_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/cholesky.h \ $(top_srcdir)/itpp/base/algebra/det.h \ $(top_srcdir)/itpp/base/algebra/eigen.h \ $(top_srcdir)/itpp/base/algebra/inv.h \ $(top_srcdir)/itpp/base/algebra/ls_solve.h \ $(top_srcdir)/itpp/base/algebra/lu.h \ $(top_srcdir)/itpp/base/algebra/qr.h \ $(top_srcdir)/itpp/base/algebra/schur.h \ $(top_srcdir)/itpp/base/algebra/svd.h cpp_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/cholesky.cpp \ $(top_srcdir)/itpp/base/algebra/det.cpp \ $(top_srcdir)/itpp/base/algebra/eigen.cpp \ $(top_srcdir)/itpp/base/algebra/inv.cpp \ $(top_srcdir)/itpp/base/algebra/ls_solve.cpp \ $(top_srcdir)/itpp/base/algebra/lu.cpp \ $(top_srcdir)/itpp/base/algebra/qr.cpp \ $(top_srcdir)/itpp/base/algebra/schur.cpp \ $(top_srcdir)/itpp/base/algebra/svd.cpp h_base_math_sources = \ $(top_srcdir)/itpp/base/math/elem_math.h \ $(top_srcdir)/itpp/base/math/error.h \ $(top_srcdir)/itpp/base/math/integration.h \ $(top_srcdir)/itpp/base/math/log_exp.h \ $(top_srcdir)/itpp/base/math/min_max.h \ $(top_srcdir)/itpp/base/math/misc.h \ $(top_srcdir)/itpp/base/math/trig_hyp.h cpp_base_math_sources = \ $(top_srcdir)/itpp/base/math/elem_math.cpp \ $(top_srcdir)/itpp/base/math/error.cpp \ $(top_srcdir)/itpp/base/math/integration.cpp \ $(top_srcdir)/itpp/base/math/log_exp.cpp \ $(top_srcdir)/itpp/base/math/misc.cpp \ $(top_srcdir)/itpp/base/math/trig_hyp.cpp h_comm_sources = \ $(top_srcdir)/itpp/comm/bch.h \ $(top_srcdir)/itpp/comm/channel_code.h \ $(top_srcdir)/itpp/comm/channel.h \ $(top_srcdir)/itpp/comm/commfunc.h \ $(top_srcdir)/itpp/comm/convcode.h \ $(top_srcdir)/itpp/comm/crc.h \ $(top_srcdir)/itpp/comm/egolay.h \ $(top_srcdir)/itpp/comm/error_counters.h \ $(top_srcdir)/itpp/comm/exit.h \ $(top_srcdir)/itpp/comm/galois.h \ $(top_srcdir)/itpp/comm/hammcode.h \ $(top_srcdir)/itpp/comm/interleave.h \ $(top_srcdir)/itpp/comm/ldpc.h \ $(top_srcdir)/itpp/comm/llr.h \ $(top_srcdir)/itpp/comm/modulator.h \ $(top_srcdir)/itpp/comm/modulator_nd.h \ $(top_srcdir)/itpp/comm/ofdm.h \ $(top_srcdir)/itpp/comm/pulse_shape.h \ $(top_srcdir)/itpp/comm/punct_convcode.h \ $(top_srcdir)/itpp/comm/rec_syst_conv_code.h \ $(top_srcdir)/itpp/comm/reedsolomon.h \ $(top_srcdir)/itpp/comm/sequence.h \ $(top_srcdir)/itpp/comm/siso.h \ $(top_srcdir)/itpp/comm/spread.h \ $(top_srcdir)/itpp/comm/stc.h \ $(top_srcdir)/itpp/comm/turbo.h cpp_comm_sources = \ $(top_srcdir)/itpp/comm/bch.cpp \ $(top_srcdir)/itpp/comm/channel.cpp \ $(top_srcdir)/itpp/comm/commfunc.cpp \ $(top_srcdir)/itpp/comm/convcode.cpp \ $(top_srcdir)/itpp/comm/crc.cpp \ $(top_srcdir)/itpp/comm/egolay.cpp \ $(top_srcdir)/itpp/comm/error_counters.cpp \ $(top_srcdir)/itpp/comm/exit.cpp \ $(top_srcdir)/itpp/comm/galois.cpp \ $(top_srcdir)/itpp/comm/hammcode.cpp \ $(top_srcdir)/itpp/comm/interleave.cpp \ $(top_srcdir)/itpp/comm/ldpc.cpp \ $(top_srcdir)/itpp/comm/llr.cpp \ $(top_srcdir)/itpp/comm/modulator.cpp \ $(top_srcdir)/itpp/comm/modulator_nd.cpp \ $(top_srcdir)/itpp/comm/ofdm.cpp \ $(top_srcdir)/itpp/comm/pulse_shape.cpp \ $(top_srcdir)/itpp/comm/punct_convcode.cpp \ $(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp \ $(top_srcdir)/itpp/comm/reedsolomon.cpp \ $(top_srcdir)/itpp/comm/sequence.cpp \ $(top_srcdir)/itpp/comm/siso_dem.cpp \ $(top_srcdir)/itpp/comm/siso_eq.cpp \ $(top_srcdir)/itpp/comm/siso_mud.cpp \ $(top_srcdir)/itpp/comm/siso_nsc.cpp \ $(top_srcdir)/itpp/comm/siso_rsc.cpp \ $(top_srcdir)/itpp/comm/spread.cpp \ $(top_srcdir)/itpp/comm/stc.cpp \ $(top_srcdir)/itpp/comm/turbo.cpp h_fixed_sources = \ $(top_srcdir)/itpp/fixed/cfixed.h \ $(top_srcdir)/itpp/fixed/cfix.h \ $(top_srcdir)/itpp/fixed/fix_base.h \ $(top_srcdir)/itpp/fixed/fixed.h \ $(top_srcdir)/itpp/fixed/fix_factory.h \ $(top_srcdir)/itpp/fixed/fix_functions.h \ $(top_srcdir)/itpp/fixed/fix.h \ $(top_srcdir)/itpp/fixed/fix_operators.h cpp_fixed_sources = \ $(top_srcdir)/itpp/fixed/cfix.cpp \ $(top_srcdir)/itpp/fixed/cfixed.cpp \ $(top_srcdir)/itpp/fixed/fix_base.cpp \ $(top_srcdir)/itpp/fixed/fix.cpp \ $(top_srcdir)/itpp/fixed/fixed.cpp \ $(top_srcdir)/itpp/fixed/fix_factory.cpp \ $(top_srcdir)/itpp/fixed/fix_functions.cpp \ $(top_srcdir)/itpp/fixed/fix_operators.cpp h_optim_sources = \ $(top_srcdir)/itpp/optim/newton_search.h cpp_optim_sources = \ $(top_srcdir)/itpp/optim/newton_search.cpp h_protocol_sources = \ $(top_srcdir)/itpp/protocol/events.h \ $(top_srcdir)/itpp/protocol/front_drop_queue.h \ $(top_srcdir)/itpp/protocol/packet_channel.h \ $(top_srcdir)/itpp/protocol/packet_generator.h \ $(top_srcdir)/itpp/protocol/packet.h \ $(top_srcdir)/itpp/protocol/selective_repeat.h \ $(top_srcdir)/itpp/protocol/signals_slots.h \ $(top_srcdir)/itpp/protocol/tcp_client_server.h \ $(top_srcdir)/itpp/protocol/tcp.h cpp_protocol_sources = \ $(top_srcdir)/itpp/protocol/events.cpp \ $(top_srcdir)/itpp/protocol/front_drop_queue.cpp \ $(top_srcdir)/itpp/protocol/packet_channel.cpp \ $(top_srcdir)/itpp/protocol/packet_generator.cpp \ $(top_srcdir)/itpp/protocol/selective_repeat.cpp \ $(top_srcdir)/itpp/protocol/tcp.cpp h_signal_sources = \ $(top_srcdir)/itpp/signal/fastica.h \ $(top_srcdir)/itpp/signal/filter_design.h \ $(top_srcdir)/itpp/signal/filter.h \ $(top_srcdir)/itpp/signal/freq_filt.h \ $(top_srcdir)/itpp/signal/poly.h \ $(top_srcdir)/itpp/signal/resampling.h \ $(top_srcdir)/itpp/signal/sigfun.h \ $(top_srcdir)/itpp/signal/source.h \ $(top_srcdir)/itpp/signal/transforms.h \ $(top_srcdir)/itpp/signal/window.h cpp_signal_sources = \ $(top_srcdir)/itpp/signal/fastica.cpp \ $(top_srcdir)/itpp/signal/filter_design.cpp \ $(top_srcdir)/itpp/signal/filter.cpp \ $(top_srcdir)/itpp/signal/freq_filt.cpp \ $(top_srcdir)/itpp/signal/poly.cpp \ $(top_srcdir)/itpp/signal/resampling.cpp \ $(top_srcdir)/itpp/signal/sigfun.cpp \ $(top_srcdir)/itpp/signal/source.cpp \ $(top_srcdir)/itpp/signal/transforms.cpp \ $(top_srcdir)/itpp/signal/window.cpp h_srccode_sources = \ $(top_srcdir)/itpp/srccode/audiofile.h \ $(top_srcdir)/itpp/srccode/gmm.h \ $(top_srcdir)/itpp/srccode/lpcfunc.h \ $(top_srcdir)/itpp/srccode/pnm.h \ $(top_srcdir)/itpp/srccode/vq.h \ $(top_srcdir)/itpp/srccode/vqtrain.h cpp_srccode_sources = \ $(top_srcdir)/itpp/srccode/audiofile.cpp \ $(top_srcdir)/itpp/srccode/gmm.cpp \ $(top_srcdir)/itpp/srccode/lpcfunc.cpp \ $(top_srcdir)/itpp/srccode/pnm.cpp \ $(top_srcdir)/itpp/srccode/vq.cpp \ $(top_srcdir)/itpp/srccode/vqtrain.cpp h_stat_sources = \ $(top_srcdir)/itpp/stat/histogram.h \ $(top_srcdir)/itpp/stat/misc_stat.h \ $(top_srcdir)/itpp/stat/mog_diag.h \ $(top_srcdir)/itpp/stat/mog_diag_em.h \ $(top_srcdir)/itpp/stat/mog_diag_kmeans.h \ $(top_srcdir)/itpp/stat/mog_generic.h cpp_stat_sources = \ $(top_srcdir)/itpp/stat/misc_stat.cpp \ $(top_srcdir)/itpp/stat/mog_diag.cpp \ $(top_srcdir)/itpp/stat/mog_diag_em.cpp \ $(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp \ $(top_srcdir)/itpp/stat/mog_generic.cpp SUBDIRS = images tutorial local distdir_html = @PACKAGE@-html-doc-@VERSION@ all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/doc/local/sources.mk $(top_srcdir)/doc/tutorial/sources.mk $(top_srcdir)/itpp/sources.mk $(top_srcdir)/itpp/base/sources.mk $(top_srcdir)/itpp/base/algebra/sources.mk $(top_srcdir)/itpp/base/math/sources.mk $(top_srcdir)/itpp/comm/sources.mk $(top_srcdir)/itpp/fixed/sources.mk $(top_srcdir)/itpp/optim/sources.mk $(top_srcdir)/itpp/protocol/sources.mk $(top_srcdir)/itpp/signal/sources.mk $(top_srcdir)/itpp/srccode/sources.mk $(top_srcdir)/itpp/stat/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/doc/local/sources.mk $(top_srcdir)/doc/tutorial/sources.mk $(top_srcdir)/itpp/sources.mk $(top_srcdir)/itpp/base/sources.mk $(top_srcdir)/itpp/base/algebra/sources.mk $(top_srcdir)/itpp/base/math/sources.mk $(top_srcdir)/itpp/comm/sources.mk $(top_srcdir)/itpp/fixed/sources.mk $(top_srcdir)/itpp/optim/sources.mk $(top_srcdir)/itpp/protocol/sources.mk $(top_srcdir)/itpp/signal/sources.mk $(top_srcdir)/itpp/srccode/sources.mk $(top_srcdir)/itpp/stat/sources.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): doxygen_html.cfg: $(top_builddir)/config.status $(srcdir)/doxygen_html.cfg.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done cscopelist-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile all-local installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: html-local info: info-recursive info-am: install-data-am: install-data-local install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-local .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ cscopelist-recursive ctags-recursive install-am install-strip \ tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am all-local check check-am clean clean-generic \ clean-libtool clean-local cscopelist cscopelist-recursive \ ctags ctags-recursive distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am html-local info info-am install install-am \ install-data install-data-am install-data-local install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-local all-local: html-local html-local: html/index.html html/index.html: doxygen_html.cfg \ $(doc_local_sources) $(html_local_sources) \ $(doc_tutorial_sources) \ $(h_sources) $(cpp_sources) \ $(h_base_sources) $(cpp_base_sources) \ $(h_base_algebra_sources) $(cpp_base_algebra_sources) \ $(h_base_math_sources) $(cpp_base_math_sources) \ $(h_comm_sources) $(cpp_comm_sources) \ $(h_fixed_sources) $(cpp_fixed_sources) \ $(h_optim_sources) $(cpp_optim_sources) \ $(h_protocol_sources) $(cpp_protocol_sources) \ $(h_signal_sources) $(cpp_signal_sources) \ $(h_srccode_sources) $(cpp_srccode_sources) \ $(h_stat_sources) $(cpp_stat_sources) doxygen $<; \ if test -d html; then \ cp $(srcdir)/images/itpp_logo.png html; \ cp $(srcdir)/images/favicon.ico html; \ fi dist-html: html-local cp -a $(top_builddir)/doc/html $(top_builddir)/$(distdir_html) tar chof - $(top_builddir)/$(distdir_html) | \ gzip --best -c > $(top_builddir)/$(distdir_html).tar.gz tar chof - $(top_builddir)/$(distdir_html) | \ bzip2 -9 -c > $(top_builddir)/$(distdir_html).tar.bz2 rm -rf $(top_builddir)/$(distdir_html) install-data-local: html-local if test -d html; then \ $(mkinstalldirs) $(DESTDIR)$(docdir); \ for d in `find html -type d`; do \ $(mkinstalldirs) $(DESTDIR)$(docdir)/$$d; \ done; \ for f in `find html -type f`; do \ $(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f; \ done \ fi uninstall-local: rm -rf $(DESTDIR)$(docdir) clean-local: rm -rf html *.log *.tag # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/doc/doxygen_html.cfg.cmake.in000066400000000000000000002030761216575753400201350ustar00rootroot00000000000000# Doxyfile 1.6.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = "@CMAKE_SOURCE_DIR@/" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = "@CMAKE_SOURCE_DIR@/" # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = YES # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = YES # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = doxygen_html.log #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = "@CMAKE_SOURCE_DIR@/@PACKAGE@" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/base" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/base/algebra" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/base/math" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/comm" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/fixed" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/optim" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/protocol" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/signal" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/srccode" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/stat" \ "@CMAKE_SOURCE_DIR@/doc/local" \ "@CMAKE_SOURCE_DIR@/doc/tutorial" \ "@CMAKE_BINARY_DIR@/doc/local/index.doc" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.h \ *.cpp \ *.doc # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = "@CMAKE_SOURCE_DIR@/@PACKAGE@/config_msvc.h" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/base/blas.h" \ "@CMAKE_SOURCE_DIR@/@PACKAGE@/base/algebra/lapack.h" # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = "@CMAKE_SOURCE_DIR@/doc/tutorial/src" \ "@CMAKE_SOURCE_DIR@/tests" # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = *.h \ *.cpp \ *.ref \ *.txt # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = "@CMAKE_SOURCE_DIR@/doc/images" # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 4 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # If the HTML_FOOTER_DESCRIPTION tag is set to YES, Doxygen will # add generated date, project name and doxygen version to HTML footer. HTML_FOOTER_DESCRIPTION= NO # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = "@CMAKE_SOURCE_DIR@/doc/local/itpp_header.html" # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = "@CMAKE_SOURCE_DIR@/doc/local/itpp_footer.html" # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = doxygen_html.tag # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = @PERL@ #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = YES # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES itpp-4.3.1/doc/doxygen_html.cfg.in000066400000000000000000002025661216575753400170610ustar00rootroot00000000000000# Doxyfile 1.6.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = @top_srcdir@/ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = @top_srcdir@/ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = YES # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = YES # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = doxygen_html.log #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/@PACKAGE@ \ @top_srcdir@/@PACKAGE@/base \ @top_srcdir@/@PACKAGE@/base/algebra \ @top_srcdir@/@PACKAGE@/base/math \ @top_srcdir@/@PACKAGE@/comm \ @top_srcdir@/@PACKAGE@/fixed \ @top_srcdir@/@PACKAGE@/optim \ @top_srcdir@/@PACKAGE@/protocol \ @top_srcdir@/@PACKAGE@/signal \ @top_srcdir@/@PACKAGE@/srccode \ @top_srcdir@/@PACKAGE@/stat \ @top_srcdir@/doc/local \ @top_builddir@/doc/local \ @top_srcdir@/doc/tutorial # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.h \ *.cpp \ *.doc # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = @top_srcdir@/@PACKAGE@/config_msvc.h \ @top_srcdir@/@PACKAGE@/base/blas.h \ @top_srcdir@/@PACKAGE@/base/algebra/lapack.h # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = @top_srcdir@/doc/tutorial/src \ @top_srcdir@/tests # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = *.h \ *.cpp \ *.ref \ *.txt # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = @top_srcdir@/doc/images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 4 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # If the HTML_FOOTER_DESCRIPTION tag is set to YES, Doxygen will # add generated date, project name and doxygen version to HTML footer. HTML_FOOTER_DESCRIPTION= NO # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = @top_srcdir@/doc/local/itpp_header.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = @top_srcdir@/doc/local/itpp_footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = doxygen_html.tag # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = @PERL@ #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = YES # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES itpp-4.3.1/doc/images/000077500000000000000000000000001216575753400145245ustar00rootroot00000000000000itpp-4.3.1/doc/images/Makefile.am000066400000000000000000000001161216575753400165560ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common EXTRA_DIST = itpp_logo.png favicon.ico itpp-4.3.1/doc/images/Makefile.in000066400000000000000000000255011216575753400165740ustar00rootroot00000000000000# Makefile.in generated by automake 1.12.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.common subdir = doc/images ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) EXTRA_DIST = itpp_logo.png favicon.ico all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/images/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/images/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.common: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/doc/images/favicon.ico000066400000000000000000000070661216575753400166560ustar00rootroot00000000000000h& ( @?>q5/21UssH}Nt|s983y0w?-hILIAA*FI7ZZRP$\HkSX1.'jxQB1woJ6];GHa7JCB\ xO=M}z~zM]fmq_py9!ZL(g <}2`G$=de)&lFDtsx7.I *{ Pn1: YQ-C43B  b'W/H8Ou %, o5;E |v ( @HDn@N4~l41c`<7Z҆P~n2u}/7BuE&55N.6t5'^[2r8@C^^=;8_`Pl9*\k4Jb\`$NPb· '`vg+XFFD@W\32bd\c%s$O+:1|vZ5;enfD9NT\4u3^ܪb9NO2LrNIsj~bHIdzZLPACR{GDB"`o32a,)q6&NWO:9SM5TD87:)HMF?#Y`!Qv B[(s<;mlB?I&`_N4K;m.w|8/pj%347F>K> utPh%KV*w4j3KHü78DwOAB26.SC??GC(LFERCqt 8C7C5f?7?FLMU+=`DSgkW=6&?*52>Wi^E06k_8>G? AUNCT7s;8D4~s|8::5pD@P4OzMj?<=>:W[A1<NN>;7 QLUv96'wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwLwww:wwwwwTwwwwwr4ww.&wwwh{wwww8b6>wwwww wJwwwU2wwww>Nywwwww<EwwU www>;wwwww F뮋wwxzwww>;\wwwwwiwwwwww>SwwwwCLwˬwwww>wwww~w]vۄwww wle/QА<փLw wlp''V3f/5Bq`*< +awM@2[[0XkBɿwϯn IOu[[㶱%ہ-Aw1ø 7utO@=K^}>>?wÈww!(v w_ >wm™ج_sӿww2(wwww#wwwwwc jE٬2(wwwwwwwww PR" 2wwww|wwwwwHn&EY$wwwwowwwwwZg1WW&9,Dwwww>wwwwwwG ҉dWW)wwwwwܔwwwwwwww>Ѣwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwitpp-4.3.1/doc/images/itpp_logga.eps000066400000000000000000000150731216575753400173700ustar00rootroot00000000000000%!PS-Adobe-2.0 EPSF-2.0 %%Title: itpp_logga.eps %%Creator: fig2dev Version 3.2 Patchlevel 3d %%CreationDate: Mon Dec 2 21:49:40 2002 %%For: frenger@localhost.localdomain (Pål Frenger) %%BoundingBox: 0 0 123 53 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 53 moveto 0 0 lineto 123 0 lineto 123 53 lineto closepath clip newpath -60.1 105.5 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /DrawEllipse { /endangle exch def /startangle exch def /yrad exch def /xrad exch def /y exch def /x exch def /savematrix mtrx currentmatrix def x y tr xrad yrad sc 0 0 1 startangle endangle arc closepath savematrix setmatrix } def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % 7.500 slw % Rotated Ellipse gs 1959 1323 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2563 1323 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1474 1323 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 1067 1323 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col22 1.00 shd ef gr gs col22 s gr gr % Rotated Ellipse gs 1973 1283 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2603 1283 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1553 940 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 1974 1317 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2578 1317 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1489 1317 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 1082 1317 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col22 1.00 shd ef gr gs col22 s gr gr % Rotated Ellipse gs 1988 1277 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2618 1277 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1568 934 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 2009 1342 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2613 1342 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1524 1342 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 1117 1342 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col22 1.00 shd ef gr gs col22 s gr gr % Rotated Ellipse gs 2023 1302 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2653 1302 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1603 959 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 1979 1352 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2583 1352 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1494 1352 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col13 1.00 shd ef gr gs col13 s gr gr % Rotated Ellipse gs 1087 1352 tr -354.002 rot n 0 0 39 402 0 360 DrawEllipse 354.002 rot gs col22 1.00 shd ef gr gs col22 s gr gr % Rotated Ellipse gs 1993 1312 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col10 1.00 shd ef gr gs col10 s gr gr % Rotated Ellipse gs 2623 1312 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col19 1.00 shd ef gr gs col19 s gr gr % Rotated Ellipse gs 1573 969 tr -5.999 rot n 0 0 394 30 0 360 DrawEllipse 5.999 rot gs col13 1.00 shd ef gr gs col13 s gr gr $F2psEnd rs itpp-4.3.1/doc/images/itpp_logga.fig000066400000000000000000000043021216575753400173370ustar00rootroot00000000000000#FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 1200 2 6 975 894 3073 1754 6 975 900 3023 1725 1 2 0 1 10 10 50 0 20 0.000 1 6.1785 1959 1323 39 402 1920 1323 1998 1323 1 2 0 1 19 19 50 0 20 0.000 1 6.1785 2563 1323 39 402 2524 1323 2602 1323 1 2 0 1 13 13 50 0 20 0.000 1 6.1785 1474 1323 39 402 1435 1323 1513 1323 1 2 0 1 22 22 50 0 20 0.000 1 6.1785 1067 1323 39 402 1028 1323 1106 1323 1 2 0 1 10 10 50 0 20 0.000 1 0.1047 1973 1283 394 30 1579 1283 2367 1283 1 2 0 1 19 19 50 0 20 0.000 1 0.1047 2603 1283 394 30 2209 1283 2996 1283 1 2 0 1 13 13 50 0 20 0.000 1 0.1047 1553 940 394 30 1159 940 1947 940 -6 6 990 894 3038 1719 1 2 0 1 10 10 50 0 20 0.000 1 6.1785 1974 1317 39 402 1935 1317 2013 1317 1 2 0 1 19 19 50 0 20 0.000 1 6.1785 2578 1317 39 402 2539 1317 2617 1317 1 2 0 1 13 13 50 0 20 0.000 1 6.1785 1489 1317 39 402 1450 1317 1528 1317 1 2 0 1 22 22 50 0 20 0.000 1 6.1785 1082 1317 39 402 1043 1317 1121 1317 1 2 0 1 10 10 50 0 20 0.000 1 0.1047 1988 1277 394 30 1594 1277 2382 1277 1 2 0 1 19 19 50 0 20 0.000 1 0.1047 2618 1277 394 30 2224 1277 3011 1277 1 2 0 1 13 13 50 0 20 0.000 1 0.1047 1568 934 394 30 1174 934 1962 934 -6 6 1025 919 3073 1744 1 2 0 1 10 10 50 0 20 0.000 1 6.1785 2009 1342 39 402 1970 1342 2048 1342 1 2 0 1 19 19 50 0 20 0.000 1 6.1785 2613 1342 39 402 2574 1342 2652 1342 1 2 0 1 13 13 50 0 20 0.000 1 6.1785 1524 1342 39 402 1485 1342 1563 1342 1 2 0 1 22 22 50 0 20 0.000 1 6.1785 1117 1342 39 402 1078 1342 1156 1342 1 2 0 1 10 10 50 0 20 0.000 1 0.1047 2023 1302 394 30 1629 1302 2417 1302 1 2 0 1 19 19 50 0 20 0.000 1 0.1047 2653 1302 394 30 2259 1302 3046 1302 1 2 0 1 13 13 50 0 20 0.000 1 0.1047 1603 959 394 30 1209 959 1997 959 -6 6 995 929 3043 1754 1 2 0 1 10 10 50 0 20 0.000 1 6.1785 1979 1352 39 402 1940 1352 2018 1352 1 2 0 1 19 19 50 0 20 0.000 1 6.1785 2583 1352 39 402 2544 1352 2622 1352 1 2 0 1 13 13 50 0 20 0.000 1 6.1785 1494 1352 39 402 1455 1352 1533 1352 1 2 0 1 22 22 50 0 20 0.000 1 6.1785 1087 1352 39 402 1048 1352 1126 1352 1 2 0 1 10 10 50 0 20 0.000 1 0.1047 1993 1312 394 30 1599 1312 2387 1312 1 2 0 1 19 19 50 0 20 0.000 1 0.1047 2623 1312 394 30 2229 1312 3016 1312 1 2 0 1 13 13 50 0 20 0.000 1 0.1047 1573 969 394 30 1179 969 1967 969 -6 -6 itpp-4.3.1/doc/images/itpp_logga.jpg000066400000000000000000000102561216575753400173570ustar00rootroot00000000000000JFIFIT++C   %# , #&')*)-0-(0%()(C   (((((((((((((((((((((((((((((((((((((((((((((((((((P"F !1A"Q6aq2Bs#SUtuRTVc7 !1QaqA"#$23Rb ?:*W6#m$E)JA u'"ufIG%=ZgQ>iF=ܦiɃE '}oqY < G\+"tHʎcGbf"d-b4}9ם:VWU;su fS՜8Q;@Xm/*9Wީ~u,rOJxg*Y$/+ p7sXҩ?iI6>8.u&&y5s4hUgh GS*sm$ 쇐RsHOˉyQwlg Fdz BL~2ZD(/Q#roLV?sK~}!Q gbM`~Ie<c`ܧZSv|N?ˬ8kH7m=S]zUq-:M԰Z4RN>gp G;)״UQ{kCghpqNT[oG+/dZ*WQq ӘyI` 渁.e^qҨP\zV@_72MKXn]-EDDq߿Z9ͶYKʱ"1'$}[1m \]xGu;iRFzT,lPTRIJ*RIJ+8Jo.cs a[Z0 bdb@>i[&xtdf 5o{.w~0f["aPQܪ—eVrML(Юx8kR V<<׻NXFκ䆢 lRKh(MxB`V%cnA2;tev+,K{*9*s T[Ih2bӭW(H=G–v$aId^`cVzY,q!Rkɓ-@@;oPuijY>1]aWV1Vh-aWX@v{U~&Y.&D*"HNW=T3F}+m?][$<]=g_fh"I qo2+dE(0,y2M_XtmTa#IZG E.jf4l ")Gr@zqwd6Tpk7RXװ(`JD,3teS߉R"lm[FF ؄-#j;$ XަpH_t?}dmnk?jCu)9.R-u^R;f|xYԳHca#*8_2qY TcAab{*SRR"  }tV7wq΁IJ!azd 7 Y C{܀"s̷sܿ9vFbrNN惷{O]rn8` f]=2㧚Ĉm1<ӷ~h/DqW3P ;yݙR(U9 <8ONү]7JHAՏI'(wL}Q xUcU.J;q>]ߦ+v$<,c(PQ 3ҋU/:HՁHU4jMuj778eDl,H8?E-7t8{QVgT7g qd?t\sចAJ}@4ͤXUy~IA] ᥿ 8zP+]At6!nbT.V'eŠX+a*C()jv%c졟-%LQ 2<I)1ړ3|ӿƖ'[-E[qsQkYkF͂IR5<.VвXw.K0I=S;˵UJlW˃i;v!Rcq>߷NYk&G8ܠBK(H{ _w)RJjJP?Ǝ ϒַp] 0< 3551bO)ZJ;#W8k9ʍq 0-xS)[H?qeG\ǿV^/̤V5\_'hfZ ^]`:OaֵlcQVYc5lK$,m[ˏaY:Szuys/$r d3dlͻ$zfC޴`t3*M#(>'>˷EUhVM zUfO!*`&\þ|n/jZUoO5Ie^r,#3 `zeEEPM|~[ /G閏wLWI{C yO{͓M]2[BjLVOufQe;W*U ='|gç-8ݬL#!F] =1}WGEX].:j*V0{$fr}t&ųX4Ⱥu,WjkX齷PhF0*ŴX$+ ҍ y^twR$R$itpp-4.3.1/doc/images/itpp_logga.xcf000066400000000000000000003501751216575753400173660ustar00rootroot00000000000000gimp xcf file3BB/ gimp-commentCreated with The GIMP++JGg̷g Highlight      2P$gp#$$g* ud!0#n#d}=<==<<<;;;;;;:::::999999998888888887777777777776666666}=<==<<<;;;;;;:::::999999998888888887777777777776666666}=<==<<<;;;;;;:::::999999998888888887777777777776666666=<==<<<;;;;;;:::::999999998888888887777777777776666666l#&-6;5 -(                         *                     '#&-6;5 -(                         *                     #&-6;5 -(                         *                     #&-6;5 -(                         *                     l}87 5 . ,* ((( ( ' ' ' ' ' & & & & & % % % % % % % $  % & 62 2 ! %  %  %  %  %  $  $  $  %  % %  %  %  %  %  &  & y}87 5 . ,* ((( ( ' ' ' ' ' & & & & & % % % % % % % $  % & 62 2 ! %  %  %  %  %  $  $  $  %  % " %  %  %  %  %  &  & }87 5 . ,* ((( ( ' ' ' ' ' & & & & & % % % % % % % $  % & 62 2 ! %  %  %  %  %  $  $  $  %  %  %  %  %  %  %  &  & 87 5 . ,* ((( ( ' ' ' ' ' & & & & & % % % % % % % $  % & 62 2 ! %  %  %  %  %  $  $  $  %  %  %  %  %  %  %  &  & l=<<<<<<<;;;;;<<<<<<<<<< " !"  #(. 5============     !! @-     "##">,     "$%%# =*     "#%%# ;)      !!""##$%%$"9'   !#%&'('&%"  "%()**)('&%$#!7&  "%'*,-/01221/,(#  "',03565420-*(&#!=<<<<<<<;;;;;<<<<<<<<<< " !"  #(. 5============&     !! @-     #$$" >,     "$%%$!=*    !"$%&&$!;)      !"##$$%&&%$!9'   !#%&'('&%"  "&(*++*)('&&$"7&  "%'*,-/01221/,(#  "',03566531.,)'%" =<<<<<<<;;;;;<<<<<<<<<< " !"  #(. 5============Ô     !! @-     "##!>,    "#$$"=*     "#$%$#;)      !""#$$%%$!9'   !#%&'('&%"  "%')**)('&%%#"7&  "%'*,-/01221/,(#  "',/245531/,*'%" =<<<<<<<;;;;;<<<<<<<<<< " !"  #(. 5============>>0@@hP0P$UX ip@088>>*?*OO*K0dC::;:>>ï ϙT- B0ZSBDL}EFvoYJRÈ=<]hFF]\;~j˔\\:nv~禮Df[99eCCdc@ZZ=46666666666677 :0()0/666666666666677 *.R %   ##$ $"$$#%&&*++,$,*..1,.56638195;;==??4+T\dksy~ڄ|vohb_^_chntx|~~{xrle]VQNNPT[bioux{{zwtpjcZPE:0U\cjqx}}wpic_^_bglsx}{unf_YUSTW\biouz}}ytlcXL@5Y^djqw}zslfb_`bflrx~~wphb]ZZ[_djpv|}uk`SF:^afkqw}}wpjebabfkqxyqkea``bflrx~}sgZL>cehlqv|{tnheccejpw~yrlhedehmrx~zn`QCggilpuzyrlgdcdhnu}ysmjhhimrx~seVGihiknrw| |tnhdbcfls{xqmjhilpv|wiYJigghkoty~woidbbejqy{uokiikotzzl\Lgfefhlqw}yqjdaachowxrmjijnsy}o_Ofdcdfjov||tlgcbdipx|uplkknsyrcRgedegkpw~xqkgfhlsz{uqoprv{wgWjihikou{ysonpsy}ywwx|}m\qppqsw|~{yz~sb}||}zhnتs¿հv챴x뱴}w¾t~oÿwjzwwz}wsrtw{~}xpdzurruzyrkhginu}wnhdcdhlpssoh^~tlfbbdipxwme^YXY^enw~tjaZVUVZ_dhigaY~si`YUTV[bjs{xndZSMKMQXajt}~uj`WPKJKOTZ_a`[Tuj`VOJHJOV_hqzzrg]SKEBCGNV`jt|~vmcXOHCACGLRWZZWPyodYOGBABGNWakt{~wndYOF@<=@GOYcmv|yqh^TKD?=?BHNSVWSM~uk`UKC><>BJS]gpx~}vmbXMD>::=CKU_iry}|vof\RJC><>AGLQTTQK|si^TJC><=BIR\fpx~}wncYOF?;;=CKT^hqx|~{vof]TKEA?@DHNRUTPJ|si_ULEA?@EKT^hrzyqg\RJC??AFMV`irx}|wqi`XPJFEFINRVWVQJ}ulbYQJFEFJPYblu}}ulbXPJFEGLR[dlt{ztme]WRNMNQUX[[YSKxog^WQMLMQW_hqyzqh_WQNMNSY`hqx~~xrkd_ZXWXZ]`ba]VM{sld]XUTVY^emu}~vme_YVUVZ_fmu{|vpkfca`adfhigaYN}vohc^\[\_djqxyqjd_\\]`djpw|~ytpljiijlnpolf]Q{vpjeb`_`cgkqw}yrlgc`_`cgkqv{}yvrpnmnprtutpi_R{wrmheb`_`beinrw|~zuojfb`_`beimqux{|}|zxurpnnortvwvrk`Sxvtrnjfb_][[]_bfjnqtwxxvtplhd`][[]_beilnpqrrpomkjiikmpsvwvrk`Rihgdb_[XVTSRSTVX[]`cfhiihfc`\YVTSRRSUWZ\_abcddcba`_`acgkorttpi^QXWVUSPNLJHGGHIJLNQSUVWWUSQNLJHGGIJLNOQRSSRTVY]bgloole[NGFEDCA?=<::9::;<=?@BCDEEDCA?=;:99:;=>?@ABBCCDFIMRX^cghf`VJ6554310/.-,,-./0233443210/--,,-./001223468<@FMSZ^`^YQE&&%$#"!  !""#$$%%$#"!!   !"#$%&'),05;BIPUWVRJ@!%+18?FKNNJC:  "(/6=BEEB<4    "(/5:==:5.& "(.2552.'+ "'+--+'!, !$&&$ ,  , , -  -  + ) )  ()(}}wohb__aehjjhe`\XURNJEA>=?DMWbluz|{wrle_ZUOIC<60*rx}}yrkd^[\^bgjkkigd`]ZUPKEA?@DKT^hpvyyvrmhc^YTNG?81+fmtz{voha\YY\`eilnnmkifb]XQKFCBEJR[dlrvwwtqmie`ZTLD<4,^emty~~{ung`[XXZ^dimprssqokf`YRLHFGKRYaiptwxwusplhb[SJA8/Y`gou{|voha[XXZ]chnsvyzyxtoib[TOLLNSYahotxz{{zxuqkd[QG=2W]elsy~~yrkd^ZYZ^bhnty}}ysld]WSRSV[ahouz}}ztmcYMB7X]djqx}׆}vohb^\\_chou||ung`[YXZ^cipv|}vlaTH;\`ekqw|{ungb_^`chov}xpid`^_aekqw}~th[M@`bfjpu{zslgcaachnu}yrlgdcdglqx~{oaSDcegjnsy~xqjebacgmt|yrmigfhlqw~tfWHeefhlqv|{slgcabekr{wqlihikpv|xj[Kfeefimsy~vnhc`adipy{tojhhjnsz{m]Mdccdfkpv}xpic``chowxqlihjmrx~p`Pcbabeiou||slfbbdipx|uoljkmrxsdScbbcfjpv}xqkgfhls{{uqooqu{xhWgffgjot{ysonosy}yvvx{}m\nmnorv|~{yz~tbzyz{~寬zhnsv챳xw¾toÿwjzwwz}wsrtw{~}xpdzurruzyqkgfinu}wnhdcdhlpssoh^~ulfbbdipxwme^YXY^enw~tjaZVUVZ_dhigaY~si`YUTV[bjs{xndZSMKMQXajt}~tj`WPKIKOTZ_a`[Tuj`VOJIJOV_hqzzrg]SKEBCGNV`jt|~vmcXOHCACGLRWZZWPyodYOGBABGNWakt{~wndYOF@<=@GOYcmv|yqh^TKC?=?BHNSVWSM~uk`ULD?=>CJS]gpx~}vmbXMD>::=CKU_iry}|vof\RIB><>AGLQTTQK|si_TKC><=BIR\fpx~}wncYOF?;;=CKT^hqx|~~{vof]TKEA?@DHNRUTPJ|tj`VMFA?AELT^hrzyqg\RJC??AFMV`irx}|wph`WPJFEFINRVWVQJ~vmdZRKGEFJQYblu}}ulbXPJFEGLR[dlt{ztme]WQNMNQUX[[YSKzqh`XROMNRX_hqyzqh_WQNMNSY`hqx~~xrkd^ZXWXZ]`ba]VM}unf_ZWUVZ_emu}~vme_YVUVZ_fmt{|vpkfca`adfhigaYNxqke`]\]`djqxyqjd_\\]`djpw|~ytpljhijlnpolf]Qyrmhda`acglqw}yrlgc`_`cgkqv{}yuronmnprtutpi_R{upkgdbaaceinsw|~zuojfb`_`beimqux{|}|zxurpnnortvwvrk`S~|zvrnieb_]\\^`cfjnqtwxxvtplhd`][[]_beilnpqrqpomkjiikmpsvwvrk`Rpnlifb^[XVTTVX[^acfhiihfc`\YVTSRRSUWZ\_abcdccba`_`acgkorttpi^Q_^\ZWTQNKJHHGHIKLNQSUVWWUSQNLJHGGIJLNOQRSSRTVY]bgloole[NMLKIFDA?=<;::;<=?@BCDEEDCA?=;:99:;=>?@ABBCCDFIMRX^cghf`VJ;;986420/.-,,-./0233443210/--,,-./001223468<@FMSZ^`^YQE,+*)'&%#"!!  !"#$$%%$#"!!   !"#$%&'),05;BIPUWVRJ@!%+18?FKNNJC:  "(/6=BEEB<4      "(/5:==:5.$ "(.2552.'' "'+--+'!, !$&&$ ,  , , +  *  ( ' '  & ' '@MZfpw{}xphb__beilmmkigec`\VPIDAAFMWbmv|~{xtojc[QF:/$?KXcmty|~{tld^[[^bgkmnnmlkhe`ZSLFBBEKT^hpw{}|zxuqlf^UJ>3(>JVakrw{}}xqia\YY[`ejnprrqokf_XPIEDFKR[dlsx{{ywtpjcZOD8-#?JU`iqw{~ڀ}wph`[WWY^cinruwxwurlf^VOIGHKQYaipvz||{yupi`VJ>3(AKU_hpw|~xqia[XWY]bhntx{}~|ytme]VPMLNSY`houz}~|wph]QE9.EMW`iqw}{sld^ZXY]bhnuz|vnf^XSRRUZahou{xpeZM@4KRYbjqx~xphb][[]bhnu|~woga\YXZ]cipv|xnbTG:RW]dkrx~|umga^]^bgnv}xqjd`^^aejqw~vi\M?X[_ekqx~zslfa__bgnu}yrlgdcdgkqw~|pbSD]_bfkpw}wpid``aflt|yrlhffhkqw~ugXI`abeintz{slea`adjrzxqlighkou|yk\La`acglqx~~vngb_`cipy{tnjhhjnsz|n_O`_`adiov}xphc`_bhoxxqlihimrxqbQ_^^`chnu|{skebadipx|uokjjmrxueT`__adiov}xpjgfhls{{upnnqu{yiXccdfintzxronotz}yvvw{~n]kklnqv{~zyz~tcwwxz}{inꘙڧsw챳¿xÿw¾t컸~oÿwjzxwz}wsrtw{~}xpdztrruyyqkgginu}wnhdcdhlpssoh^~tlfbbdipwwme^YXY^enw~tjaZVUVZ_dhigaY~si`YTSV[bjr{xndZSMKMQXajt}~tj`WPKJKOTZ_a`[Tuj`VNJHJOV_hqzzrg]SKEBCGNV`jt|~vmbXOHCACGLRWZZWPyncXOGB@BGNWakt{~wndYOF@<=@GOYcmv|yqh^SJC?=>BHNSVWSM~uj_UKC><>BJS]gpx~}vmbXMD>::=CKU_iry}|vne[RIB><=AGLQTTQK{rh^SJB=<=AIR\fpx~}wncYOF?;;=CKT^hqw|~~{une\SKD@?@CHNRUTPJ{ri^TLE@>@DKT^hrzyqg\RJC??AFMV`irx}|wph_WOJFEFIMRVWVQJ}tkbXPJEDEJPXblu}}ulbXPJFEGLR[dlt{~zsld\VQNMNQTX[[YSK~wne]UPLKMQW_gqyzqh_WQNMNSY`hqx~}wqjc^ZWVXZ]`ba]VMyrjb\WTSUX^emu}~vme_YVUVZ_fmt{{uojeb``acfhigaYN{tmfa]ZZ[_cipxyqjd_\\]`djpw|}xtolihhjlnoolf]Q~ysmhc`^^_bfkqw}yrlgc`_`cgkqv{|yuqommnprtutpi_R|xtokfb`^^_aeimrw|~zuojfb`_`beimqux{||zwtronmnoqtvwvrk`Sutrokgd`][ZZ[\_bfjnqtwxxvtplhd`][[]_beilnpqrqpnlkiijmpsvwvrk`Rfeda_\YVTRRQRSUXZ]`cfhiihfc`\YVTSRRSUWZ\_abcdccb`__acfjorttpi^QVUTRPNLJHGFFGHJLNQSUVWWUSQNLJHGGIJLNOQRSSRTVY]bgloole[NDCBA@>=;:99:;<=?@BCDEEDCA?=;:99:;=>?@ABBCCBCCDFIMRX^cghf`VJ33210/.-,,+,,-./0233443210/--,,-./001223468<@FMSZ^`^YQE%$$##"!!  !""#$$%%$#"!!   !"#$%&'),05;BIPUWVRJ@!%+18?FKNNJC:  "(/6=BEEB<4    "(/5:==:5.* "(.2552.'+ "'+--+'!, !$&&$ ,  , , -  -  - - .  .//~<;:::9:: 9: : : 99 9 : : 99 9 : : : 99 9 9 9 : : 999 9 9 9 9 : : 999 9 9 9 9 9 9 9 : : 999      *6    (4    &1"      $-&    !)*     $.#   2&   !"##"!   5)   #&'))('%#! 8,!  !%(+-./.-,*'%"  ;."  !%),/1221/-*'#   =/$  #(,/2455431.+'#  @1%   $(,/24432/,)%" B4'  #'+.01210.,)&" F7)  !%(*,--,+)'$  K:,!  !#&''&%#  P?0#   !!  UC3&   ZH7(   _L:*   bN<,   dP=-   dP>-   bO=-     ^M;,   ZJ:+      VF7)     QC5(      M@3&     I=1%     F:/#    C8-"    A6+     @5*    @4)    @4(  !"!   A4(  "$%$!   "##"B5(  "&(('#   #%&&$!C5(  !&*--+'!  "%'((&"D6(   &+/11/*$  !$&())'#D5(  $*04763.'  "%'))&#D5'  ")06:<;82*!   "%'(('%!B4&  &-5;@BA<5-#  "$%&&%"@2%  !)2:AEGFA9/%   !"#"!=/#  $-6?FKLJE<2'  9,   '1:DKPQNH?4(  4)  !*4>HOTURKA5)  0%  #,7AKSWXTMB6*  *!  $.9CMUYZVMB6)   %  %/:DNVZZUMB5(     %/:DNUYXSK@3'     $.8CLSVUPH=0%    ",6@IORQLD9-"    !*4=EKNLG?5*    '09@FHGB:1&    $,4;@B@<5,#    !)06:<:6/'   $+04540*#    &*-.-*$   !%'('$    !!               %     $    %    &      )     ,"   /%   3(   !"##"!  6*    #&'))('%#! 9,!  !%(+-./.-,*'%" 0$  #(,/2455431.+'#  @2&   $(,/24432/,)%" C4(  #'+.01210.,)&" G7*  !%(*,--,+)'$  K;-!  !#&''&%#  P?0#   !!  UD3&   [H7(   _L:*   bO<,   dP=-   cP>-   bO=-     ^M;,   ZJ:+      VF7)     QC5(      M@3&     I=1%     F:/#    C8-"    A6+     @5*    @4)    @4(  !"!   A4(  "$%$!   "##"B5(  "&(('#   #%&&$!C5(  !&*--+'!  "%'((&"D6(   &+/11/*$  !$&())'#D5(  $*04763.'  "%'))&#D5'  ")06:<;82*!   "%'(('%!B4&  &-5;@BA<5-#  "$%&&%"@2%  !)2:AEGFA9/%   !"#"!=/#  $-6?FKLJE<2'  9,   '1:DKPQNH?4(  4)  !*4>HOTURKA5)  0%  #,7AKSWXTMB6*  *!  $.9CMUYZVMB6)   %  %/:DNVZZUMB5(     %/:DNUYXSK@3'     $.8CLSVUPH=0%    ",6@IORQLD9-"    !*4=EKNLG?5*    '09@FHGB:1&    $,4;@B@<5,#    !)06:<:6/'   $+04540*#    &*-.-*$   !%'('$    !!                   "+    !*      )      &#    #)     .#   2'   !"##"!  7*    #&'))('%#!  :-"  !%(+-./.-,*'%"  =/$  !%),/1221/-*'#   ?1%  #(,/2455431.+'#  A3'   $(,/24432/,)%" D5(  #'+.01210.,)&" H8*  !%(*,--,+)'$  L;-!  !#&''&%#  Q@0$   !!  VD4&   [H7(   _L:*   bO<,   dP=-   dP>-   bO=-     ^L;,   ZJ:+      VF7)     QC5(      M@3&     I=1%     F:/#    C8-"    A6+     @5*    @4)    @4(  !"!   A4(  "$%$!   "##"B5(  "&(('#   #%&&$!C5(  !&*--+'!  "%'((&"D6(   &+/11/*$  !$&())'#D5(  $*04763.'  "%'))&#D5'  ")06:<;82*!   "%'(('%!B4&  &-5;@BA<5-#  "$%&&%"@2%  !)2:AEGFA9/%   !"#"!=/#  $-6?FKLJE<2'  9,   '1:DKPQNH?4(  4)  !*4>HOTURKA5)  0%  #,7AKSWXTMB6*  *!  $.9CMUYZVMB6)   %  %/:DNVZZUMB5(     %/:DNUYXSK@3'     $.8CLSVUPH=0%    ",6@IORQLD9-"    !*4=EKNLG?5*    '09@FHGB:1&    $,4;@B@<5,#    !)06:<:6/'   $+04540*#    &*-.-*$   !%'('$    !!                $           $   +5#$$#!902r4,'þ礨û~粶ù|xtplhĸ|wrnkgd`\YUQȺvle_[WSPMJFC?< |naWOIEA>;8520-*ǽxspnmllkjjiik ȹl\OD<62.+)'%" Ź{of_[XWVUUTSSRSV òs_N@5-'#´~m`UMGDB@@?>>?C ͿjUC4)! ˿saRE<620.--,,-/4 ˼zcM;,  ʽjVF9/($! #( ɺv^H5& ɻzcN=/$ ȸrZD1" ȹv^H6(   ǶpWA.  ȸsZD2#   ƵmU?,  ǷpWA/    ųkR=*  ƵmU?,   ñiP;)  ŴkS=*   ¯fN9' IJiP;)   }dL7& ðfN9'  Ϳ{bJ6% }dL7& ;y`I5%  ο{aJ5$ ̽x_I6& ;x_G3#  ̽x`J8)̽v]F2!  ̽ybM<̻t[D0    ͽ˺rYB/   ʹqXA.   ɸoV@-   ȶmU>,  ǵkS=*  ŲiP;)  ŶİfN9'  Ķ}cK7% ´Ͽz`I4$  ̾ͽv]F2"   ɺyusstvy{}~˻sZC0    ŵvmgdccdfgijkllmnopʸpWA.   xj_XSQPQRRSTTUUVVWXȶmT>,   ̼m]QHC?>>?@ABƳjQ<*   ȸxdRE;40.--./0ðgO9(   ųp[H:/'#  !}cL7& ¯iS@1&οz`I4$ ο{cM9*    ̼v]F2"  ̼w^H4%  ʺsZC0   ɹrZC0! ȷpWA.  ǶnV@- ƵmT>+   IJjR<* IJiQ;)   ¯fN9( CQ^kvꐑ쥣}r@MYenw}~~Ձzsk>==>>?@AABDEGJMQU[`fjmonkf`YSNKJLOT$).2579:;;<<=<;;:987543100//01223569<@EKRYafjlkgaYRJDA@BGN!%')+,--.//001100/.-,+*('&$$##$%&(*,05;CLU^fkmlg`WME=98:?G !!""#$%%&&%$#"! "'-5>IT_hnqpjbWLA93138? '0;HUbmtwvpfZM@6/+,07    "-:HXfr{~}vk]O@4,'&(.       ,:J[kx|paQA3)# !%    +:K]n|scRA3' *:L_queSA2%  *;M`rudR@0#  *;MassbP>.!   *;M`rp_L;+ " *:L_p~zlZH7( ! )9K]n{ufUD3%   )8J[kw~yo`P?/!  (7HYhsyytiZJ:+  '6FVeoutncTE5'  &5DTbkpoh]O@1#  %3CR^gkibWI:,  %2AO[dge]RD6(  $1?MX`b`XM?2%   #0=JU\^[SH;."   "/70(!!)4 !+6@HMNMG@7-%&/ &1=HQVXUOF;1' !( )6CNW]^ZSI>2(!   ,9FR[``\TI=1&   !-:HS\`_ZQF:.#  !-;GRZ]\VLA5) " !-:FPVXVOF:/$ #  ,8CLQROH>3( " *5?GKKG@6," !(2;BED@8/%   &/7=?>92)   #,38972+#  !(/342-&  %+./,(!  "&)*'#  #%%#  !                                  # 5 5 6 6 6 6 7 7 7 7 6 6 6 6 6 "                 5@IQX]`bddcbba`__^__`abccdefgghiijkkllmnnoponmljhea\W4>GOUZ]_`aa`__^]\[[ZZ[\]^_``abccddeffgghhihgfedba_\YV2;CKPUXZ[[ZYYXWVUUTTUVWWXYZZ[[\]]^__``a`^]\[YXWWVU/7>EJNQRSTTSSRRQPOONMMLMNOPPQRRSSTUUVVWWXWVUTSQPOOPRT*18>BEHIJJIHGFFEDDCCDEFGHIJJKKLKJHGFEEGIMR%+059;=>?@@?>=<<;::99:;<=>?@?><;:9:;>BHO$(,/1334455432100/..-./012343210/..14:AK #%&'())*)('&%$$##$%&'('&%$##$',2:D #*2="*4     "*      !      679::988777 7 $ "                      ! # 5 5 6 6 6 6 7 7 7 7 6 6 6 6 6 "               !   0 -  * 0 $)'%" ! 0,'"  0*$ @92+$ yvrQ:1)" JA7-$ [QF;0% mbWJ?𴮡{eN:) 9520/.0𹳧iR=+  '%#!!"%𽸬lT?,  nV@-  ľoWA.    pWA.    ´pXA.   õqXA.   ĶqXA.    ƷqXB.    ǸrYB/    ȹsZD1"   ɺu\F3$        ˼x`J7)    ;|eP>0&   $'%"%62-($5@:4*7¾1ÿ" ý ǿ ù µ}{|~ ô~umhecdgkqx ȸvi_WRNMMPTZahpv|qtx ϿscVKC=:99;?EKRX^dhknopqqrtw{Z]b ɷyeTE:2-)((*-27=CHMPSUWWXXYZ\` DHM ðmYG8-%"'+048;=?@AABDGK 26< Ͽ{dO<."!$')*,,--./149 $(. ̻u]G5& !#&, $ ɷoWB/!  !  ƳkS=+      ðgO:(    |cK6%    ;y`H4#    ˻u\E1!    ȸqYB/   g[QG?941.,*'$!  !$&'&%"   /AVd\UNIEB@>;962-("  #).25653/*#  !0BWa^[XVTSQPNKGB<5-$  &/6=BFGFC=7/& "1CX_`abccdcba]YSKB8-#  &0;DMSWXWSLD:/% #2DY]bfjnqstsqnibYNB6*  #.:FR[cghgbZPD8,   #3EZ[bjqw{~~{umcWJGOU[_aa_[UNF=4+#!%).5Ob $/;JZj{|l[K=0&  &2ARd #.:IYizxgWG9-#  !*6DUg !,8FVgwq`PB4)   &/;HXj )5CScswhXI;/%   %,5@M\l '2?N]m{zl]OA4)   "&,3;EQ_o  %/JV`hmomg_UJ?4*!  !'.49>CHNU^iv  %.9CMV]ab`ZSJ@6,$  &.5M_ "-:K] *8I\ '6H[ &5G[  &5GZ  &5G[   &5G[     '6G[    (6H[ !##"   )8I\ #(,./.,(#  !+9J] &-38;<<94.(!  $.;L^ &.6>DHJJGB;3+$  "(1>N`  '/8AIPVXXUPH@7.'    "$'-6BQb "(09BLU]cffc^VMD:2+% !#%')*,/41$  %5H]DR`lv~|ti]O@2&  #.;IWdow|}{uk_QB4'  %5H]DR_kv}|tj]PA4( '2?MZgrz~}vm`RC5'  &5H]@MZeov|~{vndYL?2'"+6BN[gpw{|ysi]OA3&  &6I^:EQ[djorrojc[QF:/&!(/9CNYckqttpjaVIDILNONMJF@:3-'""%(+.26;AGMRW[\][WRJB8.$  &6I^$*/47:;<<;963/*&# !$'+/37:=ADHKNPRSRQNJE>7.&  &6I^"%(*++*('$"! !#',16;@DHKMOQQOMJGC?93-&  &6I^ #(.4;BIOSWZ\\ZWSOJE@:50*$  &6I^ !&-5=FNV^chklkhd_XQIB;4.)#  &6I^ ")2;EPZdlsx{{yuog^TJ@80)#  '7J^ #,6AMYepzzpdXK@6-&  (8J^ %.9FSan{wi[M@5+#  )9K_ %/;IWfu|m]N@4*!  +;Ma %0Ob $/;JZj{|l[K=0&  &2ARd #.:IYizxgWG9-#  !*6DUg !,8FVgwq`PB4)   &/;HXj )5CScswhXI;/%   %,5@M\l '2?N]m{zl]OA4)   "&,3;EQ_o  %/JV`hmomg_UJ?4*!  !'.49>CHNU^iv  %.9CMV]ab`ZSJ@6,$  &.5M_ "-:K] *8I\ '6H[ &5G[  &5GZ  &5G[   &5G[     '6G[    (6H[ !##"   )8I\ #(,./.,(#  !+9J] &-38;<<94.(!  $.;L^ &.6>DHJJGB;3+$  "(2>N`  '/8AIPVXXUPH@7.'    "$(-6BQc "(09BLU]cffc^VMD:2+% !#&')*,/4IT]ekorsrojc[QF:/&!(/9CNYckpsspi`UH;."  &6I^4=FOU[_aba_[UNF=4+#!%).56-%  &6I^"%(*++*('$"! !#',16;@DHKMOQQOMJGC>93,%  &6I^ #(.4;BIOSWZ\\ZWSOJE?:5/*$  &6I^ !&-5=FNV^chklkhd_XQIB;4.(#  &6I^ ")2;EPZdlsx{{yuog^TJ@80)#  '7J^ #,6AMYepzzpdXK@6-&  (8J^ %.9FSan{wi[M@5+#  )9K_ %/;IWfu|m]N@4*!  +;Ma %0Ob $/;JZj{|l[K=0&  &2ARd #.:IYizxgWG9-#  !*6DUg !,8FVgwq`PB4)   &/;HXj )5CScswhXI;/%   %,5@M\l '2?N]m{zl]OA4)   "&,3;EQ_o  %/JV`hmomg_UJ?4*!  !'.49>CHNU^iv  %.9CMV]ab`ZSJ@6,$  &.5M_ "-:K] *8I\ '6H[ &5G[  &5GZ  &5G[   &5G[     '6G[    (6H[ !##"   )8I\ #(,./.,(#  !+9J] &-38;<<94.(!  $.;L^ &.6>DHJJGB;3+$  !(1>N`  '/8AIPVXXUPH@7.'    "$'-6BQb "(09BLU]cffc^VMD:2+% !#%')*,/44+" Ⱦ{xtplgb^XSMF?80(! ǻ{vsokhd`\XUPLHC?:4/)# ɻ{smgb^[WTPMJFC?<851-)%! ο~pf]VPLHDA>;8530-*'$" Ƶ|k]QHA<741.,)'%"  Ͽn\L@70+'$! ʹwbO?2)" ųmWD4' ®~fP<,   ξy`J6& %̻t\E2" +ʸqXA. -ǵmT>+ .ŲiQ;) .¯fN9' .{bK6%.mmnoppq rs t tttt tssst uvxy{} 􅓟􆓠􇓠 􇓠    Ȁ}{ xvtr q p ooo o o p ppq rsuw { 򅓡􌙥͔vutssrs ss t tttt tssst uvxy{} 􅓟􆓠􇓠 􇓠    Ȁ}{ xvtr q p ooo o o p ppq rtux |󁐟 򎛧͖dzf|h~kmnp rs s tttt tssst uvxy{} 􅓟􆓠􇓠 􇓠    Ȁ}{ xvtr q p ooo o o p ppq rsuw z 򄓡􋘤͓)+-/9:                !""# #"!   !#$%%&&''()*+,-.// 0/.-,*(&$"!  !$'*-0234566789:;<<==<=>??@AABBA?=;9630.,*)'%" -159<@CEFGHHIIJKJKLMNPQRTUVVUSPMIEA=:8531.+'" 9>CINRVXZ[\\[ZYXWVVUUVWY[]_bdgikllkjgc_YTOJEB?<962.("ELSZ`fjnpqrrqpnljheca_^]\\]^`behlquy}{vpiaZTNJFC@<82,%PXaiqx~|wsnjfca`__`behlqw~vmc[TNIFB>94-&Ycnxzslgb_]\\X^adiov~ti^VOIEA=82,%`lyuld^YWUUVX[`fnwyk_TLE@<73.(!etth^VQMKKLNRX`ju{k\PF>840+'" k{qbVMFA?>?BGNXdr{iXJ?60+'# qm]OC;63247=EP^nŶzfTD8.'" xǸjXH;2,(')-3=IYkɹycO>1'  ̼~iTC5+$  %,7EVj̻w`K:,! iSA2& (3CUjͼw_I7) ðkTA1%'3DWmνw_I7( ƳoXD4' )7H\sоxaK9*  ȷu_J9,#$.=Nczѿ{dO>0&ʻ}hTC5,&$'-8FXmiUE8.($!˾r_OA82039DRdxðp^OC;51.,+)&#n^QHBACJTbsųxh[QJEA?<962-'"ù~pd[VTV]fsƵtia\XUROKE?80(Ŀyqlkmr{ȸxsoljgb\ULC8.þɺ|voeZM@3nnopqrtw{»ɻseVF8VWWXYZ\_dkuľɼp^L;@AABDFJOWbpȽydP> ( * +-78                !""# #"!   !#$%%&&''()*+,-.// 0/.-,*(&$"!  !$'*-0234566789:;<<==<=>??@AABBA?=;9630.,*)'%" -159<@CEFGHHIIJKJKLMNPQRTUVVTRPMIEA=:7531.+'" 9>CINRVXZ[\\[ZYXWVVUUVWY[]_bdgikllkjgc^YTNJEB?<962.("ELSZ`fjnpqrrqpnljheca_^]\\]^`behlquy}{vohaZTNJFC@<82,%PXaiqx~|wsnjfca`__`behlqw~vlc[TNIFB>94-&Ycnxzslgb_]\\X^adiov~ti^VOIEA=82,%`lyuld^YWUUVX[`fnwyk_TLE@<73.(!etth^VQMKKLNRX`ju{k\PF>840+'" k{qbVMFA?>?BGNXdrʿ{iXJ?60+'# qm]OC;63247=EP^nŶzfSD8.'" xǸjXH;2,(')-3=IYkɹycO>1'  ̼~iTC5+$  %,7EVj̻w`K:,! iSA2& (3CUjͼv_I7) ðkTA1%'3DWmνw_I7( ƳoXD4' )7H\sоx`K9*  ȷu_J9,#$.=Nczѿ{dO>0&ʻ}hTC5,&$'-8FXmiUE8.($! ˾r_OA82039DRdxðp^OC;51.,+)&#n^QHBACJTbsŲxh[QJEA?<962-'"ù~pd[VTV]fsƵtia\XUROKE?80(Ŀyqlkmr{ȸxsoljgb\ULC8.þȺ|voeZM@3nnopqrtw{»ɻseVF8VWWXYZ\_dkuľȼp^L;@AABDFJOWbpȽydP>1246"                !""# #"!   !#$%%&&''()*+,-.// 0/.-+)(&$"!  !$'*-0234566789:;<<==<=>??@@ABBA@?=:8530.,*)'%" -159<@CEFGHHIIJKJKLMNPQRTUVVUTROLHD@=:7531.+'" 9>CINRVXZ[\\[ZYXWVVUUVWY[]_bdgijkkifb]XSMIEA?<962.("ELSZ`fjnpqrrqpnljheca_^]\\]^`behlquy|}ytng`YSMIFC@<82,%PXaiqx~|wsnjfca`__`behlqw~}tkbZSMIEB>94-&Ycnxzslgb_]\\^adiov~~rg]UNID@<82,%`lyuld^YWUUVX[`fnwwj]SKE@;73.(!etth^VQMKKLNRX`juĿyi[OE>840+'" k{qbVMFA?>?BGNXdrȾygWI>60+'# qm]OC;63247=EP^nĵyeRC7.'" xǸjXH;2,(')-3=IYkȸwbN=0& ̼~iTC5+$  %,7EVj˺v_K9+! iSA2& (3CUjͻv^I7( ðkTA1%'3DWmμv^I6( ƳoXD4' )7H\sϽx`J8* ȷu_J9,#$.=NczпzcO=/%ʻ}hTC5,&$'-8FXm~hTD7.'#!˾r_OA82039DRdx®o]NC:51.,+)&#n^QHBACJTbsıwgZPIDA?<962-'"ù~pd[VTV]fsŴrh`[WUROJE?80(Ŀyqlkmr{ƶ~vqnlifb\ULC8.þǸ{voeZM@3nnopqrtw{»ǹseVF8VWWXYZ\_dkuľǺp^L;@AABDFJOWbpǻydP>2 9 9 9 9 9 9 9 9 9 9 9 9 9 1 1 ez1 (8K_r1 %4EWix1!.>N]kt1 (6CQ\c2 "-8CLR2 $-6=A2 #).13 !$3 4 5 67;@         8877 4 3 2 1 $0 ", 0 '3 0  ,9 0 #0? 0 %3D 0 &6H 0 (8J 0 (9L0 )9M0 ):O0 );O0 );P/ );P. *;P . *;P - *S( - ,?T* - -?U,- -@U-  - .@V       8887 4 3 2 1 #0 "+ 0 '3 0  ,9 0 #0? 0 %4D 0 '6H 0 (8K 0 (9M0 ):N0 ):O0 );O0 );P/ *;P. *;P . *S( - ,?T* - -?U,- -@U-  - .@V       8987 4 3 2 1 #0 !* 0 &1 0 +8 0 "/= 0 $2B 0 &5F 0 '7I 0 (8K0 (9M0 ):N0 ):O0 );O/ );P. *;P . *;P - *S( - ,?T* - -?U,- -@U-  - .@V¯fN9'   Ϳ|cK6%Ϳ{bK6% ˼x_G3#˼w^G3#  ȹs[D0! ȹsZD0!  ƵoV@- ƵoV@-  òkS=+ òkR=+  ˿fN9( ˿fN9(  ȼzaJ6%ȻzaJ6% ŷu]F2" ŷu]F2"  pXB/   pXB/   ŽkS=+  żjS=+  }eN9(  |dM9(  w_I5$ v^H4$ ﳸpYC0!  nWB/   hR>,  {eP<*  &v`K8'  p\G5% #2Xm~kWC2# weQ?.   ->Pctq`M;+  xiXF6'  '6GWgs{}ypcTC3%  xxrgZK;-   !.IRXZWPF:.#  TSNF<1&  (2;BGHE@8.$  CA=6.%  &-36751*# 21-("   !%(('$ $#              }                      $     '  !!"#$$%%$#"!!"#$#" +"&),-./00123455432100122334431/-)&# $/"&)+*(%" $)/49<>@AABDEFGGHHGFECBBCDDEFFEDA>:61,($"!$*4+1688740,*(),17>EKORTVWXY[\]]^^]\[YXXYZ[\\[YVRMHB<71-+,1:5=CGIHEA<978;AHPX_dhkmnoqrstuvvutrqpoopqrrsttrpmhc]VNG@:659@>IQWZZWSOKIIMS[dltz򍌋ҊzskbYPIC@BGGT_glmkhc_]]`gox¥wlbYQMLPO^kv}}yussv|󺹸Ըti`ZXYUgvzphdc[n¹~vpm_tǼ|wbxȼd{ ƺe} ·f Ƚg·gƼhȿhi  úi Żj Ǿj ɿk k øl źm Ƽn Ƚn ɾ 1 1 1 0                 #     &  !"#"!  !!""##" )"&),-../0123320//.//0122321/,)&#",!&)+*)&" $)/49<>??@ABCCDEFFEDCAA@@AABCCDEECA=:51,(# !&/+1689740-*(),17>EKORSTUUVVWXXYZ[\\[ZXWVVWXXYZ[[ZXVRMHB<60+('*15=CHIHEA=988;AHPX_dhjkllmnnopqrssqponmnnopqrrplhc\VNF>71//3>IQX[[XTOKIJMS[dltz~zsjaXND<756GT_hlnlid`]^agoxvj^SI@;9O^lw~~zvssv|ѷ}obUKB=VgwqcVJB[o¸paSH_tƺ}m]Pby ƸxhYd| ´scf~ ʼ}mg õwgȼhhŹhȾi  i ĺj ƽj ɿk k ùl Żm Ǽn Ⱦn ʿ 1 1 1 1     !          #    '   !"##$$ #$#"! *!%),.012344 343210/.-+)'$!#-!%())'%!#(.38<962-)%#$(0*047763/,)((+06=DJOSVXZ[\]]\[\]\[ZZYXWVTROLGB<60,+-33;AEGFC?;877:@GOW^dhloqstuuttssrssttuttsrqqpomkhe`[TMD=6226M\isz~~|xtrru{Ӹuh[PHDSdtwh\RKYl~Ļvh\S]r Ƚtg\awȻrfczķ}pe|˿zf~ŹgʿgøhǼhʿi  ¸i ĺj ǽj ȿk k øl źm ƻn Ƚn ɾ ŵnU?,   ñjR<*   fN9(   ɽ{bK6%  ǹw^G3#  ĶsZD0!   nV@-   żiR<*   ¸}dM8'   w_I5$  ﹽqZD1!   ﵸkT?-   {dN:)   *s]H5%  ࠪ (a~jUA/   '` %FZm~r`L:* $3Ym!/?Qcr~ufUC2$   .?Qcs )8HWeouupfXI9+  )7GWfqxyt #/=JV_dd_VJ=0#  "/=KWafgc '2=GNRRNF<1&  '2>HPTUQ (08>AA=7/&  (19?CC@ %+/11.*#  %+0331 "##!  #%%#          %*'4BP^jt}ȏ"/>O_o~¿ͧ(7H[nμ-?Rg| ½#3F[q '8Lbz +=Ri/BXo3F\t7J`y :Nd| >Qg~BTiGWkKZl~Q]m} 侽Wan{ݲ^eozأejqy嘛mptx}ڌuuvxz|~~}}~~}||}|yxwvuutuvwyz{{zywusqppqrstuvwwvutsrqonnmnqt{}yuroljiggffghjklmmljigecbbabbcdefghijjihgfdba`__`bfmwysmgc_\ZYXWWXYZ[\]^^]\ZXWUTSSTUVWXYZ[\\[ZYWVTRQPOPSX`jxypg`YTOLJIHHIJKLMNNMKJHGFEEFGHIKLMMNNMMLJIGECA@@BEJR^l}xmbXPIC?=;::;<=>>??>><;:987789:;<=>??>=<:86532247=FRbtwj]QG>830.--,--.//00/.-,+**+,-./00110/.-+)(&&(,2;HYlvgXK?5.(%#"!!"#$$#"!!  !!"#$$#" "(2@Qe{veUF8.% !+9K_vvdRB4(  &4FZqvcQ?0$     "0BWnvcP>.!    .?TkwcP=- $ ,=RhxdO<,    +O_o~¿ͧ(7H[nμ-?Rg| ¾#3F[q '8Lbz +=Ri /AWo 2E[s 5H^v 8K`w :L`v ;L^r BGKOSUVWXXYXWVVWX\ajv<989:<=?@AA$BABEIP[iz?9410/.././14:BN]pE;3.)&#"!   !"$'-7DThK?5,%  $.Skt`L:* % +=RivcO<+  +-   *;Oe{fR>-    *:Nd{fR>-    *:Nc|gQ>,    ):Mb|gQ>,  )9La'4BP^jt}ȏ"/>O_o~¿ͧ(7H[nμ-?Rg| ½#3F[q '8Lbz +=Ri /AWo 2E[s 6H^v 8K`w;L`vIWfu欪?GR^ju 敔@ELU^gnty|~  聀~~BDHMSY^cfhjkk lmnmlkmot|FEFHKNQSUWXXYY Z[\[Z[]agp|LGEDDEFGHHII JKLKLOT[erSLGCA?>>== >? @?>?ADIQ\k|[RKE@<975445676657;AIUdvdZPHA;620.-,,-./.-,-/39BO_rmaVKB:4/+)'&&%%&'('&%&),3SjuaM:*  +=QhvaM:*    ++ 0񹩕~eN9( 0񴤏x`I5%0򮝈qZD1! 1򧖁jT?- 1ycM9( 1p[F3$1xeR?. 1zkZH7( 2k]N>/! 2[OB4' 2J@5* 3;3*  3,& 4  4 5 678;Ҧկ總    򒨻񍤸򅜱~ | {zyxҩձ线   󏧽 򍦼􌤺򉢸򈠶񇞴򃚯~| {zyx휦ҥկ緼    򐧻򌤸񊡶򄛰~ | { zyx3F# U Nytt lager      JUKgggUKBOV]aacdfgx7777776667777777777777777777777777777777777777777777777777x777777888999::::::;;;;;<<<<<<<<====================x7777776667777777777777777777777777777777777777777777777777==<==<<<<<<;;;;;::::::::9999999998888888888887777777@o$")/474. $!                                               @o$")/474. $!                                               @o$")/474. $!                                               $%,5:s5 -(                                               @?77 4 .-)))))((( ( ( ' ' ' ' ' & & & & & & & % % & -,)&"!"  ! &  &  &  &  &  &  %  %  &  &  &  &  &  &  &  '  '  ' @?77 4 .-)))))((( ( ( ' ' ' ' ' & & & & & & & % % & 6+72# ! &  &  &  &  &  &  %  %  &  &  &  &  &  &  &  '  '  ' @?77 4 . - )))))((( ( ( ' ' ' ' ' & & & & & & & % % & -,)&"!"  ! &  &  &  &  &  &  %  %  &  &  &  &  &  &  &  '  '  ' 77 4 .- )))))((( ( ( ' ' ' ' ' & & & & & & & % % & 6+72# ! &  &  &  &  &  &  %  %  &  &  &  &  &  &  &  '  '  ' @"""""" "                """""""@""""""      <<};83 -&     !!!!!!!!"""""""@""""""      <<};83 -&     !!!!!!!!"""""""<<<<<<<;;;;;<<<<<<<<<<< !"  #(. 5============777777777777766==66777777777777766777777777777787     888:;      888:;      888:;      888:; '  '  ' ( ((())))++,0 '  '  ' ( ((())))++,0 '  '  ' ( ((())))++,0 '  '  ' ( ((())))++,0"""""""""""""""""""""""""""""""""""""""""""""@7777*F# 3 Nytt lager#2     hu3h3hs%@|8R   @ @ ~}|{zyxwvuutsrqponmlkjjihgfedcba`_~}|{zyxwvuttsrqponmlkjiihgfedcba`_~~}|{zyxwvuttsrqponmlkjiihgfedcba`_~~}|{zyxwvutssrqponmlkjihhgfedcba`_~}}|{zyxwvutsrrqponmlkjihhgfedcba`_~}||{zyxwvutsrrqponmlkjihggfedcba`_~}||{zyxwvutsrqqponmlkjihgffedcba`_~}|{{zyxwvutsrqqponmlkjihgffedcba`_~}|{{zyxwvutsrqpponmlkjihgfeedcba`_~}|{zzyxwvutsrqpoonmlkjihgfeedcba`_~}|{zzyxwvutsrqpoonmlkjihgfeddcba`_~}|{zyyxwvutsrqponnmlkjihgfeddcba`_~}|{zyxxwvutsrqponnmlkjihgfedccba`_~}|{zyxxwvutsrqponmmlkjihgfedcbba`_~}|{zyxwwvutsrqponmmlkjihgfedcbba`_~}|{zyxwwvutsrqponmllkjihgfedcbaa`_~}|{zyxwvvutsrqponmlkkjihgfedcbaa`_~}|{zyxwvvutsrqponmlkkjihgfedcba``_~}|{zyxwvuutsrqponmlkjjihgfedcba``_~}|{zyxwvuttsrqponmlkjjihgfedcba`__~}|{zyxwvuttsrqponmlkjiihgfedcba`_^~~}|{zyxwvutssrqponmlkjiihgfedcba`_^~}}|{zyxwvutssrqponmlkjihhgfedcba`_^~}}|{zyxwvutsrrqponmlkjihggfedcba`_^~}||{zyxwvutsrqqponmlkjihggfedcba`_^~}||{zyxwvutsrqqponmlkjihgffedcba`_^~}|{{zyxwvutsrqpponmlkjihgffedcba`_^~}|{zzyxwvutsrqpponmlkjihgfeedcba`_^~}|{zzyxwvutsrqpoonmlkjihgfeddcba`_^~}|{zyyxwvutsrqpoonmlkjihgfeddcba`_^~}|{zyyxwvutsrqponnmlkjihgfedccba`_^~}|{zyxxwvutsrqponmmlkjihgfedccba`_^~}|{zyxxwvutsrqponmmlkjihgfedcbba`_^~}|{zyxwwvutsrqponmllkjihgfedcbba`_^~}|{zyxwvvutsrqponmllkjihgfedcbaa`_^~}|{zyxwvvutsrqponmlkkjihgfedcba``_^~}|{zyxwvuutsrqponmlkkjihgfedcba``_^~}|{zyxwvuutsrqponmlkjjihgfedcba`__^~}|{zyxwvuttsrqponmlkjiihgfedcba`__^~~}|{zyxwvuttsrqponmlkjiihgfedcba`_^^~~}|{zyxwvutssrqponmlkjihhgfedcba`_^^~}}|{zyxwvutsrrqponmlkjihhgfedcba`_^]~}}|{zyxwvutsrrqponmlkjihggfedcba`_^]~}||{zyxwvutsrqqponmlkjihggfedcba`_^]~}|{{zyxwvutsrqqponmlkjihgffedcba`_^]~}|{{zyxwvutsrqpponmlkjihgfeedcba`_^]~}|{zzyxwvutsrqpoonmlkjihgfeedcba`_^]~}|{zzyxwvutsrqpoonmlkjihgfeddcba`_^]~}|{zyyxwvutsrqponnmlkjihgfeddcba`_^]~}|{zyxxwvutsrqponnmlkjihgfedccba`_^]~}|{zyxxwvutsrqponmmlkjihgfedcbba`_^]@ _^]\[ZYXWVUUTSRQPONMLKJJIHGFEDCBA@??>=<;:98765443210/.-,+**)('&%_^]\[ZYXWVUTTSRQPONMLKJIIHGFEDCBA@??>=<;:98765443210/.-,+*))('&%^^]\[ZYXWVUTSSRQPONMLKJIIHGFEDCBA@?>>=<;:98765433210/.-,+*))('&%^^]\[ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>==<;:98765433210/.-,+*)(('&%^]]\[ZYXWVUTSRRQPONMLKJIHHGFEDCBA@?>==<;:98765432210/.-,+*)(''&%^]\\[ZYXWVUTSRRQPONMLKJIHGGFEDCBA@?>=<<;:98765432210/.-,+*)(''&%^]\\[ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<<;:98765432110/.-,+*)('&&%^]\[[ZYXWVUTSRQPPONMLKJIHGFFEDCBA@?>=<;;:98765432100/.-,+*)('&&%^]\[[ZYXWVUTSRQPPONMLKJIHGFEEDCBA@?>=<;::98765432100/.-,+*)('&%%^]\[ZZYXWVUTSRQPOONMLKJIHGFEEDCBA@?>=<;::9876543210//.-,+*)('&%$^]\[ZYYXWVUTSRQPOONMLKJIHGFEDDCBA@?>=<;:99876543210//.-,+*)('&%$^]\[ZYYXWVUTSRQPONNMLKJIHGFEDCCBA@?>=<;:99876543210/..-,+*)('&%$^]\[ZYXXWVUTSRQPONNMLKJIHGFEDCCBA@?>=<;:98876543210/.--,+*)('&%$^]\[ZYXXWVUTSRQPONMMLKJIHGFEDCBBA@?>=<;:98876543210/.--,+*)('&%$^]\[ZYXWWVUTSRQPONMLLKJIHGFEDCBBA@?>=<;:98776543210/.-,,+*)('&%$^]\[ZYXWWVUTSRQPONMLLKJIHGFEDCBAA@?>=<;:98766543210/.-,,+*)('&%$^]\[ZYXWVVUTSRQPONMLKKJIHGFEDCBAA@?>=<;:98766543210/.-,++*)('&%$^]\[ZYXWVUUTSRQPONMLKKJIHGFEDCBA@@?>=<;:98765543210/.-,++*)('&%$^]\[ZYXWVUUTSRQPONMLKJJIHGFEDCBA@??>=<;:98765543210/.-,+**)('&%$^]\[ZYXWVUTTSRQPONMLKJJIHGFEDCBA@??>=<;:98765443210/.-,+*))('&%$^]\[ZYXWVUTTSRQPONMLKJIIHGFEDCBA@?>>=<;:98765443210/.-,+*))('&%$^]\[ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>>=<;:98765433210/.-,+*)(('&%$]]\[ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>==<;:98765432210/.-,+*)(('&%$]]\[ZYXWVUTSRRQPONMLKJIHGGFEDCBA@?>==<;:98765432210/.-,+*)(''&%$]\\[ZYXWVUTSRQQPONMLKJIHGGFEDCBA@?>=<<;:98765432110/.-,+*)(''&%$]\[[ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<;;:98765432110/.-,+*)('&&%$]\[[ZYXWVUTSRQPPONMLKJIHGFFEDCBA@?>=<;;:98765432100/.-,+*)('&%%$]\[ZZYXWVUTSRQPPONMLKJIHGFEEDCBA@?>=<;::98765432100/.-,+*)('&%%$]\[ZZYXWVUTSRQPOONMLKJIHGFEDDCBA@?>=<;::9876543210//.-,+*)('&%$$]\[ZYYXWVUTSRQPONNMLKJIHGFEDDCBA@?>=<;:99876543210/..-,+*)('&%$$]\[ZYYXWVUTSRQPONNMLKJIHGFEDCCBA@?>=<;:98876543210/..-,+*)('&%$#]\[ZYXXWVUTSRQPONMMLKJIHGFEDCCBA@?>=<;:98876543210/.--,+*)('&%$#]\[ZYXWWVUTSRQPONMMLKJIHGFEDCBBA@?>=<;:98776543210/.--,+*)('&%$#]\[ZYXWWVUTSRQPONMLLKJIHGFEDCBAA@?>=<;:98776543210/.-,,+*)('&%$#]\[ZYXWVVUTSRQPONMLLKJIHGFEDCBAA@?>=<;:98766543210/.-,++*)('&%$#]\[ZYXWVVUTSRQPONMLKKJIHGFEDCBA@@?>=<;:98766543210/.-,++*)('&%$#]\[ZYXWVUUTSRQPONMLKJJIHGFEDCBA@@?>=<;:98765543210/.-,+**)('&%$#]\[ZYXWVUUTSRQPONMLKJJIHGFEDCBA@??>=<;:98765443210/.-,+**)('&%$#]\[ZYXWVUTTSRQPONMLKJIIHGFEDCBA@??>=<;:98765443210/.-,+*))('&%$#]\[ZYXWVUTSSRQPONMLKJIIHGFEDCBA@?>>=<;:98765433210/.-,+*))('&%$#]\[ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>==<;:98765433210/.-,+*)(('&%$#]\[ZYXWVUTSRRQPONMLKJIHHGFEDCBA@?>==<;:98765432210/.-,+*)(''&%$#\\[ZYXWVUTSRRQPONMLKJIHGGFEDCBA@?>=<<;:98765432210/.-,+*)(''&%$#\\[ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<<;:98765432110/.-,+*)('&&%$#\[[ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<;;:98765432100/.-,+*)('&&%$#\[[ZYXWVUTSRQPPONMLKJIHGFEEDCBA@?>=<;;:98765432100/.-,+*)('&%%$#\[ZZYXWVUTSRQPOONMLKJIHGFEEDCBA@?>=<;::9876543210//.-,+*)('&%%$#\[ZYYXWVUTSRQPOONMLKJIHGFEDDCBA@?>=<;:99876543210//.-,+*)('&%$$#\[ZYYXWVUTSRQPONNMLKJIHGFEDCCBA@?>=<;:99876543210/..-,+*)('&%$##\[ZYXXWVUTSRQPONNMLKJIHGFEDCCBA@?>=<;:98876543210/.--,+*)('&%$##\[ZYXXWVUTSRQPONMMLKJIHGFEDCBBA@?>=<;:98876543210/.--,+*)('&%$#"  $#"!   $#"!   $#"!   $#"!   $#"!   $#"!   $#"!   $#"!   $#"!   $#"!   $#"!   #"!   #"!   #""!   #""!   #"!!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   #"!   "!   "!   "!!   "!!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!   "!        ??~}|{zyxwwvutsrqponmmlkjihgfedcbba`_^]~}|{zyxwwvutsrqponmllkjihgfedcbaa`_^]~}|{zyxwvvutsrqponmlkkjihgfedcbaa`_^]~}|{zyxwvvutsrqponmlkkjihgfedcba``_^]~}|{zyxwvuutsrqponmlkjjihgfedcba``_^]~}|{zyxwvuttsrqponmlkjjihgfedcba`__^]~}|{zyxwvuttsrqponmlkjiihgfedcba`_^^]~~}|{zyxwvutssrqponmlkjiihgfedcba`_^^]~}}|{zyxwvutssrqponmlkjihhgfedcba`_^]]~}}|{zyxwvutsrrqponmlkjihggfedcba`_^]]~}||{zyxwvutsrrqponmlkjihggfedcba`_^]\~}||{zyxwvutsrqqponmlkjihgffedcba`_^]\~}|{{zyxwvutsrqpponmlkjihgffedcba`_^]\~}|{{zyxwvutsrqpponmlkjihgfeedcba`_^]\~}|{zzyxwvutsrqpoonmlkjihgfeedcba`_^]\~}|{zyyxwvutsrqpoonmlkjihgfeddcba`_^]\~}|{zyyxwvutsrqponnmlkjihgfedccba`_^]\~}|{zyxxwvutsrqponmmlkjihgfedccba`_^]\~}|{zyxxwvutsrqponmmlkjihgfedcbba`_^]\~}|{zyxwwvutsrqponmllkjihgfedcbba`_^]\~}|{zyxwvvutsrqponmllkjihgfedcbaa`_^]\~}|{zyxwvvutsrqponmlkkjihgfedcba``_^]\~}|{zyxwvuutsrqponmlkkjihgfedcba``_^]\~}|{zyxwvuutsrqponmlkjjihgfedcba`__^]\~}|{zyxwvuttsrqponmlkjiihgfedcba`__^]\~~}|{zyxwvuttsrqponmlkjiihgfedcba`_^^]\~~}|{zyxwvutssrqponmlkjihhgfedcba`_^^]\~}}|{zyxwvutsrrqponmlkjihhgfedcba`_^]]\~}}|{zyxwvutsrrqponmlkjihggfedcba`_^]\\~}||{zyxwvutsrqqponmlkjihggfedcba`_^]\\~}|{{zyxwvutsrqqponmlkjihgffedcba`_^]\[~}|{{zyxwvutsrqpponmlkjihgfeedcba`_^]\[~}|{zzyxwvutsrqpponmlkjihgfeedcba`_^]\[~}|{zzyxwvutsrqpoonmlkjihgfeddcba`_^]\[?\[ZYXWWVUTSRQPONMLLKJIHGFEDCBBA@?>=<;:98776543210/.-,,+*)('&%$#"\[ZYXWWVUTSRQPONMLLKJIHGFEDCBAA@?>=<;:98766543210/.-,,+*)('&%$#"\[ZYXWVVUTSRQPONMLKKJIHGFEDCBAA@?>=<;:98766543210/.-,++*)('&%$#"\[ZYXWVUUTSRQPONMLKKJIHGFEDCBA@@?>=<;:98765543210/.-,++*)('&%$#"\[ZYXWVUUTSRQPONMLKJJIHGFEDCBA@??>=<;:98765543210/.-,+**)('&%$#"\[ZYXWVUTTSRQPONMLKJJIHGFEDCBA@??>=<;:98765443210/.-,+*))('&%$#"\[ZYXWVUTTSRQPONMLKJIIHGFEDCBA@?>>=<;:98765443210/.-,+*))('&%$#"\[ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>>=<;:98765433210/.-,+*)(('&%$#"\[ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>==<;:98765432210/.-,+*)(('&%$#"\[ZYXWVUTSRRQPONMLKJIHGGFEDCBA@?>==<;:98765432210/.-,+*)(''&%$#"\[ZYXWVUTSRQQPONMLKJIHGGFEDCBA@?>=<<;:98765432110/.-,+*)(''&%$#"\[ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<;;:98765432110/.-,+*)('&&%$#"[[ZYXWVUTSRQPPONMLKJIHGFFEDCBA@?>=<;;:98765432100/.-,+*)('&%%$#"[ZZYXWVUTSRQPPONMLKJIHGFEEDCBA@?>=<;::98765432100/.-,+*)('&%%$#"[ZZYXWVUTSRQPOONMLKJIHGFEDDCBA@?>=<;::9876543210//.-,+*)('&%$$#"[ZYYXWVUTSRQPOONMLKJIHGFEDDCBA@?>=<;:99876543210/..-,+*)('&%$$#"[ZYYXWVUTSRQPONNMLKJIHGFEDCCBA@?>=<;:99876543210/..-,+*)('&%$##"[ZYXXWVUTSRQPONMMLKJIHGFEDCCBA@?>=<;:98876543210/.--,+*)('&%$##"[ZYXWWVUTSRQPONMMLKJIHGFEDCBBA@?>=<;:98776543210/.--,+*)('&%$#""[ZYXWWVUTSRQPONMLLKJIHGFEDCBAA@?>=<;:98776543210/.-,,+*)('&%$#"![ZYXWVVUTSRQPONMLLKJIHGFEDCBAA@?>=<;:98766543210/.-,++*)('&%$#"![ZYXWVVUTSRQPONMLKKJIHGFEDCBA@@?>=<;:98766543210/.-,++*)('&%$#"![ZYXWVUUTSRQPONMLKJJIHGFEDCBA@@?>=<;:98765543210/.-,+**)('&%$#"![ZYXWVUUTSRQPONMLKJJIHGFEDCBA@??>=<;:98765443210/.-,+**)('&%$#"![ZYXWVUTTSRQPONMLKJIIHGFEDCBA@??>=<;:98765443210/.-,+*))('&%$#"![ZYXWVUTSSRQPONMLKJIIHGFEDCBA@?>>=<;:98765433210/.-,+*))('&%$#"![ZYXWVUTSSRQPONMLKJIHHGFEDCBA@?>==<;:98765433210/.-,+*)(('&%$#"![ZYXWVUTSRRQPONMLKJIHHGFEDCBA@?>==<;:98765432210/.-,+*)(''&%$#"![ZYXWVUTSRRQPONMLKJIHGGFEDCBA@?>=<<;:98765432210/.-,+*)(''&%$#"![ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<<;:98765432110/.-,+*)('&&%$#"![ZYXWVUTSRQQPONMLKJIHGFFEDCBA@?>=<;;:98765432100/.-,+*)('&&%$#"![ZYXWVUTSRQPPONMLKJIHGFEEDCBA@?>=<;;:98765432100/.-,+*)('&%%$#"!ZZYXWVUTSRQPOONMLKJIHGFEEDCBA@?>=<;::9876543210//.-,+*)('&%%$#"!ZZYXWVUTSRQPOONMLKJIHGFEDDCBA@?>=<;:99876543210//.-,+*)('&%$$#"!?  "!   !   !   !   !   !   !   !   !   !   !   !   !   !   !   !   !   !   !   !   !                               ?L&3Markeringsmask-kopia[3{̟̫̓3ɯ}ʅʍʕe L3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3@ @ @ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3@@@@& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &?L&3Markeringsmask!3AYeq3uCKS[+ϷϿL3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3@ @ @ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3@@@@& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &?L&itpp-4.3.1/doc/images/itpp_logo.png000066400000000000000000000151361216575753400172340ustar00rootroot00000000000000PNG  IHDRd( pHYs B4tIME 8 ޭvIDAThޥzKmUssW?Umd!i@(%$H4hNhDP҈O:GB$&1vcr^ի{5gWp=a۹ꜽs9ˀc`9ֈw0š:1Aw8R uP\0U-TCpbvdV:Cc )kz'pcVhû&XE.ibK̮>, ts ʴfZ$Ƕ~?>i`w?[tmc "<;a Vtxs/}O?DL(qP*(x/^?W:Iyp~?/鯭tck<0[&("HSRXrwJ>wv~_w/re[@.0+*W7Oe{?'nl=y}2aU}o*ã!bJW>V;I%"c a'+sǒ!TH7nq2_΋E T{T@Skukymut;"U@amO#QK2>yY|" '/d8eJ(w^yvfg&1k7â_O*Kݗof=q> RuMUyBx#,F[ƛJRuW pW||Cj{/絗htuPop2;<&Pe*닸̳2yT F%#21w`T~xwE2LƻtwLtj )unkI=Y!}c?n皮wnVep'h B@gt"//q5xYzzU[>|Xag;on]QR/[^K7WO]LPP%HjpɬCt swܶ;˗wNg[uLWm+!-U[CR'G\bc4dB@\J dpm.J@sGoM4cNW~x ׫'emx9UóT:|8g-0Hױ;t>YTR|׳e3ǥzvSOu ĄB/o1 35^aQ l*Ȅ$)t 7(6O7o\՘˕}*0@F8@v'`TϾ h P K[agG/_>HԞGυ1Obul=\+|*B%;5\PXeQ={# @!h}rEN줓'sp Rx ,g/&u:=fjΥUM{/cmkjUCsoe &g4:f.!"*/P[?'(^ (঺7_߿"Ek-`p"-R4+AS)eDb2 CMeɳArE#WEcT@[]Ʉm HcȌ32&j40בaa>lO =lbMY(Eb&} |SD4XR`Rt]y2 `e(3!"g#`@̛{qJ|$L|jᄌj rkѣh7 %V'^Wˮ`t'%Rkhp1u߶<$;ͭ"w5 ^!V}uyOSp󕖹=1 %4(Y̻8J"ksL[:H9.ڐQ ֚/=&p'_Wz/5Tmyi/Oϝx GU~Gn]\lģI:κG|kkaBa='~<dv'\::2$]ѱ^o}~O ^DAaă)ɒqJe@{>>O̠'}YyKKek_XMyFFPĊص;//}G~ͧ^y勯UC]w5貈"h<==_K8r;xmL9O t0y{z٭di^MrS,Ux@PB1m`5 NxB Fr(uHZa,'~OO>m=;۷nd5Kbޅ#'QBJ;k8 0Cuvb2קy!ַ#nIWƆfr6#g^+rpEx w7.n+8I އ,F;HY! hRT]O8 ,%v8 ^,EvLlO!,>Gq8[nK2 5h-tj7Ln/;mqY)%n)[,t\Db4l⹠ YˠqQe:͆vOtX/&  .s%,hG˃{cQ<4B~}:p7渚'.0&tAdG(^qt1)([e'wOW_$~O}V3 1yT.0WP#sm%x>s-]wu!#aԇqR[5zVi|ݗU㌻{ԁN@+{ do9bh(\)r{'.C2?>8>tc,M-|;DX{셌V؞s܆w~:~WK, !Z!xu??R G^|5C؅lAbcL MYVtfsv4rՇ!΍J2{2N7cɡZ5FW{S;ZIɇ]p{md$Rg b@VXfO>ɘT'>7+RϼnՖ|t VH uu=Nj/AXXOpRpt&VITlѤU>mMsP3h%duECJX5aV~1ժ12ɔ~Leሕad ղ$6[Ϧn09 N$W|Z9zrpxpN=v%g/h(<.Z7ɧRDUJw84c)5\3s豚]xvT :xuj82fؽ OʹR0g[jcȰV1)Olx /b+Y{79438bRڠXZ'h]BY^R}$׺ķg>ƹL&CQuCf&n08ɻm˦+ݤ5W6Wհlh^=.{޹{=hlML^!,9 `T0"8M˸s;SęYn\2EUDLF(i[S*K؛_9I(;ha0_x>l͙ )(IsDX2#yoJ1 4ߋ~%}5)C$!` t&\vР4E U\6X qмqMTY}*($!P0յ*2Ed}ggRHpʆ];ECmUwּۙtRX=DN8koCG1R%"BTGv bRdxP\hkTR!{pQ`NH T)J ؃ |~Ùc褅͉Q4/m<)ݼ;MXe  (p: x T]EۡBh"4@8!6/e)1Y.zny2pQ1R%WF$!xث"78AAZs̋dkLcU*ٍoGϴсQ06  ,aLj0BB͆lF/"Gu+[m$(A7kZћQ8zHRJ3ϤYn^)PWqtB6qfI=۫4 UW{t<x`]3#0qz4QFCXW^˔$l*Τk9qdb9Sk iPUEA5m'2Nκj>j϶pn`QAB %/^㜖֦f $tp_=I=oj ϷQyA ಶp]P6ެa[s:A7E!BG-\ n,S+SMapl]=LF|FB7vD5C<ɺ8ڮeDG,ŲryMkVoJuL5u]+X'eᵶ9ܝsv5'vF!pVu!h? tOs> _6nk"t kSrڍ|$ - Rg~DrfTy5./.vIW"rpא+gOOvu,Ui4ί:)%41~ &kW­w}6ErP%0'OWa9n/޼dv[h*İʻ?#iܥ{{Ws}yJ>z%x2[{*Xl558xy,EW.OߑK3?/|kpaֳR^ң,n嵷NaEJ>N'7˓bc.^.;{p>Cspbl|6(늃l 4ACt\v^>v#[h/?vvX!wJۓicզqo)1L/8iYUB?j!>_&O\yk>iw|B/;dҽ"20”Źa}e)1p]?g% IENDB`itpp-4.3.1/doc/local/000077500000000000000000000000001216575753400143515ustar00rootroot00000000000000itpp-4.3.1/doc/local/Makefile.am000066400000000000000000000001741216575753400164070ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk EXTRA_DIST = $(doc_local_sources) $(html_local_sources) itpp-4.3.1/doc/local/authors.doc000066400000000000000000000026001216575753400165230ustar00rootroot00000000000000/*! \page authors IT++ People \section admins Project Admins - Bogdan Cristea (cristeab) - Tony Ottosson (tonyottosson) - Adam Piątyszek (ediap) \section developers Developers - Mirsad Čirkić (mirsadcirkic) - Johan Bergman (emwjohb) - Thomas Eriksson (thomases2) - Pål Frenger (frenger) - Fredrik Huss (frehu) - Erik G. Larsson (erik_g_larsson) - Stephan Ludwig (donludovico) - Robert Orzechowski (tytusz) - Andy Panov (andypanov) - Conrad Sanderson (conrad_s) - Andreas Wolfgang (andreas-w) - Simon Wood (sgwoodjr) \section retired Retired Developers - Håkan Eriksson (hakanbe) - Thomas Lemaire - Anders Persson - Tobias Ringstrom - Jonas Samuelsson \section contributors Contributors - Mattias Andersson - Kumar Appaiah - Francois Cayre - Zbigniew Długaszewski - Mark Dobossy - Sean Finney - Teddy Furon - Bjorn Furugard - Kenneth Hilmersson - Peter Klotz - Krister Norlund - Steve Peters - Gorka Prieto - Martin Senst - Svante Signell - Vasek Smidl - Erik Stoy - Tobias Tynderfeldt \section distributors Distribution Maintainers - Kumar Appaiah - Debian GNU/Linux - Günter Dannoritzer (dannori) - openSUSE - Markus Dittrich - Gentoo Linux - Ed Hill (edhill) - Fedora */ itpp-4.3.1/doc/local/codingrules.doc000066400000000000000000000051371216575753400173640ustar00rootroot00000000000000/*! \page codingrules Coding Rules In the following sections we describe the naming conventions which are used for files, classes, structures, local variables, and global variables. \section cr_variables Default Naming Rules for Variables Variables are named using lower-case letters and words are separated using under-score. Abbreviations, when used in variable names, are also written with lower-case letters. Examples:
  • \c `fft_size'
  • \c `nrof_paths'
  • \c `my_variable_name'
Some variable names or parts of variable names are commonly used in several different functions and files to denote the same thing. For instance the following common names and prefixes should be used:
  • \c `rows' - number of rows in a matrix
  • \c `cols' - number of columns in a matrix
  • \c `nrof_' - number of ...
\section cr_files Default Naming Rules for Files Files are named using lower-case letters and words are separated using under-score. Abbreviations, when used in file names, are also written with lower-case letters. Source files are named using `.cpp' suffix, whereas header files end with `.h' extension. Examples:
  • `my_file.h'
  • `my_file.cpp'
\section cr_functions Default Naming Rules for Functions Function names are named using lower-case letters and words are separated using under-score. Abbreviations, when used in function names, are also written with lower-case letters. This rule applies both to stand-alone functions as well as to member functions of classes. Example:
  • int my_function_name(int a, int b)
\section cr_classes Default Naming Rules for Classes and Structures Each new word in a class or structure name should always start with a capital letter and the words should be separated with an under-score. Abbreviations are written with capital letters. Examples:
  • \c `My_Class_Name'
  • \c `My_Struct_Name'
  • \c `OFDM'
\section cr_classes_functionality Default Functionality of Classes All classes that are configured by input parameters should include:
  • default empty constructor
  • one or more additional constructor(s) that takes input parameters and initializes the class instance
  • setup function, preferably named \c `setup' or \c `set_parameters'
Explicit destructor functions are not required, unless they are needed. It shall not be possible to use any of the other member functions unless the class has been properly initiated with the input parameters. */ itpp-4.3.1/doc/local/copyright.doc000066400000000000000000001057721216575753400170640ustar00rootroot00000000000000/*! \page copyright Copyright and License \section gnugpl GNU GENERAL PUBLIC LICENSE \subsection version Version 3, 29 June 2007 \verbatim Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. \endverbatim \section preamble Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. \section terms TERMS AND CONDITIONS \subsection definitions 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. \subsection source_code 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. \subsection basic_permissions 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. \subsection protecting_users 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. \subsection conveying_verbatim 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. \subsection conveying_modified_source 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. \subsection conveying_non_source 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. \subsection additional_terms 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. \subsection termination 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. \subsection acceptance_not_required 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. \subsection automatic_licensing 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. \subsection patents 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. \subsection no_surrender 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. \subsection gnu_affero_gpl 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. \subsection revised_versions 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. \subsection disclaimer_warranty 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. \subsection limit_liability 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \subsection interpret_15_16 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. \subsection endofterms END OF TERMS AND CONDITIONS \section howtoapply How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \verbatim Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . \endverbatim Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: \verbatim Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \endverbatim The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see http://www.gnu.org/licenses/. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read http://www.gnu.org/philosophy/why-not-lgpl.html. */ itpp-4.3.1/doc/local/documentation.doc000066400000000000000000000100521216575753400177070ustar00rootroot00000000000000/*! \page documentation Documentation Rules \section doc_general General Rules All classes in IT++ should be properly documented with Doxygen comments in include (`.h') files. Source (`.cpp') files should be documented according to a normal standard for well documented C++ code. An example of how the interface of a class shall be documented in IT++ is shown here: \verbatim /*! * \brief Brief description of My_Class here * * Detailed description of My_Class here. With example code if needed. */ class My_Class { public: //! Default constructor My_Class(void) { setup_done = false; } /*! * \brief Constructor that initializes the class with parameters * * Detailed description of the constructor here if needed * * \param[in] param1 Description of \a param1 here * \param[in] param2 Description of \a param2 here */ My_Class(TYPE1 param1, TYPE2 param2) { setup(param1, param2); } /*! * \brief Setup function for My_Class * * Detailed description of the setup function here if needed * * \param[in] param1 Description of \a param1 here * \param[in] param2 Description of \a param2 here */ void setup(TYPE1 param1, TYPE2 param2); /*! * \brief Brief description of member_function1 * * Detailed description of member_function1 here if needed * * \param[in] param1 Description of \a param1 here * \param[in] param2 Description of \a param2 here * \param[in,out] param3 Description of \a param3 here * \return Description of the return value here */ TYPE4 member_function1(TYPE1 param1, TYPE2 param2, TYPE3 ¶m3); private: bool setup_done; /*!< Variable that checks if the class is properly initialized with parameters */ TYPE1 private_variable1; //!< Short description of private_variable1 here TYPE2 private_variable2; //!< Short description of private_variable2 here }; \endverbatim \section doc_header File Header All files should start with the following header, which include Doxygen's \c \\file, \c \\brief and \c \\author tags, and a common copyright note: \verbatim /*! * \file * \brief Brief description of the file here * \author Names of the authors who contributed to this code * * Detailed description of the file here if needed. * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ \endverbatim \section doc_groups Grouping Various Parts All functions must be added to a Doxygen group in order to appear in the documentation. The following code example defines the group \c `my_group': \verbatim /*! * \defgroup my_group Brief description of the group here * * Detailed description of the group here */ \endverbatim The following example shows how to document the function \c `my_function' and how to add it to the group \c `my_group': \verbatim /*! * \brief Brief description of my_function here * \ingroup my_group * * Detailed description of my_function here * * \param[in] param1 Description of \a param1 here * \param[in] param2 Description of \a param2 here * \return Description of the return value here */ TYPE3 my_function(TYPE1 param1, TYPE2 ¶m2); \endverbatim */ itpp-4.3.1/doc/local/features.doc000066400000000000000000000047631216575753400166700ustar00rootroot00000000000000/*! \page features Main features of IT++ A short list of the main features of IT++ is given below sorted in different categories. Many more features and functions exist and for these we refer to the reference documentation. \section prog_features Programming features - templated array and stack container classes - input and file argument parser - timing functions and classes \section math_features Basic mathematical features - templated vector and matrix classes - sparse vectors and matrix classes - elementary functions on vectors and matrices - statistics classes and functions - matrix decompositions such as eigenvalue, Cholesky, LU, Schur, SVD, and QR - solving linear system of equations (including over and underdetermined) - random number generation (Mersenne Twister generator) - binary and Galois types (both scalar and vector and matrices) - integration of 1-dimensional functions - unconditional nonlinear optimization (Quasi-Newton search) \section sigproc_features Signal processing - filter functions and classes - frequency domain filtering - FFT, DFT, DCT, and Hadamard transforms - time and frequency domain windows - evaluating and finding roots of polynomials (and inverse operations) - filter design functions - fast independent component analysis (fast ICA) \section comm_features Communications - modulators (BPSK, PSK, PAM, QAM) - vector modulators (e.g. for OFDM and MIMO) - OFDM and CDMA modulators - pulse shaping filters (including RC and RRC) - binary symmetric (BSC) and additive white Gaussian Noise (AWGN) channels - multipath fading channels (both frequency-flat and frequency-selective) - COST 207, COST 257, and ITU channel models - Hamming, extended Golay, and CRC codes - BCH and Reed-Solomon codes - convolutional and punctured convolutional codes - recursive convolutional codes - turbo codes - interleavers \section protocol_features Protocol simulation - event-based simulation classes - signal and slots for simplified syntax - TCP clients and servers - selective repeat ARQ - queue classes - packet generators \section srccode_features Source coding - Scalar Quantizer (SQ) and Vector Quantizer (VQ) classes and functions for training of these - LPC, LSF, and cepstrum parameter calculation for speech processing - Gaussian Mixture Modeling - reading and saving several different audiofile formats - reading and saving images in PNM format \section other_features Other features - binary file format for most built in and IT++ types - fixed-point scalar, vector and matrix types */ itpp-4.3.1/doc/local/help_wanted.doc000066400000000000000000000022271216575753400173350ustar00rootroot00000000000000/*! \page help_wanted Make a Difference Do not ask what IT++ can do for you. Ask what you can do for IT++. You can help us to develop the IT++ library. There are always a lot of things you can do: - Start using IT++ - Tell your friends about IT++ and help them to get started using it - If you find a bug, report it to us. Without your help we can never hope to produce a bug free code. - Help us to improve the documentation by providing information about documentation bugs - Answer support requests in the IT++ discussion forums on SourceForge. If you know the answer to a question, help others to overcome their IT++ problems. - Help us to improve our algorithms. If you know of a better way (e.g. that is faster or requires less memory) to implement some of our algorithms, then let us know. - Help us to port IT++ to new platforms. If you manage to compile IT++ on a new platform, then tell us how you did it. - Send us your code. If you have a good IT++ compatible code, which you can release under the GPL, and you think it should be included in IT++, then send it to us. - Become an IT++ developer. Send us an e-mail and tell what you can do for IT++. */ itpp-4.3.1/doc/local/index.doc.in000066400000000000000000000116171216575753400165620ustar00rootroot00000000000000/*! \mainpage IT++ Documentation \htmlonly
\endhtmlonly \section about About IT++ IT++ is a C++ library of mathematical, signal processing and communication classes and functions. Its main use is in simulation of communication systems and for performing research in the area of communications. The kernel of the library consists of generic vector and matrix classes, and a set of accompanying routines. Such a kernel makes IT++ similar to MATLAB, GNU Octave or SciPy. The IT++ library originates from the former department of Information Theory at the Chalmers University of Technology, Gothenburg, Sweden. Because the library is coded in C++, the name IT++ seemed like a good idea at the time. While departments come and go, IT++ have developed a life of its' own and is now released under the terms of the GNU General Public License (GPL) for you to enjoy. IT++ is being developed and widely used by researchers who work in the area of communications, both in the industry and at universities. In 2005, 2006 and 2007, IT++ was developed as a part of the European Network of Excellence in Wireless Communications (NEWCOM). IT++ makes an extensive use of existing open-source or commercial libraries for increased functionality, speed and accuracy. In particular BLAS, LAPACK and FFTW libraries can be used. Instead of the reference BLAS and LAPACK implementations, some optimized platform-specific libraries can be used as well, i.e.: - ATLAS (Automatically Tuned Linear Algebra Software) - includes optimised BLAS and a limited set of LAPACK routines - MKL (Intel Math Kernel Library) - includes all required BLAS, LAPACK and FFT routines (FFTW not required) - ACML (AMD Core Math Library) - includes BLAS, LAPACK and FFT routines (FFTW not required) . It is possible to compile and use IT++ without any of the above listed libraries, but the functionality will be reduced. IT++ should work on GNU/Linux, Sun Solaris, Microsoft Windows (with Cygwin, MinGW/MSYS or Microsoft Visual C++) and Mac OS X operating systems. \htmlonly
\endhtmlonly */ itpp-4.3.1/doc/local/installation.doc000066400000000000000000000753751216575753400175620ustar00rootroot00000000000000/*! \page installation IT++ Installation \section toc Table of Contents - \ref requirements - \ref download - \ref inst_instr_cmake - \ref localinst_cmake - \ref obsolete - \ref inst_instructions - \ref modularization - \ref external_libs - \ref optimisation - \ref config_status - \ref compile_step - \ref test_step - \ref install_step - \ref localinst - \ref msvc \section requirements IT++ Requirements IT++ should compile without errors or warnings on most GNU/Linux, BSD and UNIX systems, and on POSIX based environments for Microsoft Windows like Cygwin or MinGW with MSYS. It can be also built on Microsoft Windows NT/2000/XP using Microsoft's Visual C++ .NET (or Express), but our support for this compiler is limited. For GNU/Linux, FreeBSD, Solaris SunOS, Cygwin and MinGW we assume that you have at least the following GNU software installed on your computer: - GNU make, version 3.77 or later (check version with `make --version' or `gmake --version`) - GCC - GNU Compilers Collection including C (gcc) and C++ (g++) compilers, version 3.3.x or later (check version with `gcc --version') . In most cases, a Fortran compiler is also required for proper linking of IT++ with external BLAS and LAPACK libraries. GCC provides g77 (versions 3.x.x) or gfortran (versions 4.x.x) compilers. We strongly recommend that you use recent stable releases of the GCC, if possible. We do not actively work on supporting older versions of the GCC, and they may therefore (without prior notice) become unsupported in future releases of IT++. Instead of using GCC, you might try to build and link the IT++ library using other C/C++/Fortran compilers. For instance, Intel C++ (icpc) and Fortran (ifc) compilers are known to work well. To perform tests, two command line programs: \c sed and \c diff are required. Optionally, you might need a few additional programs, i.e. Doxygen, LaTeX, Dvips and Ghostscript, to generate the HTML documentation. The HTML documentation for each release is also available as separate packages for download, so you do not need to generate it during the installation. In order to use all functionality provided by the IT++ library, it is recommended that you have some external libraries compiled and installed in your computer. The basic set of them is: BLAS, LAPACK and FFTW (version 3.0.0 or later). Instead of NetLib's reference BLAS and LAPACK implementations, some optimized platform-specific libraries can be used as well, i.e.: - ATLAS (Automatically Tuned Linear Algebra Software) - includes optimised BLAS and a limited set of LAPACK routines (version 3.6.0 or later) - MKL (Intel Math Kernel Library) - includes all required BLAS, LAPACK and FFT routines (version 8.1.1 or later; FFTW not required) - ACML (AMD Core Math Library) - includes BLAS, LAPACK and FFT routines (version 2.5.3 or later; FFTW not required) Except the Intel MKL, the above mentioned BLAS/LAPACK implementations require additional support libraries provided by a Fortran compiler. To use them with IT++, please make sure that you have the compatible Fortran compiler installed. For instance, if your system BLAS and LAPACK libraries were compiled and linked with GNU g77, you should have the same compiler installed on your system before starting the IT++ configuration process. It is possible to compile and use IT++ without these external libraries, but the functionality will be reduced. Therefore, we recommend that you take some time and effort to provide these external libraries in your system. Please note that the basic set of them (FFTW, BLAS and LAPACK) is usually included in most modern Linux distributions. \section download Obtaining the IT++ Source Codes IT++ is released under the terms of the GNU General Public License (GPL) and hence the source code of the IT++ library is available for free download. To obtain the IT++ source code, visit the project pages on SourceForge: - http://itpp.sourceforge.net/ . and download the file named \c itpp-\.tar.gz or \c itpp-\.tar.bz2, where \c \ is the latest release number, e.g. 4.0.0. Assuming that you have already downloaded the latest IT++ sources, untar and unpack the sources, and enter the unpacked directory. Depending on the package type you have downloaded, use the following commands: \verbatim % gzip -cd itpp-.tar.gz | tar xf - % cd itpp- \endverbatim \verbatim % bzip2 -cd itpp-.tar.bz2 | tar xf - % cd itpp- \endverbatim \section inst_instr_cmake Configuration and Installation with cmake Since version 4.3.0, the IT++ library uses cmake as build system for generating Unix Makefiles, VisualStudio project files or XCode project files. For example, in order to compile and install on Unix-based systems, one can use (from the sources folder): \verbatim % mkdir build % cd build % cmake .. % make % make install \endverbatim By default, IT++ library is compiled as shared library in release mode, the HTML documentation is generated (if Doxygen is detected) and no unit tests are compiled. The \c `cmake' command can be invoked with additional options: - \c `-DITPP_SHARED_LIB=off', allows to compile the static version of IT++ library. By default this option is set to `on'. - \c `-DBLA_VENDOR=vendor', where vendor can be `ACML', `Intel11' or `ATLAS'. This is helpful in selecting a specific external library (ACML or MKL 11). If these libraries are installed in nonstandard locations, on Linux, set \c `LD_LIBRARY_PATH' environment variable to the location where the libraries are installed. For Windows `PATH' environment variable should be set, while Mac OS X users should use `DYLD_LIBRARY_PATH'. - \c `-DGTEST_DIR=/path/to/gtest/sources' is used to specify the path to Google unit test framework (gtest) sources. Thus the unit tests are compiled and can be run separately to check IT++ library. - \c `-DOLD_TESTS=on' is used to activate the compilation of older unit tests (no unit test framework required). By default this option is set to `off'. These tests are no longer maintained, so it is recommended to use the tests based on Google framework. In order to run these tests use `check_tests.py' script found in extras folder (Python is required). - \c `-DHTML_DOCS=off' allows to disable the generation of HTML documentation. Default option is `on' provided that Doxygen is found. - \c `-DCMAKE_BUILD_TYPE=Release' allows to specify the build type: Release (default) or Debug. The library name in Debug mode is itpp_debug.*, so that both Release and Debug versions could exist in the installation folder. - \c `-DCMAKE_INSTALL_PREFIX=/install/path' allows to specify the installation path. This is used when installing IT++, either from command line, with 'make install', either using the INSTALL project from Visual Studio. Note that the user should have write permissions to the installation folder. Note: in order to run the unit test binaries, external libraries need to be in your system path. On Linux one can use ldconfig, while in Windows `PATH' variable should be set to the location of external libraries (ACML or MKL). For further details on the available switches see cmake documentation. Library detection examples: - on Linux, 64 bits: - in order to detect ACML library (installed in the default path `/opt/acmln.n.n/') use (from `build' folder): \verbatim % cmake .. -DBLA_VENDOR=ACML \endverbatim - in order detect MKL 11 library the following commands can be used: \verbatim % export LD_LIBRARY_PATH=/opt/intel/composer_xe_2013.2.146/mkl/lib/intel64/ % cmake .. -DBLA_VENDOR=Intel11 \endverbatim - in order to detect ATLAS library use \verbatim % export LD_LIBRARY_PATH=/usr/lib64/atlas % cmake .. -DBLA_VENDOR=ATLAS \endverbatim - on Windows, 32 bits, with MS Visual C++: - in order to detect ACML library (installed in the default path `C:\\AMD\\acmln.n.n') for Intel build the following variables must be set (from the GUI): \verbatim BLA_VENDOR=ACML CMAKE_Fortran_COMPILER_ID=Intel \endverbatim - in order to detect ACML library using PGI build the following variables must be set: \verbatim BLA_VENDOR=ACML CMAKE_Fortran_COMPILER_ID=PGI \endverbatim - in order to detect MKL 11, the following variables must be set: from Windows Properties \verbatim PATH=%PATH_TO_INTEL_COMPOSER%/mkl/lib/ia32 \endverbatim (note that PATH variable must point to the location of mkl_rt.lib) and from cmake \verbatim BLA_VENDOR=Intel11 \endverbatim - on Windows, 32 bits, with MINGW: - in order to detect MKL 11 the PATH variable must be set as before and from command line use: \verbatim % "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" .. -G "MSYS Makefiles" -DBLA_VENDOR=Intel11 -DCMAKE_INSTALL_PREFIX="C:\ITPP" \endverbatim For more options see `cmake/Modules/FindBLAS.cmake' file. \subsection localinst_cmake How To Set Up a Local IT++ Installation without Being Root This section presents a walkthrough of how to easily set up an IT++ environment without being root (all files are installed locally). The philosophy behind this installation is: - to locally compile and install all required external libraries (LAPACK, BLAS and FFTW) from sources; this is because not all systems provide these libraries as ready to use binaries - to compile IT++ using all other available options with no modifications The source code will reside in the directories itpp-external-3.2.0 and itpp-4.3.0. The libraries will be created in the directories it++external-3.2.0 and it++4.3.0. The installation procedure goes as follows (\c $HOME can be replaced by any directory where you have write access):
  1. Download itpp-external-3.2.0.tar.bz2 and itpp-4.3.0.tar.bz2. Save them in your \c $HOME directory, and unpack them: \verbatim % cd $HOME % tar jzf itpp-external-3.2.0.tar.bz2 % tar jzf itpp-4.3.0.tar.bz2 \endverbatim
  2. Compile and install the external libs as shared libs: \verbatim % cd $HOME/itpp-external-3.0.0 % make distclean % ./configure --prefix=$HOME/it++external-3.2.0 % make && make install \endverbatim
  3. Compile and install IT++ library as shared library: \verbatim % cd $HOME/itpp-4.3.0 % mkdir build && cd build % cmake .. -DCMAKE_INCLUDE_PATH=$HOME/it++external-3.2.0/include -DCMAKE_LIBRARY_PATH=$HOME/it++external-3.2.0/lib -DCMAKE_INSTALL_PREFIX=$HOME/it++4.3.0 % make && make install \endverbatim
  4. Compile and install the external libs as static libs: \verbatim % cd $HOME/itpp-external-3.0.0 % make distclean % ./configure --prefix=$HOME/it++external-3.2.0 --enable-static --disable-shared % make && make install \endverbatim
  5. Compile and install IT++ library as static library: \verbatim % cd $HOME/itpp-4.3.0 % mkdir build && cd build % cmake .. -DCMAKE_INCLUDE_PATH=$HOME/it++external-3.2.0/include -DCMAKE_LIBRARY_PATH=$HOME/it++external-3.2.0/lib -DCMAKE_INSTALL_PREFIX=$HOME/it++4.3.0 -DBLA_STATIC=on -DITPP_SHARED_LIB=off % make && make install \endverbatim
  6. Please note that you could also enable unit tests compilation by providing the path to Google C++ Testing Framework. Your own programs can be compiled using the script 'itpp-config` found in $HOME/it++4.3.0/bin. \section obsolete Obsolete Configuration and Installation Instructions The instructions found in this section are now considered obsolete and are kept only for backward compatibility. They might be removed in the future. \subsection inst_instructions Configuration and Installation Instructions with autoconf, automake and libtool Since version 3.9.0, the IT++ library uses autoconf, automake and libtool for preparing Makefiles and configuration script, so the compilation procedure resembles a standard, well-known GNU method, i.e. \verbatim % ./configure % make \endverbatim The \c `configure' command can be invoked with additional switches and options (run `./configure --help' to get a full list of them). The most important are: - \c `--prefix=PREFIX' - set top installation directory to a certain \c PREFIX value. By default it is set to \c `/usr/local', so `make install' will install appropriate files into \c `/usr/local/include', \c `/usr/local/lib`, etc. - \c `--enable-debug' - build an extra library named \c `libitpp_debug.*' using special debugging flags for compiler and linker (disabled by default) - \c `--enable-exceptions' - enable exceptions handling of run-time errors instead of aborting the program (disabled by default) - \c `--disable-html-doc' - do not generate and install the HTML documentation (enabled by default) - \c `--disable-shared' - do not build the shared version of the library (enabled by default for non Windows based platforms) - \c `--disable-static' - do not build the static version of the library (enabled by default for Windows based platforms) . Plese note that each \c `--enable-\' switch can be replaced with its opposite switch \c `--disable-\'. \subsubsection modularization Modularization Since version 3.99.0, a modularization of the library has been introduced. Therefore, several additional switches have been added to the configure script, which can be used to disable building some of the library components. Here is a list of them: - \c `--disable-comm' - do not build the `Communications' module - \c `--disable-fixed' - do not build the `Fixed-point' module - \c `--disable-optim' - do not build the `Numerical optimisations' module - \c `--disable-protocol' - do not include the `Protocols' module - \c `--disable-signal' - do not build the `Signal processing' module - \c `--disable-srccode' - do not build the `Source coding' module \subsubsection external_libs External Libraries By default, the \c `configure' script checks for a few external libraries, which might be used by the IT++ library (cf. \ref requirements). The detection procedure is as follows: -# First, the presence of a BLAS library among MKL, ACML, ATLAS and NetLib's reference BLAS is checked. If one of the above mentioned can be used, \c HAVE_BLAS is defined. -# Next, some LAPACK library is being searched, but only if BLAS is available. Full set of LAPACK routines can be found in the MKL, ACML and NetLib's reference LAPACK libraries. Besides, ATLAS contains a subset of optimised LAPACK routines, which can be used with NetLib's LAPACK library (this is described in the ATLAS documentation). If some LAPACK library can be found, \c HAVE_LAPACK is defined. -# Finally, a set of separate checks for FFT libraries is executed. Currently three different libraries providing FFT/IFFT routines can be used: MKL, ACML and FFTW. If at least one of them is found, \c HAVE_FFT id defined. Besides, one of the following: \c HAVE_FFT_MKL, \c HAVE_FFT_ACML or \c HAVE_FFTW3 is defined, respectively. If some external libraries are installed in a non-standard location in your system, e.g. MKL in `/opt/intel/mkl/9.1', the \c `configure' script will not detect them automatically. In such a case, you should use LDFLAGS and CPPFLAGS environment variables to define additional directories to be searched for libraries (LDFLAGS) and include files (CPPFLAGS). For instance, to configure IT++ to link to 32-bit versions of MKL 9.1 external libraries, which is installed in `/opt/intel/mkl/9.1' directory, you should use the following commands: \verbatim % export LDFLAGS="-L/opt/intel/mkl/9.1/lib/32" % export CPPFLAGS="-I/opt/intel/mkl/9.1/include" % ./configure \endverbatim Instead of CPPFLAGS, one can use \c `--with-fft-include=\' configure option to set path to header files that provide FFT functionality, i.e. to `fftw3.h', `mkl_dft.h' or `acml.h'. In the case that external libraries have non-standard names, e.g. `libblas3.a' for BLAS, you might specify them to the configure using \c `--with-\' switches, where \c \ is one of the following: \c `blas', \c `lapack' or \c `fft'. You might use more than one library names by quoting them, e.g. \verbatim % ./configure --with-blas="-latlas -lblas" \endverbatim If there is only one library specified, you can use a simplified notation without the preceding `-l', e.g. \c `--with-fft=fftw3' instead of \c `--with-fftw=-lfftw3'. Please refer to the documentation of your external libraries, to find out what are the correct library names and paths on your architecture, operating system, etc. Since 4.0.3 release, the configure script provides a new \c `--with-zdotu=\' option. It can be used to force the default calling convention of BLAS \c `zdotu_' Fortran function. The BLAS libraries built with g77 compiler do not return the complex result of a function, but pass it via the first argument of the function. By using \c `--with-zdotu=void' option, this approach can be forced (g77 compatible). On the other hand, the libraries built with a newer gfortran compiler return the complex result like a normal function does, but calling such interface from C++ is not portable, due to incompatibilities between C++ complex and Fortran's COMPLEX. Therefore in such case a Fortran wrapper function \c `zdotusub_' can be used (\c `--with-zdotu=zdotusub'), however it requires a working Fortran compiler. By default, IT++ tries to guess the proper method based on the detected BLAS implementation. For instance, the BLAS library provided by Intel MKL works fine with the `void' method. Eventually, if no Fortran compiler is available and the `void' method can not be used, the \c zdotu_ BLAS function is not used at all and a relevant warning message is displayed during the configuration step. Although it is not recommended, you can intentionally prevent detection of some external libraries. To do this you should use \c `--without-\' or \c `--with-\=no', e.g.: \verbatim % ./configure --without-blas --without-lapack \endverbatim \subsubsection optimisation Optimisation Flags It is recommended to set the CXXFLAGS environment variable with some compiler- and platform-specific optimisation flags, before invoking the \c `configure' command. Additionally, \c `-DNDEBUG' should be included in the optimised CXXFLAGS, because it turns off all conditional assertion checks. This will improve the computation performance of many IT++ functions. For example, in the case of using the Intel Pentium 4 processor one might employ the following flags: \verbatim % CXXFLAGS="-DNDEBUG -O3 -march=pentium4 -pipe" ./configure \endverbatim In the case of Sun's UltraSPARC 64-bit platform and GCC compiler, the flags might be set as follows: \verbatim % export CXXFLAGS="-DNDEBUG -O3 -mcpu=v9 -m64 -pipe" % ./confiugre \endverbatim If CXXFLAGS is not set in the environment, it will be initialised with the default flags, i.e. "-DNDEBUG -O3 -pipe". \subsubsection config_status Configuration Status When the configuration process is finished, a status message is displayed. For instance, after having invoked the following configuration command \verbatim % ./configure --with-blas="-lblas" \endverbatim on a recent Gentoo Linux system with blas-atlas, lapack-atlas and fftw packages installed, one can observe something like this: \verbatim ------------------------------------------------------------------------------ itpp-4.0.3 library configuration: ------------------------------------------------------------------------------ Directories: - prefix ......... : /usr/local - exec_prefix .... : ${prefix} - includedir ..... : ${prefix}/include - libdir ......... : ${exec_prefix}/lib - datarootdir .... : ${prefix}/share - docdir ......... : ${datarootdir}/doc/${PACKAGE_TARNAME} Switches: - debug .......... : no - exceptions ..... : no - html-doc ....... : yes - shared ......... : yes - static ......... : no - explicit deps .. : no - zdotu .......... : zdotusub Documentation tools: - doxygen ........ : yes - latex .......... : yes - dvips .......... : yes - ghostscript .... : yes Testing tools: - diff ........... : yes Optional modules: - comm ........... : yes - fixed .......... : yes - optim .......... : yes - protocol ....... : yes - signal ......... : yes - srccode ........ : yes External libs: - BLAS ........... : yes * MKL .......... : no * ACML ......... : no * ATLAS ........ : yes - LAPACK ......... : yes - FFT ............ : yes * MKL .......... : no * ACML ......... : no * FFTW ......... : yes Compiler/linker flags/libs/defs: - CXX ............ : g++ - F77 ............ : gfortran - CXXFLAGS ....... : -DNDEBUG -O3 -pipe - CXXFLAGS_DEBUG . : - CPPFLAGS ....... : - LDFLAGS ........ : - LIBS ........... : -lfftw3 -llapack -lblas ------------------------------------------------------------------------------ Now type 'make && make install' to build and install itpp-4.0.3 library ------------------------------------------------------------------------------ \endverbatim \subsubsection compile_step Compilation Now, it is time for compiling and linking the IT++ library. To do so, please simply run the following command: \verbatim % make \endverbatim IT++ should compile without any errors or warnings. If this is not the case, please report the problem on the IT++ Help forum at SourceForge. Please include information about your OS, compiler version, external libraries and their versions, etc. \subsubsection test_step Testing the Compiled Library It is recommended that you check if your library has been compiled and linked properly and works as expected. To do so, you should execute the testing process: \verbatim % make check \endverbatim As a result, you should obtain a similar report: \verbatim ------------------------------------------------------------------------------ Test `array_test' PASSED. ------------------------------------------------------------------------------ Test `bessel_test' PASSED. ------------------------------------------------------------------------------ [...] ------------------------------------------------------------------------------ Test `window_test' PASSED. ------------------------------------------------------------------------------ Test `histogram_test' PASSED. ------------------------------------------------------------------------------ Test `stat_test' PASSED. ------------------------------------------------------------------------------ \endverbatim Check if all the executed tests PASSED. If not, please report the problem on the IT++ Help forum. \subsubsection install_step Installation Finally, you should install the compiled and linked library, include files and HTML documentation (optionally) by typing: \verbatim % make install \endverbatim Depending on the \c PREFIX settings during configuration, you might need the root (administrator) access to perform this step. Eventually, you might invoke the following command \verbatim % make clean \endverbatim to remove all files created during compilation process, or even \verbatim % make distclean \endverbatim to remove all files generated by the \c `configure' script. \subsection localinst How To Set Up a Local, Dual-config IT++ Installation without Being Root This section presents a walkthrough of how to easily set up an IT++ environment without being root (all files are installed locally). The installation results in two parallel versions of the IT++ library, one version with debugging features enabled (this is slow in general but can be valuable during the development phase) and one version which is complied with maximum optimization. When compiling executables, one can then easily generate two versions of a program: one for debugging and one for maximum runtime efficiency. See the Makefile below for an example. The philosophy behind this installation is: - to locally compile and install all required external libraries (LAPACK, BLAS and FFTW) from sources; this is because not all systems provide these libraries as ready to use binaries - to install two parallel IT++ libraries: one optimized and one for debugging - to use static linking only (this gives larger executables but is sometimes more portable) The source code will reside in the directories itpp-external-3.0.0 and itpp-4.0.0. The libraries will be created in the directories it++external-3.0.0 and it++4.0.0. The installation procedure goes as follows (\c $HOME can be replaced by any directory where you have write access):
    1. Download itpp-external-3.0.0.tar.bz2 and itpp-4.0.0.tar.bz2. Save them in your \c $HOME directory, and unpack them: \verbatim % cd $HOME % tar jzf itpp-external-3.0.0.tar.bz2 % tar jzf itpp-4.0.0.tar.bz2 \endverbatim
    2. Compile and install the external libs \verbatim % cd $HOME/itpp-external-3.0.0 % make distclean % ./configure --prefix=$HOME/it++external-3.0.0 --disable-shared --enable-static % make && make install \endverbatim
    3. Compile and install the optimized and debugging IT++ libraries: \verbatim % export LDFLAGS=-L$HOME/it++external-3.0.0/lib % export CPPFLAGS=-I$HOME/it++external-3.0.0/include % cd $HOME/itpp-4.0.0 % make distclean % ./configure --disable-shared --enable-static --enable-debug --prefix=$HOME/it++4.0.0 % make && make check && make install \endverbatim
    4. Go to a temporary directory, and create the following program \c example.cpp: \code #include using namespace itpp; using namespace std; int main() { for (int i = 0; i < 10; i++) { mat X = randn(500, 500); mat Z = chol(X * X.transpose()); cout << Z(0, 0) << endl; } for (int i = 0; i < 10; i++) { cvec a = fft(randn_c(10000)); cout << a(5) << endl; } it_assert_debug(1 == 0, "Debugging is on!"); } \endcode Also, in the same directory, create the following \c Makefile: \verbatim FLAGS_DEBUG = `$(HOME)/it++4.0.0/bin/itpp-config --debug --cflags` FLAGS_OPT = `$(HOME)/it++4.0.0/bin/itpp-config --cflags` LIBS_DEBUG = `$(HOME)/it++4.0.0/bin/itpp-config --debug --static --libs` LIBS_OPT = `$(HOME)/it++4.0.0/bin/itpp-config --static --libs` example: example.cpp g++ $(FLAGS_DEBUG) example.cpp -o example_debug $(LIBS_DEBUG) g++ $(FLAGS_OPT) example.cpp -o example_opt $(LIBS_OPT) \endverbatim This \c Makefile produces two programs: \c example_opt and \c example_debug. The former is optimized for performance but offers no debugging or assertions. The latter includes debugging info and is compiled with all assertions enabled (this generally gives "safe" but slow code). Run \c make and try the programs \c example_opt and \c example_debug. If this works the library is ready to use. (The program \c example_debug should exit with an assertion error.)
    5. If you want to conserve disk space, clean up all temporary files: \verbatim % cd $HOME/itpp-external-3.0.0 % make distclean % cd $HOME/itpp-4.0.0 % make distclean \endverbatim To conserve even more diskspace (remove all sources) then do \verbatim % rm -rf $HOME/itpp-external-3.0.0 % rm -rf $HOME/itpp-4.0.0 \endverbatim
    Note: the \c make \c distclean commands in some steps may result in an error message; just ignore this. But the command is recommended because it guarantees that you start with a clean directory, in the event you would repeat the installation procedure. \subsection msvc IT++ Compilation and Installation using Microsoft Visual C++ It is possible to compile and link the IT++ library using the Microsoft Visual C++ .NET (or Express) compiler and either Intel Math Kernel Library (MKL) or AMD Core Math Library (ACML). First, you need to install ACML or MKL in your system. If you decide to use ACML, please download the library built with PGI compiler for Windows, e.g. acml3.6.0-32-pgi.exe file for 32-bit systems. Please follow the default installation steps of the ACML or MKL installer. After waiting a few dozens of seconds you should have the chosen external libraries installed on your computer. Finally, you need to set up a few environment variables, so the library and include files can be found during compilation and linking of the IT++ library. These environment variables are as follows: - \c INCLUDE - specifies the path to header files, e.g. INCLUDE="C:\\Program Files\\AMD\\acml3.6.0\\pgi32\\include" for ACML 3.6.0 or INCLUDE="C:\\Program Files\\Intel\\MKL\\9.1\\include" for MKL 9.1 - \c LIB - specifies the path to library files, e.g. LIB="C:\\Program Files\\AMD\\acml3.6.0\\pgi32\\lib" or LIB="C:\\Program Files\\Intel\\MKL\\9.1\\ia32\\lib" - \c PATH - specifies the runtime path to DLL libraries, e.g. PATH="C:\\Program Files\\AMD\\acml3.6.0\\pgi32\\lib" or PATH="C:\\Program Files\\Intel\\MKL\\9.1\\ia32\\bin" . Please note that the \c PATH environment variable is usually already defined, so you should just append the runtime path to DLL libraries to the existing \c PATH, using a semicolon as a separation character. The next step is to compile and link the IT++ library. Assuming that you have already downloaded and unpacked the IT++ package, you should find the itpp_acml.vcproj and itpp_mkl.vcproj MSVC++ project files in the win32 directory. Depending on the installed external library (ACML or MKL), open one of these project files in the MSVC++ IDE environment. There are two default targets prepared for compilation and linking: Debug and Release. The former can be used to compile a non-optimised version of the library for debugging purposes, named itpp_debug.lib, whereas the latter one should produce an optimised library named itpp.lib, which is also used by test programs. Both libraries will be created in win32\\lib directory. IT++ should compile and link without any warnings or errors. Last but not least, test programs can be compiled and linked to IT++ with MKL or ACML by using the project files included in win32\\itpp_mkl_tests or win32\\itpp_acml_tests respectively. The resulting executable test files should be created in win32\\bin directory. Currently there is no automated method for comparing the output of these test programs with the reference files (*.ref) located in tests directory. To learn how to set up your own project for linking with the IT++ library and ACML or MKL, please read the following manual: \ref msvc_linking. */ itpp-4.3.1/doc/local/itpp_footer.html000066400000000000000000000007671216575753400176030ustar00rootroot00000000000000
    SourceForge Logo

    Generated on $datetime for $projectname by Doxygen $doxygenversion

    itpp-4.3.1/doc/local/itpp_header.html000066400000000000000000000011631216575753400175240ustar00rootroot00000000000000 Welcome to $projectname!
    IT++ Logo
    itpp-4.3.1/doc/local/linking.doc000066400000000000000000000200111216575753400164650ustar00rootroot00000000000000/*! \page linking Linking with IT++ \section toc Table of Contents - \ref intro - \ref pkgconfig - \ref itppconfig - \ref dynamiclinking - \ref msvc_linking - \ref matlab_load_and_save - \ref python_load \section intro Introduction Since version 3.9.0, there are two convenient methods of linking your programs with the IT++ library. The first one employs the \c `pkg-config' command (see http://pkg-config.freedesktop.org/), wheres the second one uses the \c `itpp-config' script. These methods are shortly described below. \section pkgconfig Using the pkg-config command \c `pkg-config' is a helper tool used when compiling and linking programs or libraries. It provides correct compiler and linker options (flags). The syntax of the \c `pkg-config' command is as follows: \code % pkg-config \endcode For instance, assuming that you need to compile an IT++ based program `my_prog.cpp', you might use the following command: \code % g++ `pkg-config --cflags itpp` -o my_prog my_prog.cpp `pkg-config --libs itpp` \endcode If you have installed a debugging version of the IT++ library in parallel, you can ask the \c `pkg-config' command to provide flags for it as well. Just use \c `itpp_debug' name instead of \c `itpp' in the arguments: \code % export CXXFLAGS_DEBUG=`pkg-config --cflags itpp_debug` % export LIBS_DEBUG=`pkg-config --libs itpp_debug` % g++ $CXXFLAGS_DEBUG -o my_prog my_prog.cpp $LIBS_DEBUG \endcode Alternatively, when you have to use static linking only (e.g. in Cygwin or MinGW/MSYS), you might need to add the `--static' switch to your command: \code % export CXXFLAGS=`pkg-config --cflags itpp` % export LIBS=`pkg-config --static --libs` % g++ $CXXFLAGS -o my_prog my_prog.cpp $LIBS \endcode If `pkg-config' can not find the itpp library information, you might need to set the PKG_CONFIG_PATH environment variable with the directory where the `itpp.pc' file is installed (`$prefix/lib/pkgconfig' by default). Alternatively you can use the full path to the `itpp.pc' or `itpp_debug.pc' file, e.g.: \code % pkg-config --libs /usr/local/lib/pkgconfig/itpp.pc \endcode For more information please refer to the \c `pkg-config' documentation. \section itppconfig Using the itpp-config script IT++ also provides a shell script called \c `itpp-config`, which is installed in a `$prefix/bin' (`/usr/local/bin') directory by default. It can be used to simplify the compilation and linking of IT++ based programs. The usage of this script is quite similar to the usage of the \c `pkg-config' command. Assuming that you need to compile the program `my_prog.cpp', you can do that with the following command: \code % g++ `itpp-config --cflags` -o my_prog my_prog.cpp `itpp-config --libs` \endcode The above command will result in an optimised binary \c `my_prog', and optimisation flags (CXXFLAGS) will be the same as those used when compiling the IT++ library. When you need to use static linking, you might need to prepend the `--libs' switch with `--static', e.g.: \code % export CXXFLAGS=`itpp-config --cflags` % export LIBS=`itpp-config --static --libs` % g++ $CXXFLAGS -o my_prog my_prog.cpp $LIBS \endcode Moreover, if you compiled and installed the debugging IT++ library (\c `libitpp_debug.*') by using \c `--enable-debug' swich to configure, you can compile and link your program with debugging options using the following command instead: \code % g++ `itpp-config --debug --cflags` -o my_prog_debug my_prog.cpp `itpp-config --debug --libs` \endcode Full list of \c `itpp-config' options can be obtained by typing: \code % itpp-config --help \endcode If the \c `itpp-config' command is not found by your shell, you should add its location `$prefix/bin' to the PATH environment variable, e.g.: \code % export PATH=/usr/local/bin:$PATH \endcode \section dynamiclinking Using IT++ with dynamic linking When using static linking some of the IT++ library routines are copied into your executable program. This can lead to unnecessary large executables. To avoid this you may use dynamic linking instead. Dynamic linking means that the actual linking is performed when the program is executed. This requires that the system is able to locate the shared IT++ library file (`libitpp.so' or `libittp_debug.so) during the program execution. If you have to install the IT++ library using non-standard prefix, the \c `LD_LIBRARY_PATH' environment variable might be used to inform the linker about the location of the shared library object (`$prefix/lib'), e.g.: \code % export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" \endcode This environment variable can be also used to set dynamic linking library paths for external libraries which are used by IT++, e.g. ATLAS, MKL, ACML and others. \section msvc_linking Linking your own programs with IT++ using MSVC++ It is assumed here that the IT++ library is already compiled and linked with either ACML or MKL, using Microsoft Visual C++ .NET (or Express) compiler (see \ref msvc). To link your own programs with IT++ and ACML or MKL, several things need to be correctly set up in your MSVC++ project: - The IT++ include directory must be defined. Settings for this can be found in the "Tools -> Options -> Projects and Solutions -> VC++ Directories -> Include files" menu. Add path to "", e.g. "C:\itpp-4.0.1". - The IT++ library directory must be defined. Settings for this can be found in the "Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library files" menu. Add path to "\win32\lib", e.g. "C:\itpp-4.0.1\win32\lib". - The ACML or MKL library directory must be defined. If you properly set up the \c LIB environment variable after the installation of ACML or MKL (see \ref msvc), you can just add \$(LIB) as an another library path. - Linking with IT++ and ACML or MKL must be set up. Do this by marking your project and go to the "Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies" menu. There you need to add itpp_debug.lib or itpp.lib depending on whether the Debug or Release mode are being used. Furthermore, you need to add libacml_dll.lib or mkl_c_dll.lib, respectively. - Two additional definitions: _CRT_SECURE_NO_DEPRECATE and _CRT_NONSTDC_NO_DEPRECATE, which disable warnings on Standard C Library and POSIX-compilant function names, might be also added in "Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions". Moreover, HAVE_ACML or HAVE_MKL definitions should be set up, depending on the installed library. Please note that similar project settings for your program must be made for both the Debug and Release modes. \section matlab_load_and_save Using IT++ file format in Matlab/Octave IT++ provides two m-files `itload.m' and `itsave.m', which can be used for reading and writing IT++ data files in Matlab or GNU Octave. To ensure that Matlab/Octave finds these two files you should add the following directory `$prefix/share/itpp' to the default path in Matlab/Octave, e.g.: \code p = path; path(p, "/usr/local/share/itpp"); \endcode \section python_load Using IT++ file format in Python IT++ provides a Python module `pyitpp.py' with `itload()' function for reading IT++ data files in Python. This module uses `numpy' module for matrix operations and extended numerical types support. Additionally, you might need `matplotlib' module in order to graphically display the loaded data. To ensure that Python finds this module, you should add the following directory `$prefix/share/itpp' to the Python search path, e.g. \code import sys sys.path.append('$prefix/share/itpp') import pyitpp \endcode */ itpp-4.3.1/doc/local/sources.mk000066400000000000000000000011131216575753400163610ustar00rootroot00000000000000doc_local_sources = \ $(top_srcdir)/doc/local/authors.doc \ $(top_srcdir)/doc/local/codingrules.doc \ $(top_srcdir)/doc/local/copyright.doc \ $(top_srcdir)/doc/local/documentation.doc \ $(top_srcdir)/doc/local/features.doc \ $(top_srcdir)/doc/local/help_wanted.doc \ $(top_srcdir)/doc/local/installation.doc \ $(top_srcdir)/doc/local/linking.doc \ $(top_srcdir)/doc/local/test.doc \ $(top_srcdir)/doc/local/users_guide.doc \ $(top_srcdir)/doc/local/verification.doc html_local_sources = \ $(top_srcdir)/doc/local/itpp_footer.html \ $(top_srcdir)/doc/local/itpp_header.html itpp-4.3.1/doc/local/test.doc000066400000000000000000000032171216575753400160220ustar00rootroot00000000000000/*! \page test Test Rules This section describes rules how the functionality of the IT++ library should be verified. In the \c `tests' subdirectory test files are provided. All functionality should be tested using these test files. \section test_file The Test File Each new IT++ module/class should be accompanied with a test file. The test file is an implementation in C++ that tests the functionality of a function/class or a group of functions/classes called modules. The test file should test relevant parameter settings and input/output relations to guarantee correct functionality of the corresponding classes/functions. The test files should be maintained using version control and updated whenever new functionality is added to the IT++ library. The test file should use Google C++ Testing Framework (http://code.google.com/p/googletest/) for unit tests and should be, if possible, self contained, i.e. no external data needed. Also, if you use random data, please use IT++ random generators with a fixed seed in order to ensure the same results on different platforms. The test file should be placed in the \c `gtests' subdirectory and should have a name ending with `_test.cpp'. \section testing_using_make Testing IT++ Library One can compile and execute all test programs from \c `gtests' subdirectory by typing \verbatim % ./itpp_gtests \endverbatim after successful compilation of the IT++ library. Note that unit test compilation must be enabled by specifying for cmake the path to the folder containing Google C++ Testing Framework sources. From the build folder the command is: \verbatim % cmake .. -DGTEST_DIR=/path/to/gtest \endverbatim */ itpp-4.3.1/doc/local/users_guide.doc000066400000000000000000000361151216575753400173640ustar00rootroot00000000000000/*! \page users_guide Users Guide \section toc Table of Contents - \ref introduction - \ref predefined_types - \ref scalar_types - \ref vector_types - \ref matrix_types - \ref using_vectors - \ref defining_vectors - \ref vector_manipulation - \ref vector_converters - \ref vector_functions - \ref using_matrices - \ref matrix_converters - \ref array_class - \ref random_variables - \ref random_vec_mat - \ref rng - \ref deterministic_sources - \ref filters - \ref signal_processing - \ref timer_class - \ref itfile_class \section introduction Introduction The \c itbase library is the core of \c IT++ and it contains classes and functions for mathematics with scalars, vectors, and matrices. This document does not cover all the aspects of the \c itbase library. It does however explain the most important things you need to know in order to start using IT++. Once you are more familiar with the \c itbase library you will find the online reference manual more useful. \section predefined_types Predefined Data Types \subsection scalar_types Predefined Scalar Types Apart from the standard C++ types e.g. \c char, \c short, \c int, \c long, \c double, \c float, and \c long \c long, the following types are specific for \c IT++: - \c complex: Contains real and imaginary parts of type \c double - \c bin: Used for binary (0,1) data \subsection vector_types Prepared Vector Types A vector can in principle be of arbitrary type (that support addition, subtraction, multiplication and division), since the general vector class \c Vec is templated. However, the most commonly used vector types are predefined. These predefined vector types are: - \c vec: Basic vector type containing \c double - \c cvec: Vector type containing \c complex - \c ivec: Vector type containing \c int - \c bvec: Vector type containing \c bin - \c svec: Vector type containing \c short The general vector class is used to define the specialized classes above. The \c vec class is actually a \c Vec. We urge you to use these predefined classes instead of \c Vec when ever possible. \subsection matrix_types Prepared Matrix Types The general matrix class is called \c Mat. These predefined matrix types are: - \c mat: Basic matrix type containing double - \c cmat: Matrix type containing \c complex - \c imat: Matrix type containing \c int - \c bmat: Matrix type containing \c bin - \c smat: Matrix type containing \c short As with vector, the general matrix class is used to define the specialized classes above. The \c mat class is thus a \c Mat. We urge you to use these predefined classes instead of \c Mat whenever possible. \section using_vectors Using Vectors Vectors and matrices in \c IT++ are very similar. We therefore begin to describe the vector class in detail and then briefly explain the differences regarding matrices in the next section. \subsection defining_vectors Defining a Vector A vector containing elements of type \c double is defined with: \code vec my_vector; \endcode However, this will not assign a size (memory) to the vector. To assign size 10 to the vector we may use: \code vec my_vector(10); \endcode or \code vec my_vector; my_vector.set_size(10,false); \endcode where the second parameter in the \c set_size call (\c true or \c false) determines if you want to copy the contents of the old data area into the new resized one, or not. This may be useful when down-sizing a vector, but in this case it is not. It is also equivalent to use \code my_vector.set_length(10,false); \endcode instead of \c set_size. Observe that a declared vector (or matrix) is not cleared (the element values are undefined). To clear a vector we simply write \code my_vector.clear(); \endcode or \code my_vector.zeros(); \endcode To fill the vector with ones we write \code my_vector.ones(); \endcode It is possible to retrieve the length (size) of a vector in any of the following ways: \code length_of_vector = my_vector.length(); length_of_vector = my_vector.size(); length_of_vector = length(my_vector); \endcode To assign values to a vector \code vec a = "0 0.7 5 9.3"; // that is a = [0 0.7 5 9.3] ivec b = "0:5"; // that is b = [0 1 2 3 4 5] vec c = "3:2.5:13"; // that is c = [3 5.5 8 10.5 13] ivec d = "1:3:5,0:2:4"; // that is d = [1 3 5 0 2 4] vec e("1.2,3.4,5.6"); // that is e = [1.2 3.4 5.6] vec f; f.set("1.0 2.0 3.0 4.0"); // that is f = [1.0 2.0 3.0 4.0] vec g; g = f; // that is g is a copy of f \endcode A comma or a space character separates the vector elements. When assigning or retrieving a specific vector element use \code a(i) = 3.14; double p = a(i); \endcode for element number \a i. Vector elements are numbered such that \a a(0) denotes the first element. It is also possible to use square brackets as in the C language, i.e. \code a[i] = 3.14; double p = a[i]; \endcode Parts or a vector are retrieved by \code a.left(3); // a vector containing the first 3 elements of a a.right(2); // a vector containing the last 2 elements of a a.mid(1,2); // a vector containing the 2 elements starting with a(1) a(2,4); // a vector containing all elements from a(2) to a(4) a(2,-1); // a vector containing all elements from a(2) to the end of a \endcode Alternatively you can use \a get() methods instead of () or [] operators, e.g. \code a.get(4); a.get(5,-1); \endcode If you have a vector called \a index_list containing indexes (\a ivec) you may write \code // these give a vector containing elements with indexes in index_list a(index_list); a.get(index_list); \endcode If you have a \c bvec called e.g. \a bin_list you may write \code // these give a vector containing all elements a(i) for which bin_list(i) equals 1 a(bin_list); a.get(bin_list); \endcode Have a look at the following example: \code #include using namespace itpp; using namespace std; int main() { vec a = linspace(0,1,11); ivec index_list = "3 5 2 2"; bvec bin_list = "1 0 1 0 1 0 1 0 1 0 1"; cout << "a = " << a << endl; cout << "a(index_list) = " << a(index_list) << endl; cout << "a.get(bin_list) = " << a.get(bin_list) << endl; } \endcode When you run this program you will see \code a = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] a(index_list) = [0.3 0.5 0.2 0.2] a.get(bin_list) = [0.0 0.2 0.4 0.6 0.8 1.0] \endcode \subsection vector_manipulation Vector Manipulation Below follows a listing of the most common vector manipulation commands that are available. All examples are given for an \c ivec denoted \a my_ivec, but of course this will work for other vector types as well. - \c shift_right: \code // Shift in scalar data (10) at position 0 my_ivec.shift_right(10); // Shift in vector at position 0 my_ivec.shift_right("10 4"); \endcode - \c shift_left: \code // Shift in scalar data (10) at position Size()-1 my_ivec.shift_left(10); // Shift in vector at position Size()-1 my_ivec.shift_left("10 4"); \endcode - \c set_subvector: \code // Replace part of vector from position (10) with the vector "11 13" my_ivec.set_subvector(10,"11 13"); \endcode - \c del: \code // Delete element at index (10), making vector size one less my_ivec.del(10); \endcode - \c ins: \code // Insert element at index (10), making vector size one extra my_ivec.ins(10); \endcode - \c split: \code // Splits vector at pos (10). Returns first part, keep second part. ivec first_part = my_ivec.split(10); \endcode - \c elem_mult: \code // Multiply two vectors element wise. ivec my_product = elem_mult(my_invec1,my_ivec2); \endcode - \c elem_div: \code // Dividide two vectors element wise. ivec my_product = elem_div(my_invec1,my_ivec2); \endcode - Calculation: +, -, *, / \code a = my_ivec1 + my_ivec2; // Addition of vectors a = my_ivec + 10; // Addition of vector and scalar a = my_ivec1 - my_ivec2; // Subtraction of vectors a = my_ivec - 10; // Subtraction of vector and scalar a = my_ivec * 10; // Multiplication of vector and scalar a = my_ivec / 10; // Division of vector and scalar \endcode - Calculation: +=, -=, *=, /=, |= \code a += my_ivec; // Addition of vectors (a = a+my_ivec) my_ivec += 10; // Addition of vector and scalar (10) a -= my_ivec; // Subtraction of vectors (a = a-my_ivec) my_ivec -= 10; // Subtraction of vector and scalar (10) my_ivec *= 10; // Multiplication of vector and scalar (10) my_ivec /= 10; // Divsion of vector and scalar (10) my_ivec |= a; // Element wise division \endcode - \c concat \code a = concat(my_ivec1, my_ivec2); // concatenation of two vectors \endcode \subsection vector_converters Vector Converters In order to convert e.g an \c ivec to a \c vec we can write some thing like \c my_vec = \c to_vec(my_ivec). The following converters are available: - \c to_bvec, - \c to_svec, - \c to_ivec, - \c to_vec, - \c to_cvec. \subsection vector_functions Vector Functions There are several functions that operate on vectors. Some examples are: \c max, \c max_index, \c min, \c min_index, \c product, \c energy, \c geometric_mean, \c mean, \c median, \c norm, \c round, \c variance, \c ceil_i, \c floor_i, \c round_i, \c find. Examples of functions that generate different kinds of vectors are: \c linspace, \c ones_b, \c ones_c, \c ones_i, \c ones \c zeros_b. There are several more than these. Please refer to the IT++ reference manual for a description of these. \section using_matrices Using Matrices Matrices are two-dimensional arrays, and most of their functionality is similar to that of vectors. The predefined matrix types are: - \c mat, - \c cmat, - \c imat, - \c smat, - \c bmat. Below follows some examples that are specific for matrices only:
    • Define a matrix of type \c double with 3 rows and 4 columns \code mat a(3,4); \endcode
    • Define a matrix of type \c int with 2 rows and 3 columns. A comma (,) or space is used to separate columns and a semicolon (;) is used to separate rows. \code imat a = "1 2 3;4 5 6"; \endcode
    • Access to rows and columns with \c get_row and \c get_col \code a.get_row(1); // Returns the second row of the matrix b a.get_col(0); // Returns the first column of the matrix b \endcode
    • Set rows and columns with \c set_row and \c set_col \code a.set_row(1,"9 8 7"); // Set second row to "9 8 7" a.set_col(0,"7 2"); // Set first column to "7 2" \endcode
    • The size of a matrix \code // Set the size. "false" means "do not copy" a.set_size(4,5,false); int nr_of_rows = a.rows(); // return the number of rows int nr_of_columns = a.cols(); // return the number of columns \endcode
    • Access to parts of a matrix \code a(r,c); // Access to a single element. a(i); // Access to a single element. Linear addressing, by rows. // Returns the sub-matrix from rows r1 to r2 and columns c1 to c2. a(r1,r2,c1,c2); \endcode
    • Copy rows and columns \code // Copy row number "from" to row number "to" a.copy_row(to,from) // Copy column number "from" to column number "to" a.copy_col(to,from) \endcode
    • Swap rows and columns \code // Swap rows number r1 and r2 a.swap_rows(r1,r2) // Swap columns number c1 and c2 a.swap_cols(c1,c2) \endcode
    • Horizontal and vertical concatenation \code // Equivalent to the MATLAB command c = [a b] c = concat_horizontal(a,b); // Equivalent to the MATLAB command c = [a;b] c = concat_vertical(a,b); \endcode
    \subsection matrix_converters Matrix Converters The following converters are available: - \c to_mat, - \c to_imat, - \c to_cmat, - \c to_bmat. \section array_class The Array Class The \c itbase library contains, among other things, the \c Array class. An \c Array can contain any type of data. Below is an example of an \c Array containing vectors (\c vec): \code #include using namespace itpp; using namespace std; int main() { Array my_vec_array(2); my_vec_array(0) = linspace(0,1,4); my_vec_array(1) = "0.1 0.2 0.3 0.4 0.3 0.2 0.1"; cout << "my_vec_array = " << my_vec_array << endl; return 0; } \endcode \section random_variables Random Vectors, Matrices, and Generators \subsection random_vec_mat Random Vectors and Matrices Random vectors and matrices are easily obtained by using these predefined functions: - \c randb: Generates a random bit vector or matrix - \c randu: Generates a random uniform vector or matrix - \c randi: Generates a random index vector or matrix - \c randray: Generates a random Rayleigh vector or matrix - \c randrice: Generates a random Rice vector or matrix - \c randexp: Generates a random Exponential vector or matrix - \c randn: Generates a random Gaussian vector or matrix - \c randn_c: Generates a random complex Gaussian vector or matrix \subsection rng Random Number Generators (RNG) The following discrete valued random number generators are available. More information about these can be found in the IT++ reference manual. - \c Bernoulli_RNG - \c I_Uniform_RNG The following continuous valued random number generators are available. - \c Uniform_RNG - \c Exponential_RNG - \c Normal_RNG - \c Complex_Normal_RNG - \c AR1_Normal_RNG - \c Weibull_RNG - \c Rayleigh_RNG - \c Rice_RNG \section deterministic_sources Deterministic Sources The following deterministic sources are available: - \c Sine_Source - \c Square_Source - \c Triangle_Source - \c Sawtooth_Source - \c Impulse_Source - \c Pattern_Source \section filters Filter Classes and Functions The following filter classes are available: - \c AR_Filter - \c MA_Filter - \c ARMA_Filter - \c Freq_Filt The following filter functions are available: - \c filter \subsection signal_processing Signal Processing Functions The following signal processing functions are available: - \c a2k, \c k2a, \c a2lar, \c k2lar, \c lpc, \c levinsson, \c lerouxguegen - \c fft, \c ifft, \c fft_real, \c ifft_real - \c dct, \c idct - \c spectrum - \c cov, \c xcorr - \c chirp - \c dht, \c dht2, \c dwht, \c dhwt2, \c self_dht, \c self_dwht - \c filter_spectrum - \c filter_whiteness \section timer_class Timer Classes The \c Real_Timer class can be used to measure execution time of a program as in the following example: \code #include using namespace itpp; using namespace std; int main() { long sum = 0; Real_Timer my_timer; my_timer.tic(); for (int i=0; i<10000000; i++) { sum += i; } my_timer.toc_print(); cout << "The sum is " << sum << endl; return 0; } \endcode \section itfile_class Reading and Writing to Files The following example saves the variable \a a to the file \c my_file_name.it: \code #include using namespace itpp; int main() { it_file my_file("my_file_name.it"); vec a = "1.0 2.0 3.0 4.0"; my_file << Name("a") << a; return 0; } \endcode The following example reads the variable \a a from the file \c my_file_name.it and prints it: \code #include using namespace itpp; using namespace std; int main() { it_file my_file("my_file_name.it"); vec a; my_file >> Name("a") >> a; cout << "a = " << a << endl; return 0; } \endcode Note that *.it files can be read and written in Matlab/Octave by using the \c itload.m and \c itsave.m functions. Also available is the class \c it_ifile that can only be used for reading of files. */ itpp-4.3.1/doc/local/verification.doc000066400000000000000000000650231216575753400175300ustar00rootroot00000000000000/*! \page verification IT++ Supported Systems \section toc Table of Contents - \ref intro - \ref itpp_4_3 - \ref linux_4_3 - \ref opensuse_12_3 - \ref macos_4_3 - \ref macos_4_3_lion - \ref win_4_3 - \ref win_4_3_8 - \ref win_4_3_7 - \ref win_4_3_cygwin - \ref win_4_3_mingw - \ref itpp_4_0 - \ref linux_4_0 - \ref ubuntu_910_4_0 - \ref ubuntu_904_4_0 - \ref ubuntu_804_4_0 - \ref ubuntu_710_4_0 - \ref itpp_3_99 - \ref linux_3_99 - \ref debian_etch_3_99 - \ref gentoo_atlas_3_99 - \ref gentoo_mkl_3_99 - \ref rhel4_3_99 - \ref windows_3_99 - \ref cygwin_3_99 - \ref cygwin_acml_3_99 - \ref mingw_acml_3_99 - \ref mingw_netlib_3_99 - \ref msvc_acml_3_99 - \ref msvc_mkl_3_99 - \ref unix_3_99 - \ref sunos59_atlas_3_99 - \ref sunos59_netlib_3_99 - \ref itpp_3_10 - \ref linux - \ref fedora_atlas - \ref gentoo_acml - \ref gentoo_atlas - \ref gentoo_mkl - \ref gentoo_netlib - \ref rhel - \ref suse_netlib - \ref suse_mkl - \ref windows - \ref cygwin - \ref cygwin_atlas - \ref cygwin_acml - \ref mingw_acml - \ref mingw_netlib - \ref msvc_mkl - \ref unix - \ref sunos59 \section intro Introdution This page is intended to provide a list of IT++ supported systems, i.e. the systems on which configuration, installation and testing process of the IT++ library has been sucessful. Results are grouped based on minor release number. Therefore, only the latest tests for bug-fix releases are included. Besides, the information on this page is divided into sections dependent on the operating system. Where necessary, some extra information is given for each tested configuration, e.g. external libraries installed, configuration commands used, etc. If you manage to compile, install and test the IT++ library on a system not mentioned below, please let us know, so we could update this database. \htmlonly
    \endhtmlonly \section itpp_4_3 IT++ 4.3.x (Stable) \subsection linux_4_3 Linux Systems \subsubsection opensuse_12_3 OpenSUSE 12.3 - Platform: AMD Athlon 64 X2 Dual Core Processor 3800+ - Operating System: OpenSUSE 12.3 - Compiler: g++ (GCC) 4.7.2 - IT++ release: 4.3.0 - External Libraries: blas, lapack and fftw from OpenSUSE repositories or ACML 5.1.0 or MKL 11.0.2 - Tests Status: All tests PASSED - Comments: Please read Installation section of the main help page - Date: May 24, 2013 - Tester: Bogdan Cristea \subsection macos_4_3 MacOS Systems \subsubsection macos_4_3_lion MacOS Lion - Platform: Virtual Box 4.2.12 installed on Windows 8 x86_64 (Intel Core i7-3667U) - Operating System: MacOS Lion - Compiler: g++ (GCC) 4.2.1 - IT++ release: 4.3.0 - External Libraries: blas, lapack and fftw from MacOS repositories - Tests Status: All tests PASSED - Comments: Please read Installation section of the main help page - Date: May 24, 2013 - Tester: Bogdan Cristea \subsection win_4_3 Windows Systems \subsubsection win_4_3_8 Windows 8 - Platform: Intel Core i7-3667U - Operating System: Windows 8 x86_64 - Compiler: Visual Studio 2010 - IT++ release: 4.3.0 - External Libraries: ACML 5.1.0 or MKL 11.0.2 - Tests Status: All tests PASSED - Comments: Please read Installation section of the main help page - Date: May 24, 2013 - Tester: Bogdan Cristea \subsubsection win_4_3_7 Windows 7 - Platform: Virtual Box 4.2.12 installed on Windows 8 x86_64 (Intel Core i7-3667U) - Operating System: Windows 7 x86 - Compiler: Visual Studio 2010 - IT++ release: 4.3.0 - External Libraries: MKL 11.0.2 - Tests Status: All tests PASSED - Comments: Please read Installation section of the main help page - Date: May 25, 2013 - Tester: Bogdan Cristea \subsubsection win_4_3_cygwin Cygwin 1.7.18-1 - Platform: Intel Core i7-3667U - Operating System: Windows 8 x86_64 - Compiler: g++ (GCC) 4.5.3 - IT++ release: 4.3.0 - External Libraries: blas, lapack, fftw from cygwin repositories - Tests Status: All tests PASSED - Comments: Please read Installation section of the main help page - Date: May 24, 2013 - Tester: Bogdan Cristea \subsubsection win_4_3_mingw MinGW/MSYS - Platform: Intel Core i7-3667U - Operating System: Windows 8 x86_64 - Compiler: g++ (GCC) 4.7.2 - IT++ release: 4.3.0 - External Libraries: MKL 11.0.2 - Tests Status: All tests PASSED (Timer test might fail) - Comments: Please read Installation section of the main help page - Date: May 24, 2013 - Tester: Bogdan Cristea \htmlonly
    \endhtmlonly \section itpp_4_0 IT++ 4.0.x (Stable) \subsection linux_4_0 Linux Systems \subsubsection ubuntu_910_4_0 Ubuntu 9.10 - Platform: Intel Core 2 Quad - Operating System: Ubuntu 9.10 - Compiler: g++ (GCC) 4.4.1 - IT++ release: 4.0.7 - External Libraries: The following Ubuntu packages were installed to provide BLAS, LAPACK and ATLAS: liblapack-dev, libblas-dev, libatlas-base-dev, libfftw3-dev - Tests Status: All tests PASSED - Comments: A clean installation of Ubuntu is advised, some tests may fail if different gcc versions are jointly installed. - Date: January 5, 2010 - Tester: Erik G. Larsson \subsubsection ubuntu_904_4_0 Ubuntu 9.04 The Jaunty Jackalope - Platform: Intel Core 2 Quad - Operating System: Ubuntu 9.04 The Jaunty Jackalope - Compiler: g++ (GCC) 4.3.3 - IT++ release: 4.0.6 - External Libraries: The following Ubuntu packages were installed to provide BLAS, LAPACK and ATLAS: liblapack-dev, libblas-dev, libatlas-base-dev, libfftw3-dev - Tests Status: All tests PASSED - Comments: A clean installation of Ubuntu is advised, some tests may fail if different gcc versions are jointly installed. - Date: May 10, 2009 - Tester: Mirsad Cirkic \subsubsection ubuntu_804_4_0 Ubuntu 8.04 - Platform: Intel Core 2 Duo - Operating System: Ubuntu 8.04 - Compiler: g++ (GCC) 4.2.3 - IT++ release: 4.0.5 - External Libraries: The following Ubuntu packages were installed to provide BLAS, LAPACK and ATLAS: lapack3, lapack3-dev, lapack3-pic, refblas3, refblas3-dev, atlas3-base, atlas3-base-dev, atlas3-headers, fftw3, fftw3-dev - Tests Status: All tests PASSED - Date: October 5, 2008 - Tester: Erik G. Larsson \subsubsection ubuntu_710_4_0 Ubuntu 7.10 - Platform: Intel Pentium 4 - Operating System: Ubuntu 7.10 - Compiler: g++ (GCC) 4.1.3 - IT++ release: 4.0.1 - External Libraries: The following Ubuntu packages were installed to provide BLAS, LAPACK and ATLAS: lapack3, lapack3-dev, lapack3-pic, refblas3, refblas3-dev, atlas3-base, atlas3-base-dev, atlas3-headers - Tests Status: All tests PASSED - Date: December 30, 2007 - Tester: Erik G. Larsson \htmlonly
    \endhtmlonly \section itpp_3_99 IT++ 3.99.x (Development Releases) \subsection linux_3_99 Linux Systems \subsubsection debian_etch_3_99 Debian Etch - Platform: Intel Pentium 4 - Operating System: Debian Etch - Compiler: g++ (GCC) 4.1.2 - IT++ release: 3.99.0 - External Libraries: ATLAS, LAPACK and FFTW from Debian packages (on the computer where the test was done the following packages were installed, among others: fftw3, fftw3-dev, atlas3-base, atlas3-base-dev, atlas3-headers, atlas3-sse, atlas3-sse-dev, atlas3-sse2, atlas3-sse2-dev, atlas3-test) - Tests Status: All tests PASSED - Date: January 18, 2007 - Tester: Erik G. Larsson \subsubsection gentoo_atlas_3_99 Gentoo Linux with ATLAS - Platform: Intel Pentium M Centrino - Operating System: Gentoo Linux 2006.1 (x86) - Compiler: g++ (GCC) 4.1.1 - IT++ release: 3.99.0 - External Libraries: Compiled and installed from the portage tree: - sci-libs/fftw-3.1.2 - sci-libs/blas-atlas-3.7.24 - sci-libs/lapack-atlas-3.7.24 - Tests Status: All tests PASSED - Comments: BLAS and LAPACK libs set up by using the following system commands: \verbatim % eselect blas set atlas % eselect cblas set atlas % eselect lapack set atlas \endverbatim IT++ configured with: \verbatim % export CXXFLAGS="-march=pentium-m -O3 -fno-exceptions -pipe" % ./configure --with-blas="-lblas" --enable-debug \endverbatim - Date: January 18, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection gentoo_mkl_3_99 Gentoo Linux with MKL - Platform: Intel Pentium M Centrino - Operating System: Gentoo Linux 2006.1 (x86) - Compiler: g++ (GCC) 4.1.1 - IT++ release: 3.99.0 - External Libraries: Intel Math Kernel Library (MKL) 8.1.014 installed from the portage three: \verbatim % emerge sci-libs/mkl \endverbatim - Tests Status: All tests PASSED - Comments: IT++ configured using the following commands: \verbatim % export LDFLAGS="-L/opt/intel/mkl/8.1/lib/32" % export CPPFLAGS="-I/opt/intel/mkl/8.1/include" % ./configure --enable-debug \endverbatim - Date: January 18, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection rhel4_3_99 Red Hat Enterprise Linux 4 with IT++ External - Platform: Intel Pentium 4 - Operating System: Red Hat Enterprise Linux 4 - Compiler: g++ (GCC) 3.4.6 - IT++ release: 3.99.0 - External Libraries: ATLAS, LAPACK, and FFTW separately compiled from IT++ External 2.3.0 sources and installed in a local directory - Tests Status: All tests PASSED - Date: January 18, 2007 - Tester: Erik G. Larsson \subsection windows_3_99 Windows Systems \subsubsection cygwin_3_99 Cygwin - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, Cygwin 1.5.23-2 - Compiler(s): g++ (GCC) 3.4.4 (cygming special) - IT++ release: 3.99.0 - External Libraries: Installed from Cygwin repository: - fftw3-3.0.1-2, fftw3-dev-3.0.1-2 - lapack-3.0-5 - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \verbatim % ./configure --enable-debug \endverbatim - Date: January 19, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection cygwin_acml_3_99 Cygwin with ACML - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, Cygwin 1.5.23-2 - Compiler(s): g++ (GCC) 3.4.4 (cygming special) - IT++ release: 3.99.0 - External Libraries: ACML version 3.6.0 (acml3.6.0-32-g77.exe) installed into a default directory, i.e. "c:\Program Files\AMD\acml3.6.0" - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \verbatim % export LDFLAGS="-L/cygdrive/c/Progra~1/AMD/acml3.6.0/gnu32/lib" % export CPPFLAGS="-I/cygdrive/c/Progra~1/AMD/acml3.6.0/gnu32/include" % ./configure --enable-debug \endverbatim - Date: January 19, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection mingw_acml_3_99 MinGW/MSYS with ACML - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, MinGW 5.1.3, MSYS 1.0.11 - Compiler(s): g++ (GCC) 3.4.5 (mingw special) - IT++ release: 3.99.0 - External Libraries: ACML version 3.6.0 (acml3.6.0-32-g77.exe) installed into a default directory, i.e. "c:\Program Files\AMD\acml3.6.0" - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \verbatim % export LDFLAGS="-L/c/Progra~1/AMD/acml3.6.0/gnu32/lib" % export CPPFLAGS="-I/c/Progra~1/AMD/acml3.6.0/gnu32/include" % ./configure --enable-debug \endverbatim - Date: January 18, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection mingw_netlib_3_99 MinGW/MSYS with IT++ External - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, MinGW 5.1.3, MSYS 1.0.11 - Compiler(s): g++ (GCC) 3.4.5 (mingw special) - IT++ release: 3.99.0 - External Libraries: BLAS, CBLAS, LAPACK and FFTW libraries from IT++ External 2.99.1 package - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \verbatim % export LDFLAGS="-L/usr/local/lib" % export CPPFLAGS="-I/usr/local/include" % export CXXFLAGS="-Wall -O3 -march=athlon-tbird -pipe" % ./configure --disable-html-doc --enable-debug \endverbatim - Date: January 18, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection msvc_acml_3_99 MS Visual C++ .NET with ACML - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2 - Compiler(s): Microsoft Visual C++ 2005 .NET - IT++ release: 3.99.1 - External Libraries: ACML version 3.6.0 (PGI) (acml3.6.0-32-pgi.exe) installed into a default directory, i.e. "c:\Program Files\AMD\acml3.6.0" - Tests Status: Not fully tested. Some IT++ based programs compiled and run with success. - Comments: Only static library can be built. IT++ built by opening the "win32\itpp_acml.vcproj" project file in MSVC++ and executing "Build -> Build Solution" command from menu. - Date: March 21, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection msvc_mkl_3_99 MS Visual C++ .NET with Intel MKL - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2 - Compiler(s): Microsoft Visual C++ 2005 .NET - IT++ release: 3.99.1 - External Libraries: Intel Math Kernel Library (MKL) 8.1 installed manually in the following directory: "C:\Program Files\Intel\MKL\8.1" - Tests Status: Not fully tested. Some IT++ based programs compiled and run with success. - Comments: Only static library can be built. IT++ built by opening the "win32\itpp_mkl.vcproj" project file in MSVC++ and executing "Build -> Build Solution" command from menu. - Date: March 21, 2007 - Tester: Adam Piątyszek (ediap) \subsection unix_3_99 Unix Systems \subsubsection sunos59_atlas_3_99 SunOS 5.9 with ATLAS - Platform: SUNW, Sun-Blade-100 (SPARC) - Operating System: SunOS 5.9 Generic_112233-10 - Compiler(s): g++ (GCC) 3.4.5 - IT++ release: 3.99.0 - External Libraries: LAPACK and FFTW libraries installed from IT++ External 2.99.1 package. ATLAS 3.7.24 development version build from sources using the following configuration command: \verbatim % ../configure --with-netlib-lapack="/usr/local/lib/liblapack.a" \endverbatim - Tests Status: All tests PASSED - Comments: Only static library can be built due to the ATLAS installation. IT++ configured with: \verbatim % export LDFLAGS="-L/usr/local/atlas/lib -L/usr/local/lib" % export CPPFLAGS="-I/usr/local/include" % ./configure --disable-shared \endverbatim - Date: January 20, 2007 - Tester: Adam Piątyszek (ediap) \subsubsection sunos59_netlib_3_99 SunOS 5.9 with IT++ External - Platform: SUNW, Sun-Blade-100 (SPARC) - Operating System: SunOS 5.9 Generic_112233-10 - Compiler(s): g++ (GCC) 3.4.5 - IT++ release: 3.99.0 - External Libraries: BLAS, CBLAS, LAPACK and FFTW libraries from IT++ External 2.99.1 package - Tests Status: All tests PASSED - Comments: IT++ configured with: \verbatim % export LDFLAGS="-L/usr/local/lib" % export CPPFLAGS="-I/usr/local/include" % ./configure \endverbatim - Date: January 19, 2007 - Tester: Adam Piątyszek (ediap) \htmlonly
    \endhtmlonly \section itpp_3_10 IT++ 3.10.x (Stable Releases) \subsection linux Linux Systems \subsubsection fedora_atlas Fedora Core 4 with ATLAS - Platform: Intel Pentium 4 - Operating System: Fedora Core 4 (x86) - Compiler: g++ (GCC) 4.0.2 20051125 - IT++ release: 3.10.0 - External Libraries: From FC4 distribution: - fftw3.i386-3.0.1-3 - fftw3-devel.i386-3.0.1-3 - atlas-sse2.i386-3.6.0-8.fc4 - atlas-sse2-devel.i386-3.6.0-8.fc4 - blas.i386-3.0-35.fc4 - lapack.i386-3.0-35.fc4 - Tests Status: All tests PASSED - Comments: IT++ configured with: \code % CXXFLAGS="-O3 -pipe -march=pentium4" ./configure \endcode - Date: March 7, 2006 - Tester: Tony Ottosson \subsubsection gentoo_acml Gentoo Linux with ACML - Platform: AMD Sempron 3000+ - Operating System: Gentoo Linux 2006.0 (x86 arch) - Compiler(s): g++ (GCC) 3.4.5 - IT++ release: 3.10.1 - External Libraries: Compiled and installed from portage tree: - sci-libs/acml-3.0.0 - Tests Status: All tests PASSED - Comments: BLAS and LAPACK libs set by using the following system commands: \code % eselect blas set ACML % eselect lapack set ACML \endcode IT++ configured with: \code % export CPPFLAGS="-I/usr/include/acml" % ./configure --with-blas="-lblas" \endcode - Date: March 31, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection gentoo_atlas Gentoo Linux with ATLAS - Platform: Intel Pentium M Centrino - Operating System: Gentoo Linux 2006.0 (x86) - Compiler: g++ (GCC) 3.4.5 - IT++ release: 3.10.1 - External Libraries: Compiled and installed from portage tree: - sci-libs/fftw-3.1 - sci-libs/blas-atlas-3.6.0-r1 - sci-libs/lapack-atlas-3.6.0 - Tests Status: All tests PASSED - Comments: BLAS and LAPACK libs set by using the following system commands: \code % eselect blas set ATLAS % eselect lapack set ATLAS \endcode IT++ configured with: \code % ./configure --with-blas="-lblas" \endcode - Date: March 31, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection gentoo_mkl Gentoo Linux with MKL - Platform: Intel Pentium M Centrino - Operating System: Gentoo Linux 2006.0 (x86 arch) - Compiler: g++ (GCC) 3.4.5 - IT++ release: 3.10.0 - External Libraries: Intel Math Kernel Library (MKL) 8.0.1 installed manually in the following directory: /opt/intel/mkl/8.0.1 - Tests Status: All tests PASSED - Comments: IT++ configured using the following commands: \code % export LDFLAGS="-L/opt/intel/mkl/8.0.1/lib/32" % export CPPFLAGS="-I/opt/intel/mkl/8.0.1/include" % ./configure \endcode - Date: February 28, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection gentoo_netlib Gentoo Linux with NetLib's BLAS and LAPACK - Platform: Intel Pentium M Centrino - Operating System: Gentoo Linux 2006.0 (x86) - Compiler: g++ (GCC) 3.4.5 - IT++ release: 3.10.1 - External Libraries: Compiled and installed from portage tree: - sci-libs/fftw-3.1 - sci-libs/blas-reference-19940131-r2 - sci-libs/cblas-reference-20030223 - sci-libs/lapack-reference-3.0-r2 - Tests Status: All tests PASSED - Comments: BLAS and LAPACK libs set by using the following system commands: \code % blas-config reference % lapack-config reference \endcode IT++ configured with: \code % ./configure --with-blas="-lblas" \endcode - Date: March 31, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection rhel Red Hat Enterprise Linux with IT++ External - Platform: Intel Pentium 4 - Operating System: Red Hat Enterprise Linux AS release 4 (Nahant Update 2) - Compiler: g++ (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2) - IT++ release: 3.10.0 - External Libraries: BLAS, CBLAS, LAPACK and FFTW libraries from IT++ External 2.1.1 package - Tests Status: All tests PASSED - Date: March 7, 2006 - Tester: Erik G. Larsson \subsubsection suse_netlib SUSE Linux 10.0 with NetLib's BLAS and LAPACK - Platform: Intel Pentium 4 CPU 3.20GHz (64-bit) - Operating System: SUSE Linux 10.0 (x86_64) - Compiler(s): g++ (GCC) 4.0.2 - IT++ release: 3.10.0 - External Libraries: BLAS, LAPACK and FFTW libraries installed from OpenSuse 10.0 RPM repository: - blas-3.0-926 - lapack-3.0-926 - fftw3-3.0.1-114 - fftw3-threads-3.0.1-114 - fftw3-devel-3.0.1-114 - Tests Status: All tests PASSED - Comments: IT++ configured with: \code % export CXXFLAGS="-m64 -march=nocona -O3 -pipe" % ./configure --with-lapack="/usr/lib64/liblapack.so.3" \endcode - Date: March 1, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection suse_mkl SUSE Linux 10.0 with MKL - Platform: Intel Pentium 4 CPU 3.20GHz (64-bit) - Operating System: SUSE Linux 10.0 (x86_64) - Compiler(s): g++ (GCC) 4.0.2 - IT++ release: 3.10.0 - External Libraries: Intel Math Kernel Library (MKL) 8.0.1 installed manually in the following directory: /opt/intel/mkl/8.0.1 - Tests Status: All tests PASSED - Comments: IT++ configured with: \code % export CXXFLAGS="-m64 -march=nocona -O3 -pipe" % export LDFLAGS="-L/opt/intel/mkl/8.0.1/lib/em64t" % export CPPFLAGS="-I/opt/intel/mkl/8.0.1/include" % ./configure \endcode - Date: March 1, 2006 - Tester: Adam Piątyszek (ediap) \subsection windows Windows Systems \subsubsection cygwin Microsoft Windows XP with Cygwin - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, Cygwin 1.5.19-4 - Compiler(s): g++ (GCC) 3.4.4 (cygming special) - IT++ release: 3.10.1 - External Libraries: Installed from Cygwin's repository: - fftw-3.0.1-2 - fftw-dev-3.0.1-1 - lapack-3.0-4 - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \code % ./configure \endcode - Date: March 31, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection cygwin_atlas Microsoft Windows XP with Cygwin and ATLAS - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, Cygwin 1.5.19-4 - Compiler(s): g++ (GCC) 3.4.4 (cygming special) - IT++ release: 3.10.1 - External Libraries: Installed from Cygwin's repository: - fftw-3.0.1-2 - fftw-dev-3.0.1-1 . ATLAS BLAS and LAPACK libraries from IT++ External 2.1.1 package configured using: \code % ./configure --enable-atlas --disable-fftw \endcode - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \code % export LDFLAGS="-L/usr/local/lib" % ./configure \endcode - Date: March 31, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection cygwin_acml Microsoft Windows XP with Cygwin and ACML - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, Cygwin 1.5.19-4 - Compiler(s): g++ (GCC) 3.4.4 (cygming special) - IT++ release: 3.10.2 - External Libraries: ACML version 3.1.0 (acml3.1.0-32-win32-g77.exe) installed into a default directory, i.e. "c:\Program Files\AMD\acml3.1.0" - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \code % export LDFLAGS="-L/cygdrive/c/Progra~1/AMD/acml3.1.0/gnu32/lib" % export CPPFLAGS="-I/cygdrive/c/Progra~1/AMD/acml3.1.0/gnu32/include" % ./configure --enable-debug \endcode - Date: May 15, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection mingw_acml Microsoft Windows XP with MinGW, MSYS and ACML - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, MinGW 5.0.2, MSYS 1.0.10 - Compiler(s): g++ (GCC) 3.4.4 (mingw special) - IT++ release: 3.10.2 - External Libraries: ACML version 3.1.0 (acml3.1.0-32-win32-g77.exe) installed into a default directory, i.e. "c:\Program Files\AMD\acml3.1.0" - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \code % export LDFLAGS="-L/c/Progra~1/AMD/acml3.1.0/gnu32/lib" % export CPPFLAGS="-I/c/Progra~1/AMD/acml3.1.0/gnu32/include" % ./configure --enable-debug \endcode - Date: May 15, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection mingw_netlib Microsoft Windows XP with MinGW, MSYS and IT++ External - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2, MinGW 5.0.2, MSYS 1.0.10 - Compiler(s): g++ (GCC) 3.4.4 (mingw special) - IT++ release: 3.10.5 - External Libraries: BLAS, CBLAS, LAPACK and FFTW libraries from IT++ External 2.2.0 package - Tests Status: All tests PASSED - Comments: Only static library can be built. IT++ configured with: \code % export LDFLAGS="-L/usr/local/lib" % export CPPFLAGS="-I/usr/local/include" % export CXXFLAGS="-Wall -O3 -march=athlon-tbird -pipe" % ./configure --disable-html-doc \endcode - Date: August 11, 2006 - Tester: Adam Piątyszek (ediap) \subsubsection msvc_mkl Microsoft Windows XP with MS Visual C++ and Intel MKL - Platform: AMD Sempron 3000+ - Operating System: Microsoft Windows XP SP2 - Compiler(s): Microsoft Visual C++ 2005 .NET - IT++ release: 3.10.5 - External Libraries: Intel Math Kernel Library (MKL) 8.1 installed manually in the following directory: "C:\Program Files\Intel\MKL\8.1" - Tests Status: Not fully tested. Some IT++ based programs compiled and run with success. - Comments: Only static library can be built. IT++ built by opening the "win32\itpp.vcproj" project file in MSVC++ and executing "Build -> Build Solution" command from menu. - Date: August 11, 2006 - Tester: Adam Piątyszek (ediap) \subsection unix Unix Systems \subsubsection sunos59 SunOS 5.9 with IT++ External - Platform: SUNW, Sun-Blade-100 (SPARC) - Operating System: SunOS 5.9 Generic_112233-10 - Compiler(s): g++ (GCC) 3.4.5 - IT++ release: 3.10.2 - External Libraries: BLAS, CBLAS, LAPACK and FFTW libraries from IT++ External 2.1.1 package. The following configuration command has been used: \code % export CFLAGS="-mcpu=ultrasparc -O2 -pipe -funroll-all-loops" % ./configure \endcode - Tests Status: All tests PASSED - Comments: IT++ configured with: \code % export LDFLAGS="-L/usr/local/lib" % export CPPFLAGS="-I/usr/local/include" % export CXXFLAGS="-mcpu=ultrasparc -O2 -pipe" % ./configure --enable-debug \endcode - Date: May 15, 2006 - Tester: Adam Piątyszek (ediap) */ itpp-4.3.1/doc/sourceforge/000077500000000000000000000000001216575753400156025ustar00rootroot00000000000000itpp-4.3.1/doc/sourceforge/howto_release_itpp.html000066400000000000000000000100651216575753400223660ustar00rootroot00000000000000

    How to release a new version of IT++

    This document describes briefly the recommended procedure of releasing a new version of IT++ using SourceForge project site.

    The following steps are required to prepare and release of the distribution package:

    • Update NEWS and ChangeLog files with appropriate information including what has changed since the previous release. Then commit the changes into the SVN repository.
    • Create a release tag by copying the source tree to be released to the tags subdirectory in the SVN repository, e.g.:
      % svn copy https://svn.sourceforge.net/svnroot/itpp/itpp/trunk https://svn.sourceforge.net/svnroot/itpp/itpp/tags/release-3-10-0
    • Export a clean, unversioned copy of the IT++ sources using the release tag:
      % svn export https://svn.sourceforge.net/svnroot/itpp/itpp/tags/release-3-10-0 itpp-3.10.0
    • Regenerate the configure script and other autogenerated files using:
      % ./autogen.sh
      To perform this step, autoconf, automake and libtool tools have to be available in the system.
    • Configure the exported sources:
      % ./configure
    • Create the distribution packages using the following command:
      % make distcheck
      This will configure, compile and check the package. The output packages will be named itpp-3.10.0.tar.gz and itpp-3.10.0.tar.bz2, for instance.
    • Create the documentation packages using the following commnad:
      % make disthtml
      The output documentation packages will be named itpp-html-doc-3.10.0.tar.gz and itpp-html-doc-3.10.0.tar.bz2, for egzample.
    • Upload the distribution and documentation packages to the SourceForge server:
      • Start ftp connection with the SourceForge upload server:
        % ftp upload.sourceforge.net
      • Login as anonymous and give email as password
      • Change remote directory to /incomming:
        % cd /incoming
      • Upload packages:
        % mput itpp*-3.10.0.tar.*
    • Access SourceForge file release interface and add the packages. Remember to fill in the Release Notes and ChangeLog parts with appropriate infmormation.

    In order to update the online HTML documentation, the following procedure is required:

    • Upload the documentation package into the SourceForge shell server:
      % scp itpp-html-doc-3.10.0.tar.gz your_login@shell.sourceforge.net:/home/groups/i/it/itpp/htdocs/
    • Login into the SourceForge shell account:
      % ssh your_login@shell.sourceforge.net
    • Change the current directory:
      % cd /home/groups/i/it/itpp/htdocs
    • Unpack the uploaded documentation:
      % tar zxf itpp-html-doc-3.10.0.tar.gz
    • Rename the unpacked directory to 3.10.0:
      % mv itpp-html-doc-3.10.0 3.10.0
    • Update the latest link:
      % rm latest; ln -s 3.10.0 latest
    • Change the group properities of the uploaded files:
      % chmod -R g+w 3.10.0
    • Remove the package from the shell server:
      % rm itpp-html-doc-3.10.0.tar.gz

    Finally, you should send an announcement to: itpp-announce@lists.sourceforge.net

    itpp-4.3.1/doc/tutorial/000077500000000000000000000000001216575753400151225ustar00rootroot00000000000000itpp-4.3.1/doc/tutorial/Makefile.am000066400000000000000000000001701216575753400171540ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk SUBDIRS = src EXTRA_DIST = $(doc_tutorial_sources) itpp-4.3.1/doc/tutorial/Makefile.in000066400000000000000000000466741216575753400172100ustar00rootroot00000000000000# Makefile.in generated by automake 1.12.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/sources.mk $(top_srcdir)/Makefile.common subdir = doc/tutorial ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) doc_tutorial_sources = \ $(top_srcdir)/doc/tutorial/bpsk.doc \ $(top_srcdir)/doc/tutorial/convcode.doc \ $(top_srcdir)/doc/tutorial/interleaver.doc \ $(top_srcdir)/doc/tutorial/itfile.doc \ $(top_srcdir)/doc/tutorial/qpsk_simulation.doc \ $(top_srcdir)/doc/tutorial/rayleigh.doc \ $(top_srcdir)/doc/tutorial/reedsolomon.doc \ $(top_srcdir)/doc/tutorial/spread.doc \ $(top_srcdir)/doc/tutorial/timer.doc \ $(top_srcdir)/doc/tutorial/tutorial.doc \ $(top_srcdir)/doc/tutorial/vector_and_matrix.doc \ $(top_srcdir)/doc/tutorial/mimoconv.doc \ $(top_srcdir)/doc/tutorial/demapper_mimo.doc \ $(top_srcdir)/doc/tutorial/matlab_itpp.doc \ $(top_srcdir)/doc/tutorial/mog.doc \ $(top_srcdir)/doc/tutorial/ldpc_gen_codes.doc \ $(top_srcdir)/doc/tutorial/ldpc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/pccc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/exit_pccc.doc \ $(top_srcdir)/doc/tutorial/sccc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/turbo_equalizer_bersim_multipath.doc SUBDIRS = src EXTRA_DIST = $(doc_tutorial_sources) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/tutorial/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/tutorial/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.common $(srcdir)/sources.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done cscopelist-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ cscopelist-recursive ctags-recursive install-am install-strip \ tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ cscopelist cscopelist-recursive ctags ctags-recursive \ distclean distclean-generic distclean-libtool distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/doc/tutorial/bpsk.doc000066400000000000000000000007221216575753400165510ustar00rootroot00000000000000/*! \page bpsk BPSK modulation over an AWGN channel As a first example we will generate a sequence of 500000 random bits {0,1} and BPSK modulate these. Thereafter the BPSK signals will be transmitted over an AWGN channel with a signal-to-noise ratio \f$E_b/N_0 = 0\f$ dB. The received signal is then decoded and the number of bit errors are calculated. \include bpsk.cpp When you run this program, the output will look something like this: \include bpsk.ref */ itpp-4.3.1/doc/tutorial/convcode.doc000066400000000000000000000005121216575753400174070ustar00rootroot00000000000000/*! \page convcode Simulation of a convolutional encoder and decoder In this example we will show how to use the convolutional encoder/decoder class in it++. The Viterbi decoder uses the soft received values. \include convcode.cpp When you run this program, the output will look something like this: \include convcode.ref */ itpp-4.3.1/doc/tutorial/demapper_mimo.doc000066400000000000000000000007221216575753400204300ustar00rootroot00000000000000/*! \page demapper_mimo Simulation of SISO demappers using ST codes in ideal MIMO channels This program shows the usage of Soft-Input Soft-Output (SISO) demappers with Space Time (ST) codes in Multiple-Input Multiple-Output (MIMO) channels. The ST codes are generated using the STC class, the MIMO channels are ideal (no multi-antenna interferrence and no noise) and the receiver is implemented by the demapper method of the SISO class. \include stbicm.cpp */ itpp-4.3.1/doc/tutorial/exit_pccc.doc000066400000000000000000000017161216575753400175570ustar00rootroot00000000000000/*! \page exit_pccc EXIT chart of PCCCs This program computes the EXtrinsic Information Transfer (EXIT) chart for Parallel Concatenated Convolutional Codes (PCCCs) of coding rate 1/3. Actually the Transfer Characteristics (TCs) of the two SISO RSC modules used in the turbo decoder are computed at a given Signal to Noise Ratio (SNR). Reference: S. ten Brink, ''Convergence behavior of iteratively decoded parallel concatenated codes,`` IEEE Transactions on Communications, vol. 49, pp. 1727-1737, Oct. 2001 \include exit_pccc.cpp When you run this program, the results (mutual a priori and extrinsic information, EbN0_dB, etc.) are saved into exit_pccc.it file. Using the following MATLAB script \code clear all itload('exit_pccc.it') plot(IA, IE, 'LineWidth', 3) hold on plot(IE_p, IA, 'LineWidth', 3) xlabel('I_A^{(up)}, I_E^{(low)}') ylabel('I_E^{(up)}, I_A^{(low)}') grid on title(['E_b/N_0 = ' num2str(EbN0_dB) ' dB']) \endcode the EXIT chart can be displayed. */ itpp-4.3.1/doc/tutorial/interleaver.doc000066400000000000000000000003631216575753400201330ustar00rootroot00000000000000/*! \page interleaver Interleaving and de-interleaving of data This example shows how to use one of the interleaving classes. \include interleaver.cpp When you run this program, the output will look like this: \include interleaver.ref */ itpp-4.3.1/doc/tutorial/itfile.doc000066400000000000000000000016601216575753400170700ustar00rootroot00000000000000/*! \page itfile Writing and reading data from files Here we will use the \c it_file class to store some data. The program \c write_it_file.cpp looks as follows: \include write_it_file.cpp When you run this program you will obtain a file called \c it_file_test.it in your current directory. You can read the file into Matlab/Octave to view the data by using the following commands: \code itload('it_file_test.it') figure(1); clf; plot(a) \endcode Note: Make sure that $PREFIX/share/itpp is in your Matlab/Octave path and that you run the code above from the directory where \c it_file_test.it is located (\c $PREFIX is the IT++ installation prefix; /usr/local by default). The IT++ program \c read_it_file.cpp that reads the file and prints its content can look like this: \include read_it_file.cpp Here is the output of the program: \verbatim a = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] \endverbatim */ itpp-4.3.1/doc/tutorial/ldpc_bersim_awgn.doc000066400000000000000000000007251216575753400211140ustar00rootroot00000000000000/*! \page ldpc_bersim_awgn Simulation of LDPC codes the AWGN channel This program simulates the performance of LDPC codes on the AWGN channel. Since the channel is symmetric, the zero codeword is used. \include ldpc_bersim_awgn.cpp To simulate the code "RU_10000.it" over a range of SNR (see \ref ldpc_gen_codes for how to generate codec) \code ./ldpc_bersim_awgn RU_10000.it \endcode To simulate at Eb/N0=1.1 dB \code ./ldpc_bersim_awgn RU_10000.it 1.1 \endcode */ itpp-4.3.1/doc/tutorial/ldpc_gen_codes.doc000066400000000000000000000001231216575753400205350ustar00rootroot00000000000000/*! \page ldpc_gen_codes Generation of LDPC codes \include ldpc_gen_codes.cpp */ itpp-4.3.1/doc/tutorial/matlab_itpp.doc000066400000000000000000000070161216575753400201110ustar00rootroot00000000000000/*! \page matlab_itpp Conversion table between IT++ syntax and Matlab/Octave Here we provide a conversion table between Matlab/Octave and IT++ syntax. This table is intended to help with the transition from Matlab/Octave programming to IT++, but it is not an exhaustive list of possible operations.

    In what follows,
    • a, b denote vectors (assumed to be column vectors in Matlab/Octave notation),
    • A, B denote matrices,
    • x is a scalar,
    • k, l, n are indices

    Vector indexing and manipulation: \code a.length() // length(a) a(0) // a(1) a(1) // a(2) a(k-1) // a(k) a(k-1)=x; or a.set(k-1,x); // a(k)=x; a.left(k) // a(1:k) a.right(k) // a(end-k+1:end) a.mid(k,l) // a(k:k+l-1) a.del(k); // a=[a(1:k-1); a(k+1:end)]; concat(a,b) // [a; b] (or [a.' b.'].') a.clear(); // a=zeros(size(a)); (or a=complex(zeros(size(a)));) to_cmat(a) // complex(a) (assuming a real-valued) \endcode Note that indexing in IT++ starts at 0, whereas indexing in Matlab starts at 1. Also note that Matlab/Octave does distinguish between column and row vectors, whereas IT++ does not.

    Matrix indexing and manipulation: \code A.rows() // size(A,1) A.cols() // size(A,2) A(k-1,l-1) // A(k,l) A.set(k-1,l-1,x) // A(k,l)=x A.get_col(k-1) // A(:,k) A.get_row(k-1) // A(k,:) A.set_col(k-1,a) // A(:,k)=a A.set_row(k-1,a) // A(k,:)=a A.append_row(a) // A=[A; a.'] A.append_col(a) // A=[A a] A.transpose() // A.' A.hermitian_transpose() // A' A.clear() // A=zeros(size(A)) [or A=complex(zeros(size(A)))] to_cmat(A) // complex(A) (assuming a real-valued) \endcode

    Some vector and matrix algebra: \code a+b // a+b a-b // a-b elem_mult(a,b) // a.*b (elementwise product) a*b // a.'*b (inner product) conj(a)*b // a'*b (inner product) outer_product(a,b) // a*b.' (outer product) elem_div(a,b) // a./b A+B // A+B A-B // A-B A*B // A*B elem_mul(A,B) // A.*B elem_div(A,B) // A./B ls_solve_od(A,b) // A\b (assuming the system is overdetermined) \endcode

    Special matrices and vectors: \code zeros(n,n) // zeros(n,n) zeros_c(n,n) // complex(zeros(n,n)) eye(n) // eye(n) eye_c(n) // complex(eye(n)) linspace(alpha,beta,n) // linspace(alpha,beta,n) \endcode

    Hardcoded initializations: \code mat X="1.1 1.2; 2.1; 2.2"; // X=[1.1 1.2; 2.1 2.2]; ivec a="1 2 3 4 5"; // a=[1; 2; 3; 4; 5]; (or a=[1 2 3 4 5].';) ivec a="1:-3:-8"; // a=1:-3:-8; \endcode */ itpp-4.3.1/doc/tutorial/mimoconv.doc000066400000000000000000000012371216575753400174430ustar00rootroot00000000000000/*! \page mimoconv MIMO (spatial multiplexing) with convolutional coding This example demonstrates how to use the \c Modulator_ND (MIMO) class for soft-output demodulation. The program simulates a simple convolutionally coded spatial-multiplexing (V-BLAST style) MIMO system with maximum-likelihood, alternatively zero-forcing, demodulation and soft Viterbi decoding, but no iteration between the demodulator and the decoder. \include mimoconv.cpp To run the program, \code mimoconv nTx nRx nC Tc \endcode where - nTx=number of transmit antennas - nRx=number of receive antennas - nC=constellation (1=QPSK, 2=16-QAM, 3=64-QAM) - Tc=coherence time (channel uses) */ itpp-4.3.1/doc/tutorial/mog.doc000066400000000000000000000003521216575753400163730ustar00rootroot00000000000000/*! \page mog Using Mixture of Gaussians (MOG) module to model data This example demonstrates how to find the parameters of a MOG model via using the kmeans and EM based optimisers. Synthetic data is utilised. \include mog.cpp */ itpp-4.3.1/doc/tutorial/pccc_bersim_awgn.doc000066400000000000000000000021311216575753400210730ustar00rootroot00000000000000/*! \page pccc_bersim_awgn Simulation of PCCCs in an AWGN channel This program simulates Parallel Concatenated Convolutional Codes (PCCCs) of coding rate 1/3 using a turbo decoder with two SISO RSC modules. Reference: S. Benedetto, D. Divsalar, G. Motorsi and F. Pollara, "A Soft-Input Soft-Output Maximum A posteriori (MAP) Module to Decode Parallel and Serial Concatenated Codes", TDA Progress Report, nov. 1996 \include pccc_bersim_awgn.cpp When you run this program, the results (BER and EbN0_dB) are saved into pccc_bersim_awgn.it file. Using the following MATLAB script: \code clear all itload('pccc_bersim_awgn.it'); figure semilogy(EbN0_dB, BER, 'o-') grid on xlabel('E_b/N_0 [dB]') ylabel('BER') \endcode the results can be displayed. Similarly, the results can be displayed using the following Python script (pyitpp, numpy and matplotlib modules are required): \code #!/usr/bin/env python from pyitpp import itload from matplotlib.pyplot import * out = itload('pccc_bersim_awgn.it') semilogy(out['EbN0_dB'], out['BER'].T, 'o-') grid() xlabel('$E_b/N_0 [dB]$') ylabel('$BER$') show() \endcode */ itpp-4.3.1/doc/tutorial/qpsk_simulation.doc000066400000000000000000000024771216575753400210450ustar00rootroot00000000000000/*! \page qpsk_simulation Simulation of QPSK modulation on an AWGN channel In this example we will introduce a few new features compared to the BPSK example. We will use the it_ifile class to store the results of the simulation. We will use the Real_Timer class to measure the execution time of our program. Furthermore we will use one of the channel classes, the AWGN_Channel. We will also show how to read the results in to Matlab with the load_it function. The program is as follows: \include qpsk_simulation.cpp When you run this program, the output will look something like this: \include qpsk_simulation.ref Now it is time to plot the simulation results in Matlab and compare with theory using the Matlab code below. The results will be stored in a file called "qpsk_result_file.it". Make sure load_it.m is in your Matlab path (look in $(ITXX_HOME)/matlab) and that you run the example code below from the directory where qpsk_result_file.it is located \code figure(1); clf; load_it qpsk_result_file.it h1 = semilogy(EbN0dB,ber,'*-r'); hold on ebn0db = 0:.1:10; ebn0 = 10.^(ebn0db/10); Pb = 0.5 * erfc(sqrt(ebn0)); h2 = semilogy(ebn0db,Pb); set(gca,'fontname','times','fontsize',16); xlabel('{\it E_b} / {\it N}_0 [dB]'); ylabel('BER') title('QPSK on an AWGN Channel'); legend([h1 h2],'Simulation','Theory'); grid on; \endcode */ itpp-4.3.1/doc/tutorial/rayleigh.doc000066400000000000000000000014531216575753400174200ustar00rootroot00000000000000/*! \page rayleigh Generating a correlated Rayleigh fading process In this example we will generate a correlated Rayleigh fading process with a normaized Doppler frequency equal to 0.1. The normalized Doppler is defined as the multiplication of the maximum Doppler frequency by the sampling time (i.e. \f$f_d = F_d T_s\f$). \include rayleigh.cpp You can use Matlab or Octave to examine the channel fading process that is stored int the output file \c rayleigh_test.it. Try the followigh code to view a part of the fading process: \code itload("rayleigh_test.it") figure(1); clf; semilogy(abs(ch_coeffs(1:200))) \endcode Note: Make sure that the folder $PREFIX/share/itpp is included your Matlab/Octave path variable (\c $PREFIX is the IT++ installation prefix: /usr/local by default). */ itpp-4.3.1/doc/tutorial/reedsolomon.doc000066400000000000000000000012121216575753400201330ustar00rootroot00000000000000/*! \page reedsolomon Simulation of a Reed-Solomon Block Code A Reed-Solomon code is a \f$q^m\f$-ary BCH code of length \f$q^m-1\f$. The generator polynomial for a \f$t\f$-error correcting code is \f$g(x) = (x-\alpha) (x-\alpha^1) \ldots (x-\alpha^{2t-1})\f$. The decoder uses the Berlkamp-Massey algorithm for decoding as described in: S. B. Wicker, "Error Control Systems for digital communication and storage," Prentice Hall. The following example simulates a binary (i.e. \f$q=2\f$) Reed-Solomon code with parameters \f$m\f$ and \f$t\f$: \include reedsolomon.cpp A typical run of this program can look like this: \include reedsolomon.ref */ itpp-4.3.1/doc/tutorial/sccc_bersim_awgn.doc000066400000000000000000000014011216575753400210750ustar00rootroot00000000000000/*! \page sccc_bersim_awgn Simulation of SCCCs in an AWGN channel This program simulates Serially Concatenated Convolutional Codes (SCCCs) of coding rate 1/4 using a turbo decoder with a SISO NSC module and a SISO RSC module. Reference: S. Benedetto, D. Divsalar, G. Motorsi and F. Pollara, "A Soft-Input Soft-Output Maximum A posteriori (MAP) Module to Decode Parallel and Serial Concatenated Codes", TDA Progress Report, nov. 1996 \include sccc_bersim_awgn.cpp When you run this program, the results (BER and EbN0_dB) are saved into sccc_bersim_awgn.it file. Using the following MATLAB script \code clear all itload('sccc_bersim_awgn.it'); figure semilogy(EbN0_dB, BER, 'o-') grid on xlabel('E_b/N_0 [dB]') ylabel('BER') \endcode the results can be displayed. */ itpp-4.3.1/doc/tutorial/sources.mk000066400000000000000000000017431216575753400171430ustar00rootroot00000000000000doc_tutorial_sources = \ $(top_srcdir)/doc/tutorial/bpsk.doc \ $(top_srcdir)/doc/tutorial/convcode.doc \ $(top_srcdir)/doc/tutorial/interleaver.doc \ $(top_srcdir)/doc/tutorial/itfile.doc \ $(top_srcdir)/doc/tutorial/qpsk_simulation.doc \ $(top_srcdir)/doc/tutorial/rayleigh.doc \ $(top_srcdir)/doc/tutorial/reedsolomon.doc \ $(top_srcdir)/doc/tutorial/spread.doc \ $(top_srcdir)/doc/tutorial/timer.doc \ $(top_srcdir)/doc/tutorial/tutorial.doc \ $(top_srcdir)/doc/tutorial/vector_and_matrix.doc \ $(top_srcdir)/doc/tutorial/mimoconv.doc \ $(top_srcdir)/doc/tutorial/demapper_mimo.doc \ $(top_srcdir)/doc/tutorial/matlab_itpp.doc \ $(top_srcdir)/doc/tutorial/mog.doc \ $(top_srcdir)/doc/tutorial/ldpc_gen_codes.doc \ $(top_srcdir)/doc/tutorial/ldpc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/pccc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/exit_pccc.doc \ $(top_srcdir)/doc/tutorial/sccc_bersim_awgn.doc \ $(top_srcdir)/doc/tutorial/turbo_equalizer_bersim_multipath.doc itpp-4.3.1/doc/tutorial/spread.doc000066400000000000000000000014521216575753400170710ustar00rootroot00000000000000/*! \page spread Simulation of a Multicode CDMA system on an AWGN channel In this example we will introduce the multi-code spreading class \c Multicode_Spread_2d. This is the most general spreading class availiable in it++. Different spreading codes may be assigned to the I and Q branches. The number of multiple spreading codes and the spreading factor is determined by the number of rows and collumns respectively that is used when calling the member function set_codes. In this example we will use four Hadamard sequenced of length four, and the same spreading sequences will be used for the I and Q brances. \include spread.cpp A typical run of this program will look like this: \include spread.ref Use copy-and-paste to insert the variables \c EbN0dB and \c ber into Matlab and plot the result. */ itpp-4.3.1/doc/tutorial/src/000077500000000000000000000000001216575753400157115ustar00rootroot00000000000000itpp-4.3.1/doc/tutorial/src/CMakeLists.txt000066400000000000000000000026051216575753400204540ustar00rootroot00000000000000# # \file CMakeLists.txt # \brief cmake configuration file for tutorial examples # \author Bogdan Cristea # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- file ( GLOB ITPP_EXAMPLES_SRCS *.cpp ) include_directories ( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) foreach (FILE ${ITPP_EXAMPLES_SRCS}) get_filename_component ( target ${FILE} NAME_WE ) add_executable ( ${target} ${FILE} ) target_link_libraries ( ${target} ${ITPP_LIBS} ${libitpp_target} ) endforeach (FILE) itpp-4.3.1/doc/tutorial/src/Makefile.am000066400000000000000000000037601216575753400177530ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common LDADD = $(top_builddir)/itpp/libitpp.la AM_CXXFLAGS = $(CXXFLAGS_OPT) ref_example_sources = bpsk.ref convcode.ref interleaver.ref \ qpsk_simulation.ref reedsolomon.ref spread.ref timer.ref \ vector_and_matrix.ref EXTRA_DIST = $(ref_example_sources) bpsk_example_SOURCES = bpsk.cpp convcode_example_SOURCES = convcode.cpp interleaver_example_SOURCES = interleaver.cpp ldpc_bersim_awgn_example_SOURCES = ldpc_bersim_awgn.cpp pccc_bersim_awgn_example_SOURCES = pccc_bersim_awgn.cpp exit_pccc_example_SOURCES = exit_pccc.cpp sccc_bersim_awgn_example_SOURCES = sccc_bersim_awgn.cpp turbo_equalizer_bersim_multipath_example_SOURCES = turbo_equalizer_bersim_multipath.cpp ldpc_gen_codes_example_SOURCES = ldpc_gen_codes.cpp mimoconv_example_SOURCES = mimoconv.cpp mog_example_SOURCES = mog.cpp qpsk_simulation_example_SOURCES = qpsk_simulation.cpp rayleigh_example_SOURCES = rayleigh.cpp read_it_file_example_SOURCES = read_it_file.cpp reedsolomon_example_SOURCES = reedsolomon.cpp spread_example_SOURCES = spread.cpp timer_example_SOURCES = timer.cpp vector_and_matrix_example_SOURCES = vector_and_matrix.cpp write_it_file_example_SOURCES = write_it_file.cpp stbicm_example_SOURCES = stbicm.cpp dump_it_file_example_SOURCES = dump_it_file.cpp BASE_EXAMPLES = mog_example read_it_file_example timer_example \ write_it_file_example dump_it_file_example if RUN_LAPACK_TESTS BASE_EXAMPLES += vector_and_matrix_example endif # RUN_LAPACK_TESTS COMM_EXAMPLES = bpsk_example convcode_example interleaver_example \ ldpc_gen_codes_example ldpc_bersim_awgn_example qpsk_simulation_example \ rayleigh_example reedsolomon_example spread_example pccc_bersim_awgn_example \ exit_pccc_example sccc_bersim_awgn_example turbo_equalizer_bersim_multipath_example if RUN_LAPACK_TESTS COMM_EXAMPLES += mimoconv_example stbicm_example endif # RUN_LAPACK_TESTS USED_EXAMPLES = $(BASE_EXAMPLES) if ENABLE_COMM USED_EXAMPLES += $(COMM_EXAMPLES) endif # ENABLE_COMM check_PROGRAMS = $(USED_EXAMPLES) itpp-4.3.1/doc/tutorial/src/Makefile.in000066400000000000000000000761161216575753400177710ustar00rootroot00000000000000# Makefile.in generated by automake 1.12.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.common $(top_srcdir)/build-aux/depcomp @RUN_LAPACK_TESTS_TRUE@am__append_1 = vector_and_matrix_example @RUN_LAPACK_TESTS_TRUE@am__append_2 = mimoconv_example stbicm_example @ENABLE_COMM_TRUE@am__append_3 = $(COMM_EXAMPLES) check_PROGRAMS = $(am__EXEEXT_6) subdir = doc/tutorial/src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @RUN_LAPACK_TESTS_TRUE@am__EXEEXT_1 = \ @RUN_LAPACK_TESTS_TRUE@ vector_and_matrix_example$(EXEEXT) am__EXEEXT_2 = mog_example$(EXEEXT) read_it_file_example$(EXEEXT) \ timer_example$(EXEEXT) write_it_file_example$(EXEEXT) \ dump_it_file_example$(EXEEXT) $(am__EXEEXT_1) @RUN_LAPACK_TESTS_TRUE@am__EXEEXT_3 = mimoconv_example$(EXEEXT) \ @RUN_LAPACK_TESTS_TRUE@ stbicm_example$(EXEEXT) am__EXEEXT_4 = bpsk_example$(EXEEXT) convcode_example$(EXEEXT) \ interleaver_example$(EXEEXT) ldpc_gen_codes_example$(EXEEXT) \ ldpc_bersim_awgn_example$(EXEEXT) \ qpsk_simulation_example$(EXEEXT) rayleigh_example$(EXEEXT) \ reedsolomon_example$(EXEEXT) spread_example$(EXEEXT) \ pccc_bersim_awgn_example$(EXEEXT) exit_pccc_example$(EXEEXT) \ sccc_bersim_awgn_example$(EXEEXT) \ turbo_equalizer_bersim_multipath_example$(EXEEXT) \ $(am__EXEEXT_3) @ENABLE_COMM_TRUE@am__EXEEXT_5 = $(am__EXEEXT_4) am__EXEEXT_6 = $(am__EXEEXT_2) $(am__EXEEXT_5) am_bpsk_example_OBJECTS = bpsk.$(OBJEXT) bpsk_example_OBJECTS = $(am_bpsk_example_OBJECTS) bpsk_example_LDADD = $(LDADD) bpsk_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_convcode_example_OBJECTS = convcode.$(OBJEXT) convcode_example_OBJECTS = $(am_convcode_example_OBJECTS) convcode_example_LDADD = $(LDADD) convcode_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_dump_it_file_example_OBJECTS = dump_it_file.$(OBJEXT) dump_it_file_example_OBJECTS = $(am_dump_it_file_example_OBJECTS) dump_it_file_example_LDADD = $(LDADD) dump_it_file_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_exit_pccc_example_OBJECTS = exit_pccc.$(OBJEXT) exit_pccc_example_OBJECTS = $(am_exit_pccc_example_OBJECTS) exit_pccc_example_LDADD = $(LDADD) exit_pccc_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_interleaver_example_OBJECTS = interleaver.$(OBJEXT) interleaver_example_OBJECTS = $(am_interleaver_example_OBJECTS) interleaver_example_LDADD = $(LDADD) interleaver_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_ldpc_bersim_awgn_example_OBJECTS = ldpc_bersim_awgn.$(OBJEXT) ldpc_bersim_awgn_example_OBJECTS = \ $(am_ldpc_bersim_awgn_example_OBJECTS) ldpc_bersim_awgn_example_LDADD = $(LDADD) ldpc_bersim_awgn_example_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_ldpc_gen_codes_example_OBJECTS = ldpc_gen_codes.$(OBJEXT) ldpc_gen_codes_example_OBJECTS = $(am_ldpc_gen_codes_example_OBJECTS) ldpc_gen_codes_example_LDADD = $(LDADD) ldpc_gen_codes_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_mimoconv_example_OBJECTS = mimoconv.$(OBJEXT) mimoconv_example_OBJECTS = $(am_mimoconv_example_OBJECTS) mimoconv_example_LDADD = $(LDADD) mimoconv_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_mog_example_OBJECTS = mog.$(OBJEXT) mog_example_OBJECTS = $(am_mog_example_OBJECTS) mog_example_LDADD = $(LDADD) mog_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_pccc_bersim_awgn_example_OBJECTS = pccc_bersim_awgn.$(OBJEXT) pccc_bersim_awgn_example_OBJECTS = \ $(am_pccc_bersim_awgn_example_OBJECTS) pccc_bersim_awgn_example_LDADD = $(LDADD) pccc_bersim_awgn_example_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_qpsk_simulation_example_OBJECTS = qpsk_simulation.$(OBJEXT) qpsk_simulation_example_OBJECTS = \ $(am_qpsk_simulation_example_OBJECTS) qpsk_simulation_example_LDADD = $(LDADD) qpsk_simulation_example_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_rayleigh_example_OBJECTS = rayleigh.$(OBJEXT) rayleigh_example_OBJECTS = $(am_rayleigh_example_OBJECTS) rayleigh_example_LDADD = $(LDADD) rayleigh_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_read_it_file_example_OBJECTS = read_it_file.$(OBJEXT) read_it_file_example_OBJECTS = $(am_read_it_file_example_OBJECTS) read_it_file_example_LDADD = $(LDADD) read_it_file_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_reedsolomon_example_OBJECTS = reedsolomon.$(OBJEXT) reedsolomon_example_OBJECTS = $(am_reedsolomon_example_OBJECTS) reedsolomon_example_LDADD = $(LDADD) reedsolomon_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_sccc_bersim_awgn_example_OBJECTS = sccc_bersim_awgn.$(OBJEXT) sccc_bersim_awgn_example_OBJECTS = \ $(am_sccc_bersim_awgn_example_OBJECTS) sccc_bersim_awgn_example_LDADD = $(LDADD) sccc_bersim_awgn_example_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_spread_example_OBJECTS = spread.$(OBJEXT) spread_example_OBJECTS = $(am_spread_example_OBJECTS) spread_example_LDADD = $(LDADD) spread_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_stbicm_example_OBJECTS = stbicm.$(OBJEXT) stbicm_example_OBJECTS = $(am_stbicm_example_OBJECTS) stbicm_example_LDADD = $(LDADD) stbicm_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_timer_example_OBJECTS = timer.$(OBJEXT) timer_example_OBJECTS = $(am_timer_example_OBJECTS) timer_example_LDADD = $(LDADD) timer_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_turbo_equalizer_bersim_multipath_example_OBJECTS = \ turbo_equalizer_bersim_multipath.$(OBJEXT) turbo_equalizer_bersim_multipath_example_OBJECTS = \ $(am_turbo_equalizer_bersim_multipath_example_OBJECTS) turbo_equalizer_bersim_multipath_example_LDADD = $(LDADD) turbo_equalizer_bersim_multipath_example_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_vector_and_matrix_example_OBJECTS = vector_and_matrix.$(OBJEXT) vector_and_matrix_example_OBJECTS = \ $(am_vector_and_matrix_example_OBJECTS) vector_and_matrix_example_LDADD = $(LDADD) vector_and_matrix_example_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_write_it_file_example_OBJECTS = write_it_file.$(OBJEXT) write_it_file_example_OBJECTS = $(am_write_it_file_example_OBJECTS) write_it_file_example_LDADD = $(LDADD) write_it_file_example_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(bpsk_example_SOURCES) $(convcode_example_SOURCES) \ $(dump_it_file_example_SOURCES) $(exit_pccc_example_SOURCES) \ $(interleaver_example_SOURCES) \ $(ldpc_bersim_awgn_example_SOURCES) \ $(ldpc_gen_codes_example_SOURCES) $(mimoconv_example_SOURCES) \ $(mog_example_SOURCES) $(pccc_bersim_awgn_example_SOURCES) \ $(qpsk_simulation_example_SOURCES) $(rayleigh_example_SOURCES) \ $(read_it_file_example_SOURCES) $(reedsolomon_example_SOURCES) \ $(sccc_bersim_awgn_example_SOURCES) $(spread_example_SOURCES) \ $(stbicm_example_SOURCES) $(timer_example_SOURCES) \ $(turbo_equalizer_bersim_multipath_example_SOURCES) \ $(vector_and_matrix_example_SOURCES) \ $(write_it_file_example_SOURCES) DIST_SOURCES = $(bpsk_example_SOURCES) $(convcode_example_SOURCES) \ $(dump_it_file_example_SOURCES) $(exit_pccc_example_SOURCES) \ $(interleaver_example_SOURCES) \ $(ldpc_bersim_awgn_example_SOURCES) \ $(ldpc_gen_codes_example_SOURCES) $(mimoconv_example_SOURCES) \ $(mog_example_SOURCES) $(pccc_bersim_awgn_example_SOURCES) \ $(qpsk_simulation_example_SOURCES) $(rayleigh_example_SOURCES) \ $(read_it_file_example_SOURCES) $(reedsolomon_example_SOURCES) \ $(sccc_bersim_awgn_example_SOURCES) $(spread_example_SOURCES) \ $(stbicm_example_SOURCES) $(timer_example_SOURCES) \ $(turbo_equalizer_bersim_multipath_example_SOURCES) \ $(vector_and_matrix_example_SOURCES) \ $(write_it_file_example_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) LDADD = $(top_builddir)/itpp/libitpp.la AM_CXXFLAGS = $(CXXFLAGS_OPT) ref_example_sources = bpsk.ref convcode.ref interleaver.ref \ qpsk_simulation.ref reedsolomon.ref spread.ref timer.ref \ vector_and_matrix.ref EXTRA_DIST = $(ref_example_sources) bpsk_example_SOURCES = bpsk.cpp convcode_example_SOURCES = convcode.cpp interleaver_example_SOURCES = interleaver.cpp ldpc_bersim_awgn_example_SOURCES = ldpc_bersim_awgn.cpp pccc_bersim_awgn_example_SOURCES = pccc_bersim_awgn.cpp exit_pccc_example_SOURCES = exit_pccc.cpp sccc_bersim_awgn_example_SOURCES = sccc_bersim_awgn.cpp turbo_equalizer_bersim_multipath_example_SOURCES = turbo_equalizer_bersim_multipath.cpp ldpc_gen_codes_example_SOURCES = ldpc_gen_codes.cpp mimoconv_example_SOURCES = mimoconv.cpp mog_example_SOURCES = mog.cpp qpsk_simulation_example_SOURCES = qpsk_simulation.cpp rayleigh_example_SOURCES = rayleigh.cpp read_it_file_example_SOURCES = read_it_file.cpp reedsolomon_example_SOURCES = reedsolomon.cpp spread_example_SOURCES = spread.cpp timer_example_SOURCES = timer.cpp vector_and_matrix_example_SOURCES = vector_and_matrix.cpp write_it_file_example_SOURCES = write_it_file.cpp stbicm_example_SOURCES = stbicm.cpp dump_it_file_example_SOURCES = dump_it_file.cpp BASE_EXAMPLES = mog_example read_it_file_example timer_example \ write_it_file_example dump_it_file_example $(am__append_1) COMM_EXAMPLES = bpsk_example convcode_example interleaver_example \ ldpc_gen_codes_example ldpc_bersim_awgn_example \ qpsk_simulation_example rayleigh_example reedsolomon_example \ spread_example pccc_bersim_awgn_example exit_pccc_example \ sccc_bersim_awgn_example \ turbo_equalizer_bersim_multipath_example $(am__append_2) USED_EXAMPLES = $(BASE_EXAMPLES) $(am__append_3) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/tutorial/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/tutorial/src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.common: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list bpsk_example$(EXEEXT): $(bpsk_example_OBJECTS) $(bpsk_example_DEPENDENCIES) $(EXTRA_bpsk_example_DEPENDENCIES) @rm -f bpsk_example$(EXEEXT) $(CXXLINK) $(bpsk_example_OBJECTS) $(bpsk_example_LDADD) $(LIBS) convcode_example$(EXEEXT): $(convcode_example_OBJECTS) $(convcode_example_DEPENDENCIES) $(EXTRA_convcode_example_DEPENDENCIES) @rm -f convcode_example$(EXEEXT) $(CXXLINK) $(convcode_example_OBJECTS) $(convcode_example_LDADD) $(LIBS) dump_it_file_example$(EXEEXT): $(dump_it_file_example_OBJECTS) $(dump_it_file_example_DEPENDENCIES) $(EXTRA_dump_it_file_example_DEPENDENCIES) @rm -f dump_it_file_example$(EXEEXT) $(CXXLINK) $(dump_it_file_example_OBJECTS) $(dump_it_file_example_LDADD) $(LIBS) exit_pccc_example$(EXEEXT): $(exit_pccc_example_OBJECTS) $(exit_pccc_example_DEPENDENCIES) $(EXTRA_exit_pccc_example_DEPENDENCIES) @rm -f exit_pccc_example$(EXEEXT) $(CXXLINK) $(exit_pccc_example_OBJECTS) $(exit_pccc_example_LDADD) $(LIBS) interleaver_example$(EXEEXT): $(interleaver_example_OBJECTS) $(interleaver_example_DEPENDENCIES) $(EXTRA_interleaver_example_DEPENDENCIES) @rm -f interleaver_example$(EXEEXT) $(CXXLINK) $(interleaver_example_OBJECTS) $(interleaver_example_LDADD) $(LIBS) ldpc_bersim_awgn_example$(EXEEXT): $(ldpc_bersim_awgn_example_OBJECTS) $(ldpc_bersim_awgn_example_DEPENDENCIES) $(EXTRA_ldpc_bersim_awgn_example_DEPENDENCIES) @rm -f ldpc_bersim_awgn_example$(EXEEXT) $(CXXLINK) $(ldpc_bersim_awgn_example_OBJECTS) $(ldpc_bersim_awgn_example_LDADD) $(LIBS) ldpc_gen_codes_example$(EXEEXT): $(ldpc_gen_codes_example_OBJECTS) $(ldpc_gen_codes_example_DEPENDENCIES) $(EXTRA_ldpc_gen_codes_example_DEPENDENCIES) @rm -f ldpc_gen_codes_example$(EXEEXT) $(CXXLINK) $(ldpc_gen_codes_example_OBJECTS) $(ldpc_gen_codes_example_LDADD) $(LIBS) mimoconv_example$(EXEEXT): $(mimoconv_example_OBJECTS) $(mimoconv_example_DEPENDENCIES) $(EXTRA_mimoconv_example_DEPENDENCIES) @rm -f mimoconv_example$(EXEEXT) $(CXXLINK) $(mimoconv_example_OBJECTS) $(mimoconv_example_LDADD) $(LIBS) mog_example$(EXEEXT): $(mog_example_OBJECTS) $(mog_example_DEPENDENCIES) $(EXTRA_mog_example_DEPENDENCIES) @rm -f mog_example$(EXEEXT) $(CXXLINK) $(mog_example_OBJECTS) $(mog_example_LDADD) $(LIBS) pccc_bersim_awgn_example$(EXEEXT): $(pccc_bersim_awgn_example_OBJECTS) $(pccc_bersim_awgn_example_DEPENDENCIES) $(EXTRA_pccc_bersim_awgn_example_DEPENDENCIES) @rm -f pccc_bersim_awgn_example$(EXEEXT) $(CXXLINK) $(pccc_bersim_awgn_example_OBJECTS) $(pccc_bersim_awgn_example_LDADD) $(LIBS) qpsk_simulation_example$(EXEEXT): $(qpsk_simulation_example_OBJECTS) $(qpsk_simulation_example_DEPENDENCIES) $(EXTRA_qpsk_simulation_example_DEPENDENCIES) @rm -f qpsk_simulation_example$(EXEEXT) $(CXXLINK) $(qpsk_simulation_example_OBJECTS) $(qpsk_simulation_example_LDADD) $(LIBS) rayleigh_example$(EXEEXT): $(rayleigh_example_OBJECTS) $(rayleigh_example_DEPENDENCIES) $(EXTRA_rayleigh_example_DEPENDENCIES) @rm -f rayleigh_example$(EXEEXT) $(CXXLINK) $(rayleigh_example_OBJECTS) $(rayleigh_example_LDADD) $(LIBS) read_it_file_example$(EXEEXT): $(read_it_file_example_OBJECTS) $(read_it_file_example_DEPENDENCIES) $(EXTRA_read_it_file_example_DEPENDENCIES) @rm -f read_it_file_example$(EXEEXT) $(CXXLINK) $(read_it_file_example_OBJECTS) $(read_it_file_example_LDADD) $(LIBS) reedsolomon_example$(EXEEXT): $(reedsolomon_example_OBJECTS) $(reedsolomon_example_DEPENDENCIES) $(EXTRA_reedsolomon_example_DEPENDENCIES) @rm -f reedsolomon_example$(EXEEXT) $(CXXLINK) $(reedsolomon_example_OBJECTS) $(reedsolomon_example_LDADD) $(LIBS) sccc_bersim_awgn_example$(EXEEXT): $(sccc_bersim_awgn_example_OBJECTS) $(sccc_bersim_awgn_example_DEPENDENCIES) $(EXTRA_sccc_bersim_awgn_example_DEPENDENCIES) @rm -f sccc_bersim_awgn_example$(EXEEXT) $(CXXLINK) $(sccc_bersim_awgn_example_OBJECTS) $(sccc_bersim_awgn_example_LDADD) $(LIBS) spread_example$(EXEEXT): $(spread_example_OBJECTS) $(spread_example_DEPENDENCIES) $(EXTRA_spread_example_DEPENDENCIES) @rm -f spread_example$(EXEEXT) $(CXXLINK) $(spread_example_OBJECTS) $(spread_example_LDADD) $(LIBS) stbicm_example$(EXEEXT): $(stbicm_example_OBJECTS) $(stbicm_example_DEPENDENCIES) $(EXTRA_stbicm_example_DEPENDENCIES) @rm -f stbicm_example$(EXEEXT) $(CXXLINK) $(stbicm_example_OBJECTS) $(stbicm_example_LDADD) $(LIBS) timer_example$(EXEEXT): $(timer_example_OBJECTS) $(timer_example_DEPENDENCIES) $(EXTRA_timer_example_DEPENDENCIES) @rm -f timer_example$(EXEEXT) $(CXXLINK) $(timer_example_OBJECTS) $(timer_example_LDADD) $(LIBS) turbo_equalizer_bersim_multipath_example$(EXEEXT): $(turbo_equalizer_bersim_multipath_example_OBJECTS) $(turbo_equalizer_bersim_multipath_example_DEPENDENCIES) $(EXTRA_turbo_equalizer_bersim_multipath_example_DEPENDENCIES) @rm -f turbo_equalizer_bersim_multipath_example$(EXEEXT) $(CXXLINK) $(turbo_equalizer_bersim_multipath_example_OBJECTS) $(turbo_equalizer_bersim_multipath_example_LDADD) $(LIBS) vector_and_matrix_example$(EXEEXT): $(vector_and_matrix_example_OBJECTS) $(vector_and_matrix_example_DEPENDENCIES) $(EXTRA_vector_and_matrix_example_DEPENDENCIES) @rm -f vector_and_matrix_example$(EXEEXT) $(CXXLINK) $(vector_and_matrix_example_OBJECTS) $(vector_and_matrix_example_LDADD) $(LIBS) write_it_file_example$(EXEEXT): $(write_it_file_example_OBJECTS) $(write_it_file_example_DEPENDENCIES) $(EXTRA_write_it_file_example_DEPENDENCIES) @rm -f write_it_file_example$(EXEEXT) $(CXXLINK) $(write_it_file_example_OBJECTS) $(write_it_file_example_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bpsk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convcode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump_it_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exit_pccc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interleaver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldpc_bersim_awgn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldpc_gen_codes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mimoconv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pccc_bersim_awgn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qpsk_simulation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rayleigh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_it_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reedsolomon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sccc_bersim_awgn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stbicm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/turbo_equalizer_bersim_multipath.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_and_matrix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write_it_file.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist \ ctags distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/doc/tutorial/src/bpsk.cpp000066400000000000000000000022241216575753400173540ustar00rootroot00000000000000#include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Scalars int N; double N0; //Vectors bvec bits, dec_bits; vec symbols, rec; //Classes BPSK bpsk; //The BPSK modulator/debodulator class BERC berc; //The Bit Error Rate Counter class //Init N = 500000; //The number of bits to simulate N0 = 1; //0 dB SNR //Randomize the random number generator RNG_randomize(); //Generate the bits: bits = randb(N); //Do the BPSK modulation bpsk.modulate_bits(bits, symbols); //Add the AWGN rec = symbols + sqrt(N0 / 2) * randn(N); //Decode the received bits bpsk.demodulate_bits(rec, dec_bits); //Count the number of errors berc.count(bits, dec_bits); //Print the results cout << "There were " << berc.get_errors() << " received bits in error." << endl; cout << "There were " << berc.get_corrects() << " correctly received bits." << endl; cout << "The error probability was " << berc.get_errorrate() << endl; cout << "The theoretical error probability is " << 0.5*erfc(1.0) << endl; //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/bpsk.ref000066400000000000000000000002461216575753400173500ustar00rootroot00000000000000There were 39224 received bits in error. There were 460776 correctly received bits. The error probability was 0.078448 The theoretical error probability is 0.0786496 itpp-4.3.1/doc/tutorial/src/convcode.cpp000066400000000000000000000050351216575753400202200ustar00rootroot00000000000000#include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Scalars int constraint_length, MaxNrofErrors, Nobits, MaxIterations, p, i; double Ec, Eb; //Vectors ivec generators; vec EbN0dB, EbN0, N0, ber, trans_symbols, rec_symbols; bvec uncoded_bits, coded_bits, decoded_bits; //Classes BPSK bpsk; BERC berc; Convolutional_Code conv_code; AWGN_Channel channel; /* Set up the convolutional encoder/decoder class: The generators are given in octal form by adding a zero in front of the numbers. In this example we will simulate a rate 1/3 code that is listed in J. G. Proakis, "Digital communications". The encoder has constraint length 7. */ generators.set_size(3, false); generators(0) = 0133; generators(1) = 0145; generators(2) = 0175; constraint_length = 7; conv_code.set_generator_polynomials(generators, constraint_length); //Init: Calculate some simulation specific parameters: Ec = 1.0; EbN0dB = linspace(-2, 6, 5); EbN0 = inv_dB(EbN0dB); Eb = Ec / conv_code.get_rate(); N0 = Eb * pow(EbN0, -1); MaxNrofErrors = 100; Nobits = 10000; MaxIterations = 10; ber.set_size(EbN0dB.length(), false); ber.clear(); //Randomize the random number generators. RNG_randomize(); for (p = 0; p < EbN0dB.length(); p++) { cout << "Now simulating point " << p + 1 << " out of " << EbN0dB.length() << endl; berc.clear(); //Clear the bit error rate counter. channel.set_noise(N0(p) / 2.0); //Set the noise value of the AWGN channel. for (i = 0; i < MaxIterations; i++) { uncoded_bits = randb(Nobits); //The uncoded bits. coded_bits = conv_code.encode(uncoded_bits); //The convolutional encoder function. bpsk.modulate_bits(coded_bits, trans_symbols); //The BPSK modulator. rec_symbols = channel(trans_symbols); //The AWGN channel. decoded_bits = conv_code.decode(rec_symbols); //The Viterbi decoder function. berc.count(uncoded_bits, decoded_bits); //Count the errors. ber(p) = berc.get_errorrate(); //Break the simulation on this point if sufficient number of bit errors were observed: if (berc.get_errors() > MaxNrofErrors) { cout << "Breaking on point " << p + 1 << " with " << berc.get_errors() << " errors." << endl; break; } } } //Print the results: cout << "BER = " << ber << endl; cout << "EbN0dB = " << EbN0dB << endl; //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/convcode.ref000066400000000000000000000005231216575753400202070ustar00rootroot00000000000000Now simulating point 1 out of 5 Breaking on point 1 with 3297 errors. Now simulating point 2 out of 5 Breaking on point 2 with 781 errors. Now simulating point 3 out of 5 Breaking on point 3 with 112 errors. Now simulating point 4 out of 5 Now simulating point 5 out of 5 BER = [0.330858 0.0783743 0.00280983 0 0] EbN0dB = [-2 0 2 4 6] itpp-4.3.1/doc/tutorial/src/dump_it_file.cpp000066400000000000000000000021251216575753400210550ustar00rootroot00000000000000#include #include #include using namespace itpp; using namespace std; int main(int argc, char *argv[]) { it_ifile ff; if (1 >= argc) { cout << "Usage: " << argv[0] << " file.it" << endl; return EXIT_FAILURE; } for (int i = 1; i < argc; ++i) { ff.open(argv[i]); cout << "Opening " << argv[i] << endl; int n = 0; string name; string type; string desc; uint64_t bytes; while(true == ff.seek(n++)) { ff.info(name, type, desc, bytes); cout << name << ": "; if ("dmat" == type) { mat tmp; ff >> tmp; cout << tmp; } else if ("imat" == type) { imat tmp; ff >> tmp; cout << tmp; } else if ("dvec" == type) { vec tmp; ff >> tmp; cout << tmp; } else if ("ivec" == type) { ivec tmp; ff >> tmp; cout << tmp; } else if ("float64" == type) { double tmp; ff >> tmp; cout << tmp; } else if ("int32" == type) { int tmp; ff >> tmp; cout << tmp; } else { cout << type; } cout << endl; } ff.close(); } return EXIT_SUCCESS; } itpp-4.3.1/doc/tutorial/src/exit_pccc.cpp000066400000000000000000000106741216575753400203660ustar00rootroot00000000000000#include "itpp/itcomm.h" using namespace itpp; using std::cout; using std::endl; using std::string; int main(void) { //general parameters vec sigmaA = "0.01:0.1:7";//standard deviation (sqrt(variance)) of the mutual a priori information double threshold_value = 50; string map_metric = "maxlogMAP"; ivec gen = "07 05";//octal form int constraint_length = 3; int nb_blocks_lim = 10; int perm_len = int(itpp::pow10(5.0));//total number of bits in a block (with tail) double EbN0_dB = 0.6; double R = 1.0 / 3.0;//coding rate of PCCC double Ec = 1.0;//coded bit energy //other parameters vec sigma2A = sqr(sigmaA); int sigma2A_len = sigma2A.length(); int nb_bits = perm_len - (constraint_length - 1);//number of bits in a block (without tail) double sigma2 = (0.5 * Ec / R) * pow(inv_dB(EbN0_dB), -1.0);//N0/2 double Lc = -2 / sigma2;//normalisation factor for intrinsic information (take into account the BPSK modulation) bvec bits(nb_bits); bvec tail; bvec bits_tail(perm_len); bmat parity_bits; int coded_bits_len = 2 * perm_len; bvec coded_bits(coded_bits_len); vec mod_bits(coded_bits_len); vec rec_sig(coded_bits_len); vec intrinsic_coded(coded_bits_len); vec intrinsic_coded_p(2*nb_bits); intrinsic_coded_p.zeros(); vec apriori_data(perm_len); vec extrinsic_coded; vec extrinsic_data; vec apriori_mutual_info(sigma2A_len); vec extrinsic_mutual_info(sigma2A_len); vec extrinsic_mutual_info_p(sigma2A_len); extrinsic_mutual_info.zeros(); extrinsic_mutual_info_p.zeros(); register int en, n, nb_blocks; //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code rsc; rsc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; channel.set_noise(sigma2); //SISO module SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //EXIT chart EXIT exit; //Randomize generators RNG_randomize(); //main loop for (en = 0;en < sigma2A_len;en++) { apriori_mutual_info(en) = exit.apriori_mutual_info(sigma2A(en));//a priori mutual info cout << "I_A = " << apriori_mutual_info(en) << endl; for (nb_blocks = 0;nb_blocks < nb_blocks_lim;nb_blocks++) { //bits generation bits = randb(nb_bits); //RSC code rsc.encode_tail(bits, tail, parity_bits);//tail is added //form coder output bits_tail = concat(bits, tail); for (n = 0;n < perm_len;n++) { coded_bits(2*n) = bits_tail(n);//systematic output coded_bits(2*n + 1) = parity_bits(n, 0);//parity output } //BPSK modulation (1->-1,0->+1) mod_bits = bpsk.modulate_bits(coded_bits); //AWGN channel rec_sig = channel(mod_bits); //first SISO RSC module (tail is added) //intrinsic info. of coded bits intrinsic_coded = Lc * rec_sig; //a priori info. of data bits apriori_data = exit.generate_apriori_info(bits_tail); //SISO RSC module siso.rsc(extrinsic_coded, extrinsic_data, intrinsic_coded, apriori_data, true); //threshold extrinsic_data = SISO::threshold(extrinsic_data, threshold_value); //extrinsic mutual info extrinsic_mutual_info(en) += exit.extrinsic_mutual_info(extrinsic_data.left(nb_bits), bits); //second SISO RSC module (no tail added) //intrinsic info. of coded bits for (n = 0;n < nb_bits;n++) intrinsic_coded_p(2*n + 1) = Lc * rec_sig(2 * n + 1);//parity bits only //a priori info. of data bits apriori_data = exit.generate_apriori_info(bits); //SISO RSC module siso.rsc(extrinsic_coded, extrinsic_data, intrinsic_coded_p, apriori_data, false); //threshold extrinsic_data = SISO::threshold(extrinsic_data, threshold_value); //extrinsic mutual info extrinsic_mutual_info_p(en) += exit.extrinsic_mutual_info(extrinsic_data, bits); }//end blocks (while loop) //mean extrinsic mutual info over all blocks extrinsic_mutual_info(en) /= nb_blocks_lim; extrinsic_mutual_info_p(en) /= nb_blocks_lim; } it_file ff("exit_pccc.it"); ff << Name("IA") << apriori_mutual_info; ff << Name("IE") << extrinsic_mutual_info; ff << Name("IE_p") << extrinsic_mutual_info_p; ff << Name("EbN0_dB") << EbN0_dB; ff << Name("gen") << gen; ff << Name("R") << R; ff << Name("perm_len") << perm_len; ff << Name("nb_blocks_lim") << nb_blocks_lim; ff.close(); return 0; } itpp-4.3.1/doc/tutorial/src/interleaver.cpp000066400000000000000000000021211216575753400207310ustar00rootroot00000000000000#include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Declare scalars and vectors: int rows, cols; ivec input, output, deinterleaved; //Declare the interleaver. The interleaver classes are templated, and therefore we must specify //the type of the data elements. In this example we are using integers: Block_Interleaver my_interleaver; //Initialize the interleaver class. Note that this can be done already in the declaration by writing //Block_Interleaver my_interleaver(rows,cols); rows = 4; cols = 5; my_interleaver.set_rows(rows); my_interleaver.set_cols(cols); //Define the input to the interleaver: input = "1:20"; //Do the interleaving: output = my_interleaver.interleave(input); //Do the de-interleaving: deinterleaved = my_interleaver.deinterleave(output); //Print the results: cout << "input = " << input << endl; cout << "output = " << output << endl; cout << "deinterleaved = " << deinterleaved << endl; //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/interleaver.ref000066400000000000000000000003001216575753400207200ustar00rootroot00000000000000input = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] output = [1 5 9 13 17 2 6 10 14 18 3 7 11 15 19 4 8 12 16 20] deinterleaved = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] itpp-4.3.1/doc/tutorial/src/ldpc_bersim_awgn.cpp000066400000000000000000000056251216575753400217240ustar00rootroot00000000000000#include #include using namespace std; using namespace itpp; int main(int argc, char **argv) { if (argc < 2) { it_info("Usage: " << argv[0] << " codec_file.it [EbN0_dB]"); return 1; } int64_t Nbits = 5000000000LL; // maximum number of bits simulated // for each SNR point int Nbers = 2000; // target number of bit errors per SNR point double BERmin = 1e-6; // BER at which to terminate simulation vec EbN0db = "0.6:0.2:5"; LDPC_Generator_Systematic G; // for codes created with ldpc_gen_codes since generator exists LDPC_Code C(argv[1], &G); bool single_snr_mode = false; if (argc == 3) { istringstream ss(argv[2]); double x; ss >> x; EbN0db = x; single_snr_mode = true; } cout << "Running with Eb/N0: " << EbN0db << endl; // High performance: 2500 iterations, high resolution LLR algebra C.set_exit_conditions(2500); // Alternate high speed settings: 50 iterations, logmax approximation // C.set_llrcalc(LLR_calc_unit(12,0,7)); cout << C << endl; int N = C.get_nvar(); // number of bits per codeword BPSK Mod; bvec bitsin = zeros_b(N); vec s = Mod.modulate_bits(bitsin); RNG_randomize(); for (int j = 0; j < length(EbN0db); j++) { // Noise variance is N0/2 per dimension double N0 = pow(10.0, -EbN0db(j) / 10.0) / C.get_rate(); AWGN_Channel chan(N0 / 2); BERC berc; // Counters for coded and uncoded BER BLERC ferc; // Counter for coded FER ferc.set_blocksize(C.get_nvar() - C.get_ncheck()); for (int64_t i = 0; i < Nbits; i += C.get_nvar()) { // Received data vec x = chan(s); // Demodulate vec softbits = Mod.demodulate_soft_bits(x, N0); // Decode the received bits QLLRvec llr; C.bp_decode(C.get_llrcalc().to_qllr(softbits), llr); bvec bitsout = llr < 0; // bvec bitsout = C.decode(softbits); // (only systematic bits) // Count the number of errors berc.count(bitsin, bitsout); ferc.count(bitsin, bitsout); if (single_snr_mode) { cout << "Eb/N0 = " << EbN0db(j) << " Simulated " << ferc.get_total_blocks() << " frames and " << berc.get_total_bits() << " bits. " << "Obtained " << berc.get_errors() << " bit errors. " << " BER: " << berc.get_errorrate() << " FER: " << ferc.get_errorrate() << endl << flush; } else { if (berc.get_errors() > Nbers) break; } } cout << "Eb/N0 = " << EbN0db(j) << " Simulated " << ferc.get_total_blocks() << " frames and " << berc.get_total_bits() << " bits. " << "Obtained " << berc.get_errors() << " bit errors. " << " BER: " << berc.get_errorrate() << " FER: " << ferc.get_errorrate() << endl << flush; if (berc.get_errorrate() < BERmin) break; } return 0; } itpp-4.3.1/doc/tutorial/src/ldpc_gen_codes.cpp000066400000000000000000000072351216575753400213540ustar00rootroot00000000000000// Generate some example LDPC codes #include using namespace itpp; using namespace std; int main(int argc, char **argv) { { // This generates a random regular (3,6) code with 500 bits cout << "========= RANDOM (3,6) CODE ==========" << endl; LDPC_Parity_Regular H; H.generate(500, 3, 6, "rand", // random unstructured matrix "500 10"); // optimize girth H.display_stats(); LDPC_Code C1(&H); C1.save_code("random_3_6_code.it"); } { // This is the code "204.33.484 (N=204, K=102, M=102, R=0.5)" from // David MacKay's database over sparse-graph code. It can be obtained // using the following URL: // http://www.inference.phy.cam.ac.uk/mackay/codes/EN/C/204.33.484 cout << "========= MACKAY CODE ==========" << endl; LDPC_Parity_Regular H; H.load_alist("204.33.484"); H.display_stats(); LDPC_Generator_Systematic G(&H); LDPC_Code C(&H, &G); C.save_code("mackay_204.33.484.it"); // Now produce a girth-optimized version of this code by removing // cycles. This slightly improves the performance at high SNR. // Cycle removal procedure is only available for unstructured LDPC // parity check matrices, represented by either LDPC_Parity_Regular or // LDPC_Parity_Irregular classes. H.cycle_removal_MGW(12); LDPC_Generator_Systematic G1(&H); LDPC_Code C1(&H, &G1); C1.save_code("mackay_204.33.484_opt.it"); } // Irregular 1/2-rate codes optimized for the AWGN channel. The // degree distributions are taken from Richardson & Urbanke, // Trans. IT 2001. { // 1000 bits cout << "========= IRREGULAR CODE 1000 BITS ==========" << endl; LDPC_Parity_Irregular H; H.generate(1000, "0 0.27684 0.28342 0 0 0 0 0 0.43974", "0 0 0 0 0 0.01568 0.85244 0.13188", "rand", // random unstructured matrix "500 8"); // optimize girth LDPC_Code C(&H); C.save_code("RU_1000.it"); } { // 10000 bits (takes a few minutes to run) cout << "========= IRREGULAR CODE 10000 BITS ==========" << endl; LDPC_Parity_Irregular H; H.generate(10000, "0 0.21991 0.23328 0.02058 0 0.08543 0.06540 0.04767 0.01912 " "0 0 0 0 0 0 0 0 0 0.08064 0.22798", "0 0 0 0 0 0 0 0.64854 0.34747 0.00399", "rand", // random unstructured matrix "150 8"); // optimize LDPC_Code C(&H); C.save_code("RU_10000.it"); } { // 100000 bits (takes a while to run) cout << "========= IRREGULAR CODE 100000 BITS ==========" << endl; LDPC_Parity_Irregular H; H.generate(100000, "0 0.1712 0.21053 0.00273 0 0 0.00009 0.15269 0.09227 " "0.02802 0 0 0 0 0.01206 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " "0.07212 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25830", "0 0 0 0 0 0 0 0 0.33620 0.08883 0.57497", "rand", "40 4"); // less aggressive optimization LDPC_Code C(&H); C.save_code("RU_100000.it"); } return 0; { // 1000000 bits (THIS CODE REQUIRES ABOUT 450 MB TO STORE AND 2GB // INTERNAL MEMORY TO GENERATE) cout << "========= IRREGULAR CODE 1000000 BITS ==========" << endl; LDPC_Parity_Irregular H; H.generate(1000000, "0 0.1712 0.21053 0.00273 0 0 0.00009 0.15269 0.09227 " "0.02802 0 0 0 0 0.01206 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " "0.07212 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25830", "0 0 0 0 0 0 0 0 0.33620 0.08883 0.57497", "rand", "0 0"); // no optimization here LDPC_Code C(&H); C.save_code("RU_1000000.it"); } } itpp-4.3.1/doc/tutorial/src/mimoconv.cpp000066400000000000000000000216711216575753400202530ustar00rootroot00000000000000#include using namespace itpp; using namespace std; int main(int argc, char **argv) { // -- modulation and channel parameters (taken from command line input) -- int nC; // type of constellation (1=QPSK, 2=16-QAM, 3=64-QAM) int nRx; // number of receive antennas int nTx; // number of transmit antennas int Tc; // coherence time (number of channel vectors with same H) if (argc != 5) { cout << "Usage: cm nTx nRx nC Tc" << endl << "Example: cm 2 2 1 100000 (2x2 QPSK MIMO on slow fading channel)" << endl; exit(1); } else { sscanf(argv[1], "%i", &nTx); sscanf(argv[2], "%i", &nRx); sscanf(argv[3], "%i", &nC); sscanf(argv[4], "%i", &Tc); } cout << "Initializing.. " << nTx << " TX antennas, " << nRx << " RX antennas, " << (1 << nC) << "-PAM per dimension, coherence time " << Tc << endl; // -- simulation control parameters -- const vec EbN0db = "-5:0.5:50"; // SNR range const int Nmethods = 2; // number of demodulators to try const int Nbitsmax = 50000000; // maximum number of bits to ever simulate per SNR point const int Nu = 1000; // length of data packet (before applying channel coding) int Nbers, Nfers; // target number of bit/frame errors per SNR point double BERmin, FERmin; // BER/FER at which to terminate simulation if (Tc == 1) { // Fast fading channel, BER is of primary interest BERmin = 0.001; // stop simulating a given method if BER sequence_interleaver_b(Nctx); Sequence_Interleaver sequence_interleaver_i(Nctx); sequence_interleaver_b.randomize_interleaver_sequence(); sequence_interleaver_i.set_interleaver_sequence(sequence_interleaver_b.get_interleaver_sequence()); // RNG_randomize(); Array Y(Nvec); // received data Array H(Nvec / Tc + 1); // channel matrix (new matrix for each coherence interval) ivec Contflag = ones_i(Nmethods); // flag to determine whether to run a given demodulator if (pow(2.0, nC*2.0*nTx) > 256) { // ML decoder too complex.. Contflag(1) = 0; } if (nTx > nRx) { Contflag(0) = 0; // ZF not for underdetermined systems } cout << "Running methods: " << Contflag << endl; cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint); cout.precision(5); // ================== Run simulation ======================= for (int nsnr = 0; nsnr < length(EbN0db); nsnr++) { const double Eb = 1.0; // transmitted energy per information bit const double N0 = inv_dB(-EbN0db(nsnr)); const double sigma2 = N0; // Variance of each scalar complex noise sample const double Es = rate * 2 * nC * Eb; // Energy per complex scalar symbol // (Each transmitted scalar complex symbol contains rate*2*nC // information bits.) const double Ess = sqrt(Es); Array berc(Nmethods); // counter for coded BER Array bercu(Nmethods); // counter for uncoded BER Array ferc(Nmethods); // counter for coded FER for (int i = 0; i < Nmethods; i++) { ferc(i).set_blocksize(Nu); } long int nbits = 0; while (nbits < Nbitsmax) { nbits += Nu; // generate and encode random data bvec inputbits = randb(Nu); bvec txbits; code.encode_tail(inputbits, txbits); // coded block length is not always a multiple of the number of // bits per channel vector txbits = concat(txbits, randb(Nctx - Nc)); txbits = sequence_interleaver_b.interleave(txbits); // -- generate channel and data ---- for (int k = 0; k < Nvec; k++) { /* A complex valued channel matrix is used here. An alternative (with equivalent result) would be to use a real-valued (structured) channel matrix of twice the dimension. */ if (k % Tc == 0) { // generate a new channel realization every Tc intervals H(k / Tc) = Ess * randn_c(nRx, nTx); } // modulate and transmit bits bvec bitstmp = txbits(k * 2 * nTx * nC, (k + 1) * 2 * nTx * nC - 1); cvec x = chan.modulate_bits(bitstmp); cvec e = sqrt(sigma2) * randn_c(nRx); Y(k) = H(k / Tc) * x + e; } // -- demodulate -- Array LLRin(Nmethods); for (int i = 0; i < Nmethods; i++) { LLRin(i) = zeros_i(Nctx); } QLLRvec llr_apr = zeros_i(nC * 2 * nTx); // no a priori input to demodulator QLLRvec llr_apost = zeros_i(nC * 2 * nTx); for (int k = 0; k < Nvec; k++) { // zero forcing demodulation if (Contflag(0)) { chan.demodulate_soft_bits(Y(k), H(k / Tc), sigma2, llr_apr, llr_apost, ND_UQAM::ZF_LOGMAP); LLRin(0).set_subvector(k*Nbitspvec, llr_apost); } // ML demodulation if (Contflag(1)) { chan.demodulate_soft_bits(Y(k), H(k / Tc), sigma2, llr_apr, llr_apost); LLRin(1).set_subvector(k*Nbitspvec, llr_apost); } } // -- decode and count errors -- for (int i = 0; i < Nmethods; i++) { bvec decoded_bits; if (Contflag(i)) { bercu(i).count(txbits(0, Nc - 1), LLRin(i)(0, Nc - 1) < 0); // uncoded BER LLRin(i) = sequence_interleaver_i.deinterleave(LLRin(i), 0); // QLLR values must be converted to real numbers since the convolutional decoder wants this vec llr = chan.get_llrcalc().to_double(LLRin(i).left(Nc)); // llr=-llr; // UNCOMMENT THIS LINE IF COMPILING WITH 3.10.5 OR EARLIER (BEFORE HARMONIZING LLR CONVENTIONS) code.decode_tail(llr, decoded_bits); berc(i).count(inputbits(0, Nu - 1), decoded_bits(0, Nu - 1)); // coded BER ferc(i).count(inputbits(0, Nu - 1), decoded_bits(0, Nu - 1)); // coded FER } } /* Check whether it is time to terminate the simulation. Terminate when all demodulators that are still running have counted at least Nbers or Nfers bit/frame errors. */ int minber = 1000000; int minfer = 1000000; for (int i = 0; i < Nmethods; i++) { if (Contflag(i)) { minber = min(minber, round_i(berc(i).get_errors())); minfer = min(minfer, round_i(ferc(i).get_errors())); } } if (Nbers > 0 && minber > Nbers) { break;} if (Nfers > 0 && minfer > Nfers) { break;} } cout << "-----------------------------------------------------" << endl; cout << "Eb/N0: " << EbN0db(nsnr) << " dB. Simulated " << nbits << " bits." << endl; cout << " Uncoded BER: " << bercu(0).get_errorrate() << " (ZF); " << bercu(1).get_errorrate() << " (ML)" << endl; cout << " Coded BER: " << berc(0).get_errorrate() << " (ZF); " << berc(1).get_errorrate() << " (ML)" << endl; cout << " Coded FER: " << ferc(0).get_errorrate() << " (ZF); " << ferc(1).get_errorrate() << " (ML)" << endl; cout.flush(); /* Check wheter it is time to terminate simulation. Stop when all methods have reached the min BER/FER of interest. */ int contflag = 0; for (int i = 0; i < Nmethods; i++) { if (Contflag(i)) { if (berc(i).get_errorrate() > BERmin) { contflag = 1; } else { Contflag(i) = 0; } if (ferc(i).get_errorrate() > FERmin) { contflag = 1; } else { Contflag(i) = 0; } } } if (contflag) { continue; } else {break; } } return 0; } itpp-4.3.1/doc/tutorial/src/mog.cpp000066400000000000000000000073271216575753400172100ustar00rootroot00000000000000#include #include #include #include #include using std::cout; using std::endl; using std::fixed; using std::setprecision; using namespace itpp; int main() { bool print_progress = false; // // first, let's generate some synthetic data int N = 100000; // number of vectors int D = 3; // number of dimensions int K = 5; // number of Gaussians Array X(N); for (int n = 0;n < N;n++) { X(n).set_size(D); X(n) = 0.0; } // the means Array mu(K); mu(0) = "-6, -4, -2"; mu(1) = "-4, -2, 0"; mu(2) = "-2, 0, 2"; mu(3) = " 0, +2, +4"; mu(4) = "+2, +4, +6"; // the diagonal variances Array var(K); var(0) = "0.1, 0.2, 0.3"; var(1) = "0.2, 0.3, 0.1"; var(2) = "0.3, 0.1, 0.2"; var(3) = "0.1, 0.2, 0.3"; var(4) = "0.2, 0.3, 0.1"; cout << fixed << setprecision(3); cout << "user configured means and variances:" << endl; cout << "mu = " << mu << endl; cout << "var = " << var << endl; // randomise the order of Gaussians "generating" the vectors I_Uniform_RNG rnd_uniform(0, K - 1); ivec gaus_id = rnd_uniform(N); ivec gaus_count(K); gaus_count = 0; Array mu_test(K); for (int k = 0;k < K;k++) { mu_test(k).set_size(D); mu_test(k) = 0.0; } Array var_test(K); for (int k = 0;k < K;k++) { var_test(k).set_size(D); var_test(k) = 0.0; } Normal_RNG rnd_normal; for (int n = 0;n < N;n++) { int k = gaus_id(n); gaus_count(k)++; for (int d = 0;d < D;d++) { rnd_normal.setup(mu(k)(d), var(k)(d)); double tmp = rnd_normal(); X(n)(d) = tmp; mu_test(k)(d) += tmp; } } // // find the stats for the generated data for (int k = 0;k < K;k++) mu_test(k) /= gaus_count(k); for (int n = 0;n < N;n++) { int k = gaus_id(n); for (int d = 0;d < D;d++) { double tmp = X(n)(d) - mu_test(k)(d); var_test(k)(d) += tmp * tmp; } } for (int k = 0;k < K;k++) var_test(k) /= (gaus_count(k) - 1.0); cout << endl << endl; cout << fixed << setprecision(3); cout << "stats for X:" << endl; for (int k = 0;k < K;k++) { cout << "k = " << k << " count = " << gaus_count(k) << " weight = " << gaus_count(k) / double(N) << endl; for (int d = 0;d < D;d++) cout << " d = " << d << " mu_test = " << mu_test(k)(d) << " var_test = " << var_test(k)(d) << endl; cout << endl; } // make a model with initial values (zero mean and unit variance) // the number of gaussians and dimensions of the model is specified here MOG_diag mog(K, D); cout << endl; cout << fixed << setprecision(3); cout << "mog.avg_log_lhood(X) = " << mog.avg_log_lhood(X) << endl; // // find initial parameters via k-means (which are then used as seeds for EM based optimisation) cout << endl << endl; cout << "running kmeans optimiser" << endl << endl; MOG_diag_kmeans(mog, X, 10, 0.5, true, print_progress); cout << fixed << setprecision(3); cout << "mog.get_means() = " << endl << mog.get_means() << endl; cout << "mog.get_diag_covs() = " << endl << mog.get_diag_covs() << endl; cout << "mog.get_weights() = " << endl << mog.get_weights() << endl; cout << endl; cout << "mog.avg_log_lhood(X) = " << mog.avg_log_lhood(X) << endl; // // EM ML based optimisation cout << endl << endl; cout << "running ML optimiser" << endl << endl; MOG_diag_ML(mog, X, 10, 0.0, 0.0, print_progress); cout << fixed << setprecision(3); cout << "mog.get_means() = " << endl << mog.get_means() << endl; cout << "mog.get_diag_covs() = " << endl << mog.get_diag_covs() << endl; cout << "mog.get_weights() = " << endl << mog.get_weights() << endl; cout << endl; cout << "mog.avg_log_lhood(X) = " << mog.avg_log_lhood(X) << endl; return 0; } itpp-4.3.1/doc/tutorial/src/pccc_bersim_awgn.cpp000066400000000000000000000122041216575753400217010ustar00rootroot00000000000000#include "itpp/itcomm.h" using namespace itpp; using std::cout; using std::endl; using std::string; int main(void) { //general parameters double threshold_value = 10; string map_metric="maxlogMAP"; ivec gen = "07 05";//octal form, feedback first int constraint_length = 3; int nb_errors_lim = 3000; int nb_bits_lim = int(1e6); int perm_len = (1<<14);//total number of bits in a block (with tail) int nb_iter = 10;//number of iterations in the turbo decoder vec EbN0_dB = "0:0.1:5"; double R = 1.0/3.0;//coding rate (non punctured PCCC) double Ec = 1.0;//coded bit energy //other parameters int nb_bits = perm_len-(constraint_length-1);//number of bits in a block (without tail) vec sigma2 = (0.5*Ec/R)*pow(inv_dB(EbN0_dB), -1.0);//N0/2 double Lc;//scaling factor int nb_blocks;//number of blocks int nb_errors; ivec perm(perm_len); ivec inv_perm(perm_len); bvec bits(nb_bits); int cod_bits_len = perm_len*gen.length(); bmat cod1_bits;//tail is added bvec tail; bvec cod2_input; bmat cod2_bits; int rec_len = int(1.0/R)*perm_len; bvec coded_bits(rec_len); vec rec(rec_len); vec dec1_intrinsic_coded(cod_bits_len); vec dec2_intrinsic_coded(cod_bits_len); vec apriori_data(perm_len);//a priori LLR for information bits vec extrinsic_coded(perm_len); vec extrinsic_data(perm_len); bvec rec_bits(perm_len); int snr_len = EbN0_dB.length(); mat ber(nb_iter,snr_len); ber.zeros(); register int en,n; //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code cc; cc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; //SISO modules SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //BER BERC berc; //Randomize generators RNG_randomize(); //main loop for (en=0;en using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Declarations of scalars and vectors: int i, Number_of_bits; double Ec, Eb; vec EbN0dB, EbN0, N0, noise_variance, bit_error_rate; //vec is a vector containing double bvec transmitted_bits, received_bits; //bvec is a vector containing bits cvec transmitted_symbols, received_symbols; //cvec is a vector containing double_complex //Declarations of classes: QPSK qpsk; //The QPSK modulator class AWGN_Channel awgn_channel; //The AWGN channel class it_file ff; //For saving the results to file BERC berc; //Used to count the bit errors Real_Timer tt; //The timer used to measure the execution time //Reset and start the timer: tt.tic(); //Init: Ec = 1.0; //The transmitted energy per QPSK symbol is 1. Eb = Ec / 2.0; //The transmitted energy per bit is 0.5. EbN0dB = linspace(0.0, 9.0, 10); //Simulate for 10 Eb/N0 values from 0 to 9 dB. EbN0 = inv_dB(EbN0dB); //Calculate Eb/N0 in a linear scale instead of dB. N0 = Eb * pow(EbN0, -1.0); //N0 is the variance of the (complex valued) noise. Number_of_bits = 100000; //One hundred thousand bits is transmitted for each Eb/N0 value //Allocate storage space for the result vector. //The "false" argument means "Do not copy the old content of the vector to the new storage area." bit_error_rate.set_size(EbN0dB.length(), false); //Randomize the random number generators in it++: RNG_randomize(); //Iterate over all EbN0dB values: for (i = 0; i < EbN0dB.length(); i++) { //Show how the simulation progresses: cout << "Now simulating Eb/N0 value number " << i + 1 << " of " << EbN0dB.length() << endl; //Generate a vector of random bits to transmit: transmitted_bits = randb(Number_of_bits); //Modulate the bits to QPSK symbols: transmitted_symbols = qpsk.modulate_bits(transmitted_bits); //Set the noise variance of the AWGN channel: awgn_channel.set_noise(N0(i)); //Run the transmited symbols through the channel using the () operator: received_symbols = awgn_channel(transmitted_symbols); //Demodulate the received QPSK symbols into received bits: received_bits = qpsk.demodulate_bits(received_symbols); //Calculate the bit error rate: berc.clear(); //Clear the bit error rate counter berc.count(transmitted_bits, received_bits); //Count the bit errors bit_error_rate(i) = berc.get_errorrate(); //Save the estimated BER in the result vector } tt.toc(); //Print the results: cout << endl; cout << "EbN0dB = " << EbN0dB << " [dB]" << endl; cout << "BER = " << bit_error_rate << endl; cout << "Saving results to ./qpsk_result_file.it" << endl; cout << endl; //Save the results to file: ff.open("qpsk_result_file.it"); ff << Name("EbN0dB") << EbN0dB; ff << Name("ber") << bit_error_rate; ff.close(); //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/qpsk_simulation.ref000066400000000000000000000011461216575753400216330ustar00rootroot00000000000000Now simulating Eb/N0 value number 1 of 10 Now simulating Eb/N0 value number 2 of 10 Now simulating Eb/N0 value number 3 of 10 Now simulating Eb/N0 value number 4 of 10 Now simulating Eb/N0 value number 5 of 10 Now simulating Eb/N0 value number 6 of 10 Now simulating Eb/N0 value number 7 of 10 Now simulating Eb/N0 value number 8 of 10 Now simulating Eb/N0 value number 9 of 10 Now simulating Eb/N0 value number 10 of 10 Elapsed time = 0.460899 seconds EbN0dB = [0 1 2 3 4 5 6 7 8 9] [dB] BER = [0.07968 0.0559 0.03729 0.02294 0.01243 0.0058 0.0025 0.00076 0.00013 6e-05] Saving results to ./qpsk_result_file.it itpp-4.3.1/doc/tutorial/src/rayleigh.cpp000066400000000000000000000013211216575753400202160ustar00rootroot00000000000000#include using namespace itpp; int main() { // Declare my_channel variable as an instance of the Rayleigh_Channel // class TDL_Channel my_channel; // The normalized Doppler frequency is set to 0.1 double norm_dopp = 0.1; my_channel.set_norm_doppler(norm_dopp); // Generate nrof_samples of the fading process and store them in ch_coeffs // matrix int nrof_samples = 10000; cmat ch_coeffs; my_channel.generate(nrof_samples, ch_coeffs); // Open an output file "rayleigh_test.it" it_file ff("rayleigh_test.it"); // Save channel coefficients to the output file ff << Name("ch_coeffs") << ch_coeffs; // Close the output file ff.close(); // Exit program return 0; } itpp-4.3.1/doc/tutorial/src/read_it_file.cpp000066400000000000000000000006021216575753400210210ustar00rootroot00000000000000#include using namespace itpp; int main() { // Declare the it_file class it_file ff; // Open the file "it_file_test.it" for reading ff.open("it_file_test.it"); // Read the variable a from the file. Put result in vector a. vec a; ff >> Name("a") >> a; // Print the result std::cout << "a = " << a << std::endl; // Exit the program return 0; } itpp-4.3.1/doc/tutorial/src/reedsolomon.cpp000066400000000000000000000030021216575753400207360ustar00rootroot00000000000000#include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Scalars and vectors: int m, t, n, k, q, NumBits, NumCodeWords; double p; bvec uncoded_bits, coded_bits, received_bits, decoded_bits; //Set parameters: NumCodeWords = 1000; //Number of Reed-Solomon code-words to simulate p = 0.01; //BSC Error probability m = 3; //Reed-Solomon parameter m t = 2; //Reed-Solomon parameter t cout << "Number of Reed-Solomon code-words to simulate: " << NumCodeWords << endl; cout << "BSC Error probability : " << p << endl; cout << "RS m: " << m << endl; cout << "RS t: " << t << endl; //Classes: Reed_Solomon reed_solomon(m, t); BSC bsc(p); BERC berc; RNG_randomize(); //Calculate parameters for the Reed-Solomon Code: n = round_i(pow(2.0, m) - 1); k = round_i(pow(2.0, m)) - 1 - 2 * t; q = round_i(pow(2.0, m)); cout << "Simulating an Reed-Solomon code with the following parameters:" << endl; cout << "n = " << n << endl; cout << "k = " << k << endl; cout << "q = " << q << endl; NumBits = m * k * NumCodeWords; uncoded_bits = randb(NumBits); coded_bits = reed_solomon.encode(uncoded_bits); received_bits = bsc(coded_bits); decoded_bits = reed_solomon.decode(received_bits); berc.count(uncoded_bits, decoded_bits); cout << "The bit error probability after decoding is " << berc.get_errorrate() << endl; //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/reedsolomon.ref000066400000000000000000000003521216575753400207350ustar00rootroot00000000000000Number of Reed-Solomon code-words to simulate: 1000 BSC Error probability : 0.01 RS m: 3 RS t: 2 Simulating an Reed-Solomon code with the following parameters: n = 7 k = 3 q = 8 The bit error probability after decoding is 0.000333333 itpp-4.3.1/doc/tutorial/src/sccc_bersim_awgn.cpp000066400000000000000000000110421216575753400217030ustar00rootroot00000000000000#include "itpp/itcomm.h" using namespace itpp; using std::cout; using std::endl; using std::string; int main(void) { //general parameters double threshold_value = 50; string map_metric = "maxlogMAP"; ivec gen = "07 05";//octal form int constraint_length = 3; int nb_errors_lim = 1500; int nb_bits_lim = int(1e6); int perm_len = pow2i(14);//permutation length int nb_iter = 10;//number of iterations in the turbo decoder vec EbN0_dB = "0:0.1:5"; double R = 1.0 / 4.0;//coding rate (non punctured SCCC) double Ec = 1.0;//coded bit energy //other parameters int nb_bits_tail = perm_len / gen.length(); int nb_bits = nb_bits_tail - (constraint_length - 1);//number of bits in a block (without tail) vec sigma2 = (0.5 * Ec / R) * pow(inv_dB(EbN0_dB), -1.0);//N0/2 double Lc;//scaling factor for intrinsic information int nb_blocks;//number of blocks int nb_errors; bvec bits(nb_bits);//data bits bvec nsc_coded_bits;//tail is added bmat rsc_parity_bits; ivec perm(perm_len); ivec inv_perm(perm_len); int rec_len = gen.length() * perm_len; bvec coded_bits(rec_len); vec rec(rec_len); //SISO RSC vec rsc_intrinsic_coded(rec_len); vec rsc_apriori_data(perm_len); vec rsc_extrinsic_coded; vec rsc_extrinsic_data; //SISO NSC vec nsc_intrinsic_coded(perm_len); vec nsc_apriori_data(nb_bits_tail); nsc_apriori_data.zeros();//always zero vec nsc_extrinsic_coded; vec nsc_extrinsic_data; //decision bvec rec_bits(nb_bits_tail); int snr_len = EbN0_dB.length(); mat ber(nb_iter, snr_len); ber.zeros(); register int en, n; //Non recursive non Systematic Convolutional Code Convolutional_Code nsc; nsc.set_generator_polynomials(gen, constraint_length); //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code rsc; rsc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; //SISO blocks SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //BER BERC berc; //Randomize generators RNG_randomize(); //main loop for (en = 0;en < snr_len;en++) { cout << "EbN0_dB = " << EbN0_dB(en) << endl; channel.set_noise(sigma2(en)); Lc = -2.0 / sigma2(en);//take into account the BPSK mapping nb_errors = 0; nb_blocks = 0; while ((nb_errors < nb_errors_lim) && (nb_blocks*nb_bits < nb_bits_lim))//if at the last iteration the nb. of errors is inferior to lim, then process another block { //permutation perm = sort_index(randu(perm_len)); //inverse permutation inv_perm = sort_index(perm); //bits generation bits = randb(nb_bits); //serial concatenated convolutional code nsc.encode_tail(bits, nsc_coded_bits);//tail is added here to information bits to close the trellis nsc_coded_bits = nsc_coded_bits(perm);//interleave rsc.encode(nsc_coded_bits, rsc_parity_bits);//no tail added for (n = 0;n < perm_len;n++) { coded_bits(2*n) = nsc_coded_bits(n);//systematic output coded_bits(2*n + 1) = rsc_parity_bits(n, 0);//parity output } //BPSK modulation (1->-1,0->+1) + channel rec = channel(bpsk.modulate_bits(coded_bits)); //turbo decoder rsc_intrinsic_coded = Lc * rec;//intrinsic information of coded bits rsc_apriori_data.zeros();//a priori LLR for information bits for (n = 0;n < nb_iter;n++) { //first decoder siso.rsc(rsc_extrinsic_coded, rsc_extrinsic_data, rsc_intrinsic_coded, rsc_apriori_data, false); //deinterleave+threshold nsc_intrinsic_coded = SISO::threshold(rsc_extrinsic_data(inv_perm), threshold_value); //second decoder siso.nsc(nsc_extrinsic_coded, nsc_extrinsic_data, nsc_intrinsic_coded, nsc_apriori_data, true); //decision rec_bits = bpsk.demodulate_bits(-nsc_extrinsic_data);//suppose that a priori info is zero //count errors berc.clear(); berc.count(bits, rec_bits.left(nb_bits)); ber(n, en) += berc.get_errorrate(); //interleave rsc_apriori_data = nsc_extrinsic_coded(perm); }//end iterations nb_errors += int(berc.get_errors());//get number of errors at the last iteration nb_blocks++; }//end blocks (while loop) //compute BER over all tx blocks ber.set_col(en, ber.get_col(en) / nb_blocks); } //save results to file it_file ff("sccc_bersim_awgn.it"); ff << Name("BER") << ber; ff << Name("EbN0_dB") << EbN0_dB; ff.close(); return 0; } itpp-4.3.1/doc/tutorial/src/spread.cpp000066400000000000000000000055561216575753400177060ustar00rootroot00000000000000#include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Scalars: int SF, Ncode, sc, i, j, NumOfBits, MaxIterations, MaxNrOfErrors, MinNrOfErrors; double Eb; //Vectors and matrixes: vec EbN0dB, EbN0, N0, ber; smat all_codes, spread_codesI, spread_codesQ; bvec transmited_bits, received_bits; cvec transmited_symbols, received_symbols, transmited_chips, received_chips; //Classes: Multicode_Spread_2d mc_spread; AWGN_Channel channel; QPSK qpsk; BERC berc; //Initialize the spreading: SF = 4; //The spreading factor is 4 Ncode = 4; //Use all four codes in the multi-code spreader all_codes = to_smat(hadamard(SF)); //Calculate the spreading codes //Set the spreading codes: spread_codesI.set_size(Ncode, SF, false); spread_codesQ.set_size(Ncode, SF, false); for (sc = 0; sc < Ncode; sc++) { spread_codesI.set_row(sc, all_codes.get_row(sc)); spread_codesQ.set_row(sc, all_codes.get_row(sc)); } mc_spread.set_codes(to_mat(spread_codesI), to_mat(spread_codesQ)); //Specify simulation specific variables: EbN0dB = linspace(-2, 14, 17); EbN0 = pow(10, EbN0dB / 10); Eb = 1.0; N0 = Eb * pow(EbN0, -1.0); NumOfBits = 50000; MaxIterations = 10; MaxNrOfErrors = 200; MinNrOfErrors = 5; ber.set_size(EbN0dB.size(), false); ber.clear(); //Randomize the random number generators: RNG_randomize(); for (i = 0; i < EbN0dB.length(); i++) { cout << endl << "Simulating point nr " << i + 1 << endl; berc.clear(); channel.set_noise(N0(i) / 2.0); for (j = 0; j < MaxIterations; j++) { transmited_bits = randb(NumOfBits); transmited_symbols = qpsk.modulate_bits(transmited_bits); //This is where we do the multi-code spreading: transmited_chips = mc_spread.spread(transmited_symbols); received_chips = channel(transmited_chips); //The multi-code despreading: //The second argument tells the despreader that the offset is zero chips. //This offset is usefull on channels with delay. received_symbols = mc_spread.despread(received_chips, 0); received_bits = qpsk.demodulate_bits(received_symbols); berc.count(transmited_bits, received_bits); ber(i) = berc.get_errorrate(); cout << " Itteration " << j + 1 << ": ber = " << berc.get_errorrate() << endl; if (berc.get_errors() > MaxNrOfErrors) { cout << "Breaking on point " << i + 1 << " with " << berc.get_errors() << " errors." << endl; break; } } if (berc.get_errors() < MinNrOfErrors) { cout << "Exiting Simulation on point " << i + 1 << endl; break; } } //Print results: cout << endl; cout << "EbN0dB = " << EbN0dB << endl; cout << "ber = " << ber << endl; //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/spread.ref000066400000000000000000000043721216575753400176730ustar00rootroot00000000000000 Simulating point nr 1 Itteration 1: ber = 0.13016 Breaking on point 1 with 6508 errors. Simulating point nr 2 Itteration 1: ber = 0.103 Breaking on point 2 with 5150 errors. Simulating point nr 3 Itteration 1: ber = 0.07886 Breaking on point 3 with 3943 errors. Simulating point nr 4 Itteration 1: ber = 0.05534 Breaking on point 4 with 2767 errors. Simulating point nr 5 Itteration 1: ber = 0.03822 Breaking on point 5 with 1911 errors. Simulating point nr 6 Itteration 1: ber = 0.02388 Breaking on point 6 with 1194 errors. Simulating point nr 7 Itteration 1: ber = 0.01316 Breaking on point 7 with 658 errors. Simulating point nr 8 Itteration 1: ber = 0.00586 Breaking on point 8 with 293 errors. Simulating point nr 9 Itteration 1: ber = 0.0027 Itteration 2: ber = 0.00247 Breaking on point 9 with 247 errors. Simulating point nr 10 Itteration 1: ber = 0.00094 Itteration 2: ber = 0.00086 Itteration 3: ber = 0.00076 Itteration 4: ber = 0.00077 Itteration 5: ber = 0.0008 Itteration 6: ber = 0.000796667 Breaking on point 10 with 239 errors. Simulating point nr 11 Itteration 1: ber = 0.00016 Itteration 2: ber = 0.00016 Itteration 3: ber = 0.000186667 Itteration 4: ber = 0.000175 Itteration 5: ber = 0.000172 Itteration 6: ber = 0.000173333 Itteration 7: ber = 0.000162857 Itteration 8: ber = 0.00017 Itteration 9: ber = 0.000166667 Itteration 10: ber = 0.000172 Simulating point nr 12 Itteration 1: ber = 4e-05 Itteration 2: ber = 2e-05 Itteration 3: ber = 2.66667e-05 Itteration 4: ber = 2.5e-05 Itteration 5: ber = 2e-05 Itteration 6: ber = 2e-05 Itteration 7: ber = 3.14286e-05 Itteration 8: ber = 2.75e-05 Itteration 9: ber = 2.44444e-05 Itteration 10: ber = 2.6e-05 Simulating point nr 13 Itteration 1: ber = 0 Itteration 2: ber = 0 Itteration 3: ber = 0 Itteration 4: ber = 0 Itteration 5: ber = 0 Itteration 6: ber = 0 Itteration 7: ber = 0 Itteration 8: ber = 2.5e-06 Itteration 9: ber = 2.22222e-06 Itteration 10: ber = 2e-06 Exiting Simulation on point 13 EbN0dB = [-2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] ber = [0.13016 0.103 0.07886 0.05534 0.03822 0.02388 0.01316 0.00586 0.00247 0.000796667 0.000172 2.6e-05 2e-06 0 0 0 0] itpp-4.3.1/doc/tutorial/src/stbicm.cpp000066400000000000000000000277071216575753400177130ustar00rootroot00000000000000/** \file * * \brief Space Time Bit Interleaved Coded Modulation (ST BICM) * * Implements ST BICM using a turbo receiver with a SISO demapper module and a SISO NSC module. * */ #include "itpp/itcomm.h" using namespace itpp; using std::cout; using std::endl; using std::string; void print_help(char *prog_name) { cout << "Usage: " << prog_name << " [options]\n" << "Available options:\n" << "-d demapper_method: sets the demapper method. Available demapper " "methods: Hassibi_maxlogMAP, GA, sGA, mmsePIC, zfPIC and Alamouti_maxlogMAP.\n" << "-s code_name: sets the ST code name. Available code names: Golden_2x2, " "V-BLAST_MxN, Damen_2x2, Alamouti_2xN.\n" << "-c const_size: sets the constellation size\n" << "-e nb_errors_lim: sets the limit for the number of bit errors\n" << "-b nb_bits_lim: sets the limit for the number of bits to send\n" << "-p perm_len: sets the length of the permutation\n" << "-i nb_iter: sets the number of iterations\n" << "-t em_antennas: sets the number of emission antenna\n" << "-r rec_antennas: sets the number of reception antenna\n" << "-u channel_uses: sets the number of channel uses\n" << "-g: enables the ideal Gaussian MIMO channel (no MAI). Available only " "if em_antennas == rec_antennas.\n" << "-n EbN0_dB_min: sets the lower limit for the SNR [dB]\n" << "-m EbN0_dB_max: sets the upper limit for the SNR [dB]\n" << "-l EbN0_dB_step: step for the SNR vector [dB]\n" << "-h: displays this help message" << endl; } int get_opts(int argc, char *argv[], std::string &demapper_method, int &const_size, int &nb_errors_lim, int &nb_bits_lim, int &perm_len, int &nb_iter, int &rec_antennas, int &em_antennas, int &channel_uses, std::string &code_name, bool &ideal_channel, bool &to_file, vec &EbN0_dB) { int opt; double EbN0_dB_min = EbN0_dB[0]; double EbN0_dB_max = EbN0_dB[length(EbN0_dB)-1]; double EbN0_dB_step = 1.0; while (-1 != (opt = getopt(argc, argv, "hgfd:c:e:b:p:i:r:t:u:s:n:m:l:"))) { switch (opt) { case 'h': return EXIT_FAILURE;//print help and exit case 'd': demapper_method = optarg; break; case 'c': const_size = atoi(optarg); break; case 'e': nb_errors_lim = atoi(optarg); break; case 'b': nb_bits_lim = atoi(optarg); break; case 'p': perm_len = atoi(optarg); break; case 'i': nb_iter = atoi(optarg); break; case 'r': rec_antennas = atoi(optarg); break; case 't': em_antennas = atoi(optarg); break; case 'u': channel_uses = atoi(optarg); break; case 's': code_name = optarg; break; case 'g': ideal_channel = true; break; case 'f': to_file = true; break; case 'n': EbN0_dB_min = atof(optarg); break; case 'm': EbN0_dB_max = atof(optarg); break; case 'l': EbN0_dB_step = atof(optarg); break; default: return EXIT_FAILURE; } } /* update SNR if needed */ if ((EbN0_dB_min <= EbN0_dB_max) && (0 < EbN0_dB_step) && ((EbN0_dB[0] != EbN0_dB_min) || (EbN0_dB[length(EbN0_dB)-1] != EbN0_dB_max))) { int size = int((EbN0_dB_max-EbN0_dB_min)/EbN0_dB_step)+1; EbN0_dB.set_size(size); EbN0_dB[0] = EbN0_dB_min; for (int n = 1; n < size; ++n) { EbN0_dB[n] = EbN0_dB[n-1]+EbN0_dB_step; } } return EXIT_SUCCESS; } int main(int argc, char *argv[]) { //receiver parameters ivec gen = "0133 0171"; int constraint_length = 7; int const_size = 16;//constellation size int coherence_time = 512;//expressed in symbol durations, multiple of T, T<=coherence_time<=tx_duration, T is the ST code duration double threshold_value = 50; string map_metric="maxlogMAP"; string demapper_method = "mmsePIC";//Hassibi_maxlogMAP or GA or sGA or mmsePIC or zfPIC or Alamouti_maxlogMAP int nb_errors_lim = 1500; int nb_bits_lim = int(1e6); int perm_len = pow2i(14);//permutation length int nb_iter = 5;//number of iterations in the turbo decoder int rec_antennas = 2;//number of reception antennas vec EbN0_dB = "0:20"; double Es = 1.0;//mean symbol energy int em_antennas = 2;//number of emission antennas int channel_uses = 1;//ST code duration string code_name = "V-BLAST_MxN";//V-BLAST_MxN, Golden_2x2, Damen_2x2, Alamouti_2xN bool ideal_channel = false; bool to_file = false; //get parameters if any if (EXIT_FAILURE == get_opts(argc, argv, demapper_method, const_size, nb_errors_lim, nb_bits_lim, perm_len, nb_iter, rec_antennas, em_antennas, channel_uses, code_name, ideal_channel, to_file, EbN0_dB)) { print_help(argv[0]); return EXIT_FAILURE; } //convolutional code generator polynomials Convolutional_Code nsc; nsc.set_generator_polynomials(gen, constraint_length); double coding_rate = 1.0/2.0; //QAM modulator class QAM mod(const_size); //Space-Time code parameters STC st_block_code(code_name, const_size, em_antennas, channel_uses);//generate matrices for LD code (following Hassibi's approach) int symb_block = st_block_code.get_nb_symbols_per_block(); em_antennas = st_block_code.get_nb_emission_antenna();//these parameters could by changed depending on the selected code channel_uses = st_block_code.get_channel_uses(); //recompute interleaver length int G = coherence_time*mod.bits_per_symbol()*symb_block; perm_len = G*(perm_len/G);//recompute interleaver length int block_len = int(coding_rate*perm_len);//informational block length int nb_symb = perm_len/mod.bits_per_symbol();//number of symbols at the modulator output int nb_subblocks = nb_symb/symb_block;//number of blocks of ST code emitted in an interleaver period int tx_duration = channel_uses*nb_subblocks;//transmission duration expressed in number of symbol periods //show configuration parameters std::cout << "const_size = " << const_size << "\ndemapper_method = " << demapper_method << "\nnb_errors_lim = " << nb_errors_lim << "\nnb_bits_lim = " << nb_bits_lim << "\nperm_len = " << perm_len << "\ncode_name = " << code_name << "\nem_antennas = " << em_antennas << "\nchannel_uses = " << channel_uses << "\nnb_iter = " << nb_iter << "\nrec_antennas = " << rec_antennas << "\nEbN0_dB = " << EbN0_dB << std::endl; if (true == ideal_channel) { if (em_antennas == rec_antennas) { std::cout << "Using ideal AWGN MIMO channel (no MAI)" << std::endl; } else { std::cout << "Warning: cannot use ideal AWGN MIMO channel" << std::endl; ideal_channel = false; } } else { std::cout << "Using random MIMO channel (with MAI)" << std::endl; } //fading channel parameters if (coherence_time%channel_uses)//check if the coherence time is a multiple of channel_uses { coherence_time = channel_uses*(coherence_time/channel_uses); std::cout << "Warning! The coherence time must be a multiple of T. Choosing coherence_time=channel_uses*floor(coherence_time/channel_uses) = "\ << coherence_time << std::endl; } if (coherence_time>tx_duration) { coherence_time = channel_uses*(tx_duration/channel_uses); std::cout << "Warning! The coherence time must be <= tx_duration. Choosing coherence_time = channel_uses*floor(tx_duration/channel_uses) = "\ << coherence_time << std::endl; } cmat fading_pattern = ones_c(1, coherence_time/channel_uses); //other parameters string filename = "STBICM_"+map_metric+"_"+demapper_method+".it"; if (true == to_file) { std::cout << "Saving results to " << filename << std::endl; } double R = coding_rate*double(mod.bits_per_symbol()*symb_block)/double(channel_uses);//ST code rate in (info.) bits/channel use vec sigma2 = (0.5*Es/(R*double(mod.bits_per_symbol())))*pow(inv_dB(EbN0_dB), -1.0);//N0/2 int nb_blocks;//number of blocks int nb_errors; bvec bits(block_len);//data bits bvec coded_bits(perm_len);//no tail cvec em(nb_symb); ivec perm(perm_len); ivec inv_perm(perm_len); //SISO demapper vec demapper_apriori_data(perm_len); vec demapper_extrinsic_data(perm_len); //SISO NSC vec nsc_intrinsic_coded(perm_len); vec nsc_apriori_data(block_len); nsc_apriori_data.zeros();//always zero vec nsc_extrinsic_coded(perm_len); vec nsc_extrinsic_data(block_len); //decision bvec rec_bits(block_len); int snr_len = EbN0_dB.length(); mat ber(nb_iter,snr_len); ber.zeros(); register int en,n,ns; cmat S(tx_duration, em_antennas); cmat rec(tx_duration,rec_antennas); //Rayleigh fading cmat ch_attenuations(em_antennas*rec_antennas,tx_duration/channel_uses); //SISO blocks SISO siso; siso.set_map_metric(map_metric); siso.set_generators(gen, constraint_length); siso.set_demapper_method(demapper_method); siso.set_constellation(mod.bits_per_symbol(), mod.get_symbols()/sqrt(em_antennas), mod.get_bits2symbols()); siso.set_st_block_code(st_block_code.get_nb_symbols_per_block(), st_block_code.get_1st_gen_matrix(), st_block_code.get_2nd_gen_matrix(), rec_antennas); //decision BPSK bpsk; //BER BERC berc; //Randomize generators RNG_randomize(); //main loop std::cout << std::endl; for (en=0;en multipath_channel; //SISO blocks SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); #ifdef USE_PRECODER siso.set_precoder_generator(prec_gen(0), prec_gen_length); #endif //BER BERC berc; //Randomize generators RNG_randomize(); //main loop for (en = 0;en < snr_len;en++) { cout << "EbN0_dB = " << EbN0_dB(en) << endl; awgn.set_noise(sigma2(en)); siso.set_noise(sigma2(en)); nb_errors = 0; nb_blocks = 0; while ((nb_errors < nb_errors_lim) && (nb_blocks*nb_bits < nb_bits_lim))//if at the last iteration the nb. of errors is inferior to lim, then process another block { //permutation perm = sort_index(randu(perm_len)); //inverse permutation inv_perm = sort_index(perm); //bits generation bits = randb(nb_bits); //convolutional code nsc.encode_tail(bits, nsc_coded_bits);//tail is added here to information bits to close the trellis //permutation em_bits = nsc_coded_bits(perm); #ifdef USE_PRECODER //precoder prec.encode(em_bits, parity_bits); em_bits = parity_bits.get_col(0); #endif //BPSK modulation (1->-1,0->+1) + multipath channel ch_imp_response = randray(ch_nb_taps); ch_imp_response /= sqrt(sum_sqr(ch_imp_response));//normalized power profile multipath_channel.set_coeffs(ch_imp_response); multipath_channel.set_state(ini_state);//inital state is zero rec = awgn(multipath_channel(bpsk.modulate_bits(em_bits))); //turbo equalizer eq_apriori_data.zeros();//a priori information of emitted symbols siso.set_impulse_response(ch_imp_response); for (n = 0;n < nb_iter;n++) { //first decoder siso.equalizer(eq_extrinsic_data, rec, eq_apriori_data, false);//no tail //deinterleave+threshold nsc_intrinsic_coded = SISO::threshold(eq_extrinsic_data(inv_perm), threshold_value); //second decoder siso.nsc(nsc_extrinsic_coded, nsc_extrinsic_data, nsc_intrinsic_coded, nsc_apriori_data, true);//tail //decision rec_bits = bpsk.demodulate_bits(-nsc_extrinsic_data);//assume that a priori info is zero //count errors berc.clear(); berc.count(bits, rec_bits.left(nb_bits)); ber(n, en) += berc.get_errorrate(); //interleave eq_apriori_data = nsc_extrinsic_coded(perm); }//end iterations nb_errors += int(berc.get_errors());//get number of errors at the last iteration nb_blocks++; }//end blocks (while loop) //compute BER over all tx blocks ber.set_col(en, ber.get_col(en) / nb_blocks); } //save results to file it_file ff("turbo_equalizer_bersim_multipath.it"); ff << Name("BER") << ber; ff << Name("EbN0_dB") << EbN0_dB; ff.close(); return 0; } itpp-4.3.1/doc/tutorial/src/vector_and_matrix.cpp000066400000000000000000000014001216575753400221200ustar00rootroot00000000000000#include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { //Declare vectors and matricies: vec a, b, c; mat A, B; //Use the function linspace to define a vector: a = linspace(1.0, 2.0, 10); //Use a string of values to define a vector: b = "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0"; //Add two vectors: c = a + b; //Print results: cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "c = " << c << endl; //Use a string to define a matrix: A = "1.0 2.0;3.0 4.0"; //Calculate the inverse of matrix A: B = inv(A); //Print results: cout << "A = " << A << endl; cout << "B = " << B << endl; //Exit program: return 0; } itpp-4.3.1/doc/tutorial/src/vector_and_matrix.ref000066400000000000000000000003561216575753400221230ustar00rootroot00000000000000a = [1 1.11111 1.22222 1.33333 1.44444 1.55556 1.66667 1.77778 1.88889 2] b = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1] c = [1.1 1.31111 1.52222 1.73333 1.94444 2.15556 2.36667 2.57778 2.78889 3] A = [[1 2] [3 4]] B = [[-2 1] [1.5 -0.5]] itpp-4.3.1/doc/tutorial/src/write_it_file.cpp000066400000000000000000000013151216575753400212420ustar00rootroot00000000000000#include using namespace itpp; int main() { // Declare the it_file class it_file ff; // Open a file with the name "it_file_test.it" ff.open("it_file_test.it"); // Create some data to put into the file vec a = linspace(1, 20, 20); // Put the variable a into the file. The Name("a") tells the file class // that the next variable shall be named "a". ff << Name("a") << a; // Force the file to be written to disc. This is useful when performing // iterations and ensures that the information is not stored in any cache // memory. In this simple example it is not necessary to flush the file. ff.flush(); // Close the file ff.close(); // Exit program return 0; } itpp-4.3.1/doc/tutorial/timer.doc000066400000000000000000000005071216575753400167330ustar00rootroot00000000000000/*! \page timer Using timers to measure execution time In this example we are using the Real_Timer class to measure the execution time of a simple program. The Real_Timer class is included in the itmisc library. \include timer.cpp When you run this program, the output will look something like this: \include timer.ref */ itpp-4.3.1/doc/tutorial/turbo_equalizer_bersim_multipath.doc000066400000000000000000000015311216575753400244550ustar00rootroot00000000000000/*! \page turbo_equalizer_bersim_multipath Simulation of turbo equalizer in multipath channels The turbo equalizer uses a SISO NSC module and a SISO equalizer module. Optionally a precoder can be used at the channel input (by default the precoder is enabled). Reference: R. Koetter, A. C. Singer, and M. Tuchler, ''Turbo equalization: an iterative equalization and decoding technique for coded data transmision,`` IEEE Signal Processing Magazine, pp. 67-80, Jan. 2004 \include turbo_equalizer_bersim_multipath.cpp When you run this program, the results (BER and EbN0_dB) are saved into turbo_equalizer_bersim_multipath.it file. Using the following MATLAB script \code clear all itload('turbo_equalizer_bersim_multipath.it'); figure semilogy(EbN0_dB, BER, 'o-') grid on xlabel('E_b/N_0 [dB]') ylabel('BER') \endcode the results can be displayed. */ itpp-4.3.1/doc/tutorial/tutorial.doc000066400000000000000000000014321216575753400174540ustar00rootroot00000000000000/*! \page tutorial Tutorials \addindex Tutorial This page contains some tutorial examples that will help you getting started using IT++. Most examples show how to construct some simple communication system simulations. The source codes for these examples can be found in \c {ITPP_HOME}/doc/tutorial/src. Examples of basic functionality: - \ref vector_and_matrix - \ref itfile - \ref timer Examples of communications related functions: - \ref bpsk - \ref interleaver - \ref qpsk_simulation - \ref reedsolomon - \ref convcode - \ref spread - \ref rayleigh More specialized examples: - \ref mimoconv - \ref ldpc_gen_codes - \ref ldpc_bersim_awgn - \ref pccc_bersim_awgn - \ref exit_pccc - \ref sccc_bersim_awgn - \ref turbo_equalizer_bersim_multipath - \ref mog Other: - \ref matlab_itpp */ itpp-4.3.1/doc/tutorial/vector_and_matrix.doc000066400000000000000000000006051216575753400213220ustar00rootroot00000000000000/*! \page vector_and_matrix A very simple tutorial about vectors and matrices Let's start with a really simple example. Try to complile the following program: \include vector_and_matrix.cpp When you run this program, the output shall look like this \include vector_and_matrix.ref If this is what you see, then congratulations! You have managed to compile your first it++ program! */ itpp-4.3.1/extras/000077500000000000000000000000001216575753400140205ustar00rootroot00000000000000itpp-4.3.1/extras/Makefile.am000066400000000000000000000001701216575753400160520ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common dist_pkgdata_DATA = itload.m itsave.m pyitpp.py EXTRA_DIST = gdb_macros_for_itpp itpp-4.3.1/extras/Makefile.in000066400000000000000000000321501216575753400160660ustar00rootroot00000000000000# Makefile.in generated by automake 1.12.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/Makefile.common subdir = extras ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgdatadir)" DATA = $(dist_pkgdata_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) dist_pkgdata_DATA = itload.m itsave.m pyitpp.py EXTRA_DIST = gdb_macros_for_itpp all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu extras/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu extras/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.common: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-dist_pkgdataDATA: $(dist_pkgdata_DATA) @$(NORMAL_INSTALL) @list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ done uninstall-dist_pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_pkgdataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_pkgdataDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dist_pkgdataDATA \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am uninstall uninstall-am uninstall-dist_pkgdataDATA @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/extras/acml_tests_vcproj.template000066400000000000000000000040021216575753400212720ustar00rootroot00000000000000 itpp-4.3.1/extras/astylerc000066400000000000000000000023061216575753400155720ustar00rootroot00000000000000# ---------------------------------------------------------------------- # This is an astyle configuration file, which can be used for indenting, # formatting and beautifying IT++ header and source files. The Artistic # Style (astyle) program can be downloaded from the following site: # http://astyle.sourceforge.net/ # To filter a source or header file using this option please use the # following command: # $ astyle --options=/extras/astylerc file.cpp # # Similar indentation style can be obtained in GNU emacs editor by # adding these settings to the default .emacs configuration file: # # (defun it++-mode () # "C++ mode with adjusted defaults for use with the IT++ project." # (interactive) # (c++-mode) # (c-set-style "gnu") # (c-set-offset 'innamespace 0) # (setq c-basic-offset 2) # (setq indent-tabs-mode nil) # (setq c-block-comment-prefix "* ")) # # (setq auto-mode-alist (cons '("itpp.*/.*\\.\\(h\\|cpp\\)$" . it++-mode) # auto-mode-alist)) # ---------------------------------------------------------------------- indent=spaces=2 brackets=linux break-closing-brackets indent-labels pad-oper unpad-paren keep-one-line-blocks convert-tabs itpp-4.3.1/extras/astylerc_old000066400000000000000000000024651216575753400164360ustar00rootroot00000000000000# ---------------------------------------------------------------------- # This is an astyle configuration file, which can be used for indenting, # formatting and beautifying IT++ header and source files. The Artistic # Style (astyle) program can be downloaded from the following site: # http://astyle.sourceforge.net/ # # Please note that this file is compatible with older version of astyle, # i.e. 1.x series (e.g. 1.24) # # To filter a source or header file using this option please use the # following command: # $ astyle --options=/extras/astylerc_old file.cpp # # Similar indentation style can be obtained in GNU emacs editor by # adding these settings to the default .emacs configuration file: # # (defun it++-mode () # "C++ mode with adjusted defaults for use with the IT++ project." # (interactive) # (c++-mode) # (c-set-style "gnu") # (c-set-offset 'innamespace 0) # (setq c-basic-offset 2) # (setq indent-tabs-mode nil) # (setq c-block-comment-prefix "* ")) # # (setq auto-mode-alist (cons '("itpp.*/.*\\.\\(h\\|cpp\\)$" . it++-mode) # auto-mode-alist)) # ---------------------------------------------------------------------- indent=spaces=2 brackets=linux brackets=break-closing indent-labels pad=oper unpad=paren one-line=keep-blocks convert-tabs itpp-4.3.1/extras/check_tests.py000077500000000000000000000070531216575753400167010ustar00rootroot00000000000000#!/usr/bin/env python # File: check_tests.py # Brief: Run each test and compare its output with the reference output. # Author: Bogdan Cristea # # Usage: ./check_tests.py -r path_to_ref_files -w path_to_test_binaries # # This script runs all test binaries found in path_to_test_binaries and # compares their output with the corresponding reference output found in # path_to_ref_files. # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- import os import sys from subprocess import call from optparse import OptionParser import platform parser = OptionParser() parser.add_option("-r", "--ref-path", dest="ref_path", help="path where reference files (*.ref) are stored") parser.add_option("-w", "--work-path", dest="path", help="path where test binaries are stored") (options, args) = parser.parse_args() if (1 == len(sys.argv)): parser.print_help() sys.exit(1) ref_path = options.ref_path path = options.path def compare_files(file_name_ref, file_name): fd_ref = open(file_name_ref) fd = open(file_name) identical = 0 for line_ref in fd_ref: line = fd.readline() if (line_ref != line): identical = 1 break #check if the second file is bigger than the first one if 0 == identical: for line in fd: line_ref = fd_ref.readline() if (line != line_ref): identical = 1 break fd_ref.close() fd.close() return identical dirList=os.listdir(path) i = 0 passed_tests = 0 failed_tests = 0 failed_test_name = [] fd_null = open(os.devnull, "w") for fname in dirList: full_name = path+"/"+fname if os.access(full_name, os.X_OK) and (not os.path.isdir(full_name)): name_ext = os.path.splitext(fname) if (1 < len(name_ext)) and ("Windows" == platform.system()) and not(".exe" == name_ext[-1]): continue #skip non exe (Windows only) sys.stdout.write("# " + str(i) + " Running " + fname) sys.stdout.flush() i = i+1 fd = open(full_name+".tmp", "w") call(full_name, stdout=fd, stderr=fd_null) fd.close() # out = call(["diff", full_name+".tmp", ref_path+"/"+fname+".ref"], stdout=fd_null) out = compare_files(full_name+".tmp", ref_path+"/"+name_ext[0]+".ref") if 0 == out: print(" PASS") passed_tests = passed_tests+1 else: print(" FAILED") failed_tests = failed_tests+1 failed_test_name.append(name_ext[0]) fd_null.close() print("*"*60) print("From " + str(i) + " tests " + str(passed_tests) + " have passed and " + str(failed_tests) + " have failed") if 0 != failed_tests: print("Failed tests:") for i in range(0, len(failed_test_name)): print(" "+failed_test_name[i]) print("*"*60) itpp-4.3.1/extras/gdb_macros_for_itpp000066400000000000000000000111051216575753400177430ustar00rootroot00000000000000# File: gdb_macros_for_itpp # Brief: This file defines some gdb macros for printing out it++ types # Author: Vasek (files contributed in feature request 1913404) and Erik G. Larsson # # To use it, add this line to ~/.gdbinit: # source gdb_macros_for_itpp # # gdb macros defined in this file: # # dv: display vec # dm: display mat # div: display integer (ivec or svec) vector # dim: display integer (ivec or svec) matrix # dcv: display cvec # dcm: display cmat # dbv: display bvec # dbm: display bmat # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- define div printf "Vector of length %i:\n", $arg0.datasize output $arg0.data[0]@($arg0.datasize) printf "\n" end document div Display it++ integer (ivec or svec) vector end define dim set $i=0 set $M = $arg0 set $rs = $M.no_rows set $col = $M.no_cols printf "Matrix of dimension %ix%i:\n", $rs, $col while $i < $rs set $j=0 printf "[" while $j< $col output $M.data[$j*$rs+$i] printf " " set $j++ end printf "]" printf "\n" set $i++ end end document dim Display it++ integer (ivec or svec) matrix end define dv set $i=0 set $M = $arg0 set $rs = $M.datasize printf "Vector of length %i:\n", $rs printf "[" while $i < $rs printf "%g ", *(double*)(((void*)($M.data))+($i)*sizeof(double)) set $i++ end printf "]\n" end document dv Display it++ vec end define dcv set $i=0 set $M = $arg0 set $rs = $M.datasize printf "Vector of length %i:\n", $rs printf "[ " while $i < $rs printf "%g", *(double*)(((void*)($M.data))+($i)*sizeof(double)*2) printf "+" printf "%-g", *(double*)(((void*)($M.data))+($i)*sizeof(double)*2+sizeof(double)) printf "i, " set $i++ end printf "]\n" end document dcv Display it++ cvec end define dm set $i=0 set $M = $arg0 set $rs = $M.no_rows set $col = $M.no_cols printf "Matrix of dimension %ix%i:\n", $rs, $col while $i < $rs set $j=0 printf "[" while $j< $col printf "%6g", $M.data[$j*$rs+$i] # output $M.data[$j*$rs+$i] printf " " set $j++ end printf "]\n" set $i++ end end document dm Display it++ mat end define dcm set $i=0 set $M = $arg0 set $rs = $M.no_rows set $col = $M.no_cols printf "Matrix of dimension %ix%i:\n", $rs, $col while $i < $rs set $j=0 printf "[" while $j< $col # printf "%8.3f+%8.3fi ", *(double*)(((void*)($M.data))+($j*$rs+$i)*sizeof(double)*2), *(double*)(((void*)($M.data))+($j*$rs+$i)*sizeof(double)*2+sizeof(double)) printf "%5g", *(double*)(((void*)($M.data))+($j*$rs+$i)*sizeof(double)*2) printf "+" printf "%-5g", *(double*)(((void*)($M.data))+($j*$rs+$i)*sizeof(double)*2+sizeof(double)) printf "i, " set $j++ end printf "]\n" set $i++ end end document dcm Display it++ cmat end define dbv set $i=0 set $M = $arg0 set $rs = $M.datasize printf "Vector of length %i:\n", $rs printf "[" while $i < $rs printf "%c ", (*(char*)(((void*)($M.data))+($i)*sizeof(char)))+48 set $i++ end printf "]\n" end document dbv Display it++ bvec end define dbm set $i=0 set $M = $arg0 set $rs = $M.no_rows set $col = $M.no_cols printf "Matrix of dimension %ix%i:\n", $rs, $col while $i < $rs set $j=0 printf "[" while $j< $col printf "%c ", *(char*)(((void*)($M.data))+($j*$rs+$i)*sizeof(char))+48 set $j++ end printf "]\n" set $i++ end end document dbm Display it++ bmat end define _test_dvm_macros_ dv a dcv b div c div cs dm A dcm B dim C dim Cs dbv p dbm P end itpp-4.3.1/extras/gen_test_itload.cpp000066400000000000000000000125621216575753400176760ustar00rootroot00000000000000/*! * \file * \brief Generates test_pyitpp.it itfile used for unit tests by test_pyitpp.py script. * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { it_file ff("test_pyitpp.it"); //generate scalars { bin a = 1; ff << Name("a") << a; } { char b = '2'; ff << Name("b") << b; } { short c = -3; ff << Name("c") << c; } { int d = -4; ff << Name("d") << d; } { float e = 5.67; ff << Name("e") << e; } { double f = 8.91234567; ff << Name("f") << f; } { complex g(-1.234, 4.321); ff << Name("g") << g; } { complex h(-1.234567, 4.321654); ff << Name("h") << h; } //generate vectors { bvec i = "0 1 1 0 0 1"; ff << Name("i") << i; } { string j = "abc"; ff << Name("j") << j; } { svec k = "10:19"; ff << Name("k") << k; } { ivec l = "20:29"; ff << Name("l") << l; } //vec of floats not supported { vec m = "30:1:39"; ff << Name("m") << m; } //cvec of floats not supported { cvec n(10); complex step(0.5, -0.5); n[0] = complex(0.0, 0.0); for(unsigned int i = 1; i < 10; ++i) { n[i] = n[i-1] + step; } ff << Name("n") << n; } //generate matrices { bmat o = "0 1 1; 0 0 1"; ff << Name("o") << o; } //no string { smat p = "1 2 3; 4 5 6"; ff << Name("p") << p; } { imat q = "11 12 13; 14 15 16"; ff << Name("q") << q; } //mat of floats not supported { mat r = "1.5 1.6 1.7; 2.3 2.4 2.5"; ff << Name("r") << r; } //cmat of floats not supported { cmat s(3, 2); complex step(0.5, -0.5); s(0) = complex(0.0, 0.0); for(unsigned int i = 1; i < 6; ++i) { s(i) = s(i - 1) + step; } ff << Name("s") << s; } //simple arrays { Array t("{0 1 0 1 1 0 0 0 1}"); ff << Name("t") << t; } { Array u("{0 1 2 3 4 5 6 7 8}"); ff << Name("u") << u; } { Array v("{10 11 12 13 14 15 16 17 18}"); ff << Name("v") << v; } { Array w("{1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8}"); ff << Name("w") << w; } { Array x("{1.2222 2.3333 3.44444 4.55555}"); ff << Name("x") << x; } { Array > y(10); complex step(0.5, -0.5); y(0) = complex(0, 0); for(int i = 1; i < 10; ++i) { y(i) = y(i - 1) + step; } ff << Name("y") << y; } { Array > z(10); complex step(-0.5, 0.5); z(0) = complex(0, 0); for(int i = 1; i < 10; ++i) { z(i) = z(i - 1) + step; } ff << Name("z") << z; } //arrays of vectors { Array aa("{[1 1 1 0 0 0 1], [0 0 1 1], [1 0 1]}"); ff << Name("aa") << aa; } { Array bb("{[1 1 1 2 3 0 1], [0 6 1 1], [1 7 1]}"); ff << Name("bb") << bb; } { Array cc("{[10 10 10 20 30 0 10], [0 60 10 10], [10 70 10]}"); ff << Name("cc") << cc; } { Array dd("{[0.1 0.1 0.1 0.2 0.3 0.0 0.1], [0.0 0.6 0.1 0.1], [0.1 0.7 0.1]}"); ff << Name("dd") << dd; } { Array ee(3); cvec tmp(5); tmp(0) = complex(0.0, 0.0); complex step(0.5, -0.5); for(int i = 1; i < 5; ++i) { tmp(i) = tmp(i - 1) + step; } ee(0) = tmp; ee(1) = tmp.get(0, 2); ee(2) = tmp.get(1, 4); ff << Name("ee") << ee; } { Array gg(3); gg(0) = "abcd"; gg(1) = "abc"; gg(2) = "defghijk"; ff << Name("gg") << gg; } //arrays of matrices { Array hh("{[1 1; 1 0; 0 1], [0 0 1; 1 0 1], [1; 0; 1]}"); ff << Name("hh") << hh; } { Array ii("{[1 2; 1 3; 4 7], [4 7 1; 8 6 1], [3; 8; 5]}"); ff << Name("ii") << ii; } { Array jj("{[11 21; 11 31; 41 71], [41 71 11; 81 61 11], [31; 81; 51]}"); ff << Name("jj") << jj; } { Array kk("{[1.1 2.1; 1.1 3.1; 4.1 7.1], [4.1 7.1 1.1; 8.1 6.1 1.1], [3.1; 8.1; 5.1]}"); ff << Name("kk") << kk; } { Array ll(3); cmat s(3, 2); complex step(0.5, -0.5); s(0) = complex(0.0, 0.0); for(unsigned int i = 1; i < 6; ++i) { s(i) = s(i - 1) + step; } ll(0) = s; ll(1) = s(0, 1, 0, 1); ll(2) = s(0, 0, 0, 1); ff << Name("ll") << ll; } ff.close(); cout << "done" << endl; } itpp-4.3.1/extras/gen_vcproj_tests.sh000077500000000000000000000006401216575753400177350ustar00rootroot00000000000000#!/bin/sh TESTS_DIR="../tests" MKL_VCPROJ_DIR="../win32/itpp_mkl_tests" ACML_VCPROJ_DIR="../win32/itpp_acml_tests" for i in "${TESTS_DIR}"/*.cpp; do TEST_FILE=`basename "${i}" .cpp` sed -e "s/TEST_BASENAME/${TEST_FILE}/g" acml_tests_vcproj.template > \ "${ACML_VCPROJ_DIR}/${TEST_FILE}.vcproj" sed -e "s/TEST_BASENAME/${TEST_FILE}/g" mkl_tests_vcproj.template > \ "${MKL_VCPROJ_DIR}/${TEST_FILE}.vcproj" done itpp-4.3.1/extras/html2text.sh000077500000000000000000000002541216575753400163130ustar00rootroot00000000000000#!/bin/sh w3m -dump -cols 78 $1 \ | sed '1,/IT++ Compilation and Installation using Microsoft Visual/d' \ | sed '/How To Set Up a Local/,$d' \ | recode -f utf8..ascii itpp-4.3.1/extras/itload.m000066400000000000000000000250241216575753400154550ustar00rootroot00000000000000% File: itload.m % Brief: Load an IT++ itfile content to Matlab/Octave workspace % Author: Tony Ottosson and Adam Piatyszek % % Usage: itload("fname.it") % % This functions loads all variables from an IT++ file format to the % Matlab/Octave workspace. % % ------------------------------------------------------------------------- % % Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) % % This file is part of IT++ - a C++ library of mathematical, signal % processing, speech processing, and communications classes and functions. % % IT++ is free software: you can redistribute it and/or modify it under the % terms of the GNU General Public License as published by the Free Software % Foundation, either version 3 of the License, or (at your option) any % later version. % % IT++ 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 General Public License for more % details. % % You should have received a copy of the GNU General Public License along % with IT++. If not, see . % % ------------------------------------------------------------------------- function itload(fname) [fid, err_msg] = fopen(fname, 'rb', 'ieee-le'); if (fid == -1) fname = [fname '.it']; [fid, err_msg2] = fopen(fname, 'rb', 'ieee-le'); if (fid == -1) error(err_msg); end end % Check file size fseek(fid, 0, 'eof'); file_size = ftell(fid); fseek(fid, 0, 'bof'); % Read "IT++" magic string [d, n] = fread(fid, 5, 'char'); if (n ~= 5 | d(1:4) ~= [73 84 43 43]') error('Not an IT++ file!'); end % Check the IT++ file version if (d(5) ~= 3) error('Only IT++ file version 3 is supported by this function!'); end while (1) p = ftell(fid); % Save current file position [d1, n] = fread(fid, 3, 'uint64'); % Read header, data, and total block sizes name = fgetstr(fid); % Read current variable name type = fgetstr(fid); % Read current variable type fseek(fid, p+d1(1), 'bof'); % Skip header bytes if (length(type) == 0) % A deleted entry -> skip it % --- bin --- elseif (strcmp(type, 'bin')) [d, n] = fread(fid, 1, 'char'); assignin('caller', name, d); % --- int8 (char) --- elseif (strcmp(type, 'int8')) [d, n] = fread(fid, 1, 'int8'); assignin('caller', name, d); % --- int16 (short) --- elseif (strcmp(type, 'int16')) [d, n] = fread(fid, 1, 'int16'); assignin('caller', name, d); % --- int32 (int) --- elseif (strcmp(type, 'int32')) [d, n] = fread(fid, 1, 'int32'); assignin('caller', name, d); % --- float32 (float) --- elseif (strcmp(type, 'float32')) [d, n] = fread(fid, 1, 'float32'); assignin('caller', name, d); % --- float64 (double) --- elseif (strcmp(type, 'float64')) [d, n] = fread(fid, 1, 'float64'); assignin('caller', name, d); % --- cfloat32 (complex) --- elseif (strcmp(type, 'cfloat32')) [d, n] = fread(fid, 2, 'float32'); d = complex(d(1), d(2)); assignin('caller', name, d); % --- cfloat64 (complex) --- elseif (strcmp(type, 'cfloat64')) [d, n] = fread(fid, 2, 'float64'); d = complex(d(1), d(2)); assignin('caller', name, d); % --- bvec --- elseif (strcmp(type, 'bvec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'char'); assignin('caller', name, d); % --- svec --- elseif (strcmp(type, 'svec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'int16'); assignin('caller', name, d); % --- ivec --- elseif (strcmp(type, 'ivec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'int32'); assignin('caller', name, d); % --- fvec --- elseif (strcmp(type, 'fvec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'float32'); assignin('caller', name, d); % --- dvec --- elseif (strcmp(type, 'dvec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'float64'); assignin('caller', name, d); % --- fcvec --- elseif (strcmp(type, 'fcvec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size*2, 'float32'); d = complex(d(1:2:end), d(2:2:end)); assignin('caller', name, d); % --- dcvec --- elseif (strcmp(type, 'dcvec')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size*2, 'float64'); d = complex(d(1:2:end), d(2:2:end)); assignin('caller', name, d); % --- string --- elseif (strcmp(type, 'string')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'char'); d = char(d); assignin('caller', name, d); % --- bmat --- elseif (strcmp(type, 'bmat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size', 'char'); assignin('caller', name, d); % --- smat --- elseif (strcmp(type, 'smat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size', 'int16'); assignin('caller', name, d); % --- imat --- elseif (strcmp(type, 'imat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size', 'int32'); assignin('caller', name, d); % --- fmat --- elseif (strcmp(type, 'fmat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size', 'float32'); assignin('caller', name, d); % --- dmat --- elseif (strcmp(type, 'dmat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size', 'float64'); assignin('caller', name, d); % --- fcmat --- elseif (strcmp(type, 'fcmat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size(1)*size(2)*2, 'float32'); d = reshape(complex(d(1:2:end), d(2:2:end)), size(1), size(2)); assignin('caller', name, d); % --- dcmat --- elseif (strcmp(type, 'dcmat')) [size, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size(1)*size(2)*2, 'float64'); d = reshape(complex(d(1:2:end), d(2:2:end)), size(1), size(2)); assignin('caller', name, d); % --- bArray --- elseif (strcmp(type, 'bArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'char'); assignin('caller', name, d); % --- sArray --- elseif (strcmp(type, 'sArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'int16'); assignin('caller', name, d); % --- iArray --- elseif (strcmp(type, 'iArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'int32'); assignin('caller', name, d); % --- fArray --- elseif (strcmp(type, 'fArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'float32'); assignin('caller', name, d); % --- dArray --- elseif (strcmp(type, 'dArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size, 'float64'); assignin('caller', name, d); % --- fcArray --- elseif (strcmp(type, 'fcArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size*2, 'float32'); d = complex(d(1:2:end), d(2:2:end)); assignin('caller', name, d); % --- dcArray --- elseif (strcmp(type, 'dcArray')) [size, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size*2, 'float64'); d = complex(d(1:2:end), d(2:2:end)); assignin('caller', name, d); % --- bvecArray --- elseif (strcmp(type, 'bvecArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size2, 'char'); d2{i} = d; end assignin('caller', name, d2); % --- svecArray --- elseif (strcmp(type, 'svecArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size2, 'int16'); d2{i} = d; end assignin('caller', name, d2); % --- ivecArray --- elseif (strcmp(type, 'ivecArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size2, 'int32'); d2{i} = d; end assignin('caller', name, d2); % --- vecArray --- elseif (strcmp(type, 'vecArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size2, 'float64'); d2{i} = d; end assignin('caller', name, d2); % --- cvecArray --- elseif (strcmp(type, 'cvecArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size2*2, 'float64'); d2{i} = complex(d(1:2:end), d(2:2:end)); end assignin('caller', name, d2); % --- stringArray --- elseif (strcmp(type, 'stringArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 1, 'uint64'); [d, n] = fread(fid, size2, 'char'); d2{i} = char(d); end assignin('caller', name, d2); % --- bmatArray --- elseif (strcmp(type, 'bmatArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size2', 'char'); d2{i} = d; end assignin('caller', name, d2); % --- smatArray --- elseif (strcmp(type, 'smatArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size2', 'int16'); d2{i} = d; end assignin('caller', name, d2); % --- imatArray --- elseif (strcmp(type, 'imatArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size2', 'int32'); d2{i} = d; end assignin('caller', name, d2); % --- matArray --- elseif (strcmp(type, 'matArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size2', 'float64'); d2{i} = d; end assignin('caller', name, d2); % --- cmatArray --- elseif (strcmp(type, 'cmatArray')) [size, n] = fread(fid, 1, 'uint64'); clear d2; for i=1:size; [size2, n] = fread(fid, 2, 'uint64'); [d, n] = fread(fid, size2(1)*size2(2)*2, 'float64'); d2{i} = reshape(complex(d(1:2:end), d(2:2:end)), size2(1), size2(2)); end assignin('caller', name, d2); % --- else --- else warning(['Not supported type: ' type]); end if (p + d1(3) >= file_size) break; else fseek(fid, p+d1(3), 'bof'); end end fclose(fid); function str = fgetstr(fid) str = ''; while (1) [d, n] = fread(fid, 1, 'char'); if (d == 0) break; end str = [str char(d)]; end itpp-4.3.1/extras/itpp-config.t2t000066400000000000000000000040221216575753400166700ustar00rootroot00000000000000itpp-config IT++ @PACKAGE_VERSION@ @PACKAGE_DATE@ %!target: man = NAME = itpp-config - script to get information about intalled IT++ library prefix, compiler flags and its version = SYNOPSIS = **itpp-config** [--prefix] [--exec-prefix] [--debug] [--static] [--cflags] [--libs] [--help] [--version] = DESCRIPTION = //itpp-config// is a tool that can be used to determine the compiler and linker flags required for compiling and linking programs that use IT++. It can be also used for checking the intalled libitpp library version. = OPTIONS = //itpp-config// accepts the following options: : **--prefix** output libitpp installation prefix : **--exec-prefix** output libitpp installation exec prefix : **--debug** use debugging pre-processor, compiler and linker flags (needs to be used in front of **--cflags** and **--libs**) : **--static** use static linker flags (needs to be used in front of **--libs**) : **--cflags** output pre-processor and compiler flags : **--libs** output linker flags : **--help** display brief help and exit : **--version** output version number = AUTHOR = This manual page was written by Adam Piatyszek as a text file, then converted to man format by txt2tags. = COPYRIGHT = Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) This file is part of IT++ - a C++ library of mathematical, signal processing, speech processing, and communications classes and functions. IT++ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. IT++ 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 General Public License for more details. You should have received a copy of the GNU General Public License along with IT++. If not, see . itpp-4.3.1/extras/itsave.m000066400000000000000000000174061216575753400155010ustar00rootroot00000000000000% File: itsave.m % Brief: Saves Matlab/Octave workspace variables to an IT++ itfile % Author: Tony Ottosson and Adam Piatyszek % % Usage: itsave("fname.it", var1, [var2], ...) % % This function saves a set of Matlab/Octave workspace variables to an IT++ % file format. Currently, only vectors and 2-D matrices can be saved. The % type of data saved is detected automatically and can be one of the % following types: bvec, bmat, ivec, imat, vec, mat, cvec, cmat. % % ------------------------------------------------------------------------- % % Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) % % This file is part of IT++ - a C++ library of mathematical, signal % processing, speech processing, and communications classes and functions. % % IT++ is free software: you can redistribute it and/or modify it under the % terms of the GNU General Public License as published by the Free Software % Foundation, either version 3 of the License, or (at your option) any % later version. % % IT++ 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 General Public License for more % details. % % You should have received a copy of the GNU General Public License along % with IT++. If not, see . % % ------------------------------------------------------------------------- function itsave(fname, varargin) if (nargin > 1) vars = varargin; else error('Usage: itsave("fname.it", var1, [var2], ...)'); end nargs = size(vars,2); % The current file-version of it_file file_version = 3; [fid, err_msg] = fopen(fname, 'wb', 'ieee-le'); if (fid == -1) error(err_msg); end % Write a file header consisting of "IT++" and a char containing the file % version number fprintf(fid, 'IT++%c', file_version); for ai=1:nargs if (exist('OCTAVE_VERSION')) % check for octave vname = deblank(argn(ai+1,:)); % octave way of getting parameter name is_octave=1; %used by function itsizeof to identify octave else vname = inputname(ai+1); % matlab way of getting parameter name is_octave=0; %used by function itsizeof to identify matlab end v = vars{ai}; is_scalar = all(size(v) == 1); % true if scalar (for future use) is_vector = (sum(size(v) > 1) <= 1); % true if a vector (or a scalar) is_intbin = min(min(v == round(v))); % true if integer or binary if ( isreal(v) && is_intbin ) % binary or integer type if (max(max(v)) == 1 && min(min(v)) == 0) % binary type % Calculate sizes if (is_vector) hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('bvec',is_octave)+1 +1; data_bytes = itsizeof(uint64(0),is_octave) + itsizeof(char(0),is_octave) * prod(size(v)); else % a matrix hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('bmat',is_octave)+1 +1; data_bytes = 2 * itsizeof(uint64(0),is_octave) + itsizeof(char(0),is_octave) * prod(size(v)); end block_bytes = hdr_bytes + data_bytes; % Write header sizes fwrite(fid, [hdr_bytes data_bytes block_bytes], 'uint64'); % Write variable name as string fprintf(fid, '%s%c', vname); fwrite(fid, 0, 'char'); % Write data type string, empty description string and data size if (is_vector) fprintf(fid, 'bvec'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v(:),1), 'uint64'); else % a matrix fprintf(fid, 'bmat'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v), 'uint64'); end % Write data fwrite(fid, v, 'char'); else % integer type % Calculate sizes if (is_vector) hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('ivec',is_octave)+1 +1; data_bytes = itsizeof(uint64(0),is_octave) + itsizeof(int32(0),is_octave) * prod(size(v)); else % a matrix hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('imat',is_octave)+1 +1; data_bytes = 2 * itsizeof(uint64(0),is_octave) + itsizeof(int32(0),is_octave) * prod(size(v)); end block_bytes = hdr_bytes + data_bytes; % Write header sizes fwrite(fid, [hdr_bytes data_bytes block_bytes], 'uint64'); % Write variable name as string fprintf(fid, '%s%c', vname); fwrite(fid, 0, 'char'); % Write data type string, empty description string and data size if (is_vector) fprintf(fid, 'ivec'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v(:),1), 'uint64'); else % a matrix fprintf(fid, 'imat'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v), 'uint64'); end % Write data fwrite(fid, v, 'int32'); end % binary or integer elseif (isa(v, 'double')) % double precision floating point type if (isreal(v)) % Check if real values % Calculate sizes if (is_vector) hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('dvec',is_octave)+1 + 1; data_bytes = itsizeof(uint64(0),is_octave) + itsizeof(double(0),is_octave) * prod(size(v)); else % a matrix hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('dmat',is_octave)+1 + 1; data_bytes = 2 * itsizeof(uint64(0),is_octave) + itsizeof(double(0),is_octave) ... * prod(size(v)); end block_bytes = hdr_bytes + data_bytes; % Write a header fwrite(fid, [hdr_bytes data_bytes block_bytes], 'uint64'); % Writes variable name as string fprintf(fid, '%s%c', vname); fwrite(fid, 0, 'char'); if (is_vector) fprintf(fid, 'dvec'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v(:),1), 'uint64'); else % a matrix fprintf(fid, 'dmat'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v), 'uint64'); end fwrite(fid, v, 'float64'); else % complex values % Calculate sizes if (is_vector) hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('dcvec',is_octave)+1 + 1; data_bytes = itsizeof(uint64(0),is_octave) + 2 * itsizeof(double(0),is_octave) ... * prod(size(v)); else % a matrix hdr_bytes = 3 * itsizeof(uint64(0),is_octave) + size(vname,2)+1 ... + itsizeof('dcmat',is_octave)+1 + 1; data_bytes = 2 * itsizeof(uint64(0),is_octave) + 2 * itsizeof(double(0),is_octave) ... * prod(size(v)); end block_bytes = hdr_bytes + data_bytes; % Writes header sizes fwrite(fid, [hdr_bytes data_bytes block_bytes], 'uint64'); % Write variable name as string fprintf(fid, '%s', vname); fwrite(fid, 0, 'char'); if (is_vector) % Write data type string, empty description string and data size fprintf(fid, 'dcvec'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v(:),1), 'uint64'); % Write data for i=1:size(v(:),1) fwrite(fid, real(v(i)), 'float64'); fwrite(fid, imag(v(i)), 'float64'); end else % a matrix % Write data type string, empty description string and data size fprintf(fid, 'dcmat'); fwrite(fid, 0, 'char'); fwrite(fid, 0, 'char'); fwrite(fid, size(v), 'uint64'); % Write data for j=1:size(v,2) for i=1:size(v,1) fwrite(fid, real(v(i,j)), 'float64'); fwrite(fid, imag(v(i,j)), 'float64'); end end end end % real or complex else warning(['Variable ''' vname ''' is neither a vector nor matrix. Not saved.']); end end fclose(fid); % sizeof function (like C-style sizeof) % returns no. bytes used by a variable function nbytes=itsizeof(in,is_octave) if (~is_octave) tmp=whos('in'); nbytes=tmp.bytes; % matlab uses 2 bytes by default for char % overwrite using 1 byte for file format if (ischar(in)) nbytes=size(in,2); end; else nbytes=sizeof(in); end; itpp-4.3.1/extras/mkl_tests_vcproj.template000066400000000000000000000037771216575753400211630ustar00rootroot00000000000000 itpp-4.3.1/extras/pyitpp.py000066400000000000000000000373721216575753400157330ustar00rootroot00000000000000# File: pyitpp.py # Brief: Loads an IT++ itfile content and outputs a dictionary with all variables found. # Author: Bogdan Cristea # # Usage: from pyitpp import itload # out = itload('fname.it') # # This module provides a function for loading itfile content into matrices/scalars # and outputs all these variables as a dictionary whose keys are variable names as # found in itfile. This module uses numpy module for matrix operations and numerical types. # Thus, the provided functionality is similar to itload() function for MATLAB. # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- from sys import exit from os import stat from os import SEEK_SET from stat import ST_SIZE from struct import unpack from numpy import mat from numpy import reshape from numpy.matlib import zeros #numerical types used for conversions from numpy import uint8 from numpy import int16 from numpy import int32 from numpy import float32 from numpy import float64 from numpy import complex64 from numpy import complex128 def __fgetstr(fid): str = '' while 1: d = fid.read(1); if d == '\x00': break str = str+d; return str def itload(in_file): try: f = open(in_file, 'rb') except IOError: try: f = open(in_file+'.it', 'rb') except IOError: print 'Cannot open file' exit() #get file size file_size = stat(in_file)[ST_SIZE] #read IT++ magic string magic = f.read(4); if 'IT++' != magic: print 'Not an IT++ file!' exit() #check the IT++ file version version = f.read(1) if 3 != ord(version): print 'Only IT++ file version 3 is supported by this function!' exit() out = dict()#use a dictionary to output all tuples read from it file while 1: #save current file position pos = f.tell() #read header, data, and total block sizes (3*uint64) header_data_block_sizes = unpack('3Q', f.read(24)) #read current variable name var_name = __fgetstr(f) #read current variable type var_type = __fgetstr(f) #skip header bytes f.seek(pos+header_data_block_sizes[0], SEEK_SET) if len(var_type) == 0: #A deleted entry -> skip it pass #scalars # --- bin --- elif 'bin' == var_type: out[var_name] = uint8(unpack('b', f.read(1))[0]) # --- int8 (char) --- elif 'int8' == var_type: out[var_name] = unpack('c', f.read(1))[0] # --- int16 (short) --- elif 'int16' == var_type: out[var_name] = int16(unpack('h', f.read(2))[0]) # --- int32 (int) --- elif 'int32' == var_type: out[var_name] = int32(unpack('i', f.read(4))[0]) # --- float32 (float) --- elif 'float32' == var_type: out[var_name] = float32(unpack('f', f.read(4))[0]) # --- float64 (double) --- elif 'float64' == var_type: out[var_name] = float64(unpack('d', f.read(8))[0]) # --- cfloat32 (complex) --- elif 'cfloat32' == var_type: real_imag = unpack('2f', f.read(8)) out[var_name] = complex64(complex(real_imag[0], real_imag[1])) # --- cfloat64 (complex) --- elif 'cfloat64' == var_type: real_imag = unpack('2d', f.read(16)) out[var_name] = complex128(complex(real_imag[0], real_imag[1])) #vectors # --- bvec --- elif 'bvec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(length)+'b' out[var_name] = mat(unpack(fmt, f.read(length)), 'uint8').T#convert to a column vector # --- string --- elif 'string' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(length)+'c' out[var_name] = "".join(unpack(fmt, f.read(length))) # --- svec --- elif 'svec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(length)+'h' out[var_name] = mat(unpack(fmt, f.read(length*2)), 'int16').T#convert to a column vector # --- ivec --- elif 'ivec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(length)+'i' out[var_name] = mat(unpack(fmt, f.read(length*4)), 'int32').T#convert to a column vector # --- fvec --- elif 'fvec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(length)+'f' out[var_name] = mat(unpack(fmt, f.read(length*4)), 'float32').T#convert to a column vector # --- dvec --- elif 'dvec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(length)+'d' out[var_name] = mat(unpack(fmt, f.read(length*8)), 'float64').T#convert to a column vector # --- fcvec --- elif 'fcvec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(2*length)+'f' real_imag = mat(unpack(fmt, f.read(2*length*4)), 'float32').T#convert to a column vector out[var_name] = zeros((length, 1), complex) for i in range(length): out[var_name][i,0] = complex64(complex(real_imag[2*i], real_imag[2*i+1])) # --- dcvec --- elif 'dcvec' == var_type: length = unpack('Q', f.read(8))[0] fmt = str(2*length)+'d' real_imag = mat(unpack(fmt, f.read(2*length*8)), 'float64').T#convert to a column vector out[var_name] = zeros((length, 1), complex) for i in range(length): out[var_name][i,0] = complex128(complex(real_imag[2*i], real_imag[2*i+1])) #matrices # --- bmat --- elif 'bmat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'b' out[var_name] = reshape(mat(unpack(fmt, f.read(rows*cols)), 'uint8'), (cols, rows)).T # --- smat --- elif 'smat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'h' out[var_name] = reshape(mat(unpack(fmt, f.read(rows*cols*2)), 'int16'), (cols, rows)).T # --- imat --- elif 'imat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'i' out[var_name] = reshape(mat(unpack(fmt, f.read(rows*cols*4)), 'int32'), (cols, rows)).T # --- fmat --- elif 'fmat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'f' out[var_name] = reshape(mat(unpack(fmt, f.read(rows*cols*4)), 'float32'), (cols, rows)).T # --- dmat --- elif 'dmat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'d' out[var_name] = reshape(mat(unpack(fmt, f.read(rows*cols*8)), 'float64'), (cols, rows)).T # --- fcmat --- elif 'fcmat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(2*rows*cols)+'f' real_imag = mat(unpack(fmt, f.read(2*rows*cols*4)), 'float32').T out[var_name] = zeros((rows, cols), complex) for i in range(rows): for j in range(cols): out[var_name] = out[var_name][i,j] = complex(real_imag[2*i+2*rows*j], real_imag[2*i+1+2*rows*j]) # --- dcmat --- elif 'dcmat' == var_type: rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(2*rows*cols)+'d' real_imag = mat(unpack(fmt, f.read(2*rows*cols*8)), 'float64').T out[var_name] = zeros((rows, cols), complex) for i in range(rows): for j in range(cols): out[var_name][i,j] = complex(real_imag[2*i+2*rows*j], real_imag[2*i+1+2*rows*j]) #arrays of scalars (implemented as list of scalars) # --- bArray --- elif 'bArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(size)+'b' out[var_name] = [uint8(n) for n in unpack(fmt, f.read(size))] # --- sArray --- elif 'sArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(size)+'h' out[var_name] = [int16(n) for n in unpack(fmt, f.read(size*2))] # --- iArray --- elif 'iArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(size)+'i' out[var_name] = [int32(n) for n in unpack(fmt, f.read(size*4))] # --- fArray --- elif 'fArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(size)+'f' out[var_name] = [float32(n) for n in unpack(fmt, f.read(size*4))] # --- dArray --- elif 'dArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(size)+'d' out[var_name] = [float64(n) for n in unpack(fmt, f.read(size*8))] # --- fcArray --- elif 'fcArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(2*size)+'f' real_imag = unpack(fmt, f.read(2*size*4)) out[var_name] = list() for i in range(size): out[var_name].append(complex64(complex(real_imag[2*i], real_imag[2*i+1]))) # --- dcArray --- elif 'dcArray' == var_type: size = unpack('Q', f.read(8))[0] fmt = str(2*size)+'d' real_imag = unpack(fmt, f.read(2*size*8)) out[var_name] = list() for i in range(size): out[var_name].append(complex128(complex(real_imag[2*i], real_imag[2*i+1]))) #arrays of vectors (implemented as list of vectors) # --- bvecArray --- elif 'bvecArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): length = unpack('Q', f.read(8))[0] fmt = str(length)+'b' out[var_name].append(mat(unpack(fmt, f.read(length)), 'uint8').T) # --- svecArray --- elif 'svecArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): length = unpack('Q', f.read(8))[0] fmt = str(length)+'h' out[var_name].append(mat(unpack(fmt, f.read(length*2)), 'int16').T) # --- ivecArray --- elif 'ivecArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): length = unpack('Q', f.read(8))[0] fmt = str(length)+'i' out[var_name].append(mat(unpack(fmt, f.read(length*4)), 'int32').T) # --- vecArray --- elif 'vecArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): length = unpack('Q', f.read(8))[0] fmt = str(length)+'d' out[var_name].append(mat(unpack(fmt, f.read(length*8)), 'float64').T) # --- cvecArray --- elif 'cvecArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): length = unpack('Q', f.read(8))[0] fmt = str(2*length)+'d' real_imag = unpack(fmt, f.read(2*length*8)) v = zeros((length, 1), complex) for j in range(length): v[j,0] = complex128(complex(real_imag[2*j], real_imag[2*j+1])) out[var_name].append(v) # --- stringArray --- elif 'stringArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): length = unpack('Q', f.read(8))[0] fmt = str(length)+'c' out[var_name].append("".join(unpack(fmt, f.read(length)))) #arrays of matrices (implemented as list of matrices) # --- bmatArray --- elif 'bmatArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'b' out[var_name].append(reshape(mat(unpack(fmt, f.read(rows*cols)), 'uint8'), (cols, rows)).T) # --- smatArray --- elif 'smatArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'h' out[var_name].append(reshape(mat(unpack(fmt, f.read(rows*cols*2)), 'int16'), (cols, rows)).T) # --- imatArray --- elif 'imatArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'i' out[var_name].append(reshape(mat(unpack(fmt, f.read(rows*cols*4)), 'int32'), (cols, rows)).T) # --- matArray --- elif 'matArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(rows*cols)+'d' out[var_name].append(reshape(mat(unpack(fmt, f.read(rows*cols*8)), 'float64'), (cols, rows)).T) # --- cmatArray --- elif 'cmatArray' == var_type: size = unpack('Q', f.read(8))[0] out[var_name] = list() for i in range(size): rows = unpack('Q', f.read(8))[0] cols = unpack('Q', f.read(8))[0] fmt = str(2*rows*cols)+'d' real_imag = unpack(fmt, f.read(2*rows*cols*8)) m = zeros((rows, cols), complex) for j in range(rows): for k in range(cols): m[j,k] = complex128(complex(real_imag[2*j+2*rows*k], real_imag[2*j+1+2*rows*k])) out[var_name].append(m) else: print 'Not a supported type: ', var_type if pos+header_data_block_sizes[2] >= file_size: break else: f.seek(pos+header_data_block_sizes[2], SEEK_SET) f.close() return outitpp-4.3.1/extras/setenv.bat000066400000000000000000000041571216575753400160230ustar00rootroot00000000000000@rem File: setenv.bat.py @rem Brief: Setting the environment for using Microsoft Visual Studio command line tools. @rem Author: Bogdan Cristea @rem Initial version provided by B.Komazec @rem @rem Usage: setenv.bat x64 @rem @rem This batch file calls MS Visual Studio provided batch files (vcvars32.bat or vcvars64.bat) @rem in order to setup the environment variables needed for Microsoft Visual Studio @rem command line tools. Note that the paths to vcvars32.bat or vcvars64.bat are hard @rem coded and needed to be provided if needed. By default these paths correspond to @rem Microsoft Visual Studio 2010 installation. @rem @rem ------------------------------------------------------------------------- @rem @rem Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) @rem @rem This file is part of IT++ - a C++ library of mathematical, signal @rem processing, speech processing, and communications classes and functions. @rem @rem IT++ is free software: you can redistribute it and/or modify it under the @rem terms of the GNU General Public License as published by the Free Software @rem Foundation, either version 3 of the License, or (at your option) any @rem later version. @rem @rem IT++ is distributed in the hope that it will be useful, but WITHOUT ANY @rem WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS @rem FOR A PARTICULAR PURPOSE. See the GNU General Public License for more @rem details. @rem @rem You should have received a copy of the GNU General Public License along @rem with IT++. If not, see . @rem @rem ------------------------------------------------------------------------- @echo off @if "%1"=="x86" goto set_x86 @if "%1"=="x64" goto set_x64 @if "%1"=="" goto error :set_x86 call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" goto test_bin_locations :set_x64 call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat" goto test_bin_locations :test_bin_locations @echo on where nmake where cl.exe where link.exe @echo off goto:eof :error @echo Usage: setenv.bat [x86^|x64] goto:eof itpp-4.3.1/extras/test_pyitpp.it000066400000000000000000004327201216575753400167520ustar00rootroot00000000000000IT++ abin !bint82!#cint16!%dint32#'efloat32p@#+ffloat64,!@$,gcfloat32󝿢E@$4hcfloat64S󿥂_I@ .ibvec" -jstringabc <ksvec  0Plivec !ndcvec ???@@@ @ @@ Xxmdvec >@?@@@@@A@A@B@B@C@C@ 6obmat <psmat (Hqimat    @`rdmat?ffffff@?333333@333333?@!psdcmat???@@"3tbArray "<usArray ",NviArray ",NwfArray ?̌??ff?33????ff?"(JxdArray5^9D@"9D@l9D@0:D@u֣p=:D@X|?5^:D@;"~:D@v:D@n:D@G:D@ǹI ;D@_";D@C;D@pZd;D@SQ;D@6S;D@;D@Bl;D@&1D@|?5>D@ՒV>D@8v>D@O>D@~Q>D@a*>D@D">D@'v?D@ Zd;?D@(\?D@g|?D@ -?D@v?D@yYd;?D@\?D@? @D@"K7A@D@Mb@D@n@D@< ף@D@⥛@D@A`@D@t.$AD@Wx&AD@:zGAD@ rhAD@K7AD@kAD@AD@AD@]I BD@oV-BD@RMBD@5OnBD@(\BD@ BD@@`BD@BD@nCD@2333CD@jSCD@M~jtCD@0$CD@ʡECD@o= CD@CD@tDD@aX9DD@ZDD@eGzDD@HS㥛DD@+~jDD@/DD@DDD@QED@|?ED@6A`ED@}$ED@`ʡED@C(\ED@&SED@ tFD@/$FD@ϿʡEFD@efffFD@ +FD@xFD@[W9FD@>xFD@!p= GD@I +GD@KGD@ʔClGD@:OGD@zGD@sGD@V,GD@9MbHD@x&1HD@QHD@ rHD@itHD@X9HD@HD@n[HD@Q+ID@4K7ID@MbXID@xID@ݘID@>5^ID@"ID@lID@i0JD@L֣p=JD@/|?5^JD@"~JD@vJD@mJD@GJD@I KD@_"KD@dCKD@GZdKD@*QKD@ SKD@KD@BlKD@&1LD@(LD@|4^ILD@_~jLD@BCLD@%&1LD@LD@qhLD@VMD@/MD@c;OMD@w ףpMD@ZrhMD@=U-MD@ MD@EMD@FzND@|?5ND@VND@8vND@rOND@UQND@8*ND@"ND@uOD@Zd;OD@(\OD@g|OD@ -OD@mvOD@PYd;OD@3OD@ PD@J7APD@MbPD@nPD@< ףPD@⥛PD@hA`PD@K.$QD@.x&QD@zGQD@rhQD@K7QD@kQD@QD@QD@c]I RD@FV-RD@)MRD@ OnRD@(\RD@Қ RD@@`RD@RD@{nSD@^2333SD@ASSD@$~jtSD@$SD@ɡESD@o= SD@SD@tTD@vaX9TD@YZTD@5^YD@z"YD@]lYD@@0ZD@#֣p=ZD@|?5^ZD@!~ZD@vZD@mZD@GZD@uI [D@X_"[D@;C[D@Zd[D@Q[D@S[D@ǜ[D@Bl[D@&1\D@p(\D@S4^I\D@6~j\D@C\D@%1\D@\D@qh\D@V]D@/]D@kc;O]D@N ףp]D@1rh]D@U-]D@]D@ڠE]D@Fz^D@|?5^D@V^D@f8v^D@IO^D@,Q^D@*^D@"^D@u_D@Zd;_D@(\_D@~g|_D@a -_D@Dv_D@'Yd;_D@ _D@ `D@J7A`D@Mb`D@n`D@y< ף`D@\⥛`D@?A``D@".$aD@x&aD@yGaD@rhaD@K7aD@kaD@taD@WaD@:]I bD@V-bD@MbD@NnbD@(\bD@ bD@@`bD@obD@RncD@52333cD@ScD@}jtcD@#cD@ɡEcD@o= cD@cD@jtdD@MaX9dD@0ZdD@GzdD@R㥛dD@~jdD@/dD@DdD@QeD@e|?eD@H6A`eD@+$eD@ʡeD@'\eD@SeD@sfD@/$fD@}ʡEfD@`effffD@C +fD@&fD@ W9fD@xfD@Ϣp= gD@H +gD@KgD@xClgD@[:OgD@>zgD@!gD@,gD@MbhD@w&1hD@QhD@ rhD@sithD@VX9hD@9hD@[hD@+iD@K7iD@LbXiD@xiD@iD@n>5^iD@Q"iD@4liD@0jD@գp=jD@{?5^jD@!~jD@vjD@mjD@iGjD@LI kD@/_"kD@CkD@ZdkD@PkD@SkD@kD@BlkD@d&1lD@G(lD@*4^IlD@ ~jlD@ClD@%1lD@lD@qhlD@|VmD@_/mD@Bc;OmD@% ףpmD@rhmD@T-mD@mD@EmD@FznD@w|?5nD@ZVnD@=8vnD@ OnD@QnD@)nD@"nD@uoD@Zd;oD@r(\oD@Ug|oD@8 -oD@voD@Xd;oD@oD@Ĥ pD@J7ApD@MbpD@mnpD@P< ףpD@3⥛pD@A`pD@-$qD@x&qD@yGqD@rhqD@K7qD@hkqD@KqD@.qD@]I rD@V-rD@רMrD@NnrD@(\rD@ rD@c@`rD@FrD@)nsD@ 2333sD@SsD@}jtsD@#sD@ɡEsD@{o= sD@^sD@AttD@$aX9tD@ZtD@GztD@R㥛tD@~jtD@/tD@vDtD@YQuD@<|?uD@6A`uD@$uD@ʡuD@'\uD@SuD@svD@q/$vD@TʡEvD@7efffvD@ +vD@vD@V9vD@xvD@p= wD@H +wD@lKwD@OClwD@2:OwD@zwD@wD@+wD@MbxD@w&1xD@QxD@g rxD@JitxD@-X9xD@xD@ZxD@+yD@K7yD@LbXyD@xyD@byD@E>5^yD@("yD@ lyD@/zD@գp=zD@{?5^zD@!~zD@zvzD@]mzD@@GzD@#I {D@_"{D@C{D@̪Zd{D@P{D@S{D@u{D@XBl{D@;&1|D@(|D@4^I|D@~j|D@C|D@%1|D@|D@pqh|D@SV}D@6/}D@c;O}D@ףp}D@߮rh}D@T-}D@}D@E}D@kFz~D@N|?5~D@1V~D@8v~D@O~D@ڃQ~D@)~D@"~D@uD@fZd;D@I(\D@,g|D@ -D@vD@Xd;D@D@ D@~J7AD@aMbD@DnD@'< ףD@ ⥛ĀD@A`D@-$D@x&D@yGD@yrhD@\K7D@?kD@"ʁD@D@\I D@V-D@MD@NnD@t(\D@W D@:@`ЂD@D@nD@1333D@SD@}jtD@#D@oɡED@Ro= ׃D@5D@tD@`X9D@ZD@GzD@R㥛D@~jD@j/݄D@MDD@0QD@|?D@5A`D@$D@ʡD@'\…D@SD@esD@H/$D@+ʡED@efffD@ +D@԰阮D@V9ȆD@xD@}p= D@`H +D@CKD@&ClD@ :OD@zD@υ·D@+D@MbD@xw&1D@[QD@> rD@!itD@X9D@ԈD@ZD@+D@K7D@sLbXD@VxD@9D@>5^D@"ۉD@lD@/D@գp=D@{?5^D@n!~D@QvD@4mD@GD@I D@^"D@CD@ZdD@PD@iS㥋D@LƋD@/BlD@&1D@(D@3^ID@~jD@CD@%1D@ďD@GqhD@*VD@ /D@b;OD@ףpD@rhD@T-D@|ҍD@_ED@BFzD@%|?5D@VD@7vD@OD@QD@)َD@w"D@ZuD@=Zd;D@ (\D@g|D@ -D@ɲvD@Xd;ߏD@D@r D@UJ7AD@8MbD@nD@; ףD@ᥛĐD@ćA`D@-$D@x&D@myGD@PrhD@3K7D@kD@ʑD@ܶD@\I D@V-D@MD@hNnD@K(\D@. D@@`ВD@D@׋nD@1333D@SD@}jtD@c#D@FɡED@)o= דD@ D@tD@`X9D@ZD@GzD@{R㥛D@^~jD@A/ݔD@$DD@QD@|?D@5A`D@$D@ʡD@v'\•D@YSD@K7D@!LbXD@xD@痙D@=5^D@"۩D@lD@s/D@Vգp=D@9{?5^D@!~D@vD@lD@GD@I D@^"D@nCD@QZdD@4PD@S㥫D@ƫD@AlD@&1D@(D@3^ID@i~jD@LCD@/%1D@̬D@phD@VD@/D@b;OD@ףpD@drhD@GT-D@*ҭD@ ED@EzD@|?5D@VD@7vD@|OD@_QD@B)ٮD@%"D@uD@Zd;D@(\D@f|D@ -D@wvD@ZXd;߯D@=D@ D@J7AD@MbD@ɕnD@; ףD@ᥛİD@rA`D@U-$D@8x&D@yGD@rhD@K7D@jD@ʱD@D@m\I D@PV-D@3MD@NnD@(\D@ܙ D@?`вD@D@nD@h1333D@KSD@.}jtD@#D@ȡED@n= ׳D@D@tD@`X9D@cZD@FGzD@)R㥛D@ ~jD@/ݴD@CD@QD@|?D@{5A`D@^$D@AʡD@$'\µD@SD@rD@/$D@ʡED@dfffD@v +D@Y臨D@lD@!/D@գp=D@z?5^D@ ~D@vD@lD@sGD@VI D@9^"D@CD@ZdD@OD@SD@D@AlD@n&1D@Q(D@43^ID@~jD@~CD@$1D@D@phD@VD@i/D@Lb;OD@/ףpD@rhD@S-D@D@ED@EzD@|?5D@dVD@G7vD@*OD@ QD@(D@"D@tD@Zd;D@|(\D@_f|D@B -D@%vD@Xd;D@D@Σ D@I7AD@MbD@wnD@Z; ףD@=ᥛD@ A`D@-$D@x&D@xGD@rhD@K7D@rjD@UD@8D@\I D@V-D@MD@MnD@(\D@ D@m?`D@PD@3nD@1333D@SD@|jtD@"D@ȡED@n= D@hD@KtD@.`X9D@ZD@GzD@Q㥛D@~jD@/D@CD@cQD@F|?D@)5A`D@ $D@ʡD@&\D@SD@rD@{/$D@^ʡED@AdfffD@$ +D@D@U9D@xD@p= D@G +D@vKD@YClD@<9OD@zD@D@*D@MbD@v&1D@QD@q rD@ThtD@7X9D@D@YD@*D@åK7D@KbXD@xD@lD@O=5^D@2"D@lD@.D@ԣp=D@z?5^D@ ~D@vD@glD@JGD@-I D@^"D@CD@֩ZdD@OD@SD@D@bAlD@E&1D@((D@ 3^ID@~jD@~CD@$1D@D@zphD@]VD@@/D@#b;OD@ףpD@rhD@S-D@D@ED@uEzD@X|?5D@;VD@7vD@OD@QD@(D@"D@tD@pZd;D@S(\D@6f|D@ -D@vD@Wd;D@D@ D@I7AD@kMbD@NnD@1; ףD@ᥛD@A`D@,$D@x&D@xGD@rhD@fK7D@IjD@,D@D@[I D@V-D@MD@MnD@~(\D@a D@D?`D@'D@ nD@0333D@SD@|jtD@"D@yȡED@\n= D@?D@"tD@`X9D@ZD@˫GzD@Q㥛D@~jD@t/D@WCD@:QD@|?D@5A`D@$D@ƀʡD@&\D@SD@orD@R/$D@5ʡED@dfffD@ +D@ޯD@U9D@xD@p= D@jG +D@MKD@0ClD@9OD@zD@لD@*D@MbD@v&1D@eQD@H rD@+htD@X9D@D@YD@*D@K7D@}KbXD@`xD@CD@&=5^D@ "D@lD@.D@ԣp=D@z?5^D@x ~D@[vD@>lD@!GD@I D@]"D@CD@ZdD@OD@sSD@VD@9AlD@&1D@(D@2^ID@~jD@~CD@$1D@nD@QphD@4VD@/D@a;OD@ףpD@rhD@S-D@D@iED@LEzD@/|?5D@VD@6vD@OD@QD@(D@"D@dtD@GZd;D@*(\D@ f|D@ -D@ӱvD@Wd;D@D@| D@_I7AD@BMbD@%nD@; ףD@ज़D@ΆA`D@,$D@x&D@wxGD@ZrhD@=K7D@ jD@D@D@[I D@V-D@MD@rMnD@U(\D@8 D@?`D@D@ኗnD@0333D@SD@|jtD@m"D@PȡED@3n= D@D@tD@_X9D@ZD@GzD@Q㥛D@h~jD@K/D@.CD@QD@|?D@4A`D@$D@ʡD@&\D@cSD@FrD@)/$D@ ʡED@cfffD@ +D@D@U9D@{xD@^p= D@AG +D@$KD@ClD@8OD@zD@D@*D@vMbD@Yv&1D@<QD@ rD@htD@ X9D@ȳD@YD@*D@qK7D@TKbXD@7xD@D@<5^D@"D@ÈlD@.D@ԣp=D@lz?5^D@O ~D@2vD@lD@GD@۷I D@]"D@CD@ZdD@gOD@JSD@-D@AlD@&1D@֌(D@2^ID@~jD@~CD@b$1D@ED@(phD@ VD@/D@a;OD@ףpD@rhD@zS-D@]D@@ED@#EzD@|?5D@VD@6vD@OD@QD@u(D@X"D@;tD@Zd;D@(\D@e|D@ -D@vD@Wd;D@pD@S E@6I7AE@MbE@nE@: ףE@ज़E@A`E@,$E@kx&E@NxGE@1rhE@K7E@iE@E@E@[I E@V-E@fME@IMnE@,(\E@ E@>`E@E@nE@0333E@~SE@a|jtE@D"E@'ȡEE@ n= E@E@йtE@_X9E@ZE@yGzE@\Q㥛E@?~jE@"/E@CE@QE@ˎ|?E@4A`E@$E@tʡE@W&\E@:SE@rE@/$E@ʡEE@cfffE@ +E@E@oU9E@RxE@5p= E@G +E@KE@ޒClE@8OE@zE@E@j*E@MMbE@0v&1E@QE@ rE@gtE@ X9E@E@YE@e* E@HK7 E@+KbX E@x E@񖙙 E@<5^ E@" E@l E@}. E@`ԣp= E@Cz?5^ E@& ~ E@ v E@k E@G E@I  E@]" E@xC E@[Zd E@>O E@!S E@ E@@l E@&1 E@( E@2^I E@s~j E@V~C E@9$1 E@ E@oh E@V E@Ż/ E@a;O E@ףp E@nrh E@QS- E@4 E@E E@DzE@|?5E@VE@6vE@OE@iQE@L(E@/"E@tE@Zd;E@ؿ(\E@e|E@ -E@vE@dWd;E@GE@* E@ I7AE@MbE@ӔnE@: ףE@ज़E@|A`E@_,$E@Bx&E@%xGE@rhE@K7E@iE@E@E@w[I E@ZV-E@=ME@ MnE@(\E@ E@>`E@E@nE@r0333E@USE@8|jtE@"E@ǡEE@m= E@E@tE@_X9E@mZE@PGzE@3Q㥛E@~jE@/E@BE@QE@|?E@4A`E@h$E@KʡE@.&\E@SE@qE@/$E@ʡEE@cfffE@ +E@cE@FU9E@)xE@ p= E@F +E@KE@ClE@8OE@{zE@^E@A*E@$MbE@v&1E@QE@ rE@gtE@ X9E@vE@YYE@<*E@K7E@KbXE@xE@ȖE@<5^E@"E@qlE@T.E@7ԣp=E@z?5^E@~E@vE@kE@GE@I E@l]"E@OCE@2ZdE@OE@SE@ۚE@@lE@&1E@(E@g2^IE@J~jE@-~CE@$1E@E@ohE@VE@/E@a;OE@bףpE@ErhE@(S-E@ E@EE@DzE@|?5E@VE@z6vE@]OE@@QE@#(E@"E@sE@Zd;E@(\E@e|E@u -E@XvE@;Wd;E@E@ E@H7A E@Mb E@n E@: ף E@pज़ E@SA` E@6,$!E@x&!E@wG!E@rh!E@K7!E@i!E@!E@k!E@N[I "E@1V-"E@M"E@Ln"E@(\"E@ "E@>`"E@"E@fn#E@I0333#E@,S#E@|jt#E@!#E@ǡE#E@m= #E@#E@~t$E@a_X9$E@DZ$E@'Gz$E@ Q㥛$E@~j$E@М/$E@B$E@Q%E@y|?%E@\4A`%E@?$%E@"ʡ%E@&\%E@S%E@q&E@/$&E@ʡE&E@tcfff&E@W +&E@:&E@U9&E@x&E@p= 'E@F +'E@K'E@Cl'E@o8O'E@Rz'E@5'E@*'E@Mb(E@u&1(E@Q(E@ r(E@gt(E@j X9(E@M(E@0Y(E@*)E@K7)E@JbX)E@x)E@)E@<5^)E@e")E@Hl)E@+.*E@ԣp=*E@y?5^*E@~*E@v*E@k*E@}G*E@`I +E@C]"+E@&C+E@ Zd+E@N+E@S+E@+E@@l+E@x&1,E@[(,E@>2^I,E@!~j,E@~C,E@#1,E@,E@oh,E@V-E@s/-E@Va;O-E@9ףp-E@rh-E@R--E@-E@ŞE-E@Dz.E@|?5.E@nV.E@Q6v.E@4O.E@Q.E@'.E@".E@s/E@Zd;/E@(\/E@ie|/E@L -/E@/v/E@Wd;/E@/E@آ 0E@H7A0E@Mb0E@n0E@d: ף0E@Gज़0E@*A`0E@ ,$1E@x&1E@wG1E@rh1E@K71E@|i1E@_1E@B1E@%[I 2E@V-2E@M2E@Ln2E@(\2E@ 2E@w>`2E@Z2E@=n3E@ 03333E@S3E@{jt3E@!3E@ǡE3E@m= 3E@r3E@Ut4E@8_X94E@Z4E@Gz4E@P㥛4E@~j4E@/4E@B4E@mQ5E@P|?5E@34A`5E@$5E@ʡ5E@%\5E@S5E@q6E@/$6E@hʡE6E@Kcfff6E@. +6E@6E@T96E@x6E@p= 7E@F +7E@K7E@cCl7E@F8O7E@)z7E@ 7E@)7E@Mb8E@u&18E@Q8E@{ r8E@^gt8E@A X98E@$8E@Y8E@*9E@ͤK79E@JbX9E@x9E@v9E@Y<5^9E@<"9E@l9E@.:E@ӣp=:E@y?5^:E@~:E@v:E@qk:E@TG:E@7I ;E@]";E@C;E@Zd;E@N;E@S;E@;E@l@l;E@O&1E@b|?5>E@EV>E@(6v>E@ O>E@Q>E@'>E@">E@s?E@zZd;?E@](\?E@@e|?E@# -?E@v?E@Vd;?E@?E@ @E@H7A@E@uMb@E@Xn@E@;: ף@E@ज़@E@A`@E@+$AE@x&AE@wGAE@rhAE@pK7AE@SiAE@6AE@AE@ZI BE@V-BE@¦MBE@LnBE@(\BE@k BE@N>`BE@1BE@nCE@/333CE@SCE@{jtCE@!CE@ǡECE@fm= CE@ICE@,tDE@_X9DE@ZDE@ժGzDE@P㥛DE@~jDE@~/DE@aBDE@DQEE@'|?EE@ 4A`EE@$EE@ʡEE@%\EE@SEE@yqFE@\/$FE@?ʡEFE@"cfffFE@ +FE@讝FE@T9FE@xFE@p= GE@tF +GE@WKGE@:ClGE@8OGE@zGE@GE@)GE@MbHE@u&1HE@oQHE@R rHE@5gtHE@ X9HE@HE@XHE@*IE@K7IE@JbXIE@jxIE@MIE@0<5^IE@"IE@lIE@-JE@ӣp=JE@y?5^JE@~JE@evJE@HkJE@+GJE@I KE@\"KE@CKE@ZdKE@NKE@}SKE@`KE@C@lKE@&&1LE@ (LE@1^ILE@~jLE@}CLE@#1LE@xLE@[ohLE@>VME@!/ME@a;OME@ףpME@ʬrhME@R-ME@ME@sEME@VDzNE@9|?5NE@VNE@5vNE@ONE@ŁQNE@'NE@"NE@nsOE@QZd;OE@4(\OE@e|OE@ -OE@ݰvOE@Vd;OE@OE@ PE@iH7APE@LMbPE@/nPE@: ףPE@ߥPE@؅A`PE@+$QE@x&QE@wGQE@drhQE@GK7QE@*iQE@ QE@QE@ZI RE@V-RE@MRE@|LnRE@_(\RE@B RE@%>`RE@RE@뉗nSE@/333SE@SSE@{jtSE@w!SE@ZǡESE@=m= SE@ SE@tTE@^X9TE@ZTE@GzTE@P㥛TE@r~jTE@U/TE@8BTE@QUE@|?UE@3A`UE@$UE@ʡUE@%\UE@mSUE@PqVE@3/$VE@ʡEVE@bfffVE@+VE@VE@T9VE@xVE@hp= WE@KF +WE@.KWE@ClWE@7OWE@zWE@WE@)WE@MbXE@cu&1XE@FQXE@) rXE@ gtXE@ X9XE@ҲXE@XXE@*YE@{K7YE@^JbXYE@AxYE@$YE@<5^YE@"YE@͇lYE@-ZE@ӣp=ZE@vy?5^ZE@Y~ZE@mE@!EmE@DznE@|?5nE@ʏVnE@5vnE@OnE@sQnE@V'nE@9"nE@soE@Zd;oE@(\oE@d|oE@ -oE@voE@nVd;oE@QoE@4 pE@H7ApE@MbpE@ݓnpE@9 ףpE@ߥpE@A`pE@i+$qE@Lx&qE@/wGqE@rhqE@K7qE@hqE@qE@qE@ZI rE@dV-rE@GMrE@*LnrE@ (\rE@ rE@=`rE@rE@nsE@|/333sE@_SsE@B{jtsE@%!sE@ǡEsE@l= sE@sE@ttE@^X9tE@wZtE@ZGztE@=P㥛tE@ ~jtE@/tE@AtE@QuE@|?uE@3A`uE@r$uE@UʡuE@8%\uE@SuE@pvE@/$vE@ļʡEvE@bfffvE@+vE@mvE@PT9vE@3xvE@p= wE@E +wE@KwE@ClwE@7OwE@zwE@hwE@K)wE@.MbxE@u&1xE@QxE@ rxE@ftxE@ X9xE@xE@cXxE@F*yE@)K7yE@ JbXyE@xyE@ҕyE@;5^yE@"yE@{lyE@^-zE@Aӣp=zE@$y?5^zE@~zE@vzE@jzE@GzE@I {E@v\"{E@YC{E@<Zd{E@N{E@S{E@{E@?l{E@&1|E@(|E@q1^I|E@T~j|E@7}C|E@#1|E@|E@nh|E@V}E@/}E@`;O}E@lףp}E@Orh}E@2R-}E@}E@E}E@Cz~E@|?5~E@V~E@5v~E@gO~E@JQ~E@-'~E@"~E@rE@Zd;E@(\E@d|E@ -E@bvE@EVd;E@(E@ E@G7AE@MbE@nE@9 ףE@zߥĀE@]A`E@@+$E@#x&E@wGE@rhE@K7E@hE@ʁE@uE@XZI E@;V-E@ME@LnE@(\E@Ǘ E@=`ЂE@E@pnE@S/333E@6SE@{jtE@ E@ơEE@l= ׃E@E@tE@k^X9E@NZE@1GzE@P㥛E@~jE@ڛ/݄E@AE@QE@|?E@f3A`E@I$E@,ʡE@%\…E@SE@pE@/$E@ʡEE@~bfffE@a+E@D阮E@'T9ȆE@ xE@p= E@E +E@KE@ClE@y7OE@\zE@?·E@")E@MbE@t&1E@QE@ rE@ftE@t X9E@WԈE@:XE@*E@K7E@IbXE@xE@E@;5^E@o"ۉE@RlE@5-E@ӣp=E@x?5^E@~E@vE@jE@GE@jI E@M\"E@0CE@ZdE@ME@S㥋E@ƋE@?lE@&1E@e(E@H1^IE@+~jE@}CE@"1E@̌E@nhE@VE@}/E@``;OE@CףpE@&rhE@ R-E@ҍE@ϝEE@CzE@|?5E@xVE@[5vE@>OE@!QE@'َE@"E@rE@Zd;E@(\E@sd|E@V -E@9vE@Vd;ߏE@E@⡛ E@G7AE@MbE@nE@n9 ףE@QߥĐE@4A`E@+$E@x&E@vGE@rhE@K7E@hE@iʑE@LE@/ZI E@V-E@ME@KnE@(\E@ E@=`ВE@dE@GnE@*/333E@ SE@zjtE@ E@ơEE@l= דE@|E@_tE@B^X9E@%ZE@GzE@O㥛E@~jE@/ݔE@AE@wQE@Z|?E@=3A`E@ $E@ʡE@$\•E@SE@pE@/$E@rʡEE@UbfffE@8+E@淪E@S9ȖE@xE@ğp= E@E +E@KE@mClE@P7OE@3zE@ΗE@(E@MbE@t&1E@QE@ rE@hftE@K X9E@.ԘE@XE@*E@ףK7E@IbXE@xE@E@c;5^E@F"ۙE@)lE@ -E@ңp=E@x?5^E@~E@vE@{jE@^GE@AI E@$\"E@CE@ZdE@ME@S㥛E@ƛE@v?lE@Y&1E@<(E@1^IE@~jE@|CE@"1E@̜E@nhE@qVE@T/E@7`;OE@ףpE@rhE@Q-E@ҝE@EE@CzE@l|?5E@OVE@25vE@OE@QE@&ٞE@"E@rE@Zd;E@g(\E@Jd|E@- -E@vE@Ud;ߟE@E@ E@G7AE@MbE@bnE@E9 ףE@(ߥĠE@ A`E@*$E@x&E@vGE@rhE@zK7E@]hE@@ʡE@#E@ZI E@U-E@̥ME@KnE@(\E@u E@X=`ТE@;E@nE@/333E@SE@zjtE@ E@ơEE@pl= ףE@SE@6tE@^X9E@ZE@ߩGzE@O㥛E@~jE@/ݤE@kAE@NQE@1|?E@3A`E@$E@~ʡE@$\¥E@SE@pE@f/$E@IʡEE@,bfffE@+E@罹E@S9ȦE@xE@p= E@~E +E@aKE@DClE@'7OE@ zE@ΧE@(E@MbE@t&1E@yQE@\ rE@?ftE@" X9E@ԨE@WE@*E@K7E@IbXE@txE@WE@:;5^E@"۩E@lE@,E@ңp=E@x?5^E@~E@ovE@RjE@5GE@I E@["E@CE@ZdE@ME@S㥫E@jƫE@M?lE@0&1E@(E@0^IE@~jE@|CE@"1E@̬E@enhE@HVE@+/E@`;OE@ףpE@ԫrhE@Q-E@ҭE@}EE@`CzE@C|?5E@&VE@ 5vE@OE@πQE@&ٮE@"E@xrE@[Zd;E@>(\E@!d|E@ -E@vE@Ud;߯E@E@ E@sG7AE@VMbE@9nE@9 ףE@ޥİE@A`E@*$E@x&E@vGE@nrhE@QK7E@4hE@ʱE@E@YI E@U-E@ME@KnE@i(\E@L E@/=`вE@E@nE@.333E@SE@zjtE@ E@dơEE@Gl= ׳E@*E@ tE@]X9E@ZE@GzE@O㥛E@|~jE@_/ݴE@BAE@%QE@|?E@2A`E@$E@~ʡE@$\µE@wSE@ZpE@=/$E@ ʡEE@bfffE@+E@ɭ臨E@S9ȶE@xE@rp= E@UE +E@8KE@ClE@6OE@zE@ĂηE@(E@MbE@mt&1E@PQE@3 rE@ftE@ X9E@ܱԸE@WE@*E@K7E@hIbXE@KxE@.E@;5^E@"۹E@׆lE@,E@ңp=E@x?5^E@c~E@FvE@)jE@ GE@I E@["E@CE@ZdE@{ME@^S㥻E@AƻE@$?lE@&1E@(E@0^IE@~jE@|CE@v"1E@Y̼E@lE@&1E@(E@0^IE@~jE@j|CE@M"1E@0E@nhE@VE@ٹ/E@_;OE@ףpE@rhE@eQ-E@HE@+EE@CzE@|?5E@ԎVE@4vE@OE@}QE@`&E@C"E@&rE@ Zd;E@(\E@c|E@ -E@vE@xUd;E@[E@> E@!G7AE@MbE@nE@8 ףE@ޥE@A`E@s*$E@Vx&E@9vGE@rhE@K7E@gE@ E@E@YI E@nU-E@QME@4KnE@(\E@ E@<`E@E@nE@.333E@iSE@LzjtE@/ E@ơEE@k= E@E@tE@]X9E@ZE@dGzE@GO㥛E@*~jE@ /E@@E@QE@|?E@2A`E@|$E@_~ʡE@B$\E@%SE@pE@/$E@λʡEE@afffE@+E@wE@ZS9E@=xE@ p= E@E +E@KE@ɐClE@6OE@zE@rE@U(E@8MbE@t&1E@QE@ rE@etE@ X9E@E@mWE@P*E@3K7E@IbXE@xE@ܔE@:5^E@"E@lE@h,E@Kңp=E@.x?5^E@~E@vE@iE@GE@I E@["E@cCE@FZdE@)ME@ SE@E@>lE@&1E@(E@{0^IE@^~jE@A|CE@$"1E@E@mhE@VE@/E@_;OE@vףpE@YrhE@lE@&1E@o(E@R0^IE@5~jE@|CE@!1E@E@mhE@VE@/E@j_;OE@MףpE@0rhE@Q-E@E@ٜEE@BzE@|?5E@VE@e4vE@HOE@+QE@&E@"E@qE@Zd;E@(\E@}c|E@` -E@CvE@&Ud;E@ E@젛 E@F7AE@MbE@nE@x8 ףE@[ޥE@>A`E@!*$E@x&E@uGE@rhE@K7E@gE@s E@VE@9YI E@U-E@ME@JnE@(\E@ E@<`E@nE@QnE@4.333E@SE@yjtE@E@šEE@k= E@E@itE@L]X9E@/ZE@GzE@N㥛E@~jE@/E@@E@QE@d|?E@G2A`E@*$E@ ~ʡE@#\E@SE@oE@/$E@|ʡEE@_afffE@B+E@%E@S9E@xE@Ξp= E@D +E@KE@wClE@Z6OE@=zE@ E@(E@MbE@s&1E@QE@ rE@retE@U X9E@8E@WE@*E@K7E@HbXE@xE@E@m:5^E@P"E@3lE@,E@ѣp=E@w?5^E@~E@vE@iE@hGE@KI E@.["E@CE@ZdE@LE@SE@E@>lE@c&1E@F(E@)0^IE@ ~jE@{CE@!1E@E@mhE@{VE@^/E@A_;OE@$ףpE@rhE@P-E@E@EE@BzE@v|?5E@YVE@<4vE@OE@QE@%E@"E@qE@Zd;E@q(\E@Tc|E@7 -E@vE@Td;E@E@à F@F7AF@MbF@lnF@O8 ףF@2ޥF@A`F@)$F@x&F@uGF@rhF@K7F@ggF@J F@-F@YI F@U-F@֤MF@JnF@(\F@ F@b<`F@EF@(nF@ .333F@SF@yjtF@F@šEF@zk= F@]F@@tF@#]X9F@ZF@GzF@N㥛F@~jF@/F@u@F@XQF@;|?F@2A`F@$F@}ʡF@#\F@SF@oF@p/$F@SʡEF@6afffF@+F@F@R9F@xF@p= F@D +F@kKF@NClF@16OF@zF@F@'F@MbF@s&1F@QF@f rF@IetF@, X9F@F@VF@* F@K7 F@HbX F@~x F@a F@D:5^ F@'" F@ l F@+ F@ѣp= F@w?5^ F@~ F@yv F@\i F@?G F@"I  F@[" F@C F@˦Zd F@L F@S F@t F@W>l F@:&1 F@( F@0^I F@~j F@{C F@!1 F@ F@omh F@RV F@5/ F@_;O F@ףp F@ުrh F@P- F@ F@E F@jBzF@M|?5F@0VF@4vF@OF@QF@%F@"F@qF@eZd;F@H(\F@+c|F@ -F@vF@Td;F@F@ F@}F7AF@`MbF@CnF@&8 ףF@ ޥF@A`F@)$F@x&F@uGF@xrhF@[K7F@>gF@! F@F@XI F@U-F@MF@JnF@s(\F@V F@9<`F@F@nF@-333F@SF@yjtF@F@nšEF@Qk= F@4F@tF@\X9F@ZF@GzF@N㥛F@~jF@i/F@L@F@/QF@|?F@1A`F@$F@}ʡF@#\F@SF@doF@G/$F@*ʡEF@ afffF@+F@ӬF@R9F@xF@|p= F@_D +F@BKF@%ClF@6OF@zF@΁F@'F@MbF@ws&1F@ZQF@= rF@ etF@ X9F@F@VF@*F@K7F@rHbXF@UxF@8F@:5^F@"F@lF@+F@ѣp=F@w?5^F@m~F@PvF@3iF@GF@I F@Z"F@CF@ZdF@LF@hSF@KF@.>lF@&1F@(F@/^IF@~jF@{CF@!1F@cF@FmhF@)VF@ /F@^;OF@ףpF@rhF@P-F@{F@^EF@ABzF@$|?5F@VF@3vF@OF@QF@%F@v"F@YqF@<Zd;F@(\F@c|F@-F@ȮvF@Td;F@F@q F@TF7A F@7Mb F@n F@7 ף F@ݥ F@ÃA` F@)$!F@x&!F@luG!F@Orh!F@2K7!F@g!F@ !F@۲!F@XI "F@U-"F@M"F@gJn"F@J(\"F@- "F@<`"F@"F@ևn#F@-333#F@S#F@yjt#F@b#F@EšE#F@(k= #F@ #F@t$F@\X9$F@Z$F@Gz$F@zN㥛$F@]~j$F@@/$F@#@$F@Q%F@|?%F@1A`%F@$%F@}ʡ%F@u#\%F@XS%F@;o&F@/$&F@ʡE&F@`fff&F@+&F@&F@R9&F@px&F@Sp= 'F@6D +'F@K'F@Cl'F@5O'F@z'F@'F@''F@kMb(F@Ns&1(F@1Q(F@ r(F@dt(F@ X9(F@(F@V(F@*)F@fK7)F@IHbX)F@,x)F@)F@95^)F@")F@l)F@+*F@~ѣp=*F@aw?5^*F@D~*F@'v*F@ i*F@G*F@дI +F@Z"+F@C+F@yZd+F@\L+F@?S+F@"+F@>l+F@&1,F@ˉ(,F@/^I,F@~j,F@t{C,F@W!1,F@:,F@mh,F@V-F@㸟/-F@^;O-F@ףp-F@rh-F@oP--F@R-F@5E-F@Bz.F@|?5.F@ލV.F@3v.F@O.F@Q.F@j%.F@M".F@0q/F@Zd;/F@(\/F@b|/F@-/F@v/F@Td;/F@e/F@H 0F@+F7A0F@Mb0F@n0F@7 ף0F@ݥ0F@A`0F@})$1F@`x&1F@CuG1F@&rh1F@ K71F@f1F@ 1F@1F@XI 2F@xU-2F@[M2F@>Jn2F@!(\2F@ 2F@;`2F@2F@n3F@-3333F@sS3F@Vyjt3F@93F@šE3F@j= 3F@3F@Ŷt4F@\X94F@Z4F@nGz4F@QN㥛4F@4~j4F@/4F@?4F@Q5F@|?5F@1A`5F@$5F@i}ʡ5F@L#\5F@/S5F@o6F@/$6F@غʡE6F@`fff6F@+6F@6F@dR96F@Gx6F@*p= 7F@ D +7F@K7F@ӏCl7F@5O7F@z7F@|7F@_'7F@BMb8F@%s&18F@Q8F@ r8F@dt8F@ X98F@8F@wV8F@Z*9F@=K79F@ HbX9F@x9F@擙9F@95^9F@"9F@l9F@r+:F@Uѣp=:F@8w?5^:F@~:F@v:F@h:F@G:F@I ;F@Z";F@mC;F@PZd;F@3L;F@S;F@;F@=l;F@&1F@|?5>F@V>F@3v>F@{O>F@^Q>F@A%>F@$">F@q?F@Zd;?F@ͼ(\?F@b|?F@-?F@vv?F@YTd;?F@-333SF@!SSF@yjtSF@SF@ġESF@j= SF@SF@stTF@V\X9TF@9ZTF@GzTF@M㥛TF@~jTF@ř/TF@?TF@QUF@n|?UF@Q1A`UF@4$UF@}ʡUF@"\UF@SUF@nVF@/$VF@ʡEVF@i`fffVF@L+VF@/VF@R9VF@xVF@؝p= WF@C +WF@KWF@ClWF@d5OWF@GzWF@*WF@ 'WF@MbXF@r&1XF@QXF@ rXF@|dtXF@_ X9XF@BXF@%VXF@*YF@K7YF@GbXYF@xYF@YF@w95^YF@Z"YF@=lYF@ +ZF@ѣp=ZF@v?5^ZF@~ZF@vZF@hZF@rGZF@UI [F@8Z"[F@C[F@Zd[F@K[F@S[F@[F@=l[F@m&1\F@P(\F@3/^I\F@~j\F@zC\F@ 1\F@\F@lh\F@V]F@h/]F@K^;O]F@.ףp]F@rh]F@O-]F@]F@E]F@Az^F@|?5^F@cV^F@F3v^F@)O^F@ Q^F@$^F@"^F@p_F@Zd;_F@{(\_F@^b|_F@A-_F@$v_F@Td;_F@_F@͟ `F@E7A`F@Mb`F@vn`F@Y7 ף`F@<ݥ`F@A``F@)$aF@x&aF@tGaF@rhaF@K7aF@qfaF@T aF@7aF@XI bF@U-bF@MbF@InbF@(\bF@ bF@l;`bF@ObF@2ncF@-333cF@ScF@xjtcF@cF@ġEcF@j= cF@gcF@JtdF@-\X9dF@ZdF@GzdF@M㥛dF@~jdF@/dF@?dF@bQeF@E|?eF@(1A`eF@ $eF@|ʡeF@"\eF@SeF@nfF@z/$fF@]ʡEfF@@`ffffF@#+fF@fF@Q9fF@xfF@p= gF@C +gF@uKgF@XClgF@;5OgF@zgF@gF@&gF@MbhF@r&1hF@QhF@p rhF@SdthF@6 X9hF@hF@UhF@*iF@¡K7iF@GbXiF@xiF@kiF@N95^iF@1"iF@liF@*jF@Уp=jF@v?5^jF@~jF@vjF@fhjF@IGjF@,I kF@Z"kF@CkF@եZdkF@KkF@SkF@~kF@a=lkF@D&1lF@'(lF@ /^IlF@~jlF@zClF@ 1lF@lF@ylhlF@\VmF@?/mF@"^;OmF@ףpmF@rhmF@O-mF@mF@EmF@tAznF@W|?5nF@:VnF@3vnF@OnF@~QnF@$nF@"nF@poF@oZd;oF@R(\oF@5b|oF@-oF@voF@Sd;oF@oF@ pF@E7ApF@jMbpF@MnpF@07 ףpF@ݥpF@A`pF@($qF@x&qF@tGqF@rhqF@eK7qF@HfqF@+ qF@qF@WI rF@U-rF@MrF@InrF@}(\rF@` rF@C;`rF@&rF@ nsF@,333sF@SsF@xjtsF@sF@xġEsF@[j= sF@>sF@!ttF@\X9tF@ZtF@ʧGztF@M㥛tF@~jtF@s/tF@V?tF@9QuF@|?uF@0A`uF@$uF@|ʡuF@"\uF@SuF@nnvF@Q/$vF@4ʡEvF@`fffvF@+vF@ݫvF@Q9vF@xvF@p= wF@iC +wF@LKwF@/ClwF@5OwF@zwF@؀wF@&wF@MbxF@r&1xF@dQxF@G rxF@*dtxF@ X9xF@xF@UxF@*yF@K7yF@|GbXyF@_xyF@ByF@%95^yF@"yF@lyF@*zF@Уp=zF@v?5^zF@w~zF@ZvzF@=hzF@ GzF@I {F@Y"{F@C{F@Zd{F@K{F@rS{F@U{F@8=l{F@&1|F@(|F@.^I|F@~j|F@zC|F@ 1|F@m|F@Plh|F@3V}F@/}F@];O}F@ףp}F@rh}F@O-}F@}F@hE}F@KAz~F@.|?5~F@V~F@2v~F@O~F@~Q~F@$~F@"~F@cpF@FZd;F@)(\F@ b|F@-F@ҭvF@Sd;F@F@{ F@^E7AF@AMbF@$nF@7 ףF@ܥĀF@͂A`F@($F@x&F@vtGF@YrhF@~jF@!/ݔF@?F@QF@ʊ|?F@0A`F@$F@s|ʡF@V"\•F@9SF@nF@/$F@ʡEF@_fffF@+F@淪F@nQ9ȖF@QxF@4p= F@C +F@KF@ݎClF@4OF@zF@ΗF@i&F@LMbF@/r&1F@QF@ rF@ctF@ X9F@ԘF@UF@d*F@GK7F@*GbXF@ xF@𒙙F@85^F@"ۙF@lF@|*F@_Уp=F@Bv?5^F@%~F@vF@gF@ GF@I F@Y"F@wCF@ZZdF@=KF@ S㥛F@ƛF@F@QF@|?F@0A`F@g$F@J|ʡF@-"\¥F@SF@mF@/$F@ʡEF@_fffF@+F@b罹F@EQ9ȦF@(xF@ p= F@B +F@KF@ClF@4OF@zzF@]ΧF@@&F@#MbF@r&1F@QF@̽ rF@ctF@ X9F@uԨF@XUF@;*F@K7F@GbXF@xF@ǒF@85^F@"۩F@plF@S*F@6Уp=F@v?5^F@~F@vF@gF@ GF@I F@kY"F@NCF@1ZdF@KF@S㥫F@ږƫF@F@QF@x|?F@[0A`F@>$F@!|ʡF@"\µF@SF@mF@/$F@ʡEF@s_fffF@V+F@9臨F@Q9ȶF@xF@p= F@B +F@KF@ClF@n4OF@QzF@4ηF@&F@MbF@q&1F@QF@ rF@ctF@i X9F@LԸF@/UF@*F@K7F@FbXF@xF@F@85^F@d"۹F@GlF@**F@ Уp=F@u?5^F@~F@vF@gF@| GF@_I F@BY"F@%CF@ZdF@JF@S㥻F@ƻF@F@lQF@O|?F@20A`F@$F@{ʡF@!\F@SF@mF@/$F@gʡEF@J_fffF@-+F@F@P9F@xF@p= F@B +F@KF@bClF@E4OF@(zF@ F@%F@MbF@q&1F@QF@z rF@]ctF@@ X9F@#F@UF@*F@̠K7F@FbXF@xF@uF@X85^F@;"F@lF@*F@ϣp=F@u?5^F@~F@vF@pgF@S GF@6I F@Y"F@CF@ߤZdF@JF@SF@F@kF@CQF@&|?F@ 0A`F@$F@{ʡF@!\F@SF@xmF@[/$F@>ʡEF@!_fffF@+F@窝F@P9F@xF@p= F@sB +F@VKF@9ClF@4OF@zF@F@%F@MbF@q&1F@nQF@Q rF@4ctF@ X9F@F@TF@*F@K7F@FbXF@ixF@LF@/85^F@"F@lF@)F@ϣp=F@u?5^F@~F@dvF@GgF@* GF@ I F@X"F@CF@ZdF@JF@|SF@_F@BF@QF@|?F@/A`F@$F@{ʡF@!\F@lSF@OmF@2/$F@ʡEF@^fffF@+F@F@P9F@xF@gp= F@JB +F@-KF@ClF@3OF@zF@F@%F@MbF@bq&1F@EQF@( rF@ ctF@X9F@ѮF@TF@*F@zK7F@]FbXF@@xF@#F@85^F@"F@̃lF@)F@ϣp=F@uu?5^F@X~F@;vF@gF@ GF@I F@X"F@CF@ZdF@pJF@SSF@6F@F@QF@ԉ|?F@/A`F@$F@}{ʡF@`!\F@CSF@&mF@ /$F@ʡEF@^fffF@+F@F@xP9F@[xF@>p= F@!B +F@KF@ClF@3OF@zF@F@s%F@VMbF@9q&1F@QF@ rF@btF@X9F@F@TF@n*F@QK7F@4FbXF@xF@F@75^F@"F@lF@)F@iϣp=F@Lu?5^F@/~F@vF@fF@ GF@I F@X"F@CF@dZdF@GJF@*SF@ F@;lF@&1F@(F@-^IF@|~jF@_yCF@B1F@%F@khF@VF@ζ/F@\;OF@ףpF@wrhF@ZN-F@=F@ EF@@zF@|?5F@ɋVF@1vF@OF@r}QF@U#F@8"F@oF@Zd;F@(\F@`|F@-F@vF@mRd;F@PF@3 G@D7AG@MbG@܏nG@5 ףG@ۥG@A`G@h'$G@Kx&G@.sGG@rhG@K7G@dG@ G@G@VI G@cU-G@FMG@)HnG@ (\G@ G@9`G@G@nG@{+333G@^SG@AwjtG@$G@áEG@h= G@G@tG@ZX9G@vZG@YGzG@G@!%G@MbG@p&1G@QG@ rG@btG@sX9G@VG@9TG@*G@K7G@EbXG@xG@G@75^G@n"G@QlG@4)G@ϣp=G@t?5^G@~G@vG@fG@ GG@iI G@LX"G@/CG@ZdG@IG@SG@G@;lG@&1G@d(G@G-^IG@*~jG@ yCG@1G@G@jhG@VG@|/G@_\;OG@BףpG@%rhG@N-G@G@ΙEG@?zG@|?5G@wVG@Z1vG@=OG@ }QG@#G@"G@nG@Zd;G@(\G@r`|G@U-G@8vG@Rd;G@G@᝛ G@C7A G@Mb G@n G@m5 ף G@Pۥ G@3A` G@'$!G@x&!G@rG!G@rh!G@K7!G@d!G@h !G@K!G@.VI "G@U-"G@M"G@Gn"G@(\"G@ "G@9`"G@c"G@Fn#G@)+333#G@ S#G@vjt#G@#G@¡E#G@h= #G@{#G@^t$G@AZX9$G@$Z$G@Gz$G@K㥛$G@~j$G@/$G@=$G@vQ%G@Y|?%G@bt8G@!X98G@8G@S8G@*9G@K79G@EbX9G@sx9G@V9G@975^9G@"9G@l9G@(:G@Σp=:G@t?5^:G@~:G@nv:G@Qf:G@4 G:G@I ;G@W";G@C;G@Zd;G@I;G@S;G@i;G@L;l;G@/&1G@B|?5>G@%V>G@1v>G@O>G@|Q>G@">G@">G@wn?G@ZZd;?G@=(\?G@ `|?G@-?G@v?G@Qd;?G@?G@ @G@rC7A@G@UMb@G@8n@G@5 ף@G@ڥ@G@A`@G@&$AG@x&AG@rGAG@mrhAG@PK7AG@3dAG@ AG@AG@UI BG@U-BG@MBG@GnBG@h(\BG@K BG@.9`BG@BG@nCG@*333CG@SCG@vjtCG@CG@c¡ECG@Fh= CG@)CG@ tDG@YX9DG@ZDG@GzDG@K㥛DG@{~jDG@^/DG@A=DG@$QEG@|?EG@.A`EG@$EG@zʡEG@ \EG@vSEG@YlFG@</$FG@ʡEFG@^fffFG@+FG@ȩFG@O9FG@xFG@qp= GG@TA +GG@7KGG@ClGG@2OGG@zGG@~GG@$GG@MbHG@lp&1HG@OQHG@2 rHG@btHG@X9HG@ۭHG@SHG@*IG@K7IG@gEbXIG@JxIG@-IG@75^IG@"IG@ւlIG@(JG@Σp=JG@t?5^JG@b~JG@EvJG@(fJG@ GJG@I KG@W"KG@CKG@ZdKG@zIKG@]SKG@@KG@#;lKG@&1LG@(LG@,^ILG@~jLG@xCLG@u1LG@XLG@;jhLG@VMG@/MG@[;OMG@ףpMG@rhMG@M-MG@pMG@SEMG@6?zNG@|?5NG@VNG@0vNG@ONG@|QNG@"NG@k"NG@NnOG@1Zd;OG@(\OG@_|OG@-OG@vOG@Qd;OG@OG@f PG@IC7APG@,MbPG@nPG@4 ףPG@ڥPG@A`PG@&$QG@~x&QG@arGQG@DrhQG@'K7QG@ dQG@ QG@ЯQG@UI RG@U-RG@yMRG@\GnRG@?(\RG@" RG@9`RG@RG@˄nSG@*333SG@SSG@tvjtSG@WSG@:¡ESG@h= SG@SG@tTG@YX9TG@ZTG@GzTG@oK㥛TG@R~jTG@5/TG@=TG@QUG@ވ|?UG@.A`UG@$UG@zʡUG@j \UG@MSUG@0lVG@/$VG@ʡEVG@]fffVG@+VG@VG@O9VG@exVG@Hp= WG@+A +WG@KWG@ClWG@2OWG@zWG@~WG@}$WG@`MbXG@Cp&1XG@&QXG@ rXG@atXG@X9XG@XG@SXG@x*YG@[K7YG@>EbXYG@!xYG@YG@65^YG@"YG@lYG@(ZG@sΣp=ZG@Vt?5^ZG@9~ZG@vZG@eZG@ GZG@űI [G@W"[G@C[G@nZd[G@QI[G@4S[G@[G@:l[G@&1\G@(\G@,^I\G@~j\G@ixC\G@L1\G@/\G@jh\G@V]G@ص/]G@[;O]G@ףp]G@rh]G@dM-]G@G]G@*E]G@ ?z^G@|?5^G@ӊV^G@0v^G@O^G@||Q^G@_"^G@B"^G@%n_G@Zd;_G@(\_G@_|_G@-_G@v_G@wQd;_G@Z_G@= `G@ C7A`G@Mb`G@n`G@4 ף`G@ڥ`G@A``G@r&$aG@Ux&aG@8rGaG@rhaG@K7aG@caG@ aG@aG@UI bG@mU-bG@PMbG@3GnbG@(\bG@ bG@8`bG@bG@ncG@*333cG@hScG@KvjtcG@.cG@¡EcG@g= cG@ cG@tdG@YX9dG@ZdG@cGzdG@FK㥛dG@)~jdG@ /dG@znG@|?5nG@VnG@0vnG@pOnG@S|QnG@6"nG@"nG@moG@Zd;oG@¹(\oG@_|oG@-oG@kvoG@NQd;oG@1oG@ pG@B7ApG@MbpG@npG@4 ףpG@ڥpG@fA`pG@I&$qG@,x&qG@rGqG@rhqG@սK7qG@cqG@ qG@~qG@aUI rG@DU-rG@'MrG@ GnrG@(\rG@В rG@8`rG@rG@ynsG@\*333sG@?SsG@"vjtsG@sG@EsG@g= sG@ sG@ttG@tYX9tG@WZtG@:GztG@K㥛tG@~jtG@/tG@(zG@!Σp=zG@t?5^zG@~zG@ʿvzG@ezG@ GzG@sI {G@VW"{G@9C{G@Zd{G@H{G@S{G@Ŕ{G@:l{G@&1|G@n(|G@Q,^I|G@4~j|G@xC|G@1|G@|G@ih|G@V}G@/}G@i[;O}G@Lףp}G@/rh}G@M-}G@}G@ؘE}G@>z~G@|?5~G@V~G@d0v~G@GO~G@*|Q~G@ "~G@"~G@mG@Zd;G@(\G@|_|G@_-G@BvG@%Qd;G@G@뜛 G@B7AG@MbG@nG@w4 ףG@ZڥĀG@=A`G@ &$G@x&G@qGG@rhG@K7G@cG@r ʁG@UG@8UI G@U-G@MG@FnG@(\G@ G@8`ЂG@mG@PnG@3*333G@SG@ujtG@G@EG@g= ׃G@ G@htG@KYX9G@.ZG@GzG@J㥛G@~jG@/݄G@zG@u|?5G@XVG@;0vG@OG@|QG@!َG@"G@mG@Zd;G@p(\G@S_|G@6-G@vG@Pd;ߏG@G@œ G@B7AG@MbG@knG@N4 ףG@1ڥĐG@A`G@%$G@x&G@qGG@rhG@K7G@fcG@I ʑG@,G@UI G@U-G@ՠMG@FnG@(\G@~ G@a8`ВG@DG@'nG@ *333G@SG@ujtG@G@EG@yg= דG@\ G@?tG@"YX9G@ZG@GzG@J㥛G@~jG@/ݔG@t GG@!I G@W"G@CG@ʢZdG@HG@S㥛G@sƛG@V:lG@9&1G@(G@+^IG@~jG@wCG@1G@̜G@nihG@QVG@4/G@[;OG@ףpG@ݦrhG@L-G@ҝG@EG@i>zG@L|?5G@/VG@0vG@OG@{QG@!ٞG@"G@mG@dZd;G@G(\G@*_|G@ -G@vG@Pd;ߟG@G@ G@|B7AG@_MbG@BnG@%4 ףG@ڥĠG@A`G@%$G@x&G@qGG@wrhG@ZK7G@=cG@ ʡG@G@TI G@U-G@MG@FnG@r(\G@U G@88`ТG@G@nG@)333G@SG@ujtG@G@mEG@Pg= ףG@3 G@tG@XX9G@ZG@GzG@J㥛G@~jG@h/ݤG@KzG@#|?5G@VG@/vG@OG@{QG@!ٮG@u"G@XmG@;Zd;G@(\G@_|G@-G@ǪvG@Pd;߯G@G@p G@SB7AG@6MbG@nG@3 ףG@٥İG@A`G@%$G@x&G@kqGG@NrhG@1K7G@cG@ʱG@ڮG@TI G@U-G@MG@fFnG@I(\G@, G@8`вG@G@ՃnG@)333G@SG@~ujtG@aG@DEG@'g= ׳G@ G@tG@XX9G@ZG@GzG@yJ㥛G@\~jG@?/ݴG@"S㥻G@!ƻG@:lG@&1G@ʅ(G@+^IG@~jG@swCG@V1G@9̼G@ihG@VG@ⴟ/G@Z;OG@ףpG@rhG@nL-G@QҽG@4EG@>zG@|?5G@݉VG@/vG@OG@{QG@i!پG@L"G@/mG@Zd;G@(\G@^|G@-G@vG@Pd;߿G@dG@G G@*B7AG@ MbG@nG@3 ףG@٥G@A`G@|%$G@_x&G@BqGG@%rhG@K7G@bG@G@G@TI G@wU-G@ZMG@=FnG@ (\G@ G@7`G@G@nG@)333G@rSG@UujtG@8G@EG@f= G@ G@IJtG@XX9G@ZG@mGzG@PJ㥛G@3~jG@/G@;G@QG@|?G@-A`G@$G@hyʡG@K\G@.SG@kG@/$G@׶ʡEG@\fffG@+G@G@cN9G@FxG@)p= G@ @ +G@KG@ҋClG@1OG@zG@{}G@^#G@AMbG@$o&1G@QG@ rG@`tG@X9G@G@vRG@Y*G@~jG@!wCG@1G@G@hhG@VG@/G@sZ;OG@VףpG@9rhG@L-G@G@EG@=zG@|?5G@VG@n/vG@QOG@4{QG@!G@"G@lG@Zd;G@(\G@^|G@i-G@LvG@/Pd;G@G@ G@A7AG@MbG@nG@3 ףG@d٥G@GA`G@*%$G@ x&G@pGG@rhG@K7G@bG@|G@_G@BTI G@%U-G@MG@EnG@(\G@ G@7`G@wG@ZnG@=)333G@ SG@ujtG@G@EG@f= G@ G@rtG@UXX9G@8ZG@GzG@I㥛G@~jG@ĕ/G@;G@QG@m|?G@P-A`G@3$G@yʡG@\G@SG@jG@/$G@ʡEG@h\fffG@K+G@.G@N9G@xG@יp= G@? +G@KG@ClG@c1OG@FzG@)}G@ #G@MbG@n&1G@QG@ rG@{`tG@^X9G@AG@$RG@*G@K7G@CbXG@xG@G@v55^G@Y"G@/G@!Z;OG@ףpG@rhG@K-G@G@EG@s=zG@V|?5G@9VG@/vG@OG@zQG@ G@"G@lG@nZd;G@Q(\G@4^|G@-G@vG@Od;G@G@ H@A7AH@iMbH@LnH@/3 ףH@٥H@~A`H@$$H@x&H@pGH@rhH@dK7H@GbH@*H@ H@SI H@U-H@MH@EnH@|(\H@_ H@B7`H@%H@nH@(333H@SH@tjtH@H@wEH@Zf= H@= H@ tH@XX9H@ZH@ɣGzH@I㥛H@~jH@r/H@U;H@8QH@|?H@,A`H@$H@xʡH@\H@SH@mjH@P/$H@3ʡEH@\fffH@+H@ܧH@M9H@xH@p= H@h? +H@KKH@.ClH@1OH@zH@|H@"H@MbH@n&1H@cQH@F rH@)`tH@ X9H@H@QH@* H@K7 H@{CbX H@^x H@A H@$55^ H@" H@l H@& H@̣p= H@r?5^ H@v~ H@Yv H@EH@!=zH@|?5H@VH@.vH@OH@zQH@s H@V"H@9lH@Zd;H@(\H@]|H@-H@vH@Od;H@nH@Q H@4A7A H@Mb H@n H@2 ף H@إ H@~A` H@$$!H@ix&!H@LpG!H@/rh!H@K7!H@a!H@!H@!H@SI "H@U-"H@dM"H@GEn"H@*(\"H@ "H@6`"H@"H@n#H@(333#H@|S#H@_tjt#H@B#H@%E#H@f= #H@ #H@αt$H@WX9$H@Z$H@wGz$H@ZI㥛$H@=~j$H@ /$H@;$H@Q%H@Ɇ|?%H@,A`%H@$%H@rxʡ%H@U\%H@8S%H@j&H@/$&H@ʡE&H@[fff&H@+&H@&H@mM9&H@Px&H@3p= 'H@? +'H@K'H@܊Cl'H@0O'H@z'H@|'H@h"'H@KMb(H@.n&1(H@Q(H@ r(H@_t(H@X9(H@(H@Q(H@c*)H@FK7)H@)CbX)H@ x)H@)H@45^)H@")H@l)H@{&*H@^̣p=*H@Ar?5^*H@$~*H@v*H@c*H@ G*H@I +H@U"+H@vC+H@YZd+H@ +7H@K7H@Cl7H@0O7H@yz7H@\|7H@?"7H@"Mb8H@n&18H@Q8H@˹ r8H@_t8H@X98H@t8H@WQ8H@:*9H@K79H@CbX9H@x9H@Ǝ9H@45^9H@"9H@ol9H@R&:H@5̣p=:H@r?5^:H@~:H@޽v:H@c:H@ G:H@I ;H@jU";H@MC;H@0Zd;H@G;H@S;H@ْ;H@8l;H@&1H@|?5>H@V>H@x.v>H@[O>H@>zQ>H@! >H@">H@k?H@Zd;?H@(\?H@]|?H@s-?H@Vv?H@9Od;?H@?H@ @H@@7A@H@Mb@H@n@H@2 ף@H@nإ@H@Q~A`@H@4$$AH@x&AH@oGAH@rhAH@K7AH@aAH@AH@iAH@LSI BH@/U-BH@MBH@DnBH@(\BH@ BH@6`BH@BH@dnCH@G(333CH@*SCH@ tjtCH@CH@ӿECH@e= CH@ CH@|tDH@_WX9DH@BZDH@%GzDH@I㥛DH@~jDH@Δ/DH@:DH@QEH@w|?EH@Z,A`EH@=$EH@ xʡEH@\EH@SEH@iFH@/$FH@ʡEFH@r[fffFH@U+FH@8FH@M9FH@xFH@p= GH@> +GH@KGH@ClGH@m0OGH@PzGH@3|GH@"GH@MbHH@m&1HH@QHH@ rHH@_tHH@hX9HH@KHH@.QHH@*IH@K7IH@BbXIH@xIH@IH@45^IH@c"IH@FlIH@)&JH@ ̣p=JH@q?5^JH@~JH@vJH@cJH@{ GJH@^I KH@AU"KH@$CKH@ZdKH@FKH@SKH@KH@8lKH@v&1LH@Y(LH@<*^ILH@~jLH@vCLH@1LH@LH@ghLH@ VMH@q/MH@TY;OMH@7֣pMH@rhMH@J-MH@MH@ÖEMH@ +WH@~KWH@aClWH@D0OWH@'zWH@ |WH@!WH@MbXH@m&1XH@QXH@y rXH@\_tXH@?X9XH@"XH@QXH@*YH@˜K7YH@BbXYH@xYH@tYH@W45^YH@:"YH@lYH@&ZH@ˣp=ZH@q?5^ZH@~ZH@vZH@ocZH@R GZH@5I [H@U"[H@C[H@ޠZd[H@F[H@S[H@[H@j8l[H@M&1\H@0(\H@*^I\H@~j\H@uC\H@1\H@\H@gh\H@e V]H@H/]H@+Y;O]H@֣p]H@rh]H@J-]H@]H@E]H@}]|_H@!-_H@v_H@Nd;_H@_H@ `H@@7A`H@sMb`H@Vn`H@92 ף`H@إ`H@}A``H@#$aH@x&aH@oGaH@rhaH@nK7aH@QaaH@4aH@aH@RI bH@U-bH@MbH@DnbH@(\bH@i bH@L6`bH@/bH@ncH@'333cH@ScH@sjtcH@cH@EcH@de= cH@G cH@*tdH@ WX9dH@ZdH@ӢGzdH@H㥛dH@~jdH@|/dH@_:dH@BQeH@%|?eH@,A`eH@$eH@wʡeH@\eH@SeH@wifH@Z/$fH@=ʡEfH@ [ffffH@+fH@榝fH@L9fH@xfH@p= gH@r> +gH@UKgH@8ClgH@0OgH@zgH@{gH@!gH@MbhH@m&1hH@mQhH@P rhH@3_thH@X9hH@hH@PhH@*iH@K7iH@BbXiH@hxiH@KiH@.45^iH@"iH@liH@%jH@ˣp=jH@q?5^jH@~jH@cvjH@FcjH@) GjH@ I kH@T"kH@CkH@ZdkH@FkH@{SkH@^kH@A8lkH@$&1lH@(lH@)^IlH@~jlH@uClH@1lH@vlH@YghlH@< VmH@/mH@Y;OmH@֣pmH@ȤrhmH@J-mH@mH@qEmH@T +wH@,KwH@ClwH@/OwH@zwH@{wH@!wH@~MbxH@am&1xH@DQxH@' rxH@ _txH@X9xH@ЪxH@PxH@*yH@yK7yH@\BbXyH@?xyH@"yH@45^yH@"yH@lyH@%zH@ˣp=zH@tq?5^zH@W~zH@:vzH@czH@ GzH@I {H@T"{H@C{H@Zd{H@oF{H@RS{H@5{H@8l{H@&1|H@ރ(|H@)^I|H@~j|H@uC|H@j1|H@M|H@0gh|H@ V}H@/}H@X;O}H@֣p}H@rh}H@J-}H@e}H@HE}H@+@K7A>@n>@U㥛>@/$>@zG>@K7>@q>@8^I >@M>@(\>@A`>@Tn>@S>@$>@p= >@pt>@7Z>@S㥛>@ş/>@Q>@S7A`>@ʡ>@S>@/$>@offff>@6>@x>@I +>@Cl>@Rz>@->@x&1>@ r>@nX9>@5\>@K7 >@x >@?5^ >@Ql >@ףp= >@"~ >@n >@mI  >@4C >@Q >@ >@&1 >@P5^I >@C >@ >@V >@ld;O >@3rh >@ >@Gz>@V>@OO>@+>@v>@(\>@k->@2Zd;>@ >@Mb>@= ף>@NA`>@x&>@ rh>@l>@j>@1V->@On>@ >@>@M3333>@jt>@ʡE>@>@ibX9>@0Gz>@~j>@E>@|?>@L$>@)\>@t>@ʡE>@h +>@/X9>@p= >@K>@;O>@K>@Mb>@Q>@jt>@g>@.+>@MbX>@>@">@J1>@}?5^>@v>@G>@f`">@-Zd>@S>@Cl>@(>@I~j>@'1>@rh>@/>@e ףp>@,V->@E>@|?5>@9v>@HQ>@">@Zd;>@h|>@dv>@+ >@K7A >@n >@㥛 >@G/$!>@{G!>@K7!>@!>@c^I ">@*M">@(\">@A`">@n#>@FS#>@ %#>@p= #>@t$>@bZ$>@)T㥛$>@/$>@Q%>@~7A`%>@Eʡ%>@ S%>@/$&>@ffff&>@a&>@(x&>@I +'>@Cl'>@}z'>@D-'>@ y&1(>@ r(>@X9(>@`\(>@'K7)>@x)>@?5^)>@|l)>@Cףp=*>@ #~*>@n*>@I +>@_C+>@&R+>@+>@&1,>@{5^I,>@BC,>@ ,>@V->@d;O->@^rh->@%->@Gz.>@V.>@zO.>@A+.>@w/>@(\/>@-/>@]Zd;/>@$ 0>@Mb0>@= ף0>@yA`0>@@x&1>@!rh1>@l1>@1>@\V-2>@#Pn2>@ 2>@2>@x33333>@?jt3>@ˡE3>@3>@bX94>@[Gz4>@"~j4>@E4>@|?5>@w$5>@>)\5>@u6>@ʡE6>@ +6>@ZX96>@!p= 7>@K7>@;O7>@v7>@=Mb8>@Q8>@jt8>@8>@Y+9>@ NbX9>@癙9>@"9>@u1:>@<}?5^:>@v:>@G:>@`";>@XZd;>@S;>@Cl;>@(<>@t~j<>@;'1<>@sh<>@ɾ/=>@ ףp=>@WV-=>@E=>@|?5>>@9v>>@sQ>>@:">>@Zd;?>@h|?>@v?>@V@>@L7A@>@n@>@㥛@>@r/$A>@9{GA>@K7A>@A>@^I B>@UMB>@(\B>@A`B>@nC>@qSC>@8%C>@p= C>@ƼtD>@ZD>@TT㥛D>@/D>@QE>@7A`E>@pʡE>@7SE>@/$F>@ffffF>@F>@SxF>@J +G>@ClG>@zG>@o-G>@6y&1H>@ rH>@X9H>@\H>@RK7I>@xI>@?5^I>@lI>@nףp=J>@5#~J>@nJ>@úI K>@CK>@QRK>@K>@&1L>@5^IL>@mCL>@4L>@VM>@d;OM>@rhM>@PM>@HzN>@ޓVN>@ON>@l+N>@3wO>@(\O>@-O>@Zd;O>@O P>@MbP>@= ףP>@A`P>@kx&Q>@2!rhQ>@lQ>@Q>@V-R>@NPnR>@ R>@R>@3333S>@jjtS>@1ˡES>@S>@bX9T>@GzT>@M~jT>@FT>@ۑ|?U>@$U>@i)\U>@0uV>@ʡEV>@ +V>@X9V>@Lp= W>@KW>@;OW>@W>@hMbX>@/QX>@jtX>@X>@+Y>@KNbXY>@Y>@"Y>@1Z>@g}?5^Z>@.vZ>@GZ>@`"[>@Zd[>@JS[>@Dl[>@؏(\>@~j\>@f'1\>@-sh\>@/]>@ ףp]>@V-]>@IE]>@|?5^>@9v^>@Q^>@e"^>@,Zd;_>@h|_>@v_>@`>@HL7A`>@n`>@㥛`>@/$a>@d{Ga>@+K7a>@a>@^I b>@Mb>@G(\b>@B`b>@Սnc>@Sc>@c%c>@*q= c>@td>@Zd>@T㥛d>@F/d>@ Qe>@7A`e>@ʡe>@bSe>@)/$f>@fffff>@f>@~xf>@EJ +g>@ Clg>@zg>@-g>@ay&1h>@( rh>@X9h>@\h>@}K7i>@Dxi>@ @5^i>@ҋli>@ףp=j>@`#~j>@'oj>@I k>@Ck>@|Rk>@Ck>@ &1l>@5^Il>@Cl>@_l>@&Vm>@d;Om>@rhm>@{m>@BHzn>@ Vn>@On>@+n>@^wo>@%(\o>@-o>@Zd;o>@z p>@AMbp>@> ףp>@ωA`p>@x&q>@]!rhq>@$mq>@q>@V-r>@yPnr>@@ r>@r>@3333s>@jts>@\ˡEs>@#s>@bX9t>@Gzt>@x~jt>@?Ft>@|?u>@$u>@)\u>@[uv>@"ʡEv>@ +v>@X9v>@wp= w>@>Kw>@@̇w>@Mbx>@ZQx>@!ktx>@x>@+y>@vNbXy>@=y>@"y>@1z>@}?5^z>@Yvz>@ Gz>@`"{>@Zd{>@uS{>@@(|>@~j|>@'1|>@Xsh|>@/}>@ ףp}>@V-}>@tE}>@;|?5~>@:v~>@ɅQ~>@"~>@WZd;>@i|>@v>@>@sL7A>@:n>@䥛Ā>@/$>@{G>@VK7>@ʁ>@^I >@M>@r(\>@9B`Ђ>@n>@S>@%>@Uq= ׃>@t>@Z>@T㥛>@q/݄>@8Q>@7A`>@ƃʡ>@S>@T/$>@gfff>@ⲝ阮>@x>@pJ +>@7Cl>@z>@->@y&1>@S r>@X9>@\>@K7>@ox>@6@5^>@l>@ףp=>@#~>@Ro>@I >@C>@R>@nƋ>@5&1>@5^I>@ÁC>@̌>@QV>@e;O>@߰rh>@ҍ>@mHz>@4V>@O>@+َ>@w>@P(\>@->@Zd;ߏ>@ >@lMb>@3> ף>@A`>@x&>@!rh>@Om>@>@V->@Pn>@k >@2>@3333>@jt>@ˡE>@N>@cX9>@ܮGz>@~j>@jF>@1|?>@$>@)\•>@u>@MʡE>@ +>@X9Ȗ>@p= >@iK>@0@Η>@Mb>@Q>@Lkt>@Ԙ>@+>@NbX>@h>@/"ۙ>@1>@}?5^>@v>@KG>@a">@٬Zd>@S㥛>@gDl>@.(>@~j>@'1>@sh>@J/>@ ףp>@V->@E>@f|?5>@-:v>@Q>@">@Zd;>@Ii|>@v>@>@L7A>@en>@,䥛Ġ>@/$>@{G>@K7>@Hʡ>@_I >@֪M>@(\>@dB`Т>@+n>@S>@%>@q= ף>@Gt>@ Z>@T㥛>@/ݤ>@cQ>@*8A`>@ʡ>@S>@/$>@Fgfff>@ 罹>@x>@J +>@bCl>@)z>@->@y&1>@~ r>@EX9>@ ]>@ӨK7>@x>@a@5^>@(l>@ףp=>@#~>@}o>@DI >@ C>@R>@ƫ>@`&1>@'6^I>@C>@̬>@|V>@Ce;O>@ rh>@ҭ>@Hz>@_V>@&O>@+ٮ>@w>@{(\>@B->@ [d;߯>@Ц >@Mb>@^> ף>@%A`>@x&>@!rh>@zm>@A>@V->@Pn>@ >@]>@$4333>@jt>@ˡE>@y>@@cX9>@Gz>@~j>@F>@\|?>@#$>@)\µ>@u>@xʡE>@? +>@Y9ȶ>@ͤp= >@K>@[@"η>@Mb>@Q>@wkt>@>Ը>@+>@NbX>@>@Z"۹>@!2>@}?5^>@v>@vG>@=a">@Zd>@S㥻>@Dl>@Y(>@ ~j>@'1>@sh>@u/>@< ףp>@W->@ʢE>@|?5>@X:v>@Q>@">@Zd;>@ti|>@;v>@>@L7A>@n>@W䥛>@0$>@{G>@K7>@s>@:_I >@M>@(\>@B`>@Vn>@S>@%>@q= >@rt>@9 Z>@U㥛>@Ǡ/>@Q>@U8A`>@ʡ>@S>@/$>@qgfff>@8>@x>@J +>@Cl>@Tz>@.>@y&1>@ r>@pX9>@7]>@K7>@x>@@5^>@Sl>@أp=>@#~>@o>@oI >@6C>@R>@Ğ>@&1>@R6^I>@C>@>@V>@ne;O>@5rh>@>@Hz>@V>@QO>@,>@w>@(\>@m->@4[d;>@ >@Mb>@> ף>@PA`>@x&>@!rh>@m>@l>@3V->@Pn>@ >@>@O4333>@jt>@ˡE>@>@kcX9>@2Gz>@~j>@F>@|?>@N$>@*\>@u>@ʡE>@j +>@1Y9>@p= >@K>@@M>@Mb>@Q>@kt>@i>@0+>@NbX>@>@">@L2>@~?5^>@v>@G>@ha">@/Zd>@S>@Dl>@(>@K~j>@(1>@sh>@/>@g ףp>@.W->@E>@|?5>@:v>@JQ>@">@Zd;>@i|>@fv>@->@L7A>@n>@䥛>@I0$>@|G>@K7>@>@e_I >@,M>@(\>@B`>@n>@HS>@&>@q= >@t>@d Z>@+U㥛>@/>@Q>@8A`>@Gʡ>@S>@/$>@gfff>@c>@*x>@J +>@Cl>@z>@F.>@ z&1>@ r>@X9>@b]>@)K7>@x>@@5^>@~l>@Eأp=>@ $~>@o>@I >@aC>@(S>@>@&1>@}6^I>@DC>@ >@V>@e;O>@`rh>@'>@Hz>@V>@|O>@C,>@ x>@(\>@->@_[d;>@& >@Mb>@> ף>@{A`>@Bx&>@ "rh>@m>@>@^V->@%Qn>@ >@>@z4333>@Ajt>@̡E>@>@cX9>@]Gz>@$~j>@F>@|?>@y$>@@*\>@v>@ʡE>@ +>@\Y9>@#p= >@K>@@x>@?Mb>@ Q>@kt>@>@[+>@"ObX>@隙>@">@w2>@>~?5^>@v>@G>@a">@ZZd>@!S>@Dl>@(>@v~j>@=(1>@th>@˿/>@ ףp>@YW->@ E>@|?5>@:v>@uQ>@<">@Zd;>@i|>@v>@X?@M7A?@n?@䥛?@t0$?@;|G?@K7?@?@_I ?@WM?@(\?@B`?@n?@sS?@:&?@r= ?@Ƚt?@ Z?@VU㥛?@/?@Q?@8A`?@rʡ?@9S?@/$?@gfff?@?@Ux?@K +?@Cl?@z?@q.?@8z&1?@ r?@X9?@]?@TK7 ?@x ?@@5^ ?@l ?@pأp= ?@7$~ ?@o ?@ŻI  ?@C ?@SS ?@ ?@&1 ?@6^I ?@oC ?@6 ?@V ?@e;O ?@rh ?@R ?@Iz?@V?@O?@n,?@5x?@(\?@-?@[d;?@Q ?@Mb?@> ף?@A`?@mx&?@4"rh?@m?@¹?@V-?@PQn?@ ?@?@4333?@ljt?@3̡E?@?@cX9?@Gz?@O~j?@G?@ݒ|??@$?@k*\?@2v?@ʡE?@ +?@Y9?@Np= ?@K?@El;?@(?@;v>?@ˆQ>?@">?@YZd;??@ j|??@v??@@?@uM7A@?@ ףp}?@X-}?@̣E}?@|?5~?@Z;v~?@!Q~?@"~?@Zd;?@vj|?@=v?@?@M7A?@n?@Y奛Ā?@ 1$?@|G?@K7?@uʁ?@<`I ?@M?@(\?@C`Ђ?@Xn?@S?@&?@r= ׃?@tt?@; Z?@V㥛?@ɡ/݄?@Q?@W9A`?@ʡ?@S?@/$?@shfff?@:阮?@x?@K +?@Cl?@Vz?@/?@z&1?@ r?@rX9?@9^?@K7?@x?@A5^?@Ul?@٣p=?@$~?@p?@qI ?@8C?@S?@ƟƋ?@&1?@T7^I?@C?@̌?@V?@pf;O?@7rh?@ҍ?@Iz?@V?@SO?@-َ?@x?@(\?@o-?@6\d;ߏ?@ ?@Mb?@? ף?@RA`?@x&?@"rh?@n?@n?@5V-?@Qn?@Ý ?@?@Q5333?@jt?@̡E?@?@mdX9?@4Gz?@~j?@G?@|??@P$?@+\•?@v?@ʡE?@l+?@3Z9Ȗ?@p= ?@K?@=O?@OΗ?@Mb?@ Q?@lt?@kԘ?@2+?@ObX?@?@"ۙ?@N3?@?5^?@v?@G?@jb"?@1Zd?@S㥛?@El?@(?@M~j?@)1?@th?@/?@i ףp?@0X-?@E?@|?5?@;v?@LQ?@"?@Zd;?@j|?@hv?@/?@M7A?@n?@奛Ġ?@K1$?@}G?@K7?@ʡ?@g`I ?@.M?@(\?@C`Т?@n?@JS?@'?@r= ף?@t?@f Z?@-V㥛?@/ݤ?@Q?@9A`?@Iʡ?@S?@/$?@hfff?@e罹?@,x?@K +?@Cl?@z?@H/?@{&1?@ r?@X9?@d^?@+K7?@x?@A5^?@l?@G٣p=?@%~?@p?@I ?@cC?@*T?@ƫ?@&1?@7^I?@FC?@ ̬?@V?@f;O?@brh?@)ҭ?@Iz?@V?@~O?@E-ٮ?@ y?@(\?@-?@a\d;߯?@( ?@Mb?@? ף?@}A`?@Dx&?@ #rh?@n?@?@`V-?@'Rn?@ ?@?@|5333?@Cjt?@ ͡E?@?@dX9?@_Gz?@&~j?@G?@|??@{$?@B+\µ?@ w?@ʡE?@+?@^Z9ȶ?@%p= ?@K?@=O?@zη?@AMb?@!Q?@lt?@Ը?@]+?@$PbX?@뛙?@"۹?@y3?@@?5^?@v?@G?@b"?@\Zd?@#S㥻?@El?@(?@x~j?@?)1?@uh?@/?@ ףp?@[X-?@"E?@|?5?@;v?@wQ?@>"?@Zd;?@j|?@v?@Z?@!N7A?@n?@奛?@v1$?@=}G?@K7?@?@`I ?@YM?@ (\?@C`?@n?@uS?@<'?@s= ?@ʾt?@ Z?@XV㥛?@/?@Q?@9A`?@tʡ?@;S?@/$?@hfff?@?@Wx?@L +?@Cl?@z?@s/?@:{&1?@ r?@X9?@^?@VK7?@x?@A5^?@l?@r٣p=?@9%~?@q?@ǼI ?@C?@UT?@?@&1?@7^I?@qC?@8?@V?@f;O?@rh?@T?@Jz?@V?@O?@p-?@7y?@(\?@-?@\d;?@S ?@Mb?@? ף?@A`?@ox&?@6#rh?@n?@ĺ?@V-?@RRn?@ ?@?@5333?@njt?@5͡E?@?@dX9?@Gz?@Q~j?@H?@ߓ|??@$?@m+\?@4w?@ʡE?@+?@Z9?@Pp= ?@K?@=O?@?@lMb?@3!Q?@lt?@?@+?@OPbX?@?@"?@3?@k?5^?@2v?@G?@b"?@Zd?@NS?@Fl?@ܑ(?@~j?@j)1?@1uh?@/?@ ףp?@X-?@ME?@|?5?@;v?@Q?@i"?@0Zd;?@j|?@v?@?@LN7A?@n?@奛?@1$?@h}G?@/K7?@?@`I ?@M?@K(\?@D`?@ُn?@S?@g'?@.s= ?@t?@ Z?@V㥛?@J/?@Q?@9A`?@ʡ?@fS?@-/$?@hfff?@?@x?@IL +?@Cl?@z?@/?@e{&1?@, r?@X9?@^?@K7?@Hx?@B5^?@֍l?@٣p=?@d%~?@+q?@I ?@C?@T?@G?@&1?@7^I?@C?@c?@*V?@f;O?@rh?@?@FJz?@ V?@O?@-?@by?@)(\?@-?@\d;?@~ ?@EMb?@ @ ף?@ӋA`?@x&?@a#rh?@(o?@?@V-?@}Rn?@D ?@ ?@5333?@jt?@`͡E?@'?@dX9?@Gz?@|~j?@CH?@ |??@$?@+\?@_w?@&ʡE?@+?@Z9?@{p= ?@BK?@ >O?@Љ?@Mb?@^!Q?@%mt?@?@+?@zPbX?@A?@"?@3?@?5^?@]v?@$G?@b"?@Zd?@yS?@@Fl?@(?@~j?@)1?@\uh?@#/?@ ףp?@X-?@xE?@?|?5?@ ף@@䥛@@A`@@p0$@@Sx&@@6|G@@"rh@@K7@@m@@@@@@_I @@kV-@@NM@@1Qn@@(\@@ @@B`@@@@n@@4333@@fS@@Ijt@@,&@@̡E@@q= @@@@t@@cX9@@~ Z@@aGz@@DU㥛@@'~j@@ /@@F@@Q@@|?@@8A`@@y$@@\ʡ@@?*\@@"S@@v@@/$@@ʡE@@gfff@@ +@@t@@WY9@@:x@@p= @@K +@@K@@ƖCl@@C @@!(1 @@ @@sh @@V @@/ @@e;O @@s ףp @@Vrh @@9W- @@ @@E @@Hz@@|?5@@V@@:v@@nO@@QQ@@4,@@"@@w@@Zd;@@(\@@i|@@-@@iv@@L[d;@@/@@ @@L7A@@Mb@@n@@> ף@@䥛@@dA`@@G0$@@*x&@@ |G@@!rh@@K7@@m@@@@|@@__I @@BV-@@%M@@Qn@@(\@@Μ @@B`@@@@wn@@Z4333@@=S@@ jt@@&@@ˡE@@q= @@@@t@@rcX9@@U Z@@8Gz@@U㥛@@~j@@/@@F@@Q@@|?@@m8A`@@P$@@3ʡ@@*\@@S@@u@@/$@@ʡE@@gfff@@h +@@K@@.Y9@@x@@p= @@J +@@K@@Cl@@ ף @@X䥛 @@;A` @@0$!@@x&!@@{G!@@!rh!@@K7!@@m!@@p!@@S!@@6_I "@@V-"@@M"@@Pn"@@(\"@@ "@@B`"@@k"@@Nn#@@14333#@@S#@@jt#@@%#@@ˡE#@@q= #@@#@@ft$@@IcX9$@@, Z$@@Gz$@@T㥛$@@~j$@@/$@@F$@@~Q%@@a|?%@@D8A`%@@'$%@@ ʡ%@@)\%@@S%@@u&@@/$&@@yʡE&@@\gfff&@@? +&@@"&@@Y9&@@x&@@ˤp= '@@J +'@@K'@@tCl'@@We;O-@@! ףp-@@rh-@@V--@@-@@E-@@Hz.@@s|?5.@@VV.@@9:v.@@O.@@Q.@@+.@@".@@w/@@Zd;/@@n(\/@@Qi|/@@4-/@@v/@@Zd;/@@0@@ 0@@L7A0@@Mb0@@in0@@L> ף0@@/䥛0@@A`0@@/$1@@x&1@@{G1@@!rh1@@K71@@dm1@@G1@@*1@@ _I 2@@V-2@@ӪM2@@Pn2@@(\2@@| 2@@_B`2@@B2@@%n3@@43333@@S3@@jt3@@%3@@ˡE3@@wq= 3@@Z3@@=t4@@ cX94@@ Z4@@Gz4@@T㥛4@@~j4@@/4@@rF4@@UQ5@@8|?5@@8A`5@@$5@@ʡ5@@)\5@@S5@@u6@@m/$6@@PʡE6@@3gfff6@@ +6@@6@@X96@@x6@@p= 7@@J +7@@hK7@@KCl7@@.@@J|?5>@@-V>@@:v>@@O>@@օQ>@@+>@@">@@w?@@bZd;?@@E(\?@@(i|?@@ -?@@v?@@Zd;?@@@@@ @@@zL7A@@@]Mb@@@@n@@@#> ף@@@䥛@@@A`@@@/$A@@x&A@@{GA@@u!rhA@@XK7A@@;mA@@A@@A@@^I B@@V-B@@MB@@PnB@@p(\B@@S B@@6B`B@@B@@nC@@3333C@@SC@@jtC@@%C@@kˡEC@@Nq= C@@1C@@tD@@bX9D@@ZD@@GzD@@T㥛D@@~jD@@f/D@@IFD@@,QE@@|?E@@7A`E@@$E@@ʡE@@)\E@@~SE@@auF@@D/$F@@'ʡEF@@ gfffF@@ +F@@вF@@X9F@@xF@@yp= G@@\J +G@@?KG@@"ClG@@HzN@@!|?5N@@VN@@9vN@@ON@@QN@@+N@@s"N@@VwO@@9Zd;O@@(\O@@h|O@@-O@@ŴvO@@Zd;O@@P@@n P@@QL7AP@@4MbP@@nP@@= ףP@@㥛P@@A`P@@/$Q@@x&Q@@i{GQ@@L!rhQ@@/K7Q@@mQ@@Q@@ظQ@@^I R@@V-R@@MR@@dPnR@@G(\R@@* R@@ B`R@@R@@ӍnS@@3333S@@SS@@|jtS@@_%S@@BˡES@@%q= S@@S@@tT@@bX9T@@ZT@@GzT@@wT㥛T@@Z~jT@@=/T@@ FT@@QU@@|?U@@7A`U@@$U@@ʡU@@r)\U@@USU@@8uV@@/$V@@ʡEV@@ffffV@@ +V@@V@@X9V@@mxV@@Pp= W@@3J +W@@KW@@ClW@@;OW@@zW@@W@@-W@@hMbX@@Ky&1X@@.QX@@ rX@@jtX@@X9X@@X@@\X@@+Y@@cK7Y@@FNbXY@@)xY@@ Y@@?5^Y@@"Y@@lY@@1Z@@{ףp=Z@@^}?5^Z@@A#~Z@@$vZ@@oZ@@GZ@@ͺI [@@`"[@@C[@@vZd[@@YR[@@+n@@!"n@@wo@@Zd;o@@(\o@@h|o@@-o@@svo@@VZd;o@@9p@@ p@@K7Ap@@Mbp@@ŗnp@@= ףp@@㥛p@@nA`p@@Q/$q@@4x&q@@{Gq@@ rhq@@K7q@@lq@@q@@q@@i^I r@@LV-r@@/Mr@@Pnr@@(\r@@؛ r@@A`r@@r@@ns@@d3333s@@GSs@@*jts@@ %s@@ʡEs@@p= s@@s@@tt@@|bX9t@@_Zt@@BGzt@@%T㥛t@@~jt@@/t@@Et@@Qu@@|?u@@w7A`u@@Z$u@@=ʡu@@ )\u@@Su@@tv@@/$v@@ʡEv@@ffffv@@r +v@@Uv@@8X9v@@xv@@p= w@@I +w@@Kw@@Clw@@;Ow@@mzw@@Pw@@3-w@@Mbx@@x&1x@@Qx@@ rx@@jtx@@X9x@@hx@@K\x@@.+y@@K7y@@MbXy@@xy@@y@@?5^y@@"y@@cly@@F1z@@)ףp=z@@ }?5^z@@"~z@@vz@@nz@@Gz@@{I {@@^`"{@@AC{@@$Zd{@@R{@@S{@@͝{@@Cl{@@&1|@@v(|@@Y5^I|@@<~j|@@C|@@'1|@@|@@rh|@@V}@@/}@@qd;O}@@T ףp}@@7rh}@@V-}@@}@@E}@@Gz~@@|?5~@@V~@@l9v~@@OO~@@2Q~@@+~@@"~@@v@@Zd;@@(\@@h|@@g-@@Jv@@-Zd;@@@@ @@K7A@@Mb@@n@@= ף@@b㥛Ā@@EA`@@(/$@@ x&@@zG@@ rh@@K7@@l@@zʁ@@]@@@^I @@#V-@@M@@On@@(\@@ @@A`Ђ@@u@@Xn@@;3333@@S@@jt@@$@@ʡE@@p= ׃@@@@pt@@SbX9@@6Z@@Gz@@S㥛@@~j@@Ÿ/݄@@E@@Q@@k|?@@N7A`@@1$@@ʡ@@(\…@@S@@t@@/$@@ʡE@@fffff@@I +@@,阮@@X9Ȇ@@x@@գp= @@I +@@K@@~Cl@@a;O@@Dz@@'·@@ -@@Mb@@x&1@@Q@@ r@@yjt@@\X9@@?Ԉ@@"\@@+@@K7@@MbX@@x@@@@t?5^@@W"ۉ@@:l@@1@@ףp=@@|?5^@@"~@@v@@n@@oG@@RI @@5`"@@C@@Zd@@Q@@S㥋@@Ƌ@@Cl@@j&1@@M(@@05^I@@~j@@C@@&1@@̌@@rh@@V@@e/@@Hd;O@@+ ףp@@rh@@U-@@ҍ@@E@@Gz@@}|?5@@`V@@C9v@@&O@@ Q@@*َ@@"@@v@@Zd;@@x(\@@[h|@@>-@@!v@@Zd;ߏ@@@@ʥ @@K7A@@Mb@@sn@@V= ף@@9㥛Đ@@A`@@.$@@x&@@zG@@ rh@@K7@@nl@@Qʑ@@4@@^I @@V-@@ݩM@@On@@(\@@ @@iA`В@@L@@/n@@3333@@S@@~jt@@$@@ʡE@@p= ד@@d@@Gt@@*bX9@@ Z@@Gz@@S㥛@@~j@@/ݔ@@|E@@_Q@@B|?@@%7A`@@$@@ʡ@@(\•@@S@@t@@w/$@@ZʡE@@=ffff@@ +@@淪@@W9Ȗ@@x@@p= @@I +@@rK@@UCl@@8;O@@z@@Η@@,@@Mb@@x&1@@Q@@m r@@Pjt@@3X9@@Ԙ@@[@@+@@K7@@MbX@@x@@h@@K?5^@@."ۙ@@l@@0@@֣p=@@|?5^@@"~@@v@@cn@@FG@@)I @@ `"@@C@@ҫZd@@Q@@S㥛@@{ƛ@@^Cl@@A&1@@$(@@5^I@@~j@@̀C@@&1@@̜@@vrh@@YV@@</@@d;O@@ ףp@@rh@@U-@@ҝ@@E@@qGz@@T|?5@@7V@@9v@@O@@Q@@*ٞ@@"@@v@@lZd;@@O(\@@2h|@@-@@v@@Yd;ߟ@@@@ @@K7A@@gMb@@Jn@@-= ף@@㥛Ġ@@A`@@.$@@x&@@zG@@ rh@@bK7@@El@@(ʡ@@ @@]I @@V-@@M@@On@@z(\@@] @@@A`Т@@#@@n@@2333@@S@@~jt@@$@@uʡE@@Xp= ף@@;@@t@@bX9@@Z@@ǭGz@@S㥛@@~j@@p/ݤ@@SE@@6Q@@|?@@6A`@@$@@‚ʡ@@(\¥@@S@@kt@@N/$@@1ʡE@@ffff@@ +@@ڱ罹@@W9Ȧ@@x@@p= @@fI +@@IK@@,Cl@@;O@@z@@ՆΧ@@,@@Mb@@~x&1@@aQ@@D r@@'jt@@ X9@@Ԩ@@[@@+@@K7@@yMbX@@\x@@?@@"?5^@@"۩@@l@@0@@֣p=@@|?5^@@t"~@@Wv@@:n@@G@@I @@_"@@C@@Zd@@Q@@oS㥫@@Rƫ@@5Cl@@&1@@(@@4^I@@~j@@C@@&1@@j̬@@Mrh@@0V@@/@@c;O@@ ףp@@rh@@U-@@ҭ@@eE@@HGz@@+|?5@@V@@8v@@O@@Q@@*ٮ@@}"@@`v@@CZd;@@&(\@@ h|@@ -@@ϳv@@Yd;߯@@@@x @@[K7A@@>Mb@@!n@@= ף@@⥛İ@@ʈA`@@.$@@x&@@szG@@V rh@@9K7@@l@@ʱ@@@@]I @@V-@@M@@nOn@@Q(\@@4 @@A`в@@@@݌n@@2333@@S@@~jt@@i$@@LʡE@@/p= ׳@@@@t@@aX9@@Z@@Gz@@S㥛@@d~j@@G/ݴ@@*E@@ Q@@|?@@6A`@@$@@ʡ@@|(\µ@@_S@@Bt@@%/$@@ʡE@@efff@@ +@@臨@@W9ȶ@@wx@@Zp= @@=I +@@ K@@Cl@@:O@@z@@η@@,@@rMb@@Ux&1@@8Q@@ r@@it@@X9@@ĵԸ@@[@@+@@mK7@@PMbX@@3x@@@@>5^@@"۹@@l@@0@@֣p=@@h|?5^@@K"~@@.v@@n@@G@@׹I @@_"@@C@@Zd@@cQ@@FS㥻@@)ƻ@@ Cl@@&1@@Ҏ(@@4^I@@~j@@{C@@^&1@@A̼@@$rh@@V@@꽟/@@c;O@@ ףp@@rh@@vU-@@Yҽ@@5^@@"@@l@@y0@@\֣p=@@?|?5^@@""~@@v@@m@@G@@I @@_"@@tC@@WZd@@:Q@@S@@@@Bl@@&1@@(@@4^I@@o~j@@RC@@5&1@@@@qh@@V@@/@@c;O@@ ףp@@jrh@@MU-@@0@@E@@Fz@@|?5@@V@@8v@@O@@eQ@@H*@@+"@@v@@Zd;@@(\@@g|@@ -@@}v@@`Yd;@@C@@& @@ K7A@@Mb@@ϖn@@< ף@@⥛@@xA`@@[.$@@>x&@@!zG@@ rh@@K7@@k@@@@@@s]I @@VV-@@9M@@On@@(\@@ @@@`@@@@n@@n2333@@QS@@4~jt@@$@@ɡE@@o= @@@@t@@aX9@@iZ@@LGz@@/S㥛@@~j@@/@@D@@Q@@|?@@6A`@@d$@@Gʡ@@*(\@@ S@@s@@/$@@ʡE@@efff@@| +@@_@@BW9@@%x@@p= @@H +@@K@@Cl@@:O@@wz@@Z@@=,@@ Mb@@x&1@@Q@@ r@@it@@X9@@r@@U[@@8+@@K7@@LbX@@x@@Ę@@>5^@@"@@ml@@P0@@3֣p=@@|?5^@@!~@@v@@m@@G@@I @@h_"@@KC@@.Zd@@Q@@S@@ל@@Bl@@&1@@(@@c4^I@@F~j@@)C@@ &1@@@@qh@@V@@/@@{c;O@@^ ףp@@Arh@@$U-@@@@E@@Fz@@|?5@@V@@v8v@@YO@@5^@@a"@@Dl@@'0@@ ֣p=@@{?5^@@!~@@v@@m@@yG@@\I @@?_"@@"C@@Zd@@P@@S@@@@Bl@@t&1@@W(@@:4^I@@~j@@C@@%1@@@@qh@@V@@o/@@Rc;O@@5 ףp@@rh@@T-@@@@E@@Fz@@|?5@@jV@@M8v@@0O@@Q@@)@@"@@u@@Zd;@@(\@@eg|@@H -@@+v@@Yd;@@@@Ԥ @@J7A@@Mb@@}n@@`< ף@@C⥛@@&A`@@ .$@@x&@@yG@@rh@@K7@@xk@@[@@>@@!]I @@V-@@M@@Nn@@(\@@ @@s@`@@V@@9n@@2333@@S@@}jt@@#@@ɡE@@o= @@n@@Qt@@4aX9@@Z@@Gz@@R㥛@@~j@@/@@D@@iQ@@L|?@@/6A`@@$@@ʡ@@'\@@S@@s@@/$@@dʡE@@Gefff@@* +@@ @@V9@@x@@p= @@H +@@|K@@_Cl@@B:O@@%z@@@@+@@Mb@@w&1@@Q@@w r@@Zit@@=X9@@ @@[@@+@@ɦK7@@LbX@@x@@r@@U>5^@@8"@@l@@/@@գp=@@{?5^@@!~@@v@@mm@@PG@@3I @@_"@@C@@ܪZd@@P@@S@@@@hBl@@K&1@@.(@@4^I@@~j@@C@@%1@@@@qh@@cV@@F/@@)c;O@@ ףp@@rh@@T-@@@@E@@{Fz@@^|?5@@AV@@$8v@@O@@Q@@)@@"@@u@@vZd;@@Y(\@@5^ A@" A@l A@/ A@գp= A@{?5^ A@~!~ A@av A@Dm A@'G A@ I  A@^" A@C A@Zd A@P A@yS A@\ A@?Bl A@"&1 A@( A@3^I A@~j A@C A@%1 A@t A@Wqh A@:V A@/ A@c;O A@ףp A@Ʈrh A@T- A@ A@oE A@RFzA@5|?5A@VA@7vA@OA@QA@)A@"A@juA@MZd;A@0(\A@g|A@ -A@ٲvA@Xd;A@A@ A@eJ7AA@HMbA@+nA@< ףA@ᥛA@ԇA`A@-$A@x&A@}yGA@`rhA@CK7A@&kA@ A@A@\I A@V-A@MA@xNnA@[(\A@> A@!@`A@A@狗nA@1333A@SA@}jtA@s#A@VɡEA@9o= A@A@tA@`X9A@ZA@GzA@R㥛A@n~jA@Q/A@4DA@QA@|?A@5A`A@$A@ʡA@'\A@iSA@LsA@//$A@ʡEA@dfffA@ +A@A@V9A@xA@dp= A@GH +A@*KA@ ClA@9OA@zA@A@+A@|MbA@_w&1A@BQA@% rA@itA@X9A@δA@ZA@+A@wK7A@ZLbXA@=xA@ A@>5^A@"A@ɉlA@/A@գp=A@r{?5^A@U!~A@8vA@mA@GA@I A@^"A@CA@ZdA@mPA@PSA@3A@BlA@&1A@܍(A@3^IA@~jA@CA@h%1A@KA@.qhA@VA@/A@b;OA@ףpA@rhA@T-A@cA@FEA@)FzA@ |?5A@VA@7vA@OA@QA@{)A@^"A@AuA@$Zd;A@(\A@f|A@ -A@vA@Xd;A@vA@Y A@}jt3A@!#3A@ɡE3A@n= 3A@3A@t4A@`X94A@sZ4A@VGz4A@9R㥛4A@~j4A@/4A@C4A@Q5A@|?5A@5A`5A@n$5A@Qʡ5A@4'\5A@S5A@r6A@/$6A@ʡE6A@dfff6A@ +6A@i6A@LV96A@/x6A@p= 7A@G +7A@K7A@Cl7A@9O7A@z7A@d7A@G+7A@*Mb8A@ w&18A@Q8A@ r8A@ht8A@X98A@|8A@_Z8A@B+9A@%K79A@LbX9A@x9A@Η9A@=5^9A@"9A@wl9A@Z/:A@=գp=:A@ {?5^:A@!~:A@v:A@l:A@G:A@I ;A@r^";A@UC;A@8Zd;A@P;A@S;A@;A@Al;A@&1A@|?5>A@V>A@7v>A@cO>A@FQ>A@))>A@ ">A@t?A@Zd;?A@(\?A@f|?A@{ -?A@^v?A@AXd;?A@$?A@ @A@I7A@A@Mb@A@n@A@; ף@A@vᥛ@A@YA`@A@<-$AA@x&AA@yGAA@rhAA@K7AA@jAA@AA@qAA@T\I BA@7V-BA@MBA@MnBA@(\BA@Ù BA@?`BA@BA@lnCA@O1333CA@2SCA@}jtCA@"CA@ȡECA@n= CA@CA@tDA@g`X9DA@JZDA@-GzDA@R㥛DA@~jDA@֝/DA@CDA@QEA@|?EA@b5A`EA@E$EA@(ʡEA@ '\EA@SEA@rFA@/$FA@ʡEFA@zdfffFA@] +FA@@FA@#V9FA@xFA@p= GA@G +GA@KGA@ClGA@u9OGA@XzGA@;GA@+GA@MbHA@v&1HA@QHA@ rHA@htHA@pX9HA@SHA@6ZHA@+IA@K7IA@KbXIA@xIA@IA@=5^IA@k"IA@NlIA@1/JA@գp=JA@z?5^JA@ ~JA@vJA@lJA@GJA@fI KA@I^"KA@,CKA@ZdKA@OKA@SKA@KA@AlKA@~&1LA@a(LA@D3^ILA@'~jLA@ CLA@$1LA@LA@phLA@VMA@y/MA@\b;OMA@?ףpMA@"rhMA@T-MA@MA@˟EMA@EzNA@|?5NA@tVNA@W7vNA@:ONA@QNA@)NA@"NA@tOA@Zd;OA@(\OA@of|OA@R -OA@5vOA@Xd;OA@OA@ޣ PA@I7APA@MbPA@nPA@j; ףPA@MᥛPA@0A`PA@-$QA@x&QA@xGQA@rhQA@K7QA@jQA@eQA@HQA@+\I RA@V-RA@MRA@MnRA@(\RA@ RA@}?`RA@`RA@CnSA@&1333SA@ SSA@|jtSA@"SA@ȡESA@n= SA@xSA@[tTA@>`X9TA@!ZTA@GzTA@Q㥛TA@~jTA@/TA@CTA@sQUA@V|?UA@95A`UA@$UA@ʡUA@&\UA@SUA@rVA@/$VA@nʡEVA@QdfffVA@4 +VA@VA@U9VA@xVA@p= WA@G +WA@KWA@iClWA@L9OWA@/zWA@WA@*WA@MbXA@v&1XA@QXA@ rXA@dhtXA@GX9XA@*XA@ ZXA@*YA@ӥK7YA@KbXYA@xYA@|YA@_=5^YA@B"YA@%lYA@/ZA@ԣp=ZA@z?5^ZA@ ~ZA@vZA@wlZA@ZGZA@=I [A@ ^"[A@C[A@Zd[A@O[A@S[A@[A@rAl[A@U&1\A@8(\A@3^I\A@~j\A@~C\A@$1\A@\A@ph\A@mV]A@P/]A@3b;O]A@ףp]A@rh]A@S-]A@]A@E]A@Ez^A@h|?5^A@KV^A@.7v^A@O^A@Q^A@(^A@"^A@t_A@Zd;_A@c(\_A@Ff|_A@) -_A@ v_A@Wd;_A@_A@ `A@I7A`A@{Mb`A@^n`A@A; ף`A@$ᥛ`A@A``A@,$aA@x&aA@xGaA@rhaA@vK7aA@YjaA@<aA@aA@\I bA@V-bA@ȧMbA@MnbA@(\bA@q bA@T?`bA@7bA@ncA@0333cA@ScA@|jtcA@"cA@ȡEcA@ln= cA@OcA@2tdA@`X9dA@ZdA@۫GzdA@Q㥛dA@~jdA@/dA@gCdA@JQeA@-|?eA@5A`eA@$eA@րʡeA@&\eA@SeA@rfA@b/$fA@EʡEfA@(dffffA@ +fA@fA@U9fA@xfA@p= gA@zG +gA@]KgA@@ClgA@#9OgA@zgA@gA@*gA@MbhA@v&1hA@uQhA@X rhA@;hthA@X9hA@hA@YhA@*iA@K7iA@KbXiA@pxiA@SiA@6=5^iA@"iA@liA@.jA@ԣp=jA@z?5^jA@ ~jA@kvjA@NljA@1GjA@I kA@]"kA@CkA@ZdkA@OkA@SkA@fkA@IAlkA@,&1lA@(lA@2^IlA@~jlA@~ClA@$1lA@~lA@aphlA@DVmA@'/mA@ b;OmA@ףpmA@ЭrhmA@S-mA@mA@yEmA@\EznA@?|?5nA@"VnA@7vnA@OnA@˂QnA@(nA@"nA@ttoA@WZd;oA@:(\oA@f|oA@ -oA@voA@Wd;oA@oA@ pA@oI7ApA@RMbpA@5npA@; ףpA@ज़pA@ކA`pA@,$qA@x&qA@xGqA@jrhqA@MK7qA@0jqA@qA@qA@[I rA@V-rA@MrA@MnrA@e(\rA@H rA@+?`rA@rA@nsA@0333sA@SsA@|jtsA@}"sA@`ȡEsA@Cn= sA@&sA@ ttA@_X9tA@ZtA@GztA@Q㥛tA@x~jtA@[/tA@>CtA@!QuA@|?uA@4A`uA@$uA@ʡuA@&\uA@sSuA@VrvA@9/$vA@ʡEvA@cfffvA@ +vA@ůvA@U9vA@xvA@np= wA@QG +wA@4KwA@ClwA@8OwA@zwA@wA@*wA@MbxA@iv&1xA@LQxA@/ rxA@htxA@ X9xA@سxA@YxA@*yA@K7yA@dKbXyA@GxyA@*yA@ =5^yA@"yA@ӈlyA@.zA@ԣp=zA@|z?5^zA@_ ~zA@BvzA@%lzA@GzA@I {A@]"{A@C{A@Zd{A@wO{A@ZS{A@={A@ Al{A@&1|A@(|A@2^I|A@~j|A@~C|A@r$1|A@U|A@8ph|A@V}A@/}A@a;O}A@ףp}A@rh}A@S-}A@m}A@PE}A@3Ez~A@|?5~A@V~A@6v~A@O~A@Q~A@(~A@h"~A@KtA@.Zd;A@(\A@e|A@ -A@vA@Wd;A@A@c A@FI7AA@)MbA@ nA@: ףA@ज़ĀA@A`A@,$A@{x&A@^xGA@ArhA@$K7A@jA@ʁA@͵A@[I A@V-A@vMA@YMnA@<(\A@ A@?`ЂA@A@ȊnA@0333A@SA@q|jtA@T"A@7ȡEA@n= ׃A@A@tA@_X9A@ZA@GzA@lQ㥛A@O~jA@2/݄A@CA@QA@ێ|?A@4A`A@$A@ʡA@g&\…A@JSA@-rA@/$A@ʡEA@cfffA@ +A@阮A@U9ȆA@bxA@Ep= A@(G +A@ KA@ClA@8OA@zA@·A@z*A@]MbA@@v&1A@#QA@ rA@gtA@ X9A@ԈA@YA@u*A@XK7A@;KbXA@xA@A@<5^A@"ۉA@lA@.A@pԣp=A@Sz?5^A@6 ~A@vA@kA@GA@·I A@]"A@CA@kZdA@NOA@1S㥋A@ƋA@@lA@&1A@(A@2^IA@~jA@f~CA@I$1A@,̌A@phA@VA@ջ/A@a;OA@ףpA@~rhA@aS-A@DҍA@'EA@ EzA@|?5A@АVA@6vA@OA@yQA@\(َA@?"A@"tA@Zd;A@(\A@e|A@ -A@vA@tWd;ߏA@WA@: A@I7AA@MbA@nA@: ףA@ज़ĐA@A`A@o,$A@Rx&A@5xGA@rhA@K7A@iA@ʑA@A@[I A@jV-A@MMA@0MnA@(\A@ A@>`ВA@A@nA@0333A@eSA@H|jtA@+"A@ȡEA@m= דA@A@tA@_X9A@}ZA@`GzA@CQ㥛A@&~jA@ /ݔA@BA@QA@|?A@4A`A@x$A@[ʡA@>&\•A@!SA@rA@/$A@ʽʡEA@cfffA@ +A@s淪A@VU9ȖA@9xA@p= A@F +A@KA@ŒClA@8OA@zA@nΗA@Q*A@4MbA@v&1A@QA@ rA@gtA@ X9A@ԘA@iYA@L*A@/K7A@KbXA@xA@ؖA@<5^A@"ۙA@lA@d.A@Gԣp=A@*z?5^A@ ~A@vA@kA@GA@I A@|]"A@_CA@BZdA@%OA@S㥛A@ƛA@@lA@&1A@(A@w2^IA@Z~jA@=~CA@ $1A@̜A@ohA@VA@/A@a;OA@rףpA@UrhA@8S-A@ҝA@EA@DzA@|?5A@VA@6vA@mOA@PQA@3(ٞA@"A@sA@Zd;A@(\A@e|A@ -A@hvA@KWd;ߟA@.A@ A@H7AA@MbA@nA@: ףA@ज़ĠA@cA`A@F,$A@)x&A@ xGA@rhA@K7A@iA@ʡA@{A@^[I A@AV-A@$MA@MnA@(\A@͘ A@>`ТA@A@vnA@Y0333A@`вA@jA@MnA@00333A@SA@{jtA@!A@ǡEA@m= ׳A@A@etA@H_X9A@+ZA@GzA@P㥛A@~jA@/ݴA@BA@}QA@`|?A@C4A`A@&$A@ ʡA@%\µA@SA@qA@/$A@xʡEA@[cfffA@> +A@!臨A@U9ȶA@xA@ʠp= A@F +A@KA@sClA@V8OA@9zA@ηA@)A@MbA@u&1A@QA@ rA@ngtA@Q X9A@4ԸA@YA@*A@ݤK7A@JbXA@xA@A@i<5^A@L"۹A@/lA@.A@ӣp=A@y?5^A@~A@vA@kA@dGA@GI A@*]"A@ CA@ZdA@NA@S㥻A@ƻA@|@lA@_&1A@B(A@%2^IA@~jA@}CA@#1A@̼A@ohA@wVA@Z/A@=a;OA@ ףpA@rhA@R-A@ҽA@EA@DzA@r|?5A@UVA@86vA@OA@QA@'پA@"A@sA@Zd;A@m(\A@Pe|A@3 -A@vA@Vd;߿A@A@ A@H7AA@MbA@hnA@K: ףA@.ज़A@A`A@+$A@x&A@wGA@rhA@K7A@ciA@FA@)A@ [I A@V-A@ҦMA@LnA@(\A@{ A@^>`A@AA@$nA@0333A@SA@{jtA@!A@ǡEA@vm= A@YA@`A@A@nA@/333A@SA@{jtA@!A@jǡEA@Mm= A@0A@tA@^X9A@ZA@GzA@P㥛A@~jA@e/A@HBA@+QA@|?A@3A`A@$A@ʡA@%\A@}SA@`qA@C/$A@&ʡEA@ cfffA@+A@ϮA@T9A@xA@xp= A@[F +A@>KA@!ClA@8OA@zA@ʃA@)A@MbA@su&1A@VQA@9 rA@gtA@ X9A@A@XA@*A@K7A@nJbXA@QxA@4A@<5^A@"A@݇lA@-A@ӣp=A@y?5^A@i~A@LvA@/kA@GA@I A@\"A@CA@ZdA@NA@dSA@GA@*@lA@ &1A@(A@1^IA@~jA@}CA@|#1A@_A@BohA@%VA@/A@`;OA@ףpA@rhA@R-A@wA@ZEA@=DzA@ |?5A@VA@5vA@OA@QA@'A@r"A@UsA@8Zd;A@(\A@d|A@ -A@İvA@Vd;A@A@m A@PH7AA@3MbA@nA@9 ףA@ߥA@A`A@+$A@x&A@hwGA@KrhA@.K7A@iA@A@״A@ZI A@V-A@MA@cLnA@F(\A@) A@ >`A@A@҉nA@/333A@SA@{{jtA@^!A@AǡEA@$m= A@A@tA@^X9A@ZA@GzA@vP㥛A@Y~jA@</A@BA@QA@|?A@3A`A@$A@ʡA@q%\A@TSA@7qA@/$A@ʡEA@bfffA@+A@A@T9A@lxA@Op= A@2F +A@KA@ClA@7OA@zA@A@)A@gMbA@Ju&1A@-QA@ rA@ftA@ X9A@A@XA@*A@bK7A@EJbXA@(xA@ A@;5^A@"A@lA@-A@zӣp=A@]y?5^A@@~A@#vA@kA@GA@̶I A@\"A@CA@uZdA@XNA@;SA@A@@lA@&1A@Nj(A@1^IA@~jA@p}CA@S#1A@6A@ohA@VA@ߺ/A@`;OA@ףpA@rhA@kR-A@NA@1EA@DzA@|?5A@ڏVA@5vA@OA@QA@f'A@I"A@,sA@Zd;A@(\A@d|A@ -A@vA@~Vd;A@aA@D A@'H7AA@ MbA@nA@9 ףA@ߥA@A`A@y+$A@\x&A@?wGA@"rhA@K7A@hA@A@A@ZI A@tV-A@WMA@:LnA@(\A@ A@=`A@A@nA@/333A@oSA@R{jtA@5!A@ǡEA@l= A@A@tA@^X9A@ZA@jGzA@MP㥛A@0~jA@/A@AA@QA@|?A@3A`A@$A@eʡA@H%\A@+SA@qA@/$A@ԼʡEA@bfffA@+A@}A@`T9A@CxA@&p= A@ F +A@KA@ϑClA@7OA@zA@xA@[)A@>MbA@!u&1A@QA@ rA@ftA@ X9A@A@sXA@V*A@9K7A@JbXA@xA@╙A@;5^A@"A@lA@n-A@Qӣp=A@4y?5^A@~A@vA@jA@GA@I A@\"A@iCA@LZdA@/NA@SA@A@?lA@&1A@(A@1^IA@d~jA@G}CA@*#1A@ A@nhA@VA@/A@`;OA@|ףpA@_rhA@BR-A@%A@EA@CzA@|?5A@VA@5vA@wOA@ZQA@='A@ "A@sA@Zd;A@ɾ(\A@d|A@ -A@rvA@UVd;A@8A@ B@G7AB@MbB@ēnB@9 ףB@ߥB@mA`B@P+$B@3x&B@wGB@rhB@K7B@hB@B@B@hZI B@KV-B@.MB@LnB@(\B@ח B@=`B@B@nB@c/333B@FSB@){jtB@ !B@ơEB@l= B@B@tB@{^X9B@^ZB@AGzB@$P㥛B@~jB@/B@AB@QB@|?B@v3A`B@Y$B@<ʡB@%\B@SB@pB@/$B@ʡEB@bfffB@q+B@TB@7T9B@xB@p= B@E +B@KB@ClB@7OB@lzB@OB@2)B@MbB@t&1B@QB@ rB@ftB@ X9B@gB@JXB@-* B@K7 B@IbX B@x B@ B@;5^ B@" B@bl B@E- B@(ӣp= B@ y?5^ B@~ B@v B@j B@G B@zI  B@]\" B@@C B@#Zd B@N B@S B@̙ B@?l B@&1 B@u( B@X1^I B@;~j B@}C B@#1 B@ B@nh B@V B@/ B@p`;O B@Sףp B@6rh B@R- B@ B@ߝE B@CzB@|?5B@VB@k5vB@NOB@1QB@'B@"B@rB@Zd;B@(\B@d|B@f -B@IvB@,Vd;B@B@ B@G7AB@MbB@nB@~9 ףB@aߥB@DA`B@'+$B@ x&B@vGB@rhB@K7B@hB@yB@\B@?ZI B@"V-B@MB@KnB@(\B@ B@=`B@tB@WnB@:/333B@SB@{jtB@ B@ơEB@l= B@B@otB@R^X9B@5ZB@GzB@O㥛B@~jB@/B@AB@QB@j|?B@M3A`B@0$B@ʡB@$\B@SB@pB@/$B@ʡEB@ebfffB@H+B@+B@T9B@xB@ԟp= B@E +B@KB@}ClB@`7OB@CzB@&B@ )B@MbB@t&1B@QB@ rB@xftB@[ X9B@>B@!XB@*B@K7B@IbXB@xB@B@s;5^B@V"B@9lB@-B@ңp=B@x?5^B@~B@vB@jB@nGB@QI B@4\"B@CB@ZdB@MB@SB@B@?lB@i&1B@L(B@/1^IB@~jB@|CB@"1B@B@nhB@VB@d/B@G`;OB@*ףpB@ rhB@Q-B@B@EB@CzB@||?5B@_VB@B5vB@%OB@QB@&B@"B@rB@Zd;B@w(\B@Zd|B@= -B@ vB@Vd;B@B@ɡ B@G7A B@Mb B@rn B@U9 ף B@8ߥ B@A` B@*$!B@x&!B@vG!B@rh!B@K7!B@mh!B@P!B@3!B@ZI "B@U-"B@ܥM"B@Kn"B@(\"B@ "B@h=`"B@K"B@.n#B@/333#B@S#B@zjt#B@ #B@ơE#B@l= #B@c#B@Ft$B@)^X9$B@ Z$B@Gz$B@O㥛$B@~j$B@/$B@{A$B@^Q%B@A|?%B@$3A`%B@$%B@~ʡ%B@$\%B@S%B@p&B@v/$&B@YʡE&B@9B@!;5^9B@"9B@l9B@,:B@ңp=:B@x?5^:B@s~:B@Vv:B@9j:B@G:B@I ;B@[";B@C;B@Zd;B@M;B@nS;B@Q;B@4?l;B@&1B@*|?5>B@ V>B@4v>B@O>B@Q>B@&>B@|">B@_r?B@BZd;?B@%(\?B@d|?B@ -?B@ίv?B@Ud;?B@?B@w @B@ZG7A@B@=Mb@B@ n@B@9 ף@B@ޥ@B@ɄA`@B@*$AB@x&AB@rvGAB@UrhAB@8K7AB@hAB@ AB@AB@YI BB@U-BB@MBB@mKnBB@P(\BB@3 BB@=`BB@BB@܈nCB@.333CB@SCB@zjtCB@h CB@KơECB@.l= CB@CB@tDB@]X9DB@ZDB@GzDB@O㥛DB@c~jDB@F/DB@)ADB@ QEB@|?EB@2A`EB@$EB@~ʡEB@{$\EB@^SEB@ApFB@$/$FB@ʡEFB@afffFB@+FB@FB@S9FB@vxFB@Yp= GB@x?5^ZB@!~ZB@vZB@iZB@GZB@I [B@["[B@sC[B@VZd[B@9M[B@S[B@[B@>l[B@&1\B@(\B@0^I\B@n~j\B@Q|C\B@4"1\B@\B@mh\B@V]B@/]B@_;O]B@ףp]B@irh]B@LQ-]B@/]B@E]B@Bz^B@|?5^B@V^B@4v^B@O^B@dQ^B@G&^B@*"^B@ r_B@Zd;_B@ӽ(\_B@c|_B@ -_B@|v_B@_Ud;_B@B_B@% `B@G7A`B@Mb`B@Βn`B@8 ף`B@ޥ`B@wA``B@Z*$aB@=x&aB@ vGaB@rhaB@K7aB@gaB@ aB@aB@rYI bB@UU-bB@8MbB@KnbB@(\bB@ bB@<`bB@bB@ncB@m.333cB@PScB@3zjtcB@ cB@šEcB@k= cB@cB@tdB@]X9dB@hZdB@KGzdB@.O㥛dB@~jdB@/dB@@dB@QeB@|?eB@2A`eB@c$eB@F~ʡeB@)$\eB@ SeB@ofB@/$fB@ʡEfB@affffB@{+fB@^fB@AS9fB@$xfB@p= gB@D +gB@KgB@ClgB@6OgB@vzgB@YgB@<(gB@MbhB@t&1hB@QhB@ȿ rhB@ethB@ X9hB@qhB@TWhB@7*iB@K7iB@HbXiB@xiB@ÔiB@:5^iB@"iB@lliB@O,jB@2ңp=jB@x?5^jB@~jB@vjB@ijB@GjB@I kB@g["kB@JCkB@-ZdkB@MkB@SkB@֘kB@>lkB@&1lB@(lB@b0^IlB@E~jlB@(|ClB@ "1lB@lB@mhlB@VmB@/mB@z_;OmB@]ףpmB@@rhmB@#Q-mB@mB@EmB@BznB@|?5nB@VnB@u4vnB@XOnB@;QnB@&nB@"nB@qoB@Zd;oB@(\oB@c|oB@p -oB@SvoB@6Ud;oB@oB@ pB@F7ApB@MbpB@npB@8 ףpB@kޥpB@NA`pB@1*$qB@x&qB@uGqB@rhqB@K7qB@gqB@ qB@fqB@IYI rB@,U-rB@MrB@JnrB@(\rB@ rB@<`rB@~rB@ansB@D.333sB@'SsB@ zjtsB@sB@šEsB@k= sB@sB@yttB@\]X9tB@?ZtB@"GztB@O㥛tB@~jtB@˚/tB@@tB@QuB@t|?uB@W2A`uB@:$uB@~ʡuB@$\uB@SuB@ovB@/$vB@ʡEvB@oafffvB@R+vB@5vB@S9vB@xvB@ޞp= wB@D +wB@KwB@ClwB@j6OwB@MzwB@0wB@(wB@MbxB@s&1xB@QxB@ rxB@etxB@e X9xB@HxB@+WxB@*yB@K7yB@HbXyB@xyB@yB@}:5^yB@`"yB@ClyB@&,zB@ ңp=zB@w?5^zB@~zB@vzB@izB@xGzB@[I {B@>["{B@!C{B@Zd{B@L{B@S{B@{B@>l{B@s&1|B@V(|B@90^I|B@~j|B@{C|B@!1|B@|B@mh|B@V}B@n/}B@Q_;O}B@4ףp}B@rh}B@P-}B@}B@E}B@Bz~B@|?5~B@iV~B@L4v~B@/O~B@Q~B@%~B@"~B@qB@Zd;B@(\B@dc|B@G -B@*vB@ Ud;B@B@Ӡ B@F7AB@MbB@|nB@_8 ףB@BޥĀB@%A`B@*$B@x&B@uGB@rhB@K7B@wgB@Z ʁB@=B@ YI B@U-B@MB@JnB@(\B@ B@r<`ЂB@UB@8nB@.333B@SB@yjtB@B@šEB@k= ׃B@mB@PtB@3]X9B@ZB@GzB@N㥛B@~jB@/݄B@@B@hQB@K|?B@.2A`B@$B@}ʡB@#\…B@SB@oB@/$B@cʡEB@FafffB@)+B@ 阮B@R9ȆB@xB@p= B@D +B@{KB@^ClB@A6OB@$zB@·B@'B@MbB@s&1B@QB@v rB@YetB@< X9B@ԈB@WB@*B@ȢK7B@HbXB@xB@qB@T:5^B@7"ۉB@lB@+B@ѣp=B@w?5^B@~B@vB@liB@OGB@2I B@["B@CB@ۦZdB@LB@S㥋B@ƋB@g>lB@J&1B@-(B@0^IB@~jB@{CB@!1B@̌B@mhB@bVB@E/B@(_;OB@ ףpB@rhB@P-B@ҍB@EB@zBzB@]|?5B@@VB@#4vB@OB@QB@%َB@"B@qB@uZd;B@X(\B@;c|B@ -B@vB@Td;ߏB@B@ B@F7AB@pMbB@SnB@68 ףB@ޥĐB@A`B@)$B@x&B@uGB@rhB@kK7B@NgB@1 ʑB@B@XI B@U-B@MB@JnB@(\B@f B@I<`ВB@,B@nB@-333B@SB@yjtB@B@~šEB@ak= דB@DB@'tB@ ]X9B@ZB@ШGzB@N㥛B@~jB@y/ݔB@\@B@?QB@"|?B@2A`B@$B@}ʡB@#\•B@SB@toB@W/$B@:ʡEB@afffB@+B@㬝淪B@R9ȖB@xB@p= B@oD +B@RKB@5ClB@6OB@zB@ށΗB@'B@MbB@s&1B@jQB@M rB@0etB@ X9B@ԘB@VB@*B@K7B@HbXB@exB@HB@+:5^B@"ۙB@lB@+B@ѣp=B@w?5^B@}~B@`vB@CiB@&GB@ I B@Z"B@CB@ZdB@LB@xS㥛B@[ƛB@>>lB@!&1B@(B@/^IB@~jB@{CB@!1B@s̜B@VmhB@9VB@/B@^;OB@ףpB@ŪrhB@P-B@ҝB@nEB@QBzB@4|?5B@VB@3vB@OB@QB@%ٞB@"B@iqB@LZd;B@/(\B@c|B@-B@خvB@Td;ߟB@B@ B@dF7AB@GMbB@*nB@ 8 ףB@ݥĠB@ӃA`B@)$B@x&B@|uGB@_rhB@BK7B@%gB@ ʡB@B@XI B@U-B@MB@wJnB@Z(\B@= B@ <`ТB@B@懗nB@-333B@SB@yjtB@rB@UšEB@8k= ףB@B@tB@\X9B@ZB@GzB@N㥛B@m~jB@P/ݤB@3@B@QB@|?B@1A`B@$B@}ʡB@#\¥B@hSB@KoB@./$B@ʡEB@`fffB@+B@罹B@R9ȦB@xB@cp= B@FD +B@)KB@ ClB@5OB@zB@ΧB@'B@{MbB@^s&1B@AQB@$ rB@etB@ X9B@ͰԨB@VB@*B@vK7B@YHbXB@lB@&1B@ۉ(B@/^IB@~jB@{CB@g!1B@J̬B@-mhB@VB@/B@^;OB@ףpB@rhB@P-B@bҭB@EEB@(BzB@ |?5B@VB@3vB@OB@QB@z%ٮB@]"B@@qB@#Zd;B@(\B@b|B@-B@vB@Td;߯B@uB@X B@;F7AB@MbB@nB@7 ףB@ݥİB@A`B@)$B@px&B@SuGB@6rhB@K7B@fB@ ʱB@²B@XI B@U-B@kMB@NJnB@1(\B@ B@;`вB@B@nB@-333B@SB@fyjtB@IB@,šEB@k= ׳B@B@նtB@\X9B@ZB@~GzB@aN㥛B@D~jB@'/ݴB@ @B@QB@Ћ|?B@1A`B@$B@y}ʡB@\#\µB@?SB@"oB@/$B@ʡEB@`fffB@+B@臨B@tR9ȶB@WxB@:p= B@D +B@KB@ClB@5OB@zB@ηB@o'B@RMbB@5s&1B@QB@ rB@dtB@ X9B@ԸB@VB@j*B@MK7B@0HbXB@xB@B@95^B@"۹B@lB@+B@eѣp=B@Hw?5^B@+~B@vB@hB@GB@I B@Z"B@}CB@`ZdB@CLB@&S㥻B@ ƻB@=lB@&1B@(B@/^IB@x~jB@[{CB@>!1B@!̼B@mhB@VB@ʸ/B@^;OB@ףpB@srhB@VP-B@9ҽB@EB@AzB@|?5B@ōVB@3vB@OB@nQB@Q%پB@4"B@qB@Zd;B@ݼ(\B@b|B@-B@vB@iTd;߿B@LB@/ B@F7AB@MbB@ؑnB@7 ףB@ݥB@A`B@d)$B@Gx&B@*uGB@ rhB@K7B@fB@ B@B@|XI B@_U-B@BMB@%JnB@(\B@ B@;`B@B@nB@w-333B@ZSB@=yjtB@ B@šEB@j= B@B@tB@\X9B@rZB@UGzB@8N㥛B@~jB@/B@?B@QB@|?B@1A`B@m$B@P}ʡB@3#\B@SB@nB@/$B@ʡEB@`fffB@+B@hB@KR9B@.xB@p= B@C +B@KB@ClB@5OB@zB@cB@F'B@)MbB@ s&1B@QB@Ҿ rB@dtB@ X9B@{B@^VB@A*B@$K7B@HbXB@xB@͓B@95^B@"B@vlB@Y+B@<ѣp=B@w?5^B@~B@vB@hB@GB@I B@qZ"B@TCB@7ZdB@LB@SB@B@=lB@&1B@(B@l/^IB@O~jB@2{CB@!1B@B@lhB@VB@/B@^;OB@gףpB@JrhB@-P-B@B@EB@AzB@|?5B@VB@3vB@bOB@EQB@(%B@ "B@pB@Zd;B@(\B@b|B@z-B@]vB@@Td;B@#B@ B@E7AB@MbB@nB@7 ףB@uݥB@XA`B@;)$B@x&B@uGB@rhB@K7B@fB@ B@pB@SXI B@6U-B@MB@InB@(\B@• B@;`B@B@knB@N-333B@1SB@yjtB@B@ġEB@j= B@B@tB@f\X9B@IZB@,GzB@N㥛B@~jB@ՙ/B@?B@QB@~|?B@a1A`B@D$B@'}ʡB@ #\B@SB@nB@/$B@ʡEB@y`fffB@\+B@?B@"R9B@xB@p= B@C +B@KB@ClB@t5OB@WzB@:B@'B@MbB@r&1B@QB@ rB@dtB@o X9B@RB@5VB@*B@K7B@GbXB@xB@B@95^B@j"B@MlB@0+B@ѣp=B@v?5^B@~B@vB@hB@GB@eI B@HZ"B@+CB@ZdB@KB@SB@B@=lB@}&1B@`(B@C/^IB@&~jB@ {CB@ 1B@B@lhB@VB@x/B@[^;OB@>ףpB@!rhB@P-B@B@ʛEB@AzB@|?5B@sVB@V3vB@9OB@QB@$B@"B@pB@Zd;B@(\B@nb|B@Q-B@4vB@Td;B@B@ݟ B@E7AB@MbB@nB@i7 ףB@LݥB@/A`B@)$B@x&B@tGB@rhB@K7B@fB@d B@GB@*XI B@ U-B@MB@InB@(\B@ B@|;`B@_B@BnB@%-333B@SB@xjtB@B@ġEB@j= B@wB@ZtB@=\X9B@ ZB@GzB@M㥛B@~jB@/B@?B@rQB@U|?B@81A`B@$B@|ʡB@"\B@SB@nB@/$B@mʡEB@P`fffB@3+B@B@Q9B@xB@p= B@C +B@KB@hClB@K5OB@.zB@B@&B@MbB@r&1B@QB@ rB@cdtB@F X9B@)B@ VB@*B@ҡK7B@GbXB@xB@{B@^95^B@A"B@$lB@+B@Уp=B@v?5^B@~B@vB@vhB@YGB@|?5B@!VB@3vB@OB@~QB@$B@"B@spB@VZd;B@9(\B@b|B@-B@vB@Sd;B@B@ C@nE7AC@QMbC@4nC@7 ףC@ܥC@݂A`C@($C@x&C@tGC@irhC@LK7C@/fC@ C@C@WI C@U-C@MC@InC@d(\C@G C@*;`C@ C@nC@,333C@SC@xjtC@|C@_ġEC@Bj= C@%C@tC@[X9C@ZC@GzC@M㥛C@w~jC@Z/C@=?C@ QC@|?C@0A`C@$C@|ʡC@"\C@rSC@UnC@8/$C@ʡEC@_fffC@+C@īC@Q9C@xC@mp= C@PC +C@3KC@ClC@4OC@zC@C@&C@MbC@hr&1C@KQC@. rC@dtC@ X9C@ׯC@UC@* C@K7 C@cGbX C@Fx C@) C@ 95^ C@" C@҄l C@* C@Уp= C@{v?5^ C@^~ C@Av C@$h C@G C@I  C@Y" C@C C@Zd C@vK C@YS C@< C@=l C@&1 C@( C@.^I C@~j C@zC C@q 1 C@T C@7lh C@V C@/ C@];O C@ףp C@rh C@O- C@l C@OE C@2AzC@|?5C@VC@2vC@OC@~QC@$C@g"C@JpC@-Zd;C@(\C@a|C@-C@vC@Sd;C@C@b C@EE7AC@(MbC@ nC@6 ףC@ܥC@A`C@($C@zx&C@]tGC@@rhC@#K7C@fC@ C@̱C@WI C@U-C@uMC@XInC@;(\C@ C@;`C@C@džnC@,333C@SC@pxjtC@SC@6ġEC@j= C@C@ߵtC@[X9C@ZC@GzC@kM㥛C@N~jC@1/C@?C@QC@ڊ|?C@0A`C@$C@|ʡC@f"\C@ISC@,nC@/$C@ʡEC@_fffC@+C@C@~Q9C@axC@Dp= C@'C +C@ KC@ClC@4OC@zC@C@y&C@\MbC@?r&1C@"QC@ rC@ctC@ X9C@C@UC@t*C@WK7C@:GbXC@xC@C@85^C@"C@lC@*C@oУp=C@Rv?5^C@5~C@vC@gC@ GC@I C@Y"C@CC@jZdC@MKC@0SC@C@"C@!pC@Zd;C@(\C@a|C@-C@vC@sSd;C@VC@9 C@E7A C@Mb C@n C@6 ף C@ܥ C@A` C@n($!C@Qx&!C@4tG!C@rh!C@K7!C@e!C@ !C@!C@WI "C@iU-"C@LM"C@/In"C@(\"C@ "C@:`"C@"C@n#C@,333#C@dS#C@Gxjt#C@*#C@ ġE#C@i= #C@#C@t$C@[X9$C@|Z$C@_Gz$C@BM㥛$C@%~j$C@/$C@>$C@Q%C@|?%C@0A`%C@w$%C@Z|ʡ%C@="\%C@ S%C@n&C@/$&C@ɹʡE&C@_fff&C@+&C@r&C@UQ9&C@8x&C@p= 'C@B +'C@K'C@ĎCl'C@4O'C@z'C@m'C@P&'C@3Mb(C@r&1(C@Q(C@ܽ r(C@ct(C@ X9(C@(C@hU(C@K*)C@.K7)C@GbX)C@x)C@ג)C@85^)C@")C@l)C@c**C@FУp=*C@)v?5^*C@ ~*C@v*C@g*C@ G*C@I +C@{Y"+C@^C+C@AZd+C@$K+C@S+C@+C@4C@Q5C@|?5C@k0A`5C@N$5C@1|ʡ5C@"\5C@S5C@m6C@/$6C@ʡE6C@_fff6C@f+6C@I6C@,Q96C@x6C@p= 7C@B +7C@K7C@Cl7C@~4O7C@az7C@D7C@'&7C@ Mb8C@q&18C@Q8C@ r8C@ct8C@y X98C@\8C@?U8C@"*9C@K79C@FbX9C@x9C@9C@85^9C@t"9C@Wl9C@:*:C@Уp=:C@v?5^:C@~:C@v:C@g:C@ G:C@oI ;C@RY";C@5C;C@Zd;C@J;C@S;C@;C@C@|?5>C@}V>C@`2v>C@CO>C@&~Q>C@ $>C@">C@o?C@Zd;?C@(\?C@xa|?C@[-?C@>v?C@!Sd;?C@?C@瞛 @C@D7A@C@Mb@C@n@C@s6 ף@C@Vܥ@C@9A`@C@($AC@x&AC@sGAC@rhAC@K7AC@eAC@n AC@QAC@4WI BC@U-BC@MBC@HnBC@(\BC@ BC@:`BC@iBC@LnCC@/,333CC@SCC@wjtCC@CC@áECC@i= CC@CC@dtDC@G[X9DC@*ZDC@ GzDC@L㥛DC@~jDC@/DC@>DC@|QEC@_|?EC@B0A`EC@%$EC@|ʡEC@!\EC@SEC@mFC@/$FC@wʡEFC@Z_fffFC@=+FC@ FC@Q9FC@xFC@ɜp= GC@B +GC@KGC@rClGC@U4OGC@8zGC@GC@%GC@MbHC@q&1HC@QHC@ rHC@mctHC@P X9HC@3HC@UHC@*IC@ܠK7IC@FbXIC@xIC@IC@h85^IC@K"IC@.lIC@*JC@ϣp=JC@u?5^JC@~JC@vJC@gJC@c GJC@FI KC@)Y"KC@ CKC@ZdKC@JKC@SKC@KC@{TC@SQUC@6|?UC@0A`UC@$UC@{ʡUC@!\UC@SUC@mVC@k/$VC@NʡEVC@1_fffVC@+VC@VC@P9VC@xVC@p= WC@B +WC@fKWC@IClWC@,4OWC@zWC@WC@%WC@MbXC@q&1XC@~QXC@a rXC@DctXC@' X9XC@ XC@TXC@*YC@K7YC@FbXYC@yxYC@\YC@?85^YC@""YC@lYC@)ZC@ϣp=ZC@u?5^ZC@~ZC@tvZC@WgZC@: GZC@I [C@Y"[C@C[C@ƤZd[C@J[C@S[C@o[C@Rn`C@!6 ף`C@ܥ`C@A``C@'$aC@x&aC@sGaC@srhaC@VK7aC@9eaC@ aC@aC@VI bC@U-bC@MbC@HnbC@n(\bC@Q bC@4:`bC@bC@ncC@+333cC@ScC@wjtcC@cC@iáEcC@Li= cC@/cC@tdC@ZX9dC@ZdC@GzdC@L㥛dC@~jdC@d/dC@G>dC@*QeC@ |?eC@/A`eC@$eC@{ʡeC@!\eC@|SeC@_mfC@B/$fC@%ʡEfC@_ffffC@+fC@ΪfC@P9fC@xfC@wp= gC@ZB +gC@=KgC@ ClgC@4OgC@zgC@gC@%gC@MbhC@rq&1hC@UQhC@8 rhC@cthC@X9hC@hC@ThC@*iC@K7iC@mFbXiC@PxiC@3iC@85^iC@"iC@܃liC@)jC@ϣp=jC@u?5^jC@h~jC@KvjC@.gjC@ GjC@I kC@X"kC@CkC@ZdkC@JkC@cSkC@FkC@)tC@QuC@|?uC@/A`uC@$uC@{ʡuC@p!\uC@SSuC@6mvC@/$vC@ʡEvC@^fffvC@+vC@vC@P9vC@kxvC@Np= wC@1B +wC@KwC@ClwC@3OwC@zwC@wC@%wC@fMbxC@Iq&1xC@,QxC@ rxC@btxC@X9xC@xC@TxC@~*yC@aK7yC@DFbXyC@'xyC@ yC@75^yC@"yC@lyC@)zC@yϣp=zC@\u?5^zC@?~zC@"vzC@gzC@ GzC@˲I {C@X"{C@C{C@tZd{C@WJ{C@:S{C@{C@. # # ------------------------------------------------------------------------- from pyitpp import itload import unittest from numpy import mat from numpy.matlib import zeros class TestITLoad(unittest.TestCase): def setUp(self): self.out = itload('test_pyitpp.it') self.eps = 1e-6 def test_scalars(self): # test all supported scalars for type and value self.assertEqual(type(self.out['a']).__name__, 'uint8') self.assertEqual(self.out['a'], 1) self.assertEqual(type(self.out['b']).__name__, 'str') self.assertEqual(self.out['b'], '2') self.assertEqual(type(self.out['c']).__name__, 'int16') self.assertEqual(self.out['c'], -3) self.assertEqual(type(self.out['d']).__name__, 'int32') self.assertEqual(self.out['d'], -4) self.assertEqual(type(self.out['e']).__name__, 'float32') self.assertTrue(abs(self.out['e']-5.67) < self.eps) self.assertEqual(type(self.out['f']).__name__, 'float64') self.assertTrue(abs(self.out['f']-8.91234567) < self.eps) self.assertEqual(type(self.out['g']).__name__, 'complex64') self.assertTrue(abs(self.out['g']-complex(-1.234, 4.321)) < self.eps) self.assertEqual(type(self.out['h']).__name__, 'complex128') self.assertTrue(abs(self.out['h']-complex(-1.234567, 4.321654)) < self.eps) def test_vectors(self): # test all supported vectors for type and value self.assertEqual(type(self.out['i']).__name__, 'matrix') self.assertEqual(type(self.out['i'][0,0]).__name__, 'uint8') self.assertTrue((self.out['i'] == mat('0; 1; 1; 0; 0; 1')).all()) self.assertEqual(type(self.out['j']).__name__, 'str') self.assertEqual(self.out['j'], 'abc') self.assertEqual(type(self.out['k']).__name__, 'matrix') self.assertEqual(type(self.out['k'][0,0]).__name__, 'int16') self.assertTrue((self.out['k'] == mat('10; 11; 12; 13; 14; 15; 16; 17; 18; 19')).all()) self.assertEqual(type(self.out['l']).__name__, 'matrix') self.assertEqual(type(self.out['l'][0,0]).__name__, 'int32') self.assertTrue((self.out['l'] == mat('20; 21; 22; 23; 24; 25; 26; 27; 28; 29')).all()) self.assertEqual(type(self.out['m']).__name__, 'matrix') self.assertEqual(type(self.out['m'][0,0]).__name__, 'float64') self.assertTrue((abs(self.out['m']-mat('30; 31; 32; 33; 34; 35; 36; 37; 38; 39')) < self.eps).all()) self.assertEqual(type(self.out['n']).__name__, 'matrix') self.assertEqual(type(self.out['n'][0,0]).__name__, 'complex128') step = complex(0.5, -0.5) ref_cvec = zeros((10, 1), complex) ref_cvec[0,0] = complex(0.0, 0.0) for i in range(1, 10): ref_cvec[i,0] = ref_cvec[i-1,0]+step self.assertTrue((abs(self.out['n']-ref_cvec) < self.eps).all()) def test_matrices(self): # test all supported matrices for type and value self.assertEqual(type(self.out['o']).__name__, 'matrix') self.assertEqual(type(self.out['o'][0,0]).__name__, 'uint8') self.assertTrue((self.out['o'] == mat('0, 1, 1; 0, 0, 1')).all()) self.assertEqual(type(self.out['p']).__name__, 'matrix') self.assertEqual(type(self.out['p'][0,0]).__name__, 'int16') self.assertTrue((self.out['p'] == mat('1, 2, 3; 4, 5, 6')).all()) self.assertEqual(type(self.out['q']).__name__, 'matrix') self.assertEqual(type(self.out['q'][0,0]).__name__, 'int32') self.assertTrue((self.out['q'] == mat('11, 12, 13; 14, 15, 16')).all()) self.assertEqual(type(self.out['r']).__name__, 'matrix') self.assertEqual(type(self.out['r'][0,0]).__name__, 'float64') self.assertTrue((abs(self.out['r']-mat('1.5, 1.6, 1.7; 2.3, 2.4, 2.5')) < self.eps).all()) self.assertEqual(type(self.out['s']).__name__, 'matrix') self.assertEqual(type(self.out['s'][0,0]).__name__, 'complex128') step = complex(0.5, -0.5) ref_cvec = zeros((3, 2), complex) ref_cvec[0,0] = complex(0.0, 0.0) for i in range(1,3): ref_cvec[i,0] = ref_cvec[i-1,0]+step ref_cvec[0,1] = complex(1.5, -1.5) for i in range(1,3): ref_cvec[i,1] = ref_cvec[i-1,1]+step self.assertTrue((abs(self.out['s']-ref_cvec) < self.eps).all()) def test_arrays_of_scalars(self): self.assertEqual(type(self.out['t']).__name__, 'list') self.assertEqual(type(self.out['t'][0]).__name__, 'uint8') self.assertTrue(self.out['t'] == [0, 1, 0, 1, 1, 0, 0, 0, 1]) self.assertEqual(type(self.out['u']).__name__, 'list') self.assertEqual(type(self.out['u'][0]).__name__, 'int16') self.assertTrue(self.out['u'] == [0, 1, 2, 3, 4, 5, 6, 7, 8]) self.assertEqual(type(self.out['v']).__name__, 'list') self.assertEqual(type(self.out['v'][0]).__name__, 'int32') self.assertTrue(self.out['v'] == [10, 11, 12, 13, 14, 15, 16, 17, 18]) self.assertEqual(type(self.out['w']).__name__, 'list') self.assertEqual(type(self.out['w'][0]).__name__, 'float32') ref_farray = [1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8] for i in range(len(self.out['w'])): self.assertTrue(abs(self.out['w'][i]-ref_farray[i]) < self.eps) self.assertEqual(type(self.out['x']).__name__, 'list') self.assertEqual(type(self.out['x'][0]).__name__, 'float64') ref_farray = [1.2222, 2.3333, 3.44444, 4.55555] for i in range(len(self.out['x'])): self.assertTrue(abs(self.out['x'][i]-ref_farray[i]) < self.eps) self.assertEqual(type(self.out['y']).__name__, 'list') self.assertEqual(type(self.out['y'][0]).__name__, 'complex64') ref_cfarray = list() ref_cfarray.append(complex(0.0, 0.0)) step = complex(0.5, -0.5) for i in range(1, 10): ref_cfarray.append(ref_cfarray[i-1]+step) for i in range(len(self.out['y'])): self.assertTrue(abs(self.out['y'][i]-ref_cfarray[i]) < self.eps) self.assertEqual(type(self.out['z']).__name__, 'list') self.assertEqual(type(self.out['z'][0]).__name__, 'complex128') ref_cfarray = list() ref_cfarray.append(complex(0.0, 0.0)) step = complex(-0.5, 0.5) for i in range(1, 10): ref_cfarray.append(ref_cfarray[i-1]+step) for i in range(len(self.out['z'])): self.assertTrue(abs(self.out['z'][i]-ref_cfarray[i]) < self.eps) def test_arrays_of_vectors(self): self.assertEqual(type(self.out['aa']).__name__, 'list') self.assertEqual(type(self.out['aa'][0]).__name__, 'matrix') self.assertEqual(type(self.out['aa'][0][0,0]).__name__, 'uint8') ref_bvarray = [mat((1, 1, 1, 0, 0, 0, 1)).T, mat((0, 0, 1, 1)).T, mat((1, 0, 1)).T] for i in range(3): self.assertTrue((self.out['aa'][i] == ref_bvarray[i]).all()) self.assertEqual(type(self.out['bb']).__name__, 'list') self.assertEqual(type(self.out['bb'][0]).__name__, 'matrix') self.assertEqual(type(self.out['bb'][0][0,0]).__name__, 'int16') ref_svarray = [mat((1, 1, 1, 2, 3, 0, 1)).T, mat((0, 6, 1, 1)).T, mat((1, 7, 1)).T] for i in range(3): self.assertTrue((self.out['bb'][i] == ref_svarray[i]).all()) self.assertEqual(type(self.out['cc']).__name__, 'list') self.assertEqual(type(self.out['cc'][0]).__name__, 'matrix') self.assertEqual(type(self.out['cc'][0][0,0]).__name__, 'int32') ref_ivarray = [mat((10, 10, 10, 20, 30, 0, 10)).T, mat((0, 60, 10, 10)).T, mat((10, 70, 10)).T] for i in range(3): self.assertTrue((self.out['cc'][i] == ref_ivarray[i]).all()) self.assertEqual(type(self.out['dd']).__name__, 'list') self.assertEqual(type(self.out['dd'][0]).__name__, 'matrix') self.assertEqual(type(self.out['dd'][0][0,0]).__name__, 'float64') ref_dvarray = [mat((0.1, 0.1, 0.1, 0.2, 0.3, 0.0, 0.1)).T, mat((0.0, 0.6, 0.1, 0.1)).T, mat((0.1, 0.7, 0.1)).T] for i in range(3): self.assertTrue((abs(self.out['dd'][i]-ref_dvarray[i]) < self.eps).all()) self.assertEqual(type(self.out['ee']).__name__, 'list') self.assertEqual(type(self.out['ee'][0]).__name__, 'matrix') self.assertEqual(type(self.out['ee'][0][0,0]).__name__, 'complex128') step = complex(0.5, -0.5) tmp = zeros((5, 1), complex) tmp[0,0] = complex(0.0, 0.0) for i in range(1, 5): tmp[i,0] = tmp[i-1,0]+step ref_cvarray = list() ref_cvarray.append(tmp) ref_cvarray.append(tmp[0:3]) ref_cvarray.append(tmp[1:5]) for i in range(3): self.assertTrue((abs(self.out['ee'][i]-ref_cvarray[i]) < self.eps).all()) self.assertEqual(type(self.out['gg']).__name__, 'list') self.assertEqual(type(self.out['gg'][0]).__name__, 'str') ref_cvarray = ['abcd', 'abc', 'defghijk'] for i in range(3): self.assertEqual(self.out['gg'][i], ref_cvarray[i]) def test_arrays_of_matrices(self): self.assertEqual(type(self.out['hh']).__name__, 'list') self.assertEqual(type(self.out['hh'][0]).__name__, 'matrix') self.assertEqual(type(self.out['hh'][0][0,0]).__name__, 'uint8') ref_bmarray = [mat('1, 1; 1, 0; 0, 1'), mat('0, 0, 1; 1, 0, 1'), mat('1; 0; 1')] for i in range(3): self.assertTrue((self.out['hh'][i] == ref_bmarray[i]).all()) self.assertEqual(type(self.out['ii']).__name__, 'list') self.assertEqual(type(self.out['ii'][0]).__name__, 'matrix') self.assertEqual(type(self.out['ii'][0][0,0]).__name__, 'int16') ref_smarray = [mat('1, 2; 1, 3; 4, 7'), mat('4, 7, 1; 8, 6, 1'), mat('3; 8; 5')] for i in range(3): self.assertTrue((self.out['ii'][i] == ref_smarray[i]).all()) self.assertEqual(type(self.out['jj']).__name__, 'list') self.assertEqual(type(self.out['jj'][0]).__name__, 'matrix') self.assertEqual(type(self.out['jj'][0][0,0]).__name__, 'int32') ref_imarray = [mat('11, 21; 11, 31; 41, 71'), mat('41, 71, 11; 81, 61, 11'), mat('31; 81; 51')] for i in range(3): self.assertTrue((self.out['jj'][i] == ref_imarray[i]).all()) self.assertEqual(type(self.out['kk']).__name__, 'list') self.assertEqual(type(self.out['kk'][0]).__name__, 'matrix') self.assertEqual(type(self.out['kk'][0][0,0]).__name__, 'float64') ref_dmarray = [mat('1.1, 2.1; 1.1, 3.1; 4.1, 7.1'), mat('4.1, 7.1, 1.1; 8.1, 6.1, 1.1'), mat('3.1; 8.1; 5.1')] for i in range(3): self.assertTrue((self.out['kk'][i] == ref_dmarray[i]).all()) self.assertEqual(type(self.out['ll']).__name__, 'list') self.assertEqual(type(self.out['ll'][0]).__name__, 'matrix') self.assertEqual(type(self.out['ll'][0][0,0]).__name__, 'complex128') step = complex(0.5, -0.5) tmp = zeros((3, 2), complex) tmp[0,0] = complex(0.0, 0.0) for i in range(1,3): tmp[i,0] = tmp[i-1,0]+step tmp[0,1] = complex(1.5, -1.5) for i in range(1,3): tmp[i,1] = tmp[i-1,1]+step ref_cmarray = list() ref_cmarray.append(tmp) ref_cmarray.append(tmp[0:2][0:2]) ref_cmarray.append(tmp[0:1][0:2]) for i in range(3): self.assertTrue((self.out['ll'][i] == ref_cmarray[i]).all()) if __name__ == '__main__': unittest.main() itpp-4.3.1/extras/txt2man.sh000077500000000000000000000001411216575753400157500ustar00rootroot00000000000000#!/bin/sh if [ -f itpp-config.t2t ]; then txt2tags -i itpp-config.t2t -o ../itpp-config.1.in fi itpp-4.3.1/gtests/000077500000000000000000000000001216575753400140235ustar00rootroot00000000000000itpp-4.3.1/gtests/CMakeLists.txt000066400000000000000000000047601216575753400165720ustar00rootroot00000000000000# # \file CMakeLists.txt # \brief cmake configuration file for gtests # \author Bogdan Cristea # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- file ( GLOB ITPP_TEST_SRCS *.cpp ) include_directories ( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${GTEST_DIR} ${GTEST_DIR}/include ) add_executable ( itpp_gtests ${ITPP_TEST_SRCS} ${GTEST_DIR}/src/gtest-all.cc ${GTEST_DIR}/src/gtest_main.cc ) foreach (FILE ${ITPP_TEST_SRCS}) get_filename_component ( target ${FILE} NAME_WE ) if (target MATCHES "^fastica") set_source_files_properties(${target} PROPERTIES COMPILE_FLAGS -DFASTICA_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/fastica_test_data.txt\\") endif() if (target MATCHES "^parser") set_source_files_properties(${target} PROPERTIES COMPILE_FLAGS -DPARSER_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/parser_test_data.txt\\") endif() if (target MATCHES "^itfile") set_source_files_properties(${target} PROPERTIES COMPILE_FLAGS -DITFILE_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/itfile_test_data.it\\") endif() if (target MATCHES "^g711") set_source_files_properties(${target} PROPERTIES COMPILE_FLAGS -DG711_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/g711_ref_data.it\\") endif() if (target MATCHES "^audiofile") set_source_files_properties(${target} PROPERTIES COMPILE_FLAGS -DAUDIOFILE_REF_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/audiofile_ref_data.au\\") endif() endforeach (FILE) if (NOT WIN32) target_link_libraries ( itpp_gtests ${ITPP_LIBS} ${libitpp_target} pthread ) else() target_link_libraries ( itpp_gtests ${ITPP_LIBS} ${libitpp_target} ) endif() itpp-4.3.1/gtests/array_test.cpp000066400000000000000000000062411216575753400167070ustar00rootroot00000000000000/*! * \file * \brief Array class test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST(Array, Operations) { ostringstream ss(ostringstream::out);//replaces cout const string ref[] = {"Testing simple Arrays of integers:\ A1 = {1 1 42 1 1 1 1 1 1 1}\ A2 = {5 5 5 5 5 5 5 5 5 5 5 5 5 5 5}",\ "Testing Array initialisation with: \"{[1 1] [1 0 1 0] [0 0 1]}\":\ A3 = {[1 1] [1 0 1 0] [0 0 1]}",\ "Testing Array initialisation with: \"{{[5 3; 020 4] [1 0; 3 9]} {[0 -3; 1 0xa]}}\":\ A4 = {{[[5 3]\n\ [16 4]] [[1 0]\n\ [3 9]]} {[[0 -3]\n\ [1 10]]}}",\ "Testing Array::operator():\ A4(1) = {[[0 -3]\n\ [1 10]]}\ A4(0)(1) = [[1 0]\n\ [3 9]]",\ "Testing Array::left(), Array::right() and Array::mid():\ A1.left(4) = {1 1 42 1}\ A1.right(5) = {1 1 1 1 1}\ A1.mid(2, 3) = {42 1 1}",\ "Testing A4.swap(0, 1):\ {{[[0 -3]\n\ [1 10]]} {[[5 3]\n\ [16 4]] [[1 0]\n\ [3 9]]}}"}; Array A1(10), A2(15); A1 = 1; A1(2) = 42; A2 = 5; ss << "Testing simple Arrays of integers:" << "A1 = " << A1 << "A2 = " << A2; ASSERT_TRUE(ss.str() == ref[0]); ss.str(""); // Test of Array initialisation by string: Array A3 = "{[1 1] [1 0 1 0] [0 0 1]}"; ss << "Testing Array initialisation with: \"{[1 1] [1 0 1 0] [0 0 1]}\":" << "A3 = " << A3; ASSERT_TRUE(ss.str() == ref[1]); ss.str(""); Array > A4 = "{{[5 3; 020 4] [1 0; 3 9]} {[0 -3; 1 0xa]}}"; ss << "Testing Array initialisation with: \"{{[5 3; 020 4] [1 0; 3 9]} {[0 -3; 1 0xa]}}\":" << "A4 = " << A4; ASSERT_TRUE(ss.str() == ref[2]); ss.str(""); // Test of operator() ss << "Testing Array::operator():" << "A4(1) = " << A4(1) << "A4(0)(1) = " << A4(0)(1); ASSERT_TRUE(ss.str() == ref[3]); ss.str(""); // Test of left(), right() and mid() methods: ss << "Testing Array::left(), Array::right() and Array::mid():" << "A1.left(4) = " << A1.left(4) << "A1.right(5) = " << A1.right(5) << "A1.mid(2, 3) = " << A1.mid(2, 3); ASSERT_TRUE(ss.str() == ref[4]); ss.str(""); // Test of swap function A4.swap(0, 1); ss << "Testing A4.swap(0, 1):" << A4; ASSERT_TRUE(ss.str() == ref[5]); } itpp-4.3.1/gtests/audiofile_ref_data.au000066400000000000000000002343401216575753400201460ustar00rootroot00000000000000.snd`8@ITPP reference audio file contains 1004 Hz tone at 8 kHz sampling rate.??x9?dc=?֚yZp?iĥKto4d9RÿZjiKeDkr)!?M`Zאa?[*?(LG?ii?BhԺ?65?.-X?V}eL>L 0ܿ-O2L}qG냿8?<{QW?ԁ5?Ȫ?4?͔M9?c#ƚ*?οӿRo;?=?GF?2^PX,?4vE>}jS6셿藛ц2yW׿ۤ]?{Qc?kx|F?N+s,?֣?>8շ?*2?O$ÿJ]EF? )I0N'-'̿˩sWٷJűl?}&ǧhϿ>[?9$+? ][?gT?XD)?㈓TͲ?n?_#ww2("GT6y6D瀞I?n biX?ʽ7}1?:%M? ?Nȹ ? ?$/Z gS?JZn'ʪXKl&Vfv+ŕһv!nf?ŜUֿfqjC?.HPN?g',?3?Kl?<=o_?xbY1Px?ٖh ~ezn% WGV'eڶ?:%ἆQR>?ꢊ*6T?ɐA?ZQ?Z?ᑘMf?P-#YdF?f|bL3 # >=En;3rg:?#oG?}~`'?̴?/R ?-I?EdT?#}~}fuǿ?N.HHE`yHncؓVJL F? }&`2.Ve?~1/???C?3 ?ﲿN)߲sQ?mTĜ/؂)бhTHQY/ ߵF[ؿ ]~?ד]\ ?0Ãv?x eP?Ai?EB#m?H?5t?ާ,7ֿ=nx5 N/McdށbK?ҠV(@D?G?;?@~?_ e?ݗn\ ?~Έ2d &h?<\!wg `P7/voDTB ſH.Z^ƒ?(8&l܄DJe?3?ԊWe?N4?켤S8?'?=4?`/X$ LẌB,}YL]$nnA?խW6\E?Cz&?0F? H?JF?ڳ,?7wܿo'V6?V@Rf*74S0sľBq\??g#K#zӆ1Q?/ [ٚxe?So?׏ZH?Z?hnI?;nn?uL~򗫦?Yz.|ONL; k2P}⦮4톈T2?حh{,R!/?D? D"5]?r% ?7=?׿.6p?^>j|?_w5*Wk\8/<տI Z4lɿI4o?'Nr ȿ֟Te?(Q?څ!((#?r?3;6?>l? ơ5@B2?H,~vIE?%W$_Jb}mH  ?ۜw˿YΌ ?5y/?h:?텪?FTlpo?ԻqU?H'V&3?YacVͳ$ۿܲOKYTE{gO2NܬV =,_?.+D7ӕ&?v'?i@?k!AE?.f?3ڔ3F?SНr-ο 7?ю$D; bꗿ;ba&joޡ.#[csq?zw eO/ߤ?ȿ? \? N{?",?ѩ*cɷ?w/&?FS>C⦿߈Bru؋ݧ~hKi7 H!?CDzdWB?:?g ?B?1or?^9?2J9.?qR vпvI嫎p۽>{:{KΩsV=?Wcብ3??;?;XnjO(?)Ol?0tG-? -zֵXO?P5z4%~<+Dd.@H潬Dˇ>N/B?P݄!ƏʾiH;?K2x?|>,??Uc!? ܫ?AU\#=R ?+1a`d5Ͽ=盭jYqZa3cCHwq5QJ?Gǖl?s i?'6$?Za ?}#?{YMg?= 4%Q]-Syl?w#Z8{yYs~lٿ6]1<|B?f;_k?]?#uZ?w?! ˄?àWgQ? ⩿ݹ?|,d" o2\F 3釈4WP?K2= 0?]?t*=[H?h^p?#Q?q6m?H*@ݫ?IĿ–s:Łڿ)F[RȸhͿ Xt?ࣱoE=bI?·4? 15?)?#?~iۭ?ȺF>Ǻm?lh9,.pOme c[k{笿JzYicW{?Uo4K ?M?䴮3y?e;?.&`?29?D5Mf?{J69ʿꟾֿ!O"ʧ.T-ÿ+ ?)w@鿮4?i?O}?޿ ?QQ9?TGp'N?Y=ȿvA#?V2u(ֿSu癵픕+Aȳ׿當;vt?-[ܿ%?V?U?SҸ^?ͽ?3?0[4 8f1?b ̿k2hjNj ŃGc8п?W_8心M9ƨG??|Iy?w\??ibM6?栞f;栞f;ibLvǿw񢤿|I1?M9ƁW_8͜??8?Gc? Ń?2hjN!?ib }? 8fܡ0[ɿͽSҷU 8V?%-\M?vt?當ߒ?+Aȳ?癵-?Sv+?(ѿV2un?vA#Y=`TGp-QQ9޿ ͡Oi?Ȋ)w@? "?+(?-?"ʧ.?!N?ꟾῲ{J64?fnD5Mڿ29 .&`e;I䴮3,M ?KǺȺFD~iտ#)Ɲ 15·4?=bqࣱo? Xtk? ?ȸh?)F[?ŁT?–s.I?@ݬVH*q8#Qh^p8t*=[¿]?= 0΍K2?釈4W? 3?F?o2\T?" 8?{|*/?ݹ6 àWd! ˛w̿#uZ-]7?k_f; ?1<|}?6]6?l?s~?{yY?Z85w!?Q]-Sy= 4_{YM}#Za '6$s i?ǖn~G ?wq5P?a3cD?jYqG?=W?6O?`P+1a?=RAU[ο 9Uc ذ|>-#K2x?ʾiHɿP݄!??ˇ>O?@H潬.?d.;?%~<+?5z4˿Pc?XN -z0tGӿ)O;XnjO];좿?ብWb?V=?Ω?{:{p?p۽?vI嫎?qR ?J9ֿ2D^9ù1oBrg Z ?BCDzec? G?Kh ?ݧ~?؋?߈Br?⋿FS>Da?/&vѩ*cȎ"V N \%ȿ? eO/rzw,?#[cs'?oޟ?&j?;b? b?;ю$? HSНr-3ڔ3H^.!k!AEϿi?Sv' ?ӕ.+DJ? =,?ܬXE?gO2?YTE?ܲOK\?Vͳ% Ya??V&5H'sԻqFTlpN텪Ŀh:5y/?YΊۜw?H ?}m?$_J@?W??%?IyH,}T?@B ơ>lo3;6gڅ!((#˿(Q,?֟Tdǿ'Nr ?4o??4l?I ?8/=?*Wk]_w5?j|ڿ^>׿.6?7=r%Ͽ D"6y?!ؿحh{,Q?톈TY?}⦮?k2Z?; ?NL?|Yz?򗫥]uL;mRhn慿Z׏ZHĿSo?ٚxe¿/ ?ӆ1G?K#`???g#?q֭?sľ?*74SV@R?o'V6Q7wӿڳJ Hտ0DkCz?\EխWh??nn*?YL]f?,}?LẊ?$ `/)?4#='켤SNTԊWڤ3?܄DJeֿ(8&n?^a?H.\*?B ]?oDU?7/?wg `\<\!k?d &ߎ~Έ2ݗn\_ ex@:ƿG?DsҠV(\?bKs?Mcdނ?/f?5 G?=nx7?7 ާ,? G5HEB#[:}&ǧa?űl?ٷJA?W?˩s?'-)?I0N Ԙ?J]?"O$ؿ*O>8՟ֿ֣N+ukx|?Qc{_?ۤj?yW?藛ц/?S6z?}j?vE\?PX2fGFֿU>=(1迳HA4C3әI?P F[n}?qݥ?"\?%'~?տC? ?0W&\=?PXV?2U?vE-?H?S6앿}j?yW?藛ц{ۤWkx| Qd֣?N+lb*?>8?J]Er?O$?I0N8? Չ?˩s'- ?ٷJW-}&ǧgűl9$+ʒ>\-gT? ]_)㈓Tb?XD)E?mO?&?wj?_#%?(!5,?6y6&Gkn瀞Iʽ7| bi ?:%߿ ?Nȸ? gQ;?$/r?ʪY?JZml?fvKl'?v!ŕҬŜUuf.HPO5fqj3?g',<=o?Kl?1P?xb?h ?ٖ\?n% ez?GV'W2:ѿeڷ0ꢊ*6ἆQQZV?ɐ@ᑘM?Z?Yg?P,?3W?f|bL?E# ?EB#? ?5{?7?ާ,?5 =ny?Mcdށ3/ƿҠV( bKͿGCD@~?k2حh{,SU톈T :!_r%H? D"4A׿.6?7>:?j|O?^>?*Wk\?_w5?I 8/;?4m'Nr!4o(Q⿿֟Tg?څ!((!>l?3;6?@B? ơ@?I?H,?W?%?}m7$_JۜwH ,5y/SY΍0텪l?hF?؋~߈Brܪ?Kfݧ~ǿCDzfÿ GoUB6B?g O^9?1oK?J9?2?l?qR?p۽vI嫏3?Ω{:{WcgV=xѿብ;XnjOy?;u0tG?)OI?XM? -z׏?5z41?P|d?d-ο%~<,r?ˇ>L@H潬ZP݄! K2xʾiHY?|>, ?Uc?=P?AU]?`?+1a?=6?a3cAjYqmG߿wq5Qs hǖoNZa!?'6#{YM?}#ݰ?Q]-Sz?= 4X?Z8X?w}?s~N{yZB?6]lf;1<|]k"w?#uY3àWm?! E?ݹ? ?ؙ?|' ?o2[ڿ" ? 3wF˿K2 釈4W]޿= 0Uh^p?t*=[q0?#Q?@ݬ?H*;?–sG?I՞?)F[Ł*? ȸh廿ࣱn̿ Xt,·4ؿ=b )? 13߿~iА?#?>Ǻ?ȺF?.pOw?lh6? c[le?JzYn2{瞿Uo3W|MݿKӿe; ?䴮3튿29?.&`?f?D5MU?ꟾ?{J66?"ʧ.!N?+ɿ-)w@ i˿֫޿ ?OTGp ?QQ9?vA#?Y=?(?V2u ?癵SuG?當ܿ+Aȳǿ-Zvt3V+%6Sҷi?U ̿?ͽ? 8f{?0[?g?b ? Ń2hjMC?8EGc W_8ÿM9Nw?|I¿ibL??栞f;?栞f<?ibKX?|JUw񡃿M9ſ޿W_8̜Gc?8+32hjM? Ń?b 0?l?0[_? 8f?ͽƛ?U!cSҶۿ%:Vvt-[G+Aȳ?當Su?癵r?V2t?(?Y=?vA#?QQ9TGp?O'޿ 9ٿi󢚿 e)w@Q-?+S!O0?"ʧ.2?{J60*?ꟾ?D5L?f?.&`տ29@?䴮3e;1K_MW| Uo4"{?JzYge.? c[k?lh/?.pO?ȺF@?>Ǻ\?#y~i? 14)~=b·4 Xtࣱooȸh?LŁ?)F[?I0?–s`?H*?@ݭ?#QVq=?t*=[h^p= 0]釈4W0K2F? 3B" ?o2[^?|#?ط? ?ݹ?! dàWjt?#uYڿwk]&1<|#f;l ?6]տ{yZ?s~?wM?Z8{?= 4,?Q]-Sw?}#տ{YM?'6$?Za!#ǖls i$wq5PGjYq?a3c>7?=r?+1a?` ?AU\?=Qw?Uc ?|>,οʾiHmK2xP݄!Ǔ@H潬?ˇ>Ix%~<)?d/?P?5z4|? -z!?XNh?)Ox0tG_?;&;XnjO ብV= Wd{:{?ΩvI嫌w?p۽*?qR ??2x?J9?1o^9~?g B勵B؊ GCDzh+ݧ}?Kl߈Br?؋?FS>E$?o?w$?/&G?":ѩ*cR? \ N eO/^ȿ#[crdzw&jN?oޣ b1?;b?ю$?;?SНr-? ?.3ڔ3EO?iB,k!AEӕv' =-/.+DgO2?ܬYܲOK?YTE?Ya?Vͳ$?H'Ϡ?V&4a?FTlpӿԻq ?h=ǿ텪Y·5y0@H ۜwv$_J?}mu?%?W?H,~?IW? ơ?@Bz?3;6(>lm?څ!((&֟TiB(QS4p'NrU4l?տ8/=6?I E?_w5>?*Wk\?^>|?j|?7>׿.6E? D"2r%!ȿ톈T䀿حh{,Q#k23?}⦮NL?; ?Yz?|?uL ?򗫨W?hn';j_?׏ZHO[rٚxf|Soӆ1l/ Ͽ??g#?K#sľ?q?V@R3?*74S?7wC?o'V9R?Jڳn?0C H\EFCzѿխWYL];?nnLX̊?,}O?`/E?$ ^?=e?4+?켤S'K?ԊWNu܄DJe⌿3^Ɓ(8&mEB ?H.YM7/?oDT?<\?wg a?~Έ2n?d &?_ eIݗn\U?:@9D'G餿bKҠV(Ú/)?Mcdƿ=n{I?5 ?ާ,?7?5? ?EB# HS?x ePnAi喿\ 0à ]NהQY/?ߵF[б?hS?mTź?/؂??N)߲q?C3 ?ۿܿ`2.Uɿ~1 Fɿ }&cu?VJLE`rP?n?N/?H?#}?}fuĨ?-IEd]?̴/R G}~`ݪ:#%|?;3r# 84?EG?f|bL?3?P-2?Yc ?Z-ᑘM:?ɐC߿Z,ἆQQ=ꢊ*6eڶ:ؿW?GV'eu?n% 6?ٖW?h /?xb[?1PL?Km)<=o?g',"ȿ3fqj.HPOf,ŜUŕ?v!|Kl#4?fvL?JZnc?ʪXh?$/R? gTn?Nȹw  ?:% biſʽ7~[瀞I nG?6y70u?("?_#?w? ?p?XD)ÿ㈓T̾? ]b`gTο>]9$+׿űl }&ǧ^Wp?ٷJ'-&v?˩s? ?I0N?O$?J]K?>8֢*?N+֣ϭQdkx{Kۤt{6藛ц?yW)}j?S6?ܩ?vE?2D?PX?U>=2GF?HA!$1P F[3әqݬzq%'~M?"\Ϳ ?տC?d1x93dc=֚?yZiĥK ?o4c?9Rg?Zj?iJ?Dm?r)!M`L?א`[ݿ(LWDiiBhԱ6>.?-NοV~a?eLv?L ?-OC?L}¨?G2?8ῦ<{?QWkԁ6ȭ4ſ͔M9멿c#ƚuο?Ro=GFt2w?PXނ?vE$?}j6?S6`?藛ц?yW?ۤM{?Qckx|MN+o֣>8*O$?J]8 ?I0M8?'-3?˩s?Wl?ٷJR?űl￾}&ǧk$?>[ݿ9$+ѿ ]X̿gTXD(J㈓TΧ\?f_#h?E?/?;3r?:-#?G}~``̴,/R!<-IʿEd#}O?}fuֿN.P?Hp?E`x{?n?c5?VJL? F_ }&G?`2.Wܿ~1OwC3 ~?N)߲tڿmT[?/؂O?бT?hTw?QY.t?ߵF[? ]א?\0Âax eS|Ai'EB#ϿH5_?ާ,?7?=nv?5 ?/?Mcdބ?bLDҠV(?DYGc= @~_ fݗn\~Έ2?d &<\"?wg _?7/+?oDUY?B ?H.]?^(8&pH?܄DJeߵ3 _ԊWN켤SY'r=/?4`/?$ R?LX̅?,}?YL\2?nn>?WխW?\EfCz|0F HlJ0ڳ錿7w?o'V4ͿV@Rș?*74S?sľ?q???g$N?K#3?ӆ1ٿ/ ?ٚxcSp>׏ZHCZܿhn4;nϿuL?򗫣ݿYzS?|?NLj?;!?k2?}⦮?톈Tحh{,T?!a D"4r% 7=׿.6^>r?j|]_w5?*Wk\?8/@?I ?4m@? ?4o['Nr":?֟TfJ(Qڅ!(("R3;6Q>l ơ?@BH,?IDŽ??%?W?$_J?}mx?H ۜwS?YΌp5y/th9p텪FTlp ԻqH'в?V&0 Ya?Vͳ%m?ܲOK}?YTE ?gO2e?ܬV? =,w.+D?ӕv'˿i=k!AF/.3ڔ3ISНr,? cю$?;Q? b?;b?&j?oޠ?#[cszw? eO/ȿp \ N!ѩ*cv^?/& FS>B??߈Br?؋P?ݧ~Z?Ki? H;CDzc?BPgBݿ1o^9k2ɩ?J9ܿqRb??vI嫍?p۽Y?{:{>?Ω@?V=ۀMWb?ብq;;XnjPP)OԿ0tG0 -zI?XOP?5z4?%~<+?d.?@H潬?ˇ>R?P݄!Ō?ʾiHݿK2x叿|>." UcJ ِAU[?=Rʿ+1a?`Z?5?=?jYq?a3cH?wq5QG?ǖes io'6%Za =}#{YMH= 4C?Q]-Sy@w$?Z8?{yX?s~;?l?6] Z?1<}f;?k{]g#u[#w! ˣàWd. ?ݹ]|-c?\?" ?o2\?F? 3?釈4W;K2?= 0տ]1t*=[h^p#Qq7?H*7?@ݫIY?–s?Ł?)F[?ȸh?y? Xtࣱp?=b·4 15)#~iRȺF?>Ǻ~lhB?.pOO?eR? c[m?{?JzY[?W{Uo5Y?K߿M䴮3Qe;*.&`29D5Na?fп{J6Ck?ꟾ?!M^?"ʧ/?-?+? X)w@?ŀi󢲿OV޿ +QQ9TGp:Y=?vA#V2u#Z?(?Sw ?癵_?+Aȳ?當̋?vt-\q?%ٿVUSҸͽ˿0[ ? 8fRb k?u?2hjN? Ń?Gc?8m?¿W_8Ϳ?M9Ƶ|Hw5ibNF栞f=8?栞f:a?ibNA??w2?|H?M9ƴt?W_8¿񿿐8Gc Ń2hjOu?b 8fU?0[?E?ͽ?SҸ?U?V%?-\tvt當I+Aȳ癵]Sw(?V2t*vA#?Y=?TGp:R?QQ9?޿ (?OY?i󢳿=?)w@ U+-"ʧ-$!Peꟾ?{J6CIf?D5N^?29^?.&`?e;'?䴮3T?MK߿?Uo5]W{JzYZ{׿ c[jek.pOO?lhB>Ǻ?ȺF?~i0?#?)|? 15?·4=b?ࣱp Xtȸh)F[Ł–s?I8@ݫ?H*4?q7.?#Q?h^p?t*=[?]1= 0?K2釈4W9 3Fo2\Ϳ" ]?|-Sݹ`? ?àWs?! ?wp?#uW?\ſkg?f;1<}6] Ils~8{yXZ8?w$Q]-SyD?= 4A?{YM7?}#?Za ;?'6%?s ioǖe?G޿wq5Oa3c8?jYq=癍8`$?+1a"=Ow?AU]? *?Uc{?7?|>*?K2x吿ʾiH?P݄!ŏˇ>Rտ@H潬d.%~<+5z4?PXO? -zG?0tG ?)O?;XnjN4?;?aብF?WewV=~7Ω{:|4p۽HvI嫑E?qRտJ9o?2˰?^9!?1n?B?g?BG?CDzd H9Kiݧ~[؋N߈Brݿ?FS>B/&?v\?ѩ*c=?"? N ? \?ȿ eO/K?zw Ͽ#[cqoޘ&j;b b;%?ю%h V?SНr.?3ڔ3I?.?k!AF-?i=?v'̿ӕw?.+D =,uܬUgO2gYTEܲOKVͳ%o?YaV&7A?H'?Իp?FTlqX?텪^?h@?5y0ǿY΄?ۜw#H }m$_JPW?%|ÿIDž?H,@B ? ơ?>l?3;6S??څ!(("Z?(Q֟TfC?'Nr"B4oY ׿4mAI 8/@%*Wk]?_w5Bj|?^>?׿.6K?7??r%? D"<`?!?حh{,L톈Tm}⦮,k2H;!NLr|?YzK򗫣?uL?;n?hn5?Z?׏ZHK?Sp@ٚxc?/ ̿ӆ1׿K#+??g$PqՉsľ*74SX?V@RGo'VX?}&ǧKűliٷJrW˩sC'-hI0M:? ƿJ]8?O$?*?>8?֣?N+o?kx|PQc?{ۤMyW藛цS6_}jWvE?pPX?2#?GFf?U>==?1?HAM?3әuP F]?gPq׿"^%'|տD 0W%??dc>x8yZʿ֚o4b߿iĥK1Zj?9RDn*?iH?M`v?r)!?]?א_A?ii꿙(L?4BhW-u".weLV|-O+?L ;G_?L}?<{ ?8?ԁ5 ?QX?4ڿȓ?c#ƚæ͔M9ꖿRoWο0W$¿=/PX2EvEܭS6?}joyW,?藛ц?{?ۤt?kx{I?Qd?֣N+b?*.>8J]+O$I0L7 ˩sϋ?'-F ٷJq?W?}&ǧ~.?űl?9$+J?>Y?gTϿ ]bO?㈓TXD)pu w_#("?0d6y7?G?n?瀞I ?ʽ7{? bi? :%1? KNȷ gD$/ʪZJZk)fu?Kl2v!=?ŕK?ŜUx?f,?.HPO?fqj?3g',"?<=oKm&1P;xb\h -ٖ[n% 6?euGV'?W?:?eڷl?ꢊ*4?ἆQT?Zɐ4"?ᑘM앿ZYrP,`3ܿf|bLdEo?# Gǿ;3r?y?#%?:?}~`ݨ?G?/R ̴?Eda-I}fuĘ#}HN/n?E`r@VJL?ca? }&}? F?~1}?`2.Yj|Ŀ^>~*Wk\_w5FI G?8/=.?4l?'NrM?4p?(QQ?֟TiJ?gڅ!((g?>l3;6¿@B0 ơIH,W??%O}m ?$_Ju?ۜw"?H ?5y0??Y·?텪h=?ԻqFTlpҿV&4ZH'ϢVͳ$YaYTE?ܲOKܬY?gO2?.+D? =-1?v'M?ӕ̌?k!AFi; ?3ڔ3L.h xSНr/;ю$6;b? b8oޜ?&jt?zw?#[crf?ȿ? eO/f? N \?ѩ*cZ"9/&@w&nFS>E,؋?߈Br Kl?ݧ}?CDza4? I?ׁ?Ci?Bg?^9D1n|J92qqRp۽?vI嫏Ω?{:{?Wd?V=??ብ?;XnjO;"?0tGo)OwXNe -z#5z4{Pd/?%~<)ˇ>Y)?@H潫?P݄!2??K2x:?ʾiH#?|>)q? ,Ucǿ=TɿAUZ``ӿ+1a|=t?7a3c>?jYq?G?wq5P?s i#?ǖl0?Za!&'6$ǺYȺFC.pOlh/ c[k?e+JzYg?{?Uo4?W|"?M?K̀?e;4䴮3?29H.&`fD5Olꟾ{J6P6"ʧ0?!L(+?- ?)w@N? ?i?֟8?޿ ̒O ?TGpJQQ9vA#Y=(ؿV2t 癵u?Suݿ當-?+Aȳ?-[D?vt?V?%|?SҹUu?Gͽ} 8f(0[ #Ub y ŃZ?2hjP8?Gc?W_8v???M9?w񡆿|JR?ibK栞f<栞f;?ibLy|I?w?M9M???W_8?Gc8ě?2hjP' Ń俖b ~0[) 8fdͽw?_U?SҺ#?%?V?vt1?-Z?+Aȳǿ當?SuJ癵V2u x(ϿY=vA#QQ9?TGp O?޿ ?֫?i? F?)w@?-+?!Q"ʧ,{J6ꟾ(D5Of.&`u?29{䴮3?e;?KҲ?M?W|?Uo3?{矿JzYn?e c[l lh5.pOwȺF>Ǻ#?~io 17?)z?=b?·4I? Xt?ࣱq?ȸh2?ŁS)F[I?–sʿH*@ݩѿ#Q?s h?wq5Q?G?jYqna3cA?6=+1a`AUZο=T#UcĞ? 8|>/~?'?ʾiH?K2x?3?P݄!Ë?@H潫ˇ>\2?%~<)d/P5z4O -z׍XM)OI?0tGv;y?;XnjOw?ብ??V=v?Wck?{:{Ω?vI嫏7p۽qRh2ֿJ9A1pN?^9Ig ?B?C?N? Ik?CDz_?ݧ}Kn5?߈Brܱ؋|FS>F8w/&"?ѩ*cؿ \? NH? eO/?ȿ?#[cr?zw?&j;oޝ? bٿ;b>ю$;˿SНr,8 A. ?3ڔ3?1i9?k!AGG?ӕ?v'? =-?.+Dٛ?gO2ѧܬZ?ܲOKljڅ!((??֟Tj?(Q ?4pT?'Nr?4leP?8/;¿I _w5*Wk\^>Ϳj|V7>;?׿.6 D"7?r%~?!??톈TC?حh{,W ?k2m}⦮?NL$п;Yz | տuLտ򗫟rhnC?;s/׏ZH?[?ٚxg?SoJ?ӆ1?/ T???g#WK#?sľqdV@Rť*74S[7wo'V7տJ?ڳ暿0I? H?\Ev?Cz,??խW?YL^nn?LX̐,}=`/$ I=4켤SM?'ԊWc?N?܄DJe?3O?^?(8&k?B H.Z?7/?oDTؿ<\wg `~Έ2ud &_ f?ݗn\@$?@~F?D|?G%?bJ?ҠV(ɼ?/Mcdz ?=nr5 0ާ, 76  EB#?Hx eN?Ai?\ ?0Ã-? ]?ד2?QY/AߵF[!?бthT mT/؂N)߲wCW?3 SH??`2.S?~1/? F? }&z ?cVJL?E`o;n!N0WH1#}ۿ}fu-I?Ed ̴}?/R ?G?}~`=?:?#"?;3rl?# DEf|bL 3oP,YoZ?ᑘM挿ɐPq?Z?ἆQU:?ꢊ*4W?eڷ?:?WGV'?erڿn% \ٖh xb1P-Kl?<=o樂g',?3?fqj?.HPO8?fN?ŜUh?ŕؿv!?Kl/ܿfuƿJZkʿʪZH$/ѿ gaNȻ\? w:%? >? bi?ʽ7{?瀞I)?n?G:6y7?-P("0_#!wl&m`XD)G?㈓T_ ]_:?gT?>Z?9$+?űl?}&ǧx?WmٷJ ?'-?˩sϡ fI0PO$TJ]ed>8ӝ?*ɿN+\?֣(?Qe?kxz?ۤ㓇?{ ?藛цlyW?}j>S6앿EvE02UPXwU>=?GF8HA:?1?P FYN?3ә?qt??%'j"Zd? rտCĿ=?GF?2PX?ؿvE;}jS6N藛цtyWUۤ:?{#,Qc?kx|?N+u?֣?>8՝?*R?O$ؿJ]?? +I0M'-˩s-WoٷJֿűlQ?}&ǧQ>^d?9$+? ]L?gTق?XD+7?㈓T?y?_#wX9(!G"6y53瀞I?n] bi?ʽ7}d?:%? ?Nȸ? \?$/䓿 gN?JZoʪWuKlпfvŕ v!Ϳf?ŜUafqj?.HPLq?g',,(?3;?Kn?<=o ?xb1P?ٖ`heSn% ÿWݿGV'eڶ?:}ἆQR?ꢊ*6?ɐ=?Z?ZI?ᑘM?P-Y\?f|bL3п# 1߿EŸu;3r}:?#/G?}~`?̴ ?/R )?-I5?EdX?#} }fu?N-HڿE`{nac؞VJL F.? }&[`2.W-?~1??C?C?3 |?ON)߲n?mT!/؂б#hUNQY,ݿߵF[ \?יP\?0Ä?x eU?Ai?EB#2?H)?5&?ާ,7=nx/5 H/dMcdނbL ?ҠV(D?G?6?@?_ d?ݗn\4?~Έ2d &?<\(wg ^7/IoDSݿB )H.U^?(8&qʿ܄DJeI?3 ?ԊWf?N?켤S?'?=4?`/0$ LẊ{,}ٿYL\nnϿm?խW\E5?Cz!?0@? H?J?ڳ`?7w;o'V.?V@Rܿ*74SsľqB??g$K#ӆ1?/ !?ٚxb?Sp?׏ZH?Z?hn?;mY?uL򗫥V?Yzݿ|NL;!uk2}⦮톈T ?حh{,N&!?+? D"/?r%a?7j|*?_w5Ͽ*Wk]ѿ8/AI P4m d4o?'Nr#֟Td?(Q*?څ!((#?i?3;6?>lw? ơ@B?H,Iɿ?%~+W[$_J}mH b?ۜwYΒ~?5y.e?h3?텪?FTlq?Իp?H'ΒV&8?Ya|Vͳ%ܲOKYTDſgO2ҥܬT =,?.+DCӕ?v' ?i?K?k!AE?. ?3ڔ3Hf?SНr.v ?ю%;_ bU;b&j׿oަ¿#[cu?zv eO/'?ȿ? \ ? N?"?ѩ*cľ?u/&o?FS>@߈Br8؋ݧ~Kh G?CDze\B??g?Bv?1o?^9Ǡ?2KJ9?qRѿ9vI嫋p۽{:zyΩV=ہ?W_Kብ@??;,?;XnjM?)O?0tG? -z޿XPm?P5z4%~<+ÿd.=@H潬.ˇ>O̿{?P݄!6ʾiH?K2x?|>+s??Ucä? ?AU]x=P?+1av`2=睓jYr a3c52wq5OE?Gǖb?s i?'6&5?Za?}#B?{YM(?= 4ϿQ]-Sy?w!Z84{yYs~ƿlȿ6]81<}?f;9kU?\?#uX?w?! %?àWp? 䯿ݹ?|:" !jo2YF> 3տ釈4W?K2= 0ư?]L?t*=[?h^p?#Q?q4?H*@ݬS?I –s-Ł)F[ȸh壿+ Xt­?ࣱn*=by?·4? 13>?)Ȃ?#O?~i?ȺFο>Ǻ?lh.pOƿe c[j{鿷JzYTǿWz?Uo5K߹e?M"?䴮3?e;?.&`?29+?D5Mܿfk?{J6=ꟾϿ!M"ʧ/B-+@ w?)w@?i?O?޿ N?QQ9U?TGpm?Y=`vA#M?V2t־(Sw癵ֿ+Aȳ迤當ܿvt?-]%)?V$?U 5?Sҷ?ͽ?i?0[} 8f?b -c2hjL Ń =Gc8_?W_8sM9ǂ??|FV?wv??ibIz?栞f9Կ栞f=ſibO w|H?M9ǺȺFE~iみ#) 15"·4?=b(ࣱp? Xt)??ȸh?)F[?Łp?–syI?@ݮ>H*=q*v#Qh^p%t*=[x]?= 0ĿK2&?釈4W? 3?Fu?o2]G?" ??|0v?ݹ ?àWgA! ˄w#uZ]H?k~f;2?1<{?6]?l/?s~^?{y[?Z8w?Q]-S{= 4k{YM }#ްZa"'6!s h?ǖxG?wq5Rg?a3cK?jYp?=9?4?`3+1a?=R$AU\ ܛUc"v|>-|K2xFN?@H潬?d,?%~<-?5z4Pv?XR| -zԔ0tH̿)O;XnjP;oB?ብWa^?V=ۀ?ΩE?{:{?p۽?vI嫍)?ѿqR f?J912^91oB=g ؿ?BCDzi? F?Kcf?ݧ4?؋?߈Brr?㼿FS>;?/&xѩ*ct!Y No \]ȿ8? eO/}zwa?#[cs?oޢ?&j?;b_? b?;ю$G? SНr-U3ڔ3CĿ.ڿk!ADiCv'?ӕ\.+D? =+?ܬO?gO2g?YTC?ܲOK@?Vͳ#Ya ?V&.H' ԻqFTloʿ텪vh8 5y/3?Y΍ۜw?H V?}m?$_Jd?WR??%?IȝH,|?@B ơ>l3;6pgڅ!(((0(Q?֟T`C'Nr(?4n ??4nh?I ?8/7_?*Wk[ȿ_w5 .?j|^>׿.627=Wr%n D"3?!حh{,R?톈T0?}⦮@?k2?; ?NL a?|Yzc?򗫩׿uL;hhnyY׏ZHASq?ٚx]/ ?ӆ1?K#???g"^?q>?sľ?*74S_V@R?o'V3X7waڳJݿ H0E2Cz(?\EοխW/??nnk?YL]?,} ?LX̌?$ `/?4=!'켤SĿNԊW3>?܄DJeC(8&g7?^ǂ?H.^?B?oDU?7/?wg _<\$>?d &܈~Έ2/ݗn\_ e@~;G?DҠV(&?bKT?Mcd~Y?/?5 ?=n|?7Hާ,J?4yHEB#_Aiux eJK0Â?\L׎? ^(?ߵF[K?QY.?hT?б?/؂mT?N)߲sYﰿ3 dC  ~1?`2.U }&? F?VJL?c?n?E`?HN+?}fua#}Ed-IE/R!h̴%}~`?Gǿ#?:X?;3rq??E?# ;^?3"f|bL ?YfKP-ᑘM茿ZZɐG ꢊ*7r?ἆQP:?eڶ}?GV'?W9?n% O?e?hٖ_?1Oxb<=oKkW35g',7.HPM?fqjŜU?f?v!?ŕt?fv*?Kl&f?ʪXJZm? gW$/1 fNȹ f:%Fʽ7~? bin?瀞I[?6y3A?G?(!j?C?w_# ?c߿v㈓TEXD'ѿgT4 ]U9$+V?>\z}&ǧd?űl?ٷJ?W?˩s?'-,?I0O< E?J]RTO$*o>8%֣ϘN+1kx~Y?Qa6{6?ۤ?yW ?藛ц?S6?}j{$?vE뤿?PX{[2GF U>= 1HA'3әŎ?P F[?qݞ?"\1?%'~?տC? P?0W'h[S?אaM`3?r)!?Dj?iLQ?Zjy?9R5?o4f@iĥKֿ?yZn֚dc;Ox;x@dc;U?x;s?yZjX?֚?o4f:?iĥK?Zjy9R3?DjiLLM`2Կr)![Mאaii?(L=]6?Bh#?-A?.?eL?V~?-OJL ?GL}f<{˿9ԁ2QZ4?}c#ƚ?͔M9?Ro?ο̲?0W'?=?PX{?2?vE? ?S6̿}jz?yW 藛ц޿{ۤkx~TQa<֣ϙ?N+*v?>8?J]R?O$?I0O6? L?˩s迼'-,?ٷJW쿾}&ǧdűl9$+Q>\gT5? ]U㈓TK?XD'?c?w?w?_#?("#?6y9Gſnڿ瀞I\ʽ7~ѿ bi& h?:%% m?Nȹ? gW?$/3?ʪX?JZm?fv,Kl&E?v!ڿŕoŜUԿf.HPMҿfqj37?g',<=o?KkS?1O?xb?h ]?ٖ?n% пeiO?GV'W4:eڶ~ꢊ*7mἆQPZ?ɐFᑘM?Z?Yf+?P- ?3?f|bL?E# ;>?;3rx#:Z}~`Gο/R!j?̴Ed?-I@?}fu?#}j?H?N+?nпE`?VJLcۿ }& F~1`2.U? ޿3 k?C?N)߲sI??/؂?mT?hTб?ߵF[YQY. ׎ ^*0Á\[Aiw?x eJ;H?EB#{??4{?7D?ާ,Y?5 =n|?Mcd~h/ҠV(bKWGDǿ@~?;ݗn\?_ e?d &?~Έ2?wg _?<\$M?oDS 7/?H._B(8&vW^3:܄DJeRN?ԊW'?켤S;?4?=$?$ ;?`/H?,} LX̌?nnYLZ"խWCzÿ\E] H?0E"ڳz?J0?o'V3H?7wd?*74S?V@R~?qAsľ?K#~^??g%/ Ϳӆ1Sqٚx]\?׏ZHQ;h?hnv?򗫚?uM?|?Yzr?;#NL?}⦮Ok2حh{,CϿ톈TI!#r%P? D"B8׿.6A?7=T?j|?^>?*Wk[?_w5 >?I X8/E?ٿ4k'Nr( 4n (Q/֟ToJk?څ!((( >l?3;6?@B? ơ?I?H,?WV?%?}m"$_JۜwݿH Y5y1ӿY~ݿ텪z?h7Իp?FTlr_?V&.?H' ?Vͳ&q?Ya?YTGHܲOK?ܬOgO2d.+DG =.v'ſӕlk!AHd?i5W3ڔ3C?.? ?SНr1?;?ю$W?;b' br?oޢ+&jzwd#[cpȿ5 eO/⍿ N? \Sѩ*cτ?!V?/&?t??FS>KY?؋߈Brc?Krݧ}CDzi F֭CBA?g ^9y?1m?J9*?2??qR)?p۽ĿvI嫍!?ΩT{:|WaWV=ۀብ;XnjP?;h0tG?)O?XK? -z?5z4?Pv4?d1>%~<'?ˇ>Fo@H潬P݄!K2x:ʾiHb?|>& ܼ?Uc ?=Kp?AU`?`1?+1a?=ɿ;?a3cK2jYpG~wq5Ms hǖx˿Zan?'6(.{YM)6?}#B?Q]-S{?= 4p?Z7=?w7?s~c{y[?6]Slڿf;+1<{[kuw?#uZ{àWG?! ̽?ݹ? D?k?|?o2]L" ? 3WFK2 釈4W!]= 00h^p?t*=[q*?#Q?@ݧ?H*)?–sx?I?)F[ Ł?ȸhࣱiȿ Xt*·4=bj)? 1;V~i?#?>Ǻ?ȺF;?.pO;?lhI:? c[he?JzYk{fUo7˿WyMKe;?䴮329?.&`D?fǺ ?##~i? 13D)}=bj·4ʣ Xt§ࣱn1ȸh?WŁ?)F[?I˜D?–s)?H*?@ݬY?#QqS?t*=[h^p= 0D]:釈4WK2F? 3b" !q?o2Y?|9?? ?ݹ@?! &àWp?#u_ wBk4\1+zƿʾiH|WK2xgwP݄!=@H潭?ˇ>0k%~<+?d.9?P?5z4@? -z?XPt?)O20tH"?;3;XnjMȿብ=V=}˿Wf({:z{?ΩvI嫑?p۽?qR?;?24?J9?1o^9ǐ?gBkB! CֿCDzsJݧ~?Kh߈BrZ?؋ ?FS>@??y?/&?"ѩ*cĮ? \) N— eO/׽ȿ̿#[cu zv*&j'?oޗ` bd?;b?ю$?;?SНr.s? ?. 3ڔ39?i?Zk!AEͿӕv'~ =,.+DRgO2(?ܬcܲOK?YTD?Ya?Vͳ#%?H'Ώ?V&8?FTloԻq ?hB텪YΒn5y.hH ۜw'$_J?}ms?%?W?H,?I? ơ7?@B?3;6>lg?څ!((2c֟Td(Q-4rJ'Nr"4m? T8/2?I ?_w5?*Wk]?^>?j|?7?l׿.6? D"/$r%^!2톈Tحh{,N5k2?}⦮NL?;!r?Yz?|"?uL?򗫥e?hn鯿;^?׏ZH̿ZٚxpSm_ӆ1/ !N??g!e?K#Psľ?q??V@Rb?*74Sb?7wj?o'V=?JݿڳP?0O H¿\E&Cz%խWYL\?nnLX̖?,},?`/!?$ ?=?4 ?켤S'?ԊWON@܄DJe:3 ^D(8&bB -?H.T7/!?oDVT?<\F?wg b2?~Έ2?d &?_ h@ݗn\?6@DѿG쥿bLҠV(/2?Mcdtz=nx??5 F?ާ,ŋ?7M?5$?&?EB#VH?x eUAi\z0Àӿ \יaQY,?ߵF[uб?hS5?mT?/؂?C?N)߲~/?C3 u? D`2.W&~1 F; }&cأ?VJLE`\?nC?N-?H?#}?}fu?-I:EdQ?̴Ϳ/R!G }~`:޿#O?;3r฿# 2?E?f|bLZ?3.?P-?Y\?ZᑘM?ɐ=Z~ἆQKꢊ*:eڶ:䞿Wh?GV'et?n% ?ٖ?h ?xb?1P?Ki<=o?g',,H3:fqj.HPLvfÿŜU ŕ?v!ǿKlX9$+ɿűlP}&ǧQWk?ٷJ'-?˩s,? ?I0R?O$?J]?C?>8ڭ*?N+v֣տQi>kxwۤ9{#n藛цZ?yW t}j?S6M??vE?2?PX?U>=쑿GF?HATM1P F\3әq;筟%'}A?"]  ?տC?ⰿx=#dc9֚?yZ$iĥK?o4g?9R!?Zj?iM?Di?r)!ȿM`?א_׿\(Kii#Bhȿ5.?-?V}8?eL?L ?-O?L}?G?8<|E?QY4ԁ4ɿ4}͔M9 c#ƚAο̐?Ro3=wGFT2V?PX5i?vE?}j?S6?藛ц?yW?ۤ㓇{ ?Q_bkxڿN+\U֣)>8آ*O$0?J]% m?I0P?'-?˩sЉ?Wh?ٷJ?űl}&ǧ84?>Z9$+˿ ]?YgTXD)B㈓Te4?M_#(?wg?L?(!?G5?6y7?瀞InV? biʽ7{{:% Nȶ $/? g`JZrM?ʪU?Kl/?fu?ŕ/?v!j?fOŜUG?fqjK.HPJg',3˿Kh!<=o?xb?1P ٖl?h8׿.6ο^>?j|ۘ_w5?*Wk\?8/JX?I ~a?4lb?`?4m'Nr,m?֟Tjο(Qڅ!((,}m3;6z>lz ơ?@B=H,%?Iư??%?WP?$_J?}m?H Qۜw!0?YΘ5y-WhF?6?߈Br?؋?ݧ}?KnE? EsCDzm?CKg B 1nH^9տ2?J9:qR @?o?vI嫏0?p۽?{:y?Ω(?V=zWcc?ብֿ;r;XnjO{)O0tGm -zב?XMPl?5z4?%~<)?d/?@H潭5?ˇ>=?8P݄!Ä?ʾiHK2x溿|>(ÿۋUcĝ XAU_?ǖo_s h'6*(Za}#ݰ{YMǿ= 4?Q]-S}տw.Q?Z7?{y]?s~?l@?6]?1Ǻlh6$?.pOv?ea? c[q+?{?JzYnS?WwUo9?KMݿ䴮3e;.&`t29D5J?f {J6V?ꟾ?!Q?"ʧ,?-u?+? L)w@?+iPO޿ QQ9)TGp Y=?vA#쿨V2u?(n?SuD?癵?+Aȴ?當s:?vt6-Z?%[VOU޿SҺ)ͽa0[ ? 8fْb ?~?2hjJ^? Ń w?Gc?8Ŧ?Ǻ-?ȺFM?~i?#?)? 11g?·4_=b}?ࣱlQ Xt&bȸhJ)F[ Ł–s?I˯L@ݪt?H*-?q?#Q]?h^p?t*=[?]= 0Z?K2釈4W. 3Fȿo2[\" ׊?|CnݹR? X?àWz3?! ?w?#u]?\k葫?f;Ϳ1zjYq=1`?+1a\=N$?AU^? ?Uc??|>)x?K2xʾiH?P݄!9ÿˇ>9ȿ@H潭dd/%~<)Ŀ5z4B?PiXNl? -z?0tG%?)OJ?;XnjO ?;)?$ብ?WdV= Ω{:yp۽vI嫏?qRJ9?2l?^94?1n?B?g {?׃CY?CDzo" EKlݧ}؋%߈Brp?FS>E/&G?sl?3;6??څ!((.?(QT֟Ti;?'Nr-4lͿ4lI ~ 8/K*Wk\?_w56j|$?^>?׿.6=?7>?r%N? D"*?K!#?حh{,Iɿ톈T }⦮Sk2;"[NL|!%?Yz z򗫠?uL?;b?hn?[p?׏ZHW?SrпٚxW?/ ֿӆ1kK#xr??g&qsľ*74Sf?V@Ro'V9Z?7wA?ڳ?J? H?0K7?Cz!\E ~?խW8nnYL[,}LX̒$ ?`/s4?=?'D?켤S?N?ԊW?3܄DJe?(8&|}^H.YFB oDW7/ܒwg a?<\d &e?~Έ2?ݗn\6?_ g$?@h?2i?G놿D?ҠV(bLMcdx/5 =ns7?ާ, ?5?HM?EB#?Ai?x ePv?0Ç~\?ה¿ ]MߵF\QY+hSտб/؂?mT-N)߲y??3 ?C??k?~1`2.Y5? }&9 FпVJLcen E`xH?N/}fu?#}?EdZ?-I?/R?̴"?}~`ݬG?#:d;3r⽿~E# (3?f|bL]YS?P.?ᑘM?Zb?Z?ɐ4B?ꢊ*99ἆQM?:6eڷjGV'VWn% 5ev h?ٖ蹺1P\?xbZ?<=oh?Kq?3?g',"?.HPKfqj?ŜUf+v!ŕϬfuKl3ʪV?JZq gdL?$/? D?Nȷ? ?:%?ʽ7{ bi?n¬瀞I6y7G( P7w?_#|P??㈓T̺?XD)?gT? ]B?9$+O>Y?}&ǧ>űlٷJjW˩sq'-˿I0Q=? ſJ],3?O$?*?>8*?֣?N+c ?kxcQ^?{XۤsyW藛цS6샿}jvE?ĿPX?2D?GF?U>=?1?HAA.?3әkP F^?qe"_̿%'{տC 0W$?=PXQ2$vE鍿ᔿS6`?}jyW ?藛ц?{?ۤN?kxw6?Qi?֣뿹N+oi?*>8%J]8O$I0R6 Ў˩sD?'-&ٷJ2?W?}&ǧK=?űlj?9$+D?>X?gTٜ ]H?㈓TXD*Wwۿ_#@("?6y5?G?n~?瀞I?ʽ7|? bi? :%? Nȸ gjp$/sʪVJZp\fud?Kl90v!v?ŕГ?ŜU?f?.HPK?fqjU?3`g',(?<=oGKi1Pzxbh ٖŦn% ?e|$GV'O?W?:O?eڷ?ꢊ*:?ἆQL?Zɐ:Z?ᑘM䒿Z *Wk]_w5QI ?8/1q ?4m>?'Nr?4r?(Q?֟TfR?nڅ!((0?>l3;6P@B햿 ơIǂH,WK??%.}m ?$_JM?ۜw%?H H?5y.!?YΔ?텪ah@?Իq 7FTlnV&72H'Vͳ"Ya0YTE"?ܲOKuܬe>?gO2?.+D? =,y?v'B؋!C?߈BrKi?ݧ~Y?CDzq? DA??BX?B׿g?^911nJ9J2ǢqRp۽L?vI嫑>Ω?{:zH?Wep?V=~;??ብ?;XnjN9;|?0tHj)OXO -zK5z4Pd.?%~<+ˇ>3?@H潭?P݄!ň??K2x:?ʾiH?;|>*? Uc=OpAU]`#+1aC=?2Ma3c8`?jYq?G9?wq5T9?s in?ǖe?Za$ɿ'6?{YMX}#Q]-Sr= 4ڿZ8w$߿s~?{y_w6] j?l?f;?1?]?= 0?h^pt*=[?qW #Q@ݫH*9–sIˢ)F[?Ł俽?ȸhx?ࣱm? Xt.?·4ʋ?=bqM?) 12?~i# >ǺbȺFQ.pOlh# c[o?e:JzY[;?{?Uo/4?WA?M?K߿?e;Z䴮34?29.&`f ޿D5I-ꟾ{J6C"ʧ*?!Sc+?-?)w@~? ¶?iu??޿ ˄OO?TGpzQQ9JvA#Y=(V2uc癵b?Sw當L?+Aȳ?-\m?vt?V?%5?SҸU?jͽ¿ 8fO0[ ݋b F Ń ?2hjL8x?Gc%?W_8???M9Ŷ?w|E?ibJJA栞f7栞f@?ibN=|NU?w?M9Ƴi??&?W_8?Gc8b?2hjI? Ń b `u0[!Ŀ 8frͽ?ޒͿU?Sһ9?%t^?VA?vtE?-Y?+Aȴ 當?St癵 V2t(Y=vA#ſQQ9?TGo>O\?޿ %?E5?i-? S?)w@?-Z+A?!Pi"ʧ-!{J6cꟾwD5Kf߿.&`U?29#䴮3d?e;?KX?M?Wx?Uo8q?{zJzYz?e c[glhB.pOPȺF>Ǻ#?~i 1;?)t?=b?·4? XtŤ?ࣱjq?ȸhn?Łɿ)F[IT–s㓿H*@ݨ#Q?q'?t*=[?h^p?= 0?]?釈4W?K2?F 3?" o2\˿| ً Ŀݹd! ?àWDn#u[*?w?k"?\"?1<{1?f;?l6]?{y\=s~w4qZ7b= 4Q]-S|}#i?{YM%'6(?Za?ǖu{?s h?wq5Ms?G0?jYq!a3cG?'v?d?ʾiH?K2xg??P݄!5?@H潬ˇ>C%?%~<'d0ʿPr5z4 -zdXLd)O?0tG{;?;XnjPL?ብ?Q?V=ۀI?Wb?{:}+Ω?vI嫍ڿp۽UqR&G 2ɥJ91m?^9׿g i?B?C?? F9?CDzj?ݧ}NKqE?߈Brۿ؋SFS>I˿tg/&!?ѩ*c \? N1? eO/?ȿr?#[co?zw?&jƿoޠ? b;bю$;SSНr0 H. ?3ڔ3B8i6?k!AH?ӕ?v'? =.D?.+D?gO2ӧܬNX?ܲOKeYTFYaWVͳ&H'ЮV&0FTlr?Իpjh9?텪?Y}F?5y2?H ?ۜwb?$_J}m z??%WH,I) ơ;@Bj3;6?>ldڅ!(()??֟Tm?(Q|?4m?'Nr)?4kӿF?8/GI _w5*Wk\^>Aj|7=?׿.6 D"C?r%?!?d?톈T?حh{,E\?k2ҿ}⦮?NL;#DYz | 7uMm򗫜hn?;ge׏ZH?\R?ٚx\/?Sq?ӆ1I?/ _???g%K#|?sľ!qV@R*74S7wo'V4ܿJ?ڳ0F? Hi?\E?Cz?T?խW?YLZ~nni?LX̍,}ſ`/Ŀ$ =ݿ4:켤S?'ԊW?N?܄DJe?3?^ļ?(8&w?B H.]?7/roDRݿ<\"Ϳwg `~Έ2d &R_ f?ݗn\v-?@?DJ?Gf?bMl?ҠV(d?/Mcd|?=no5 ާ,޿76zEB#?H~x eK?Ai[?9$+?űl?}&ǧ?WqٷJK?',˩sж ӣI0OO$ZJ]">8ק?*οN+O?֣Q?Q`?kx~?ۤ㓭?{A?藛цyW?}jS6칿^vER2vPXпU>=?GFXHA.?1?P FTt?3әQ?qݐ?^?%'z"a? ǿտCݿ=?GF?1PXm?߿vE}j.S6*藛цYyW Cۤ?{/пQh ?kxx?N+|?֣Ϯ?>8ђ?*M?O$J]K? ,I0I'-&3˩sWaٷJQűl!?}&ǧ^G>V?9$+ξ? ]R_?gTO?XD,/?㈓Tə?`?_#Ww N {("G6y3瀞I?n bi?ʽ7~V?:%O? ?Nȹr? ?$/哿 g4?JZnjʪXcKlBfuŕv!f?ŜU-fqj_?.HPM[?g',2h?3?Kj?<=oO?xb1P?ٖëh en% wWFGV'Seڶ?:귿ἆQW?ꢊ*2?ɐC?Z.?Z?ᑘM?P-4Yb?f|bL 3# 8EI;3ri:?#aG?}~`?̴?/R!?-I ?Ed?#}}fu?N,HHE`bncpVJL F? }&mx`2.U?~1?? ?C?3 ?޿N)߲1?mT¿/؂б!hRͿQY-ߵF[ \??ל_\?0Á?x eX?Ai?EB#?Ha?4"?ާ,п7 =n{95 Կ/[McdލbK?ҠV(ÊDZ?G?9?@j|d?_w5ۿ*Wk^e8/5ԿI 4n m4q?'Nr֟Ta?(Q?څ!((??3;6%?>l}? ơI@B?H,~#IT?%rW$_J}mH ??ۜw)ֿYΏ?5y.?hD?텪~U?FTlo?Իq?H'߿V&;~?Ya饿Vͳ#ܲOKYTDgO2Хܬ` =+b?.+Dӕ2?v'?iB?k!AE?.3?3ڔ3T?SНr- ?ю% .;} b";bſ&joޔf#[ctP?zv eO/?ȿ=み߈Br؋ ݧ~Ke K?CDzZ=B?؈?g?B?1o}?^9Ď?2ΎJ9?qR vI嫓Lp۽{:zۿΩV=|?Wg|ብ1??;?;XnjL?)O?0tH ? -zXQ?P5z4%~<-d-d@H潪̿ˇ>hٿ?P݄!njʾiH?K2xc?|>,??UcW? =?AU\=Qp?+1aݿ`4J=眱jYrVa3c.wq5R?G5ǖ\?s i?'6 ?Za#m?}#ފ?{YM ?= 4{Q]-St?wmZ8z{yT\s~zl 6]1?·4? 14z?)ǃ?#M?~i?ȺFͿ>Ǻ=?lh.pOe c[n{JzYH"W~?Uo1 K߬?ME?䴮3?e;?.&`?29?D5R f?{J60lꟾ!I!"ʧ3x-ƿ+ ?)w@K^?i?O?޿ ?QQ9k?TGpTu?Y=PvA#{?V2u==(SxͿ癵Ŀ+Aȳ當&bvt?-^/%?V?U!]?SҶ?ͽ`?nj?0[e 8f ?b +?2hjMҿ Ń#Gc/8,G?W_8̖M9*??|Gw?wY??ibG?栞f>]栞f9ǺۿȺF6~i!#e) 1: ·4?=bƿࣱu? Xt+? y?ȸh?)F[?Ł{?–sHI\?@ݦH*q0#Qh^pt*=[ ۿ]i?= 0YK2?釈4W? 3?F]?o2^:?" ?0|?ݹv 0àWM! ̀w|#uY:^M?kejf;?1<|?6]W?l??s~I?{yZH?Z6w=?Q]-Sz= 4S{YM/T}#ZaO'6&s hB?ǖ~G5?wq5N?a3cQM?jYp?=瘧?:Q?`+1a(?=W}AUX ҿUcп|>2ۿK2x?ʾiHwP݄!ͦ??ˇ>L?@H潬\?d2?%~<%?5z43P|D?XJ\ -z٪0tGѿ)O3;XnjQ;?ብW`?V=ہ?Ω]?{:|?p۽?vI嫋?eqR?J9Կ2ݿ^91qQB g Wg?B걿CDzf? Gk?Ku?ݧ|?؋?߈Br?%FS>NX?/&uѩ*cҁ NX \ȿ? eO/剿zw ?#[cp?oޥ%?&j?;bZ? b?;ю$P? ^SНr*Y3ڔ3F˿.ak!AAiOv'K?ӕa.+D҂? =/Z?ܬR?gO2?YTG?ܲOK?Vͳ%Ya?V&+пH'ѾԻpFTlq޿텪(h5/5y1P?Y΁̿ۜw?H ?}m?$_J?W??%?IοH,p?@B ơ<>l~3;6څ!((%L(Q?֟Tr2'Nr%7?4n??4j?I ?8/C?*Wk[3_w5 #?j|^>5׿.6$7?|HYzO?򗫘uMR;kͿhnٿ]4׏ZHmSp?ٚx`/ ?ӆ1'?K#6???g$?q?sľ?*74SV@RS?o'V0_7wڳMJ H<0B7Cz?\E/խW3?$?nn?YL`S?,}?LX̉?$ 펿`/?4='켤SNlԊW3?܄DJe(8&sc?^}?H.a?B?oDS?7/?wg ^<\'?d &~Έ2=ݗn\_ d@}GпGG?DҠV(l?bIv?Mcdށ%?/?5 R?=njv?7ާ,?W7&HEB#Aix eG=0Å$?\׋? ^?ߵF['?QY1>?hU?б?/؂!mTȿz?N)߲pG3 ܿC_ ؿ~1>?`2.O }&? F?VJL?c?n.?E`~?HN3?}fu4#}Edl-In/R̴$}~`?G#1?:?;3r??E?# Tp?3Ef|bLb?YfP+ᑘMZZɐ`/ꢊ*6?ἆQQ:f?eڸX?GV'O?WU?n% ?ec3?hٖ轮?1Oxb8<=oYKn3|g',.HPQ?fqjoŜU?f?v!?ŕ,?fvl?Kl #?ʪ\JZh? gQ\$/q 9NȽ :%ʽ7y!? biӿn?瀞I?6y:?G?(!?=9?w_#M?}M㈓TІXD&ٿgTg ]o*9$+\?>]}&ǧ?űlD?ٷJ-?W?˩s-?'-_?I0N> Ղ?J]WO$*>8%֣ЎN+=J1%HA3ә?P FVEt=?qݺ?"W^?%'?տD? ?0W,8="?PXG?3?vE??S6}jH?yWk藛ц⿸{BۤڿkxzBQf1֣p?N+*p?>8?J]^?O$k?I0K4? M?˩sϺ'-9@?ٷJW}&ǧqPűlؿ9$+_>agT? ][㈓T`?XD#?j ?B?w ?_#o?("M)?6y2Gnw瀞IIʽ7ÿ bi߿ ^?:%ɿ %?NȺ? g>*?$/3?ʪY?JZly?fw7Kl ?v!ŕZŜUrf̿.HPNfqji3V?g'+տ<=oW?Kl:?1P!U?xb4?h C?ٖ?n% e?GV'VW:eڶ0ꢊ*3߿ἆQUZ?ɐM#ᑘM?Z?Yla?P,?3?f|bLv?Eǿ# Ar?;3rK#:}~`G/R!?̴4Ed?-IP?}fuJ?#} ?H?N*=?nTE`k?VJLcڮ }&vſ F'~1`2.S C?3  ?C?N)߲f?U?/؂?mTï?hVZбb?ߵF[QY.ֿנ [0Âÿ\Ai?x e\H0?EB#@??4 ?72?ާ,?5 %=n?Mcdމ/}ҠV( bJGD@~?>ݗn\T?_ b?d &~?~Έ2?wg \?<\/?oDU7/?H.MB (8&j*^3"܄DJe'N?ԊW˿'?켤Ss?4?=խWɿCzѿ\E H?09ڳ"?J?o'V'E?7w?*74S?V@R/?qֿsľy?K#??g"/ (ӆ1Snٚxi|Y?׏ZH%;t?hn?򗫬?uL(?|e?YzC?;NL#A?}⦮)k2 حh{,U톈T㗿"r%? D"6j׿.6*?7:?j|?^>#?*Wk_E?_w5d?I 8/:7?4n'NrX4p(Q䓿֟T]Z?څ!((t>l?3;6?@B?? ơG?I%?H,y?W?%v?}m$_JۜwJH !5y/YΊ텪G?h,rԻq%?FTlpK?V&??H'?Vͳ$g?Ya?YTBܲOK?ܬ\"gO2d.+D\ =*Lv'οӕϢk!AC?iF_3ڔ3P?.? ?SНr,?;1?ю%?;b b]?oޮs&jzw#[cs+ȿf eO/ۿ N? \ѩ*c?#?/&l?w?'?FS>8?؋߈Br:?K`fݧCDz^e Iֿ&BB|?g$^9?1p?J9?2V?3?qR_?p۽vI嫇?Ω;{:{nW[ݿV=ۄብ߿;XnjK?;0tG?)O?XS? -z?5z4?P8?d,%~</ ?ˇ>_|@H潫PP݄!ɐSK2xʾiHxם?|>.ɿ ?Uc?=So?AU[E?`?+1a7?=[6H?a3cdajYoG0wq5Qs jPǖSZa"?'6"{YMz?}#?Q]-Sv?= 4?Z8?w?s~{yVQ?6]lqf;1<l]kxwW?#uUKàWa?! ?ݹ? ?y?|*P?o2a!" ? 3FK2ƿ釈4WZ]¿= 0֛h^p3?t*=[qD?#Q ?@ݯx?H*I?–s?I?)F[Ł©?4ȸh,ࣱqH Xt2·4P=bi)? 16X~j?#?>Ǻ?ȺFI?.pN?lh|I? c[le?JzY5 {FUo2W}-MyKߙe;@?䴮3ܿ29lf?.&a?f_?D5P{?ꟾ?{J6M?"ʧ1!J?+s-)w@ i󢾿ֹ޿ ?OTGp.*?QQ9?vA#d?Y=o?(?V2u?癵%Sz?當+Aȳ-_vtSV%bSҵ=?U#z?ͽq? 8f?0[?L?b ~? Ńz2hjO?8߇GbW_8M7M9ȃw?|I+ibE!??栞f:?栞fǺ?#%~j4? 18B)v=bտ·4ɕ Xtࣱs5ȸhu? Łę?)F[?Ic?–s?H*?@ݱj?#Qqq:C?t*=[h^p= 0ٿ]釈4WK2F? 3" ?o2_?| ?? ?ݹ?! "àWWa?#uWIwkn]1<}f;l?6]˿{yXS?s~?wH?Z9P?= 4ٳ?Q]-Sx?}#h{YL?'6$Za ǖⴈSs gѿwq5P%G9jYp7?a3cZ8S?=?+1a?`j?AUY?=U}?UcS 5?|>0ٿEʾiH׿K2xgP݄!ˢ@H潫?ˇ>U޿%~<14?d*?P?5z4? -zr?XU?)O0tG'?; ;XnjRѿብK2V=ۂǿW]{:|?ΩvI嫉?p۽?qR??2?J9?1p^9&?gDB?BRȿ HCDzbݧC?K[߈Br߃?؋?FS>4%??v?/&? ?ѩ*c? \g N eO/"ȿ#[cqzwr&jd?oީ b?;b{?ю%?;?SНr+w? ?.3ڔ3K]?iJk!ABۿӕv' =)-.+D꿿gO2)?ܬWtܲOKn?YTA?Yan?Vͳ%/?H'?V&'?FTlqԻp|?h0텪4YΆR5y0H ۜw$_J?}m ^?%{[?W?H,u?I? ơ>?@Bݷ?3;6տ>l`?څ!(( ֟TX(Qr4o'Nr ׿4o?\8/>?I ?_w5?*WkZS?^>(?j|O?7;ݿ׿.6? D":r%ܿ!u톈T⤿حh{,Z k2?}⦮NL'?;?Yz?|Z?uL_9$+űl}&ǧ޿Wx?ٷJ'-L?˩ss? a?I0L?O$(?J]rF?>8Ԣ*?N+)֣1QdJkx{ҿۤ㒟{V藛цu?yW}j[e?S6%??vE;?2?PX[?U>=GF?HAҿ1TP FX3ә.q忱a%'{?"Y, }?տD*?"itpp-4.3.1/gtests/audiofile_test.cpp000066400000000000000000000164041216575753400175340ustar00rootroot00000000000000/*! * \file * \brief Audio streaming test program * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" #include using namespace itpp; using namespace std; // To rewrite the AUDIOFILE_REF_FILE uncomment the following definition // #define SAVE_DATA //reference data const string ref_file_name = AUDIOFILE_REF_FILE; const int ref_num_samples = 5000; const int ref_num_channels = 2; mat ref_channels(ref_num_samples,ref_num_channels); std::string ref_annotation("ITPP reference audio file contains 1004 Hz tone at 8 kHz sampling rate."); const Audio_Encoding ref_encoding = enc_double; const int ref_sampling_rate = 8000; const int ref_tone_frequency = 1004; Audio_Stream_Description ref_description(ref_encoding,ref_sampling_rate,ref_num_channels); static const double tol = 1e-9; //checkers void check_sample(double s, double ref) { ASSERT_NEAR(ref,s, tol) << "sample test failed." << endl; } void check_samples(const vec& s, const vec& ref) { ASSERT_EQ(s.length(),ref.length()) <<"check_samples: vector length test failed" << endl; for(int j = 0; j < s.length(); ++j){ ASSERT_NEAR(ref(j), s(j), tol) <<"check_samples: failed for sample number: "<< j << endl; } } void check_samples(const mat& s, const mat& ref) { ASSERT_EQ(s.rows(),ref.rows()) <<"check_samples: matrix rows test failed" << endl; ASSERT_EQ(s.cols(),ref.cols()) <<"check_samples: matrix columns test failed" << endl; for(int i = 0; i < s.rows(); ++i) for(int j = 0; j < s.cols(); ++j){ ASSERT_NEAR(ref(i,j), s(i,j), tol) <<"check_samples: failed for row: "<< i << " column: " << j << endl; } } void check_description(const Audio_Stream_Description d, const Audio_Stream_Description ref) { ASSERT_TRUE(is_valid(d)) << "check_description: invalid description" << endl; ASSERT_TRUE(is_valid(ref)) << "check_description: invalid reference" << endl; ASSERT_EQ(d.get_encoding(), ref.get_encoding()) << "check_description: encodings mismatch" << endl; ASSERT_EQ(d.get_sampling_rate(), ref.get_sampling_rate()) << "check_description: sampling rates mismatch" << endl; ASSERT_EQ(d.get_num_channels(), ref.get_num_channels()) << "check_description: number of channels mismatch" << endl; ASSERT_EQ(d.get_description(), ref.get_description()) << "check_description: annotations mismatch" << endl; } //base class for AudioFile tests class AudioFileTest : public ::testing::Test { protected: static void SetUpTestCase() { //generate reference tone for(int i = 0; i < ref_num_samples; ++i){ ref_channels(i,0) = Audio_Sample::decode(Audio_Sample::encode(sin(2*pi*ref_tone_frequency/ref_sampling_rate*i))); ref_channels(i,1) = Audio_Sample::decode(Audio_Sample::encode(cos(2*pi*ref_tone_frequency/ref_sampling_rate*i))); } ref_description.set_description(ref_annotation.c_str()); #ifdef SAVE_DATA Audio_Stream_Description d(ref_encoding,ref_sampling_rate,ref_num_channels); d.set_description(ref_annotation.c_str()); SND_Out_File ref(ref_file_name.c_str(),d); ref.write(ref_channels); #endif } }; //read test with reference file (refence file should be audible with .au files player (e.g. audacity)) TEST_F(AudioFileTest, In) { SND_In_File ref(ref_file_name.c_str()); check_description(ref.get_description(),ref_description); ASSERT_EQ(ref.num_samples(),ref_num_samples) << "Unexpected number of samples" <. * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; bvec set_errors(const bvec &input, const ivec errpos) { bvec output = input; for (int i = 0; i < errpos.length(); i++) output(errpos(i)) ^= 1; return output ; } TEST(BCH, codec) { ostringstream ss(ostringstream::out); const string ref[] = {"encoded = [1 0 1 1 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 0 1 1 0 0]", "err = [1 1 0 1 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 0 1 1 0 0]", "input = [0 1 0 0 0 1 1 1 0 1 0 1 1 1 0 1 0 0 1 1 0]", "encoded = [0 1 1 1 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 1 1 1 0 1 0 1 1 0]", "err = [0 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 0]", "decoded = [0 0 0 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0]", "input = [1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 1 1 1 1 0 0]", "encoded = [1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 0 1 0 1 0 0 1 0 0 0 1 0 1]", "err = [1 1 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 1]", "decoded = [1 1 0 1 0 0 0 1 1 0 1 0 0 1 0 1]"}; int i = 0; { BCH bch(31, 2); RNG_reset(0); bvec input = randb(21); bvec encoded = bch.encode(input); bvec err = set_errors(encoded, (ivec) "1 2"); // error positions bvec decoded = bch.decode(err); // A two error case (should be corrected) ASSERT_TRUE(input == decoded); ss << "encoded = " << encoded; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "err = " << err; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); input = randb(21); encoded = bch.encode(input); err = set_errors(encoded, (ivec) "1 2 27"); // error positions decoded = bch.decode(err); // A three error case (will cause decoding errors); ss << "input = " << input; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "encoded = " << encoded; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "err = " << err; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "decoded = " << decoded; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); } // Systematic vs. non-systematic test { bmat u = "0 0 0 0; 0 0 0 1; 0 0 1 0; 0 0 1 1; 0 1 0 0; 0 1 0 1; 0 1 1 0"; bmat c(u.rows(), 7); bmat y(u.rows(), 7); bmat decoded(u.rows(), u.cols()); BCH bch_nsys(7, 1); BCH bch_sys(7, 1, true); bmat f = "1 0 0 0 0 0 0; 0 1 0 0 0 0 0; 0 0 1 0 0 0 0; 0 0 0 1 0 0 0; 0 0 0 0 1 0 0; 0 0 0 0 0 1 0; 0 0 0 0 0 0 1"; // Non-systematic case for (int i = 0; i < u.rows(); i++) { c.set_row(i, bch_nsys.encode(u.get_row(i))); y.set_row(i, f.get_row(i) + c.get_row(i)); decoded.set_row(i, bch_nsys.decode(y.get_row(i))); } ASSERT_TRUE(u == decoded); // Systematic case for (int i = 0; i < u.rows(); i++) { c.set_row(i, bch_sys.encode(u.get_row(i))); y.set_row(i, f.get_row(i) + c.get_row(i)); decoded.set_row(i, bch_sys.decode(y.get_row(i))); } ASSERT_TRUE(u == decoded); } // Systematic decoding failure test { BCH bch(31, 3, true); bvec input = randb(21); bvec encoded = bch.encode(input); bvec err = set_errors(encoded, (ivec) "1 2 14 27"); // error positions bvec decoded; bvec is_valid_cw; // test the new decoding procedure for the systematic case (should extract the systematics) // all codewords valid? ASSERT_FALSE(bch.decode(err, decoded, is_valid_cw)); // valid codeword? ASSERT_TRUE(bvec("0") == is_valid_cw); // A four error case (will cause decoding failure) ss << "input = " << input; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "encoded = " << encoded; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "err = " << err; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "decoded = " << decoded; ASSERT_TRUE(ss.str() == ref[i++]); } } itpp-4.3.1/gtests/bessel_test.cpp000066400000000000000000000201201216575753400170360ustar00rootroot00000000000000/*! * \file * \brief Bessel test program * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST(Bessel, All) { ostringstream ss(ostringstream::out); const string ref[] = {"x = [0.01 0.535789 1.06158 1.58737 2.11316 2.63895 3.16474 3.69053 \ 4.21632 4.74211 5.26789 5.79368 6.31947 6.84526 7.37105 7.89684 8.42263 8.94842 9.47421 10]", "besselj(0, x) = [0.999975 0.929510 0.737496 0.462593 0.159139 -0.114928 -0.310723 -0.398702 \ -0.374249 -0.257398 -0.086903 0.089735 0.227815 0.295737 0.281659 0.195053 0.063020 -0.077530 \ -0.189700 -0.245936]", "besselj(1, x) = [0.005000 0.258396 0.459448 0.568610 0.566890 0.459775 0.275443 0.057757 \ -0.144224 -0.287643 -0.345450 -0.311940 -0.203055 -0.051503 0.101930 0.218652 0.271552 0.251069 \ 0.166657 0.043473]", "besselj(5, x) = [0.000000 0.000011 0.000335 0.002361 0.009087 0.024777 0.053741 0.098533 0.158167 \ 0.226989 0.294752 0.348121 0.373422 0.360040 0.303620 0.208143 0.086202 -0.042842 -0.156525 -0.234062]", "besselj(0.3, x) = [0.227333 0.709740 0.733615 0.600610 0.371136 0.105291 -0.137641 -0.309029 \ -0.380002 -0.346362 -0.227881 -0.062193 0.105129 0.231848 0.288953 0.266844 0.176472 0.045388 \ -0.090110 -0.194619]", "besselj(1.7, x) = [0.000079 0.067160 0.198405 0.343409 0.457949 0.507700 0.475136 0.363160 0.194018 \ 0.003625 -0.167309 -0.283160 -0.321855 -0.279865 -0.172579 -0.030045 0.110759 0.215140 0.259064 0.234648]", "besselj(5.3, x) = [0.000000 0.000005 0.000165 0.001317 0.005544 0.016247 0.037475 0.072593 0.122628 \ 0.184847 0.252110 0.313421 0.355752 0.366874 0.338539 0.269215 0.165544 0.041984 -0.081497 -0.183307]", "bessely(0, x) = [-3.005456 -0.393388 0.134747 0.415986 0.518927 0.473687 0.320004 0.110022 -0.099731 \ -0.259413 -0.335829 -0.318494 -0.220309 -0.072808 0.082722 0.205946 0.267362 0.254997 0.176400 0.055671]", "bessely(1, x) = [-63.678596 -1.387656 -0.729200 -0.355648 -0.044554 0.204046 0.363724 0.416719 0.365013 \ 0.231664 0.055661 -0.117354 -0.245833 -0.301794 -0.276703 -0.182445 -0.047311 0.091854 0.199244 0.249015]", "bessely(5, x) = [-2444635204830.000000 -5637.104920 -194.723098 -28.527040 -7.796072 -3.084767 \ -1.583672 -0.986094 -0.698192 -0.523538 -0.384929 -0.250859 -0.112548 0.025099 0.148996 0.242846 \ 0.292104 0.288391 0.232521 0.135403]", "bessely(0.3, x) = [-4.501885 -0.756144 -0.192147 0.176734 0.399032 0.477286 0.425200 0.275829 0.077193 \ -0.117613 -0.261894 -0.325212 -0.299154 -0.197723 -0.052439 0.096490 0.210615 0.262704 0.242933 0.160422]", "bessely(1.7, x) = [-2360.521095 -3.009003 -1.185564 -0.719724 -0.432942 -0.177942 0.054479 0.240501 \ 0.353307 0.377184 0.314160 0.184609 0.022720 -0.131614 -0.242281 -0.285365 -0.254426 -0.161362 -0.032773 0.097192]", "bessely(5.3, x) = [-19010147659829.000000 -13261.137342 -371.693756 -47.926483 -11.884160 -4.322880 \ -2.054324 -1.196689 -0.809794 -0.599174 -0.453007 -0.323825 -0.193008 -0.058325 0.071986 0.183747 \ 0.261390 0.292489 0.271580 0.202481]", "besseli(0, x) = [1.000025 1.073066 1.302214 1.736363 2.469391 3.662497 5.582888 8.668475 13.634868 \ 21.651723 34.633273 55.717272 90.055289 146.118049 237.853623 388.258981 635.295671 1041.696056 \ 1711.231130 2815.716628]", "besseli(1, x) = [0.005000 0.277623 0.609156 1.071337 1.766870 2.854192 4.586135 7.372273 11.880787 \ 19.205890 31.143828 50.648619 82.585563 134.978313 221.074665 362.771310 596.295812 981.640046 \ 1618.232132 2670.988304]", "besseli(5, x) = [0.000000 0.000012 0.000368 0.002913 0.013185 0.044294 0.124033 0.307911 0.702786 \ 1.509283 3.097299 6.139460 11.845643 22.373107 41.540816 76.069168 137.725169 247.024584 439.606601 777.188286]", "besseli(0.3, x) = [0.227342 0.792616 1.133692 1.616922 2.370067 3.565909 5.475611 8.537063 13.462834 \ 21.416322 34.301243 55.238598 89.353662 145.076015 236.289277 385.889218 631.678022 1036.136392 \ 1702.636834 2802.362489]", "besseli(1.7, x) = [0.000079 0.070827 0.244469 0.548134 1.052827 1.884257 3.253621 5.511453 9.237952 \ 15.393238 25.566853 42.392032 70.233829 116.332703 192.705987 319.311124 529.310475 877.837948 \ 1456.603093 2418.229821]", "besseli(5.3, x) = [0.000000 0.000005 0.000181 0.001608 0.007903 0.028250 0.083093 0.214721 0.506726 \ 1.119372 2.353247 4.762836 9.357849 17.957982 33.815077 62.699642 114.791605 207.960347 373.439504 665.621707]", "besselk(0, x) = [4.721245 0.867728 0.385816 0.191022 0.099182 0.052916 0.028734 0.015799 0.008767 \ 0.004900 0.002754 0.001555 0.000881 0.000501 0.000286 0.000163 0.000094 0.000054 0.000031 0.000018]", "besselk(1, x) = [99.973894 1.514822 0.542899 0.244952 0.120671 0.062227 0.032994 0.017822 0.009756 \ 0.005393 0.003005 0.001684 0.000949 0.000537 0.000305 0.000173 0.000099 0.000057 0.000032 0.000019]", "besselk(5, x) = [3839976000100.000000 8542.624206 265.658856 32.672931 6.971494 1.991747 0.679497 \ 0.260647 0.108529 0.047977 0.022189 0.010627 0.005232 0.002634 0.001350 0.000703 0.000371 0.000197 \ 0.000106 0.000058]"}; int i = 0; vec x = linspace(0.01, 10, 20); ss << "x = " << x; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselj(0, x) = " << fixed << besselj(0, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselj(1, x) = " << besselj(1, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselj(5, x) = " << round_to_infty(besselj(5, x)); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselj(0.3, x) = " << besselj(0.3, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselj(1.7, x) = " << besselj(1.7, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselj(5.3, x) = " << round_to_infty(besselj(5.3, x)); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "bessely(0, x) = " << bessely(0, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "bessely(1, x) = " << bessely(1, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "bessely(5, x) = " << round_to_infty(bessely(5, x)); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "bessely(0.3, x) = " << bessely(0.3, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "bessely(1.7, x) = " << bessely(1.7, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "bessely(5.3, x) = " << round_to_infty(bessely(5.3, x)); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besseli(0, x) = " << besseli(0, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besseli(1, x) = " << besseli(1, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besseli(5, x) = " << besseli(5, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besseli(0.3, x) = " << besseli(0.3, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besseli(1.7, x) = " << besseli(1.7, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besseli(5.3, x) = " << besseli(5.3, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselk(0, x) = " << besselk(0, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselk(1, x) = " << besselk(1, x); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); ss << "besselk(5, x) = " << round_to_infty(besselk(5, x)); ASSERT_TRUE(ss.str() == ref[i++]); } itpp-4.3.1/gtests/blas_test.cpp000066400000000000000000000256121216575753400165150ustar00rootroot00000000000000/*! * \file * \brief BLAS aided routines test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; TEST(BLAS, All) { int i,j; const double eps = 8*std::numeric_limits::epsilon(); // dot() tests { vec a = "-0.53867916598526822 -1.2749137275918296 1.0282326809755016 -0.12769391261256544 -0.36545017988288314 " "-0.87843445720393964 1.290111844695397 -0.67538252183750369 -0.70127933871039161 0.81090935639334638"; vec b = "-0.53196841563668684 -3.7326992066642575 -0.1127551468065689 -0.94014676063834202 0.24924688123208288 " "-1.2762774231089256 0.3873527275026688 -0.38752244901288929 0.014601505447491007 0.87579113195022229"; ASSERT_NEAR(7.5409827210127167, dot(a, b), eps); cvec c = "0.27048736281775243-0.43161417341950425i 0.24733404881732354+0.91695158262351717i " "-0.13822544249254176-0.32994867677758688i 0.45312345826746936+1.0235294160253086i 0.41375330826825513+0.17986200239570888i " "0.48013423494175655+0.041530819390519759i"; cvec d = "0.3881730386544478+0.90716001255184286i -1.0369420852527764-0.10653084374544097i " "-0.45368954946988371+0.63018137700832588i -0.36010935124332805-1.2392806118375086i -1.0154675556525383-0.10484826487656193i " "0.11897334710181541+1.5931245965356391i"; std::complex actual = dot(c, d); ASSERT_NEAR(1.3033212438765029, actual.real(), eps); ASSERT_NEAR(-1.2230531450688598, actual.imag(), eps); } // outer_product() tests { vec a = "1.144350801849226 0.4030712283482284 1.288501360291362 1.97906140519714"; vec b = "1.144800467126237 -0.8485065927711128 -1.229839122249251 1.070565791232947 1.030604680915006 " "-0.1875783677316915 0.4566649855427434"; mat outer_prod = outer_product(a, b); const mat outer_prod_expect = "1.310053332513278 -0.970989199811978 -1.407367385691479 1.2251028216297744 1.1793732929946534 " "-0.2146554555233302 0.5225849423823038; 0.461436130498198 -0.3420085946098225 -0.4957127656757127 0.431514268499857 " "0.4154070946778456 -0.07560744309316859 0.1840685166663396; 1.475076959154343 -1.093301899001768 -1.584649381957695 " "1.3794254782850506 1.327935533281631 -0.2416949819835179 0.5884134550692601; 2.265630421141193 -1.679246649808636 " "-2.4339271414450203 2.118715439153464 2.0396299480144027 -0.3712291080276673 0.9037680479925535"; for (i = 0; i < outer_prod.rows(); ++i) { for (j = 0; j < outer_prod.cols(); ++j) { ASSERT_NEAR(outer_prod_expect(i,j), outer_prod(i,j), eps) << i << "x" << j; } } cvec c = "0.648281980978702+0.5393189597808304i -1.698775822486131+0.8257068048973116i " "-0.3091289715393962-0.6238632012662513i 0.04914321647156545-1.10390652648413i"; cvec d = "-0.9635435410370933+1.580133781005509i 0.4497496320949741-1.340916266239779i " "0.1034133351433764+0.3939126587361242i 0.6689829815540316+0.03429401822619i -0.5558754225740515-0.2154901642550677i " "-0.7622797901336434+0.4460947554352002i -0.7594798687045069+0.04215845908992501i"; cmat c_outer_prod = outer_product(c, d); cmat c_outer_prod_expect = "-1.476844022629202+0.5047149575059551i 1.014746148300605-0.6267333496612161i -0.1454035635877053+0.3111392510750342i 0.4151941982864324+0.3830273997941929i -0.2441460888946358-0.4394925452350682i -0.7347596118728638-0.1219167517190851i -0.5150939700995433-0.3822713233903702i; 0.3321172558021201-3.479897522114934i 0.3431798846567065+2.6492774647873953i -0.5009324363178334-0.5837802062871459i -1.164768918935312+0.4941259512111063i 1.122239423196909-0.09292063807448886i 0.9265990022569888-1.387234595020226i 1.2553755120656216-0.6987254667870634i; 1.283646542921267+0.1126542274539301i -0.9755789557060787+0.1339338210560608i 0.213779554362088-0.1862855893876137i -0.1854072450702826-0.4279551390491551i 0.03740081397078696+0.4134044734853026i 0.5139448697431694+0.337657497176539i 0.2610783419657928+0.4607791410871117i; 1.696968364753062+1.1413148599564635i -1.4581440742427734-0.5623784924955431i 0.4399248187585209-0.0948005205311046i 0.0707333660175599-0.7368093610829385i -0.265198504937086+0.6030446271021392i 0.4549860312168223+0.8634081664686641i 0.009215714542340728+0.8404665860773792i"; for (i = 0; i < c_outer_prod.rows(); ++i) { for (j = 0; j < c_outer_prod.cols(); ++j) { ASSERT_NEAR(c_outer_prod_expect(i,j).real(), c_outer_prod(i,j).real(), eps) << i << "x" << j; ASSERT_NEAR(c_outer_prod_expect(i,j).imag(), c_outer_prod(i,j).imag(), eps) << i << "x" << j; } } c_outer_prod = outer_product(c, d, true); c_outer_prod_expect = "0.2275481915436817-1.544029558017281i -0.4316169834226605+1.1118503571477614i 0.2794855671204302-0.1995937064010499i 0.4521850267593397+0.3385630116514046i -0.4765819513527226-0.1600957641056658i -0.2535848929428715-0.7003071352345676i -0.4696202574948612-0.4369324621380225i; 2.9415716870508546+1.888688604816574i -1.8712274870066554-1.90655480134563i 0.1495802893893871+0.7545583953771703i -1.108135310502037+0.6106416492482069i 0.7663760331692112-0.8250596001146373i 1.6632859526406825+0.1283953751221377i 1.3249965651746936-0.5554899247565929i; -0.6879280951728179+1.089584488687711i 0.6975176732665963-0.6950983115502394i -0.2777156702347496+0.05725404075528072i -0.2281967970600307-0.4067525898807242i 0.3062735813979007+0.2801759677792534i -0.04265933464460947+0.6134591230901429i 0.208476119469207+0.4868439432874201i; -1.7916716223869915+0.9860091470484897i 1.502348361298874-0.4305846158114135i -0.4297606909285259-0.1335167906494231i -0.0049814150609538-0.7401799978056773i 0.2105634924915269+0.6242243866810993i -0.5299077926936966+0.8195631042022999i -0.0838622817294241+0.8363229815150517i"; for (i = 0; i < c_outer_prod.rows(); ++i) { for (j = 0; j < c_outer_prod.cols(); ++j) { ASSERT_NEAR(c_outer_prod_expect(i,j).real(), c_outer_prod(i,j).real(), eps) << i << "x" << j; ASSERT_NEAR(c_outer_prod_expect(i,j).imag(), c_outer_prod(i,j).imag(), eps) << i << "x" << j; } } } // Mat *= Mat operator test { mat M1 = "0.6416619010964826 0.235659520657739 1.3983669192959736 -1.916076396202661 -0.2313932978834664; " "-0.1723662919540427 0.5667202738083824 0.2357501419330437 1.2157243960564346 -0.8334515155604767; " "-0.7916949400225816 0.1902016039548307 -1.8515590721454276 -1.48074205072801 0.2367650475159956"; mat N1 = "-0.8649851360899323 0.5426015425358679; " "-0.05968253198862269 0.5717199326645428; -0.3861898484143324 -0.6654857247496347; " "-1.3647102306443 1.6300227968022034; 0.4595579721985606 0.6434323438908552"; M1 *= N1; const mat M1_expect = "1.399422553523895 -3.7198293783926872; -2.0179041413026333 1.518979524845883; " "3.5180970502245303 -1.349947725820544"; for (i = 0; i < M1.rows(); ++i) { for (j = 0; j < M1.cols(); ++j) { ASSERT_NEAR(M1_expect(i,j), M1(i,j), eps) << i << "x" << j; } } cmat M2 = "0.5313310759460741-0.5618900653783278i -0.6095848356402745+1.446658858924682i " "0.7174248000225271+0.7459764842740102i 0.2803552569457621+1.302851286217992i; " "0.3555319955217059-0.9194703925032131i -0.633288104876484+0.1126850099324503i -0.1945412419171371+0.07740707824065497i " "-1.099197860484227+0.04822719629670968i; 0.8372873214572285-0.1680261588241537i 0.8240186444425496+1.043483298307191i " "0.1780410762780012+0.2349504126253822i 0.0690521880409925+0.2825038112687566i; 0.2094812424070254-1.8657283920272836i " "-1.745273495226459+0.6962265981502513i 0.7192704358053181+1.426973623391087i 0.5700889022085341-0.350927410090021i"; cmat N2 = "-1.443024172028881-0.1633982415054971i -0.5954993250735038-0.5638800857829505i; " "0.3088018358967147+0.1094460610547769i 1.0275952539185527-0.1750885564095062i; 0.2482232949362309-1.1372797157525494i " "-0.02110191719219557-0.3653734659787203i; 0.7222711837987867-0.1535072377450153i -0.6873480514598044-0.08690531283448709i"; M2 *= N2; const cmat M2_expect = "0.2238476324597395+1.371248083267034i -0.8284149542175873+0.4305630743709985i; " "-1.617946452997547+1.678241138114074i -0.5691137095915012+0.705566702106269i; " "-0.6907886228392469+0.5673516983633202i 0.4952848265775473+0.2857432320130563i; " "0.9370105702181578+1.8772639329343965i -2.7644731136780063+1.91268556781121i"; for (i = 0; i < M2.rows(); ++i) { for (j = 0; j < M2.cols(); ++j) { ASSERT_NEAR(M2_expect(i,j).real(), M2(i,j).real(), eps) << i << "x" << j; ASSERT_NEAR(M2_expect(i,j).imag(), M2(i,j).imag(), eps) << i << "x" << j; } } } // Vec = Mat * Vec operator test { mat M1 = "-1.156207177555769 1.937595489846581 -0.7600784760582153 1.133825535154124; " "-1.567451802499219 -0.3135104798924478 -0.5122172858230097 -0.9159646322420039; " "-1.3301111770828475 -0.8226722974807049 -0.4063568488084563 -1.296727513207429"; vec v1 = "-0.31313016493873 -1.2622055080049717 -0.4708215799031978 0.9473031308640839"; M1 *= v1; const mat M1_expect = "-0.6516625271052732; 0.2599978838689173; 0.4178069778515376"; for (i = 0; i < M1.rows(); ++i) { for (j = 0; j < M1.cols(); ++j) { ASSERT_NEAR(M1_expect(i,j), M1(i,j), eps) << i << "x" << j; } } cmat M2 = "0.4598662936935902+0.2647372102970682i 1.2194828317757294+1.395466657255362i; " "-0.3375121080067005-0.4760783255515197i 0.09884444743078168-0.3339675294900224i; " "-0.3314179731182946+0.133072817036334i 0.5527689805911649+0.0704665547758981i"; cvec v2 = "0.1158868961132298+1.145603110960835i -0.9576278296044424+0.3083997905942557i"; M2 *= v2; const cmat M2_expect = "-1.8481636166122595-0.4027456260514852i; 0.5146229027137302-0.09152595306142891i; " "-0.7419344632949262-0.2612589613576985i"; for (i = 0; i < M2.rows(); ++i) { for (j = 0; j < M2.cols(); ++j) { ASSERT_NEAR(M2_expect(i,j).real(), M2(i,j).real(), eps) << i << "x" << j; ASSERT_NEAR(M2_expect(i,j).imag(), M2(i,j).imag(), eps) << i << "x" << j; } } } } itpp-4.3.1/gtests/channel_test.cpp000066400000000000000000000130301216575753400171730ustar00rootroot00000000000000/*! * \file * \brief Channel classes test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST(Channel, All) { ostringstream ss(ostringstream::out); const string ref[] = {"[[0.572-0.281i 0.163-0.260i -0.243-0.025i -0.047+0.004i]\n\ [0.917-0.028i 0.149+0.552i 0.029+0.382i -0.084-0.073i]\n\ [0.611-0.193i -0.083-0.199i 0.194+0.068i 0.120+0.034i]\n\ [0.975-0.149i 0.273+0.616i 0.218+0.335i -0.102+0.008i]\n\ [0.537+0.179i 0.249+0.108i 0.194-0.144i 0.030+0.051i]\n\ [0.574-0.822i 0.289+0.025i -0.208+0.181i 0.003-0.042i]\n\ [0.666-0.207i 0.234+0.546i 0.175-0.032i -0.016-0.058i]\n\ [0.746-0.281i -0.624-0.064i 0.077+0.155i 0.034-0.058i]\n\ [0.776-0.085i -0.273+0.379i 0.129-0.407i 0.003+0.034i]\n\ [0.694+0.193i -0.217-0.746i 0.198-0.074i -0.009-0.042i]]", "[[0.064+0.155i 0.074+0.540i 0.065-0.507i -0.416+0.264i -0.455-0.071i -0.203+0.058i]\n\ [0.064+0.155i 0.074+0.540i 0.065-0.507i -0.416+0.264i -0.455-0.071i -0.203+0.058i]\n\ [0.064+0.155i 0.074+0.540i 0.065-0.507i -0.416+0.264i -0.455-0.071i -0.203+0.058i]\n\ [0.064+0.155i 0.074+0.540i 0.065-0.507i -0.416+0.264i -0.455-0.071i -0.203+0.058i]\n\ [0.064+0.155i 0.074+0.540i 0.065-0.507i -0.416+0.264i -0.455-0.071i -0.203+0.058i]]", "[[0.063+0.143i -0.203-0.354i 0.309+0.000i -0.396+0.000i -0.285+0.000i 0.312+0.000i]\n\ [0.062+0.142i -0.204-0.374i 0.309-0.025i -0.395+0.007i -0.285-0.008i 0.312+0.007i]\n\ [0.062+0.140i -0.205-0.393i 0.308-0.050i -0.393+0.014i -0.285-0.016i 0.312+0.014i]\n\ [0.061+0.138i -0.207-0.413i 0.306-0.075i -0.390+0.021i -0.285-0.024i 0.311+0.020i]\n\ [0.060+0.135i -0.208-0.433i 0.303-0.100i -0.387+0.028i -0.284-0.032i 0.310+0.027i]\n\ [0.060+0.132i -0.209-0.452i 0.299-0.124i -0.383+0.035i -0.283-0.039i 0.308+0.034i]\n\ [0.059+0.128i -0.210-0.471i 0.294-0.148i -0.378+0.041i -0.281-0.048i 0.306+0.041i]\n\ [0.059+0.123i -0.211-0.490i 0.288-0.172i -0.373+0.047i -0.279-0.056i 0.303+0.048i]\n\ [0.058+0.118i -0.212-0.509i 0.281-0.195i -0.367+0.053i -0.276-0.063i 0.300+0.055i]\n\ [0.058+0.112i -0.213-0.527i 0.273-0.217i -0.360+0.059i -0.273-0.071i 0.296+0.061i]]", "[[0.526-0.156i -0.671-0.072i 0.050-0.042i -0.106+0.044i]\n\ [0.528-0.133i -0.685-0.062i 0.048-0.043i -0.103+0.041i]\n\ [0.528-0.109i -0.700-0.053i 0.045-0.043i -0.100+0.038i]\n\ [0.527-0.086i -0.714-0.044i 0.042-0.044i -0.098+0.036i]\n\ [0.525-0.063i -0.728-0.034i 0.040-0.045i -0.095+0.033i]\n\ [0.521-0.040i -0.743-0.025i 0.037-0.046i -0.092+0.030i]\n\ [0.516-0.017i -0.757-0.015i 0.034-0.046i -0.089+0.028i]\n\ [0.510+0.005i -0.771-0.006i 0.031-0.047i -0.086+0.025i]\n\ [0.502+0.027i -0.786+0.003i 0.029-0.048i -0.083+0.022i]\n\ [0.494+0.048i -0.800+0.013i 0.026-0.048i -0.081+0.019i]]", "[[0.874+0.095i -0.851+0.319i 0.178+0.255i 0.016+0.000i]\n\ [0.873+0.112i -0.828+0.274i 0.170+0.250i 0.016-0.003i]\n\ [0.870+0.128i -0.802+0.228i 0.162+0.245i 0.016-0.007i]\n\ [0.865+0.144i -0.774+0.182i 0.153+0.239i 0.016-0.010i]\n\ [0.859+0.159i -0.743+0.137i 0.143+0.233i 0.016-0.014i]\n\ [0.852+0.173i -0.709+0.091i 0.132+0.225i 0.016-0.017i]\n\ [0.843+0.187i -0.673+0.045i 0.120+0.217i 0.016-0.021i]\n\ [0.833+0.200i -0.635+0.000i 0.108+0.209i 0.016-0.025i]\n\ [0.822+0.213i -0.595-0.045i 0.096+0.200i 0.017-0.029i]\n\ [0.809+0.226i -0.552-0.089i 0.082+0.190i 0.017-0.032i]]"}; int i = 0; ss.setf(ios::fixed); ss.precision(3); double Ts = 100e-9; // channel sampling time Ts = 100ns double fd_norm = 100e3 * Ts; // normalised Doppler fd_norm = 10kHz * Ts RNG_reset(0); Channel_Specification cost207ra(COST207_RA); Channel_Specification cost207bu(COST207_BU); TDL_Channel tdl_207ra(cost207ra, Ts); TDL_Channel tdl_207bu(cost207bu, Ts); cmat ch_coeffs; tdl_207ra.set_fading_type(Independent); tdl_207ra.generate(10, ch_coeffs); ss << ch_coeffs; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); tdl_207bu.set_fading_type(Static); tdl_207bu.generate(5, ch_coeffs); ss << ch_coeffs; ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); tdl_207bu.set_fading_type(Correlated); tdl_207bu.set_norm_doppler(fd_norm); tdl_207bu.generate(10, ch_coeffs); ss << round_to_zero(ch_coeffs); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); tdl_207ra.set_correlated_method(FIR); tdl_207ra.set_norm_doppler(fd_norm); tdl_207ra.generate(10, ch_coeffs); ss << round_to_zero(ch_coeffs); ASSERT_TRUE(ss.str() == ref[i++]); ss.str(""); tdl_207ra.set_correlated_method(IFFT); tdl_207ra.generate(200, ch_coeffs); ss << round_to_zero(ch_coeffs.get_rows(0, 9)); ASSERT_TRUE(ss.str() == ref[i++]); } itpp-4.3.1/gtests/cholesky_test.cpp000066400000000000000000000057171216575753400174210ustar00rootroot00000000000000/*! * \file * \brief Cholesky factorisation test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(Cholesky, All) { ostringstream ss(ostringstream::out); const string ref[] = {"X = [[3.1227 -2.07284 4.95845 -0.526723 0.837649]\n\ [-2.07284 4.04154 -3.41073 2.58253 -2.42765]\n\ [4.95845 -3.41073 15.1747 -0.518676 0.767615]\n\ [-0.526723 2.58253 -0.518676 2.69632 -1.01246]\n\ [0.837649 -2.42765 0.767615 -1.01246 2.36107]]", "X = [[3.84646+0i 0.263101+2.41269i 1.41977-0.156761i -4.66083+1.4819i -1.61119+0.105067i]\n\ [0.263101-2.41269i 6.52894+0i 1.83059+1.97006i -1.05794+4.01142i -1.20091+2.68544i]\n\ [1.41977+0.156761i 1.83059-1.97006i 5.8672+0i -0.433947+1.42927i -1.39383+0.665716i]\n\ [-4.66083-1.4819i -1.05794-4.01142i -0.433947-1.42927i 9.4098+0i 1.13971-1.30921i]\n\ [-1.61119-0.105067i -1.20091-2.68544i -1.39383-0.665716i 1.13971+1.30921i 3.75041+0i]]"}; int k = 0; RNG_reset(0); { mat X, F; bool ok = false; while (!ok) { X = randn(5, 5); X = transpose(X) * X; // create a symmetric matrix // Make diagonal real and positive for (int i = 0; i < X.cols(); i++) X(i, i) = std::abs(X(i, i)); ok = chol(X, F); ASSERT_TRUE(ok); ss << "X = " << round_to_zero(X); ASSERT_TRUE(ss.str() == ref[k++]); ss.str(""); ASSERT_EQ(0, round_to_zero(norm(X - transpose(F) * F))); } } { cmat X, F; bool ok = false; while (!ok) { X = randn_c(5, 5); X = hermitian_transpose(X) * X; // create a symmetric matrix // Make diagonal real and positive for (int i = 0; i < X.cols(); i++) X(i, i) = std::abs(real(X(i, i))) ; ok = chol(X, F); ASSERT_TRUE(ok); ss << "X = " << round_to_zero(X); ASSERT_TRUE(ss.str() == ref[k++]); ASSERT_NEAR(12.683, round_to_zero(norm(X - transpose(F) * F)), 1e-3); } } } itpp-4.3.1/gtests/circular_buffer_test.cpp000066400000000000000000000104501216575753400207230ustar00rootroot00000000000000/*! * \file * \brief Circular buffer test program * \author * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST(CircularBuffer, All) { //Set a fixed seed to the random number generator RNG_reset(12345); int nrof_elements; ivec index_vec; vec a = randn(3); vec b = randn(8); vec out_vec; double out; Array out_array; Circular_Buffer cb1(10); //Put the elements of a to the buffer cb1.put(a); //Vector output: Peek at the two oldest elements of the buffer (the two first extracted) cb1.peek(out_vec, 2); ASSERT_TRUE(a(0,1) == out_vec); //Vector output: Peek at all elements of the buffer in reverse order cb1.peek_reverse(out_vec); ASSERT_TRUE(reverse(a) == out_vec); //Array output: Peek at all elements of the buffer in reverse order cb1.peek_reverse(out_array); nrof_elements = out_array.size(); for (int n = 0; n < nrof_elements; ++n) { ASSERT_EQ(a[n], out_array(nrof_elements-n-1)); } //Put the elements of \c b to the buffer cb1.put(b); //Extract the oldest element of the buffer cb1.get(out_vec, 1); ASSERT_EQ(a[1], out_vec[0]); //Extract all elements of the buffer cb1.get(out_vec); ASSERT_EQ(a[2], out_vec[0]); ASSERT_TRUE(b == out_vec(1,-1)); cb1.get(out_vec); ASSERT_EQ(0, out_vec.size()); cb1.get(out_array, 0); ASSERT_EQ(0, out_array.size()); for (int i = 0;i < a.length();i++) { cb1.put(a(i)); } for (int i = 0;i < b.length();i++) { cb1.put(b(i)); } ASSERT_EQ(cb1.size(), cb1.nrof_elements()); nrof_elements = cb1.nrof_elements(); for (int i = 0;i < nrof_elements;i++) { cb1.peek(i, out); if (2 > i) { ASSERT_EQ(a[i+1], out); } else { ASSERT_EQ(b[i-2], out); } } //Test of error handling //cout << "get() = " << cb1.get() << endl; cb1.put(b); ASSERT_EQ(10, cb1.size()); ASSERT_EQ(10, cb1.nrof_elements()); cb1.peek(out_vec, -1); for (int i = 0; i < out_vec.length(); ++i) { if (2 > i) { ASSERT_EQ(b[6+i], out_vec[i]); } else { ASSERT_EQ(b[i-2], out_vec[i]); } } index_vec = "5 3 7 1"; for (int i = 0;i < index_vec.size();i++) { cb1.peek(index_vec(i), out); if (3 > i) { ASSERT_EQ(b[index_vec[i]-2], out); } else { ASSERT_EQ(b[7], out); } } cb1.peek(index_vec, out_vec); for (int i = 0;i < index_vec.size();i++) { if (3 > i) { ASSERT_EQ(b[index_vec[i]-2], out_vec[i]); } else { ASSERT_EQ(b[7], out_vec[i]); } } cb1.set_size(15, true); ASSERT_EQ(15, cb1.size()); ASSERT_EQ(10, cb1.nrof_elements()); cb1.peek(out_vec, -1); for (int i = 0; i < out_vec.length(); ++i) { if (2 > i) { ASSERT_EQ(b[6+i], out_vec[i]); } else { ASSERT_EQ(b[i-2], out_vec[i]); } } cb1.set_size(5, true); cb1.peek(out_vec, -1); for (int i = 0; i < out_vec.length(); ++i) { ASSERT_EQ(b[i+3], out_vec[i]); } // "Copy constructor: " Circular_Buffer cb2(cb1); cb2.peek(out_vec, -1); for (int i = 0; i < out_vec.length(); ++i) { ASSERT_EQ(b[i+3], out_vec[i]); } // "Copy operator: " Circular_Buffer cb3 = cb1; cb3.peek(out_array, -1); for (int i = 0; i < out_vec.length(); ++i) { ASSERT_EQ(b[i+3], out_vec[i]); } } itpp-4.3.1/gtests/commfunc_test.cpp000066400000000000000000000077411216575753400174060ustar00rootroot00000000000000/*! * \file * \brief Commfunc test program * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST(CommFunc, All) { const double tol = 1e-9; bmat expected_gray = "0 0 0 0 0;\ 0 0 0 0 1;\ 0 0 0 1 1;\ 0 0 0 1 0;\ 0 0 1 1 0;\ 0 0 1 1 1;\ 0 0 1 0 1;\ 0 0 1 0 0;\ 0 1 1 0 0;\ 0 1 1 0 1;\ 0 1 1 1 1;\ 0 1 1 1 0;\ 0 1 0 1 0;\ 0 1 0 1 1;\ 0 1 0 0 1;\ 0 1 0 0 0;\ 1 1 0 0 0;\ 1 1 0 0 1;\ 1 1 0 1 1;\ 1 1 0 1 0;\ 1 1 1 1 0;\ 1 1 1 1 1;\ 1 1 1 0 1;\ 1 1 1 0 0;\ 1 0 1 0 0;\ 1 0 1 0 1;\ 1 0 1 1 1;\ 1 0 1 1 0;\ 1 0 0 1 0;\ 1 0 0 1 1;\ 1 0 0 0 1;\ 1 0 0 0 0"; ASSERT_TRUE(expected_gray == graycode(5)); RNG_reset(0); bvec b1 = randb(10); bvec b2 = randb(10); ASSERT_EQ(8, hamming_distance(b1, b2)); ASSERT_EQ(7, weight(b1)); vec expected_water = "0 0 0.001"; vec actual_water = waterfilling("1 2 3", 0.001); int i = 0; for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } expected_water = "0 0 0.010000000000000009"; actual_water = waterfilling("1 2 3", 0.01); for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } expected_water = "0 0 0.1"; actual_water = waterfilling("1 2 3", 0.1); for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } expected_water = "0 0.16666666666666663 0.33333333333333331"; actual_water = waterfilling("1 2 3", 0.5); for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } expected_water = "0 0.41666666666666652 0.58333333333333326"; actual_water = waterfilling("1 2 3", 1); for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } expected_water = "1.2777777777777777 1.7777777777777777 1.9444444444444444"; actual_water = waterfilling("1 2 3", 5); for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } expected_water = "32.944444444444443 33.444444444444443 33.611111111111107"; actual_water = waterfilling("1 2 3", 100); for (i = 0; i < actual_water.length(); ++i) { ASSERT_NEAR(expected_water[i], actual_water[i], tol); } } itpp-4.3.1/gtests/convcode_test.cpp000066400000000000000000000177221216575753400173770ustar00rootroot00000000000000/*! * \file * \brief Convolutional encoder/decoder class test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (ConvCode, All) { // Test of convolutional coders Array spectrum, spectrum_fast, spectrum_punct, spectrum_punct_fast; spectrum.set_size(2); spectrum_fast.set_size(2); spectrum_punct.set_size(2); spectrum_punct_fast.set_size(2); Convolutional_Code code; Punctured_Convolutional_Code code_punct; BPSK bpsk; BERC berc; const int no_bits = 2500; const int packet_size = 500; int coded_packet_size; bvec bits, tail_coded_bits, tail_decoded_bits, tailbite_coded_bits, tailbite_decoded_bits, trunc_coded_bits, trunc_decoded_bits; vec symbols; ivec dist_profile; ivec G(2); G(0) = 0133; G(1) = 0171; int L = max(int2bits(G(0)), int2bits(G(1))); // L = 7 code.set_generator_polynomials(G, L); code_punct.set_generator_polynomials(G, L); bmat punct_matrix = "1 0 1; 1 1 0"; // results in R = 3/4 code_punct.set_puncture_matrix(punct_matrix); //1) Rate 1/2 code ASSERT_FALSE(code.catastrophic()); ASSERT_DOUBLE_EQ(0.5, code.get_rate()); code.calculate_spectrum(spectrum, 10, 10); code.fast(spectrum_fast, 10, 10); code.distance_profile(dist_profile, 10); // Spectrum and Spectrum, fast ivec expected = "0 0 0 0 0 0 0 0 0 0 11 0 38 0 193 0 1331 0 7275 0"; ASSERT_TRUE(expected == spectrum(0));//Ad ASSERT_TRUE(expected == spectrum_fast(0)); expected = "0 0 0 0 0 0 0 0 0 0 36 0 211 0 1404 0 11633 0 77433 0"; ASSERT_TRUE(expected == spectrum(1));//Cd ASSERT_TRUE(expected == spectrum_fast(1)); // Distance profile expected = "2 3 3 4 4 4 4"; ASSERT_TRUE(expected == dist_profile); // Tail method test. Printing 30 bits starting from bit 1400 RNG_reset(0); bits = randb(no_bits); //Input bits bvec expect_bits = "0 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0"; bvec expect_enc_bits = "1 0 0 1 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0 0 0"; ASSERT_TRUE(expect_bits == bits.mid(1400, 30)); tail_coded_bits = code.encode_tail(bits); //Coded bits ASSERT_TRUE(expect_enc_bits == tail_coded_bits.mid(1400, 30)); bpsk.modulate_bits(tail_coded_bits, symbols); tail_decoded_bits = code.decode_tail(symbols); //Decoded bits ASSERT_TRUE(expect_bits == tail_decoded_bits.mid(1400, 30)); berc.count(bits, tail_decoded_bits); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); //Tailbite method test. Printing 30 bits starting from bit 1400 ASSERT_TRUE(expect_bits == bits.mid(1400, 30)); tailbite_coded_bits = code.encode_tailbite(bits); ASSERT_TRUE(expect_enc_bits == tailbite_coded_bits.mid(1400, 30)); bpsk.modulate_bits(tailbite_coded_bits, symbols); tailbite_decoded_bits = code.decode_tailbite(symbols); //Decoded bits ASSERT_TRUE(expect_bits == tailbite_decoded_bits.mid(1400, 30)); berc.clear(); berc.count(bits, tailbite_decoded_bits); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); //Trunc method test. Printing 30 bits starting from bit 1400 ASSERT_TRUE(expect_bits == bits.mid(1400, 30)); trunc_coded_bits.set_size(0); for (int i = 0; i < no_bits / packet_size; i++) { trunc_coded_bits = concat(trunc_coded_bits, code.encode_trunc(bits.mid(i * packet_size, packet_size))); } ASSERT_TRUE(expect_enc_bits == trunc_coded_bits.mid(1400, 30)); bpsk.modulate_bits(trunc_coded_bits, symbols); trunc_decoded_bits.set_size(0); coded_packet_size = round_i(packet_size / code.get_rate()); for (int i = 0; i < no_bits / packet_size; i++) { trunc_decoded_bits = concat(trunc_decoded_bits, code.decode_trunc(symbols.mid(i * coded_packet_size, coded_packet_size))); } ASSERT_TRUE(expect_bits == trunc_decoded_bits.mid(1400, 30)); berc.clear(); berc.count(bits, trunc_decoded_bits); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); //2) Punctured code (R = 3/4) ASSERT_FALSE(code_punct.catastrophic()); ASSERT_DOUBLE_EQ(0.75, code_punct.get_rate()); bmat expect_punct_mat = "1 0 1; 1 1 0"; ASSERT_TRUE(expect_punct_mat == code_punct.get_puncture_matrix()); //Tail method test. Printing 30 bits starting from bit 1400 bits = randb(no_bits); expect_bits = "1 1 1 0 1 1 1 1 1 0 0 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 0 0 1 1"; ASSERT_TRUE(expect_bits == bits.mid(1400, 30)); tail_coded_bits = code_punct.encode_tail(bits); expect_enc_bits = "0 1 1 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 0"; ASSERT_TRUE(expect_enc_bits == tail_coded_bits.mid(1400, 30)); bpsk.modulate_bits(tail_coded_bits, symbols); tail_decoded_bits = code_punct.decode_tail(symbols); ASSERT_TRUE(expect_bits == tail_decoded_bits.mid(1400, 30)); berc.count(bits, tail_decoded_bits); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); //Tailbite method test. Printing 30 bits starting from bit 1400 ASSERT_TRUE(expect_bits == bits.mid(1400, 30)); tailbite_coded_bits = code_punct.encode_tailbite(bits); ASSERT_TRUE(expect_enc_bits == tailbite_coded_bits.mid(1400, 30)); bpsk.modulate_bits(tailbite_coded_bits, symbols); tailbite_decoded_bits = code_punct.decode_tailbite(symbols); ASSERT_TRUE(expect_bits == tailbite_decoded_bits.mid(1400, 30)); berc.clear(); berc.count(bits, tailbite_decoded_bits); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); //Trunc method test. Printing 30 bits starting from bit 1400 ASSERT_TRUE(expect_bits == bits.mid(1400, 30)); trunc_coded_bits.set_size(0); for (int i = 0; i < no_bits / packet_size; i++) { trunc_coded_bits = concat(trunc_coded_bits, code_punct.encode_trunc(bits.mid(i * packet_size, packet_size))); } expect_enc_bits = "1 0 0 1 0 1 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 1"; ASSERT_TRUE(expect_enc_bits == trunc_coded_bits.mid(1400, 30)); bpsk.modulate_bits(trunc_coded_bits, symbols); trunc_decoded_bits.set_size(0); coded_packet_size = round_i(packet_size / code_punct.get_rate()); for (int i = 0; i < no_bits / packet_size; i++) { trunc_decoded_bits = concat(trunc_decoded_bits, code_punct.decode_trunc(symbols.mid(i * coded_packet_size, coded_packet_size))); } ASSERT_TRUE(expect_bits == trunc_decoded_bits.mid(1400, 30)); berc.clear(); berc.count(bits, trunc_decoded_bits); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); //3) Rate 1/7 code ivec generator(7); generator(0)=02; generator(1)=011; generator(2)=015; generator(3)=014; generator(4)=07; generator(5)=012; generator(6)=06; code.set_generator_polynomials(generator, 4); bvec uncoded = "1 1 1 1 1 1 1"; bvec coded = code.encode_tail(uncoded); bvec decoded = code.decode_tail(to_vec((-2)*to_ivec(coded)+1)); ASSERT_TRUE(uncoded == decoded); berc.clear(); berc.count(uncoded, decoded); ASSERT_DOUBLE_EQ(0, berc.get_errorrate()); } itpp-4.3.1/gtests/converters_test.cpp000066400000000000000000000042661216575753400177700ustar00rootroot00000000000000/*! * \file * \brief Tests of miscellaneous conversion functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (Converters, All) { vec v1 = "-4:0.5:5.5"; vec v2 = randn(10) * 20 - 10; vec v = concat(v1, v2); ASSERT_EQ(v1.length()+v2.length(), v.length()); ASSERT_TRUE(v1 == v.left(v1.length())); ASSERT_TRUE(v2 == v.right(v2.length())); vec expect = round_to_zero(round(v)); vec actual = to_vec(round_i(v)); ASSERT_TRUE(expect == actual); expect = round_to_zero(ceil(v)); actual = to_vec(ceil_i(v)); ASSERT_TRUE(expect == actual); expect = round_to_zero(floor(v)); actual = to_vec(floor_i(v)); ASSERT_TRUE(expect == actual); RNG_reset(0); bvec b = randb(15); int i = bin2dec(b); ASSERT_EQ(31523, i); ASSERT_TRUE(b == dec2bin(i)); i = bin2dec(b, false); ASSERT_EQ(25199, i); ASSERT_TRUE(b == dec2bin(i, false)); ivec iv = bin2oct(b); ivec expect_i = "7 5 4 4 3"; ASSERT_TRUE(expect_i == iv); ASSERT_TRUE(b == oct2bin(iv)); ASSERT_TRUE(b == oct2bin(iv, 1)); iv = bin2pol(b); expect_i = 1-2*to_ivec(b); ASSERT_TRUE(expect_i == iv); ASSERT_TRUE(b == pol2bin(iv)); } itpp-4.3.1/gtests/demapper_test.cpp000066400000000000000000000073531216575753400173730ustar00rootroot00000000000000/*! * \file * \brief test program for MIMO demapper * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST (Demapper, All) { //parameters int const_size = 16; string demapper_method[] = {"Hassibi_maxlogMAP", "GA", "sGA", "mmsePIC", "zfPIC"}; string code_name = "V-BLAST_MxN"; int em_antennas = 2; int rec_antennas = 2; int channel_uses = 1; int perm_len = pow2i(6);//permutation length //QAM modulator class QAM mod(const_size); //Space-Time code parameters STC st_block_code(code_name, const_size, em_antennas, channel_uses);//generate matrices for LD code (following Hassibi's approach) //SISO blocks SISO siso; siso.set_constellation(mod.bits_per_symbol(), mod.get_symbols(), mod.get_bits2symbols()); siso.set_st_block_code(st_block_code.get_nb_symbols_per_block(), st_block_code.get_1st_gen_matrix(), st_block_code.get_2nd_gen_matrix(), rec_antennas); siso.set_noise(1e-1); //bits generation bvec bits = randb(perm_len); //QAM modulation cvec em = mod.modulate_bits(bits)/sqrt(double(em_antennas));//normalize emitted symbols //ST code cmat S = st_block_code.encode(em); //internal variables int symb_block = st_block_code.get_nb_symbols_per_block(); int nb_symb = perm_len/mod.bits_per_symbol();//number of symbols at the modulator output int nb_subblocks = nb_symb/symb_block;//number of blocks of ST code emitted in an interleaver period int tx_duration = channel_uses*nb_subblocks;//transmission duration expressed in number of symbol periods //ideal channel ASSERT_EQ(em_antennas, rec_antennas); cmat mimo_channel = eye_c(em_antennas); cmat rec(tx_duration,rec_antennas); for (int ns=0;ns 0), bits); ASSERT_DOUBLE_EQ(0, ber.get_errorrate()); demapper_extrinsic_data.zeros(); } } itpp-4.3.1/gtests/det_test.cpp000066400000000000000000000134421216575753400163460ustar00rootroot00000000000000/*! * \file * \brief Determinant routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(Det, All) { const double eps = 1e-14; int i,j; { //Real matrix RNG_reset(0); mat X = randn(5, 5); mat X_expect = "-0.53867916598526822 -0.8784344572039396 -0.5319684156366868 -1.2762774231089256 0.3825268969473976; " "-1.2749137275918296 1.290111844695397 -3.7326992066642575 0.3873527275026688 -0.61039461776231596; " "1.0282326809755016 -0.67538252183750369 -0.1127551468065689 -0.38752244901288929 0.34978316627410816; " "-0.12769391261256544 -0.70127933871039161 -0.94014676063834202 0.014601505447491007 1.296765364185652; " "-0.36545017988288314 0.8109093563933464 0.24924688123208288 0.8757911319502223 -0.1954802954379749"; for (i = 0; i < X.rows(); ++i) { for (j = 0; j < X.cols(); ++j) { ASSERT_NEAR(X_expect(i,j), X(i,j), eps) << i << "x" < d = det(X); ASSERT_NEAR(-6.1046669217012699, d.real(), eps); ASSERT_NEAR(1.4975632311302132, d.imag(), eps); X = randn_c(5, 5); X_expect = "-0.8696275831109568+0.7570043306871584i -0.6238632012662513+0.04914321647156545i 0.03429401822619-0.5558754225740515i " "0.1666364451082585+0.4007317486458041i -0.5893392184430184+0.1674181706465156i; " "0.7287475585975989-0.1326379358269829i -1.10390652648413-0.9635435410370933i -0.2154901642550677-0.7622797901336434i " "0.1344928439490188+0.9887947312211245i -0.6116368553547598-0.04220192308753814i; " "0.3229109080077305+0.648281980978702i 1.580133781005509+0.4497496320949741i 0.4460947554352002-0.7594798687045069i " "0.1667005240265463-1.309249975681504i -0.2730774606391793-0.9649958584432418i; " "0.5393189597808304-1.698775822486131i -1.340916266239779+0.1034133351433764i 0.04215845908992501+0.4537234814943746i " "-1.3548706130263835+0.8596469645054249i 0.3249565584899411+0.3836772302093931i; " "0.8257068048973116-0.3091289715393962i 0.3939126587361242+0.6689829815540316i -0.1218813738886838-0.5598128607210444i " "-1.047042745257851-0.1636197700545179i 0.4042670413266145-0.4705694687533109i"; for (i = 0; i < X.rows(); ++i) { for (j = 0; j < X.cols(); ++j) { ASSERT_NEAR(X_expect(i,j).real(), X(i,j).real(), eps) << i << "x" <. * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(Eigen, All) { double actual_norm = 0; const double eps = 1e-12; { //Real symmetric matrix mat A = randn(5, 5); A = transpose(A) * A; // make it symmetic mat V; vec d; eig_sym(A, d, V); actual_norm = norm(A * V - V * diag(d)); ASSERT_NEAR(0, actual_norm, eps); } { //Real non-symmetric matrix mat A = randn(5, 5); cmat V; cvec d; eig(A, d, V); actual_norm = norm(A * V - V * diag(d)); ASSERT_NEAR(0, actual_norm, eps); } { //Complex hermitian matrix cmat A = randn_c(5, 5); A = transpose(conj(A)) * A; // make it hermitian cmat V; vec d; eig_sym(A, d, V); actual_norm = norm(A * V - V * diag(d)); ASSERT_NEAR(0, actual_norm, eps); } { //Complex non-hermitian matrix cmat A = randn_c(5, 5); cmat V; cvec d; eig(A, d, V); actual_norm = norm(A * V - V * diag(d)); ASSERT_NEAR(0, actual_norm, eps); } } itpp-4.3.1/gtests/error_count_test.cpp000066400000000000000000000042031216575753400201260ustar00rootroot00000000000000/*! * \file * \brief BERC and BLER error counters test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(ErrorCount, All) { //BERC and BLER test const double eps = 1e-12; RNG_reset(0); const int block_size = 20; const ivec error_pos = "3 5 9 17"; BERC berc; BLERC blerc(block_size); for (int i = 0; i < 100; ++i) { bvec input = randb(block_size); bvec output = input; // introduce some errors if (i < 80) for (int j = 0; j < error_pos.size(); ++j) output(error_pos(j)) = !output(error_pos(j)); // extend the output vector by one bit output = concat(output, bin(1)); // count errors berc.count(input, output); blerc.count(input, output); } ASSERT_NEAR(0.8, blerc.get_errorrate(), eps); ASSERT_NEAR(80, blerc.get_errors(), eps); ASSERT_NEAR(20, blerc.get_corrects(), eps); ASSERT_EQ(100, blerc.get_total_blocks()); ASSERT_NEAR(0.16, berc.get_errorrate(), eps); ASSERT_NEAR(320, berc.get_errors(), eps); ASSERT_NEAR(1680, berc.get_corrects(), eps); ASSERT_EQ(2000, berc.get_total_bits()); } itpp-4.3.1/gtests/exit_test.cpp000066400000000000000000000134331216575753400165430ustar00rootroot00000000000000/*! * \file * \brief EXIT class test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(EXIT, All) { //test parameters const double eps = 1e-12; const vec apriori_mutual_info_expect = "1.803346244821924e-05 0.48594415413293501 0.91282228577448177 0.99902335921776853"; const vec extrinsic_mutual_info_expect = "0.57474253793992003 0.79081789562325711 0.98191798133410091 0.9975400908252704"; const vec extrinsic_mutual_info_p_expect = "0.031706232459936402 0.33837811448717559 0.93275900297128034 0.99710134578550191"; //general parameters vec sigmaA = "0.01 2 4 7";//standard deviation (sqrt(variance)) of the mutual a priori information double threshold_value = 50; string map_metric = "maxlogMAP"; ivec gen = "07 05";//octal form int constraint_length = 3; int nb_blocks_lim = 10; int perm_len = int(itpp::pow10(3.0));//total number of bits in a block (with tail) double EbN0_dB = 0.8; double R = 1.0 / 3.0; //coding rate of PCCC double Ec = 1.0;//coded bit energy //other parameters vec sigma2A = sqr(sigmaA); int sigma2A_len = sigma2A.length(); int nb_bits = perm_len - (constraint_length - 1); //number of bits in a block (without tail) double sigma2 = (0.5 * Ec / R) * pow(inv_dB(EbN0_dB), -1.0); //N0/2 double Lc = -2 / sigma2; //normalisation factor for intrinsic information (take into account the BPSK modulation) bvec bits(nb_bits); bvec tail; bvec bits_tail(perm_len); bmat parity_bits; int coded_bits_len = 2 * perm_len; bvec coded_bits(coded_bits_len); vec mod_bits(coded_bits_len); vec rec_sig(coded_bits_len); vec intrinsic_coded(coded_bits_len); vec intrinsic_coded_p(2 * nb_bits); intrinsic_coded_p.zeros(); vec apriori_data(perm_len); vec extrinsic_coded; vec extrinsic_data; vec apriori_mutual_info(sigma2A_len); vec extrinsic_mutual_info(sigma2A_len); vec extrinsic_mutual_info_p(sigma2A_len); extrinsic_mutual_info.zeros(); extrinsic_mutual_info_p.zeros(); register int en, n, nb_blocks; //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code rsc; rsc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; channel.set_noise(sigma2); //SISO module SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //EXIT chart EXIT exit; //Randomize generators RNG_reset(12345); //main loop for(en = 0; en < sigma2A_len; en++) { apriori_mutual_info(en) = exit.apriori_mutual_info(sigma2A(en));//a priori mutual info for(nb_blocks = 0; nb_blocks < nb_blocks_lim; nb_blocks++) { //bits generation bits = randb(nb_bits); //RSC code rsc.encode_tail(bits, tail, parity_bits);//tail is added //form coder output bits_tail = concat(bits, tail); for(n = 0; n < perm_len; n++) { coded_bits(2 * n) = bits_tail(n); //systematic output coded_bits(2 * n + 1) = parity_bits(n, 0); //parity output } //BPSK modulation (1->-1,0->+1) mod_bits = bpsk.modulate_bits(coded_bits); //AWGN channel rec_sig = channel(mod_bits); //first SISO RSC module (tail is added) //intrinsic info. of coded bits intrinsic_coded = Lc * rec_sig; //a priori info. of data bits apriori_data = exit.generate_apriori_info(bits_tail); //SISO RSC module siso.rsc(extrinsic_coded, extrinsic_data, intrinsic_coded, apriori_data, true); //threshold extrinsic_data = SISO::threshold(extrinsic_data, threshold_value); //extrinsic mutual info extrinsic_mutual_info(en) += exit.extrinsic_mutual_info(extrinsic_data.left(nb_bits), bits); //second SISO RSC module (no tail added) //intrinsic info. of coded bits for(n = 0; n < nb_bits; n++) intrinsic_coded_p(2 * n + 1) = Lc * rec_sig(2 * n + 1); //parity bits only //a priori info. of data bits apriori_data = exit.generate_apriori_info(bits); //SISO RSC module siso.rsc(extrinsic_coded, extrinsic_data, intrinsic_coded_p, apriori_data, false); //threshold extrinsic_data = SISO::threshold(extrinsic_data, threshold_value); //extrinsic mutual info extrinsic_mutual_info_p(en) += exit.extrinsic_mutual_info(extrinsic_data, bits); }//end blocks (while loop) //mean extrinsic mutual info over all blocks extrinsic_mutual_info(en) /= nb_blocks_lim; extrinsic_mutual_info_p(en) /= nb_blocks_lim; //check results ASSERT_NEAR(apriori_mutual_info_expect(en), apriori_mutual_info(en), eps); ASSERT_NEAR(extrinsic_mutual_info_expect(en), extrinsic_mutual_info(en), eps); ASSERT_NEAR(extrinsic_mutual_info_p_expect(en), extrinsic_mutual_info_p(en), eps); } } itpp-4.3.1/gtests/fastica_test.cpp000066400000000000000000000240161216575753400172030ustar00rootroot00000000000000/*! * \file * \brief FastICA test program * \author Francois Cayre, Teddy Furon and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ /*----------------------------------------------------------------------------------------* * FastICA for IT++ * *----------------------------------------------------------------------------------------* * This code is Copyright (C) 2004 by Francois CAYRE and Teddy FURON * * TEMICS Project * * INRIA/Rennes (IRISA) * * Campus Universitaire de Beaulieu * * 35042 RENNES cedex FRANCE * * * * Email : firstname.lastname@irisa.fr * * * * This is the IT++ implementation of the original Matlab package FastICA. * * * * Matlab package is Copyright (C) 1998 by Jarmo HURRI, Hugo GAVERT, Jaakko SARELA and * * Aapo HYVARINEN * * Laboratory of Information and Computer Science * * Helsinki University of Technology * * * * URL : http://www.cis.hut.fi/projects/ica/fastica/about.shtml * * * * If you use results given by this FastICA software in an article for a scientific * * journal, conference proceedings or similar, please include the following original * * reference in the bibliography : * * * * A. Hyvarinen. Fast and Robust Fixed-Point Algorithms for Independent Component * * Analysis. IEEE Transactions on Neural Networks 10(3):626-634, 1999. * *----------------------------------------------------------------------------------------* * DISCLAIMER * * * * This software package is free software ; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the Free Software * * Foundation ; either version 2 of the License, or any later version. * * * * The software package 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 General Public License for more details. * * * *----------------------------------------------------------------------------------------* * Differences with the original Matlab implementation : * * - no GUI * * - return something even in the case of a convergence problem * * - optimization of SVD decomposition (performed 2 times in Matlab, only 1 time in IT++) * * - default approach is SYMM wit non-linearity POW3 * *----------------------------------------------------------------------------------------*/ #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(Fastica, All) { #if defined(FASTICA_TEST_FILE) const double eps = 1e-12; const mat mixing_matrix_expect = "0.20144255910862657 0.37985941512204879; -0.38969201072547255 0.31918961738834795"; const mat separating_matrix_expect = "1.503295812136356 -1.789033968666887; 1.835342805132183 0.94873936681213422"; const mat independent_components_expect = "0.081523541458408566 0.74717136112026661 1.2323127422446056 1.4178953014486217 " "1.2582094210524861 0.79207900492589467 0.13335632609814074 -0.55695312005441711 " "-1.1101100814898155 -1.3909552319850542;" "-1.7138482673446558 -1.5321013719589991 -1.352666385717076 -1.1770680527274013 " "-1.0058918059024045 -0.83864043309954472 -0.67385567733571405 -0.50947550907352301 " "-0.34333866810304298 -0.17371418886128326";//sampled independent comp matrix FILE * fpin = NULL; float tmp = 0.0; // Separate nrIC independent components in nrSamples samples int nrSamples = 0, nrIC = 0; fpin = fopen(FASTICA_TEST_FILE, "r"); ASSERT_TRUE(NULL != fpin) << "Error: Could not open FASTICA_TEST_FILE for reading"; //Test program for FastICA / IT++ int ret = fscanf(fpin, "%d", &nrSamples); ret = fscanf(fpin, "%d", &nrIC); mat X = zeros(nrIC, nrSamples); for (int i = 0; i < nrSamples; i++) for (int j = 0; j < nrIC; j++) { ret = fscanf(fpin , "%f", &tmp); X(j, i) = tmp; } fclose(fpin); RNG_reset(0);//separate uses randu // Instantiate an ICA object with default parameters : SYMM approach and // POW3 non-linearity // Be sure that : // - nrSamples = number of samples = nb of columns of the input matrix // - nrIC = number of sensors = nb of rows of the input matrix Fast_ICA my_fastica(X); // Set number of independent components to separate : // By default, this value is taken from the dimension of // the input data. This line is for illustration purposes. // May help in some cases. my_fastica.set_nrof_independent_components(nrIC); // Perform ICA bool result = my_fastica.separate(); ASSERT_TRUE(result) << "Algorithm failed"; // Get results mat mixing_matrix = my_fastica.get_mixing_matrix(); mat separating_matrix = my_fastica.get_separating_matrix(); mat independent_components = my_fastica.get_independent_components(); for (int i = 0; i < mixing_matrix.rows(); ++i) { for (int j = 0; j < mixing_matrix.cols(); ++j) { ASSERT_NEAR(mixing_matrix_expect(i,j), mixing_matrix(i,j), eps); ASSERT_NEAR(separating_matrix_expect(i,j), separating_matrix(i,j), eps); } } ASSERT_EQ(nrIC, independent_components.rows()); ASSERT_EQ(nrSamples, independent_components.cols()); for (int i = 0; i < nrIC; ++i) { for (int j = 0; j < nrSamples/100; ++j) { ASSERT_NEAR(independent_components_expect(i,j), independent_components(i,j*nrSamples/100), eps); } } // Another test with other parameters Fast_ICA my_fastica2(X); // Set GAUSS non-linearity my_fastica2.set_non_linearity(FICA_NONLIN_GAUSS); // Use deflation approach : IC are computed one by one my_fastica2.set_approach(FICA_APPROACH_DEFL); // Perform ICA result = my_fastica2.separate(); ASSERT_TRUE(result) << "Algorithm failed"; // Get results mixing_matrix = my_fastica.get_mixing_matrix(); separating_matrix = my_fastica.get_separating_matrix(); independent_components = my_fastica.get_independent_components(); for (int i = 0; i < mixing_matrix.rows(); ++i) { for (int j = 0; j < mixing_matrix.cols(); ++j) { ASSERT_NEAR(mixing_matrix_expect(i,j), mixing_matrix(i,j), eps); ASSERT_NEAR(separating_matrix_expect(i,j), separating_matrix(i,j), eps); } } ASSERT_EQ(nrIC, independent_components.rows()); ASSERT_EQ(nrSamples, independent_components.cols()); for (int i = 0; i < nrIC; ++i) { for (int j = 0; j < nrSamples/100; ++j) { ASSERT_NEAR(independent_components_expect(i,j), independent_components(i,j*nrSamples/100), eps); } } // Another test which should fail const int rows = 10; const int comp = 3; RNG_reset(1); mat signal = randu(rows, 100); mat guess = zeros(rows, comp); Fast_ICA my_fastica3(signal); // Use deflation approach : IC are computed one by one my_fastica3.set_approach(FICA_APPROACH_DEFL); my_fastica3.set_nrof_independent_components(comp); my_fastica3.set_init_guess(guess); my_fastica3.set_max_num_iterations(100); // Perform ICA result = my_fastica3.separate(); ASSERT_FALSE(result) << "Algorithm should fail"; #else FAIL() << "FASTICA_TEST_FILE not defined. Test skipped."; #endif // defined(FASTICA_TEST_FILE) } itpp-4.3.1/gtests/fastica_test_data.txt000066400000000000000000000626271216575753400202430ustar00rootroot000000000000001000 2 -0.634599062 -0.578811670 -0.613534476 -0.600355395 -0.592542503 -0.621763400 -0.571659225 -0.642968249 -0.550920448 -0.663903013 -0.530361620 -0.684501440 -0.510017738 -0.704698117 -0.489923262 -0.724428636 -0.470112030 -0.743629754 -0.450617168 -0.762239550 -0.431471016 -0.780197584 -0.412705040 -0.797445041 -0.394349756 -0.813924886 -0.376434653 -0.829582000 -0.358988121 -0.844363322 -0.342037378 -0.858217978 -0.325608402 -0.871097412 -0.309725869 -0.882955506 -0.294413088 -0.893748693 -0.279691943 -0.903436069 -0.265582841 -0.911979492 -0.252104658 -0.919343683 -0.239274693 -0.925496307 -0.227108626 -0.930408059 -0.215620476 -0.934052734 -0.204822568 -0.936407297 -0.194725503 -0.937451934 -0.185338129 -0.937170108 -0.176667520 -0.935548596 -0.168718959 -0.932577523 -0.161495925 -0.928250389 -0.155000082 -0.922564083 -0.149231277 -0.915518889 -0.144187540 -0.907118490 -0.139865089 -0.897369957 -0.136258339 -0.886283726 -0.133359916 -0.873873583 -0.131160674 -0.860156618 -0.129649723 -0.845153189 -0.128814449 -0.828886870 -0.128640551 -0.811384392 -0.129112074 -0.792675575 -0.130211452 -0.772793252 -0.131919546 -0.751773194 -0.134215700 -0.729654012 -0.137077783 -0.706477065 -0.140482254 -0.682286357 -0.144404214 -0.657128424 -0.148817472 -0.631052221 -0.153694606 -0.604108999 -0.159007038 -0.576352174 -0.164725101 -0.547837196 -0.170818112 -0.518621411 -0.177254455 -0.488763917 -0.184001651 -0.458325414 -0.191026448 -0.427368055 -0.198294898 -0.395955291 -0.205772445 -0.364151710 -0.213424010 -0.332022878 -0.221214078 -0.299635172 -0.229106789 -0.267055619 -0.237066027 -0.234351722 -0.245055509 -0.201591298 -0.253038876 -0.168842303 -0.260979784 -0.136172666 -0.268841997 -0.103650117 -0.276589474 -0.071342018 -0.284186461 -0.039315195 -0.291597580 -0.007635771 -0.298787919 0.023630998 -0.305723117 0.054420888 -0.312369449 0.084670869 -0.318693915 0.114319258 -0.324664317 0.143305877 -0.330249344 0.171572201 -0.335418646 0.199061507 -0.340142915 0.225719012 -0.344393952 0.251492014 -0.348144744 0.276330021 -0.351369526 0.300184877 -0.354043849 0.323010886 -0.356144639 0.344764921 -0.357650257 0.365406535 -0.358540550 0.384898063 -0.358796903 0.403204712 -0.358402288 0.420294653 -0.357341300 0.436139097 -0.355600204 0.450712368 -0.353166961 0.463991968 -0.350031264 0.475958631 -0.346184563 0.486596375 -0.341620082 0.495892537 -0.336332842 0.503837809 -0.330319668 0.510426260 -0.323579202 0.515655348 -0.316111901 0.519525931 -0.307920042 0.522042261 -0.299007710 0.523211976 -0.289380793 0.523046079 -0.279046964 0.521558913 -0.268015663 0.518768121 -0.256298073 0.514694606 -0.243907093 0.509362476 -0.230857305 0.502798987 -0.217164938 0.495034471 -0.202847826 0.486102262 -0.187925365 0.476038613 -0.172418466 0.464882605 -0.156349497 0.452676049 -0.139742235 0.439463383 -0.122621798 0.425291558 -0.105014592 0.410209924 -0.086948234 0.394270104 -0.068451493 0.377525867 -0.049554212 0.360032990 -0.030287234 0.341849125 -0.010682329 0.323033649 0.009227891 0.303647518 0.029410049 0.283753114 0.049830090 0.263414089 0.070453364 0.242695209 0.091244711 0.221662186 0.112168555 0.200381519 0.133188984 0.178920326 0.154269848 0.157346176 0.175374845 0.135726920 0.196467613 0.114130521 0.217511819 0.092624887 0.238471253 0.071277699 0.259309917 0.050156238 0.279992113 0.029327227 0.300482537 0.008856652 0.320746361 -0.011190392 0.340749327 -0.030749872 0.360457825 -0.049758972 0.379838985 -0.068156252 0.398860752 -0.085881801 0.417491971 -0.102877388 0.435702463 -0.119086605 0.453463100 -0.134455011 0.470745879 -0.148930266 0.487523991 -0.162462261 0.503771888 -0.175003247 0.519465348 -0.186507951 0.534581536 -0.196933690 0.549099057 -0.206240478 0.562998014 -0.214391126 0.576260056 -0.221351333 0.588868424 -0.227089777 0.600807993 -0.231578187 0.612065309 -0.234791418 0.622628625 -0.236707510 0.632487925 -0.237307747 0.641634956 -0.236576702 0.650063245 -0.234502276 0.657768114 -0.231075726 0.664746693 -0.226291689 0.670997930 -0.220148196 0.676522589 -0.212646675 0.681323250 -0.203791950 0.685404302 -0.193592226 0.688771935 -0.182059068 0.691434120 -0.169207378 0.693400592 -0.155055350 0.694682825 -0.139624430 0.695294004 -0.122939260 0.695248989 -0.105027618 0.694564282 -0.085920346 0.693257985 -0.065651275 0.691349750 -0.044257141 0.688860737 -0.021777489 0.685813555 0.001745418 0.682232212 0.026266715 0.678142046 0.051739036 0.673569671 0.078112642 0.668542903 0.105335539 0.663090697 0.133353611 0.657243069 0.162110756 0.651031025 0.191549022 0.644486479 0.221608756 0.637642180 0.252228751 0.630531623 0.283346401 0.623188971 0.314897854 0.615648965 0.346818176 0.607946840 0.379041509 0.600118237 0.411501239 0.592199113 0.444130161 0.584225649 0.476860646 0.576234165 0.509624813 0.568261024 0.542354694 0.560342544 0.574982411 0.552514907 0.607440336 0.544814065 0.639661270 0.537275658 0.671578605 0.529934915 0.703126489 0.522826573 0.734239998 0.515984790 0.764855291 0.509443055 0.794909773 0.503234108 0.824342249 0.497389857 0.853093082 -0.819458701 -0.233295663 -0.824481559 -0.206080074 -0.829049772 -0.179714247 -0.833135534 -0.154250157 -0.836712243 -0.129737524 -0.839754571 -0.106223688 -0.842238523 -0.083753496 -0.844141503 -0.062369183 -0.845442364 -0.042110274 -0.846121466 -0.023013476 -0.846160723 -0.005112596 -0.845543648 0.011561552 -0.844255393 0.026981217 -0.842282790 0.041121785 -0.839614380 0.053961840 -0.836240443 0.065483216 -0.832153024 0.075671041 -0.827345950 0.084513778 -0.821814847 0.092003253 -0.815557150 0.098134673 -0.808572112 0.102906640 -0.800860803 0.106321153 -0.792426108 0.108383604 -0.783272719 0.109102767 -0.773407127 0.108490770 -0.762837602 0.106563070 -0.751574172 0.103338413 -0.739628601 0.098838785 -0.727014358 0.093089361 -0.713746583 0.086118438 -0.699842049 0.077957367 -0.685319121 0.068640473 -0.670197710 0.058204971 -0.654499223 0.046690871 -0.638246508 0.034140880 -0.621463800 0.020600294 -0.604176657 0.006116883 -0.586411900 -0.009259225 -0.568197541 -0.025475669 -0.549562719 -0.042477990 -0.530537622 -0.060209764 -0.511153412 -0.078612744 -0.491442152 -0.097627005 -0.471436721 -0.117191093 -0.451170732 -0.137242183 -0.430678451 -0.157716229 -0.409994709 -0.178548129 -0.389154815 -0.199671889 -0.368194469 -0.221020782 -0.347149672 -0.242527520 -0.326056636 -0.264124421 -0.304951693 -0.285743575 -0.283871206 -0.307317021 -0.262851476 -0.328776907 -0.241928652 -0.350055669 -0.221138641 -0.371086194 -0.200517018 -0.391801989 -0.180098938 -0.412137347 -0.159919046 -0.432027516 -0.140011392 -0.451408851 -0.120409346 -0.470218984 -0.101145514 -0.488396970 -0.082251656 -0.505883449 -0.063758607 -0.522620785 -0.045696203 -0.538553216 -0.028093199 -0.553626994 -0.010977206 -0.567790513 0.005625384 -0.580994447 0.021689463 -0.593191863 0.037191268 -0.604338350 0.052108442 -0.614392118 0.066420088 -0.623314111 0.080106824 -0.631068103 0.093150830 -0.637620784 0.105535891 -0.642941851 0.117247440 -0.647004075 0.128272593 -0.649783376 0.138600183 -0.651258880 0.148220784 -0.651412972 0.157126741 -0.650231341 0.165312180 -0.647703011 0.172773032 -0.643820377 0.179507038 -0.638579214 0.185513756 -0.631978696 0.190794560 -0.624021395 0.195352642 -0.614713271 0.199192996 -0.604063664 0.202322413 -0.592085265 0.204749461 -0.578794086 0.206484461 -0.564209421 0.207539467 -0.548353797 0.207928231 -0.531252919 0.207666170 -0.512935601 0.206770328 -0.493433701 0.205259333 -0.472782037 0.203153352 -0.451018299 0.200474036 -0.428182959 0.197244473 -0.404319166 0.193489123 -0.379472640 0.189233761 -0.353691556 0.184505414 -0.327026428 0.179332289 -0.299529977 0.173743705 -0.271257003 0.167770018 -0.242264247 0.161442551 -0.212610247 0.154793507 -0.182355198 0.147855894 -0.151560792 0.140663442 -0.120290074 0.133250517 -0.088607277 0.125652037 -0.056577663 0.117903384 -0.024267364 0.110040313 0.008256789 0.102098868 0.040927429 0.094115286 0.073676824 0.086125913 0.106437045 0.078167107 0.139140136 0.070275148 0.171718282 0.062486153 0.204103982 0.054835978 0.236230217 0.047360135 0.268030614 0.040093698 0.299439616 0.033071218 0.330392644 0.026326637 0.360826258 0.019893202 0.390678318 0.013803383 0.419888136 0.008088789 0.448396630 0.002780094 0.476146471 -0.002093045 0.503082225 -0.006502057 0.529150494 -0.010419535 0.554300048 -0.013819296 0.578481953 -0.016676455 0.601649696 -0.018967480 0.623759294 -0.020670257 0.644769413 -0.021764141 0.664641466 -0.022230007 0.683339710 -0.022050302 0.700831335 -0.021209088 0.717086551 -0.019692076 0.732078652 -0.017486670 0.745784096 -0.014581993 0.758182551 -0.010968916 0.769256956 -0.006640082 0.778993558 -0.001589919 0.787381946 0.004185337 0.794415082 0.010687641 0.800089313 0.017917129 0.804404384 0.025872120 0.807363437 0.034549121 0.808973002 0.043942832 0.809242984 0.054046164 0.808186635 0.064850251 0.805820522 0.076344479 0.802164487 0.088516507 0.797241594 0.101352301 0.791078076 0.114836166 0.783703265 0.128950789 0.775149522 0.143677281 0.765452153 0.158995220 0.754649324 0.174882711 0.742781964 0.191316431 0.729893661 0.208271694 0.716030557 0.225722510 0.701241230 0.243641649 0.685576572 0.262000712 0.669089664 0.280770200 0.651835642 0.299919589 0.633871558 0.319417404 0.615256242 0.339231299 0.596050148 0.359328140 0.576315208 0.379674083 0.556114678 0.400234664 0.535512975 0.420974881 0.514575519 0.441859283 0.493368570 0.462852060 0.471959062 0.483917129 0.450414435 0.505018227 0.428802466 0.526119002 0.407191100 0.547183103 0.385648282 0.568174268 0.364241786 0.589056420 0.343039042 0.609793755 0.322106974 0.630350827 0.301511829 0.650692644 0.281319010 0.670784752 0.261592917 0.690593320 0.242396780 0.710085225 0.223792509 0.729228138 0.205840530 0.747990599 0.188599642 0.766342102 0.172126865 0.784253167 0.156477299 0.801695413 0.141703987 0.818641635 0.127857782 0.835065864 0.114987219 0.850943437 0.103138396 0.866251058 0.092354854 0.880966854 0.082677475 0.895070433 0.074144374 0.908542933 0.066790806 0.921367068 0.060649078 -0.377872826 -1.058651531 -0.366390755 -1.062284845 -0.355599028 -1.064627856 -0.345508229 -1.065660780 -0.336127193 -1.065367108 -0.327462976 -1.063733648 -0.319520846 -1.060750555 -0.312304266 -1.056411358 -0.305814884 -1.050712976 -0.300052530 -1.043655725 -0.295015219 -1.035243317 -0.290699152 -1.025482851 -0.287098728 -1.014384797 -0.284206557 -1.001962967 -0.282013479 -0.988234481 -0.280508587 -0.973219728 -0.279679252 -0.956942308 -0.279511159 -0.939428980 -0.279988339 -0.920709591 -0.281093209 -0.900817002 -0.282806620 -0.879787007 -0.285107899 -0.857658245 -0.287974905 -0.834472096 -0.291384084 -0.810272589 -0.295310525 -0.785106282 -0.299728025 -0.759022150 -0.304609152 -0.732071463 -0.309925319 -0.704307658 -0.315646849 -0.675786200 -0.321743050 -0.646564454 -0.328182297 -0.616701530 -0.334932107 -0.586258142 -0.341959218 -0.555296458 -0.349229678 -0.523879937 -0.356708926 -0.492073178 -0.364361877 -0.459941753 -0.372153015 -0.427552048 -0.380046477 -0.394971092 -0.388006143 -0.362266395 -0.395995731 -0.329505773 -0.403978881 -0.296757184 -0.411919249 -0.264088556 -0.419780601 -0.231567615 -0.427526898 -0.199261721 -0.435122390 -0.167237693 -0.442531701 -0.135561649 -0.449719925 -0.104298835 -0.456652704 -0.073513464 -0.463296322 -0.043268557 -0.469617783 -0.013625783 -0.475584899 0.015354694 -0.481166366 0.043614364 -0.486331843 0.071096520 -0.491052031 0.097746398 -0.495298743 0.123511315 -0.499044974 0.148340798 -0.502264973 0.172186714 -0.504934301 0.195003388 -0.507029899 0.216747717 -0.508530138 0.237379278 -0.509414880 0.256860431 -0.509665524 0.275156409 -0.509265055 0.292235411 -0.508198085 0.308068673 -0.506450892 0.322630548 -0.504011453 0.335898567 -0.500869477 0.347853493 -0.497016427 0.358479372 -0.492445547 0.367763572 -0.487151870 0.375696815 -0.481132240 0.382273198 -0.474385314 0.387490212 -0.466911565 0.391348743 -0.458713287 0.393853075 -0.449794580 0.395010874 -0.440161348 0.394833175 -0.429821280 0.393334347 -0.418783831 0.390532066 -0.407060201 0.386447261 -0.394663303 0.381104071 -0.381607735 0.374529777 -0.367909738 0.366754739 -0.353587162 0.357812317 -0.338659416 0.347738790 -0.323147424 0.336573263 -0.307073568 0.324357572 -0.290461635 0.311136177 -0.273336758 0.296956051 -0.255725350 0.281866565 -0.237655041 0.265919360 -0.219154610 0.249168225 -0.200253908 0.231668956 -0.180983788 0.213479217 -0.161376027 0.194658402 -0.141463244 0.175267480 -0.121278822 0.155368845 -0.100856822 0.135026160 -0.080231900 0.114304199 -0.059439219 0.093268683 -0.038514359 0.071986117 -0.017493234 0.050523623 0.003588005 0.028948773 0.024693053 0.007329420 0.045785549 -0.014266471 0.066829161 -0.035770994 0.087787681 -0.057116474 0.108625112 -0.078235629 0.129305760 -0.099061747 0.149794323 -0.119528845 0.170055981 -0.139571839 0.190056478 -0.159126705 0.209762213 -0.178130639 0.229140320 -0.196522214 0.248158755 -0.214241534 0.266786368 -0.231230382 0.284992991 -0.247432369 0.302749506 -0.262793069 0.320027918 -0.277260163 0.336801432 -0.290783563 0.353044509 -0.303315541 0.368732941 -0.314810846 0.383843903 -0.325226819 0.398356016 -0.334523498 0.412249394 -0.342663719 0.425505702 -0.349613209 0.438108195 -0.355340671 0.450041761 -0.359817861 0.461292962 -0.363019663 0.471850066 -0.364924146 0.481703074 -0.365512622 0.490843748 -0.364769694 0.499265629 -0.362683293 0.506964057 -0.359244704 0.513936179 -0.354448597 0.520180957 -0.348293031 0.525699172 -0.340779466 0.530493419 -0.331912754 0.534568105 -0.321701130 0.537929435 -0.310156192 0.540585395 -0.297292867 0.542545737 -0.283129382 0.543821950 -0.267687209 0.544427232 -0.250991020 0.544376461 -0.233068618 0.543686152 -0.213950874 0.542374419 -0.193671645 0.540460931 -0.172267691 0.537966859 -0.149778584 0.534914826 -0.126246608 0.531328849 -0.101716653 0.527234282 -0.076236105 0.522657746 -0.049854724 0.517627071 -0.022624523 0.512171220 0.005400364 0.506320217 0.034163815 0.500105078 0.063607866 0.493557725 0.093672847 0.486710913 0.124297540 0.479598143 0.155419325 0.472253584 0.186974342 0.464711983 0.218897646 0.457008577 0.251123373 0.449179012 0.283584902 0.441259245 0.316215024 0.433285461 0.348946108 0.425293980 0.381710269 0.417321165 0.414439542 0.409403333 0.447066047 0.401576664 0.479522163 0.393877109 0.511740693 0.386340302 0.543655034 0.379001471 0.575199345 0.371895348 0.606308709 0.365056083 0.636919294 0.358517161 0.666968518 0.352311313 0.696395201 0.346470442 0.725139718 0.341025534 0.753144149 0.336006589 0.780352426 0.331442540 0.806710470 0.327361184 0.832166325 0.323789111 0.856670292 0.320751639 0.880175052 0.318272750 0.902635782 0.316375027 0.924010269 0.315079604 0.944259015 0.314406107 0.963345335 0.314372609 0.981235451 0.314995583 0.997898575 0.316289860 1.013306983 0.318268595 1.027436090 0.320943231 1.040264509 0.324323473 1.051774100 0.328417259 1.061950025 0.333230747 1.070780774 0.338768295 1.078258204 0.345032451 1.084377551 0.352023946 1.089137447 0.359741695 1.092539923 0.368182797 1.094590400 -0.934057457 -0.019102318 -0.924185574 -0.019726074 -0.913609839 -0.021665380 -0.902340296 -0.024901462 -0.890388725 -0.029412306 -0.877768609 -0.035172708 -0.864495102 -0.042154344 -0.850584992 -0.050325836 -0.836056659 -0.059652833 -0.820930027 -0.070098094 -0.805226514 -0.081621586 -0.788968983 -0.094180578 -0.772181681 -0.107729753 -0.754890176 -0.122221316 -0.737121301 -0.137605121 -0.718903078 -0.153828787 -0.700264655 -0.170837838 -0.681236230 -0.188575833 -0.661848973 -0.206984508 -0.642134955 -0.226003925 -0.622127060 -0.245572617 -0.601858910 -0.265627747 -0.581364774 -0.286105259 -0.560679489 -0.306940043 -0.539838368 -0.328066097 -0.518877113 -0.349416689 -0.497831728 -0.370924526 -0.476738426 -0.392521923 -0.455633540 -0.414140971 -0.434553433 -0.435713706 -0.413534405 -0.457172281 -0.392612603 -0.478449133 -0.371823931 -0.499477154 -0.351203963 -0.520189858 -0.330787846 -0.540521546 -0.310610223 -0.560407473 -0.290705138 -0.579784008 -0.271105953 -0.598588792 -0.251845268 -0.616760896 -0.232954836 -0.634240972 -0.214465482 -0.650971401 -0.196407033 -0.666896440 -0.178808235 -0.681962357 -0.161696688 -0.696117568 -0.145098772 -0.709312765 -0.129039584 -0.721501039 -0.113542875 -0.732638000 -0.098630990 -0.742681884 -0.084324811 -0.751593659 -0.070643707 -0.759337123 -0.057605485 -0.765878995 -0.045226344 -0.771188996 -0.033520837 -0.775239927 -0.022501833 -0.778007736 -0.012180483 -0.779471576 -0.002566198 -0.779613863 0.006333382 -0.778420314 0.014512401 -0.775879985 0.021966805 -0.771985298 0.028694351 -0.766732061 0.034694613 -0.760119477 0.039968982 -0.752150146 0.044520664 -0.742830062 0.048354671 -0.732168592 0.051477810 -0.720178458 0.053898663 -0.706875701 0.055627569 -0.692279644 0.056676594 -0.676412843 0.057059508 -0.659301029 0.056791740 -0.640973046 0.055890350 -0.621460777 0.054373980 -0.600799066 0.052262809 -0.579025628 0.049578503 -0.556180960 0.046344160 -0.532308234 0.042584254 -0.507453191 0.038324571 -0.481664031 0.033592148 -0.454991284 0.028415202 -0.427487692 0.022823062 -0.399208073 0.016846094 -0.370209183 0.010515628 -0.340549578 0.003863874 -0.310289465 -0.003076152 -0.279490550 -0.010270714 -0.248215887 -0.017685441 -0.216529721 -0.025285411 -0.184497322 -0.033035239 -0.152184829 -0.040899165 -0.119659078 -0.048841144 -0.086987439 -0.056824936 -0.054237649 -0.064814198 -0.021477636 -0.072772571 0.011224643 -0.080663773 0.043801376 -0.088451693 0.076185066 -0.096100475 0.108308698 -0.103574612 0.140105906 -0.110839034 0.171511141 -0.117859194 0.202459833 -0.124601157 0.232888554 -0.131031681 0.262735175 -0.137118306 0.291939022 -0.142829428 0.320441027 -0.148134384 0.348183878 -0.153003524 0.375112159 -0.157408290 0.401172491 -0.161321283 0.426313662 -0.164716333 0.450486762 -0.167568565 0.473645296 -0.169854461 0.495745307 -0.171551919 0.516745484 -0.172640306 0.536607265 -0.173100513 0.555294932 -0.172915002 0.572775703 -0.172067845 0.589019812 -0.170544772 0.604000586 -0.168333201 0.617694506 -0.165422270 0.630081272 -0.161802866 0.641143850 -0.157467646 0.650868518 -0.152411058 0.659244896 -0.146629350 0.666265974 -0.140120586 0.671928130 -0.132884644 0.676231138 -0.124923222 0.679178172 -0.116239830 0.680775791 -0.106839782 0.681033930 -0.096730185 0.679965870 -0.085919919 0.677588209 -0.074419614 0.673920815 -0.062241627 0.668986784 -0.049400006 0.662812374 -0.035910460 0.655426945 -0.021790317 0.646862885 -0.007058480 0.637155526 0.008264617 0.626343058 0.024157063 0.614466434 0.040595526 0.601569267 0.057555307 0.587697720 0.075010403 0.572900391 0.092933576 0.557228193 0.111296416 0.540734227 0.130069414 0.523473644 0.149222038 0.505503515 0.168722803 0.486882683 0.188539359 0.467671617 0.208638562 0.447932263 0.228986564 0.427727884 0.249548895 0.407122909 0.270290549 0.386182767 0.291176072 0.364973724 0.312169650 0.343562719 0.333235198 0.322017195 0.354336454 0.300404932 0.375437063 0.278793876 0.396500675 0.257251971 0.417491031 0.235846988 0.438372054 0.214646354 0.459107943 0.193716989 0.479663256 0.173125130 0.500003007 0.152936175 0.520092744 0.133214512 0.539898644 0.114023362 0.559387591 0.095424620 0.578527262 0.077478701 0.597286206 0.060244386 0.615633925 0.043778681 0.633540949 0.028136667 0.650978909 0.013371369 0.667920606 -0.000466381 0.684340087 -0.013328068 0.700212698 -0.025167618 0.715515157 -0.035941511 0.730225603 -0.045608891 0.744323658 -0.054131667 0.757790473 -0.061474610 0.770608777 -0.067605439 0.782762920 -0.072494903 0.794238912 -0.076116853 0.805024457 -0.078448311 0.815108988 -0.079469520 0.824483687 -0.079164003 0.833141511 -0.077518594 0.841077209 -0.074523480 0.848287335 -0.070172220 0.854770257 -0.064461763 0.860526160 -0.057392454 0.865557046 -0.048968037 0.869866729 -0.039195640 0.873460828 -0.028085763 0.876346746 -0.015652248 0.878533662 -0.001912244 0.880032496 0.013113833 0.880855892 0.029402352 0.881018182 0.046926528 0.880535347 0.065656486 0.879424985 0.085559338 0.877706260 0.106599266 0.875399857 0.128737606 0.872527930 0.151932952 -0.442285955 -0.938258745 -0.446216874 -0.913084067 -0.450638614 -0.886992010 -0.455523733 -0.860033864 -0.460843633 -0.832263082 -0.466568626 -0.803735150 -0.472668015 -0.774507446 -0.479110165 -0.744639096 -0.485862584 -0.714190830 -0.492892008 -0.683224825 -0.500164475 -0.651804552 -0.507645420 -0.619994620 -0.515299756 -0.587860608 -0.523091961 -0.555468908 -0.530986170 -0.522886556 -0.538946262 -0.490181063 -0.546935953 -0.457420249 -0.554918882 -0.424672071 -0.562858708 -0.392004457 -0.570719197 -0.359485130 -0.578464311 -0.327181446 -0.586058304 -0.295160220 -0.593465805 -0.263487560 -0.600651910 -0.232228705 -0.607582268 -0.201447859 -0.614223169 -0.171208030 -0.620541624 -0.141570876 -0.626505451 -0.112596546 -0.632083355 -0.084343535 -0.637245005 -0.056868533 -0.641961110 -0.030226286 -0.646203493 -0.004469459 -0.649945162 0.020351497 -0.653160376 0.044188469 -0.655824708 0.066995805 -0.657915111 0.088730425 -0.659409970 0.109351930 -0.660289159 0.128822705 -0.660534093 0.147108011 -0.660127770 0.164176070 -0.659054817 0.179998149 -0.657301526 0.194548627 -0.654855890 0.207805063 -0.651707633 0.219748250 -0.647848235 0.230362264 -0.643270954 0.239634501 -0.637970841 0.247555714 -0.631944755 0.254120030 -0.625191368 0.259324969 -0.617711172 0.263171449 -0.609506474 0.265663782 -0.600581393 0.266809667 -0.590941846 0.266620166 -0.580595540 0.265109679 -0.569551946 0.262295910 -0.557822277 0.258199818 -0.545419462 0.252845569 -0.532358114 0.246260472 -0.518654489 0.238474914 -0.504326450 0.229522283 -0.489393421 0.219438881 -0.473876339 0.208263839 -0.457797597 0.196039016 -0.441180995 0.182808896 -0.424051679 0.168620472 -0.406436071 0.153523137 -0.388361814 0.137568553 -0.369857695 0.120810525 -0.350953575 0.103304866 -0.331680315 0.085109259 -0.312069700 0.066283110 -0.292154356 0.046887402 -0.271967674 0.026984541 -0.251543718 0.006638202 -0.230917151 -0.014086835 -0.210123139 -0.035124839 -0.189197265 -0.056409300 -0.168175447 -0.077873090 -0.147093837 -0.099448634 -0.125988740 -0.121068077 -0.104896518 -0.142663455 -0.083853503 -0.164166864 -0.062895900 -0.185510629 -0.042059706 -0.206627474 -0.021380609 -0.227450692 -0.000893908 -0.247914308 0.019365580 -0.267953247 0.039363606 -0.287503495 0.059066575 -0.306502258 0.078441627 -0.324888124 0.097456726 -0.342601210 0.116080732 -0.359583315 0.134283484 -0.375778066 0.152035874 -0.391131057 0.169309918 -0.405589986 0.186078831 -0.419104787 0.202317087 -0.431627754 0.218000488 -0.443113656 0.233106223 -0.453519860 0.247612926 -0.462806427 0.261500725 -0.470936219 0.274751297 -0.477874989 0.287347912 -0.483591466 0.299275475 -0.488057435 0.310520561 -0.491247806 0.321071452 -0.493140678 0.330918167 -0.493717392 0.340052483 -0.492962581 0.348467957 -0.490864202 0.356159944 -0.487413576 0.363125608 -0.482605398 0.369363926 -0.476437759 0.374875697 -0.468912150 0.379663531 -0.460033452 0.383731852 -0.449809930 0.387086879 -0.438253212 0.389736616 -0.425378255 0.391690828 -0.411203313 0.392961021 -0.395749889 0.393560409 -0.379042682 0.393503883 -0.361109524 0.392807972 -0.341981311 0.391490806 -0.321691926 0.389572066 -0.300278156 0.387072937 -0.277779597 0.384016054 -0.254238556 0.380425447 -0.229699946 0.376326479 -0.204211174 0.371745786 -0.177822022 0.366711206 -0.150584522 0.361251711 -0.122552826 0.355397337 -0.093783072 0.349179105 -0.064333242 0.342628947 -0.034263017 0.335779624 -0.003633632 0.328664645 0.027492284 0.321318182 0.059050859 0.313774988 0.090977140 0.306070304 0.123205255 0.298239779 0.155668579 0.290319373 0.188299895 0.282345272 0.221031572 0.274353796 0.253795722 0.266381310 0.286524381 0.258464129 0.319149670 0.250638431 0.351603971 0.242940165 0.383820091 0.235404962 0.415731435 0.228068046 0.447272167 0.220964143 0.478377379 0.214127400 0.508983253 0.207591293 0.539027215 0.201388548 0.568448099 0.195551058 0.597186295 0.190109803 0.625183899 0.185094772 0.652384860 0.180534890 0.678735116 0.176457942 0.704182732 0.172890508 0.728678029 0.169857894 0.752173710 0.167384068 0.774624975 0.165491604 0.795989633 0.164201620 0.816228212 0.163533731 0.835304052 0.163505993 0.853183402 0.164134866 0.869835499 0.165435167 0.885232648 0.167420035 0.899350293 0.170100898 0.912167073 0.173487444 0.923664880 0.177587598 0.933828903 0.182407501 0.942647663 0.187951493 0.950113047 0.194222109 0.956220321 0.201220062 0.960968147 0.208944251 0.964358586 0.217391759 0.966397090 0.226557861 0.967092492 0.236436034 0.966456979 0.247017978 0.964506068 0.258293633 0.961258562 0.270251204 0.956736505 0.282877192 0.950965127 0.296156430 0.943972781 0.310072113 0.935790870 0.324605850 0.926453773 0.339737702 0.915998755 0.355446238 0.904465874 0.371708583 0.891897885 0.388500478 0.878340127 0.405796343 0.863840414 0.423569334 0.848448917 0.441791419 0.832218032 0.460433440 0.815202256 0.479465191 0.797458045 0.498855492 0.779043680 0.518572266 0.760019112 0.538582621 0.740445821 0.558852930 0.720386656 0.579348918 0.699905683 itpp-4.3.1/gtests/fastmath_test.cpp000066400000000000000000000042101216575753400173720ustar00rootroot00000000000000/*! * \file * \brief Fast math test program * \author * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static void assert_mat_p(const mat &ref, const mat &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), ref.cols()) << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol) << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) TEST(FastMath, All) { // Test of fastmath mat m0("1 2 3;4 5 6;7 8 9"), mv0("2;3;1"); vec v0("2 3 1"); // sub_v_vT_m: the slow and fast way mat act = m0 - mv0*transpose(mv0)*m0; mat ref = "-41 -52 -63; -59 -76 -93; -14 -19 -24"; assert_mat(ref, act); sub_v_vT_m(m0, v0); ref = "-41 -52 -63; -59 -76 -93; -14 -19 -24"; assert_mat(ref, m0); m0 = "1 2 3;4 5 6;7 8 9"; // sub_m_v_vT: the slow and fast way act = m0 - m0*mv0*transpose(mv0); ref = "-21 -31 -8; -54 -82 -23; -87 -133 -38"; assert_mat(ref, act); sub_m_v_vT(m0, v0); ref = "-21 -31 -8; -54 -82 -23; -87 -133 -38"; assert_mat(ref, m0); } itpp-4.3.1/gtests/filter_design_test.cpp000066400000000000000000000237711216575753400204160ustar00rootroot00000000000000/*! * \file * \brief Filter design test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (FilterDesign, All) { const double eps = 1e-5; int i; RNG_reset(0); { //Stabilisation of real filters vec p = "0.7 3.0 -0.4"; vec p2 = polystab(p); vec p2_expect = "0.7 0.067948 -0.0205197"; for (i = 0; i < p2.length(); ++i) { ASSERT_NEAR(p2_expect[i], p2[i], eps); } p = randn(7); p2 = polystab(p); p2_expect = "-0.538679 0.177994 0.0682446 0.00533096 -0.423768 0.283801 0.140756"; for (i = 0; i < p2.length(); ++i) { ASSERT_NEAR(p2_expect[i], p2[i], eps); } p = poly(vec("1.1 0.7 0.2")); p2 = polystab(p); p2_expect = "1 -1.80909 0.958182 -0.127273"; for (i = 0; i < p2.length(); ++i) { ASSERT_NEAR(p2_expect[i], p2[i], eps); } } { // Stabilisation of complex filters cvec p = "0.7 3.0 -0.4"; cvec p2 = polystab(p); cvec p2_expect = "0.7+0i 0.067948+0i -0.0205197+0i"; for (i = 0; i < p2.length(); ++i) { ASSERT_NEAR(p2_expect[i].real(), p2[i].real(), eps); ASSERT_NEAR(p2_expect[i].imag(), p2[i].imag(), eps); } p = randn_c(7); p2 = polystab(p); p2_expect = "-0.477568-0.495879i -0.0943114+0.0400239i -0.302978-0.102541i -0.0391834+0.072045i " "-0.0104879+0.17661i -0.00760533-0.0478387i 0.0397027+0.0173413i"; for (i = 0; i < p2.length(); ++i) { ASSERT_NEAR(p2_expect[i].real(), p2[i].real(), eps); ASSERT_NEAR(p2_expect[i].imag(), p2[i].imag(), eps); } p = poly(cvec("1.1 0.7 0.2")); p2 = polystab(p); p2_expect = "1+0i -1.80909+0i 0.958182+0i -0.127273+0i"; for (i = 0; i < p2.length(); ++i) { ASSERT_NEAR(p2_expect[i].real(), p2[i].real(), eps); ASSERT_NEAR(p2_expect[i].imag(), p2[i].imag(), eps); } cvec a = randn_c(4); cvec b = randn_c(6); cvec h = freqz(b, a, 32); cvec h_expect = "-0.624626-1.17758i -0.723594-0.875573i -0.785197-0.579523i -0.809466-0.307105i " "-0.795505-0.0763535i -0.741218+0.0967196i -0.644514+0.200455i -0.505709+0.228512i -0.329798+0.178836i " "-0.127347+0.0513423i 0.0860505-0.154368i 0.290704-0.440555i 0.462875-0.812365i 0.572569-1.279i " "0.576688-1.85548i 0.401261-2.56385i -0.105448-3.42346i -1.29433-4.36244i -3.84967-4.66146i " "-6.82565-1.62413i -4.85021+2.58433i -1.83063+2.79958i -0.451672+1.85213i 0.050022+0.993934i " "0.16639+0.356617i 0.101157-0.0921887i -0.0539619-0.390646i -0.250759-0.566939i -0.45974-0.641763i " "-0.660596-0.631587i -0.838317-0.550787i -0.981551-0.412832i"; for (i = 0; i < h.length(); ++i) { ASSERT_NEAR(h_expect[i].real(), h[i].real(), eps); ASSERT_NEAR(h_expect[i].imag(), h[i].imag(), eps); } } { // Yulewalk filter design vec f = "0 0.5 0.6 1"; vec m = "1 1 0 0"; vec a, b, R; filter_design_autocorrelation(256, f, m, R); vec R_expect = "0.532559 0.315821 -0.031951 -0.098821 0.030194 0.052117 -0.027468 -0.030472 0.024049 " "0.017893 -0.020260 -0.010026 0.016429 0.005118 -0.012847 -0.002225 0.009732 0.000713 -0.007211 -0.000100 " "0.005318 0.000009 -0.004008 -0.000158 0.003178 0.000354 -0.002694 -0.000487 0.002425 0.000517 -0.002257 " "-0.000453 0.002112 0.000332 -0.001947 -0.000198 0.001752 0.000087 -0.001541 -0.000020 0.001334 0.000000 " "-0.001154 -0.000016 0.001015 0.000050 -0.000918 -0.000083 0.000856 0.000102 -0.000817 -0.000102 0.000786 " "0.000084 -0.000751 -0.000057 0.000707 0.000029 -0.000654 -0.000009 0.000596 0.000000 -0.000542 -0.000003 " "0.000495 0.000013 -0.000460 -0.000026 0.000436 0.000035 -0.000420 -0.000037 0.000409 0.000033 -0.000396 " "-0.000024 0.000381 0.000014 -0.000361 -0.000005 0.000338 0.000001 -0.000315 -0.000001 0.000294 0.000005 " "-0.000277 -0.000010 0.000265 0.000015 -0.000257 -0.000017 0.000251 0.000017 -0.000246 -0.000013 0.000239 " "0.000008 -0.000230 -0.000003 0.000219 0.000001 -0.000207 -0.000000 0.000196 0.000002 -0.000186 -0.000005 " "0.000179 0.000008 -0.000174 -0.000009 0.000171 0.000009 -0.000168 -0.000008 0.000165 0.000005 -0.000160 " "-0.000003 0.000154 0.000001 -0.000147 -0.000000 0.000140 0.000001 -0.000135 -0.000002 0.000130 0.000004 " "-0.000127 -0.000005 0.000125 0.000006 -0.000123 -0.000005 0.000121 0.000004 -0.000118 -0.000002 0.000115 " "0.000001 -0.000111 -0.000000 0.000106 0.000000 -0.000103 -0.000001 0.000099 0.000002 -0.000097 -0.000003 " "0.000096 0.000004 -0.000095 -0.000003 0.000093 0.000003 -0.000092 -0.000002 0.000089 0.000001 -0.000087 " "-0.000000 0.000084 0.000000 -0.000081 -0.000001 0.000079 0.000001 -0.000077 -0.000002 0.000076 0.000003 " "-0.000075 -0.000002 0.000075 0.000002 -0.000074 -0.000001 0.000072 0.000001 -0.000070 -0.000000 0.000068 " "0.000000 -0.000066 -0.000000 0.000065 0.000001 -0.000063 -0.000001 0.000063 0.000002 -0.000062 -0.000002 " "0.000061 0.000002 -0.000061 -0.000001 0.000060 0.000000 -0.000059 -0.000000 0.000057 0.000000 -0.000056 " "-0.000000 0.000054 0.000001 -0.000053 -0.000001 0.000053 0.000001 -0.000052 -0.000001 0.000052 0.000001 " "-0.000051 -0.000001 0.000051 0.000000 -0.000050 -0.000000 0.000049 0.000000 -0.000048 -0.000000 0.000047 " "0.000000 -0.000046 -0.000001 0.000045 0.000001 -0.000045 -0.000001 0.000045 0.000001 -0.000044 -0.000001 " "0.000044 0.000000 -0.000043 -0.000000 0.000042 0.000000 -0.000042 -0.000000 0.000041 0.000000 -0.000040 " "-0.000000 0.000040 0.000001 -0.000039 -0.000001"; for (i = 0; i < R.length(); ++i) { ASSERT_NEAR(R_expect[i], R[i], eps); } arma_estimator(8, 8, R, b, a); vec a_expect = "1.000000 0.674659 1.903750 0.910429 1.202849 0.356944 0.264436 0.033088 0.009850"; vec b_expect = "0.098191 0.427406 0.944264 1.365558 1.419767 1.112417 0.654916 0.271520 0.062529"; for (i = 0; i < b.length(); ++i) { ASSERT_NEAR(b_expect[i], b[i], eps); ASSERT_NEAR(a_expect[i], a[i], eps); } vec n = "0:1:256"; double fd = 0.1; R = besselj(0, 2 * pi * fd * n); R_expect = "1.000000 0.903713 0.642512 0.290564 -0.054960 -0.304242 -0.401986 -0.342615 -0.168862 0.045176 0.220277 " "0.298483 0.260759 0.130387 -0.038298 -0.181211 -0.247891 -0.218682 -0.109979 0.033729 0.157507 0.216539 0.192023 " "0.096868 -0.030454 -0.141182 -0.194690 -0.173208 -0.087544 0.027970 0.129064 0.178348 0.159020 0.080477 -0.026004 " "-0.119609 -0.165531 -0.147829 -0.074884 0.024400 0.111968 0.155131 0.138710 0.070314 -0.023059 -0.105625 -0.146473 " "-0.131094 -0.066490 0.021917 0.100251 0.139119 0.124608 0.063229 -0.020929 -0.095621 -0.132772 -0.118998 -0.060405 " "0.020063 0.091579 0.127221 0.114084 0.057928 -0.019296 -0.088009 -0.122313 -0.109732 -0.055733 0.018611 0.084827 " "0.117932 0.105843 0.053770 -0.017994 -0.081967 -0.113991 -0.102340 -0.052000 0.017434 0.079377 0.110420 0.099163 " "0.050395 -0.016923 -0.077019 -0.107165 -0.096265 -0.048929 0.016455 0.074859 0.104181 0.093607 0.047585 -0.016024 " "-0.072871 -0.101434 -0.091157 -0.046345 0.015625 0.071033 0.098893 0.088890 0.045197 -0.015254 -0.069328 -0.096534 " "-0.086785 -0.044131 0.014908 0.067740 0.094336 0.084822 0.043137 -0.014585 -0.066256 -0.092282 -0.082987 -0.042207 " "0.014282 0.064866 0.090356 0.081266 0.041335 -0.013997 -0.063560 -0.088546 -0.079647 -0.040514 0.013729 0.062330 " "0.086841 0.078122 0.039741 -0.013475 -0.061168 -0.085231 -0.076681 -0.039010 0.013235 0.060069 0.083707 0.075317 " "0.038319 -0.013007 -0.059027 -0.082261 -0.074023 -0.037662 0.012791 0.058038 0.080889 0.072794 0.037039 -0.012585 " "-0.057096 -0.079582 -0.071624 -0.036445 0.012389 0.056199 0.078337 0.070509 0.035879 -0.012202 -0.055343 -0.077149 " "-0.069444 -0.035338 0.012023 0.054525 0.076013 0.068426 0.034822 -0.011851 -0.053743 -0.074926 -0.067451 -0.034327 " "0.011687 0.052993 0.073884 0.066517 0.033853 -0.011529 -0.052273 -0.072885 -0.065621 -0.033398 0.011378 0.051582 " "0.071925 0.064760 0.032961 -0.011232 -0.050918 -0.071002 -0.063932 -0.032540 0.011092 0.050279 0.070114 0.063135 " "0.032135 -0.010957 -0.049663 -0.069258 -0.062367 -0.031745 0.010827 0.049070 0.068432 0.061627 0.031369 -0.010701 " "-0.048497 -0.067636 -0.060912 -0.031006 0.010579 0.047943 0.066867 0.060221 0.030655 -0.010462 -0.047409 -0.066123 " "-0.059554 -0.030316 0.010348 0.046891 0.065404 0.058908 0.029988 -0.010238 -0.046391 -0.064708 -0.058283 -0.029670 " "0.010132 0.045906 0.064033 0.057677 0.029362 -0.010029 -0.045436 -0.063379 -0.057090 -0.029064 0.009929 0.044980 " "0.062745 0.056520 0.028774 -0.009831 -0.044537 -0.062129"; for (i = 0; i < R.length(); ++i) { ASSERT_NEAR(R_expect[i], R[i], eps); } arma_estimator(8, 8, R, b, a); a_expect = "1.000000 -5.639923 14.887872 -23.713094 24.788487 -17.355262 7.935089 -2.164767 0.269989"; b_expect = "0.117196 -0.457317 0.947020 -1.258532 1.157363 -0.723747 0.290453 -0.062104 0.004607"; for (i = 0; i < b.length(); ++i) { ASSERT_NEAR(b_expect[i], b[i], eps); ASSERT_NEAR(a_expect[i], a[i], eps); } } } itpp-4.3.1/gtests/filter_test.cpp000066400000000000000000000500701216575753400170550ustar00rootroot00000000000000/*! * \file * \brief Filter classes test program * \author Hakan Eriksson, Thomas Eriksson, Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (FilterTest, All) { static const double eps = 1e-4; int i; RNG_reset(0); // Test signals vec x = randn(20), x2 = randn(20); cvec cx = randn_c(20), cx2 = randn_c(20); // Filter coefficients vec b(10); b.ones(); b(0) += 0.1; cvec cb(10); cb.ones(); cb(0) += 0.1; cvec ca(2); ca(0) = 1.0; ca(1) = -1.0; vec a(2); a(0) = 1.0; a(1) = -1.0; vec y, y2; vec s1, s2; vec y_ref, y2_ref; vec s1_ref, s2_ref; cvec cy, cy2; cvec cs1, cs2; cvec cy_ref, cy2_ref; cvec cs1_ref, cs2_ref; // MA Filter MA_Filter H(b); MA_Filter, double, complex > CH(b); MA_Filter, complex, complex > C(cb); y = H(x); y_ref = "-0.592547 -1.94108 -0.682537 -0.925824 -1.31505 -2.24478 -0.737816 -1.60975 -2.31362 -1.35149 -1.47907 " "-4.25692 -5.03592 -5.93111 -5.19747 -5.74787 -6.48426 -6.27389 -5.5178 -5.3668"; s1 = H.get_state(); s1_ref = "-0.531968 0.875791 0.0146015 -0.387522 0.387353 -1.27628 0.249247 -0.940147 -0.112755 -3.7327"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } for (i = 0; i < s1.length(); ++i) { ASSERT_NEAR(s1_ref[i], s1[i], eps); } y2 = H(x2); y2_ref = "-4.50163 -1.47862 -0.920061 1.41155 0.817598 1.60014 1.96435 3.88003 4.36433 3.70982 4.04877 4.65587 " "4.90407 4.96362 3.4177 3.86524 2.53372 2.13073 0.89627 -1.23503"; s2 = H.get_state(); s2_ref = "0.679012 -1.75261 -0.509272 0.891211 -0.641614 -0.150657 -1.46646 1.28292 0.54896 0.0587334"; for (i = 0; i < y2.length(); ++i) { ASSERT_NEAR(y2_ref[i], y2[i], eps); } for (i = 0; i < s2.length(); ++i) { ASSERT_NEAR(s2_ref[i], s2[i], eps); } H.set_state(s1); y2 = H(x2); y2_ref = "-4.50163 -1.47862 -0.920061 1.41155 0.817598 1.60014 1.96435 3.88003 4.36433 3.70982 4.04877 4.65587 " "4.90407 4.96362 3.4177 3.86524 2.53372 2.13073 0.89627 -1.23503"; s2 = H.get_state(); s2_ref = "0.679012 -1.75261 -0.509272 0.891211 -0.641614 -0.150657 -1.46646 1.28292 0.54896 0.0587334"; for (i = 0; i < y2.length(); ++i) { ASSERT_NEAR(y2_ref[i], y2[i], eps); } for (i = 0; i < s2.length(); ++i) { ASSERT_NEAR(s2_ref[i], s2[i], eps); } cy = CH(cx); cy_ref = "-1.11701-0.115333i -0.884597+1.64759i -0.00639818+1.80179i 0.914903+3.31264i 1.71424+2.51272i " "0.676698+3.40542i 1.56528+3.18382i 1.84761+3.91019i 2.40857+1.97671i 3.26292+1.80654i 3.50956+1.99636i " "2.23868-0.661574i 3.27804-0.355509i 0.733909-1.68614i 0.491808-0.360612i 1.35977-1.79598i 0.390552-2.44626i " "0.579894-3.85374i 0.0423402-1.57992i -0.921652-1.93196i"; cs1 = CH.get_state(); cs1_ref = "-0.623863+0.0491432i -0.121881-0.559813i 0.0421585+0.453723i 0.446095-0.75948i -0.21549-0.76228i " "0.034294-0.555875i 0.393913+0.668983i -1.34092+0.103413i 1.58013+0.44975i -1.10391-0.963544i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } for (i = 0; i < cs1.length(); ++i) { ASSERT_NEAR(cs1_ref[i].real(), cs1[i].real(), eps); ASSERT_NEAR(cs1_ref[i].imag(), cs1[i].imag(), eps); } cy2 = CH(cx2); cs2 = CH.get_state(); cy2_ref = "-0.102301-1.48432i 1.13288+0.526827i -0.277328-1.46198i -0.44344-0.488853i -1.85361-1.42378i " "-2.43148-0.667385i -2.82985+0.0317305i -3.51517-0.266065i -3.17257-0.201244i -2.63849-0.197425i " "-1.57769-0.050627i -1.24298-1.703i -1.07173-1.34898i 1.16861-2.30151i 2.36235-4.17338i 2.2602-2.5629i " "2.23618-2.54142i 3.479-0.439856i 1.15184-0.162033i 1.71127+1.05949i"; cs2_ref = "1.1526+0.454975i 0.717425+0.745976i -1.74527+0.696227i 0.824019+1.04348i -0.633288+0.112685i " "-0.609585+1.44666i 0.209481-1.86573i 0.837287-0.168026i 0.355532-0.91947i 0.531331-0.56189i"; for (i = 0; i < cy2.length(); ++i) { ASSERT_NEAR(cy2_ref[i].real(), cy2[i].real(), eps); ASSERT_NEAR(cy2_ref[i].imag(), cy2[i].imag(), eps); } for (i = 0; i < cs2.length(); ++i) { ASSERT_NEAR(cs2_ref[i].real(), cs2[i].real(), eps); ASSERT_NEAR(cs2_ref[i].imag(), cs2[i].imag(), eps); } CH.set_state(cs1); cy2 = CH(cx2); cs2 = CH.get_state(); cy2_ref = "-0.102301-1.48432i 1.13288+0.526827i -0.277328-1.46198i -0.44344-0.488853i -1.85361-1.42378i " "-2.43148-0.667385i -2.82985+0.0317305i -3.51517-0.266065i -3.17257-0.201244i -2.63849-0.197425i " "-1.57769-0.050627i -1.24298-1.703i -1.07173-1.34898i 1.16861-2.30151i 2.36235-4.17338i 2.2602-2.5629i " "2.23618-2.54142i 3.479-0.439856i 1.15184-0.162033i 1.71127+1.05949i"; cs2_ref = "1.1526+0.454975i 0.717425+0.745976i -1.74527+0.696227i 0.824019+1.04348i -0.633288+0.112685i " "-0.609585+1.44666i 0.209481-1.86573i 0.837287-0.168026i 0.355532-0.91947i 0.531331-0.56189i"; for (i = 0; i < cy2.length(); ++i) { ASSERT_NEAR(cy2_ref[i].real(), cy2[i].real(), eps); ASSERT_NEAR(cy2_ref[i].imag(), cy2[i].imag(), eps); } for (i = 0; i < cs2.length(); ++i) { ASSERT_NEAR(cs2_ref[i].real(), cs2[i].real(), eps); ASSERT_NEAR(cs2_ref[i].imag(), cs2[i].imag(), eps); } cy = C(cx); cy_ref = "-1.11701-0.115333i -0.884597+1.64759i -0.00639818+1.80179i 0.914903+3.31264i 1.71424+2.51272i " "0.676698+3.40542i 1.56528+3.18382i 1.84761+3.91019i 2.40857+1.97671i 3.26292+1.80654i 3.50956+1.99636i " "2.23868-0.661574i 3.27804-0.355509i 0.733909-1.68614i 0.491808-0.360612i 1.35977-1.79598i 0.390552-2.44626i " "0.579894-3.85374i 0.0423402-1.57992i -0.921652-1.93196i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } y = filter(b, 1, x); y_ref = "-0.592547 -1.94108 -0.682537 -0.925824 -1.31505 -2.24478 -0.737816 -1.60975 -2.31362 -1.35149 " "-1.47907 -4.25692 -5.03592 -5.93111 -5.19747 -5.74787 -6.48426 -6.27389 -5.5178 -5.3668"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } cy = filter(b, 1, cx); cy_ref = "-1.11701-0.115333i -0.884597+1.64759i -0.00639818+1.80179i 0.914903+3.31264i 1.71424+2.51272i " "0.676698+3.40542i 1.56528+3.18382i 1.84761+3.91019i 2.40857+1.97671i 3.26292+1.80654i 3.50956+1.99636i " "2.23868-0.661574i 3.27804-0.355509i 0.733909-1.68614i 0.491808-0.360612i 1.35977-1.79598i 0.390552-2.44626i " "0.579894-3.85374i 0.0423402-1.57992i -0.921652-1.93196i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } cy = filter(cb, 1, cx); cy_ref = "-1.11701-0.115333i -0.884597+1.64759i -0.00639818+1.80179i 0.914903+3.31264i 1.71424+2.51272i " "0.676698+3.40542i 1.56528+3.18382i 1.84761+3.91019i 2.40857+1.97671i 3.26292+1.80654i 3.50956+1.99636i " "2.23868-0.661574i 3.27804-0.355509i 0.733909-1.68614i 0.491808-0.360612i 1.35977-1.79598i 0.390552-2.44626i " "0.579894-3.85374i 0.0423402-1.57992i -0.921652-1.93196i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } // AR Filter AR_Filter HAR(a); AR_Filter, double, complex > CHAR(a); AR_Filter, complex, complex > CAR(ca); y = HAR(x); y_ref = "-0.538679 -1.81359 -0.78536 -0.913054 -1.2785 -2.15694 -0.866827 -1.54221 -2.24349 " "-1.43258 -1.96455 -5.69725 -5.81 -6.75015 -6.5009 -7.77718 -7.38983 -7.77735 -7.76275 -6.88696"; s1 = HAR.get_state(); s1_ref = "-6.88696"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } for (i = 0; i < s1.length(); ++i) { ASSERT_NEAR(s1_ref[i], s1[i], eps); } y2 = HAR(x2); y2_ref = "-6.50443 -7.11482 -6.76504 -5.46828 -5.66376 -6.13037 -5.48956 -4.04207 -3.45694 " "-3.20257 -2.52356 -2.46483 -1.91587 -0.632949 -2.09941 -2.25006 -2.89168 -2.00047 -2.50974 -4.26235"; s2 = HAR.get_state(); s2_ref = "-4.26235"; for (i = 0; i < y2.length(); ++i) { ASSERT_NEAR(y2_ref[i], y2[i], eps); } for (i = 0; i < s2.length(); ++i) { ASSERT_NEAR(s2_ref[i], s2[i], eps); } HAR.set_state(s1); y2 = HAR(x2); y2_ref = "-6.50443 -7.11482 -6.76504 -5.46828 -5.66376 -6.13037 -5.48956 -4.04207 -3.45694 -3.20257 " "-2.52356 -2.46483 -1.91587 -0.632949 -2.09941 -2.25006 -2.89168 -2.00047 -2.50974 -4.26235"; s2 = HAR.get_state(); s2_ref = "-4.26235"; for (i = 0; i < y2.length(); ++i) { ASSERT_NEAR(y2_ref[i], y2[i], eps); } for (i = 0; i < s2.length(); ++i) { ASSERT_NEAR(s2_ref[i], s2[i], eps); } cy = CHAR(cx); cs1 = CHAR.get_state(); cy_ref = "-1.01547-0.104848i -0.896494+1.48828i -0.087316+1.77329i 0.823792+3.1727i 1.63329+2.57271i " "0.763661+3.32972i 1.49241+3.19708i 1.81532+3.84536i 2.35464+2.14659i 3.18034+1.83746i 2.55648+1.8866i " "1.45258+0.923057i 3.03271+1.37281i 1.69179+1.47622i 2.08571+2.1452i 2.12+1.58933i 1.90451+0.827048i " "2.3506+0.0675678i 2.39276+0.521291i 2.27088-0.0385215i"; cs1_ref = "2.27088-0.0385215i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } for (i = 0; i < cs1.length(); ++i) { ASSERT_NEAR(cs1_ref[i].real(), cs1[i].real(), eps); ASSERT_NEAR(cs1_ref[i].imag(), cs1[i].imag(), eps); } cy2 = CHAR(cx2); cs2 = CHAR.get_state(); cy2_ref = "2.43752+0.36221i 2.57201+1.351i 2.73871+0.041755i 1.38384+0.901402i 0.336797+0.737782i " "-0.252542+0.9052i -0.864179+0.862998i -1.13726-0.101997i -0.8123+0.28168i -0.408032-0.18889i " "0.744568+0.266086i 1.2759-0.295804i 1.63143-1.21527i 2.46872-1.3833i 2.6782-3.24903i 2.06861-1.80237i " "1.43533-1.68969i 2.25935-0.646202i 0.514072+0.0500244i 1.2315+0.796001i"; cs2_ref = "1.2315+0.796001i"; for (i = 0; i < cy2.length(); ++i) { ASSERT_NEAR(cy2_ref[i].real(), cy2[i].real(), eps); ASSERT_NEAR(cy2_ref[i].imag(), cy2[i].imag(), eps); } for (i = 0; i < cs2.length(); ++i) { ASSERT_NEAR(cs2_ref[i].real(), cs2[i].real(), eps); ASSERT_NEAR(cs2_ref[i].imag(), cs2[i].imag(), eps); } CHAR.set_state(cs1); cy2 = CHAR(cx2); cs2 = CHAR.get_state(); cy2_ref = "2.43752+0.36221i 2.57201+1.351i 2.73871+0.041755i 1.38384+0.901402i 0.336797+0.737782i " "-0.252542+0.9052i -0.864179+0.862998i -1.13726-0.101997i -0.8123+0.28168i -0.408032-0.18889i " "0.744568+0.266086i 1.2759-0.295804i 1.63143-1.21527i 2.46872-1.3833i 2.6782-3.24903i 2.06861-1.80237i " "1.43533-1.68969i 2.25935-0.646202i 0.514072+0.0500244i 1.2315+0.796001i"; cs2_ref = "1.2315+0.796001i"; for (i = 0; i < cy2.length(); ++i) { ASSERT_NEAR(cy2_ref[i].real(), cy2[i].real(), eps); ASSERT_NEAR(cy2_ref[i].imag(), cy2[i].imag(), eps); } for (i = 0; i < cs2.length(); ++i) { ASSERT_NEAR(cs2_ref[i].real(), cs2[i].real(), eps); ASSERT_NEAR(cs2_ref[i].imag(), cs2[i].imag(), eps); } cy = CAR(cx); cy_ref = "-1.01547-0.104848i -0.896494+1.48828i -0.087316+1.77329i 0.823792+3.1727i " "1.63329+2.57271i 0.763661+3.32972i 1.49241+3.19708i 1.81532+3.84536i 2.35464+2.14659i " "3.18034+1.83746i 2.55648+1.8866i 1.45258+0.923057i 3.03271+1.37281i 1.69179+1.47622i " "2.08571+2.1452i 2.12+1.58933i 1.90451+0.827048i 2.3506+0.0675678i 2.39276+0.521291i 2.27088-0.0385215i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } y = filter(1, a, x); y_ref = "-0.538679 -1.81359 -0.78536 -0.913054 -1.2785 -2.15694 -0.866827 -1.54221 -2.24349 -1.43258 " "-1.96455 -5.69725 -5.81 -6.75015 -6.5009 -7.77718 -7.38983 -7.77735 -7.76275 -6.88696"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } cy = filter(1, a, cx); cy_ref = "-1.01547-0.104848i -0.896494+1.48828i -0.087316+1.77329i 0.823792+3.1727i 1.63329+2.57271i " "0.763661+3.32972i 1.49241+3.19708i 1.81532+3.84536i 2.35464+2.14659i 3.18034+1.83746i 2.55648+1.8866i " "1.45258+0.923057i 3.03271+1.37281i 1.69179+1.47622i 2.08571+2.1452i 2.12+1.58933i 1.90451+0.827048i " "2.3506+0.0675678i 2.39276+0.521291i 2.27088-0.0385215i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } cy = filter(1, ca, cx); cy_ref = "-1.01547-0.104848i -0.896494+1.48828i -0.087316+1.77329i 0.823792+3.1727i 1.63329+2.57271i " "0.763661+3.32972i 1.49241+3.19708i 1.81532+3.84536i 2.35464+2.14659i 3.18034+1.83746i 2.55648+1.8866i " "1.45258+0.923057i 3.03271+1.37281i 1.69179+1.47622i 2.08571+2.1452i 2.12+1.58933i 1.90451+0.827048i " "2.3506+0.0675678i 2.39276+0.521291i 2.27088-0.0385215i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } // ARMA Filter ARMA_Filter HARMA(b, a); ARMA_Filter, double, complex > CHARMA(b, a); ARMA_Filter, complex, complex > CARMA(cb, ca); y = HARMA(x); s1 = HARMA.get_state(); y_ref = "-0.592547 -2.53363 -3.21617 -4.14199 -5.45704 -7.70182 -8.43964 -10.0494 -12.363 " "-13.7145 -15.1936 -19.4505 -24.4864 -30.4175 -35.615 -41.3629 -47.8471 -54.121 -59.6388 -65.0056"; s1_ref = "-6.88696 -7.76275 -7.77735 -7.38983 -7.77718 -6.5009 -6.75015 -5.81 -5.69725"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } for (i = 0; i < s1.length(); ++i) { ASSERT_NEAR(s1_ref[i], s1[i], eps); } y2 = HARMA(x2); s2 = HARMA.get_state(); y2_ref = "-69.5072 -70.9858 -71.9059 -70.4944 -69.6768 -68.0766 -66.1123 -62.2322 -57.8679 -54.1581 " "-50.1093 -45.4535 -40.5494 -35.5858 -32.1681 -28.3028 -25.7691 -23.6384 -22.7421 -23.9771"; s2_ref = "-4.26235 -2.50974 -2.00047 -2.89168 -2.25006 -2.09941 -0.632949 -1.91587 -2.46483"; for (i = 0; i < y2.length(); ++i) { ASSERT_NEAR(y2_ref[i], y2[i], eps); } for (i = 0; i < s2.length(); ++i) { ASSERT_NEAR(s2_ref[i], s2[i], eps); } HARMA.set_state(s1); y2 = HARMA(x2); s2 = HARMA.get_state(); y2_ref = "-69.5072 -70.9858 -71.9059 -70.4944 -69.6768 -68.0766 -66.1123 -62.2322 -57.8679 -54.1581 " "-50.1093 -45.4535 -40.5494 -35.5858 -32.1681 -28.3028 -25.7691 -23.6384 -22.7421 -23.9771"; s2_ref = "-4.26235 -2.50974 -2.00047 -2.89168 -2.25006 -2.09941 -0.632949 -1.91587 -2.46483"; for (i = 0; i < y2.length(); ++i) { ASSERT_NEAR(y2_ref[i], y2[i], eps); } for (i = 0; i < s2.length(); ++i) { ASSERT_NEAR(s2_ref[i], s2[i], eps); } cy = CHARMA(cx); cs1 = CHARMA.get_state(); cy_ref = "-1.11701-0.115333i -2.00161+1.53226i -2.00801+3.33405i -1.09311+6.64669i 0.621131+9.1594i " "1.29783+12.5648i 2.86311+15.7486i 4.71072+19.6588i 7.11929+21.6355i 10.3822+23.4421i 13.8918+25.4384i " "16.1304+24.7769i 19.4085+24.4214i 20.1424+22.7352i 20.6342+22.3746i 21.994+20.5786i 22.3845+18.1324i " "22.9644+14.2786i 23.0068+12.6987i 22.0851+10.7667i"; cs1_ref = "2.27088-0.0385215i 2.39276+0.521291i 2.3506+0.0675678i 1.90451+0.827048i 2.12+1.58933i " "2.08571+2.1452i 1.69179+1.47622i 3.03271+1.37281i 1.45258+0.923057i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } for (i = 0; i < cs1.length(); ++i) { ASSERT_NEAR(cs1_ref[i].real(), cs1[i].real(), eps); ASSERT_NEAR(cs1_ref[i].imag(), cs1[i].imag(), eps); } cy2 = CHARMA(cx2); cs2 = CHARMA.get_state(); cy2_ref = "21.9828+9.28243i 23.1157+9.80926i 22.8384+8.34728i 22.3949+7.85843i 20.5413+6.43465i " "18.1098+5.76726i 15.28+5.79899i 11.7648+5.53293i 8.59225+5.33168i 5.95376+5.13426i 4.37607+5.08363i " "3.1331+3.38063i 2.06137+2.03165i 3.22998-0.269851i 5.59233-4.44324i 7.85252-7.00614i 10.0887-9.54756i " "13.5677-9.98741i 14.7195-10.1494i 16.4308-9.08996i"; cs2_ref = "1.2315+0.796001i 0.514072+0.0500244i 2.25935-0.646202i 1.43533-1.68969i 2.06861-1.80237i " "2.6782-3.24903i 2.46872-1.3833i 1.63143-1.21527i 1.2759-0.295804i"; for (i = 0; i < cy2.length(); ++i) { ASSERT_NEAR(cy2_ref[i].real(), cy2[i].real(), eps); ASSERT_NEAR(cy2_ref[i].imag(), cy2[i].imag(), eps); } for (i = 0; i < cs2.length(); ++i) { ASSERT_NEAR(cs2_ref[i].real(), cs2[i].real(), eps); ASSERT_NEAR(cs2_ref[i].imag(), cs2[i].imag(), eps); } CHARMA.set_state(cs1); cy2 = CHARMA(cx2); cs2 = CHARMA.get_state(); cy2_ref = "21.9828+9.28243i 23.1157+9.80926i 22.8384+8.34728i 22.3949+7.85843i 20.5413+6.43465i " "18.1098+5.76726i 15.28+5.79899i 11.7648+5.53293i 8.59225+5.33168i 5.95376+5.13426i 4.37607+5.08363i " "3.1331+3.38063i 2.06137+2.03165i 3.22998-0.269851i 5.59233-4.44324i 7.85252-7.00614i 10.0887-9.54756i " "13.5677-9.98741i 14.7195-10.1494i 16.4308-9.08996i"; cs2_ref = "1.2315+0.796001i 0.514072+0.0500244i 2.25935-0.646202i 1.43533-1.68969i 2.06861-1.80237i " "2.6782-3.24903i 2.46872-1.3833i 1.63143-1.21527i 1.2759-0.295804i"; for (i = 0; i < cy2.length(); ++i) { ASSERT_NEAR(cy2_ref[i].real(), cy2[i].real(), eps); ASSERT_NEAR(cy2_ref[i].imag(), cy2[i].imag(), eps); } for (i = 0; i < cs2.length(); ++i) { ASSERT_NEAR(cs2_ref[i].real(), cs2[i].real(), eps); ASSERT_NEAR(cs2_ref[i].imag(), cs2[i].imag(), eps); } cy = CARMA(cx); cy_ref = "-1.11701-0.115333i -2.00161+1.53226i -2.00801+3.33405i -1.09311+6.64669i 0.621131+9.1594i " "1.29783+12.5648i 2.86311+15.7486i 4.71072+19.6588i 7.11929+21.6355i 10.3822+23.4421i 13.8918+25.4384i " "16.1304+24.7769i 19.4085+24.4214i 20.1424+22.7352i 20.6342+22.3746i 21.994+20.5786i 22.3845+18.1324i " "22.9644+14.2786i 23.0068+12.6987i 22.0851+10.7667i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } y = filter(b, a, x); y_ref = "-0.592547 -2.53363 -3.21617 -4.14199 -5.45704 -7.70182 -8.43964 -10.0494 -12.363 -13.7145 " "-15.1936 -19.4505 -24.4864 -30.4175 -35.615 -41.3629 -47.8471 -54.121 -59.6388 -65.0056"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } cy = filter(b, a, cx); cy_ref = "-1.11701-0.115333i -2.00161+1.53226i -2.00801+3.33405i -1.09311+6.64669i 0.621131+9.1594i " "1.29783+12.5648i 2.86311+15.7486i 4.71072+19.6588i 7.11929+21.6355i 10.3822+23.4421i 13.8918+25.4384i " "16.1304+24.7769i 19.4085+24.4214i 20.1424+22.7352i 20.6342+22.3746i 21.994+20.5786i 22.3845+18.1324i " "22.9644+14.2786i 23.0068+12.6987i 22.0851+10.7667i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } cy = filter(cb, ca, cx); cy_ref = "-1.11701-0.115333i -2.00161+1.53226i -2.00801+3.33405i -1.09311+6.64669i 0.621131+9.1594i " "1.29783+12.5648i 2.86311+15.7486i 4.71072+19.6588i 7.11929+21.6355i 10.3822+23.4421i 13.8918+25.4384i " "16.1304+24.7769i 19.4085+24.4214i 20.1424+22.7352i 20.6342+22.3746i 21.994+20.5786i 22.3845+18.1324i " "22.9644+14.2786i 23.0068+12.6987i 22.0851+10.7667i"; for (i = 0; i < cy.length(); ++i) { ASSERT_NEAR(cy_ref[i].real(), cy[i].real(), eps); ASSERT_NEAR(cy_ref[i].imag(), cy[i].imag(), eps); } } itpp-4.3.1/gtests/fix_test.cpp000066400000000000000000000135061216575753400163610ustar00rootroot00000000000000/*! * \file * \brief Fixed-point classes test program * \author Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (Fix, All) { // This is a hack for improper rounding under MinGW static const double eps = 1e-4; // Testing declaration, initialization and conversion int shift(10); // -64...+63 (0 is default) int wordlen(20); // 1...64 (64 is default) e_mode emode(TC); // TC or US (TC is default) o_mode omode(WRAP); // WRAP or SAT (WRAP is default) q_mode qmode(TRN); // RND or TRN (TRN is default) Stat *stat_ptr(0); // 0 or Stat* value (0 is default) // For double and complex double real_value(3.14159265358979323846); complex complex_value(100.0 / 3.0, 200.0 / 3.0); // For Fix and CFix Fix the_fix(real_value, shift, wordlen, emode, omode, qmode, stat_ptr); ASSERT_NEAR(3.14062, double(the_fix), eps); CFix the_cfix(complex_value, 0.0, shift, wordlen, emode, omode, qmode, stat_ptr); complex actual = complex(the_cfix); ASSERT_NEAR(33.333, actual.real(), eps); ASSERT_NEAR(66.666, actual.imag(), eps); // For Fixed and CFixed Fixed<20, TC, WRAP, TRN> the_fixed(real_value, shift, stat_ptr); ASSERT_NEAR(3.14062, double(the_fixed), eps); CFixed<20, TC, WRAP, TRN> the_cfixed(complex_value, 0.0, shift, stat_ptr); actual = complex(the_cfixed); ASSERT_NEAR(33.333, actual.real(), eps); ASSERT_NEAR(66.666, actual.imag(), eps); // For Fixed and CFixed declared using a typedef fixed20 the_fixed20(real_value, shift, stat_ptr); ASSERT_NEAR(3.14062, double(the_fixed20), eps); cfixed20 the_cfixed20(complex_value, 0.0, shift, stat_ptr); actual = complex(the_cfixed20); ASSERT_NEAR(33.333, actual.real(), eps); ASSERT_NEAR(66.666, actual.imag(), eps); // For Fix and CFix declared using a factory Fix the_fix20(FIX20); the_fix20.set(real_value, shift); ASSERT_NEAR(3.14062, double(the_fix20), eps); CFix the_cfix20(FIX20); the_cfix20.set(complex_value, shift); actual = complex(the_cfix20); ASSERT_NEAR(33.333, actual.real(), eps); ASSERT_NEAR(66.666, actual.imag(), eps); // Testing Array/Vec/Mat declarations and operations int vec_length(2); // For Vec and Vec fixvec the_fixvec(vec_length, FIX20); the_fixvec = Fix(real_value, shift); vec v_actual = to_vec(the_fixvec); vec v_expect = "3.14062 3.14062"; int i; for (i = 0; i < v_actual.length(); ++i) { ASSERT_NEAR(v_actual[i], v_expect[i], eps); } cfixvec the_cfixvec(vec_length, FIX20); the_cfixvec = CFix(complex_value, 0.0, shift); cvec cv_actual = to_cvec(the_cfixvec); cvec cv_expect = "33.333+66.666i 33.333+66.666i"; for (i = 0; i < cv_actual.length(); ++i) { ASSERT_NEAR(cv_actual[i].real(), cv_expect[i].real(), eps); ASSERT_NEAR(cv_actual[i].imag(), cv_expect[i].imag(), eps); } cv_actual = to_cvec(the_cfixvec + the_fixvec); cv_expect = "36.4736+66.666i 36.4736+66.666i"; for (i = 0; i < cv_actual.length(); ++i) { ASSERT_NEAR(cv_actual[i].real(), cv_expect[i].real(), eps); ASSERT_NEAR(cv_actual[i].imag(), cv_expect[i].imag(), eps); } cv_actual = to_cvec(the_cfixvec - the_fixvec); cv_expect = "30.1924+66.666i 30.1924+66.666i"; for (i = 0; i < cv_actual.length(); ++i) { ASSERT_NEAR(cv_actual[i].real(), cv_expect[i].real(), eps); ASSERT_NEAR(cv_actual[i].imag(), cv_expect[i].imag(), eps); } actual = complex(the_cfixvec * the_fixvec); cv_expect = "209.373+418.746i"; ASSERT_NEAR(209.373, actual.real(), eps); ASSERT_NEAR(418.746, actual.imag(), eps); cv_actual = to_cvec(the_cfixvec / the_fix); cv_expect = "10+21i 10+21i"; for (i = 0; i < cv_actual.length(); ++i) { ASSERT_NEAR(cv_actual[i].real(), cv_expect[i].real(), eps); ASSERT_NEAR(cv_actual[i].imag(), cv_expect[i].imag(), eps); } // Testing functions // Function is_fix Array > the_array2d_fixvec; ASSERT_TRUE(is_fix(the_array2d_fixvec)); // Function set_fix vec original_float = "0:7"; fixvec resulting_fix(FIX3); set_fix(resulting_fix, original_float, 0); v_actual = to_vec(resulting_fix); v_expect = "0 1 2 3 -4 -3 -2 -1"; for (i = 0; i < v_actual.length(); ++i) { ASSERT_NEAR(v_actual[i], v_expect[i], eps); } vec resulting_float(FIX3); set_fix(resulting_float, original_float, 0); for (i = 0; i < resulting_float.length(); ++i) { ASSERT_NEAR(resulting_float[i], original_float[i], eps); } // Function lshift_fix Fix fix_to_be_lshifted(FIX16); fix_to_be_lshifted = 77; lshift_fix(fix_to_be_lshifted, 1); ASSERT_NEAR(77, double(fix_to_be_lshifted), eps); // Function rshift_fix Fix fix_to_be_rshifted(FIX16); fix_to_be_rshifted = Fix(3.14, 8); rshift_fix(fix_to_be_rshifted, 6, RND); ASSERT_NEAR(3.25, double(fix_to_be_rshifted), eps); } itpp-4.3.1/gtests/freq_filt_test.cpp000066400000000000000000000055161216575753400175500ustar00rootroot00000000000000/*! * \file * \brief Frequency filter test program * \author Simon Wood and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (FreqFilt, All) { static const double eps = 1e-4; int i; vec b = "1 2 3 4"; vec x(20); x.zeros(); x(0) = 1; // Define a filter object for doubles Freq_Filt FF(b, x.length()); // Filter the data vec y = FF.filter(x); // Check the FFT and block sizes that were used int fftsize = FF.get_fft_size(); int blksize = FF.get_blk_size(); ASSERT_EQ(8, fftsize); ASSERT_EQ(5, blksize); vec y_ref = "1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; for (i = 0; i < y.length(); ++i) { ASSERT_NEAR(y_ref[i], y[i], eps); } // Test streaming mode x = linspace(0, 10, 100); Freq_Filt FFS(b, x.length()); vec y1 = FFS.filter(x(0, 49), 1); vec y2 = FFS.filter(x(50, 99), 1); vec conc = concat(y1, y2); vec conc_ref = "0 0.10101 0.40404 1.0101 2.0202 3.0303 4.0404 5.05051 6.06061 7.07071 8.08081 9.09091 " "10.101 11.1111 12.1212 13.1313 14.1414 15.1515 16.1616 17.1717 18.1818 19.1919 20.202 21.2121 22.2222 " "23.2323 24.2424 25.2525 26.2626 27.2727 28.2828 29.2929 30.303 31.3131 32.3232 33.3333 34.3434 35.3535 " "36.3636 37.3737 38.3838 39.3939 40.404 41.4141 42.4242 43.4343 44.4444 45.4545 46.4646 47.4747 48.4848 " "49.4949 50.5051 51.5152 52.5253 53.5354 54.5455 55.5556 56.5657 57.5758 58.5859 59.596 60.6061 61.6162 " "62.6263 63.6364 64.6465 65.6566 66.6667 67.6768 68.6869 69.697 70.7071 71.7172 72.7273 73.7374 74.7475 " "75.7576 76.7677 77.7778 78.7879 79.798 80.8081 81.8182 82.8283 83.8384 84.8485 85.8586 86.8687 87.8788 " "88.8889 89.899 90.9091 91.9192 92.9293 93.9394 94.9495 95.9596 96.9697 97.9798"; for (i = 0; i < conc_ref.length(); ++i) { ASSERT_NEAR(conc_ref[i], conc[i], eps); } } itpp-4.3.1/gtests/g711_ref_data.it000066400000000000000000024004101216575753400166660ustar00rootroot00000000000000IT+++3g191_SweepsArray  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€ÀĀŀƀǀȀɀʀˀ̀̀΀πЀрҀӀԀՀր׀؀ـڀۀ܀݀ހ߀  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÁāŁƁǁȁɁʁˁ́́΁ρЁсҁӁԁՁցׁ؁فځہ܁݁ށ߁  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~‚ÂĂłƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂قڂۂ܂݂ނ߂  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ƒÃăŃƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃփ׃؃كڃۃ܃݃ރ߃  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~„ÄĄńƄDŽȄɄʄ˄̄̈́΄τЄф҄ӄԄՄքׄ؄لڄۄ܄݄ބ߄  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~…ÅąŅƅDžȅɅʅ˅̅ͅ΅υЅх҅ӅԅՅօׅ؅مڅۅ܅݅ޅ߅  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~†ÆĆņƆdžȆɆʆˆ̆͆ΆφІц҆ӆԆՆֆ׆؆نچۆ܆݆ކ߆  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~‡ÇćŇƇLJȇɇʇˇ͇̇·χЇч҇ӇԇՇևׇ؇هڇۇ܇݇އ߇  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ˆÈĈňƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈وڈۈ܈݈ވ߈  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~‰ÉĉʼnƉljȉɉʉˉ͉̉ΉωЉщ҉ӉԉՉ։׉؉ىډۉ܉݉މ߉  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ŠÊĊŊƊNJȊɊʊˊ̊͊ΊϊЊъҊӊԊՊ֊׊؊يڊۊ܊݊ފߊ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~‹ËċŋƋNjȋɋʋˋ̋͋΋ϋЋыҋӋԋՋ֋׋؋ًڋۋ܋݋ދߋ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ŒÌČŌƌnjȌɌʌˌ̌͌ΌόЌьҌӌԌՌ֌׌،ٌڌی܌݌ތߌ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÍčōƍǍȍɍʍˍ͍̍΍ύЍэҍӍԍՍ֍׍؍ٍڍۍ܍ݍލߍ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ŽÎĎŎƎǎȎɎʎˎ͎̎ΎώЎюҎӎԎՎ֎׎؎َڎێ܎ݎގߎ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÏďŏƏǏȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏۏ܏ݏޏߏ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÐĐŐƐǐȐɐʐː̐͐ΐϐАѐҐӐԐՐ֐אِؐڐېܐݐސߐ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~‘ÑđőƑǑȑɑʑˑ̑͑ΑϑБёґӑԑՑ֑בّؑڑۑܑݑޑߑ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~’ÒĒŒƒǒȒɒʒ˒̒͒ΒϒВђҒӒԒՒ֒גْؒڒےܒݒޒߒ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~“ÓēœƓǓȓɓʓ˓͓̓ΓϓГѓғӓԓՓ֓דؓٓړۓܓݓޓߓ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~”ÔĔŔƔǔȔɔʔ˔͔̔ΔϔДєҔӔԔՔ֔הؔٔڔ۔ܔݔޔߔ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~•ÕĕŕƕǕȕɕʕ˕͕̕ΕϕЕѕҕӕԕՕ֕וٕؕڕەܕݕޕߕ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~–ÖĖŖƖǖȖɖʖ˖̖͖ΖϖЖіҖӖԖՖ֖זٖؖږۖܖݖޖߖ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~—×ėŗƗǗȗɗʗ˗̗͗ΗϗЗїҗӗԗ՗֗חؗٗڗۗܗݗޗߗ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~˜ØĘŘƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ٘ژۘܘݘޘߘ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~™ÙęřƙǙșəʙ˙̙͙ΙϙЙљҙәԙՙ֙יؙٙڙۙܙݙޙߙ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~šÚĚŚƚǚȚɚʚ˚͚̚ΚϚКњҚӚԚ՚֚ךؚٚښۚܚݚޚߚ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~›ÛěśƛǛțɛʛ˛̛͛ΛϛЛћқӛԛ՛֛כ؛ٛڛۛܛݛޛߛ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~œÜĜŜƜǜȜɜʜ˜̜͜ΜϜМќҜӜԜ՜֜ל؜ٜڜۜܜݜޜߜ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÝĝŝƝǝȝɝʝ˝̝͝ΝϝНѝҝӝԝ՝֝ם؝ٝڝ۝ܝݝޝߝ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~žÞĞŞƞǞȞɞʞ˞̞͞ΞϞОўҞӞԞ՞֞מ؞ٞڞ۞ܞݞޞߞ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ŸßğşƟǟȟɟʟ˟̟͟ΟϟПџҟӟԟ՟֟ן؟ٟڟ۟ܟݟޟߟ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ àĠŠƠǠȠɠʠˠ̠͠ΠϠРѠҠӠԠՠ֠נؠ٠ڠ۠ܠݠޠߠ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡áġšơǡȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡۡܡݡޡߡ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢âĢŢƢǢȢɢʢˢ̢͢΢ϢТѢҢӢԢբ֢עآ٢ڢۢܢݢޢߢ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~£ãģţƣǣȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڣۣܣݣޣߣ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¤äĤŤƤǤȤɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤۤܤݤޤߤ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¥åĥťƥǥȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥۥܥݥޥߥ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¦æĦŦƦǦȦɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צئ٦ڦۦܦݦަߦ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~§çħŧƧǧȧɧʧ˧̧ͧΧϧЧѧҧӧԧէ֧קا٧ڧۧܧݧާߧ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¨èĨŨƨǨȨɨʨ˨̨ͨΨϨШѨҨӨԨը֨רب٨ڨۨܨݨިߨ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~©éĩũƩǩȩɩʩ˩̩ͩΩϩЩѩҩөԩթ֩שة٩ک۩ܩݩީߩ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ªêĪŪƪǪȪɪʪ˪̪ͪΪϪЪѪҪӪԪժ֪תت٪ڪ۪ܪݪުߪ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~«ëīūƫǫȫɫʫ˫̫ͫΫϫЫѫҫӫԫի֫׫ث٫ګ۫ܫݫޫ߫  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¬ìĬŬƬǬȬɬʬˬ̬ͬάϬЬѬҬӬԬլ֬׬ج٬ڬ۬ܬݬެ߬  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~­íĭŭƭǭȭɭʭ˭̭ͭέϭЭѭҭӭԭխ֭׭ح٭ڭۭܭݭޭ߭  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~®îĮŮƮǮȮɮʮˮ̮ͮήϮЮѮҮӮԮծ֮׮خٮڮۮܮݮޮ߮  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¯ïįůƯǯȯɯʯ˯̯ͯίϯЯѯүӯԯկ֯ׯدٯگۯܯݯޯ߯  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~°ðİŰưǰȰɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ۰ܰݰް߰  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~±ñıűƱDZȱɱʱ˱̱ͱαϱбѱұӱԱձֱױرٱڱ۱ܱݱޱ߱  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~²òIJŲƲDzȲɲʲ˲̲ͲβϲвѲҲӲԲղֲײزٲڲ۲ܲݲ޲߲  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~³óijųƳdzȳɳʳ˳̳ͳγϳгѳҳӳԳճֳ׳سٳڳ۳ܳݳ޳߳  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~´ôĴŴƴǴȴɴʴ˴̴ʹδϴдѴҴӴԴմִ״شٴڴ۴ܴݴ޴ߴ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~µõĵŵƵǵȵɵʵ˵̵͵εϵеѵҵӵԵյֵ׵صٵڵ۵ܵݵ޵ߵ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¶öĶŶƶǶȶɶʶ˶̶Ͷζ϶жѶҶӶԶնֶ׶ضٶڶ۶ܶݶ޶߶  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~·÷ķŷƷǷȷɷʷ˷̷ͷηϷзѷҷӷԷշַ׷طٷڷ۷ܷݷ޷߷  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¸øĸŸƸǸȸɸʸ˸̸͸θϸиѸҸӸԸոָ׸ظٸڸ۸ܸݸ޸߸  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¹ùĹŹƹǹȹɹʹ˹̹͹ιϹйѹҹӹԹչֹ׹عٹڹ۹ܹݹ޹߹  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ºúĺźƺǺȺɺʺ˺̺ͺκϺкѺҺӺԺպֺ׺غٺںۺܺݺ޺ߺ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~»ûĻŻƻǻȻɻʻ˻̻ͻλϻлѻһӻԻջֻ׻ػٻڻۻܻݻ޻߻  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¼üļżƼǼȼɼʼ˼̼ͼμϼмѼҼӼԼռּ׼ؼټڼۼܼݼ޼߼  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~½ýĽŽƽǽȽɽʽ˽̽ͽνϽнѽҽӽԽսֽ׽ؽٽڽ۽ܽݽ޽߽  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¾þľžƾǾȾɾʾ˾̾;ξϾоѾҾӾԾվ־׾ؾپھ۾ܾݾ޾߾  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¿ÿĿſƿǿȿɿʿ˿̿ͿοϿпѿҿӿԿտֿ׿ؿٿڿۿܿݿ޿߿  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƻƼƽƾƿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ǀǁǂǃDŽDždžLJLjljNJNjnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZDzdzǴǵǶǷǸǹǺǻǼǽǾǿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ɀɁɂɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼʽʾʿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ˀˁ˂˃˄˅ˆˇˈˉˊˋˌˍˎˏːˑ˒˓˔˕˖˗˘˙˚˛˜˝˞˟ˠˡˢˣˤ˥˦˧˨˩˪˫ˬ˭ˮ˯˰˱˲˳˴˵˶˷˸˹˺˻˼˽˾˿  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̕̚  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~͇͈͉͍͎̀́͂̓̈́͆͊͋͌ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ͘͜͟͢͝͞͠͡ͰͱͲͳʹ͵Ͷͷ͸͹ͺͻͼͽ;Ϳ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~΀΁΂΃΄΅Ά·ΈΉΊ΋Ό΍ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ΢ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξο  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~πρςστυφχψωϊϋόύώϏϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵ϶ϷϸϹϺϻϼϽϾϿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~рстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Ҁҁ҂҃҄҅҆҇҈҉ҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӏӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹӺӻӼӽӾӿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԐԑԒԓԔԕԖԗԘԙԚԛԜԝԞԟԠԡԢԣԤԥԦԧԨԩԪԫԬԭԮԯ԰ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖ՗՘ՙ՚՛՜՝՞՟ՠաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~րցւփքօֆևֈ։֊֋֌֍֎֏֐ְֱֲֳִֵֶַָֹֺֻּֽ֑֖֛֢֣֤֥֦֧֪֚֭֮֒֓֔֕֗֘֙֜֝֞֟֠֡֨֩֫֬֯־ֿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~׀ׁׂ׃ׅׄ׆ׇ׈׉׊׋׌׍׎׏אבגדהוזחטיךכלםמןנסעףפץצקרשת׫׬׭׮ׯװױײ׳״׵׶׷׸׹׺׻׼׽׾׿  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~؀؁؂؃؄؅؆؇؈؉؊؋،؍؎؏ؘؙؚؐؑؒؓؔؕؖؗ؛؜؝؞؟ؠءآأؤإئابةتثجحخدذرزسشصضطظعغػؼؽؾؿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ـفقكلمنهوىيًٌٍَُِّْٕٖٜٟٓٔٗ٘ٙٚٛٝٞ٠١٢٣٤٥٦٧٨٩٪٫٬٭ٮٯٰٱٲٳٴٵٶٷٸٹٺٻټٽپٿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ڀځڂڃڄڅچڇڈډڊڋڌڍڎڏڐڑڒړڔڕږڗژڙښڛڜڝڞڟڠڡڢڣڤڥڦڧڨکڪګڬڭڮگڰڱڲڳڴڵڶڷڸڹںڻڼڽھڿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ۀہۂۃۄۅۆۇۈۉۊۋیۍێۏېۑےۓ۔ەۖۗۘۙۚۛۜ۝۞ۣ۟۠ۡۢۤۥۦۧۨ۩۪ۭ۫۬ۮۯ۰۱۲۳۴۵۶۷۸۹ۺۻۼ۽۾ۿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~܀܁܂܃܄܅܆܇܈܉܊܋܌܍܎܏ܐܑܒܓܔܕܖܗܘܙܚܛܜܝܞܟܠܡܢܣܤܥܦܧܨܩܪܫܬܭܮܯܱܴܷܸܹܻܼܾܰܲܳܵܶܺܽܿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~݂݄݆݈݀݁݃݅݇݉݊݋݌ݍݎݏݐݑݒݓݔݕݖݗݘݙݚݛݜݝݞݟݠݡݢݣݤݥݦݧݨݩݪݫݬݭݮݯݰݱݲݳݴݵݶݷݸݹݺݻݼݽݾݿ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ހށނރބޅކއވމފދތލގޏސޑޒޓޔޕޖޗޘޙޚޛޜޝޞޟޠޡޢޣޤޥަާިީުޫެޭޮޯްޱ޲޳޴޵޶޷޸޹޺޻޼޽޾޿  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~߀߁߂߃߄߅߆߇߈߉ߊߋߌߍߎߏߐߑߒߓߔߕߖߗߘߙߚߛߜߝߞߟߠߡߢߣߤߥߦߧߨߩߪ߲߫߬߭߮߯߰߱߳ߴߵ߶߷߸߹ߺ߻߼߽߾߿  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  !!!!!!!!! ! ! ! ! !!!!!!!!!!!!!!!!!!! !!!"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2!3!4!5!6!7!8!9!:!;!!?!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""" " " " " """"""""""""""""""" "!"""#"$"%"&"'"(")"*"+","-"."/"0"1"2"3"4"5"6"7"8"9":";"<"=">"?"@"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""######### # # # # ################### #!#"###$#%#&#'#(#)#*#+#,#-#.#/#0#1#2#3#4#5#6#7#8#9#:#;#<#=#>#?#@#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#[#\#]#^#_#`#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#{#|#}#~##################################################################################################################################$$$$$$$$$ $ $ $ $ $$$$$$$$$$$$$$$$$$$ $!$"$#$$$%$&$'$($)$*$+$,$-$.$/$0$1$2$3$4$5$6$7$8$9$:$;$<$=$>$?$@$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O$P$Q$R$S$T$U$V$W$X$Y$Z$[$\$]$^$_$`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z${$|$}$~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%% % % % % %%%%%%%%%%%%%%%%%%% %!%"%#%$%%%&%'%(%)%*%+%,%-%.%/%0%1%2%3%4%5%6%7%8%9%:%;%<%=%>%?%@%A%B%C%D%E%F%G%H%I%J%K%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%[%\%]%^%_%`%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q%r%s%t%u%v%w%x%y%z%{%|%}%~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&& & & & & &&&&&&&&&&&&&&&&&&& &!&"&#&$&%&&&'&(&)&*&+&,&-&.&/&0&1&2&3&4&5&6&7&8&9&:&;&<&=&>&?&@&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&[&\&]&^&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&{&|&}&~&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&''''''''' ' ' ' ' ''''''''''''''''''' '!'"'#'$'%'&'''(')'*'+','-'.'/'0'1'2'3'4'5'6'7'8'9':';'<'='>'?'@'A'B'C'D'E'F'G'H'I'J'K'L'M'N'O'P'Q'R'S'T'U'V'W'X'Y'Z'['\']'^'_'`'a'b'c'd'e'f'g'h'i'j'k'l'm'n'o'p'q'r's't'u'v'w'x'y'z'{'|'}'~''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''((((((((( ( ( ( ( ((((((((((((((((((( (!("(#($(%(&('((()(*(+(,(-(.(/(0(1(2(3(4(5(6(7(8(9(:(;(<(=(>(?(@(A(B(C(D(E(F(G(H(I(J(K(L(M(N(O(P(Q(R(S(T(U(V(W(X(Y(Z([(\(](^(_(`(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z({(|(}(~(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))) ) ) ) ) ))))))))))))))))))) )!)")#)$)%)&)')()))*)+),)-).)/)0)1)2)3)4)5)6)7)8)9):);)<)=)>)?)@)A)B)C)D)E)F)G)H)I)J)K)L)M)N)O)P)Q)R)S)T)U)V)W)X)Y)Z)[)\)])^)_)`)a)b)c)d)e)f)g)h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z){)|)})~))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))********* * * * * ******************* *!*"*#*$*%*&*'*(*)***+*,*-*.*/*0*1*2*3*4*5*6*7*8*9*:*;*<*=*>*?*@*A*B*C*D*E*F*G*H*I*J*K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*[*\*]*^*_*`*a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*{*|*}*~**********************************************************************************************************************************+++++++++ + + + + +++++++++++++++++++ +!+"+#+$+%+&+'+(+)+*+++,+-+.+/+0+1+2+3+4+5+6+7+8+9+:+;+<+=+>+?+@+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+[+\+]+^+_+`+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+{+|+}+~++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++,,,,,,,,, , , , , ,,,,,,,,,,,,,,,,,,, ,!,",#,$,%,&,',(,),*,+,,,-,.,/,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,@,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,[,\,],^,_,`,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,{,|,},~,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------- - - - - ------------------- -!-"-#-$-%-&-'-(-)-*-+-,---.-/-0-1-2-3-4-5-6-7-8-9-:-;-<-=->-?-@-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z-[-\-]-^-_-`-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-{-|-}-~----------------------------------------------------------------------------------------------------------------------------------......... . . . . ................... .!.".#.$.%.&.'.(.).*.+.,.-.../.0.1.2.3.4.5.6.7.8.9.:.;.<.=.>.?.@.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.[.\.].^._.`.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.{.|.}.~..................................................................................................................................///////// / / / / /////////////////// /!/"/#/$/%/&/'/(/)/*/+/,/-/.///0/1/2/3/4/5/6/7/8/9/:/;//?/@/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/[/\/]/^/_/`/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/{/|/}/~//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////000000000 0 0 0 0 0000000000000000000 0!0"0#0$0%0&0'0(0)0*0+0,0-0.0/000102030405060708090:0;0<0=0>0?0@0A0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z0[0\0]0^0_0`0a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0{0|0}0~0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111 1 1 1 1 1111111111111111111 1!1"1#1$1%1&1'1(1)1*1+1,1-1.1/101112131415161718191:1;1<1=1>1?1@1A1B1C1D1E1F1G1H1I1J1K1L1M1N1O1P1Q1R1S1T1U1V1W1X1Y1Z1[1\1]1^1_1`1a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1{1|1}1~1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222 2 2 2 2 2222222222222222222 2!2"2#2$2%2&2'2(2)2*2+2,2-2.2/202122232425262728292:2;2<2=2>2?2@2A2B2C2D2E2F2G2H2I2J2K2L2M2N2O2P2Q2R2S2T2U2V2W2X2Y2Z2[2\2]2^2_2`2a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2q2r2s2t2u2v2w2x2y2z2{2|2}2~2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222333333333 3 3 3 3 3333333333333333333 3!3"3#3$3%3&3'3(3)3*3+3,3-3.3/303132333435363738393:3;3<3=3>3?3@3A3B3C3D3E3F3G3H3I3J3K3L3M3N3O3P3Q3R3S3T3U3V3W3X3Y3Z3[3\3]3^3_3`3a3b3c3d3e3f3g3h3i3j3k3l3m3n3o3p3q3r3s3t3u3v3w3x3y3z3{3|3}3~3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333444444444 4 4 4 4 4444444444444444444 4!4"4#4$4%4&4'4(4)4*4+4,4-4.4/404142434445464748494:4;4<4=4>4?4@4A4B4C4D4E4F4G4H4I4J4K4L4M4N4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4\4]4^4_4`4a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4{4|4}4~4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444555555555 5 5 5 5 5555555555555555555 5!5"5#5$5%5&5'5(5)5*5+5,5-5.5/505152535455565758595:5;5<5=5>5?5@5A5B5C5D5E5F5G5H5I5J5K5L5M5N5O5P5Q5R5S5T5U5V5W5X5Y5Z5[5\5]5^5_5`5a5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5{5|5}5~5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555666666666 6 6 6 6 6666666666666666666 6!6"6#6$6%6&6'6(6)6*6+6,6-6.6/606162636465666768696:6;6<6=6>6?6@6A6B6C6D6E6F6G6H6I6J6K6L6M6N6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6\6]6^6_6`6a6b6c6d6e6f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u6v6w6x6y6z6{6|6}6~6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666777777777 7 7 7 7 7777777777777777777 7!7"7#7$7%7&7'7(7)7*7+7,7-7.7/707172737475767778797:7;7<7=7>7?7@7A7B7C7D7E7F7G7H7I7J7K7L7M7N7O7P7Q7R7S7T7U7V7W7X7Y7Z7[7\7]7^7_7`7a7b7c7d7e7f7g7h7i7j7k7l7m7n7o7p7q7r7s7t7u7v7w7x7y7z7{7|7}7~7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777888888888 8 8 8 8 8888888888888888888 8!8"8#8$8%8&8'8(8)8*8+8,8-8.8/808182838485868788898:8;8<8=8>8?8@8A8B8C8D8E8F8G8H8I8J8K8L8M8N8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8\8]8^8_8`8a8b8c8d8e8f8g8h8i8j8k8l8m8n8o8p8q8r8s8t8u8v8w8x8y8z8{8|8}8~8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888999999999 9 9 9 9 9999999999999999999 9!9"9#9$9%9&9'9(9)9*9+9,9-9.9/909192939495969798999:9;9<9=9>9?9@9A9B9C9D9E9F9G9H9I9J9K9L9M9N9O9P9Q9R9S9T9U9V9W9X9Y9Z9[9\9]9^9_9`9a9b9c9d9e9f9g9h9i9j9k9l9m9n9o9p9q9r9s9t9u9v9w9x9y9z9{9|9}9~9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999::::::::: : : : : ::::::::::::::::::: :!:":#:$:%:&:':(:):*:+:,:-:.:/:0:1:2:3:4:5:6:7:8:9:::;:<:=:>:?:@:A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:[:\:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:{:|:}:~::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;; ; ; ; ; ;;;;;;;;;;;;;;;;;;; ;!;";#;$;%;&;';(;);*;+;,;-;.;/;0;1;2;3;4;5;6;7;8;9;:;;;<;=;>;?;@;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;[;\;];^;_;`;a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z;{;|;};~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<<<<<<<<< < < < < <<<<<<<<<<<<<<<<<<< =?=@=A=B=C=D=E=F=G=H=I=J=K=L=M=N=O=P=Q=R=S=T=U=V=W=X=Y=Z=[=\=]=^=_=`=a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z={=|=}=~==================================================================================================================================>>>>>>>>> > > > > >>>>>>>>>>>>>>>>>>> >!>">#>$>%>&>'>(>)>*>+>,>->.>/>0>1>2>3>4>5>6>7>8>9>:>;><>=>>>?>@>A>B>C>D>E>F>G>H>I>J>K>L>M>N>O>P>Q>R>S>T>U>V>W>X>Y>Z>[>\>]>^>_>`>a>b>c>d>e>f>g>h>i>j>k>l>m>n>o>p>q>r>s>t>u>v>w>x>y>z>{>|>}>~>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>????????? ? ? ? ? ??????????????????? ?!?"?#?$?%?&?'?(?)?*?+?,?-?.?/?0?1?2?3?4?5?6?7?8?9?:?;????@?A?B?C?D?E?F?G?H?I?J?K?L?M?N?O?P?Q?R?S?T?U?V?W?X?Y?Z?[?\?]?^?_?`?a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t?u?v?w?x?y?z?{?|?}?~??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????@@@@@@@@@ @ @ @ @ @@@@@@@@@@@@@@@@@@@ @!@"@#@$@%@&@'@(@)@*@+@,@-@.@/@0@1@2@3@4@5@6@7@8@9@:@;@<@=@>@?@@@A@B@C@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@[@\@]@^@_@`@a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@{@|@}@~@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@AAAAAAAAA A A A A AAAAAAAAAAAAAAAAAAA A!A"A#A$A%A&A'A(A)A*A+A,A-A.A/A0A1A2A3A4A5A6A7A8A9A:A;AA?A@AAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZA[A\A]A^A_A`AaAbAcAdAeAfAgAhAiAjAkAlAmAnAoApAqArAsAtAuAvAwAxAyAzA{A|A}A~AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBB B B B B BBBBBBBBBBBBBBBBBBB B!B"B#B$B%B&B'B(B)B*B+B,B-B.B/B0B1B2B3B4B5B6B7B8B9B:B;BB?B@BABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZB[B\B]B^B_B`BaBbBcBdBeBfBgBhBiBjBkBlBmBnBoBpBqBrBsBtBuBvBwBxByBzB{B|B}B~BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCC C C C C CCCCCCCCCCCCCCCCCCC C!C"C#C$C%C&C'C(C)C*C+C,C-C.C/C0C1C2C3C4C5C6C7C8C9C:C;CC?C@CACBCCCDCECFCGCHCICJCKCLCMCNCOCPCQCRCSCTCUCVCWCXCYCZC[C\C]C^C_C`CaCbCcCdCeCfCgChCiCjCkClCmCnCoCpCqCrCsCtCuCvCwCxCyCzC{C|C}C~CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDD D D D D DDDDDDDDDDDDDDDDDDD D!D"D#D$D%D&D'D(D)D*D+D,D-D.D/D0D1D2D3D4D5D6D7D8D9D:D;DD?D@DADBDCDDDEDFDGDHDIDJDKDLDMDNDODPDQDRDSDTDUDVDWDXDYDZD[D\D]D^D_D`DaDbDcDdDeDfDgDhDiDjDkDlDmDnDoDpDqDrDsDtDuDvDwDxDyDzD{D|D}D~DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEE E E E E EEEEEEEEEEEEEEEEEEE E!E"E#E$E%E&E'E(E)E*E+E,E-E.E/E0E1E2E3E4E5E6E7E8E9E:E;EE?E@EAEBECEDEEEFEGEHEIEJEKELEMENEOEPEQERESETEUEVEWEXEYEZE[E\E]E^E_E`EaEbEcEdEeEfEgEhEiEjEkElEmEnEoEpEqErEsEtEuEvEwExEyEzE{E|E}E~EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFF F F F F FFFFFFFFFFFFFFFFFFF F!F"F#F$F%F&F'F(F)F*F+F,F-F.F/F0F1F2F3F4F5F6F7F8F9F:F;FF?F@FAFBFCFDFEFFFGFHFIFJFKFLFMFNFOFPFQFRFSFTFUFVFWFXFYFZF[F\F]F^F_F`FaFbFcFdFeFfFgFhFiFjFkFlFmFnFoFpFqFrFsFtFuFvFwFxFyFzF{F|F}F~FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGG G G G G GGGGGGGGGGGGGGGGGGG G!G"G#G$G%G&G'G(G)G*G+G,G-G.G/G0G1G2G3G4G5G6G7G8G9G:G;GG?G@GAGBGCGDGEGFGGGHGIGJGKGLGMGNGOGPGQGRGSGTGUGVGWGXGYGZG[G\G]G^G_G`GaGbGcGdGeGfGgGhGiGjGkGlGmGnGoGpGqGrGsGtGuGvGwGxGyGzG{G|G}G~GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHH H H H H HHHHHHHHHHHHHHHHHHH H!H"H#H$H%H&H'H(H)H*H+H,H-H.H/H0H1H2H3H4H5H6H7H8H9H:H;HH?H@HAHBHCHDHEHFHGHHHIHJHKHLHMHNHOHPHQHRHSHTHUHVHWHXHYHZH[H\H]H^H_H`HaHbHcHdHeHfHgHhHiHjHkHlHmHnHoHpHqHrHsHtHuHvHwHxHyHzH{H|H}H~HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIII I I I I IIIIIIIIIIIIIIIIIII I!I"I#I$I%I&I'I(I)I*I+I,I-I.I/I0I1I2I3I4I5I6I7I8I9I:I;II?I@IAIBICIDIEIFIGIHIIIJIKILIMINIOIPIQIRISITIUIVIWIXIYIZI[I\I]I^I_I`IaIbIcIdIeIfIgIhIiIjIkIlImInIoIpIqIrIsItIuIvIwIxIyIzI{I|I}I~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJJJJ J J J J JJJJJJJJJJJJJJJJJJJ J!J"J#J$J%J&J'J(J)J*J+J,J-J.J/J0J1J2J3J4J5J6J7J8J9J:J;JJ?J@JAJBJCJDJEJFJGJHJIJJJKJLJMJNJOJPJQJRJSJTJUJVJWJXJYJZJ[J\J]J^J_J`JaJbJcJdJeJfJgJhJiJjJkJlJmJnJoJpJqJrJsJtJuJvJwJxJyJzJ{J|J}J~JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKK K K K K KKKKKKKKKKKKKKKKKKK K!K"K#K$K%K&K'K(K)K*K+K,K-K.K/K0K1K2K3K4K5K6K7K8K9K:K;KK?K@KAKBKCKDKEKFKGKHKIKJKKKLKMKNKOKPKQKRKSKTKUKVKWKXKYKZK[K\K]K^K_K`KaKbKcKdKeKfKgKhKiKjKkKlKmKnKoKpKqKrKsKtKuKvKwKxKyKzK{K|K}K~KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLL L L L L LLLLLLLLLLLLLLLLLLL L!L"L#L$L%L&L'L(L)L*L+L,L-L.L/L0L1L2L3L4L5L6L7L8L9L:L;LL?L@LALBLCLDLELFLGLHLILJLKLLLMLNLOLPLQLRLSLTLULVLWLXLYLZL[L\L]L^L_L`LaLbLcLdLeLfLgLhLiLjLkLlLmLnLoLpLqLrLsLtLuLvLwLxLyLzL{L|L}L~LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMM M M M M MMMMMMMMMMMMMMMMMMM M!M"M#M$M%M&M'M(M)M*M+M,M-M.M/M0M1M2M3M4M5M6M7M8M9M:M;MM?M@MAMBMCMDMEMFMGMHMIMJMKMLMMMNMOMPMQMRMSMTMUMVMWMXMYMZM[M\M]M^M_M`MaMbMcMdMeMfMgMhMiMjMkMlMmMnMoMpMqMrMsMtMuMvMwMxMyMzM{M|M}M~MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNN N N N N NNNNNNNNNNNNNNNNNNN N!N"N#N$N%N&N'N(N)N*N+N,N-N.N/N0N1N2N3N4N5N6N7N8N9N:N;NN?N@NANBNCNDNENFNGNHNINJNKNLNMNNNONPNQNRNSNTNUNVNWNXNYNZN[N\N]N^N_N`NaNbNcNdNeNfNgNhNiNjNkNlNmNnNoNpNqNrNsNtNuNvNwNxNyNzN{N|N}N~NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOO O O O O OOOOOOOOOOOOOOOOOOO O!O"O#O$O%O&O'O(O)O*O+O,O-O.O/O0O1O2O3O4O5O6O7O8O9O:O;OO?O@OAOBOCODOEOFOGOHOIOJOKOLOMONOOOPOQOROSOTOUOVOWOXOYOZO[O\O]O^O_O`OaObOcOdOeOfOgOhOiOjOkOlOmOnOoOpOqOrOsOtOuOvOwOxOyOzO{O|O}O~OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPP P P P P PPPPPPPPPPPPPPPPPPP P!P"P#P$P%P&P'P(P)P*P+P,P-P.P/P0P1P2P3P4P5P6P7P8P9P:P;PP?P@PAPBPCPDPEPFPGPHPIPJPKPLPMPNPOPPPQPRPSPTPUPVPWPXPYPZP[P\P]P^P_P`PaPbPcPdPePfPgPhPiPjPkPlPmPnPoPpPqPrPsPtPuPvPwPxPyPzP{P|P}P~PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQQQ Q Q Q Q QQQQQQQQQQQQQQQQQQQ Q!Q"Q#Q$Q%Q&Q'Q(Q)Q*Q+Q,Q-Q.Q/Q0Q1Q2Q3Q4Q5Q6Q7Q8Q9Q:Q;QQ?Q@QAQBQCQDQEQFQGQHQIQJQKQLQMQNQOQPQQQRQSQTQUQVQWQXQYQZQ[Q\Q]Q^Q_Q`QaQbQcQdQeQfQgQhQiQjQkQlQmQnQoQpQqQrQsQtQuQvQwQxQyQzQ{Q|Q}Q~QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQRRRRRRRRR R R R R RRRRRRRRRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-R.R/R0R1R2R3R4R5R6R7R8R9R:R;RR?R@RARBRCRDRERFRGRHRIRJRKRLRMRNRORPRQRRRSRTRURVRWRXRYRZR[R\R]R^R_R`RaRbRcRdReRfRgRhRiRjRkRlRmRnRoRpRqRrRsRtRuRvRwRxRyRzR{R|R}R~RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSS S S S S SSSSSSSSSSSSSSSSSSS S!S"S#S$S%S&S'S(S)S*S+S,S-S.S/S0S1S2S3S4S5S6S7S8S9S:S;SS?S@SASBSCSDSESFSGSHSISJSKSLSMSNSOSPSQSRSSSTSUSVSWSXSYSZS[S\S]S^S_S`SaSbScSdSeSfSgShSiSjSkSlSmSnSoSpSqSrSsStSuSvSwSxSySzS{S|S}S~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTT T T T T TTTTTTTTTTTTTTTTTTT T!T"T#T$T%T&T'T(T)T*T+T,T-T.T/T0T1T2T3T4T5T6T7T8T9T:T;TT?T@TATBTCTDTETFTGTHTITJTKTLTMTNTOTPTQTRTSTTTUTVTWTXTYTZT[T\T]T^T_T`TaTbTcTdTeTfTgThTiTjTkTlTmTnToTpTqTrTsTtTuTvTwTxTyTzT{T|T}T~TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUU U U U U UUUUUUUUUUUUUUUUUUU U!U"U#U$U%U&U'U(U)U*U+U,U-U.U/U0U1U2U3U4U5U6U7U8U9U:U;UU?U@UAUBUCUDUEUFUGUHUIUJUKULUMUNUOUPUQURUSUTUUUVUWUXUYUZU[U\U]U^U_U`UaUbUcUdUeUfUgUhUiUjUkUlUmUnUoUpUqUrUsUtUuUvUwUxUyUzU{U|U}U~UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVV V V V V VVVVVVVVVVVVVVVVVVV V!V"V#V$V%V&V'V(V)V*V+V,V-V.V/V0V1V2V3V4V5V6V7V8V9V:V;VV?V@VAVBVCVDVEVFVGVHVIVJVKVLVMVNVOVPVQVRVSVTVUVVVWVXVYVZV[V\V]V^V_V`VaVbVcVdVeVfVgVhViVjVkVlVmVnVoVpVqVrVsVtVuVvVwVxVyVzV{V|V}V~VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWWWWWWWWW W W W W WWWWWWWWWWWWWWWWWWW W!W"W#W$W%W&W'W(W)W*W+W,W-W.W/W0W1W2W3W4W5W6W7W8W9W:W;WW?W@WAWBWCWDWEWFWGWHWIWJWKWLWMWNWOWPWQWRWSWTWUWVWWWXWYWZW[W\W]W^W_W`WaWbWcWdWeWfWgWhWiWjWkWlWmWnWoWpWqWrWsWtWuWvWwWxWyWzW{W|W}W~WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXXXXXXXX X X X X XXXXXXXXXXXXXXXXXXX X!X"X#X$X%X&X'X(X)X*X+X,X-X.X/X0X1X2X3X4X5X6X7X8X9X:X;XX?X@XAXBXCXDXEXFXGXHXIXJXKXLXMXNXOXPXQXRXSXTXUXVXWXXXYXZX[X\X]X^X_X`XaXbXcXdXeXfXgXhXiXjXkXlXmXnXoXpXqXrXsXtXuXvXwXxXyXzX{X|X}X~XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYYYYYYYY Y Y Y Y YYYYYYYYYYYYYYYYYYY Y!Y"Y#Y$Y%Y&Y'Y(Y)Y*Y+Y,Y-Y.Y/Y0Y1Y2Y3Y4Y5Y6Y7Y8Y9Y:Y;YY?Y@YAYBYCYDYEYFYGYHYIYJYKYLYMYNYOYPYQYRYSYTYUYVYWYXYYYZY[Y\Y]Y^Y_Y`YaYbYcYdYeYfYgYhYiYjYkYlYmYnYoYpYqYrYsYtYuYvYwYxYyYzY{Y|Y}Y~YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZ Z Z Z Z ZZZZZZZZZZZZZZZZZZZ Z!Z"Z#Z$Z%Z&Z'Z(Z)Z*Z+Z,Z-Z.Z/Z0Z1Z2Z3Z4Z5Z6Z7Z8Z9Z:Z;ZZ?Z@ZAZBZCZDZEZFZGZHZIZJZKZLZMZNZOZPZQZRZSZTZUZVZWZXZYZZZ[Z\Z]Z^Z_Z`ZaZbZcZdZeZfZgZhZiZjZkZlZmZnZoZpZqZrZsZtZuZvZwZxZyZzZ{Z|Z}Z~ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ[[[[[[[[[ [ [ [ [ [[[[[[[[[[[[[[[[[[[ [!["[#[$[%[&['[([)[*[+[,[-[.[/[0[1[2[3[4[5[6[7[8[9[:[;[<[=[>[?[@[A[B[C[D[E[F[G[H[I[J[K[L[M[N[O[P[Q[R[S[T[U[V[W[X[Y[Z[[[\[][^[_[`[a[b[c[d[e[f[g[h[i[j[k[l[m[n[o[p[q[r[s[t[u[v[w[x[y[z[{[|[}[~[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\\\\\\\\\ \ \ \ \ \\\\\\\\\\\\\\\\\\\ \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\0\1\2\3\4\5\6\7\8\9\:\;\<\=\>\?\@\A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z\[\\\]\^\_\`\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z\{\|\}\~\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\]]]]]]]]] ] ] ] ] ]]]]]]]]]]]]]]]]]]] ]!]"]#]$]%]&]'](])]*]+],]-].]/]0]1]2]3]4]5]6]7]8]9]:];]<]=]>]?]@]A]B]C]D]E]F]G]H]I]J]K]L]M]N]O]P]Q]R]S]T]U]V]W]X]Y]Z][]\]]]^]_]`]a]b]c]d]e]f]g]h]i]j]k]l]m]n]o]p]q]r]s]t]u]v]w]x]y]z]{]|]}]~]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]^^^^^^^^^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^^^^ ^!^"^#^$^%^&^'^(^)^*^+^,^-^.^/^0^1^2^3^4^5^6^7^8^9^:^;^<^=^>^?^@^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_^`^a^b^c^d^e^f^g^h^i^j^k^l^m^n^o^p^q^r^s^t^u^v^w^x^y^z^{^|^}^~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_________ _ _ _ _ ___________________ _!_"_#_$_%_&_'_(_)_*_+_,_-_._/_0_1_2_3_4_5_6_7_8_9_:_;_<_=_>_?_@_A_B_C_D_E_F_G_H_I_J_K_L_M_N_O_P_Q_R_S_T_U_V_W_X_Y_Z_[_\_]_^___`_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_{_|_}_~__________________________________________________________________________________________________________________________________````````` ` ` ` ` ``````````````````` `!`"`#`$`%`&`'`(`)`*`+`,`-`.`/`0`1`2`3`4`5`6`7`8`9`:`;`<`=`>`?`@`A`B`C`D`E`F`G`H`I`J`K`L`M`N`O`P`Q`R`S`T`U`V`W`X`Y`Z`[`\`]`^`_```a`b`c`d`e`f`g`h`i`j`k`l`m`n`o`p`q`r`s`t`u`v`w`x`y`z`{`|`}`~``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````aaaaaaaaa a a a a aaaaaaaaaaaaaaaaaaa a!a"a#a$a%a&a'a(a)a*a+a,a-a.a/a0a1a2a3a4a5a6a7a8a9a:a;aa?a@aAaBaCaDaEaFaGaHaIaJaKaLaMaNaOaPaQaRaSaTaUaVaWaXaYaZa[a\a]a^a_a`aaabacadaeafagahaiajakalamanaoapaqarasatauavawaxayaza{a|a}a~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbb b b b b bbbbbbbbbbbbbbbbbbb b!b"b#b$b%b&b'b(b)b*b+b,b-b.b/b0b1b2b3b4b5b6b7b8b9b:b;bb?b@bAbBbCbDbEbFbGbHbIbJbKbLbMbNbObPbQbRbSbTbUbVbWbXbYbZb[b\b]b^b_b`babbbcbdbebfbgbhbibjbkblbmbnbobpbqbrbsbtbubvbwbxbybzb{b|b}b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccc c c c c ccccccccccccccccccc c!c"c#c$c%c&c'c(c)c*c+c,c-c.c/c0c1c2c3c4c5c6c7c8c9c:c;cc?c@cAcBcCcDcEcFcGcHcIcJcKcLcMcNcOcPcQcRcScTcUcVcWcXcYcZc[c\c]c^c_c`cacbcccdcecfcgchcicjckclcmcncocpcqcrcsctcucvcwcxcyczc{c|c}c~ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeeeeeeeee e e e e eeeeeeeeeeeeeeeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;ee?e@eAeBeCeDeEeFeGeHeIeJeKeLeMeNeOePeQeReSeTeUeVeWeXeYeZe[e\e]e^e_e`eaebecedeeefegeheiejekelemeneoepeqereseteuevewexeyeze{e|e}e~eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffffffff f f f f fffffffffffffffffff f!f"f#f$f%f&f'f(f)f*f+f,f-f.f/f0f1f2f3f4f5f6f7f8f9f:f;ff?f@fAfBfCfDfEfFfGfHfIfJfKfLfMfNfOfPfQfRfSfTfUfVfWfXfYfZf[f\f]f^f_f`fafbfcfdfefffgfhfifjfkflfmfnfofpfqfrfsftfufvfwfxfyfzf{f|f}f~ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffggggggggg g g g g ggggggggggggggggggg g!g"g#g$g%g&g'g(g)g*g+g,g-g.g/g0g1g2g3g4g5g6g7g8g9g:g;gg?g@gAgBgCgDgEgFgGgHgIgJgKgLgMgNgOgPgQgRgSgTgUgVgWgXgYgZg[g\g]g^g_g`gagbgcgdgegfggghgigjgkglgmgngogpgqgrgsgtgugvgwgxgygzg{g|g}g~gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhh h h h h hhhhhhhhhhhhhhhhhhh h!h"h#h$h%h&h'h(h)h*h+h,h-h.h/h0h1h2h3h4h5h6h7h8h9h:h;hh?h@hAhBhChDhEhFhGhHhIhJhKhLhMhNhOhPhQhRhShThUhVhWhXhYhZh[h\h]h^h_h`hahbhchdhehfhghhhihjhkhlhmhnhohphqhrhshthuhvhwhxhyhzh{h|h}h~hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;ii?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjj j j j j jjjjjjjjjjjjjjjjjjj j!j"j#j$j%j&j'j(j)j*j+j,j-j.j/j0j1j2j3j4j5j6j7j8j9j:j;jj?j@jAjBjCjDjEjFjGjHjIjJjKjLjMjNjOjPjQjRjSjTjUjVjWjXjYjZj[j\j]j^j_j`jajbjcjdjejfjgjhjijjjkjljmjnjojpjqjrjsjtjujvjwjxjyjzj{j|j}j~jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkkkkkkkkk k k k k kkkkkkkkkkkkkkkkkkk k!k"k#k$k%k&k'k(k)k*k+k,k-k.k/k0k1k2k3k4k5k6k7k8k9k:k;kk?k@kAkBkCkDkEkFkGkHkIkJkKkLkMkNkOkPkQkRkSkTkUkVkWkXkYkZk[k\k]k^k_k`kakbkckdkekfkgkhkikjkkklkmknkokpkqkrksktkukvkwkxkykzk{k|k}k~kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllll l l l l lllllllllllllllllll l!l"l#l$l%l&l'l(l)l*l+l,l-l.l/l0l1l2l3l4l5l6l7l8l9l:l;ll?l@lAlBlClDlElFlGlHlIlJlKlLlMlNlOlPlQlRlSlTlUlVlWlXlYlZl[l\l]l^l_l`lalblcldlelflglhliljlklllmlnlolplqlrlsltlulvlwlxlylzl{l|l}l~llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllmmmmmmmmm m m m m mmmmmmmmmmmmmmmmmmm m!m"m#m$m%m&m'm(m)m*m+m,m-m.m/m0m1m2m3m4m5m6m7m8m9m:m;mm?m@mAmBmCmDmEmFmGmHmImJmKmLmMmNmOmPmQmRmSmTmUmVmWmXmYmZm[m\m]m^m_m`mambmcmdmemfmgmhmimjmkmlmmmnmompmqmrmsmtmumvmwmxmymzm{m|m}m~mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmnnnnnnnnn n n n n nnnnnnnnnnnnnnnnnnn n!n"n#n$n%n&n'n(n)n*n+n,n-n.n/n0n1n2n3n4n5n6n7n8n9n:n;nn?n@nAnBnCnDnEnFnGnHnInJnKnLnMnNnOnPnQnRnSnTnUnVnWnXnYnZn[n\n]n^n_n`nanbncndnenfngnhninjnknlnmnnnonpnqnrnsntnunvnwnxnynzn{n|n}n~nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooo o o o o ooooooooooooooooooo o!o"o#o$o%o&o'o(o)o*o+o,o-o.o/o0o1o2o3o4o5o6o7o8o9o:o;oo?o@oAoBoCoDoEoFoGoHoIoJoKoLoMoNoOoPoQoRoSoToUoVoWoXoYoZo[o\o]o^o_o`oaobocodoeofogohoiojokolomonooopoqorosotouovowoxoyozo{o|o}o~ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooppppppppp p p p p ppppppppppppppppppp p!p"p#p$p%p&p'p(p)p*p+p,p-p.p/p0p1p2p3p4p5p6p7p8p9p:p;pp?p@pApBpCpDpEpFpGpHpIpJpKpLpMpNpOpPpQpRpSpTpUpVpWpXpYpZp[p\p]p^p_p`papbpcpdpepfpgphpipjpkplpmpnpopppqprpsptpupvpwpxpypzp{p|p}p~ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqq q q q q qqqqqqqqqqqqqqqqqqq q!q"q#q$q%q&q'q(q)q*q+q,q-q.q/q0q1q2q3q4q5q6q7q8q9q:q;qq?q@qAqBqCqDqEqFqGqHqIqJqKqLqMqNqOqPqQqRqSqTqUqVqWqXqYqZq[q\q]q^q_q`qaqbqcqdqeqfqgqhqiqjqkqlqmqnqoqpqqqrqsqtquqvqwqxqyqzq{q|q}q~qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;rr?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrsssssssss s s s s sssssssssssssssssss s!s"s#s$s%s&s's(s)s*s+s,s-s.s/s0s1s2s3s4s5s6s7s8s9s:s;ss?s@sAsBsCsDsEsFsGsHsIsJsKsLsMsNsOsPsQsRsSsTsUsVsWsXsYsZs[s\s]s^s_s`sasbscsdsesfsgshsisjskslsmsnsospsqsrssstsusvswsxsyszs{s|s}s~ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssttttttttt t t t t ttttttttttttttttttt t!t"t#t$t%t&t't(t)t*t+t,t-t.t/t0t1t2t3t4t5t6t7t8t9t:t;tt?t@tAtBtCtDtEtFtGtHtItJtKtLtMtNtOtPtQtRtStTtUtVtWtXtYtZt[t\t]t^t_t`tatbtctdtetftgthtitjtktltmtntotptqtrtstttutvtwtxtytzt{t|t}t~ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttuuuuuuuuu u u u u uuuuuuuuuuuuuuuuuuu u!u"u#u$u%u&u'u(u)u*u+u,u-u.u/u0u1u2u3u4u5u6u7u8u9u:u;uu?u@uAuBuCuDuEuFuGuHuIuJuKuLuMuNuOuPuQuRuSuTuUuVuWuXuYuZu[u\u]u^u_u`uaubucudueufuguhuiujukulumunuoupuqurusutuuuvuwuxuyuzu{u|u}u~uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuvvvvvvvvv v v v v vvvvvvvvvvvvvvvvvvv v!v"v#v$v%v&v'v(v)v*v+v,v-v.v/v0v1v2v3v4v5v6v7v8v9v:v;vv?v@vAvBvCvDvEvFvGvHvIvJvKvLvMvNvOvPvQvRvSvTvUvVvWvXvYvZv[v\v]v^v_v`vavbvcvdvevfvgvhvivjvkvlvmvnvovpvqvrvsvtvuvvvwvxvyvzv{v|v}v~vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvwwwwwwwww w w w w wwwwwwwwwwwwwwwwwww w!w"w#w$w%w&w'w(w)w*w+w,w-w.w/w0w1w2w3w4w5w6w7w8w9w:w;ww?w@wAwBwCwDwEwFwGwHwIwJwKwLwMwNwOwPwQwRwSwTwUwVwWwXwYwZw[w\w]w^w_w`wawbwcwdwewfwgwhwiwjwkwlwmwnwowpwqwrwswtwuwvwwwxwywzw{w|w}w~wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwxxxxxxxxx x x x x xxxxxxxxxxxxxxxxxxx x!x"x#x$x%x&x'x(x)x*x+x,x-x.x/x0x1x2x3x4x5x6x7x8x9x:x;xx?x@xAxBxCxDxExFxGxHxIxJxKxLxMxNxOxPxQxRxSxTxUxVxWxXxYxZx[x\x]x^x_x`xaxbxcxdxexfxgxhxixjxkxlxmxnxoxpxqxrxsxtxuxvxwxxxyxzx{x|x}x~xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyy y y y y yyyyyyyyyyyyyyyyyyy y!y"y#y$y%y&y'y(y)y*y+y,y-y.y/y0y1y2y3y4y5y6y7y8y9y:y;yy?y@yAyByCyDyEyFyGyHyIyJyKyLyMyNyOyPyQyRySyTyUyVyWyXyYyZy[y\y]y^y_y`yaybycydyeyfygyhyiyjykylymynyoypyqyrysytyuyvywyxyyyzy{y|y}y~yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyzzzzzzzzz z z z z zzzzzzzzzzzzzzzzzzz z!z"z#z$z%z&z'z(z)z*z+z,z-z.z/z0z1z2z3z4z5z6z7z8z9z:z;zz?z@zAzBzCzDzEzFzGzHzIzJzKzLzMzNzOzPzQzRzSzTzUzVzWzXzYzZz[z\z]z^z_z`zazbzczdzezfzgzhzizjzkzlzmznzozpzqzrzsztzuzvzwzxzyzzz{z|z}z~zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{{{{{{{{{ { { { { {{{{{{{{{{{{{{{{{{{ {!{"{#{${%{&{'{({){*{+{,{-{.{/{0{1{2{3{4{5{6{7{8{9{:{;{<{={>{?{@{A{B{C{D{E{F{G{H{I{J{K{L{M{N{O{P{Q{R{S{T{U{V{W{X{Y{Z{[{\{]{^{_{`{a{b{c{d{e{f{g{h{i{j{k{l{m{n{o{p{q{r{s{t{u{v{w{x{y{z{{{|{}{~{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{||||||||| | | | | ||||||||||||||||||| |!|"|#|$|%|&|'|(|)|*|+|,|-|.|/|0|1|2|3|4|5|6|7|8|9|:|;|<|=|>|?|@|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|[|\|]|^|_|`|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|{|||}|~||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}}}}}}}}} } } } } }}}}}}}}}}}}}}}}}}} }!}"}#}$}%}&}'}(})}*}+},}-}.}/}0}1}2}3}4}5}6}7}8}9}:};}<}=}>}?}@}A}B}C}D}E}F}G}H}I}J}K}L}M}N}O}P}Q}R}S}T}U}V}W}X}Y}Z}[}\}]}^}_}`}a}b}c}d}e}f}g}h}i}j}k}l}m}n}o}p}q}r}s}t}u}v}w}x}y}z}{}|}}}~}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}~~~~~~~~~ ~ ~ ~ ~ ~~~~~~~~~~~~~~~~~~~ ~!~"~#~$~%~&~'~(~)~*~+~,~-~.~/~0~1~2~3~4~5~6~7~8~9~:~;~<~=~>~?~@~A~B~C~D~E~F~G~H~I~J~K~L~M~N~O~P~Q~R~S~T~U~V~W~X~Y~Z~[~\~]~^~_~`~a~b~c~d~e~f~g~h~i~j~k~l~m~n~o~p~q~r~s~t~u~v~w~x~y~z~{~|~}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~*2g191_ulawsArray  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""################################################################################################################################################################################################################################################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))****************************************************************************************************************************************************************************************************************************************************************++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------................................................................................................................................................................................................................................................................////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444445555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555566666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888899999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<================================================================================================================================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^________________________________````````````````aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddeeeeeeeeeeeeeeeeffffffffffffffffgggggggggggggggghhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkllllllllllllllllmmmmmmmmmmmmmmmmnnnnnnnnnnnnnnnnooooooooooooooooppppppppqqqqqqqqrrrrrrrrssssssssttttttttuuuuuuuuvvvvvvvvwwwwwwwwxxxxxxxxyyyyyyyyzzzzzzzz{{{{{{{{||||||||}}}}}}}}~~~~~~~~.6g191_ulaw_decsArrayaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))9999999999999999999999999999999999999999999999999999999999999999IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%--------------------------------55555555555555555555555555555555================================EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} !!!!!!!!!!!!!!!!%%%%%%%%%%%%%%%%))))))))))))))))----------------111111111111111155555555555555559999999999999999================AAAAAAAAAAAAAAAAEEEEEEEEEEEEEEEEIIIIIIIIIIIIIIIIMMMMMMMMMMMMMMMMQQQQQQQQQQQQQQQQUUUUUUUUUUUUUUUUYYYYYYYYYYYYYYYY]]]]]]]]]]]]]]]]cccccccccccccccccccccccccccccccckkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkssssssssssssssssssssssssssssssss{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''7777777777777777777777777777777777777777777777777777777777777777GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________*2g191_alawsArray****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888899999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111166666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444455555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555   jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooollllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc````````````````````````````````````````````````````````````````aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||||||||||||||||||||||||||||||||}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrssssssssssssssssssssssssssssssssppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwttttttttttttttttttttttttttttttttuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIINNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCC@@@@@@@@@@@@@@@@AAAAAAAAAAAAAAAAFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEZZZZZZZZZZZZZZZZ[[[[[[[[[[[[[[[[XXXXXXXXXXXXXXXXYYYYYYYYYYYYYYYY^^^^^^^^^^^^^^^^________________\\\\\\\\\\\\\\\\]]]]]]]]]]]]]]]]RRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSPPPPPPPPPPPPPPPPQQQQQQQQQQQQQQQQVVVVVVVVVVVVVVVVWWWWWWWWWWWWWWWWTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUU.6g191_alaw_decsArray@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` ````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4444444444444444444444444444444444444444444444444444444444444444<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<. * * ------------------------------------------------------------------------- */ /* * This code uses repacked G.191 test vectors distributed under the * ITU-T SOFTWARE TOOLS' GENERAL PUBLIC LICENSE. * Following is the information about original authors of G.711 test suite: * Simao Ferraz de Campos Neto Rudolf Hofmann * CPqD/Telebras PHILIPS KOMMUNIKATIONS INDUSTRIE AG * DDS/Pr.11 Kommunikationssysteme * Rd. Mogi Mirim-Campinas Km.118 Thurn-und-Taxis-Strasse 14 * 13.080-061 - Campinas - SP (Brazil) D-8500 Nuernberg 10 (Germany) * Phone : +55-192-39-6637 Phone : +49-911-526-2603 * FAX : +55-192-39-2179 FAX : +49-911-526-3385 * EMail : tdsimao@cpqd.ansp.br EMail : hf@pkinbg.uucp * In order to get license and original test vectors you should download G.191 software tools * archive. License can be found in \Software\gen-lic.txt file. Original test vectors are stored in * /Software/stl2009/g711/g711-tst.zip */ #include "gtest/gtest.h" #include #include #include using namespace itpp; //This test program uses original G.191 test vectors repacked to itpp file format. //Please uncomment following define in order to update/regenerate the test vectors. Also you should //unpack the G.191 original files (sweep.src, sweep-r.u, sweep-r.u-u, sweep-r.a, sweep-r.a-a) //to the test executable folder. //Original test vectors cover the whole range of 16-bit integers (2^16 samples). Please adjust the //num_samples constant accordingly if you want to run the test on the reduced range and speed things up. //#define UPDATE_TEST_VECTORS const std::string test_file_name = G711_TEST_FILE; const int num_samples = 256*256; //use full test set //equality checker template inline void check_equality(const Array& left, const Array& right) { int size = left.size(); ASSERT_EQ (size , right.size()) << "array size mismatch"; for(int i = 0; i < size; ++i) { ASSERT_EQ(left(i) , right(i)) << "equality failure for element # " << i << std::endl; } } //base class for ItFile tests class G711 : public ::testing::Test { protected: static void SetUpTestCase() { #ifdef UPDATE_TEST_VECTORS it_file g711_refs(test_file_name); Array samples(num_samples); int cnt; //load 16-bit sweep reference { bifstream g191_file("sweep.src"); int16_t s; for(cnt = 0; cnt < num_samples && g191_file; ++cnt){ g191_file >> s ; samples(cnt) = s; } //it seems to be a bug in gtest (see issue 247, http://code.google.com/p/googletest/issues/detail?id=247) //gtest does not seem to mark fixture failed on failures in SetUpTestCase(), so we have to terminate here. it_error_if(cnt != num_samples,"Failed to read sweep.src file contents."); g711_refs << Name("g191_Sweep") << samples; } //ulaw-encoded g191_Sweep { bifstream g191_file("sweep-r.u"); int16_t s; for(cnt = 0; cnt < num_samples && g191_file; ++cnt) { g191_file >> s; samples(cnt) = s; } it_error_if(cnt != num_samples,"Failed to read sweep-r.u file contents."); g711_refs << Name("g191_ulaw") << samples; } //load ulaw-decoded samples. Test samples are left-justified, so scale them down to fit into 13 LSBs { bifstream g191_file("sweep-r.u-u"); int16_t s; for(cnt = 0; cnt < num_samples && g191_file; ++cnt) { g191_file >> s; samples(cnt) = (s>>2); } it_error_if(cnt != num_samples, "Failed to read sweep-r.u-u file contents."); g711_refs << Name("g191_ulaw_dec") << samples; } //alaw-encoded g191_Sweep { bifstream g191_file("sweep-r.a"); int16_t s; for(cnt = 0; cnt < num_samples && g191_file; ++cnt) { g191_file >> s; samples(cnt) = s; } it_error_if(cnt != num_samples,"Failed to read sweep-r.a file contents."); g711_refs << Name("g191_alaw") << samples; } //load alaw-decoded samples. Test samples are left-justified, so scale them down to fit into 13 LSBs { bifstream g191_file("sweep-r.a-a"); int16_t s; for(cnt = 0; cnt < num_samples && g191_file; ++cnt) { g191_file >> s; samples(cnt) = (s>>3); } it_error_if(cnt != num_samples,"Failed to read sweep-r.a-a file contents."); g711_refs << Name("g191_alaw_dec") << samples; } #endif } }; //G.711 u-codec test TEST_F(G711, uCodec) { it_file ref_data(test_file_name); Array ref_in_samples(num_samples); Array ref_enc_samples(num_samples); Array ref_dec_samples(num_samples); ref_data >> Name("g191_Sweep")>>ref_in_samples; ref_data >> Name("g191_ulaw") >> ref_enc_samples; ref_data >> Name("g191_ulaw_dec") >> ref_dec_samples; Array enc_samples(num_samples); Array dec_samples(num_samples); //encode for(int cnt = 0; cnt < num_samples; ++cnt){ enc_samples(cnt) = ulaw_compress(ref_in_samples(cnt)>>2); } check_equality(enc_samples, ref_enc_samples); //decode for(int cnt = 0; cnt < num_samples; ++cnt){ dec_samples(cnt) = ulaw_expand(static_cast(ref_enc_samples(cnt))); } check_equality(dec_samples, ref_dec_samples); } //G.711 a-codec test TEST_F(G711, aCodec) { it_file ref_data(test_file_name); Array ref_in_samples(num_samples); Array ref_enc_samples(num_samples); Array ref_dec_samples(num_samples); ref_data >> Name("g191_Sweep")>>ref_in_samples; ref_data >> Name("g191_alaw") >> ref_enc_samples; ref_data >> Name("g191_alaw_dec") >> ref_dec_samples; Array enc_samples(num_samples); Array dec_samples(num_samples); //encode for(int cnt = 0; cnt < num_samples; ++cnt){ enc_samples(cnt) = alaw_compress(ref_in_samples(cnt)>>3); } check_equality(enc_samples, ref_enc_samples); //decode for(int cnt = 0; cnt < num_samples; ++cnt){ dec_samples(cnt) = alaw_expand(static_cast(ref_enc_samples(cnt))); } check_equality(dec_samples, ref_dec_samples); } itpp-4.3.1/gtests/galois_test.cpp000066400000000000000000000030271216575753400170460ustar00rootroot00000000000000/*! * \file * \brief Galois Field algebra classes test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST (Galois, All) { GF a(8), b(8), c(8); a = 4; b = 2; c = a + b; ostringstream ss(ostringstream::out); string ref[] = {"a=alpha^4, b=alpha^2", "c=alpha^1"}; ss << "a=" << a << ", b=" << b; ASSERT_TRUE(ss.str() == ref[0]); ss.str(""); ss << "c=" << c; ASSERT_TRUE(ss.str() == ref[1]); } itpp-4.3.1/gtests/gf2mat_test.cpp000066400000000000000000000205161216575753400167520ustar00rootroot00000000000000/*! * \file * \brief Test program for a class for algebra on GF(2) (binary) matrices * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ // To run extensive tests uncomment the following definition //#define EXTENSIVE_TESTS #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static GF2mat random_matrix(int m, int n) { GF2mat Z(m, n); for (int j = 0; j < n; j++) { for (int i = 0; i < m; i++) { Z.set(i, j, randi(0, 1)); } } return Z; } TEST (GF2Mat, All) { RNG_reset(0); int i,j; // gf2mat_test: Test of matrix operations in gfmat.h/gfmat.cpp GF2mat A(3, 3); A.set(0, 0, 1); A.set(1, 2, 1); A.set(2, 1, 1); ASSERT_DOUBLE_EQ(3.0/9, A.density()); ASSERT_EQ(3, A.rows()); ASSERT_EQ(3, A.cols()); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { if ((0 == i && 0 == j) || (1 == i && 2 == j) || (2 == i && 1 == j)) { ASSERT_EQ(bin(1), A(i,j)); } else { ASSERT_EQ(bin(0), A(i,j)); } } } GF2mat B = A*A; ASSERT_DOUBLE_EQ(3.0/9, B.density()); ASSERT_EQ(3, B.rows()); ASSERT_EQ(3, B.cols()); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { if ((0 == i && 0 == j) || (1 == i && 1 == j) || (2 == i && 2 == j)) { ASSERT_EQ(bin(1), B(i,j)); } else { ASSERT_EQ(bin(0), B(i,j)); } } } B = A*A.transpose(); ASSERT_DOUBLE_EQ(3.0/9, B.density()); ASSERT_EQ(3, B.rows()); ASSERT_EQ(3, B.cols()); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { if ((0 == i && 0 == j) || (1 == i && 1 == j) || (2 == i && 2 == j)) { ASSERT_EQ(bin(1), B(i,j)); } else { ASSERT_EQ(bin(0), B(i,j)); } } } B = A; bvec v = B.get_row(1); bvec v_ref = "0 0 1"; ASSERT_TRUE(v == v_ref); v = B.get_col(2); v_ref = "0 1 0"; ASSERT_TRUE(v == v_ref); v.set_size(3); v(0) = 1; v(1) = 1; v(2) = 0; v = A*v; v_ref = "1 0 1"; ASSERT_TRUE(v == v_ref); ASSERT_EQ(3, A.row_rank()); B = A.inverse(); ASSERT_DOUBLE_EQ(3.0/9, B.density()); ASSERT_EQ(3, B.rows()); ASSERT_EQ(3, B.cols()); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { if ((0 == i && 0 == j) || (1 == i && 2 == j) || (2 == i && 1 == j)) { ASSERT_EQ(bin(1), B(i,j)); } else { ASSERT_EQ(bin(0), B(i,j)); } } } GF2mat C, D; ivec p; A.T_fact(C, D, p); ASSERT_DOUBLE_EQ(3.0/9, C.density()); ASSERT_EQ(3, C.rows()); ASSERT_EQ(3, C.cols()); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { if ((0 == i && 0 == j) || (1 == i && 1 == j) || (2 == i && 2 == j)) { ASSERT_EQ(bin(1), C(i,j)); } else { ASSERT_EQ(bin(0), C(i,j)); } } } ASSERT_EQ(C, D); ivec p_ref = "0 2 1"; ASSERT_EQ(p, p_ref); // Test Alist functionality string file = "gf2mat_test.alist"; GF2mat_sparse_alist alist; alist.from_sparse(A.sparsify()); alist.write(file); GF2mat_sparse_alist alist2(file); ASSERT_EQ(GF2mat(alist2.to_sparse()), A) << "Alist test failed"; #ifdef EXTENSIVE_TESTS // ========== EXTENSIVE RANDOM TESTS ========== // The following code can be used to verify the behavior of the GF2 // class for large matrix dimensions. Note that with debugging // options enabled, this code takes a while to run. To run these // extensive tests, simply remove the comments around this code segment. // Test of file I/O GF2mat Z = random_matrix(301, 179); it_file f1("gf2mat_test.it"); f1 << Name("Z") << Z; f1.close(); it_ifile f2("gf2mat_test.it"); GF2mat Z_temp; f2 >> Name("Z") >> Z_temp; f2.close(); ASSERT_EQ(Z, Z_temp); // Binary vector bvec b = randb(Z.cols()); ASSERT_EQ(GF2mat(Z*b, 1), Z*GF2mat(b, 1)); // Multiplication test GF2mat W = random_matrix(139, Z.rows()); GF2mat temp1 = W * Z; GF2mat temp2 = GF2mat(W.sparsify() * Z.sparsify()); ASSERT_EQ(temp1, temp2); Z = Z.transpose(); ASSERT_EQ(W*Z.transpose(), mult_trans(W, Z)); // Transpose ASSERT_EQ(GF2mat(b, 0), GF2mat(b, 1).transpose()); ASSERT_EQ(GF2mat(b, 1), GF2mat(b, 0).transpose()); GF2mat Y = random_matrix(Z.cols(), 73); ASSERT_EQ((Z*Y).transpose(), Y.transpose()*Z.transpose()); // Concatenation int m = Z.rows(); int n = Z.cols(); ASSERT_EQ(Z, Z.get_submatrix(0, 0, m - 1, 27).concatenate_horizontal(Z.get_submatrix(0, 28, m - 1, n - 1))); ASSERT_EQ(Z, Z.get_submatrix(0, 0, 13, n - 1).concatenate_vertical(Z.get_submatrix(14, 0, m - 1, n - 1))); // Assignment operator GF2mat P = Z; ASSERT_EQ(P, Z); ASSERT_TRUE((P + Z).is_zero()); // Sparse-dense conversions GF2mat_sparse As(Z.rows(), Z.cols()); for (i = 0; i < Z.rows(); i++) { for (j = 0; j < Z.cols(); j++) { if (Z.get(i, j) == 1) { As.set(i, j, 1); } } } ASSERT_EQ(GF2mat(As), Z); GF2mat_sparse Cs = Z.sparsify(); ASSERT_EQ(Cs.full(), As.full()); Z = random_matrix(100, 75); // Get rows and columns v_ref = "0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0 1 0 " "1 0 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 0 1"; ASSERT_EQ(v_ref, Z.get_row(1)); v_ref = "0 1 0 1 1 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 0 1 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 1 0 " "1 0 1 0 1 1 0 1 0 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 0 1 0"; ASSERT_EQ(v_ref, Z.get_col(2)); // Print a submatrix on the screen B = Z.get_submatrix(1, 1, 6, 4); ASSERT_DOUBLE_EQ(0.54166666666666663, B.density()); ASSERT_EQ(6, B.rows()); ASSERT_EQ(4, B.cols()); // Test of T-factorization int dim = 250; for (int trial = 0; trial < 100; trial++) { GF2mat X = random_matrix(rand() % dim + 1, rand() % dim + 1); GF2mat T, U; ivec perm; X.T_fact(T, U, perm); GF2mat W = T * X; W.permute_cols(perm, 0); ASSERT_EQ(U, W); } // Test of inversion for (int trial = 0; trial < 100; trial++) { GF2mat X = random_matrix(dim, dim); while (X.row_rank() != dim) { X.set(rand() % dim, rand() % dim, rand() % 2); } ASSERT_EQ(X*X.inverse(), gf2dense_eye(dim)); ASSERT_EQ(X.inverse()*X, gf2dense_eye(dim)); } // Test of the T-factorization bitflip update for (int trial = 0; trial < 100; trial++) { GF2mat X = random_matrix(rand() % dim + 1, rand() % dim + 1); GF2mat T, U; ivec perm; int rank = X.T_fact(T, U, perm); GF2mat Tnew = T; GF2mat Unew = U; ivec permnew = perm; for (int trial2 = 0; trial2 < 10; trial2++) { int i = rand() % X.rows(); int j = rand() % X.cols(); X.addto_element(i, j, 1); X.T_fact_update_bitflip(Tnew, Unew, permnew, rank, i, j); GF2mat W = Tnew * X; W.permute_cols(permnew, 0); ASSERT_EQ(Unew, W); } } // Test of the T-factorization add-column update for (int trial = 0; trial < 100; trial++) { bvec c = randb(dim); GF2mat X(c, 1); GF2mat T, U; ivec perm; X.T_fact(T, U, perm); for (int trial2 = 0; trial2 < 100; trial2++) { bvec c = randb(dim); // cerr << X << endl; // cerr << GF2mat(c,1) << endl; GF2mat Xtemp = X.concatenate_horizontal(GF2mat(c, 1)); int success = Xtemp.T_fact_update_addcol(T, U, perm, c); if (success == 1) { X = Xtemp; } // cerr << "rank was: " << X.row_rank() << endl; GF2mat W = T * X; W.permute_cols(perm, 0); ASSERT_EQ(U, W); } } #endif // #ifdef(EXTENSIVE_TESTS) } itpp-4.3.1/gtests/histogram_test.cpp000066400000000000000000000074111216575753400175660ustar00rootroot00000000000000/*! * \file * \brief Histogram class test program * \author Andy Panov and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static void assert_ivec(const ivec &expected, const ivec &actual) { ASSERT_EQ(expected.length(), actual.length()); for (int n = 0; n < expected.length(); ++n) { ASSERT_EQ(expected[n], actual[n]); } } static void assert_vec(const vec &expected, const vec &actual) { static const double eps = 1e-12; ASSERT_EQ(expected.length(), actual.length()); for (int n = 0; n < expected.length(); ++n) { ASSERT_NEAR(expected[n], actual[n], eps); } } TEST (Histogram, All) { // Histogram tests // create histogram Histogram hist(-3, 3, 21); // matrix dimension for statistical test int mat_dim = 100; // compute histogram for a random matrix RNG_reset(0); hist.update(randn(mat_dim, mat_dim)); ivec bins = hist.get_bins(); vec exp_pdf = hist.get_pdf(); double pdf_max = max(exp_pdf); ASSERT_DOUBLE_EQ(0.1242, pdf_max); ivec bins_ref = "29 39 75 118 225 406 622 734 1035 1135 1242 1119 973 781 584 370 247 143 75 21 27"; assert_ivec(bins_ref, bins); vec exp_pdf_ref = "0.0029 0.0039 0.0075 0.0118 0.0225 0.0406 0.0622 0.0734 0.1035 0.1135 0.1242 0.1119 " "0.0973 0.0781 0.0584 0.037 0.0247 0.0143 0.0075 0.0021 0.0027"; assert_vec(exp_pdf_ref, exp_pdf); ASSERT_EQ(10000, sum(hist.get_bins())); ASSERT_DOUBLE_EQ(1.0, sum(exp_pdf)); // reset histogram, so we can start next experiment hist.reset(); // compute histogram for a random vector int num_stat_trials = 50000; // compute histogram for random vector hist.update(randn(num_stat_trials)); bins = hist.get_bins(); exp_pdf = hist.get_pdf(); pdf_max = max(exp_pdf); ASSERT_DOUBLE_EQ(0.11752, pdf_max); bins_ref = "115 169 319 648 1246 2009 2917 3960 5000 5724 5876 5683 4936 4126 2880 1962 1182 679 318 157 94"; assert_ivec(bins_ref, bins); exp_pdf_ref = "0.0023 0.00338 0.00638 0.01296 0.02492 0.04018 0.05834 0.0792 0.1 0.11448 0.11752 0.11366 " "0.09872 0.08252 0.0576 0.03924 0.02364 0.01358 0.00636 0.00314 0.00188"; assert_vec(exp_pdf_ref, exp_pdf); ASSERT_EQ(50000, sum(hist.get_bins())); ASSERT_DOUBLE_EQ(1.0, sum(exp_pdf)); // compute CDF. CDF is computed vs. right bin boundaries vec exp_cdf = hist.get_cdf(); vec bin_right = hist.get_bin_rights(); vec exp_cdf_ref = "0.0023 0.00568 0.01206 0.02502 0.04994 0.09012 0.14846 0.22766 0.32766 0.44214 0.55966 " "0.67332 0.77204 0.85456 0.91216 0.9514 0.97504 0.98862 0.99498 0.99812 1"; vec bin_right_ref = "-2.85 -2.55 -2.25 -1.95 -1.65 -1.35 -1.05 -0.75 -0.45 -0.15 0.15 0.45 0.75 1.05 1.35 " "1.65 1.95 2.25 2.55 2.85 3.15"; assert_vec(exp_cdf_ref, exp_cdf); assert_vec(bin_right_ref, bin_right); } itpp-4.3.1/gtests/integration_test.cpp000066400000000000000000000056411216575753400201170ustar00rootroot00000000000000/*! * \file * \brief Transforms test program * \author Tony Ottosson, Thomas Eriksson, Simon Wood, Adam Piatyszek, Andy Panov and Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace std; using namespace itpp; //Integration is tested with x*ln(x) function double test_integrand(const double x) { return x * log(x); } struct Test_Integrand { double operator()(double x) { return x * log(x); } }; //set test tolerance (measure of relative and absolute error) const double max_rel_error = 1e-6; const double max_abs_error = 1e-6; //results tester inline void test_result(double q, double ref) { if(abs(q - ref) < max_abs_error) return; //handle numbers with absolute value close to zero (relative error can be huge for them) double rel_error = abs(q - ref) / abs(q); ASSERT_LE(rel_error, max_rel_error); } //analytically computed integral double integral_value(double a, double b) { return 0.25 * b * b * (2 * log(b) - 1.0) - 0.25 * a * a * (2 * log(a) - 1.0); } //---------------------------------------------- //Gtest test cases //---------------------------------------------- static const double low_lim = 1.5; static const double hi_lim = 3.5; static const double ref_integral_value = integral_value(low_lim, hi_lim); TEST(Integration, Simpson) { { SCOPED_TRACE("Testing function object"); double q = itpp::quad(Test_Integrand(), low_lim, hi_lim); test_result(q, ref_integral_value); } { SCOPED_TRACE("Testing double f(double)"); double q = itpp::quad(test_integrand, low_lim, hi_lim); test_result(q, ref_integral_value); } } TEST(Integration, Lobatto) { { SCOPED_TRACE("Testing function object"); double q = itpp::quadl(Test_Integrand(), low_lim, hi_lim); test_result(q, ref_integral_value); } { SCOPED_TRACE("Testing double f(double)"); double q = itpp::quadl(test_integrand, low_lim, hi_lim); test_result(q, ref_integral_value); } } itpp-4.3.1/gtests/interleaver_test.cpp000066400000000000000000000056141216575753400201140ustar00rootroot00000000000000/*! * \file * \brief Interleaver classes test program * \author Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static void assert_ivec(const ivec &exp, const ivec &act) { ASSERT_EQ(exp.length(), act.length()); for (int n = 0; n < exp.length(); ++n) { ASSERT_EQ(exp[n], act[n]); } } TEST (Interleaver, All) { //Declare scalars and vectors: int rows, cols, order, depth; ivec input, output, deinterleaved; ivec ref; RNG_reset(0); //Declare the interleavers. Block_Interleaver block_interleaver; Cross_Interleaver cross_interleaver; Sequence_Interleaver sequence_interleaver; //Testing Block_Interleaver rows = 4; cols = 5; block_interleaver.set_rows(rows); block_interleaver.set_cols(cols); input = "1:20"; output = block_interleaver.interleave(input); deinterleaved = block_interleaver.deinterleave(output); ref = "1 5 9 13 17 2 6 10 14 18 3 7 11 15 19 4 8 12 16 20"; assert_ivec(ref, output); assert_ivec(input, deinterleaved); //Testing Cross_Interleaver order = 5; cross_interleaver.set_order(order); input = "1:25"; output = cross_interleaver.interleave(input); deinterleaved = cross_interleaver.deinterleave(output); ref = "1 0 0 0 0 6 2 0 0 0 11 7 3 0 0 16 12 8 4 0 21 17 13 9 5 0 22 18 14 10 " "0 0 23 19 15 0 0 0 24 20 0 0 0 0 25 0 0 0 0 0"; assert_ivec(ref, output); assert_ivec(input, deinterleaved); //Testing Sequence_Interleaver depth = 25; sequence_interleaver.set_interleaver_depth(depth); sequence_interleaver.randomize_interleaver_sequence(); input = "1:25"; output = sequence_interleaver.interleave(input); deinterleaved = sequence_interleaver.deinterleave(output); ref = "19 1 7 6 10 18 2 14 3 23 4 15 16 21 11 24 13 9 12 25 17 22 5 8 20"; assert_ivec(ref, output); assert_ivec(input, deinterleaved); } itpp-4.3.1/gtests/inv_test.cpp000066400000000000000000000077611216575753400163750ustar00rootroot00000000000000/*! * \file * \brief Matrix inversion routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static void assert_mat(const mat &exp, const mat &act) { static const double eps = 1e-5; ASSERT_EQ(exp.rows(), act.rows()); ASSERT_EQ(exp.cols(), act.cols()); for (int n = 0; n < exp.rows(); ++n) { for (int k = 0; k < exp.cols(); ++k) { ASSERT_NEAR(exp(n,k), act(n,k), eps); } } } static void assert_cmat(const cmat &exp, const cmat &act) { static const double eps = 1e-5; ASSERT_EQ(exp.rows(), act.rows()); ASSERT_EQ(exp.cols(), act.cols()); for (int n = 0; n < exp.rows(); ++n) { for (int k = 0; k < exp.cols(); ++k) { ASSERT_NEAR(exp(n,k).real(), act(n,k).real(), eps); ASSERT_NEAR(exp(n,k).imag(), act(n,k).imag(), eps); } } } TEST (Inv, All) { // Test of Matrix inversion routines RNG_reset(0); { // Real matrix mat X = randn(5, 5), Y; Y = inv(X); mat Y_ref = "1.02914 0.086169 2.46109 -0.54101 2.55964;" "6.03751 0.193059 7.44752 -1.88403 12.0398;" "0.636496 -0.231074 0.457221 -0.233538 1.23596;" "-4.4763 -0.0890091 -4.95943 1.47648 -7.56113;" "3.87823 -0.0536348 4.65722 -0.486929 7.74427"; assert_mat(Y_ref, Y); X = randn(5, 5); Y = inv(X); Y_ref = "3.18059 -3.97463 2.92744 0.223873 2.60524;" "2.31265 -2.53672 1.42136 0.543372 1.29475;" "-1.10003 0.582699 -0.380368 -0.218256 -0.819337;" "-1.18654 0.94806 -0.743228 0.142985 -0.664563;" "-2.37153 3.2677 -1.79564 -0.228335 -1.83916"; assert_mat(Y_ref, Y); } { // Complex matrix cmat X = randn_c(5, 5), Y; Y = inv(X); cmat Y_ref = "-0.233219-0.564957i 0.289735+0.149868i 0.470503+0.172316i 0.461592+0.104654i -0.341534-0.150273i;" "-0.458316-0.459834i -0.0783873+0.212039i 0.266618-0.511581i 0.0741277-0.555698i -0.325349+0.120556i;" "-0.199788-0.443033i 0.168852+0.46391i 0.881415-0.198862i 0.891107-0.532156i -1.02218+0.518232i;" "-0.513695-0.0187012i 0.357327-0.185935i 0.0794018-0.0419093i -0.240815-0.251631i -0.301137+0.182979i;" "-0.823673+0.556726i 0.116893+0.0113572i -1.17761-0.221457i -1.08623-0.382027i 1.03425+0.763366i"; assert_cmat(Y_ref, Y); X = randn_c(5, 5); Y = inv(X); Y_ref = "-0.612452-1.18464i -0.491647-1.60476i 0.242101+0.273005i 0.354203+0.915628i -0.775818+0.913778i;" "-0.0387323-0.968675i -0.0942719-0.428252i -0.0993426+0.234267i -0.153272+0.210774i -0.504668-0.046527i;" "-0.78825+0.122621i -0.145274+0.16973i 0.264336+0.14154i 0.142947-0.44944i -0.297705+0.396744i;" "-0.998674+0.323841i -1.24939+1.84618i -0.364234+0.311316i 0.681211-1.20705i 0.512001+0.157226i;" "-0.729248+1.85844i -0.952761+2.86892i 0.410097+0.0181813i 0.0702624-1.47188i 1.2297+0.186874i"; assert_cmat(Y_ref, Y); } } itpp-4.3.1/gtests/itfile_test.cpp000066400000000000000000000211231216575753400170410ustar00rootroot00000000000000/*! * \file * \brief IT file endianness test program * \author Andy Panov and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" #include using namespace itpp; using namespace std; // To rewrite the ITFILE_TEST_FILE uncomment the following definition // #define SAVE_DATA const string test_file_name = ITFILE_TEST_FILE; //reference data; const char c_ref = 'c'; const bool bo_ref = true; const bin b_ref = 0; const short s_ref = 1234; const int i_ref = -1234567890; const float f_ref = -12345.6f; const double d_ref = 2.1e-8; const complex cd_ref = std::complex(1.0, -1.5); const string st_ref = "abcdefghij 0123456789"; const bvec bv_ref = "0 1 0 1 1"; const ivec iv_ref = "2 5 -400 2 -10"; const vec v_ref = "1e-9 0.2 0.7 -1.0 0.0"; const cvec cv_ref = "(0,2) (1.5,7.2)"; const bmat bm_ref = "0 1 0; 1 1 1"; const imat im_ref = "2 5; 4 -10; 0 3"; const mat m_ref = "1e-9 0.2 0.7; -1.0 0.0 3e10"; const cmat cm_ref = "(0,2) (-1.5,7.2); (1.1,2) (7,-4e-5)"; const Array abv_ref = "{[0 1] [0 0 0] [1 0] [1 1 0]}"; const Array aiv_ref = "{[1 2 3] [4 5 6] [7 8 9]}"; const Array av_ref = "{[1 2e4 -3.0] [-0.5 6e-9] [7e-3]}"; const Array acv_ref = "{[(0,2) (0.5,-0.5)] [(2,1)] [(0,0) (-4.6,2)]}"; const Array abm_ref = "{[0 1 0; 0 0 1] [1 1; 0 0; 1 0] [1; 1; 0]}"; const Array aim_ref = "{[0 2 3; 0 -1 9; 2 3 -1] [1 10 100] [0 4; -2 3]}"; const Array am_ref = "{[0.5 2e7; 0.5 -0.5] [1e-4 3 4; 0.1 0.2 .3]}"; const Array acm_ref = "{[(0,2) (0.5,-0.5); (2,1) (0,0)] " "[(1.1,2) (7,-4e-5); (0,2) (1.5,7.2)]}"; const string contents_list_ref[] = { " c int8 1 char variable", " bo bool 1 bool variable", " b bin 1 bin variable", " s int16 2 short int variable", " i int32 4 int variable", " f float32 4 ", " d float64 8 ", " cd cfloat64 16 ", " st string 29 ", " bv bvec 13 ", " iv ivec 28 ", " v dvec 48 ", " cv dcvec 40 ", " bm bmat 22 ", " im imat 40 ", " m dmat 64 ", " cm dcmat 80 ", " abv bvecArray 50 ", " aiv ivecArray 68 ", " av vecArray 80 ", " acv cvecArray 112 ", " abm bmatArray 71 ", " aim imatArray 120 ", " am matArray 120 ", " acm cmatArray 168 " }; namespace itpp{ //comparison of two arrays template bool operator==(const itpp::Array l, const itpp::Array r) { if (l.length() != r.length()) return false; for(int i = 0; i < l.length(); ++i) if(l(i) != r(i)) return false; return true; } } //checker and item list extraction helpers template inline void check_equality(const T& val, const T& ref) { ASSERT_EQ(val, ref) << "equality failure for " << typeid(T).name() << endl; } int list_file_contents(it_ifile& f, ostream& str) { std::string name, type, desc; uint64_t size; int n = 0; while (f.seek(n++)) { f.info(name, type, desc, size); str << setw(4) << name << setw(12) << type << setw(7) << size << " " << desc << endl; } return n - 1; } //base class for ItFile tests class ItFileTest : public ::testing::Test { protected: static void SetUpTestCase() { #ifdef SAVE_DATA it_file fw; fw.open(test_file_name, true); fw << Name("c", "char variable") << c_ref; fw << Name("bo", "bool variable") << bo_ref; fw << Name("b", "bin variable") << b_ref; fw << Name("s", "short int variable") << s_ref; fw << Name("i", "int variable") << i_ref; fw << Name("f") << f_ref; fw << Name("d") << d_ref; fw << Name("cd") << cd_ref; fw << Name("st") << st_ref; fw << Name("bv") << bv_ref; fw << Name("iv") << concat(iv_ref, iv_ref, iv_ref); fw << Name("v") << v_ref; fw << Name("cv") << cv_ref; fw << Name("bm") << bm_ref; fw << Name("im") << im_ref; fw << Name("m") << m_ref; fw << Name("cm") << cm_ref; fw << Name("abv") << abv_ref; fw << Name("aiv") << aiv_ref; fw << Name("av") << av_ref; fw << Name("acv") << acv_ref; fw << Name("abm") << abm_ref; fw << Name("aim") << aim_ref; fw << Name("am") << am_ref; fw << Name("acm") << acm_ref; fw.remove("iv"); fw << Name("iv") << iv_ref; fw.close(); #endif } }; //it_file contents TEST_F(ItFileTest, Contents) { stringstream str; it_ifile ff(test_file_name); int items_read = list_file_contents(ff,str); string cur; int i = 0; while(getline(str,cur)) { ASSERT_EQ(cur, contents_list_ref[i])<< "item info mismatch for item #" << i << endl; ++i; } } //it_file extraction test TEST_F(ItFileTest, Extraction) { it_ifile ff(test_file_name); char c; bool bo; bin b; short s; int i; float f; double d; complex cd; string st; bvec bv; ivec iv; vec v; cvec cv; bmat bm; imat im; mat m; cmat cm; Array abv; Array aiv; Array av; Array acv; Array abm; Array aim; Array am; Array acm; ff >> Name("abm") >> abm; check_equality(abm,abm_ref); ff >> Name("abv") >> abv; check_equality(abv,abv_ref); ff >> Name("acm") >> acm; check_equality(acm,acm_ref); ff >> Name("acv") >> acv; check_equality(acv,acv_ref); ff >> Name("aim") >> aim; check_equality(aim,aim_ref); ff >> Name("aiv") >> aiv; check_equality(aiv,aiv_ref); ff >> Name("am") >> am; check_equality(am,am_ref); ff >> Name("av") >> av; check_equality(av,av_ref); ff >> Name("b") >> b; check_equality(b,b_ref); ff >> Name("bm") >> bm; check_equality(bm,bm_ref); ff >> Name("bo") >> bo; check_equality(bo,bo_ref); ff >> Name("bv") >> bv; check_equality(bv,bv_ref); ff >> Name("c") >> c; check_equality(c,c_ref); ff >> Name("cd") >> cd; check_equality(cd,cd_ref); ff >> Name("cm") >> cm; check_equality(cm,cm_ref); ff >> Name("cv") >> cv; check_equality(cv,cv_ref); ff >> Name("d") >> d; check_equality(d,d_ref); ff >> Name("f") >> f; check_equality(f,f_ref); ff >> Name("i") >> i; check_equality(i,i_ref); ff >> Name("im") >> im; check_equality(im,im_ref); ff >> Name("iv") >> iv; check_equality(iv,iv_ref); ff >> Name("m") >> m; check_equality(m,m_ref); ff >> Name("s") >> s; check_equality(s,s_ref); ff >> Name("st") >> st; check_equality(st,st_ref); ff >> Name("v") >> v; check_equality(v,v_ref); ff.close(); } //this test verifies deletion and packing of it_file items TEST_F(ItFileTest, Packing) { ivec iv0 = "0 0"; ivec iv1 = ones_i(100); ivec iv2 = "2 2 2 2"; ivec iv3 = "3"; it_file ff1("itfile_test_pack.it", true); ff1 << Name("iv0") << iv0 << flush; ff1 << Name("iv1") << iv1 << flush; ff1 << Name("iv2") << iv2 << flush; ff1.remove("iv1"); ff1 << Name("iv1") << ivec("1") << flush; ff1 << Name("iv3") << iv3 << flush; ff1 << Name("iv4") << iv3 << flush; ff1.remove("iv3"); ff1.low_level().seekg(0, std::ios::end); streamsize before_packing = ff1.low_level().tellg(); ff1.pack(); //ensure that file was squeezed by the previous pack operation ff1.low_level().seekg(0, std::ios::end); ASSERT_LT(ff1.low_level().tellg(), before_packing) << "size squeeze failure after packing" << std::endl; ff1.close(); } itpp-4.3.1/gtests/itfile_test_data.it000066400000000000000000000042031216575753400176640ustar00rootroot00000000000000IT++-.cint8char variablec./boboolbool variable+,bbinbin variable35sint16short int variable-1iint32int variable.i#'ffloat32f@#+dfloat64oV>%5cdcfloat64?#@ststringabcdefghij 0123456789! .bvbvec!eivivecppp 0Pvdvec& .>?ffffff?"(Jcvdcvec@?@!7bmbmat!(Iimimat @`mdmat& .>𿚙?ffffff?B"Prcmdcmat@?@@@h㈵'2YabvbvecArray'DkaivivecArray %PuavvecArray?@A:9>y&1|?'pacvcvecArray@?@?ffffff@'GnabmbmatArray'xaimimatArray  d%xammatArray??sA-C6??@?@333333?'acmcmatArray@@???@@@h㈵?@itpp-4.3.1/gtests/ldpc_test.cpp000066400000000000000000000060521216575753400165130ustar00rootroot00000000000000/*! * \file * \brief LDPC class test program * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(LDPC, All) { RNG_reset(0); int n; LDPC_Parity_Regular H; H.generate(200, 3, 6, "rand", "100 6"); int girth = H.cycle_removal_MGW(6); ASSERT_EQ(6, girth); LDPC_Generator_Systematic G; G.construct(&H); LDPC_Code C(&H, &G); C.save_code("ldpc_test.codec"); LDPC_Code C1("ldpc_test.codec", &G); ASSERT_EQ(200, C.get_nvar()); ASSERT_EQ(100, C.get_ncheck()); ASSERT_DOUBLE_EQ(0.5, C.get_rate()); bvec bitsin = randb(C.get_nvar() - C.get_ncheck()); bvec bitsout; C.encode(bitsin, bitsout); ASSERT_TRUE(C.syndrome_check(bitsout)) << "syndrome check failed"; double EbN0db = 1.5; double N0 = pow(10.0, -EbN0db / 10.0) / C.get_rate(); double sigma = sqrt(N0 / 2.0); vec x = 1.0 + sigma * randn(C.get_nvar()); QLLRvec LLRin = C.get_llrcalc().to_qllr(2.0 * x / (N0 / 2.0)); QLLRvec LLRout(C.get_nvar()); C.bp_decode(LLRin, LLRout); QLLRvec LLRout_ref = "27277 29922 2454 37509 36082 1560 25684 39929 29353 29133 26578 42497 39556 22777 " "47940 32903 35425 17665 35097 33419 18795 31183 30935 27616 20303"; QLLRvec LLRout_act = LLRout.left(25); for (n = 0; n < LLRout_act.length(); ++n) { ASSERT_EQ(LLRout_ref(n), LLRout_act(n)); } // BLDPC code { imat A = "0 -1 -1 0; -1 1 4 -1; -1 2 -1 6"; imat B = "1; -1; 2"; imat T = "0 -1 -1; 0 0 -1; -1 0 0"; imat C = "3 -1 5 -1"; imat D = "3"; imat E = "-1 -1 0"; // base matrix imat H_b = concat_vertical(concat_horizontal(concat_horizontal(A, B), T), concat_horizontal(concat_horizontal(C, D), E)); int Z = 4; // expansion factor BLDPC_Parity H(H_b, Z); BLDPC_Generator G(&H); bvec in_bits = randb(H.get_nvar() - H.get_ncheck()); bvec codeword; G.encode(in_bits, codeword); bvec cw_ref = "0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 0 0"; for (n = 0; n < cw_ref.length(); ++n) { ASSERT_EQ(cw_ref(n), codeword(n)); } } } itpp-4.3.1/gtests/linspace_test.cpp000066400000000000000000000117711216575753400173730ustar00rootroot00000000000000/*! * \file * \brief linspace functions test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static void assert_vec(const vec &ref, const vec &act) { static const double TOL = 1e-12; ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), TOL); } } TEST(Linspace, All) { double from = 0; double to = 2; int points = 1; vec v = linspace(from, to, points); ASSERT_EQ(points, v.length()); ASSERT_EQ(to, v(0)); from = 0; to = 10; points = 30; v = linspace(from, to, points); ASSERT_EQ(points, v.length()); vec actual_v(v.length()); int n; for (n = 0; n < v.length()-1; ++n) { actual_v(n) = n*(to-from)/(points-1); } actual_v(n) = to; assert_vec(actual_v, v); from = 0; to = 10; double step = 1.0; v = linspace_fixed_step(from, to, step); int actual_len = floor_i((to-from)/step)+1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } assert_vec(actual_v, v); from = 0; to = 10; step = 1.1; v = linspace_fixed_step(from, to, step); actual_len = floor_i((to-from)/step)+1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } assert_vec(actual_v, v); from = 0; to = 1; step = 2; v = linspace_fixed_step(from, to, step); actual_len = 1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } assert_vec(actual_v, v); from = 0; to = -1; step = -2; v = linspace_fixed_step(from, to, step); actual_len = 1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } assert_vec(actual_v, v); from = 0; to = -1; step = 2; v = linspace_fixed_step(from, to, step); actual_len = 0; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); ASSERT_TRUE(v == actual_v); from = -1; to = 0; step = 2; v = linspace_fixed_step(from, to, step); actual_len = 1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); actual_v(0) = from; ASSERT_TRUE(v == actual_v); from = -1; to = 0; step = -2; v = linspace_fixed_step(from, to, step); actual_len = 0; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); ASSERT_TRUE(v == actual_v); from = -5; to = 5; step = 2; v = linspace_fixed_step(from, to, step); actual_len = floor_i((to-from)/step)+1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } ASSERT_TRUE(v == actual_v); from = 5; to = -5; step = -2; v = linspace_fixed_step(from, to, step); actual_len = floor_i((to-from)/step)+1; ASSERT_EQ(actual_len, v.length()); actual_v.set_size(actual_len); for (n = 0; n < actual_len; ++n) { actual_v(n) = from+n*step; } ASSERT_TRUE(v == actual_v); int ifrom = 0; int ito = 10; ivec iv = linspace_fixed_step(ifrom, ito); actual_len = floor_i(ito-ifrom)+1; ASSERT_EQ(actual_len, iv.length()); ivec actual_iv(actual_len); for (n = 0; n < actual_iv.length(); ++n) { actual_iv(n) = ifrom+n; } ASSERT_TRUE(iv == actual_iv); short int sfrom = 0; short int sto = 10; svec sv = linspace_fixed_step(sfrom, sto); actual_len = floor_i(sto-sfrom)+1; ASSERT_EQ(actual_len, sv.length()); svec actual_sv(actual_len); for (n = 0; n < actual_sv.length(); ++n) { actual_sv(n) = sfrom+n; } ASSERT_TRUE(sv == actual_sv); } itpp-4.3.1/gtests/llr_test.cpp000066400000000000000000000152211216575753400163600ustar00rootroot00000000000000/*! * \file * \brief Test program for the LLR class * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(LLR, All) { const double tol = 1e-6; LLR_calc_unit lcu1; // standard table resolution LLR_calc_unit lcu2(10, 7, 9); // low table resolution LLR_calc_unit lcu3(2, 15, 0); // low table resolution and low LLR granuality LLR_calc_unit lcu4(10, 0, 0); // this gives logexp=logmax ivec ref = "12 300 7"; ASSERT_TRUE(ref == lcu1.get_Dint()); ref = "10 7 9"; ASSERT_TRUE(ref == lcu2.get_Dint()); ref = "2 15 0"; ASSERT_TRUE(ref == lcu3.get_Dint()); ref = "10 0 0"; ASSERT_TRUE(ref == lcu4.get_Dint()); // Testing Jacobian logarithm with four different resolutions mat ref_m = "0.693115 0.693359 0.75 0;" "0.647461 0.693359 0.75 0;" "0.60376 0.693359 0.5 0;" "0.562256 0.693359 0.5 0;" "0.523193 0.693359 0.5 0;" "0.474121 0.473633 0.5 0;" "0.439697 0.473633 0.5 0;" "0.407471 0.473633 0.5 0;" "0.376953 0.473633 0.5 0;" "0.348389 0.473633 0.25 0;" "0.313232 0.313477 0.25 0;" "0.288818 0.313477 0.25 0;" "0.266113 0.313477 0.25 0;" "0.245117 0.313477 0.25 0;" "0.225342 0.313477 0.25 0;" "0.201416 0.201172 0.25 0;" "0.185059 0.201172 0.25 0;" "0.169678 0.201172 0.25 0;" "0.155762 0.201172 0.25 0;" "0.142578 0.201172 0.25 0;" "0.126953 0.126953 0.25 0;" "0.116211 0.126953 0.25 0;" "0.106445 0.126953 0 0;" "0.097168 0.126953 0 0;" "0.0888672 0.126953 0 0;" "0.0788574 0.0791016 0 0;" "0.0720215 0.0791016 0 0;" "0.065918 0.0791016 0 0;" "0.0600586 0.0791016 0 0;" "0.0549316 0.0791016 0 0;" "0.048584 0.0488281 0 0;" "0.0444336 0.0488281 0 0;" "0.0405273 0.0488281 0 0;" "0.0368652 0.0488281 0 0;" "0.0336914 0.0488281 0 0;" "0.0297852 0 0 0;" "0.0270996 0 0 0;" "0.0246582 0 0 0;" "0.0224609 0 0 0;" "0.0205078 0 0 0;" "0.0180664 0 0 0;" "0.0166016 0 0 0;" "0.0151367 0 0 0;" "0.0136719 0 0 0;" "0.0124512 0 0 0;" "0.0109863 0 0 0;" "0.0100098 0 0 0;" "0.00927734 0 0 0;" "0.00830078 0 0 0;" "0.00756836 0 0 0;" "0.00683594 0 0 0;" "0.00610352 0 0 0;" "0.00561523 0 0 0;" "0.00512695 0 0 0;" "0.00463867 0 0 0;" "0.00415039 0 0 0;" "0.00366211 0 0 0;" "0.00341797 0 0 0;" "0.00317383 0 0 0;" "0.00268555 0 0 0;" "0.00244141 0 0 0;" "0.00219727 0 0 0;" "0.00195312 0 0 0;" "0.00195312 0 0 0;" "0.00170898 0 0 0;" "0.00146484 0 0 0;" "0.00146484 0 0 0;" "0.0012207 0 0 0;" "0.0012207 0 0 0;" "0.000976562 0 0 0;" "0.000976562 0 0 0;" "0.000732422 0 0 0;" "0.000732422 0 0 0;" "0.000732422 0 0 0;" "0.000732422 0 0 0;" "0.000488281 0 0 0;" "0.000488281 0 0 0;" "0.000488281 0 0 0;" "0.000488281 0 0 0;" "0.000488281 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0.000244141 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0;" "0 0 0 0"; int n = 0; for (double x = 0.0; x < 10; x += 0.1, ++n) { ASSERT_NEAR(ref_m(n,0), lcu1.to_double(lcu1.logexp(lcu1.to_qllr(x))), tol); ASSERT_NEAR(ref_m(n,1), lcu2.to_double(lcu2.logexp(lcu2.to_qllr(x))), tol); ASSERT_NEAR(ref_m(n,2), lcu3.to_double(lcu3.logexp(lcu3.to_qllr(x))), tol); ASSERT_NEAR(ref_m(n,3), lcu4.to_double(lcu4.logexp(lcu4.to_qllr(x))), tol); } ASSERT_NEAR(0.75, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(100.0), lcu1.to_qllr(0.75))), tol); ASSERT_NEAR(-0.75, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(100.0), lcu1.to_qllr(-0.75))), tol); ASSERT_NEAR(-0.75, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-100.0), lcu1.to_qllr(0.75))), tol); ASSERT_NEAR(0.75, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-100.0), lcu1.to_qllr(-0.75))), tol); ASSERT_NEAR(0, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(0.0), lcu1.to_qllr(0.75))), tol); ASSERT_NEAR(0, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(0.0), lcu1.to_qllr(-0.75))), tol); ASSERT_NEAR(-1.177978515625, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(3.75), lcu1.to_qllr(-1.25))), tol); ASSERT_NEAR(-1.177978515625, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-1.25), lcu1.to_qllr(3.75))), tol); ASSERT_NEAR(-1.177978515625, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-3.75), lcu1.to_qllr(1.25))), tol); ASSERT_NEAR(-1.177978515625, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(1.25), lcu1.to_qllr(-3.75))), tol); ASSERT_NEAR(1.177978515625, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(3.75), lcu1.to_qllr(1.25))), tol); ASSERT_NEAR(1.177978515625, lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(1.25), lcu1.to_qllr(3.75))), tol); } itpp-4.3.1/gtests/ls_solve_test.cpp000066400000000000000000000144131216575753400174170ustar00rootroot00000000000000/*! * \file * \brief Linear systems of equations solving test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static const double tol = 1e-4; static void assert_vec(const vec &ref, const vec &act) { ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref[n], act[n], tol); } } static void assert_cvec(const cvec &ref, const cvec &act) { ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref[n].real(), act[n].real(), tol); ASSERT_NEAR(ref[n].imag(), act[n].imag(), tol); } } static void assert_mat(const mat &ref, const mat &act) { ASSERT_EQ(ref.rows(), act.rows()); ASSERT_EQ(ref.cols(), act.cols()); for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol); } } } static void assert_cmat(const cmat &ref, const cmat &act) { ASSERT_EQ(ref.rows(), act.rows()); ASSERT_EQ(ref.cols(), act.cols()); for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k).real(), act(n,k).real(), tol); ASSERT_NEAR(ref(n,k).imag(), act(n,k).imag(), tol); } } } TEST(LS, All) { RNG_reset(0); // Solving linear systems of equations { // Real systems mat A, B, X; vec b, x; A = randn(4, 4); b = randn(4); x = ls_solve(A, b); vec x_ref = "-0.312176 0.00252645 -0.393292 0.493941"; assert_vec(x_ref, x); A = randn(4, 4); B = randn(4, 2); X = ls_solve(A, B); mat X_ref = "-1.55189 -1.50623;" "0.185151 2.98571;" "-0.051986 -0.872471;" "0.0339548 0.426711"; assert_mat(X_ref, X); A = randn(4, 4); A = A.transpose() * A; b = randn(4); x = ls_solve(A, b); x_ref = "6.96571 3.4157 -15.9777 1.67972"; assert_vec(x_ref, x); A = randn(4, 4); A = A.transpose() * A; B = randn(4, 2); X = ls_solve(A, B); X_ref = "0.150362 0.405445;" "-3.54916 -11.7528;" "-0.245019 -1.77316;" "5.35996 14.6563"; assert_mat(X_ref, X); // Overdetermined system A = randn(4, 2); b = randn(4); x = ls_solve_od(A, b); x_ref = "-0.652584 0.39863"; assert_vec(x_ref, x); // Overdetermined system A = randn(4, 2); B = randn(4, 3); X = ls_solve_od(A, B); X_ref = "-1.05062 -0.44978 -0.756015;" "0.937086 0.249577 -0.225774"; assert_mat(X_ref, X); // Underdetermined system A = randn(2, 4); b = randn(2); x = ls_solve_ud(A, b); x_ref = "1.84586 -0.741848 -1.51662 1.72224"; assert_vec(x_ref, x); // Underdetermined system A = randn(2, 4); B = randn(2, 3); X = ls_solve_ud(A, B); X_ref = "-1.33908 -0.190497 -0.653759;" "1.84025 0.443054 0.70934;" "0.396185 -0.331404 0.597969;" "-0.442725 0.0149668 -0.297468"; assert_mat(X_ref, X); } { // Complex systems cmat A, B, X; cvec b, x; // Square system A = randn_c(4, 4); b = randn_c(4); x = ls_solve(A, b); cvec x_ref = "-0.665037-0.657617i -0.258391+0.204449i -1.31542-0.160235i -0.490128+1.08786i"; assert_cvec(x_ref, x); // Square system A = randn_c(4, 4); B = randn_c(4, 2); X = ls_solve(A, B); cmat X_ref = "1.06773+0.57688i 1.72069-0.274636i;" "0.642428-0.433694i 1.77196+0.66473i;" "0.465216-2.37791i 0.302972-2.9492i;" "0.188992-0.408485i -0.849173-0.00855581i"; assert_cmat(X_ref, X); // Square system (chol) A = randn_c(4, 4); A = A.transpose() * A; b = randn_c(4); x = ls_solve(A, b); x_ref = "0.656667-0.696584i 0.448907+0.212332i -0.73524-1.06406i 0.991158-0.396795i"; assert_cvec(x_ref, x); // Square system (Chol) A = randn_c(4, 4); A = A.transpose() * A; B = randn_c(4, 2); X = ls_solve(A, B); X_ref = "0.102859-2.48984i 5.31307-0.364868i;" "-0.460786+1.98873i -5.60124+0.500538i;" "-1.26409+0.955385i -2.9779-2.32294i;" "-1.13999-0.738824i 1.12245-4.405i"; assert_cmat(X_ref, X); // Overdetermined system A = randn_c(4, 2); b = randn_c(4); x = ls_solve_od(A, b); x_ref = "0.0737946+0.819157i 0.0650055+0.0621781i"; assert_cvec(x_ref, x); // Overdetermined system A = randn_c(4, 2); B = randn_c(4, 3); X = ls_solve_od(A, B); X_ref = "-0.796269+0.064283i -0.57216-0.000698553i 0.365305-0.067377i;" "0.845856-0.416823i -0.264445-0.73061i -0.853229+0.231852i"; assert_cmat(X_ref, X); // Underdetermined system A = randn_c(2, 4); b = randn_c(2); x = ls_solve_ud(A, b); x_ref = "-0.0430224+0.0471777i -0.0200806-0.0467243i 0.234193-0.2424i 0.421536+0.260783i"; assert_cvec(x_ref, x); // Underdetermined system A = randn_c(2, 4); B = randn_c(2, 3); X = ls_solve_ud(A, B); X_ref = "-0.314656-0.0734181i 0.110243-0.333847i 0.084258+0.0813639i;" "-0.234372-0.0964481i -0.0627429-0.292354i 0.571474+0.0219301i;" "0.0852421-0.00435951i 0.0685549+0.00636267i -0.129461+0.265599i;" "-0.23233-0.188923i -0.0575991+0.0723313i 0.472732-0.915352i"; assert_cmat(X_ref, X); } } itpp-4.3.1/gtests/lu_test.cpp000066400000000000000000000032671216575753400162160ustar00rootroot00000000000000/*! * \file * \brief LU factorization routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(LU, All) { // Test of LU factorization routines RNG_reset(0); static const double tol = 1e-10; { // Real matrix mat X = randn(5, 5); mat L, U; ivec p; lu(X, L, U, p); mat P = to_mat(permutation_matrix(p)); ASSERT_NEAR(0, norm(X - transpose(P) * L * U), tol); } { // Complex matrix cmat X = randn_c(5, 5); cmat L, U; ivec p; lu(X, L, U, p); mat P = to_mat(permutation_matrix(p)); ASSERT_NEAR(0, norm(X - hermitian_transpose(P) * L * U), tol); } } itpp-4.3.1/gtests/mat_test.cpp000066400000000000000000001422701216575753400163550ustar00rootroot00000000000000/*! * \file * \brief Matrix class test program * \author Tony Ottosson, Adam Piatyszek and Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static const double tol = 1e-5; static void common_operators(const bmat &A, const bmat &B, const bmat &C, const bvec &u, const bvec &v, bin c) { // indexing ASSERT_TRUE(bin(0) == A(1,2)); ASSERT_TRUE(bin(0) == A(2, 3)); ASSERT_TRUE(bin(1) == A(6)); bmat ref_m = "1 1 1;" "0 0 0;" "1 0 0"; ASSERT_TRUE(ref_m == A(0, 2, 1, 3)); bvec ref_v = "1 0 0 0"; ASSERT_TRUE(ref_v == A.get_row(1)); ref_m = "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A.get_rows(1, 2)); ref_v = "1 0 0"; ASSERT_TRUE(ref_v == A.get_col(2)); ref_m = "1 1;" "0 0;" "0 0"; ASSERT_TRUE(ref_m == A.get_cols(2, 3)); // setting, copying, swapping bmat Mv(v); ref_m = "1; 1; 0; 1"; ASSERT_TRUE(ref_m == Mv); bmat D(A); ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); ref_m = "1 1 1 1 0;" "1 0 0 0 0;" "1 1 0 0 0;" "0 0 0 0 0;" "0 0 0 0 0;" "0 0 0 0 0"; D.set_size(6, 5, true); ASSERT_TRUE(ref_m == D); D.set_size(3, 2, true); ref_m = "1 1;" "1 0;" "1 1"; ASSERT_TRUE(ref_m == D); D.zeros(); ref_m = "0 0;" "0 0;" "0 0"; ASSERT_TRUE(ref_m == D); D.ones(); ref_m = "1 1;" "1 1;" "1 1"; ASSERT_TRUE(ref_m == D); D = A; ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D(2, 2) = c; ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D(9) = c; ref_m = "1 1 1 0;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.set(0, 1, c); ref_m = "1 0 1 0;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.set_row(1, v); ref_m = "1 0 1 0;" "1 1 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.set_col(2, u); ref_m = "1 0 1 0;" "1 1 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.set_rows(0, B.get_rows(1, 2)); ref_m = "1 0 0 1;" "1 1 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.set_cols(2, B.get_cols(0, 1)); ref_m = "1 0 0 1;" "1 1 1 0;" "1 1 1 1"; ASSERT_TRUE(ref_m == D); D.copy_row(1, 2); ref_m = "1 0 0 1;" "1 1 1 1;" "1 1 1 1"; ASSERT_TRUE(ref_m == D); D.copy_col(2, 3); ref_m = "1 0 1 1;" "1 1 1 1;" "1 1 1 1"; ASSERT_TRUE(ref_m == D); D.swap_rows(0, 2); ref_m = "1 1 1 1;" "1 1 1 1;" "1 0 1 1"; ASSERT_TRUE(ref_m == D); D.swap_cols(0, 3); ref_m = "1 1 1 1;" "1 1 1 1;" "1 0 1 1"; ASSERT_TRUE(ref_m == D); D.set_submatrix(1, 2, A(0, 1, 0, 1)); ref_m = "1 1 1 1;" "1 1 1 1;" "1 0 1 0"; ASSERT_TRUE(ref_m == D); D.set_submatrix(0, 0, A(0, 1, 0, 1)); ref_m = "1 1 1 1;" "1 0 1 1;" "1 0 1 0"; ASSERT_TRUE(ref_m == D); D.set_submatrix(1, 2, 2, 3, c); ref_m = "1 1 1 1;" "1 0 0 0;" "1 0 0 0"; ASSERT_TRUE(ref_m == D); // transposition ref_m = "1 1 1;" "1 0 1;" "1 0 0;" "1 0 0"; ASSERT_TRUE(ref_m == A.T()); ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A.T().T()); ref_m = "1 1 1;" "1 0 1;" "1 0 0;" "1 0 0"; ASSERT_TRUE(ref_m == A.H()); // concatenation D = concat_horizontal(A, B); ref_m = "1 1 1 1 0 1 1 0;" "1 0 0 0 1 0 0 1;" "1 1 0 0 1 1 0 0"; ASSERT_TRUE(ref_m == D); D = concat_vertical(A, B); ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0;" "0 1 1 0;" "1 0 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); // deleting rows, cols D.del_row(2); ref_m = "1 1 1 1;" "1 0 0 0;" "0 1 1 0;" "1 0 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.del_rows(0, 2); ref_m = "1 0 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == D); D.del_col(3); ref_m = "1 0 0;" "1 1 0"; ASSERT_TRUE(ref_m == D); D.del_cols(0, 1); ref_m = "0; 0"; ASSERT_TRUE(ref_m == D); // inserting, appending rows cols bmat A2 = A; A2.ins_row(1, v); ref_m = "1 1 1 1;" "1 1 0 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A2); A2.ins_col(0, v); ref_m = "1 1 1 1 1;" "1 1 1 0 1;" "0 1 0 0 0;" "1 1 1 0 0"; ASSERT_TRUE(ref_m == A2); A2.append_col(A2.get_col(3)); ref_m = "1 1 1 1 1 1;" "1 1 1 0 1 0;" "0 1 0 0 0 0;" "1 1 1 0 0 0"; ASSERT_TRUE(ref_m == A2); A2.append_row(A2.get_row(0)); ref_m = "1 1 1 1 1 1;" "1 1 1 0 1 0;" "0 1 0 0 0 0;" "1 1 1 0 0 0;" "1 1 1 1 1 1"; ASSERT_TRUE(ref_m == A2); // addition ref_m = "1 0 0 1;" "0 0 0 1;" "0 0 0 0"; ASSERT_TRUE(ref_m == (A + B)); ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == (A + c)); ASSERT_TRUE(ref_m == (c + A)); A2 = A; A2 += B; ref_m = "1 0 0 1;" "0 0 0 1;" "0 0 0 0"; ASSERT_TRUE(ref_m == A2); A2 = A; A2 += c; ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A2); // subtraction ref_m = "1 0 0 1;" "0 0 0 1;" "0 0 0 0"; ASSERT_TRUE(ref_m == (A - B)); ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == (A - c)); ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == (c - A)); A2 = A; A2 -= B; ref_m = "1 0 0 1;" "0 0 0 1;" "0 0 0 0"; ASSERT_TRUE(ref_m == A2); A2 = A; A2 -= c; ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A2); ASSERT_TRUE(ref_m == -A); // multiplication ref_m = "0 0 1;" "0 1 1;" "0 1 0"; ASSERT_TRUE(ref_m == A*C); A2 = A; A2 *= C; ref_m = "0 0 1;" "0 1 1;" "0 1 0"; ASSERT_TRUE(ref_m == A2); ref_m = "0 0 0 0;" "0 0 0 0;" "0 0 0 0"; ASSERT_TRUE(ref_m == A*c); ASSERT_TRUE(ref_m == c*A); A2 = A; A2 *= c; ASSERT_TRUE(ref_m == A2); ref_v = "1 1 0;"; ASSERT_TRUE(ref_v == A*v); ref_m = "0 1 1 0;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == elem_mult(A, B)); elem_mult_out(A, B, A2); ref_m = "0 1 1 0;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m ==A2); bmat B2 = B; elem_mult_inplace(A, B2); ref_m = "0 1 1 0;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == B2); ASSERT_TRUE(bin(1) == elem_mult_sum(A, B)); // division ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A / c); A2 = A; A2 /= c; ref_m = "1 1 1 1;" "1 0 0 0;" "1 1 0 0"; ASSERT_TRUE(ref_m == A2); A2 = A; A2 /= B; ref_m = "1 1 1 1;" "1 0 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == A2); ref_m = "1 1 1 1;" "1 0 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == elem_div(A, B)); elem_div_out(A, B, A2); ref_m = "1 1 1 1;" "1 0 0 1;" "1 1 0 0"; ASSERT_TRUE(ref_m == A2); ASSERT_TRUE(bin(0) == elem_div_sum(A, B)); } static void common_operators(const imat &A, const imat &B, const imat &C, const ivec &u, const ivec &v, int c) { // indexing ASSERT_TRUE(4 == A(1,2)); ASSERT_TRUE(4 == A(2, 3)); ASSERT_TRUE(6 == A(6)); imat ref_m = "2 6 6;" "3 4 9;" "8 7 4"; ASSERT_TRUE(ref_m == A(0, 2, 1, 3)); ivec ref_v = "7 3 4 9"; ASSERT_TRUE(ref_v == A.get_row(1)); ref_m = "7 3 4 9;" "2 8 7 4"; ASSERT_TRUE(ref_m == A.get_rows(1, 2)); ref_v = "6 4 7"; ASSERT_TRUE(ref_v == A.get_col(2)); ref_m = "6 6;" "4 9;" "7 4"; ASSERT_TRUE(ref_m == A.get_cols(2, 3)); // setting, copying, swapping imat Mv(v); ref_m = "8; 5; 8; 3"; ASSERT_TRUE(ref_m == Mv); imat D(A); ref_m = "4 2 6 6;" "7 3 4 9;" "2 8 7 4"; ASSERT_TRUE(ref_m == D); ref_m = "4 2 6 6 0;" "7 3 4 9 0;" "2 8 7 4 0;" "0 0 0 0 0;" "0 0 0 0 0;" "0 0 0 0 0"; D.set_size(6, 5, true); ASSERT_TRUE(ref_m == D); D.set_size(3, 2, true); ref_m = "4 2;" "7 3;" "2 8"; ASSERT_TRUE(ref_m == D); D.zeros(); ref_m = "0 0;" "0 0;" "0 0"; ASSERT_TRUE(ref_m == D); D.ones(); ref_m = "1 1;" "1 1;" "1 1"; ASSERT_TRUE(ref_m == D); D = A; ref_m = "4 2 6 6;" "7 3 4 9;" "2 8 7 4"; ASSERT_TRUE(ref_m == D); D(2, 2) = c; ref_m = "4 2 6 6;" "7 3 4 9;" "2 8 8 4"; ASSERT_TRUE(ref_m == D); D(9) = c; ref_m = "4 2 6 8;" "7 3 4 9;" "2 8 8 4"; ASSERT_TRUE(ref_m == D); D.set(0, 1, c); ref_m = "4 8 6 8;" "7 3 4 9;" "2 8 8 4"; ASSERT_TRUE(ref_m == D); D.set_row(1, v); ref_m = "4 8 6 8;" "8 5 8 3;" "2 8 8 4"; ASSERT_TRUE(ref_m == D); D.set_col(2, u); ref_m = "4 8 8 8;" "8 5 9 3;" "2 8 5 4"; ASSERT_TRUE(ref_m == D); D.set_rows(0, B.get_rows(1, 2)); ref_m = "5 9 8 8;" "6 7 8 2;" "2 8 5 4"; ASSERT_TRUE(ref_m == D); D.set_cols(2, B.get_cols(0, 1)); ref_m = "5 9 2 2;" "6 7 5 9;" "2 8 6 7"; ASSERT_TRUE(ref_m == D); D.copy_row(1, 2); ref_m = "5 9 2 2;" "2 8 6 7;" "2 8 6 7"; ASSERT_TRUE(ref_m == D); D.copy_col(2, 3); ref_m = "5 9 2 2;" "2 8 7 7;" "2 8 7 7"; ASSERT_TRUE(ref_m == D); D.swap_rows(0, 2); ref_m = "2 8 7 7;" "2 8 7 7;" "5 9 2 2"; ASSERT_TRUE(ref_m == D); D.swap_cols(0, 3); ref_m = "7 8 7 2;" "7 8 7 2;" "2 9 2 5"; ASSERT_TRUE(ref_m == D); D.set_submatrix(1, 2, A(0, 1, 0, 1)); ref_m = "7 8 7 2;" "7 8 4 2;" "2 9 7 3"; ASSERT_TRUE(ref_m == D); D.set_submatrix(0, 0, A(0, 1, 0, 1)); ref_m = "4 2 7 2;" "7 3 4 2;" "2 9 7 3"; ASSERT_TRUE(ref_m == D); D.set_submatrix(1, 2, 2, 3, c); ref_m = "4 2 7 2;" "7 3 8 8;" "2 9 8 8"; ASSERT_TRUE(ref_m == D); // transposition ref_m = "4 7 2;" "2 3 8;" "6 4 7;" "6 9 4"; ASSERT_TRUE(ref_m == A.T()); ref_m = "4 2 6 6;" "7 3 4 9;" "2 8 7 4"; ASSERT_TRUE(ref_m == A.T().T()); ref_m = "4 7 2;" "2 3 8;" "6 4 7;" "6 9 4"; ASSERT_TRUE(ref_m == A.H()); // concatenation D = concat_horizontal(A, B); ref_m = "4 2 6 6 2 2 1 1;" "7 3 4 9 5 9 8 8;" "2 8 7 4 6 7 8 2"; ASSERT_TRUE(ref_m == D); D = concat_vertical(A, B); ref_m = "4 2 6 6;" "7 3 4 9;" "2 8 7 4;" "2 2 1 1;" "5 9 8 8;" "6 7 8 2"; ASSERT_TRUE(ref_m == D); // deleting rows, cols D.del_row(2); ref_m = "4 2 6 6;" "7 3 4 9;" "2 2 1 1;" "5 9 8 8;" "6 7 8 2"; ASSERT_TRUE(ref_m == D); D.del_rows(0, 2); ref_m = "5 9 8 8;" "6 7 8 2"; ASSERT_TRUE(ref_m == D); D.del_col(3); ref_m = "5 9 8;" "6 7 8"; ASSERT_TRUE(ref_m == D); D.del_cols(0, 1); ref_m = "8; 8"; ASSERT_TRUE(ref_m == D); // inserting, appending rows cols imat A2 = A; A2.ins_row(1, v); ref_m = "4 2 6 6;" "8 5 8 3;" "7 3 4 9;" "2 8 7 4"; ASSERT_TRUE(ref_m == A2); A2.ins_col(0, v); ref_m = "8 4 2 6 6;" "5 8 5 8 3;" "8 7 3 4 9;" "3 2 8 7 4"; ASSERT_TRUE(ref_m == A2); A2.append_col(A2.get_col(3)); ref_m = "8 4 2 6 6 6;" "5 8 5 8 3 8;" "8 7 3 4 9 4;" "3 2 8 7 4 7"; ASSERT_TRUE(ref_m == A2); A2.append_row(A2.get_row(0)); ref_m = "8 4 2 6 6 6;" "5 8 5 8 3 8;" "8 7 3 4 9 4;" "3 2 8 7 4 7;" "8 4 2 6 6 6"; ASSERT_TRUE(ref_m == A2); // addition ref_m = "6 4 7 7;" "12 12 12 17;" "8 15 15 6"; ASSERT_TRUE(ref_m == (A + B)); ref_m = "12 10 14 14;" "15 11 12 17;" "10 16 15 12"; ASSERT_TRUE(ref_m == (A + c)); ASSERT_TRUE(ref_m == (c + A)); A2 = A; A2 += B; ref_m = "6 4 7 7;" "12 12 12 17;" "8 15 15 6"; ASSERT_TRUE(ref_m == A2); A2 = A; A2 += c; ref_m = "12 10 14 14;" "15 11 12 17;" "10 16 15 12"; ASSERT_TRUE(ref_m == A2); // subtraction ref_m = "2 0 5 5;" "2 -6 -4 1;" "-4 1 -1 2"; ASSERT_TRUE(ref_m == (A - B)); ref_m = "-4 -6 -2 -2;" "-1 -5 -4 1;" "-6 0 -1 -4"; ASSERT_TRUE(ref_m == (A - c)); ref_m = "4 6 2 2;" "1 5 4 -1;" "6 0 1 4"; ASSERT_TRUE(ref_m == (c - A)); A2 = A; A2 -= B; ref_m = "2 0 5 5;" "2 -6 -4 1;" "-4 1 -1 2"; ASSERT_TRUE(ref_m == A2); A2 = A; A2 -= c; ref_m = "-4 -6 -2 -2;" "-1 -5 -4 1;" "-6 0 -1 -4"; ASSERT_TRUE(ref_m == A2); ref_m = "-4 -2 -6 -6;" "-7 -3 -4 -9;" "-2 -8 -7 -4"; ASSERT_TRUE(ref_m == -A); // multiplication ref_m = "124 68 72;" "152 81 91;" "156 91 78"; ASSERT_TRUE(ref_m == A*C); A2 = A; A2 *= C; ref_m = "124 68 72;" "152 81 91;" "156 91 78"; ASSERT_TRUE(ref_m == A2); ref_m = "32 16 48 48;" "56 24 32 72;" "16 64 56 32"; ASSERT_TRUE(ref_m == A*c); ASSERT_TRUE(ref_m == c*A); A2 = A; A2 *= c; ASSERT_TRUE(ref_m == A2); ref_v = "108 130 124"; ASSERT_TRUE(ref_v == A*v); ref_m = "8 4 6 6;" "35 27 32 72;" "12 56 56 8"; ASSERT_TRUE(ref_m == elem_mult(A, B)); elem_mult_out(A, B, A2); ref_m = "8 4 6 6;" "35 27 32 72;" "12 56 56 8"; ASSERT_TRUE(ref_m ==A2); imat B2 = B; elem_mult_inplace(A, B2); ref_m = "8 4 6 6;" "35 27 32 72;" "12 56 56 8"; ASSERT_TRUE(ref_m == B2); ASSERT_TRUE(322 == elem_mult_sum(A, B)); // division ref_m = "0 0 0 0;" "0 0 0 1;" "0 1 0 0"; ASSERT_TRUE(ref_m == A / c); A2 = A; A2 /= c; ref_m = "0 0 0 0;" "0 0 0 1;" "0 1 0 0"; ASSERT_TRUE(ref_m == A2); A2 = A; A2 /= B; ref_m = "2 1 6 6;" "1 0 0 1;" "0 1 0 2"; ASSERT_TRUE(ref_m == A2); ref_m = "2 1 6 6;" "1 0 0 1;" "0 1 0 2"; ASSERT_TRUE(ref_m == elem_div(A, B)); elem_div_out(A, B, A2); ref_m = "2 1 6 6;" "1 0 0 1;" "0 1 0 2"; ASSERT_TRUE(ref_m == A2); ASSERT_TRUE(20 == elem_div_sum(A, B)); } static void assert_vec(const vec &ref, const vec &act) { ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref[n], act[n], tol); } } static void assert_mat(const mat &ref, const mat &act) { ASSERT_EQ(ref.rows(), act.rows()); ASSERT_EQ(ref.cols(), act.cols()); for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol); } } } static void common_operators(const mat &A, const mat &B, const mat &C, const vec &u, const vec &v, double c) { // indexing ASSERT_NEAR(0.236765, A(1,2), tol); ASSERT_NEAR(-1.36471, A(2, 3), tol); ASSERT_NEAR(-0.833452, A(6), tol); mat ref_m = "1.21572 -0.833452 -0.0596825;" "-1.48074 0.236765 -0.38619;" "-0.231393 -0.864985 -1.36471"; assert_mat(ref_m, A(0, 2, 1, 3)); vec ref_v = "-1.85156 -1.48074 0.236765 -0.38619"; assert_vec(ref_v, A.get_row(1)); ref_m = "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 -0.864985 -1.36471"; assert_mat(ref_m, A.get_rows(1, 2)); ref_v = "-0.833452 0.236765 -0.864985"; assert_vec(ref_v, A.get_col(2)); ref_m = "-0.833452 -0.0596825;" "0.236765 -0.38619;" "-0.864985 -1.36471"; assert_mat(ref_m, A.get_cols(2, 3)); // setting, copying, swapping mat Mv(v); ref_m = "0.33227; 1.0172; 2.01805; 0.396482"; assert_mat(ref_m, Mv); mat D(A); ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 -0.864985 -1.36471"; assert_mat(ref_m, D); ref_m = "0.23575 1.21572 -0.833452 -0.0596825 0;" "-1.85156 -1.48074 0.236765 -0.38619 0;" "-1.91608 -0.231393 -0.864985 -1.36471 0;" "0 0 0 0 0;" "0 0 0 0 0;" "0 0 0 0 0"; D.set_size(6, 5, true); assert_mat(ref_m, D); D.set_size(3, 2, true); ref_m = "0.23575 1.21572;" "-1.85156 -1.48074;" "-1.91608 -0.231393"; assert_mat(ref_m, D); D.zeros(); ref_m = "0 0;" "0 0;" "0 0"; assert_mat(ref_m, D); D.ones(); ref_m = "1 1;" "1 1;" "1 1"; assert_mat(ref_m, D); D = A; ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 -0.864985 -1.36471"; assert_mat(ref_m, D); D(2, 2) = c; ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 1.84251 -1.36471"; assert_mat(ref_m, D); D(9) = c; ref_m = "0.23575 1.21572 -0.833452 1.84251;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 1.84251 -1.36471"; assert_mat(ref_m, D); D.set(0, 1, c); ref_m = "0.23575 1.84251 -0.833452 1.84251;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 1.84251 -1.36471"; assert_mat(ref_m, D); D.set_row(1, v); ref_m = "0.23575 1.84251 -0.833452 1.84251;" "0.33227 1.0172 2.01805 0.396482;" "-1.91608 -0.231393 1.84251 -1.36471"; assert_mat(ref_m, D); D.set_col(2, u); ref_m = "0.23575 1.84251 -0.275123 1.84251;" "0.33227 1.0172 0.10947 0.396482;" "-1.91608 -0.231393 0.251788 -1.36471"; assert_mat(ref_m, D); D.set_rows(0, B.get_rows(1, 2)); ref_m = "0.542602 1.63002 -0.794633 1.1841;" "0.57172 0.643432 0.502798 -0.237625;" "-1.91608 -0.231393 0.251788 -1.36471"; assert_mat(ref_m, D); D.set_cols(2, B.get_cols(0, 1)); ref_m = "0.542602 1.63002 0.459558 -0.665486;" "0.57172 0.643432 0.542602 1.63002;" "-1.91608 -0.231393 0.57172 0.643432"; assert_mat(ref_m, D); D.copy_row(1, 2); ref_m = "0.542602 1.63002 0.459558 -0.665486;" "-1.91608 -0.231393 0.57172 0.643432;" "-1.91608 -0.231393 0.57172 0.643432"; assert_mat(ref_m, D); D.copy_col(2, 3); ref_m = "0.542602 1.63002 -0.665486 -0.665486;" "-1.91608 -0.231393 0.643432 0.643432;" "-1.91608 -0.231393 0.643432 0.643432"; assert_mat(ref_m, D); D.swap_rows(0, 2); ref_m = "-1.91608 -0.231393 0.643432 0.643432;" "-1.91608 -0.231393 0.643432 0.643432;" "0.542602 1.63002 -0.665486 -0.665486"; assert_mat(ref_m, D); D.swap_cols(0, 3); ref_m = "0.643432 -0.231393 0.643432 -1.91608;" "0.643432 -0.231393 0.643432 -1.91608;" "-0.665486 1.63002 -0.665486 0.542602"; assert_mat(ref_m, D); D.set_submatrix(1, 2, A(0, 1, 0, 1)); ref_m = "0.643432 -0.231393 0.643432 -1.91608;" "0.643432 -0.231393 0.23575 1.21572;" "-0.665486 1.63002 -1.85156 -1.48074"; assert_mat(ref_m, D); D.set_submatrix(0, 0, A(0, 1, 0, 1)); ref_m = "0.23575 1.21572 0.643432 -1.91608;" "-1.85156 -1.48074 0.23575 1.21572;" "-0.665486 1.63002 -1.85156 -1.48074"; assert_mat(ref_m, D); D.set_submatrix(1, 2, 2, 3, c); ref_m = "0.23575 1.21572 0.643432 -1.91608;" "-1.85156 -1.48074 1.84251 1.84251;" "-0.665486 1.63002 1.84251 1.84251"; assert_mat(ref_m, D); // transposition ref_m = "0.23575 -1.85156 -1.91608;" "1.21572 -1.48074 -0.231393;" "-0.833452 0.236765 -0.864985;" "-0.0596825 -0.38619 -1.36471"; assert_mat(ref_m, A.T()); ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 -0.864985 -1.36471"; assert_mat(ref_m, A.T().T()); ref_m = "0.23575 -1.85156 -1.91608;" "1.21572 -1.48074 -0.231393;" "-0.833452 0.236765 -0.864985;" "-0.0596825 -0.38619 -1.36471"; assert_mat(ref_m, A.H()); // concatenation D = concat_horizontal(A, B); ref_m = "0.23575 1.21572 -0.833452 -0.0596825 0.459558 -0.665486 0.751416 -1.30033;" "-1.85156 -1.48074 0.236765 -0.38619 0.542602 1.63002 -0.794633 1.1841;" "-1.91608 -0.231393 -0.864985 -1.36471 0.57172 0.643432 0.502798 -0.237625"; assert_mat(ref_m, D); D = concat_vertical(A, B); ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 -0.864985 -1.36471;" "0.459558 -0.665486 0.751416 -1.30033;" "0.542602 1.63002 -0.794633 1.1841;" "0.57172 0.643432 0.502798 -0.237625"; assert_mat(ref_m, D); // deleting rows, cols D.del_row(2); ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "-1.85156 -1.48074 0.236765 -0.38619;" "0.459558 -0.665486 0.751416 -1.30033;" "0.542602 1.63002 -0.794633 1.1841;" "0.57172 0.643432 0.502798 -0.237625"; assert_mat(ref_m, D); D.del_rows(0, 2); ref_m = "0.542602 1.63002 -0.794633 1.1841;" "0.57172 0.643432 0.502798 -0.237625"; assert_mat(ref_m, D); D.del_col(3); ref_m = "0.542602 1.63002 -0.794633;" "0.57172 0.643432 0.502798"; assert_mat(ref_m, D); D.del_cols(0, 1); ref_m = "-0.794633; 0.502798"; assert_mat(ref_m, D); // inserting, appending rows cols mat A2 = A; A2.ins_row(1, v); ref_m = "0.23575 1.21572 -0.833452 -0.0596825;" "0.33227 1.0172 2.01805 0.396482;" "-1.85156 -1.48074 0.236765 -0.38619;" "-1.91608 -0.231393 -0.864985 -1.36471"; assert_mat(ref_m, A2); A2.ins_col(0, v); ref_m = "0.33227 0.23575 1.21572 -0.833452 -0.0596825;" "1.0172 0.33227 1.0172 2.01805 0.396482;" "2.01805 -1.85156 -1.48074 0.236765 -0.38619;" "0.396482 -1.91608 -0.231393 -0.864985 -1.36471"; assert_mat(ref_m, A2); A2.append_col(A2.get_col(3)); ref_m = "0.33227 0.23575 1.21572 -0.833452 -0.0596825 -0.833452;" "1.0172 0.33227 1.0172 2.01805 0.396482 2.01805;" "2.01805 -1.85156 -1.48074 0.236765 -0.38619 0.236765;" "0.396482 -1.91608 -0.231393 -0.864985 -1.36471 -0.864985"; assert_mat(ref_m, A2); A2.append_row(A2.get_row(0)); ref_m = "0.33227 0.23575 1.21572 -0.833452 -0.0596825 -0.833452;" "1.0172 0.33227 1.0172 2.01805 0.396482 2.01805;" "2.01805 -1.85156 -1.48074 0.236765 -0.38619 0.236765;" "0.396482 -1.91608 -0.231393 -0.864985 -1.36471 -0.864985;" "0.33227 0.23575 1.21572 -0.833452 -0.0596825 -0.833452"; assert_mat(ref_m, A2); // addition ref_m = "0.695308 0.550239 -0.0820359 -1.36001;" "-1.30896 0.149281 -0.557868 0.797913;" "-1.34436 0.412039 -0.362187 -1.60234"; assert_mat(ref_m, (A + B)); ref_m = "2.07826 3.05823 1.00906 1.78283;" "-0.00904911 0.361768 2.07928 1.45632;" "-0.0735664 1.61112 0.977525 0.4778"; assert_mat(ref_m, (A + c)); assert_mat(ref_m, (c + A)); A2 = A; A2 += B; ref_m = "0.695308 0.550239 -0.0820359 -1.36001;" "-1.30896 0.149281 -0.557868 0.797913;" "-1.34436 0.412039 -0.362187 -1.60234"; assert_mat(ref_m, A2); A2 = A; A2 += c; ref_m = "2.07826 3.05823 1.00906 1.78283;" "-0.00904911 0.361768 2.07928 1.45632;" "-0.0735664 1.61112 0.977525 0.4778"; assert_mat(ref_m, A2); // subtraction ref_m = "-0.223808 1.88121 -1.58487 1.24064;" "-2.39416 -3.11076 1.0314 -1.57029;" "-2.4878 -0.874826 -1.36778 -1.12709"; assert_mat(ref_m, (A - B)); ref_m = "-1.60676 -0.626786 -2.67596 -1.90219;" "-3.69407 -3.32325 -1.60574 -2.2287;" "-3.75859 -2.0739 -2.7075 -3.20722"; assert_mat(ref_m, (A - c)); ref_m = "1.60676 0.626786 2.67596 1.90219;" "3.69407 3.32325 1.60574 2.2287;" "3.75859 2.0739 2.7075 3.20722"; assert_mat(ref_m, (c - A)); A2 = A; A2 -= B; ref_m = "-0.223808 1.88121 -1.58487 1.24064;" "-2.39416 -3.11076 1.0314 -1.57029;" "-2.4878 -0.874826 -1.36778 -1.12709"; assert_mat(ref_m, A2); A2 = A; A2 -= c; ref_m = "-1.60676 -0.626786 -2.67596 -1.90219;" "-3.69407 -3.32325 -1.60574 -2.2287;" "-3.75859 -2.0739 -2.7075 -3.20722"; assert_mat(ref_m, A2); ref_m = "-0.23575 -1.21572 0.833452 0.0596825;" "1.85156 1.48074 -0.236765 0.38619;" "1.91608 0.231393 0.864985 1.36471"; assert_mat(ref_m, -A); // multiplication ref_m = "-2.54149 -1.07673 -0.293434;" "2.36426 1.1283 2.94484;" "-2.00345 -1.34274 2.18407"; assert_mat(ref_m, A*C); A2 = A; A2 *= C; ref_m = "-2.54149 -1.07673 -0.293434;" "2.36426 1.1283 2.94484;" "-2.00345 -1.34274 2.18407"; assert_mat(ref_m, A2); ref_m = "0.434372 2.23998 -1.53564 -0.109966;" "-3.41152 -2.72828 0.436242 -0.711559;" "-3.53039 -0.426344 -1.59374 -2.51449"; assert_mat(ref_m, A*c); assert_mat(ref_m, c*A); A2 = A; A2 *= c; ref_m = "0.434372 2.23998 -1.53564 -0.109966;" "-3.41152 -2.72828 0.436242 -0.711559;" "-3.53039 -0.426344 -1.59374 -2.51449"; assert_mat(ref_m, A2); ref_v = "-0.390636 -1.79675 -3.15869"; assert_vec(ref_v, A*v); ref_m = "0.108341 -0.809047 -0.626268 0.0776068;" "-1.00466 -2.41364 -0.188141 -0.457289;" "-1.09546 -0.148886 -0.434913 0.324289"; assert_mat(ref_m, elem_mult(A, B)); elem_mult_out(A, B, A2); ref_m = "0.108341 -0.809047 -0.626268 0.0776068;" "-1.00466 -2.41364 -0.188141 -0.457289;" "-1.09546 -0.148886 -0.434913 0.324289"; assert_mat(ref_m, A2); mat B2 = B; elem_mult_inplace(A, B2); ref_m = "0.108341 -0.809047 -0.626268 0.0776068;" "-1.00466 -2.41364 -0.188141 -0.457289;" "-1.09546 -0.148886 -0.434913 0.324289"; assert_mat(ref_m, B2); ASSERT_NEAR(-6.66807, elem_mult_sum(A, B), tol); // division ref_m = "0.127951 0.65982 -0.452346 -0.032392;" "-1.00491 -0.803655 0.128501 -0.2096;" "-1.03993 -0.125586 -0.46946 -0.74068"; assert_mat(ref_m, A / c); A2 = A; A2 /= c; ref_m = "0.127951 0.65982 -0.452346 -0.032392;" "-1.00491 -0.803655 0.128501 -0.2096;" "-1.03993 -0.125586 -0.46946 -0.74068"; assert_mat(ref_m, A2); A2 = A; A2 /= B; ref_m = "0.512993 -1.82682 -1.10918 0.0458981;" "-3.41237 -0.908418 -0.297955 -0.326145;" "-3.35142 -0.359623 -1.72034 5.74313"; assert_mat(ref_m, A2); ref_m = "0.512993 -1.82682 -1.10918 0.0458981;" "-3.41237 -0.908418 -0.297955 -0.326145;" "-3.35142 -0.359623 -1.72034 5.74313"; assert_mat(ref_m, elem_div(A, B)); elem_div_out(A, B, A2); ref_m = "0.512993 -1.82682 -1.10918 0.0458981;" "-3.41237 -0.908418 -0.297955 -0.326145;" "-3.35142 -0.359623 -1.72034 5.74313"; assert_mat(ref_m, A2); ASSERT_NEAR(-7.01026, elem_div_sum(A, B), tol); } static void assert_vec(const cvec &ref, const cvec &act) { ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref[n].real(), act[n].real(), tol); ASSERT_NEAR(ref[n].imag(), act[n].imag(), tol); } } static void assert_mat_p(const cmat &ref, const cmat &act, int line) { ASSERT_EQ(ref.rows(), act.rows()) << "line:" << line; ASSERT_EQ(ref.cols(), act.cols()) << "line:" << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k).real(), act(n,k).real(), tol) << "line:" << line; ASSERT_NEAR(ref(n,k).imag(), act(n,k).imag(), tol) << "line:" << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) static void common_operators(const cmat &A, const cmat &B, const cmat &C, const cvec &u, const cvec &v, complex c) { // indexing ASSERT_NEAR(-0.595499, A(1,2).real(), tol); ASSERT_NEAR(-0.56388, A(1,2).imag(), tol); ASSERT_NEAR(-0.817562, A(2, 3).real(), tol); ASSERT_NEAR(-1.10836, A(2, 3).imag(), tol); ASSERT_NEAR(0.722271, A(6).real(), tol); ASSERT_NEAR(-0.153507, A(6).imag(), tol); cmat ref_m = "-1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, A(0, 2, 1, 3)); cvec ref_v = "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i"; assert_vec(ref_v, A.get_row(1)); ref_m = "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, A.get_rows(1, 2)); ref_v = "0.722271-0.153507i -0.595499-0.56388i 1.0276-0.175089i"; assert_vec(ref_v, A.get_col(2)); ref_m = "0.722271-0.153507i -0.0211019-0.365373i;" "-0.595499-0.56388i -0.687348-0.0869053i;" "1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, A.get_cols(2, 3)); // setting, copying, swapping cmat Mv(v); ref_m = "0.174329+0.0466934i; -0.51944+0.527715i; -0.410049-0.311715i; -0.253286-0.813752i"; assert_mat(ref_m, Mv); cmat D(A); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, D); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i 0+0i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i 0+0i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i 0+0i;" "0+0i 0+0i 0+0i 0+0i 0+0i;" "0+0i 0+0i 0+0i 0+0i 0+0i;" "0+0i 0+0i 0+0i 0+0i 0+0i"; D.set_size(6, 5, true); assert_mat(ref_m, D); D.set_size(3, 2, true); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i;" "0.0690522+0.282504i 0.308802+0.109446i;" "0.570089-0.350927i 0.248223-1.13728i"; assert_mat(ref_m, D); D.zeros(); ref_m = "0+0i 0+0i;" "0+0i 0+0i;" "0+0i 0+0i"; assert_mat(ref_m, D); D.ones(); ref_m = "1+0i 1+0i;" "1+0i 1+0i;" "1+0i 1+0i"; assert_mat(ref_m, D); D = A; ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, D); D(2, 2) = c; ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i -0.117174+0.468096i -0.817562-1.10836i"; assert_mat(ref_m, D); D(9) = c; ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.117174+0.468096i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i -0.117174+0.468096i -0.817562-1.10836i"; assert_mat(ref_m, D); D.set(0, 1, c); ref_m = "-1.0992+0.0482272i -0.117174+0.468096i 0.722271-0.153507i -0.117174+0.468096i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i -0.117174+0.468096i -0.817562-1.10836i"; assert_mat(ref_m, D); D.set_row(1, v); ref_m = "-1.0992+0.0482272i -0.117174+0.468096i 0.722271-0.153507i -0.117174+0.468096i;" "0.174329+0.0466934i -0.51944+0.527715i -0.410049-0.311715i -0.253286-0.813752i;" "0.570089-0.350927i 0.248223-1.13728i -0.117174+0.468096i -0.817562-1.10836i"; assert_mat(ref_m, D); D.set_col(2, u); ref_m = "-1.0992+0.0482272i -0.117174+0.468096i 0.455057-0.444672i -0.117174+0.468096i;" "0.174329+0.0466934i -0.51944+0.527715i -0.8556-0.192441i -0.253286-0.813752i;" "0.570089-0.350927i 0.248223-1.13728i -0.110127+1.22645i -0.817562-1.10836i"; assert_mat(ref_m, D); D.set_rows(0, B.get_rows(1, 2)); ref_m = "-0.221685-0.581717i -0.647685-0.916925i 0.459866+0.264737i 1.21948+1.39547i;" "-0.537457-0.362192i -0.221416-0.892514i -0.337512-0.476078i 0.0988444-0.333968i;" "0.570089-0.350927i 0.248223-1.13728i -0.110127+1.22645i -0.817562-1.10836i"; assert_mat(ref_m, D); D.set_cols(2, B.get_cols(0, 1)); ref_m = "-0.221685-0.581717i -0.647685-0.916925i -0.940531+1.37009i -0.287338+0.801736i;" "-0.537457-0.362192i -0.221416-0.892514i -0.221685-0.581717i -0.647685-0.916925i;" "0.570089-0.350927i 0.248223-1.13728i -0.537457-0.362192i -0.221416-0.892514i"; assert_mat(ref_m, D); D.copy_row(1, 2); ref_m = "-0.221685-0.581717i -0.647685-0.916925i -0.940531+1.37009i -0.287338+0.801736i;" "0.570089-0.350927i 0.248223-1.13728i -0.537457-0.362192i -0.221416-0.892514i;" "0.570089-0.350927i 0.248223-1.13728i -0.537457-0.362192i -0.221416-0.892514i"; assert_mat(ref_m, D); D.copy_col(2, 3); ref_m = "-0.221685-0.581717i -0.647685-0.916925i -0.287338+0.801736i -0.287338+0.801736i;" "0.570089-0.350927i 0.248223-1.13728i -0.221416-0.892514i -0.221416-0.892514i;" "0.570089-0.350927i 0.248223-1.13728i -0.221416-0.892514i -0.221416-0.892514i"; assert_mat(ref_m, D); D.swap_rows(0, 2); ref_m = "0.570089-0.350927i 0.248223-1.13728i -0.221416-0.892514i -0.221416-0.892514i;" "0.570089-0.350927i 0.248223-1.13728i -0.221416-0.892514i -0.221416-0.892514i;" "-0.221685-0.581717i -0.647685-0.916925i -0.287338+0.801736i -0.287338+0.801736i"; assert_mat(ref_m, D); D.swap_cols(0, 3); ref_m = "-0.221416-0.892514i 0.248223-1.13728i -0.221416-0.892514i 0.570089-0.350927i;" "-0.221416-0.892514i 0.248223-1.13728i -0.221416-0.892514i 0.570089-0.350927i;" "-0.287338+0.801736i -0.647685-0.916925i -0.287338+0.801736i -0.221685-0.581717i"; assert_mat(ref_m, D); D.set_submatrix(1, 2, A(0, 1, 0, 1)); ref_m = "-0.221416-0.892514i 0.248223-1.13728i -0.221416-0.892514i 0.570089-0.350927i;" "-0.221416-0.892514i 0.248223-1.13728i -1.0992+0.0482272i -1.44302-0.163398i;" "-0.287338+0.801736i -0.647685-0.916925i 0.0690522+0.282504i 0.308802+0.109446i"; assert_mat(ref_m, D); D.set_submatrix(0, 0, A(0, 1, 0, 1)); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i -0.221416-0.892514i 0.570089-0.350927i;" "0.0690522+0.282504i 0.308802+0.109446i -1.0992+0.0482272i -1.44302-0.163398i;" "-0.287338+0.801736i -0.647685-0.916925i 0.0690522+0.282504i 0.308802+0.109446i"; assert_mat(ref_m, D); D.set_submatrix(1, 2, 2, 3, c); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i -0.221416-0.892514i 0.570089-0.350927i;" "0.0690522+0.282504i 0.308802+0.109446i -0.117174+0.468096i -0.117174+0.468096i;" "-0.287338+0.801736i -0.647685-0.916925i -0.117174+0.468096i -0.117174+0.468096i"; assert_mat(ref_m, D); // transposition ref_m = "-1.0992+0.0482272i 0.0690522+0.282504i 0.570089-0.350927i;" "-1.44302-0.163398i 0.308802+0.109446i 0.248223-1.13728i;" "0.722271-0.153507i -0.595499-0.56388i 1.0276-0.175089i;" "-0.0211019-0.365373i -0.687348-0.0869053i -0.817562-1.10836i"; assert_mat(ref_m, A.T()); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, A.T().T()); ref_m = "-1.0992-0.0482272i 0.0690522-0.282504i 0.570089+0.350927i;" "-1.44302+0.163398i 0.308802-0.109446i 0.248223+1.13728i;" "0.722271+0.153507i -0.595499+0.56388i 1.0276+0.175089i;" "-0.0211019+0.365373i -0.687348+0.0869053i -0.817562+1.10836i"; assert_mat(ref_m, A.H()); // concatenation D = concat_horizontal(A, B); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i -0.940531+1.37009i -0.287338+0.801736i -0.332921+0.669844i -0.331418+0.133073i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i -0.221685-0.581717i -0.647685-0.916925i 0.459866+0.264737i 1.21948+1.39547i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i -0.537457-0.362192i -0.221416-0.892514i -0.337512-0.476078i 0.0988444-0.333968i"; assert_mat(ref_m, D); D = concat_vertical(A, B); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i;" "-0.940531+1.37009i -0.287338+0.801736i -0.332921+0.669844i -0.331418+0.133073i;" "-0.221685-0.581717i -0.647685-0.916925i 0.459866+0.264737i 1.21948+1.39547i;" "-0.537457-0.362192i -0.221416-0.892514i -0.337512-0.476078i 0.0988444-0.333968i"; assert_mat(ref_m, D); // deleting rows, cols D.del_row(2); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "-0.940531+1.37009i -0.287338+0.801736i -0.332921+0.669844i -0.331418+0.133073i;" "-0.221685-0.581717i -0.647685-0.916925i 0.459866+0.264737i 1.21948+1.39547i;" "-0.537457-0.362192i -0.221416-0.892514i -0.337512-0.476078i 0.0988444-0.333968i"; assert_mat(ref_m, D); D.del_rows(0, 2); ref_m = "-0.221685-0.581717i -0.647685-0.916925i 0.459866+0.264737i 1.21948+1.39547i;" "-0.537457-0.362192i -0.221416-0.892514i -0.337512-0.476078i 0.0988444-0.333968i"; assert_mat(ref_m, D); D.del_col(3); ref_m = "-0.221685-0.581717i -0.647685-0.916925i 0.459866+0.264737i;" "-0.537457-0.362192i -0.221416-0.892514i -0.337512-0.476078i"; assert_mat(ref_m, D); D.del_cols(0, 1); ref_m = "0.459866+0.264737i; -0.337512-0.476078i"; assert_mat(ref_m, D); // inserting, appending rows cols cmat A2 = A; A2.ins_row(1, v); ref_m = "-1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "0.174329+0.0466934i -0.51944+0.527715i -0.410049-0.311715i -0.253286-0.813752i;" "0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, A2); A2.ins_col(0, v); ref_m = "0.174329+0.0466934i -1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i;" "-0.51944+0.527715i 0.174329+0.0466934i -0.51944+0.527715i -0.410049-0.311715i -0.253286-0.813752i;" "-0.410049-0.311715i 0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i;" "-0.253286-0.813752i 0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i"; assert_mat(ref_m, A2); A2.append_col(A2.get_col(3)); ref_m = "0.174329+0.0466934i -1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i 0.722271-0.153507i;" "-0.51944+0.527715i 0.174329+0.0466934i -0.51944+0.527715i -0.410049-0.311715i -0.253286-0.813752i -0.410049-0.311715i;" "-0.410049-0.311715i 0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i -0.595499-0.56388i;" "-0.253286-0.813752i 0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i 1.0276-0.175089i"; assert_mat(ref_m, A2); A2.append_row(A2.get_row(0)); ref_m = "0.174329+0.0466934i -1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i 0.722271-0.153507i;" "-0.51944+0.527715i 0.174329+0.0466934i -0.51944+0.527715i -0.410049-0.311715i -0.253286-0.813752i -0.410049-0.311715i;" "-0.410049-0.311715i 0.0690522+0.282504i 0.308802+0.109446i -0.595499-0.56388i -0.687348-0.0869053i -0.595499-0.56388i;" "-0.253286-0.813752i 0.570089-0.350927i 0.248223-1.13728i 1.0276-0.175089i -0.817562-1.10836i 1.0276-0.175089i;" "0.174329+0.0466934i -1.0992+0.0482272i -1.44302-0.163398i 0.722271-0.153507i -0.0211019-0.365373i 0.722271-0.153507i"; assert_mat(ref_m, A2); // addition ref_m = "-2.03973+1.41831i -1.73036+0.638337i 0.38935+0.516337i -0.35252-0.232301i;" "-0.152633-0.299213i -0.338883-0.807479i -0.135633-0.299143i 0.532135+1.30856i;" "0.0326323-0.71312i 0.0268068-2.02979i 0.690083-0.651167i -0.718717-1.44232i"; assert_mat(ref_m, (A + B)); ref_m = "-1.21637+0.516323i -1.5602+0.304697i 0.605097+0.314588i -0.138276+0.102722i;" "-0.0481216+0.750599i 0.191628+0.577542i -0.712673-0.0957844i -0.804522+0.38119i;" "0.452915+0.117168i 0.13105-0.669184i 0.910422+0.293007i -0.934736-0.64026i"; assert_mat(ref_m, (A + c)); assert_mat(ref_m, (c + A)); A2 = A; A2 += B; ref_m = "-2.03973+1.41831i -1.73036+0.638337i 0.38935+0.516337i -0.35252-0.232301i;" "-0.152633-0.299213i -0.338883-0.807479i -0.135633-0.299143i 0.532135+1.30856i;" "0.0326323-0.71312i 0.0268068-2.02979i 0.690083-0.651167i -0.718717-1.44232i"; assert_mat(ref_m, A2); A2 = A; A2 += c; ref_m = "-1.21637+0.516323i -1.5602+0.304697i 0.605097+0.314588i -0.138276+0.102722i;" "-0.0481216+0.750599i 0.191628+0.577542i -0.712673-0.0957844i -0.804522+0.38119i;" "0.452915+0.117168i 0.13105-0.669184i 0.910422+0.293007i -0.934736-0.64026i"; assert_mat(ref_m, A2); // subtraction ref_m = "-0.158667-1.32186i -1.15569-0.965134i 1.05519-0.823352i 0.310316-0.498446i;" "0.290738+0.864221i 0.956487+1.02637i -1.05537-0.828617i -1.90683-1.48237i;" "1.10755+0.0112649i 0.46964-0.244766i 1.36511+0.30099i -0.916406-0.774388i"; assert_mat(ref_m, (A - B)); ref_m = "-0.982024-0.419868i -1.32585-0.631494i 0.839445-0.621603i 0.0960718-0.833469i;" "0.186226-0.185592i 0.425976-0.35865i -0.478326-1.03198i -0.570174-0.555001i;" "0.687263-0.819023i 0.365397-1.60538i 1.14477-0.643184i -0.700388-1.57645i"; assert_mat(ref_m, (A - c)); ref_m = "0.982024+0.419868i 1.32585+0.631494i -0.839445+0.621603i -0.0960718+0.833469i;" "-0.186226+0.185592i -0.425976+0.35865i 0.478326+1.03198i 0.570174+0.555001i;" "-0.687263+0.819023i -0.365397+1.60538i -1.14477+0.643184i 0.700388+1.57645i"; assert_mat(ref_m, (c - A)); A2 = A; A2 -= B; ref_m = "-0.158667-1.32186i -1.15569-0.965134i 1.05519-0.823352i 0.310316-0.498446i;" "0.290738+0.864221i 0.956487+1.02637i -1.05537-0.828617i -1.90683-1.48237i;" "1.10755+0.0112649i 0.46964-0.244766i 1.36511+0.30099i -0.916406-0.774388i"; assert_mat(ref_m, A2); A2 = A; A2 -= c; ref_m = "-0.982024-0.419868i -1.32585-0.631494i 0.839445-0.621603i 0.0960718-0.833469i;" "0.186226-0.185592i 0.425976-0.35865i -0.478326-1.03198i -0.570174-0.555001i;" "0.687263-0.819023i 0.365397-1.60538i 1.14477-0.643184i -0.700388-1.57645i"; assert_mat(ref_m, A2); ref_m = "1.0992-0.0482272i 1.44302+0.163398i -0.722271+0.153507i 0.0211019+0.365373i;" "-0.0690522-0.282504i -0.308802-0.109446i 0.595499+0.56388i 0.687348+0.0869053i;" "-0.570089+0.350927i -0.248223+1.13728i -1.0276+0.175089i 0.817562+1.10836i"; assert_mat(ref_m, -A); // multiplication ref_m = "-0.910805-1.18033i -1.44173-0.454669i -1.57228+0.766807i;" "1.10653+0.339386i -0.365877+0.320608i 1.006+0.9153i;" "2.11969+0.360853i -1.86799-1.10692i -1.79365+0.0201111i"; assert_mat(ref_m, A*C); A2 = A; A2 *= C; ref_m = "-0.910805-1.18033i -1.44173-0.454669i -1.57228+0.766807i;" "1.10653+0.339386i -0.365877+0.320608i 1.006+0.9153i;" "2.11969+0.360853i -1.86799-1.10692i -1.79365+0.0201111i"; assert_mat(ref_m, A2); ref_m = "0.106222-0.520181i 0.245571-0.656327i -0.0127751+0.356079i 0.173502+0.0329345i;" "-0.14033-0.000778999i -0.0874147+0.131725i 0.333727-0.212679i 0.121219-0.311562i;" "0.0974682+0.307976i 0.50327+0.249452i -0.038449+0.501529i 0.614613-0.252827i"; assert_mat(ref_m, A*c); assert_mat(ref_m, c*A); A2 = A; A2 *= c; ref_m = "0.106222-0.520181i 0.245571-0.656327i -0.0127751+0.356079i 0.173502+0.0329345i;" "-0.14033-0.000778999i -0.0874147+0.131725i 0.333727-0.212679i 0.121219-0.311562i;" "0.0974682+0.307976i 0.50327+0.249452i -0.038449+0.501529i 0.614613-0.252827i"; assert_mat(ref_m, A2); ref_v = "0.00592265-0.772031i -0.0475239+1.15677i -0.5838+1.38468i"; assert_vec(ref_v, A*v); ref_m = "0.967754-1.55136i 0.545637-1.10997i -0.137633+0.534915i 0.0556148+0.118283i;" "0.149029-0.102796i -0.0996524-0.354035i -0.12457-0.41696i -0.716936-1.06515i;" "-0.433501-0.0178736i -1.07+0.0302697i -0.430182-0.430121i -0.450966+0.163484i"; assert_mat(ref_m, elem_mult(A, B)); elem_mult_out(A, B, A2); ref_m = "0.967754-1.55136i 0.545637-1.10997i -0.137633+0.534915i 0.0556148+0.118283i;" "0.149029-0.102796i -0.0996524-0.354035i -0.12457-0.41696i -0.716936-1.06515i;" "-0.433501-0.0178736i -1.07+0.0302697i -0.430182-0.430121i -0.450966+0.163484i"; assert_mat(ref_m, A2); cmat B2 = B; elem_mult_inplace(A, B2); ref_m = "0.967754-1.55136i 0.545637-1.10997i -0.137633+0.534915i 0.0556148+0.118283i;" "0.149029-0.102796i -0.0996524-0.354035i -0.12457-0.41696i -0.716936-1.06515i;" "-0.433501-0.0178736i -1.07+0.0302697i -0.430182-0.430121i -0.450966+0.163484i"; assert_mat(ref_m, B2); complex ref_s = elem_mult_sum(A, B); ASSERT_NEAR(-1.7454, ref_s.real(), tol); ASSERT_NEAR(-4.20131, ref_s.imag(), tol); // division ref_m = "0.650103+2.1855i 0.397686+2.98321i -0.672071-1.37477i -0.723908+0.226289i;" "0.533181-0.280983i 0.0646261-0.675875i -0.833921+1.48092i 0.171184+1.42554i;" "-0.992372-0.969479i -2.41124+0.0732986i -0.869106-1.97771i -1.81676+2.20134i"; assert_mat(ref_m, A / c); A2 = A; A2 /= c; ref_m = "0.650103+2.1855i 0.397686+2.98321i -0.672071-1.37477i -0.723908+0.226289i;" "0.533181-0.280983i 0.0646261-0.675875i -0.833921+1.48092i 0.171184+1.42554i;" "-0.992372-0.969479i -2.41124+0.0732986i -0.869106-1.97771i -1.81676+2.20134i"; assert_mat(ref_m, A2); A2 = A; A2 /= B; ref_m = "0.398266+0.528884i 0.391033+1.65973i -0.613527-0.773337i -0.326374+0.971408i;" "-0.463553-0.0579506i -0.238334+0.168429i -1.50279-0.361051i -0.279369+0.248421i;" "-0.426849+0.940595i 1.13537+0.559782i -0.773626+1.61i 2.38526-3.154i"; assert_mat(ref_m, A2); ref_m = "0.398266+0.528884i 0.391033+1.65973i -0.613527-0.773337i -0.326374+0.971408i;" "-0.463553-0.0579506i -0.238334+0.168429i -1.50279-0.361051i -0.279369+0.248421i;" "-0.426849+0.940595i 1.13537+0.559782i -0.773626+1.61i 2.38526-3.154i"; assert_mat(ref_m, elem_div(A, B)); elem_div_out(A, B, A2); ref_m = "0.398266+0.528884i 0.391033+1.65973i -0.613527-0.773337i -0.326374+0.971408i;" "-0.463553-0.0579506i -0.238334+0.168429i -1.50279-0.361051i -0.279369+0.248421i;" "-0.426849+0.940595i 1.13537+0.559782i -0.773626+1.61i 2.38526-3.154i"; assert_mat(ref_m, A2); ref_s = elem_div_sum(A, B); ASSERT_NEAR(-0.314489, ref_s.real(), tol); ASSERT_NEAR(2.34092, ref_s.imag(), tol); } TEST(Mat, All) { RNG_reset(0); // Testing Mat (bmat) bmat bM1 = randb(3, 4); bmat bM2 = randb(3, 4); bmat bM3 = randb(4, 3); bvec bv1 = randb(3); bvec bv2 = randb(4); bin bx = randb(); common_operators(bM1, bM2, bM3, bv1, bv2, bx); // Testing Mat (imat) imat iM1 = randi(3, 4, 1, 9); imat iM2 = randi(3, 4, 1, 9); imat iM3 = randi(4, 3, 1, 9); ivec iv1 = randi(3, 1, 9); ivec iv2 = randi(4, 1, 9); int ix = randi(1, 9); common_operators(iM1, iM2, iM3, iv1, iv2, ix); // Testing Mat (mat) mat dM1 = randn(3, 4); mat dM2 = randn(3, 4); mat dM3 = randn(4, 3); vec dv1 = randn(3); vec dv2 = randn(4); double dx = randn(); common_operators(dM1, dM2, dM3, dv1, dv2, dx); // Testing Mat > (cmat) cmat cM1 = randn_c(3, 4); cmat cM2 = randn_c(3, 4); cmat cM3 = randn_c(4, 3); cvec cv1 = randn_c(3); cvec cv2 = randn_c(4); complex cx = randn_c(); common_operators(cM1, cM2, cM3, cv1, cv2, cx); //initializations with strings are tested implicitly } itpp-4.3.1/gtests/matfunc_test.cpp000066400000000000000000000151441216575753400172300ustar00rootroot00000000000000/*! * \file * \brief Test program of various functions on vectors and matrices * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static const double tol = 1e-4; static void assert_vec(const vec &ref, const vec &act) { ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref[n], act[n], tol); } } static void assert_mat(const mat &ref, const mat &act) { ASSERT_EQ(ref.rows(), act.rows()); ASSERT_EQ(ref.cols(), act.cols()); for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol); } } } TEST(MatFunc, All) { // Test of matfunc routines RNG_reset(0); vec act_v, ref_v; mat act_m, ref_m; vec a = randn(5); ASSERT_NEAR(-1.2785, sum(a), tol); act_v = cumsum(a); ref_v = "-0.538679 -1.81359 -0.78536 -0.913054 -1.2785"; assert_vec(ref_v, act_v); ASSERT_NEAR(0.0329534, prod(a), tol); ASSERT_NEAR(3.1227, sum_sqr(a), tol); mat A = randn(5, 5); act_v = sum(A); ref_v = "-0.154075 -5.06832 -0.386055 1.2232 2.46118"; assert_vec(ref_v, act_v); act_v = sum(A, 1); ref_v = "-0.154075 -5.06832 -0.386055 1.2232 2.46118"; assert_vec(ref_v, act_v); act_v = sum(A, 2); ref_v = "-2.77077 -2.02482 0.621612 0.255076 1.99483"; assert_vec(ref_v, act_v); act_m = cumsum(A); ref_m = "-0.878434 -0.531968 -1.27628 0.382527 -0.466618;" "0.411677 -4.26467 -0.888925 -0.227868 0.174195;" "-0.263705 -4.37742 -1.27645 0.121915 1.62168;" "-0.964984 -5.31757 -1.26185 1.41868 2.20682;" "-0.154075 -5.06832 -0.386055 1.2232 2.46118"; assert_mat(ref_m, act_m); act_m = cumsum(A, 1); ref_m = "-0.878434 -0.531968 -1.27628 0.382527 -0.466618;" "0.411677 -4.26467 -0.888925 -0.227868 0.174195;" "-0.263705 -4.37742 -1.27645 0.121915 1.62168;" "-0.964984 -5.31757 -1.26185 1.41868 2.20682;" "-0.154075 -5.06832 -0.386055 1.2232 2.46118"; assert_mat(ref_m, act_m); act_m = cumsum(A, 2); ref_m = "-0.878434 -1.4104 -2.68668 -2.30415 -2.77077;" "1.29011 -2.44259 -2.05523 -2.66563 -2.02482;" "-0.675383 -0.788138 -1.17566 -0.825877 0.621612;" "-0.701279 -1.64143 -1.62682 -0.330059 0.255076;" "0.810909 1.06016 1.93595 1.74047 1.99483"; assert_mat(ref_m, act_m); act_v = prod(A); ref_v = "-0.435261 0.0524651 0.00244989 0.0207031 -0.0644198"; assert_vec(ref_v, act_v); act_v = prod(A, 1); ref_v = "-0.435261 0.0524651 0.00244989 0.0207031 -0.0644198"; assert_vec(ref_v, act_v); act_v = prod(A, 2); ref_v = "0.106454 0.729624 -0.0149416 0.0073047 -0.00880157"; assert_vec(ref_v, act_v); act_v = sum_sqr(A); ref_v = "4.04154 15.1747 2.69632 2.36107 3.13068"; assert_vec(ref_v, act_v); act_v = sum_sqr(A, 1); ref_v = "4.04154 15.1747 2.69632 2.36107 3.13068"; assert_vec(ref_v, act_v); act_v = sum_sqr(A, 2); ref_v = "3.04758 16.5307 2.8366 3.39987 1.58962"; assert_vec(ref_v, act_v); act_m = repmat(a, 1, 3); ref_m = "-0.538679 -0.538679 -0.538679;" "-1.27491 -1.27491 -1.27491;" "1.02823 1.02823 1.02823;" "-0.127694 -0.127694 -0.127694;" "-0.36545 -0.36545 -0.36545;"; assert_mat(ref_m, act_m); act_m = repmat(a, 3, 1, true); ref_m = "-0.538679 -1.27491 1.02823 -0.127694 -0.36545;" "-0.538679 -1.27491 1.02823 -0.127694 -0.36545;" "-0.538679 -1.27491 1.02823 -0.127694 -0.36545"; assert_mat(ref_m, act_m); act_m = repmat(A, 2, 2); ref_m = "-0.878434 -0.531968 -1.27628 0.382527 -0.466618 -0.878434 -0.531968 -1.27628 0.382527 -0.466618;" "1.29011 -3.7327 0.387353 -0.610395 0.640813 1.29011 -3.7327 0.387353 -0.610395 0.640813;" "-0.675383 -0.112755 -0.387522 0.349783 1.44749 -0.675383 -0.112755 -0.387522 0.349783 1.44749;" "-0.701279 -0.940147 0.0146015 1.29677 0.585136 -0.701279 -0.940147 0.0146015 1.29677 0.585136;" "0.810909 0.249247 0.875791 -0.19548 0.254363 0.810909 0.249247 0.875791 -0.19548 0.254363;" "-0.878434 -0.531968 -1.27628 0.382527 -0.466618 -0.878434 -0.531968 -1.27628 0.382527 -0.466618;" "1.29011 -3.7327 0.387353 -0.610395 0.640813 1.29011 -3.7327 0.387353 -0.610395 0.640813;" "-0.675383 -0.112755 -0.387522 0.349783 1.44749 -0.675383 -0.112755 -0.387522 0.349783 1.44749;" "-0.701279 -0.940147 0.0146015 1.29677 0.585136 -0.701279 -0.940147 0.0146015 1.29677 0.585136;" "0.810909 0.249247 0.875791 -0.19548 0.254363 0.810909 0.249247 0.875791 -0.19548 0.254363"; assert_mat(ref_m, act_m); // Kronecker test mat X = to_mat(randi(2, 2, 1, 4)); mat Y = randn(3, 3); act_m = kron(X, Y); ref_m = "-2.93292 1.78242 -2.87218 -2.93292 1.78242 -2.87218;" "-0.301315 -1.01854 -0.296556 -0.301315 -1.01854 -0.296556;" "-1.28323 -3.50521 0.336507 -1.28323 -3.50521 0.336507;" "-2.93292 1.78242 -2.87218 -4.39937 2.67363 -4.30826;" "-0.301315 -1.01854 -0.296556 -0.451972 -1.52781 -0.444834;" "-1.28323 -3.50521 0.336507 -1.92484 -5.25782 0.504761"; assert_mat(ref_m, act_m); // sqrtm of a real matrix A = randn(3, 3); cmat A_sqrtm = sqrtm(A); ASSERT_NEAR(0, norm(A_sqrtm * A_sqrtm - to_cmat(A)), tol); // sqrtm of a complex matrix cmat B = randn_c(3, 3); cmat B_sqrtm = sqrtm(B); ASSERT_NEAR(0, norm(B_sqrtm * B_sqrtm - B), tol); // Rank test A = randn(3, 3); ASSERT_EQ(3, itpp::rank(A)); A.set_row(1, 3.0 * A.get_row(0)); ASSERT_EQ(2, itpp::rank(A)); B = randn_c(3, 3); ASSERT_EQ(3, itpp::rank(B)); B.set_col(1, B.get_col(0)); ASSERT_EQ(2, itpp::rank(B)); } itpp-4.3.1/gtests/modulator_nd_test.cpp000066400000000000000000000241601216575753400202600ustar00rootroot00000000000000/*! * \file * \brief Vector ("MIMO") modulator classes test program * \author Erik G. Larsson, Adam Piatyszek, and Mirsad Cirkic * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; template void assert_vec_p(const Vec &ref, const Vec &act, int line) { static const double tol = 1e-3; ASSERT_EQ(ref.length(), ref.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref,act) assert_vec_p(ref, act, __LINE__) TEST(ModulatorNd, All) { // Test of ND (MIMO) Modulators RNG_reset(12345); double sigma2 = 0.05; { // --- Test for M-PAM, M^2-QAM, and M^2-PSK constellations ND_UPAM pammod; ND_UQAM qammod; ND_UPSK pskmod; int nt = 2; for (int nb = 1; nb <= 2; nb++) { pammod.set_M(2*nt, 1<. * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static void assert_vec_p(const vec &ref, const vec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) static void assert_cvec_p(const cvec &ref, const cvec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line; ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line; } } #define assert_cvec(ref, act) assert_cvec_p(ref, act, __LINE__) TEST(Modulator, All) { RNG_reset(12345); // Test of Modulators const int no_symbols = 5; const double N0 = 0.1; { // Modulator_1D (configured as BPSK) Modulator_1D mod("1.0 -1.0", "0 1"); int bps = round_i(mod.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); vec noise = sqrt(N0) * randn(no_symbols); vec tx_symbols = mod.modulate_bits(tx_bits); vec rx_symbols = tx_symbols + noise; bvec decbits = mod.demodulate_bits(rx_symbols); // modulating bits vec ref = "-1 -1 1 -1 -1"; assert_vec(ref, tx_symbols); ref = "-0.903346 -0.634069 0.890343 -1.15583 -0.830113"; assert_vec(ref, rx_symbols); ASSERT_TRUE(tx_bits == decbits); tx_symbols = mod.modulate(tx_sym_numbers); rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = mod.demodulate(rx_symbols); // modulating symbol numbers ref = "-1 -1 1 -1 -1"; assert_vec(ref, tx_symbols); ref = "-0.903346 -0.634069 0.890343 -1.15583 -0.830113"; assert_vec(ref, rx_symbols); ASSERT_TRUE(tx_sym_numbers == dec_sym_numbers); // BPSK (real signal) BPSK bpsk; bpsk.modulate_bits(tx_bits, tx_symbols); rx_symbols = tx_symbols + noise; bpsk.demodulate_bits(rx_symbols, decbits); // modulating bits ref = "-1 -1 1 -1 -1"; assert_vec(ref, tx_symbols); ref = "-0.903346 -0.634069 0.890343 -1.15583 -0.830113"; assert_vec(ref, rx_symbols); ASSERT_TRUE(tx_bits == decbits); // BPSK (complex signal) BPSK_c bpsk_c; cvec tx_csymbols = bpsk_c.modulate_bits(tx_bits); cvec rx_csymbols = tx_csymbols + to_cvec(noise, -noise); decbits = bpsk_c.demodulate_bits(rx_csymbols); vec softbits_approx = bpsk_c.demodulate_soft_bits(rx_csymbols, N0, APPROX); vec softbits = bpsk_c.demodulate_soft_bits(rx_csymbols, N0, LOGMAP); // modulating bits cvec ref_c = "-1+0i -1+0i 1+0i -1+0i -1+0i"; assert_cvec(ref_c, tx_csymbols); ref_c = "-0.903346-0.0966544i -0.634069-0.365931i 0.890343+0.109657i -1.15583+0.155832i -0.830113-0.169887i"; assert_cvec(ref_c, rx_csymbols); ASSERT_TRUE(tx_bits == decbits); ref = "-36.1338 -25.3628 35.6137 -46.2333 -33.2045"; assert_vec(ref, softbits); assert_vec(ref, softbits_approx); } { // Modulator_1D (configured as 4-PAM) Modulator_1D mod("-3.0 -1.0 1.0 3.0", "0 1 3 2"); int bps = round_i(mod.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); vec noise = sqrt(N0) * randn(no_symbols); vec tx_symbols = mod.modulate_bits(tx_bits); vec rx_symbols = tx_symbols + noise; bvec decbits = mod.demodulate_bits(rx_symbols); // modulating bits vec ref = "3 -1 3 1 -1"; assert_vec(ref, tx_symbols); ref = "2.81898 -1.09523 2.8743 1.56882 -0.880341"; assert_vec(ref, rx_symbols); ASSERT_TRUE(tx_bits == decbits); tx_symbols = mod.modulate(tx_sym_numbers); rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = mod.demodulate(rx_symbols); // modulating symbol numbers ref = "1 -3 3 3 1"; assert_vec(ref, tx_symbols); ref = "0.818976 -3.09523 2.8743 3.56882 1.11966"; assert_vec(ref, rx_symbols); ASSERT_TRUE(tx_sym_numbers == dec_sym_numbers); // 4-PAM (real signal) PAM pam(4); pam.modulate_bits(tx_bits, tx_symbols); rx_symbols = tx_symbols + noise; pam.demodulate_bits(rx_symbols, decbits); ref = "-1.34164 0.447214 -1.34164 -0.447214 0.447214"; assert_vec(ref, tx_symbols); ref = "-1.52266 0.351985 -1.46734 0.121605 0.566872"; assert_vec(ref, rx_symbols); bvec ref_b = "1 0 0 1 1 0 0 1 0 1"; ASSERT_TRUE(ref_b == decbits); // 4-PAM (complex signal) PAM_c pam_c(4); cvec tx_csymbols = pam_c.modulate_bits(tx_bits); cvec rx_csymbols = tx_csymbols + to_cvec(noise, -noise); decbits = pam_c.demodulate_bits(rx_csymbols); vec softbits_approx = pam_c.demodulate_soft_bits(rx_csymbols, N0, APPROX); vec softbits = pam_c.demodulate_soft_bits(rx_csymbols, N0, LOGMAP); cvec ref_c = "-1.34164+0i 0.447214+0i -1.34164+0i -0.447214+0i 0.447214+0i"; assert_cvec(ref_c, tx_csymbols); ref_c = "-1.52266+0.181024i 0.351985+0.0952288i -1.46734+0.125701i 0.121605-0.568819i 0.566872-0.119659i"; assert_cvec(ref_c, rx_csymbols); ref_b = "1 0 0 1 1 0 0 1 0 1"; ASSERT_TRUE(ref_b == decbits); ref = "-38.4765 11.2383 6.29656 -9.70535 -36.4973 10.2486 2.17534 -13.9308 10.1434 -5.85952"; assert_vec(ref, softbits); ref = "-38.4765 11.2383 6.2965 -9.7035 -36.4972 10.2486 2.17534 -13.8247 10.1405 -5.85948"; assert_vec(ref, softbits_approx); } { // Modulator_2D (configured as 256-QAM) QAM qam(256); Modulator_2D mod(qam.get_symbols(), qam.get_bits2symbols()); int bps = round_i(mod.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); cvec noise = sqrt(N0) * randn_c(no_symbols); cvec tx_symbols = mod.modulate(tx_sym_numbers); cvec rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = mod.demodulate(rx_symbols); cvec ref_c = "-0.536875+0.690268i -0.536875-0.0766965i -0.843661+0.997054i 0.843661-0.536875i -0.690268+0.0766965i"; assert_cvec(ref_c, tx_symbols); ref_c = "-0.254627+0.564075i -0.440218+0.144641i -1.01567+1.09629i 0.848682-0.37757i -0.759703-0.322026i"; assert_cvec(ref_c, rx_symbols); ivec ref_i = "73 122 14 162 172"; ASSERT_TRUE(ref_i == dec_sym_numbers); tx_symbols = mod.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; bvec decbits = mod.demodulate_bits(rx_symbols); vec softbits_approx = mod.demodulate_soft_bits(rx_symbols, N0, APPROX); vec softbits = mod.demodulate_soft_bits(rx_symbols, N0, LOGMAP); ref_c = "-0.843661+0.230089i -0.997054+1.15045i 0.997054+0.0766965i -0.383482-0.0766965i -0.230089+0.536875i"; assert_cvec(ref_c, tx_symbols); ref_c = "-0.561413+0.103896i -0.900397+1.37179i 0.825046+0.175927i -0.378462+0.0826089i -0.299524+0.138153i"; assert_cvec(ref_c, rx_symbols); bvec ref_b = "0 1 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1"; ASSERT_TRUE(ref_b == decbits); vec ref = "0.764361 -4.53879 1.33914 0.0998816 -5.24815 -0.383786 -1.56908 0.175588 20.8995 6.83599 2.47707 0.707791 " "-10.7329 2.17238 -0.289121 -0.303773 1.31869 -3.74479 0.901794 -0.0470311 9.34327 1.56432 -0.762366 -0.165231 " "0.605491 -4.76275 1.44412 0.13652 -3.12443 -1.80187 -0.499773 -0.153056 1.02428 -4.16087 1.14289 0.0319552 " "-2.36526 -2.49883 0.0507592 -0.205765"; assert_vec(ref, softbits); ref = "0.318739 -3.43093 0.774286 0.151849 -4.06582 -0.160015 -1.09173 0.310573 20.4911 6.48084 2.29924 0.914328 " "-9.51492 1.28929 -0.061239 -0.409349 0.608852 -2.61613 0.401456 -0.0691321 8.12793 0.826956 -0.292404 " "-0.178184 0.253433 -3.69215 0.9049 0.217156 -2.07144 -0.971982 -0.219892 -0.250697 0.423836 -3.01054 0.564094 " "0.0467527 -1.36721 -1.4786 0.0222797 -0.448308"; assert_vec(ref, softbits_approx); // 256-QAM tx_symbols = qam.modulate(tx_sym_numbers); rx_symbols = tx_symbols + noise; dec_sym_numbers = qam.demodulate(rx_symbols); ref_c = "-0.536875+0.690268i -0.536875-0.0766965i -0.843661+0.997054i 0.843661-0.536875i -0.690268+0.0766965i"; assert_cvec(ref_c, tx_symbols); ref_c = "-0.254627+0.564075i -0.440218+0.144641i -1.01567+1.09629i 0.848682-0.37757i -0.759703-0.322026i"; assert_cvec(ref_c, rx_symbols); ref_i = "73 122 14 162 172"; ASSERT_TRUE(ref_i == dec_sym_numbers); tx_symbols = qam.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; decbits = qam.demodulate_bits(rx_symbols); softbits_approx = qam.demodulate_soft_bits(rx_symbols, N0, APPROX); softbits = qam.demodulate_soft_bits(rx_symbols, N0, LOGMAP); ref_c = "-0.843661+0.230089i -0.997054+1.15045i 0.997054+0.0766965i -0.383482-0.0766965i -0.230089+0.536875i"; assert_cvec(ref_c, tx_symbols); ref_c = "-0.561413+0.103896i -0.900397+1.37179i 0.825046+0.175927i -0.378462+0.0826089i -0.299524+0.138153i"; assert_cvec(ref_c, rx_symbols); ref_b = "0 1 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1"; ASSERT_TRUE(ref_b == decbits); ref = "0.764361 -4.53879 1.33914 0.0998816 -5.24815 -0.383786 -1.56908 0.175588 20.8995 6.83599 2.47707 0.707791 " "-10.7329 2.17238 -0.289121 -0.303773 1.31869 -3.74479 0.901794 -0.0470311 9.34327 1.56432 -0.762366 -0.165231 " "0.605491 -4.76275 1.44412 0.13652 -3.12443 -1.80187 -0.499773 -0.153056 1.02428 -4.16087 1.14289 0.0319552 " "-2.36526 -2.49883 0.0507592 -0.205765"; assert_vec(ref, softbits); ref = "0.318739 -3.43093 0.774286 0.151849 -4.06582 -0.160015 -1.09173 0.310573 20.4911 6.48084 2.29924 0.914328 " "-9.51492 1.28929 -0.061239 -0.409349 0.608852 -2.61613 0.401456 -0.0691321 8.12793 0.826956 -0.292404 -0.178184 " "0.253433 -3.69215 0.9049 0.217156 -2.07144 -0.971982 -0.219892 -0.250697 0.423836 -3.01054 0.564094 0.0467527 " "-1.36721 -1.4786 0.0222797 -0.448308"; assert_vec(ref, softbits_approx); } { // 8-PSK PSK psk(8); int bps = round_i(psk.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); cvec noise = sqrt(N0) * randn_c(no_symbols); cvec tx_symbols = psk.modulate(tx_sym_numbers); cvec rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = psk.demodulate(rx_symbols); cvec ref_c = "0.707107-0.707107i 0.707107-0.707107i 0.707107-0.707107i 1+0i 0.707107+0.707107i"; assert_cvec(ref_c, tx_symbols); ref_c = "0.8977-0.790151i 0.613921-1.00098i 0.597143-0.839004i 1.14134+0.25144i 0.978761+0.560701i"; assert_cvec(ref_c, rx_symbols); ASSERT_TRUE(tx_sym_numbers == dec_sym_numbers); tx_symbols = psk.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; bvec decbits = psk.demodulate_bits(rx_symbols); vec softbits_approx = psk.demodulate_soft_bits(rx_symbols, N0, APPROX); vec softbits = psk.demodulate_soft_bits(rx_symbols, N0, LOGMAP); ref_c = "0-1i 0.707107+0.707107i 0.707107-0.707107i 0-1i 0+1i"; assert_cvec(ref_c, tx_symbols); ref_c = "0.190593-1.08304i 0.613921+0.413229i 0.597143-0.839004i 0.141345-0.74856i 0.271654+0.853594i"; assert_cvec(ref_c, rx_symbols); ASSERT_TRUE(tx_bits == decbits); vec ref = "-17.8748 9.0654 -3.64905 11.79 6.36194 -2.2495 -8.39621 16.9189 3.53033 -12.2338 6.47187 -2.38768 22.7189 " "-1.15859 -9.05583"; assert_vec(ref, softbits); ref = "-17.849 9.03972 -3.64894 11.6879 6.26152 -2.24768 -8.36733 16.8897 3.5301 -12.1443 6.38388 -2.38605 22.505 " "-1.15847 -8.842"; assert_vec(ref, softbits_approx); } { // 16-QAM QAM qam(16); int bps = round_i(qam.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); cvec noise = sqrt(N0) * randn_c(no_symbols); cvec tx_symbols = qam.modulate(tx_sym_numbers); cvec rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = qam.demodulate(rx_symbols); cvec ref_c = "0.948683-0.316228i 0.316228-0.316228i -0.948683-0.948683i -0.316228-0.316228i -0.316228+0.948683i"; assert_cvec(ref_c, tx_symbols); ref_c = "0.761834-0.196896i 0.818726-0.145779i -1.08588-1.63427i -0.239432-0.0518489i -0.318584+0.783665i"; assert_cvec(ref_c, rx_symbols); ivec ref_i = "8 8 15 10 2"; ASSERT_TRUE(ref_i == dec_sym_numbers); tx_symbols = qam.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; bvec decbits = qam.demodulate_bits(rx_symbols); vec softbits_approx = qam.demodulate_soft_bits(rx_symbols, N0, APPROX); vec softbits = qam.demodulate_soft_bits(rx_symbols, N0, LOGMAP); ref_c = "0.316228-0.316228i 0.948683-0.948683i -0.316228-0.948683i 0.316228-0.948683i -0.948683+0.316228i"; assert_cvec(ref_c, tx_symbols); ref_c = "0.129379-0.196896i 1.45118-0.778235i -0.453421-1.63427i 0.393024-0.684304i -0.95104+0.151209i"; assert_cvec(ref_c, rx_symbols); ASSERT_TRUE(tx_bits == decbits); vec ref = "-2.49457 -5.58849 1.63818 -6.53399 -11.8348 1.84392 28.7123 10.3562 -33.3441 12.6721 -5.83419 " "-2.26785 -9.72974 0.655668 5.01865 -3.03551 1.91488 -6.22187 -16.0772 4.0298"; assert_vec(ref, softbits); ref = "-2.49055 -5.50945 1.63652 -6.36348 -11.688 1.84398 28.7123 10.3562 -33.3441 12.6721 -5.73537 -2.26463 " "-9.31168 0.655842 4.9714 -3.0286 1.91266 -6.08734 -16.0596 4.02981"; assert_vec(ref, softbits_approx); } } itpp-4.3.1/gtests/multilateration_test.cpp000066400000000000000000000215571216575753400210150ustar00rootroot00000000000000/*! * \file * \brief Unit tests for multilateration class * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; #ifdef _MSC_VER #include #define isnan _isnan #endif #define BASE_LINE_M 10.0 #define SPHERE_RADIUS_M 450 //uncomment the line below in order to run full tests //this is needed in order to make sure that the tests pass on non-i386 architectures //#define FULL_TESTS static bool point_eq(const vec &expect, const vec &actual, double eps) { if((3 != length(expect)) || (3 != length(actual))) { it_warning("invalid input"); return false; } bool out = ((fabs(expect(0) - actual(0)) < eps) && (fabs(expect(1) - actual(1)) < eps) && (fabs(expect(2) - actual(2)) < eps) && !isnan(actual(0)) && !isnan(actual(1)) && !isnan(actual(2))); if(false == out) { cout << "expect " << expect << endl; cout << "actual " << actual << endl; } return out; } static double get_dist(const vec &p0, const vec &p1) { double out = 0.0; for(int n = 0; n < 3; ++n) { out += (p1[n] - p0[n]) * (p1[n] - p0[n]); } return sqrt(out); } //used for both spheric and hybrid multilateration static bool generate_meas(vec &meas, const bvec &method, const mat &bs_pos, const vec &ms_pos) { unsigned int method_len = length(method); unsigned int nb_bs = bs_pos.cols(); bool column = true; if(3 == nb_bs) { nb_bs = bs_pos.rows(); column = false; } if((nb_bs < method_len) || (3 != length(ms_pos))) { return false; } meas.set_size(method_len); vec pos(3); vec pos_ref(3); pos_ref = column ? bs_pos.get_col(0) : bs_pos.get_row(0); for(unsigned int k = 0; k < method_len; ++k) { if(bin(1) == method[k]) { /* hyperbolic */ pos = column ? bs_pos.get_col(k + 1) : bs_pos.get_row(k + 1); meas[k] = get_dist(pos, ms_pos) - get_dist(pos_ref, ms_pos); } else { /* spherical */ pos = column ? bs_pos.get_col(k) : bs_pos.get_row(k); meas[k] = get_dist(pos, ms_pos); } } return true; } //used only for hyperbolic multilateration static bool generate_meas(mat &meas, const bvec &method, const mat &bs_pos, const vec &ms_pos) { unsigned int k; unsigned int i; unsigned int method_len = length(method); unsigned int nb_bs = bs_pos.cols(); bool column = true; if(3 == nb_bs) { nb_bs = bs_pos.rows(); column = false; } if((nb_bs < method_len) || (3 != length(ms_pos))) { return false; } meas.set_size(nb_bs, nb_bs); vec pos_i(3); vec pos_k(3); for(k = 0; k < nb_bs; ++k) { pos_k = column ? bs_pos.get_col(k) : bs_pos.get_row(k); for(i = 0; i < nb_bs; ++i) { pos_i = column ? bs_pos.get_col(i) : bs_pos.get_row(i); meas(i, k) = get_dist(pos_i, ms_pos) - get_dist(pos_k, ms_pos); } } return true; } static bool get_bs(mat &bs_pos, unsigned int nb_bs, double l) { int n, i, j, k; static const double SQRT2M1 = 0.7071067811865475; if(8 < nb_bs) { it_warning("at most 8 BSs"); return false; } n = 0; i = j = k = 0; bs_pos.set_size(3, nb_bs); while((unsigned int)n < nb_bs) { bs_pos(0, n) = (0.5 - i) * l; bs_pos(1, n) = (0.5 - j) * l; bs_pos(2, n++) = (1 - 2 * k) * l * SQRT2M1; switch(n) { /*ensure that the first 4 BSs are not on the same plane*/ case 3: i = j = 0; k = 1; break; case 5: i = k = 1; j = 0; break; case 4: k = 0; i = j = 1; break; default: i = (i + 1) % 2; if((0 != n) && (0 == n % 2)) { j = (j + 1) % 2; } } } return true; } static vec get_ms(double radius) { static const double SQRT3M1 = 0.5773502691896258; vec out; out.set_size(3); for(int n = 0; n < 3; ++n) { out[n] = SQRT3M1 * radius * (2.0 * randu() - 1.0); } return out; } TEST(Multilateration, get_pos) { RNG_reset(0); const unsigned int nb_points = 10; const double eps = 1e-3; mat bs_pos; unsigned int method_len = 0;//NB: the number of BSs is greater by one for hyprid and hyperbolic bvec method; vec ms_pos; vec actual_ms_pos; unsigned int i; Multilateration multi; vec meas;//measurements vector for spherical and hybrid multilateration mat meas_hyper;//measurements matrix for hyperbolic multilateration //test inputs bs_pos.set_size(3, 4); method.set_size(4); method.zeros(); multi.setup(method, bs_pos); ASSERT_TRUE(Multilateration::MULTI_SPHERICAL == multi.get_type()); method(0) = 1; bs_pos.set_size(3, 5);//nb of BSs is the number of measures plus one multi.setup(method, bs_pos); ASSERT_TRUE(Multilateration::MULTI_HYBRID == multi.get_type()); method.ones(); multi.setup(method, bs_pos); ASSERT_TRUE(Multilateration::MULTI_HYPERBOLIC == multi.get_type()); for(method_len = 4; method_len < 8; ++method_len) { //spherical multilateration ASSERT_TRUE(get_bs(bs_pos, method_len, BASE_LINE_M)); method.set_size(method_len); method.zeros(); multi.setup(method, bs_pos); ms_pos = get_ms(SPHERE_RADIUS_M); ASSERT_TRUE(generate_meas(meas, method, bs_pos, ms_pos)); ASSERT_TRUE(multi.get_pos(actual_ms_pos, meas)); ASSERT_TRUE(point_eq(ms_pos, actual_ms_pos, eps)); actual_ms_pos.zeros(); //hybrid multilateration ASSERT_TRUE(get_bs(bs_pos, method_len + 1, BASE_LINE_M)); for(i = 0; i < (method_len - 1); ++i) { method[i] = 1; multi.setup(method, bs_pos); ms_pos = get_ms(SPHERE_RADIUS_M); ASSERT_TRUE(generate_meas(meas, method, bs_pos, ms_pos)); ASSERT_TRUE(multi.get_pos(actual_ms_pos, meas)); ASSERT_TRUE(point_eq(ms_pos, actual_ms_pos, eps)); actual_ms_pos.zeros(); } //hyperbolic multilateration method[i] = 1; multi.setup(method, bs_pos); ms_pos = get_ms(SPHERE_RADIUS_M); ASSERT_TRUE(generate_meas(meas_hyper, method, bs_pos, ms_pos)); ASSERT_TRUE(multi.get_pos(actual_ms_pos, meas_hyper)); ASSERT_TRUE(point_eq(ms_pos, actual_ms_pos, eps)); actual_ms_pos.zeros(); } #ifdef FULL_TESTS //test case when the last measure is always from TDOA for(method_len = 5; method_len < 8; ++method_len) { ASSERT_TRUE(get_bs(bs_pos, method_len + 1, BASE_LINE_M)); method.set_size(method_len); method.ones(); for(i = 0; i < (method_len - 1); ++i) { method[i] = 0; multi.setup(method, bs_pos); ms_pos = get_ms(SPHERE_RADIUS_M); EXPECT_TRUE(generate_meas(meas, method, bs_pos, ms_pos)); EXPECT_TRUE(multi.get_pos(actual_ms_pos, meas)); EXPECT_TRUE(point_eq(ms_pos, actual_ms_pos, eps)); actual_ms_pos.zeros(); } } #endif } TEST(Multilateration, get_crlb) { vec ms_pos(3); mat bs_pos; bvec method; unsigned int method_len = 4; double sigma2 = 0.0; Multilateration multi; unsigned int i; method.set_size(method_len); method.zeros(); ASSERT_TRUE(get_bs(bs_pos, method_len, BASE_LINE_M)); multi.setup(method, bs_pos); ms_pos = get_ms(SPHERE_RADIUS_M); double crlb = multi.get_crlb(ms_pos, sigma2); ASSERT_EQ(0.0, crlb); sigma2 = 1e-6; for(method_len = 4; method_len < 8; ++method_len) { ASSERT_TRUE(get_bs(bs_pos, method_len + 1, BASE_LINE_M)); method.set_size(method_len); method.zeros(); for(i = 0; i < method_len; ++i) { method(i) = 1; multi.setup(method, bs_pos); ms_pos = get_ms(SPHERE_RADIUS_M); crlb = multi.get_crlb(ms_pos, sigma2); ASSERT_NEAR(0.0, crlb, (i < 3) ? 1e-1 : 12); } } ms_pos.ones(); sigma2 = 0.1; for(method_len = 4; method_len < 8; ++method_len) { ASSERT_TRUE(get_bs(bs_pos, method_len, BASE_LINE_M)); method.set_size(method_len); method.zeros(); multi.setup(method, bs_pos); crlb = multi.get_crlb(ms_pos, sigma2); ASSERT_NEAR(0.5, crlb, 0.2); ASSERT_TRUE(get_bs(bs_pos, method_len + 1, BASE_LINE_M)); for(i = 0; i < method_len; ++i) { method(i) = 1; multi.setup(method, bs_pos); crlb = multi.get_crlb(ms_pos, sigma2); ASSERT_NEAR(0.5, crlb, 0.6); } } } itpp-4.3.1/gtests/newton_search_test.cpp000066400000000000000000000130441216575753400204270ustar00rootroot00000000000000/*! * \file * \brief Newton search test program * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; double rosenbrock(const vec &x) { double f1 = x(1) - sqr(x(0)), f2 = 1 - x(0); double F = 50 * sqr(f1) + 0.5 * sqr(f2) + 0.0; return F; } vec rosenbrock_gradient(const vec &x) { double f1 = x(1) - sqr(x(0)), f2 = 1 - x(0); vec g(2); g(0) = -200.0 * x(0) * f1 - f2; g(1) = 100.0 * f1; return g; } static const double tol = 1e-4; static void assert_vec_p(const vec &ref, const vec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) TEST(NewtonSearch, All) { // Test of Numerical optimization { // Line_Search vec x0 = "-1.2 1"; double F0 = rosenbrock(x0); vec g0 = rosenbrock_gradient(x0); vec h = -g0; Line_Search line; line.set_functions(rosenbrock, rosenbrock_gradient); ASSERT_NEAR(12.1, F0, tol); vec ref = "-107.8 -44"; assert_vec(ref, g0); ref = "107.8 44"; assert_vec(ref, h); double Fn; vec xn, gn; line.enable_trace(); ASSERT_TRUE(line.search(x0, F0, g0, h, xn, Fn, gn)); // Soft ref = "-0.876168 1.13218"; assert_vec(ref, xn); ASSERT_NEAR(8.40327, Fn, tol); ref = "61.9977 36.4507"; assert_vec(ref, gn); ASSERT_EQ(4, line.get_no_function_evaluations()); vec alpha_values, F_values, dF_values; line.get_trace(alpha_values, F_values, dF_values); // trace ref = "0 1 0.1 0.01 0.00300401"; assert_vec(ref, alpha_values); ref = "12.1 6405495599.3599997 373080.93204800034 102.17722267280001 8.40327"; assert_vec(ref, F_values); ref = "-13556.84 25963610893.439999 17461465.02672001 9898.07 8287.1771139224893"; assert_vec(ref, dF_values); line.set_method(Exact); ASSERT_TRUE(line.search(x0, F0, g0, h, xn, Fn, gn)); // Exact ref = "-1.03008 1.06935"; assert_vec(ref, xn); ASSERT_NEAR(2.06405, Fn, tol); ref = "-0.322427 0.828893"; assert_vec(ref, gn); ASSERT_EQ(7, line.get_no_function_evaluations()); line.get_trace(alpha_values, F_values, dF_values); // trace ref = "0 1 0.1 0.01 0.00300401 0.00165196 0.00148676 0.00157625"; assert_vec(ref, alpha_values); ref = "12.1 6405495599.3599997 373080.93204800034 102.17722267280001 8.40327 2.08432 2.09243 2.06405"; assert_vec(ref, F_values); ref = "-13556.84 25963610893.439999 17461465.02672001 9898.07 8287.1771139224893 531.883 -638.60641049642675 1.71365"; assert_vec(ref, dF_values); } { // Newton_Search vec x0 = "-1.2 1"; Newton_Search newton; newton.set_functions(rosenbrock, rosenbrock_gradient); newton.enable_trace(); vec xn, gn; ASSERT_TRUE(newton.search(x0, xn)); vec ref = "1 1"; assert_vec(ref, xn); ASSERT_NEAR(5.24508e-14, newton.get_function_value(), tol); ASSERT_NEAR(1.41687e-06, newton.get_stop_1(), tol); ASSERT_NEAR(9.32294e-06, newton.get_stop_2(), tol); ASSERT_EQ(38, newton.get_no_function_evaluations()); ASSERT_EQ(34, newton.get_no_iterations()); Array xv; vec Fv, ngv, dv; newton.get_trace(xv, Fv, ngv, dv); // trace ref = "-0.916319 1.11579"; assert_vec(ref, xv(0)); ref = "1 1"; assert_vec(ref, xv(xv.length()-1)); ref = "5.64904 1.5618 1.41629 1.2203 1.20012 1.18688 1.16266 1.11426 1.03385 0.841214 0.682837 0.634992 " "0.528517 0.395891 0.349639 0.224737 0.202608 0.149765 0.109608 0.0815102 0.0465651 0.0379422 0.0229203 " "0.0131056 0.00545953 0.0026574 0.000729924 0.000189087 2.7111e-05 4.66978e-06 5.98346e-07 4.12168e-08 " "2.55577e-11 5.24508e-14"; assert_vec(ref, Fv); ref = "48.6917 6.83035 9.16562 1.45963 2.87505 3.70968 4.45032 5.01409 4.59566 3.08462 1.58691 2.36257 " "3.0891 1.40777 3.52707 0.767488 3.04116 0.907026 1.22519 1.64112 0.351909 2.13814 0.643864 1.16604 " "0.458514 0.87564 0.575896 0.384089 0.0473799 0.0132776 0.0183764 0.00561985 0.000112443 1.41687e-06"; assert_vec(ref, ngv); ref = "0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 " "0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 0.1225 " "0.1225 0.1225"; assert_vec(ref, dv); newton.disable_trace(); // fminunc xn = fminunc(rosenbrock, rosenbrock_gradient, x0); ref = "-1.2 1"; assert_vec(ref, x0); ref = "1 1"; assert_vec(ref, xn); } } itpp-4.3.1/gtests/operators_test.cpp000066400000000000000000000064711216575753400176140ustar00rootroot00000000000000/*! * \file * \brief Operators test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itbase.h" #include "gtest/gtest.h" using namespace itpp; using std::complex; TEST(Operators, All) { //complex plus/minus scalar { //complex scalar complex x(1.0, 1.0); int y = 2; complex z = x+y; ASSERT_TRUE (complex(x.real()+y, x.imag()) == z); z = x-y; ASSERT_TRUE (complex(x.real()-y, x.imag()) == z); //complex vector vec x1_re("1 3"); vec x1_im("2 4"); cvec x1 = to_cvec(x1_re, x1_im); cvec z1 = x1+y; ASSERT_TRUE (to_cvec(x1_re+y, x1_im) == z1); z1 = x1-y; ASSERT_TRUE (to_cvec(x1_re-y, x1_im) == z1); //complex scalar double y1 = 2.7; z = x+y1; ASSERT_TRUE (complex(x.real()+y1, x.imag()) == z); z = x-y1; ASSERT_TRUE (complex(x.real()-y1, x.imag()) == z); //complex vector z1 = x1+y1; ASSERT_TRUE (to_cvec(x1_re+y1, x1_im) == z1); z1 = x1-y1; ASSERT_TRUE (to_cvec(x1_re-y1, x1_im) == z1); //complex matrix mat x2_re("1 3; 5 7"); mat x2_im("2 4; 6 8"); cmat x2 = to_cmat(x2_re, x2_im); cmat z2 = x2+complex(y1, 0); ASSERT_TRUE (to_cmat(x2_re+double(y1), x2_im) == z2); z2 = x2-complex(y1, 0); ASSERT_TRUE (to_cmat(x2_re-double(y1), x2_im) == z2); } //scalar plus/minus complex { //complex scalar int x = 2; complex y(1.0, 1.0); complex z = x+y; ASSERT_TRUE (complex(x+y.real(), y.imag()) == z); z = x-y; ASSERT_TRUE (complex(x-y.real(), -y.imag()) == z); //complex vector vec y1_re("1 3"); vec y1_im("2 4"); cvec y1 = to_cvec(y1_re, y1_im); cvec z1 = x+y1; ASSERT_TRUE (to_cvec(x+y1_re, y1_im) == z1); z1 = x-y1; ASSERT_TRUE (to_cvec(x-y1_re, -y1_im) == z1); //complex scalar double x1 = 2.7; z = x1+y; ASSERT_TRUE (complex(x1+y.real(), y.imag()) == z); z = x1-y; ASSERT_TRUE (complex(x1-y.real(), -y.imag()) == z); //complex vector z1 = x1+y1; ASSERT_TRUE (to_cvec(x1+y1_re, y1_im) == z1); z1 = x1-y1; ASSERT_TRUE (to_cvec(x1-y1_re, -y1_im) == z1); //complex matrix mat y2_re("1 3; 5 7"); mat y2_im("2 4; 6 8"); cmat y2 = to_cmat(y2_re, y2_im); cmat z2 = complex(x1, 0)+y2; ASSERT_TRUE (to_cmat(x1+y2_re, y2_im) == z2); z2 = complex(x1, 0)-y2; ASSERT_TRUE (to_cmat(x1-y2_re, -y2_im) == z2); } } itpp-4.3.1/gtests/parser_test.cpp000066400000000000000000000155421216575753400170710ustar00rootroot00000000000000/*! * \file * \brief Parser test program * \author Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static void assert_vec_p(const vec &ref, const vec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) static void assert_mat_p(const mat &ref, const mat &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol) << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) static void assert_cvec_p(const cvec &ref, const cvec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line; ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line; } } #define assert_cvec(ref, act) assert_cvec_p(ref, act, __LINE__) TEST(Parser, all) { #ifndef PARSER_TEST_FILE ASSERT_TRUE(false) << "PARSER_TEST_FILE not defined. Test skipped."; #else const double tol = 1e-12; Parser p; int a; double b; string c; ivec d; vec e; svec f; bvec g; imat h; mat i; smat j; bmat k; bool l, m; string n; Array > o, q; p.set_silentmode(true); // Use the Parser class on a parameter file p.init(string(PARSER_TEST_FILE)); a = p.get_int("a"); ASSERT_EQ(4, a); b = p.get_double("b"); //The default value of b ASSERT_NEAR(2.35, b, tol); b = p.get_double("b", 1); //The first alternative value of b ASSERT_NEAR(2.36, b, tol); b = p.get_double("b", 2); //The second alternative value of b ASSERT_NEAR(2.37, b, tol); c = p.get_string("c"); ASSERT_TRUE(string("Hello World") == c); d = p.get_ivec("d"); ivec ref_i = "1 2 3 4 3 2 -1"; ASSERT_TRUE(ref_i == d); e = p.get_vec("e"); vec ref = "1.2 2 3.33 4.01 3.2 2 -1.2"; assert_vec(ref, e); f = p.get_svec("f"); svec ref_s = "1 2 3 4 3 2 -1"; ASSERT_TRUE(ref_s == f); g = p.get_bvec("g"); bvec ref_b = "0 1 0 0 1"; ASSERT_TRUE(ref_b == g); h = p.get_imat("h"); imat ref_imat = "1 2 3; 4 5 6"; ASSERT_TRUE(ref_imat == h); i = p.get_mat("i"); mat ref_mat = "1 2; -3 4.2"; assert_mat(ref_mat, i); j = p.get_smat("j"); smat ref_smat = "1 -2 -3; 4 -5 6"; ASSERT_TRUE(ref_smat == j); k = p.get_bmat("k"); bmat ref_bmat = "0 1 0 1; 1 0 1 0; 0 0 0 0; 1 1 1 1"; ASSERT_TRUE(ref_bmat == k); l = p.get_bool("l"); ASSERT_FALSE(l); m = p.get_bool("m"); ASSERT_TRUE(m); n = p.get_string("n"); ASSERT_TRUE(string("Hello World") == n); // Use the Parser class on a char pointer (usually the command line input) char argv1_0[] = "a=345"; char argv1_1[] = "b=1.001"; char argv1_2[] = "c=\"Hello Bird\""; char argv1_3[] = "d=[1,2,3,-1,-2,-3]"; int argc1 = 4; char *argv1[4] = { argv1_0, argv1_1, argv1_2, argv1_3 }; p.init(argc1, argv1); a = p.get_int("a"); ASSERT_EQ(345, a); b = p.get_double("b"); ASSERT_DOUBLE_EQ(1.001, b); c = p.get_string("c"); ASSERT_TRUE(string("Hello Bird") == c); d = p.get_ivec("d"); ref_i = "1 2 3 -1 -2 -3"; ASSERT_TRUE(ref_i == d); // Use the Parser class on a parameter file and a char pointer // The data in the char pointer are selected first. The data in the // file are used as default values char argv2_0[] = "a=345"; char argv2_1[] = "d=[1,-2,3,-4,5,-6,7,-8]"; int argc2 = 2; char *argv2[2] = { argv2_0, argv2_1 }; p.init(string(PARSER_TEST_FILE), argc2, argv2); a = p.get_int("a"); ASSERT_EQ(345, a); b = p.get_double("b"); ASSERT_DOUBLE_EQ(2.35, b); c = p.get_string("c"); ASSERT_TRUE(string("Hello World") == c); d = p.get_ivec("d"); ref_i = "1 -2 3 -4 5 -6 7 -8"; ASSERT_TRUE(ref_i == d); // Use the Parser class on an Array of strings Array parser_data(4); parser_data(0) = "a=-11"; parser_data(1) = "b=3.14"; parser_data(2) = "c=\"Hello Nerd\""; parser_data(3) = "d=[0,1,2,0,3,4,7]"; p.init(parser_data); a = p.get_int("a"); ASSERT_EQ(-11, a); b = p.get_double("b"); ASSERT_DOUBLE_EQ(3.14, b); c = p.get_string("c"); ASSERT_TRUE(string("Hello Nerd") == c); d = p.get_ivec("d"); ref_i = "0 1 2 0 3 4 7"; ASSERT_TRUE(ref_i == d); // Use the Parser::get() method on a parameter file p.init(string(PARSER_TEST_FILE)); ASSERT_TRUE(p.get(a, "a")); ASSERT_TRUE(p.get(b, "b")); ASSERT_TRUE(p.get(b, "b", 1)); ASSERT_TRUE(p.get(b, "b", 2)); ASSERT_TRUE(p.get(c, "c")); ASSERT_TRUE(p.get(d, "d")); ASSERT_TRUE(p.get(e, "e")); ASSERT_TRUE(p.get(f, "f")); ASSERT_TRUE(p.get(g, "g")); ASSERT_TRUE(p.get(h, "h")); ASSERT_TRUE(p.get(i, "i")); ASSERT_TRUE(p.get(j, "j")); ASSERT_TRUE(p.get(k, "k")); ASSERT_TRUE(p.get(l, "l")); ASSERT_TRUE(p.get(m, "m")); ASSERT_TRUE(p.get(n, "n")); ASSERT_TRUE(p.get(o, "o")); // The following tries can not be found in the data file, so their initial // values should not be changed: set_array(q, "{{[1][2 3][4 5 6]}}"); ASSERT_FALSE(p.get(q, "q")); cvec ref_c = "1"; assert_cvec(ref_c, q(0)(0)); ref_c = "2 3"; assert_cvec(ref_c, q(0)(1)); ref_c = "4 5 6"; assert_cvec(ref_c, q(0)(2)); bool r = true; ASSERT_FALSE(p.get(r, "r")); ASSERT_TRUE(r); int s = 7; ASSERT_FALSE(p.get(s, "s")); ASSERT_EQ(7, s); double t = 3.14; ASSERT_FALSE(p.get(t, "t")); ASSERT_DOUBLE_EQ(3.14, t); std::string u = "test string"; p.get(u, "u"); ASSERT_TRUE(string("test string") == u); // Check if variables exist in the Parser ASSERT_TRUE(p.exist("a")); ASSERT_FALSE(p.exist("aa")); #endif /* ----- #ifndef PARSER_TEST_FILE ----- */ } itpp-4.3.1/gtests/parser_test_data.txt000066400000000000000000000035221216575753400201120ustar00rootroot00000000000000%--------------------------------------------------------------------- % Test data file for the parser_test.cpp program %--------------------------------------------------------------------- % Lines that begins with % are ignored. Expressions that ends with ';' % are not printed while parsing. a = 4; %Comments may be put at the end of each line % You can give several values for the same parameter name. Each % alternative value must be on a new row. Select the value you % want with the num parameter in the get_double member function. % Use: % Parser p("filename.txt"); % double b = p.get_double("b",1); % to select the value 2.36 below. b = 2.35 2.36 2.37 % Several expressions may be put on the same row (separated by , or ;) % c is a string, d is an integer vector. Spaces and/or commas separate % the vector elements. c = "Hello World"; d =[1,2,3 4,3 2, -1]; % This a vector. e=[1.2,2,3.33 4.01,3.2 2, -1.2]; % This is a short vector. f=[1,2,3 4,3 2, -1]; % This is a binary vector. g=[0 1 0 0 1]; % This an integer matrix. Spaces and/or commas separate the colums. Semicolons separate rows. h=[1 2 3;4 5 6]; % Expressions can continue over several rows by inserting '...' at the end of the rows % (as in Matlab). This is a matrix. i=[... 1.0, 2 ; ... -3 4.2 ... ] ; % This is a short matrix. j=[1 -2 -3;4 -5 6]; % This is a binary matrix. k=[0 1 0 1;1 0 1 0;0 0 0 0;1 1 1 1]; % These are boolean variables: l= 0; m= true; % This is a string with single instead of double quotes (For Matlab compatibility) n='Hello World'; % This is an Array > % In Matlab, the elements defined below are accessible as % o{1}{1}, o{1}{2} and o{2}{1}; note the curly brackets. % For complex numbers, both 1+2i and (1,2) are allowed formats, % but only the first one is Matlab compatible. o = {{[1+2i 3+4i] [5+6i]} {[7 8 9]}} itpp-4.3.1/gtests/poly_test.cpp000066400000000000000000000077671216575753400165720ustar00rootroot00000000000000/*! * \file * \brief Polynomial routines test program * \author Tony Ottosson, Adam Piatyszek and Kumar Appaiah * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static const double tol = 1e-4; static void assert_vec_p(const vec &ref, const vec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) static void assert_cvec_p(const cvec &ref, const cvec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line; ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line; } } #define assert_cvec(ref, act) assert_cvec_p(ref, act, __LINE__) TEST(Poly, All) { // Test of polynomial routines RNG_reset(0); { vec r = randn(3); vec p = poly(r); cvec r2 = roots(p); vec ref = "1 0.78536 -1.17803 -0.706159"; assert_vec(ref, p); cvec ref_c = "1.02823+0i -1.27491+0i -0.538679+0i"; assert_cvec(ref_c, r2); r = randn(7); p = poly(r); r2 = roots(p); ref = "1 0.647219 -1.88626 -1.74412 0.41764 0.836933 0.256015 0.0203118"; assert_vec(ref, p); ref_c = "1.29011+0i 0.810909+0i -0.878434+0i -0.701279+0i -0.675383+0i -0.36545+0i -0.127694+0i"; assert_cvec(ref_c, r2); vec x = randn(9); vec y = polyval(p, x); ref = "0.00138573 -7328.4084433054286 0.00124015 -0.00711672 0.134252 -0.770298 0.217109 0.000511238 0.0242297"; assert_vec(ref, y); } { // Complex polynomials cvec r = randn_c(3); cvec p = poly(r); cvec r2 = roots(p); cvec ref_c = "1+0i -1.10462-0.379596i -0.0905352+0.4853i 0.301401-0.079591i"; assert_cvec(ref_c, p); ref_c = "-0.431614+0.247334i 0.916952-0.138225i 0.619278+0.270487i"; assert_cvec(ref_c, r2); r = randn_c(7); p = poly(r); r2 = roots(p); ref_c = "1+0i -2.34578+0.115557i 2.61793+0.471743i -1.41308-1.24427i 0.50249+0.79891i -0.119019-0.3526i " "0.0871739+0.177806i 0.0285549-0.0501647i"; assert_cvec(ref_c, p); ref_c = "0.90716-1.03694i 1.02353+0.413753i 0.630181-0.360109i -0.106531-0.45369i -0.329949+0.453123i " "0.179862+0.480134i 0.0415308+0.388173i"; assert_cvec(ref_c, r2); cvec x = randn_c(9); cvec y = polyval(p, x); ref_c = "62.9076+74.3315i -0.00908609-0.0502987i -12.7646-15.3766i -0.218263-0.631535i -1.23503-9.01664i " "-3.51764+7.19977i 0.273831+0.59537i -0.023377-0.00661798i 0.0748359+0.191528i"; assert_cvec(ref_c, y); } { // Chebyshev polynomial vec x = randn(8); vec ref = "2061173.0875914963 151.508 0.186741 0.187703 -0.767701 12825.119165891341 1968.4127832291322 923658.76088428847"; assert_vec(ref, cheb(10, x)); ref = "-4184915494.8777189 2637.3130287898421 0.48261 -0.481323 -0.864083 -2054031.5518480411 -123506.33117417867 " "1255400590.6012175"; assert_vec(ref, cheb(15, x)); } } itpp-4.3.1/gtests/pulse_shape_test.cpp000066400000000000000000000467111216575753400201070ustar00rootroot00000000000000/*! * \file * \brief Pulse shaping classes test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace std; using namespace itpp; static const double tol = 1e-4; static void assert_vec_p(const vec &ref, const vec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) static void assert_cvec_p(const cvec &ref, const cvec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line; ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line; } } #define assert_cvec(ref, act) assert_cvec_p(ref, act, __LINE__) TEST(PulseShape, All) { // Test of pulse shaping routines RNG_reset(0); BPSK bpsk; vec symbols, samples, rsymbols; Root_Raised_Cosine rrc_tx(0.5), rrc_rx(0.5); Raised_Cosine rc_tx(0.5); bpsk.modulate_bits(randb(20), symbols); samples = rrc_tx.shape_symbols(symbols); rsymbols = rrc_rx.shape_samples(samples); // Root Raised Cosine; real input vec ref = "0.00107181 -0.0027027 -0.00581667 -0.00696875 -0.00530516 -0.000815537 0.00546883 0.0115738 0.0150053 " "0.0134306 0.00546883 -0.00861562 -0.0265258 -0.0440088 -0.0554523 -0.0549318 -0.0375132 -0.000532387 0.0554523 " "0.126288 0.204577 0.280729 0.344536 0.386975 0.401856 0.386975 0.344536 0.280729 0.204577 0.126288 0.0554523 " "-0.000532387 -0.0375132 -0.0549318 -0.0554523 -0.0440088 -0.0265258 -0.00861562 0.00546883 0.0134306 0.0150053 " "0.0115738 0.00546883 -0.000815537 -0.00530516 -0.00696875 -0.00581667 -0.0027027 0.00107181"; assert_vec(ref, rrc_tx.get_pulse_shape()); ref = "-0.00107181 0.0027027 0.00581667 0.00696875 0.00530516 0.000815537 -0.00546883 -0.0115738 -0.0160771 " "-0.0107279 0.000347842 0.0155844 0.031831 0.0448243 0.0499834 0.0433579 0.0214361 -0.0101955 -0.0551044 " "-0.110704 -0.172746 -0.235905 -0.294553 -0.343617 -0.38042 -0.397171 -0.399641 -0.391433 -0.377324 -0.362193 " "-0.350005 -0.343085 -0.340763 -0.347645 -0.355822 -0.361361 -0.361408 -0.355208 -0.344536 -0.333368 -0.327901 " "-0.326952 -0.338719 -0.36384 -0.398545 -0.434626 -0.460562 -0.463676 -0.43401 -0.354878 -0.238753 -0.094032 " "0.063662 0.214849 0.339415 0.420138 0.446872 0.414732 0.327782 0.200912 0.0530516 -0.0956631 -0.227815 -0.33173 " "-0.401856 -0.442221 -0.461257 -0.465795 -0.462207 -0.453488 -0.438686 -0.413668 -0.373989 -0.304869 -0.216877 " "-0.112894 1.38778e-17 0.112894 0.216877 0.304869 0.373989 0.413668 0.438686 0.453488 0.462207 0.465795 0.461257 " "0.442221 0.401856 0.33173 0.227815 0.0956631 -0.0530516 -0.200912 -0.327782 -0.414732 -0.446872 -0.420138 " "-0.339415 -0.214849 -0.063662 0.094032 0.238753 0.354878 0.431866 0.469082 0.472195 0.448563 0.409155 0.365471 " "0.327782 0.303804 0.296819 0.30921 0.339415 0.379408 0.419765 0.450195 0.461257 0.445934 0.399712 0.333422 " "0.239448 0.125201 -1.38778e-17 -0.125201 -0.239448 -0.333422 -0.399712 -0.445934 -0.461257 -0.450195 -0.419765 " "-0.379408 -0.339415 -0.30921 -0.296819 -0.303804 -0.327782 -0.365471 -0.409155 -0.448563 -0.472195 -0.469082 " "-0.431866 -0.354878 -0.238753 -0.094032 0.063662 0.214849 0.339415 0.420138 0.446872 0.414732 0.327782 0.200912 " "0.0530516 -0.0956631 -0.227815 -0.33173"; assert_vec(ref, samples); ref = "-1.14877e-06 5.79353e-06 5.16411e-06 -1.65031e-05 -6.01302e-05 -0.000107998 -0.000126412 -7.86767e-05 " "5.33562e-05 0.000260324 0.000459271 0.000528627 0.00034915 -0.000140663 -0.000892236 -0.00171907 -0.00231299 " "-0.00229884 -0.00137958 0.000562355 0.00336609 0.00655046 0.00935825 0.0108978 0.0103664 0.00732923 0.00192998 " "-0.00492754 -0.0115725 -0.0157611 -0.0150763 -0.00748811 0.00802133 0.0308814 0.0586051 0.0867172 0.109087 " "0.118648 0.108416 0.0726618 0.00800958 -0.0857266 -0.205223 -0.343836 -0.492374 -0.640337 -0.777394 -0.894844 " "-0.986783 -1.05073 -1.08773 -1.10165 -1.09811 -1.08321 -1.06236 -1.03947 -1.01677 -0.995122 -0.974794 -0.956374 " "-0.941541 -0.933381 -0.936049 -0.953742 -0.989175 -1.04189 -1.10689 -1.17398 -1.22825 -1.25181 -1.22656 -1.13759 " "-0.976659 -0.744793 -0.453718 -0.125306 0.210732 0.520675 0.771508 0.935703 0.995194 0.943845 0.788112 0.545574 " "0.241958 -0.0928153 -0.428764 -0.739431 -1.00437 -1.21023 -1.35063 -1.42483 -1.43609 -1.38985 -1.29244 -1.15025 " "-0.96958 -0.756879 -0.519122 -0.264014 -2.08438e-17 0.264014 0.519122 0.756879 0.969578 1.15026 1.29245 1.38982 " "1.43597 1.42462 1.35038 1.21007 1.00447 0.739946 0.429677 0.0938891 -0.241199 -0.545747 -0.78977 -0.947205 -0.999873 " "-0.940561 -0.774727 -0.520079 -0.204349 0.138547 0.473327 0.768307 0.999707 1.15454 1.23178 1.24143 1.20186 " "1.13612 1.06763 1.01617 0.994738 1.00769 1.05044 1.11059 1.17023 1.20906 1.20773 1.1509 1.02972 0.843259 0.598789 " "0.310972 2.53974e-17 -0.310972 -0.598789 -0.843259 -1.02972 -1.1509 -1.20773 -1.20906 -1.17023 -1.11059 -1.05044 -1.00769"; assert_vec(ref, rsymbols); samples = rc_tx.shape_symbols(symbols); // Raised Cosine; real input ref = "8.95103e-34 0.00113767 0.00477279 0.0105661 0.0171489 0.0221856 0.0227496 0.015992 -1.29939e-17 -0.0253289 " "-0.0576127 -0.0917169 -0.120042 -0.133416 -0.122502 -0.0795251 3.06162e-17 0.115879 0.262504 0.428983 0.600211 " "0.758749 0.887236 0.970942 1 0.970942 0.887236 0.758749 0.600211 0.428983 0.262504 0.115879 3.06162e-17 " "-0.0795251 -0.122502 -0.133416 -0.120042 -0.0917169 -0.0576127 -0.0253289 -1.29939e-17 0.015992 0.0227496 " "0.0221856 0.0171489 0.0105661 0.00477279 0.00113767 8.95103e-34"; assert_vec(ref, rc_tx.get_pulse_shape()); ref = "-8.95103e-34 -0.00113767 -0.00477279 -0.0105661 -0.0171489 -0.0221856 -0.0227496 -0.015992 1.29939e-17 " "0.0241912 0.0528399 0.0811508 0.102893 0.11123 0.0997521 0.0635331 -1.76223e-17 -0.0916881 -0.209664 " "-0.347832 -0.497318 -0.647518 -0.787484 -0.907409 -1 -1.06263 -1.0969 -1.10658 -1.09753 -1.0765 -1.04999 " "-1.02329 -1 -0.980829 -0.964853 -0.952033 -0.943189 -0.940413 -0.946876 -0.965975 -1 -1.04975 -1.11237 " "-1.17878 -1.23472 -1.26218 -1.24215 -1.15815 -1 -0.767338 -0.47214 -0.137385 0.205787 0.522147 0.777324 " "0.942787 1 0.945062 0.78687 0.543279 0.240084 -0.0930137 -0.426641 -0.735354 -1 -1.20653 -1.34783 -1.42448 " "-1.44051 -1.40124 -1.31188 -1.17682 -1 -0.786012 -0.541866 -0.276447 3.46945e-17 0.276447 0.541866 0.786012 " "1 1.17682 1.31188 1.40124 1.44051 1.42448 1.34783 1.20653 1 0.735354 0.426641 0.0930137 -0.240084 -0.543279 " "-0.78687 -0.945062 -1 -0.942787 -0.777324 -0.522147 -0.205787 0.137385 0.47214 0.767338 1 1.15587 1.23261 " "1.24105 1.20042 1.13441 1.06687 1.01777 1 1.0155 1.05733 1.11328 1.16612 1.19668 1.18711 1.12389 1 0.81572 " "0.57782 0.299687 6.93889e-18 -0.299687 -0.57782 -0.81572 -1 -1.12389 -1.18711 -1.19668 -1.16612 -1.11328 " "-1.05733 -1.0155 -1 -1.01777 -1.06687 -1.13441 -1.20042 -1.24105 -1.23261 -1.15587 -1 -0.767338 -0.47214 " "-0.137385 0.205787 0.522147 0.777324 0.942787 1 0.945062 0.78687 0.543279 0.240084 -0.0930137 -0.426641 -0.735354"; assert_vec(ref, samples); QPSK qpsk; cvec csymbols, csamples, crsymbols; Root_Raised_Cosine > crrc_tx(0.5), crrc_rx(0.5); Raised_Cosine > crc_tx(0.5); qpsk.modulate_bits(randb(40), csymbols); csamples = crrc_tx.shape_symbols(csymbols); crsymbols = crrc_rx.shape_samples(csamples); // Root Raised Cosine; complex input ref = "0.00107181 -0.0027027 -0.00581667 -0.00696875 -0.00530516 -0.000815537 0.00546883 0.0115738 0.0150053 " "0.0134306 0.00546883 -0.00861562 -0.0265258 -0.0440088 -0.0554523 -0.0549318 -0.0375132 -0.000532387 0.0554523 " "0.126288 0.204577 0.280729 0.344536 0.386975 0.401856 0.386975 0.344536 0.280729 0.204577 0.126288 0.0554523 " "-0.000532387 -0.0375132 -0.0549318 -0.0554523 -0.0440088 -0.0265258 -0.00861562 0.00546883 0.0134306 0.0150053 " "0.0115738 0.00546883 -0.000815537 -0.00530516 -0.00696875 -0.00581667 -0.0027027 0.00107181"; assert_vec(ref, crrc_tx.get_pulse_shape()); cvec ref_c = "0.00107181+0i -0.0027027+0i -0.00581667+0i -0.00696875+0i -0.00530516+0i -0.000815537+0i 0.00546883+0i " "0.0115738+0i 0.0150053-0.00107181i 0.0134306+0.0027027i 0.00546883+0.00581667i -0.00861562+0.00696875i " "-0.0265258+0.00530516i -0.0440088+0.000815537i -0.0554523-0.00546883i -0.0549318-0.0115738i -0.0364414-0.0150053i " "-0.00323508-0.0134306i 0.0496356-0.00546883i 0.119319+0.00861562i 0.199272+0.0265258i 0.279913+0.0440088i " "0.350005+0.0554523i 0.398549+0.0549318i 0.415789+0.0375132i 0.403109+0.000532387i 0.355822-0.0554523i " "0.279082-0.126288i 0.183357-0.204577i 0.083095-0.280729i -0.00546883-0.344536i -0.067038-0.386975i " "-0.0900316-0.402928i -0.0688947-0.384273i -0.00546883-0.338719i 0.0908951-0.27376i 0.204577-0.199272i " "0.316122-0.125473i 0.405457-0.0609211i 0.455338-0.0110414i 0.454374+0.0214361i 0.399082+0.0442039i " "0.294553+0.0558001i 0.153625+0.0595931i -0.00530516+0.0583568i -0.161409+0.0534399i -0.294901+0.0445146i " "-0.39021+0.0299274i -0.439369+0.00750264i -0.439204-0.024472i -0.394172-0.0663899i -0.317769-0.116857i " "-0.225798-0.172746i -0.134088-0.229751i -0.0554523-0.283267i 0.00238914-0.329341i 0.0375132-0.366486i " "0.053075-0.38374i 0.0554523-0.394172i 0.0518088-0.400048i 0.0477465-0.40385i 0.0456556-0.406202i 0.0441668-0.405457i " "0.0387985-0.398017i 0.0235797-0.38042i -0.0110414-0.342772i -0.0609211-0.288736i -0.125473-0.221136i " "-0.199272-0.146221i -0.27376-0.0728483i -0.338719-0.0109377i -0.384273+0.0304597i -0.402928+0.0460876i " "-0.386975+0.027757i -0.344536-0.0167543i -0.280729-0.079817i -0.204577-0.151526i -0.126288-0.221951i " "-0.0554523-0.283267i 0.000532387-0.331198i 0.0375132-0.366486i 0.0549318-0.381884i 0.0554523-0.394172i " "0.0440088-0.407848i 0.0265258-0.42507i 0.00861562-0.443242i -0.00546883-0.455093i -0.0134306-0.450246i " "-0.0150053-0.419005i -0.0115738-0.343304i -0.00546883-0.233284i 0.000815537-0.0948476i 0.00530516+0.0583568i " "0.00696875+0.207881i 0.00581667+0.333598i 0.0027027+0.417435i -0.00214361+0.446872i 0.0027027+0.417435i " "0.00581667+0.333598i 0.00696875+0.207881i 0.00530516+0.0583568i 0.000815537-0.0948476i -0.00546883-0.233284i " "-0.0115738-0.343304i -0.0139335-0.417933i -0.0161333-0.452949i -0.0112855-0.460909i 0.00164687-0.45021i " "0.0212207-0.430376i 0.0431932-0.408664i 0.0609211-0.388703i 0.0665056-0.37031i 0.0525185-0.349337i " "0.013963-0.323172i -0.0499834-0.289432i -0.134904-0.244504i -0.231103-0.188662i -0.324738-0.125457i " "-0.399988-0.0612689i -0.441907-0.00402706i -0.439369+0.0375132i -0.387508+0.0594912i -0.289084+0.0612689i " "-0.154441+0.0431774i 0+0.0106103i 0.154441-0.0276089i 0.289084-0.0605732i 0.387508-0.0772335i 0.439369-0.0696673i " "0.441907-0.0228341i 0.399988+0.0503313i 0.324738+0.142688i 0.231103+0.241714i 0.134904+0.332522i " "0.0499834+0.400336i -0.013963+0.433036i -0.0525185+0.424364i -0.0665056+0.371374i -0.0609211+0.277798i " "-0.0431932+0.156088i -0.0212207+0.0212207i -0.00164687-0.111247i 0.0112855-0.228163i 0.0161333-0.321002i " "0.0128617-0.386851i 0.0142765-0.427944i 0.0112855-0.449972i 0.00615321-0.459641i 0-0.462207i -0.00615321-0.459641i " "-0.0112855-0.449972i -0.0142765-0.427944i -0.0150053-0.386851i -0.0107279-0.321002i 0.000347842-0.228163i " "0.0155844-0.111247i 0.031831+0.0212207i 0.0448243+0.156088i 0.0499834+0.277798i 0.0433579+0.371374i"; assert_cvec(ref_c, csamples); ref_c = "1.14877e-06+0i -5.79353e-06+0i -5.16411e-06+0i 1.65031e-05+0i 6.01302e-05+0i 0.000107998+0i 0.000126412+0i " "7.86767e-05+0i -5.4505e-05-1.14877e-06i -0.00025453+5.79353e-06i -0.000454107+5.16411e-06i -0.00054513-1.65031e-05i " "-0.00040928-6.01302e-05i 3.26645e-05-0.000107998i 0.000765824-0.000126412i 0.00164039-7.86767e-05i 0.00236749+5.4505e-05i " "0.00255337+0.00025453i 0.00183369+0.000454107i -1.72249e-05+0.00054513i -0.00295681+0.00040928i -0.00658312-3.26645e-05i " "-0.0101241-0.000765824i -0.0125382-0.00164039i -0.0127351-0.00236634i -0.00987681-0.00255917i -0.0037585-0.00183885i " "0.00492827+3.37281e-05i 0.0144692+0.00301694i 0.0222362+0.00669112i 0.025074+0.0102505i 0.0199476+0.0126168i " "0.00476824+0.0126783i -0.0207501+0.00963387i -0.0543925+0.00331472i -0.0911003-0.0055064i -0.123147-0.0149987i " "-0.140917-0.0224196i -0.134256-0.024561i -0.0942497-0.0184646i -0.0151453-0.00229404i 0.103923+0.0238241i " "0.257782+0.0571447i 0.434953+0.0921403i 0.618478+0.120889i 0.787837+0.134052i 0.921774+0.122347i 1.00163+0.0782734i " "1.01466-0.00221228i 0.956699-0.118415i 0.833718-0.264315i 0.661716-0.428851i 0.464984-0.597096i 0.272817-0.752176i " "0.11513-0.877604i 0.0176536-0.959653i -0.002492-0.989322i 0.0599364-0.963554i 0.19683-0.885613i 0.387394-0.764307i " "0.600932-0.612504i 0.801383-0.445158i 0.952877-0.277241i 1.02542-0.121958i 0.999715+0.0104849i 0.870345+0.113445i " "0.646754+0.183694i 0.35175+0.220843i 0.0179555+0.226489i -0.317224+0.203352i -0.617217+0.154598i -0.85153+0.0834514i " "-0.999734-0.00690592i -1.05361-0.113243i -1.01727-0.23207i -0.905208-0.359534i -0.739017-0.491435i -0.543387-0.623365i " "-0.342212-0.750929i -0.155501-0.869953i 0.0024659-0.976598i 0.123583-1.0673i 0.205125-1.13875i 0.248149-1.18759i " "0.255608-1.21042i 0.230749-1.20393i 0.176161-1.1654i 0.0936737-1.09351i -0.0149818-0.989149i -0.147035-0.856266i " "-0.297489-0.702322i -0.458324-0.538057i -0.618418-0.376641i -0.764341-0.232223i -0.881946-0.118129i -0.958448-0.0450215i " "-0.984588-0.0194324i -0.956366-0.0429516i -0.876067-0.112261i -0.752127-0.219976i -0.597975-0.356077i -0.430049-0.509566i " "-0.26535-0.66993i -0.119003-0.828077i -0.00226564-0.976543i 0.0786795-1.109i 0.123049-1.21942i 0.13483-1.30095i " "0.121478-1.34543i 0.0922487-1.34353i 0.056495-1.28597i 0.0222508-1.16543i -0.00471259-0.978988i -0.0212782-0.730363i " "-0.0268539-0.431444i -0.022931-0.102415i -0.0123911+0.229627i 0.00121738+0.533584i 0.014331+0.77839i 0.0238911+0.937463i " "0.027724+0.992771i 0.0248041+0.937721i 0.0153989+0.778308i 0.00116749+0.532195i -0.0149386+0.22602i -0.0289689-0.108637i " "-0.0365239-0.439825i -0.0335619-0.739512i -0.0173931-0.986829i 0.0122953-1.16976i 0.0526101-1.28527i 0.097069-1.33769i " "0.135887-1.33623i 0.15705-1.29218i 0.148128-1.21637i 0.0986329-1.11756i 0.00250145-1.00187i -0.139753-0.873213i " "-0.319742-0.734629i -0.521149-0.589586i -0.721122-0.443193i -0.893044-0.302671i -1.01032-0.176894i -1.05062-0.0750385i " "-0.999736-0.00463313i -0.854513+0.0305213i -0.624153+0.0319934i -0.329421+0.00743645i -6.01302e-05-0.0299373i " "0.329297-0.0631639i 0.624032-0.0743647i 0.85444-0.0481098i 0.999787+0.0253505i 1.05088+0.147654i 1.01079+0.31122i " "0.893556+0.499822i 0.721411+0.690715i 0.520901+0.858007i 0.318724+0.976665i 0.137955+1.02644i"; assert_cvec(ref_c, crsymbols); csamples = crc_tx.shape_symbols(csymbols); // Raised Cosine; complex input ref = "8.95103e-34 0.00113767 0.00477279 0.0105661 0.0171489 0.0221856 0.0227496 0.015992 -1.29939e-17 -0.0253289 " "-0.0576127 -0.0917169 -0.120042 -0.133416 -0.122502 -0.0795251 3.06162e-17 0.115879 0.262504 0.428983 0.600211 " "0.758749 0.887236 0.970942 1 0.970942 0.887236 0.758749 0.600211 0.428983 0.262504 0.115879 3.06162e-17 -0.0795251 " "-0.122502 -0.133416 -0.120042 -0.0917169 -0.0576127 -0.0253289 -1.29939e-17 0.015992 0.0227496 0.0221856 0.0171489 " "0.0105661 0.00477279 0.00113767 8.95103e-34"; assert_vec(ref, crc_tx.get_pulse_shape()); ref_c = "8.95103e-34+0i 0.00113767+0i 0.00477279+0i 0.0105661+0i 0.0171489+0i 0.0221856+0i 0.0227496+0i 0.015992+0i " "-1.29939e-17-8.95103e-34i -0.0253289-0.00113767i -0.0576127-0.00477279i -0.0917169-0.0105661i -0.120042-0.0171489i " "-0.133416-0.0221856i -0.122502-0.0227496i -0.0795251-0.015992i 3.06162e-17+1.29939e-17i 0.117017+0.0253289i " "0.267277+0.0576127i 0.439549+0.0917169i 0.61736+0.120042i 0.780934+0.133416i 0.909986+0.122502i 0.986934+0.0795251i " "1-3.06162e-17i 0.944475-0.115879i 0.824851-0.262504i 0.656466-0.428983i 0.46302-0.600211i 0.273381-0.758749i " "0.117252-0.887236i 0.0203623-0.970942i 7.42262e-17-1i 0.0616832-0.972079i 0.197615-0.892009i 0.387284-0.769315i " "0.600211-0.61736i 0.800447-0.451168i 0.952125-0.285253i 1.02514-0.131871i 1-1.76223e-17i 0.871054+0.103716i " "0.647482+0.175342i 0.351951+0.214566i 0.0171489+0.222935i -0.3192+0.202947i -0.61996+0.157365i -0.853925+0.088862i " "-1-4.62836e-18i -1.0516-0.106542i -1.01451-0.227641i -0.90273-0.359451i -0.737402-0.497318i -0.542885-0.635899i " "-0.342866-0.769507i -0.1572-0.892554i -3.06162e-17-1i 0.120846-1.08796i 0.202864-1.15451i 0.247318-1.1983i " "0.257233-1.21757i 0.235699-1.20992i 0.184887-1.17249i 0.105992-1.10281i -1.76223e-17-1i -0.131871-0.867225i " "-0.285253-0.711894i -0.451168-0.544182i -0.61736-0.377275i -0.769315-0.226036i -0.892009-0.105139i " "-0.972079-0.0270174i -1-3.52445e-17i -0.970942-0.0258797i -0.887236-0.100366i -0.758749-0.21547i " "-0.600211-0.360127i -0.428983-0.521996i -0.262504-0.689145i -0.115879-0.851233i -3.06162e-17-1i 0.0795251-1.12928i " "0.122502-1.23487i 0.133416-1.3122i 0.120042-1.35476i 0.0917169-1.3539i 0.0576127-1.29976i 0.0253289-1.18348i " "1.29939e-17-1i -0.015992-0.751346i -0.0227496-0.449391i -0.0221856-0.115199i -0.0171489+0.222935i " "-0.0105661+0.532713i -0.00477279+0.782097i -0.00113767+0.943924i -1.79021e-33+1i -0.00113767+0.943924i " "-0.00477279+0.782097i -0.0105661+0.532713i -0.0171489+0.222935i -0.0221856-0.115199i -0.0227496-0.449391i " "-0.015992-0.751346i 1.29939e-17-1i 0.0264666-1.18234i 0.0623855-1.29499i 0.102283-1.34333i 0.137191-1.33761i " "0.155601-1.29001i 0.145251-1.21213i 0.095517-1.11329i -4.36101e-17-1i -0.141208-0.874287i -0.320116-0.737212i " "-0.5207-0.592581i -0.720253-0.445871i -0.892164-0.304514i -1.00974-0.177369i -1.05047-0.0734208i -1-3.06162e-17i " "-0.855062+0.0370665i -0.624732+0.0373666i -0.329766+0.00894711i 0-0.0342978i 0.329766-0.0744505i " "0.624732-0.0924114i 0.855062-0.0713258i 1+5.6604e-17i 1.05047+0.124079i 1.00974+0.292594i 0.892164+0.487948i " "0.720253+0.685955i 0.5207+0.859413i 0.320116+0.982215i 0.141208+1.03334i 4.36101e-17+1i -0.095517+0.881529i " "-0.145251+0.687118i -0.155601+0.432049i -0.137191+0.137191i -0.102283-0.174165i -0.0623855-0.479481i " "-0.0264666-0.759545i -1.29939e-17-1i 0.0148543-1.19168i 0.0179768-1.32985i 0.0116196-1.41286i 0-1.44051i " "-0.0116196-1.41286i -0.0179768-1.32985i -0.0148543-1.19168i 1.29939e-17-1i 0.0241912-0.759545i 0.0528399-0.479481i " "0.0811508-0.174165i 0.102893+0.137191i 0.11123+0.432049i 0.0997521+0.687118i 0.0635331+0.881529i"; assert_cvec(ref_c, csamples); } itpp-4.3.1/gtests/qr_test.cpp000066400000000000000000000074401216575753400162150ustar00rootroot00000000000000/*! * \file * \brief QR factorisation test program * \author Tony Ottosson, Adam Piatyszek and Vasek Smidl * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(QR, All) { // Test of QR factorization routines RNG_reset(0); static const double tol = 1e-9; { // QR of Real matrix mat Q, R, e; mat A = randn(5, 5); qr(A, Q, R); ASSERT_NEAR(9.14651e-16, norm(A - Q * R), tol); // This does not give same sizes as matlab. Why???!!!!! A = randn(4, 2); qr(A, Q, R); ASSERT_NEAR(3.60139e-16, norm(A - Q * R), tol); A = randn(2, 4); qr(A, Q, R); ASSERT_NEAR(5.31202e-16, norm(A - Q * R), tol); } { // QR of Real matrix without Q mat R; mat A = randn(5, 5); qr(A, R); ASSERT_NEAR(4.7391e-15, norm(A.T()*A - R.T()*R), tol); A = randn(4, 2); qr(A, R); ASSERT_NEAR(5.68779e-16, norm(A.T()*A - R.T()*R), tol); A = randn(2, 4); qr(A, R); ASSERT_NEAR(4.73573e-16, norm(A.T()*A - R.T()*R), tol); } { // QR of Real matrix with pivoting mat Q, R, e; bmat P; mat A = randn(5, 5); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; ASSERT_NEAR(1.13066e-15, norm(e), tol); // This does not give same sizes as matlab. Why???!!!!! A = randn(4, 2); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; ASSERT_NEAR(5.05084e-16, norm(e), tol); A = randn(2, 4); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; ASSERT_NEAR(2.48662e-16, norm(e), tol); } { // QR of Complex matrix cmat A = randn_c(5, 5); cmat Q, R, e; qr(A, Q, R); e = A - Q * R; ASSERT_NEAR(1.01366e-15, norm(e), tol); // This does not give same sizes as matlab. Why???!!!!! A = randn_c(4, 2); qr(A, Q, R); e = A - Q * R; ASSERT_NEAR(2.91757e-16, norm(e), tol); A = randn_c(2, 4); qr(A, Q, R); e = A - Q * R; ASSERT_NEAR(1.71413e-16, norm(e), tol); } { // QR of Complex matrix without Q cmat A = randn_c(5, 5); cmat R, e; qr(A, R); e = A.H() * A - R.H() * R; ASSERT_NEAR(5.20531e-15, norm(e), tol); A = randn_c(4, 2); qr(A, R); e = A.H() * A - R.H() * R; ASSERT_NEAR(1.78189e-15, norm(e), tol); A = randn_c(2, 4); qr(A, R); e = A.H() * A - R.H() * R; ASSERT_NEAR(5.80022e-16, norm(e), tol); } { // QR of Complex matrix with pivoting cmat A = randn_c(5, 5); cmat Q, R, e; bmat P; qr(A, Q, R, P); e = A * to_mat(P) - Q * R; ASSERT_NEAR(7.59219e-16, norm(e), tol); // This does not give same sizes as matlab. Why???!!!!! A = randn_c(4, 2); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; ASSERT_NEAR(6.6432e-16, norm(e), tol); A = randn_c(2, 4); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; ASSERT_NEAR(1.55268e-16, norm(e), tol); } } itpp-4.3.1/gtests/rand_core_test.cpp000066400000000000000000000621341216575753400175300ustar00rootroot00000000000000/*! * \file * \brief Random Number generation core tests * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include "gtest/gtest.h" #ifdef _OPENMP //should work on both gcc & msvc (it is an omp standard requirement) #include #endif //tests vectors are taken from dSFMT package (v 2.2) //Here is the package license /* Copyright (c) 2007, 2008, 2009 Mutsuo Saito, Makoto Matsumoto and Hiroshima University. Copyright (c) 2011, 2002 Mutsuo Saito, Makoto Matsumoto, Hiroshima University and The University of Tokyo. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Hiroshima University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ //init_gen_rand(0) generated randoms [1, 2) double ref_result1[] = { 1.030581026769374, 1.213140320067012, 1.299002525016001, 1.381138853044628, 1.863488397063594, 1.133443440024236, 1.073465290616508, 1.924735636004535, 1.642876178923654, 1.135658049473512, 1.614181131134505, 1.758658396495576, 1.629675660963117, 1.280639430198043, 1.450236428147610, 1.493660282874514, 1.814271115361793, 1.167373211634437, 1.029478262306546, 1.995645230878212, 1.571796427913721, 1.820991494675444, 1.342215733241735, 1.623155152394482, 1.770877090925340, 1.971604009986542, 1.291307503466583, 1.042482713804030, 1.489892341518318, 1.846505153340657, 1.464614144455080, 1.722998990286586, 1.261140462560469, 1.466608076171318, 1.284476538780147, 1.566267595424500, 1.214877812942994, 1.814025145094890, 1.875364841982453, 1.420058799919090, 1.185941915813226, 1.613435647553408, 1.261307303980314, 1.575227905977901, 1.368593422560852, 1.178339827374882, 1.617026203567302, 1.605806966367909, 1.688420982162701, 1.271452757436403, 1.380651074471749, 1.923694230059664, 1.183689647854999, 1.813616738156070, 1.674316771173891, 1.388616443854270, 1.112619958524579, 1.143443226388526, 1.044504544026019, 1.059792215140743, 1.473318469170684, 1.907724040304600, 1.840641748107302, 1.880247376378763, 1.662300761822745, 1.756077893716310, 1.794902408257739, 1.208089693203264, 1.573346980275286, 1.343298418696786, 1.290031288673300, 1.785887855614908, 1.469555312775962, 1.303565840269790, 1.821346312600028, 1.464630963746065, 1.350918117062525, 1.608975946390805, 1.218770519593969, 1.553737984201091, 1.799048445169658, 1.934409566880829, 1.518706598932114, 1.806743174028226, 1.445770445550219, 1.853994985463463, 1.294940116346864, 1.846933188597791, 1.585285299858689, 1.436399337803629, 1.984097327010455, 1.104286003167359, 1.650974773825423, 1.509620107806257, 1.257788148487937, 1.343504084778931, 1.949774691002465, 1.575826707171932, 1.334309761521545, 1.970145826389876, 1.634179511150286, 1.117295679338137, 1.975634802490159, 1.876312964236097, 1.588415777998304, 1.655714874553697, 1.333606641414210, 1.534065546092020, 1.430491671060673, 1.948237416318885, 1.221039675791948, 1.002582148951994, 1.154359196718931, 1.871051234557714, 1.608929525044202, 1.314753139712890, 1.024921298185855, 1.269548213986646, 1.311905073508091, 1.820250418624237, 1.530899807500864, 1.382415501216911, 1.723050693688422, 1.273273073610244, 1.313899532538009, 1.788939639818993, 1.876299000001360, 1.991333199989678, 1.991820254950511, 1.030433951689168, 1.676262472193616, 1.508094775671104, 1.379478805615782, 1.669062560664250, 1.454294977515323, 1.058637649351106, 1.762305416761906, 1.259329140543268, 1.069306898227167, 1.416672040871633, 1.692817632828360, 1.325016179312241, 1.894413502990435, 1.065827451446854, 1.648472088974056, 1.136729079291305, 1.577029131655685, 1.770630083651844, 1.312969529843681, 1.120742660491037, 1.381749920757092, 1.532127565299400, 1.430576333290474, 1.408675485986594, 1.664550700542242, 1.808244181927591, 1.449745796589231, 1.561376218313360, 1.823412610420372, 1.175033367831775, 1.302133406247658, 1.209386996910797, 1.958852403617822, 1.327413109121052, 1.905326191931480, 1.243341689973321, 1.171964300933144, 1.947795532949568, 1.406088608658097, 1.352799736126945, 1.038567042456604, 1.952366632464022, 1.271894317271382, 1.276879063784723, 1.962232899932226, 1.635977123253224, 1.427227475039741, 1.902767774021188, 1.348976205109293, 1.098551616320939, 1.761303753087471, 1.725151135219154, 1.973647280723666, 1.438406762461431, 1.976338460962363, 1.080691466989757, 1.302440271222677, 1.524443530330429, 1.677973975664305, 1.899365828945253, 1.758064697654786, 1.664994321814212, 1.702509799458075, 1.542285497404383, 1.583785005757146, 1.364775251860427, 1.914911483830064, 1.492662121733521, 1.803292510850298, 1.913612505233413, 1.990030445920955, 1.265653421547230, 1.371464451146616, 1.812272753750019, 1.468314372775775, 1.962074516808028, 1.071993018163613, 1.362232923167970, 1.286098054243162, 1.166494117866721, 1.190627308126986, 1.336522203701874, 1.589002579609417, 1.989085299207313, 1.886248617042378, 1.494809620088929, 1.210511688798404, 1.373900882339293, 1.529044652411248, 1.599366524611929, 1.436552769988409, 1.577285005915829, 1.688182285296122, 1.277637471607439, 1.929554385968616, 1.823441682648089, 1.922013798503081, 1.645761293216693, 1.431349251849024, 1.762959265242032, 1.878537838979557, 1.999467237190877, 1.485220104894368, 1.716411480065391, 1.412097187018955, 1.552070069949518, 1.892433293954831, 1.503681065768480, 1.856696961604681, 1.652070478210699, 1.941264820695600, 1.747443060523082, 1.340963648345302, 1.115605969659878, 1.350907250724354, 1.815702983867849, 1.598890428370514, 1.439048661943484, 1.517663378502000, 1.304964768398997, 1.079026972256675, 1.524811537337526, 1.316547675188607, 1.138964396377513, 1.662996685355875, 1.267094641341935, 1.501239512928825, 1.102282578729245, 1.681064147709950, 1.806571233091203, 1.723576229776429, 1.736972959477229, 1.912237952025255, 1.660774311421941, 1.025816042908814, 1.438547835995945, 1.739013210613549, 1.413224917267124, 1.358475319974022, 1.358765432047162, 1.593140545500734, 1.172245654090473, 1.930726901246793, 1.162761062259565, 1.318549211468092, 1.092783981301198, 1.555764474221963, 1.708252060788802, 1.269806348212832, 1.852955157375948, 1.907379745865761, 1.486699553976457, 1.515744472393222, 1.620128750267234, 1.622430346507121, 1.668132516832666, 1.796788360374040, 1.636602348582785, 1.773593519549434, 1.258248394226789, 1.246140312082405, 1.015163448535963, 1.521503953242567, 1.140634382438487, 1.702118160723025, 1.132078836187980, 1.963663308022001, 1.452227189409805, 1.832632887982046, 1.261616333794024, 1.803214901972612, 1.388570383844696, 1.643765598586203, 1.619544270246625, 1.307755937472623, 1.857004438119476, 1.398636660692930, 1.556031209947539, 1.641338721048474, 1.115939103561434, 1.654221123345289, 1.150482842848706, 1.494319794557959, 1.788401632203792, 1.025831928414729, 1.042464682154734, 1.886776958738527, 1.968746864493441, 1.159635330475675, 1.956557704773203, 1.284243453753799, 1.572925045526015, 1.859321130727941, 1.005189956275669, 1.005337392745185, 1.442294781323312, 1.890812262600537, 1.206329358583467, 1.026098286977865, 1.047660975111641, 1.037196173307690, 1.743350801362402, 1.274336569674040, 1.719733191271306, 1.241944533170590, 1.761242705869024, 1.087057719955586, 1.923433325400596, 1.769554882850761, 1.422355508046144, 1.335735282689950, 1.969166433701194, 1.309113579529401, 1.934488263782031, 1.363050605738272, 1.205012399069315, 1.702636620368798, 1.377299901239738, 1.082603967707894, 1.707678198781335, 1.357839171792981, 1.249151205817995, 1.414407072442705, 1.758876753195856, 1.947897139275915, 1.873737405944571, 1.864011982004539, 1.197733232912529, 1.708750747026161, 1.584026807407247, 1.464232596280593, 1.910020147544669, 1.107379834907888, 1.431311422166039, 1.656031749095368, 1.583060053927119, 1.338823782349183, 1.675841451609077, 1.863125002352507, 1.383321945211853, 1.437552865439453, 1.323329267004908, 1.510393439678810, 1.381858897252844, 1.488904172419540, 1.703038148781844, 1.363689874508434, 1.782902379399008, 1.207151750281740, 1.134081954739325, 1.786230025908168, 1.301807943529430, 1.818037084625490, 1.954083924684191, 1.503136817574214, 1.166174793570306, 1.905851898350567, 1.861611595448786, 1.912073551209336, 1.311539667277574, 1.348138517947969, 1.835216223115592, 1.848638059772834, 1.508211065551719, 1.501558584290350, 1.841635694216024, 1.695119173143315, 1.454484117280340, 1.625646404371770, 1.119869639433384, 1.444195622035266, 1.399038475609640, 1.911871066122697, 1.393715521875472, 1.634940751730062, 1.299965953553803, 1.625354065027734, 1.880393059283658, 1.690675478017034, 1.628589134880479, 1.012241730322596, 1.151619785119961, 1.951158889711496, 1.797539238310482, 1.755218167276459, 1.713478006991327, 1.571668224641071, 1.319684419283076, 1.470800535782670, 1.106150064396913, 1.759426082965527, 1.413902064615626, 1.663209862298114, 1.688656611986246, 1.561766088174504, 1.021593733617964, 1.104216171759727, 1.056934446307648, 1.131101785914085, 1.025747434603107, 1.653089659161949, 1.862010102275871, 1.700392592888141, 1.749844513072156, 1.600475707472835, 1.797824285171013, 1.303262789973822, 1.833983051083715, 1.706436841851279, 1.583152584413344, 1.157186002470311, 1.160819822241010, 1.212754944300861, 1.963053526130375, 1.268811286389321, 1.374828807938443, 1.049479080410400, 1.973869788889314, 1.280288819687655, 1.193231050947952, 1.306156625366250, 1.244778108696800, 1.731164172106588, 1.765672206167307, 1.617163972329793, 1.333068311058873, 1.230571993026005, 1.225697451543153, 1.277811874136488, 1.572508333797608, 1.556415237569166, 1.209965265731652, 1.934900416408164, 1.370051485789686, 1.026053486793906, 1.090498102405539, 1.516231184525802, 1.080879023417522, 1.616056345268405, 1.414971598053735, 1.813169501790841, 1.946113087783638, 1.550874962654984, 1.095276777050610, 1.022240506381006, 1.349953863208443, 1.639335057225891, 1.086999372715814, 1.198125757163164, 1.358872097979379, 1.864767925147218, 1.425774441879807, 1.324356243811146, 1.013779032909748, 1.877970176001620, 1.017769324762142, 1.517328996674653, 1.156791735454128, 1.820771116348883, 1.209713056264071, 1.854832025810033, 1.626515379727837, 1.072074225561507, 1.621286465674130, 1.549902343511516, 1.266113813183351, 1.450731461629206, 1.023903615692273, 1.141802126238102, 1.478789349904744, 1.030261249106096, 1.744520411596375, 1.610339075504574, 1.734036515785284, 1.445021690251891, 1.067695047319750, 1.044588489496833, 1.078902049240712, 1.775656376455273, 1.529010846255880, 1.684639314731656, 1.869078008870465, 1.196659282984713, 1.055877083218375, 1.343311406572803, 1.657804323039657, 1.931310179843877, 1.876531128866294, 1.953312528893538, 1.751295176436919, 1.990635408763924, 1.747960800049019, 1.625876628099381, 1.950163235823662, 1.461443118782703, 1.075928147908412, 1.092143870551425, 1.530725871270558, 1.134721738077522, 1.006593825427538, 1.510662628484829, 1.102117778241225, 1.237414790616429, 1.415898757276402, 1.227818931317890, 1.803733837180969, 1.039835919301454, 1.945637370177811, 1.014985550164521, 1.662360752310358, 1.389442153375327, 1.067707198772765, 1.752954274484631, 1.712429083915912, 1.798210585469825, 1.644104449048200, 1.668431996831141, 1.786974747468935, 1.411459450430814, 1.354534709965009, 1.755820242124135, 1.186816760748136, 1.711332994678620, 1.903597963775769, 1.127695794052451, 1.055764745873512, 1.462173219563238, 1.601988414252792, 1.542788005387959, 1.470016225539294, 1.053250417579233, 1.919128040049399, 1.920409133273121, 1.930196071775802, 1.093941301487821, 1.907077053805924, 1.180006330527884, 1.855787153756457, 1.038787604610960, 1.603390528893462, 1.675699800641335, 1.436579268097476, 1.695216721991263, 1.667921392643477, 1.298225569286973, 1.176659205584008, 1.484688184402969, 1.736977199998048, 1.527346818010219, 1.124337166052271, 1.004126214409010, 1.257995351445688, 1.048750698690273, 1.600687893284987, 1.771330853717698, 1.781338029764260, 1.791045259533474, 1.218240073554028, 1.404476462748409, 1.263776254264821, 1.771506489056091, 1.492535106857984, 1.942560639598830, 1.880445735782105, 1.987365393774292, 1.624806632834506, 1.360289989229111, 1.259447098681650, 1.565201597574085, 1.724405238661507, 1.480135931789360, 1.613728648660302, 1.148462875077473, 1.082990694586929, 1.791549713090436, 1.011697309037590, 1.051330287711138, 1.404529653735530, 1.255076827666297, 1.465354319402313, 1.959722467095358, 1.667465002487598, 1.059786656048662, 1.145589007250259, 1.111653746143364, 1.118097303976153, 1.274790361215896, 1.061022554596977, 1.650762458048159, 1.426666443801441, 1.643025168116494, 1.881525522016726, 1.331922961270956, 1.141320506705509, 1.835459356205120, 1.604755953946371, 1.126481102674482, 1.345361030653902, 1.552930483800284, 1.651060315989797, 1.281924176836940, 1.478282162483309, 1.089522082067808, 1.514671692662497, 1.062032369569581, 1.220072855001427, 1.335222242385036, 1.917688560760201, 1.881563679176478, 1.061345187966617, 1.932816485102730, 1.831378583403447, 1.018053903667606, 1.803752606555742, 1.744151146745064, 1.823935602019249, 1.549411228789844, 1.852085525549937, 1.268910953917921, 1.398103908872195, 1.115463052648461, 1.134166374832642, 1.059662865049822, 1.913385314672057, 1.817573645089763, 1.543472539894835, 1.879411496379644, 1.187052469310417, 1.327060124683171, 1.201797766005763, 1.585708496011359, 1.726441950212828, 1.765366139479803, 1.575105655795392, 1.161836204689848, 1.177060808947556, 1.991643941775680, 1.483304774937826, 1.299878727524718, 1.860512786972423, 1.055049090865626, 1.843398581472891, 1.092910752402670, 1.944321623196737, 1.663494470271249, 1.922888589107380, 1.203337506107050, 1.673695668302879, 1.453053811175328, 1.005089626720857, 1.795346999949530, 1.229821542926916, 1.748377783144588, 1.321996885703262, 1.309371806850785, 1.716138869778725, 1.135666913050759, 1.338269469982098, 1.970855876728981, 1.853517049886400, 1.057177758132396, 1.248940788315584, 1.791020744082269, 1.081574247946067, 1.730996177586578, 1.009526675464715, 1.009798100718231, 1.881102727076643, 1.670032923753426, 1.864089798899085, 1.947800326838745, 1.525753676291635, 1.481044314974777, 1.045650816913446, 1.343050229590432, 1.254467660379006, 1.942791560918173, 1.712818820358553, 1.365835692787808, 1.840681238589795, 1.226240189108953, 1.322696502726162, 1.519948924493175, 1.902086636313264, 1.831961607099442, 1.656813895374856, 1.580562626129614, 1.628706392122500, 1.709923293711780, 1.397619640553994, 1.955521961038447, 1.131582790546282, 1.120774954775631, 1.643383921264857, 1.428256924538280, 1.629234961965852, 1.481973671272142, 1.355168703906496, 1.381360123066666, 1.297353474383750, 1.998779984895075, 1.299540149195283, 1.554953631008684, 1.022499550534725, 1.267538332848977, 1.999635534064931, 1.216908438689689, 1.125330423218031, 1.521094226167544, 1.352444820153410, 1.891355866547355, 1.237188250644441, 1.829163148453760, 1.010975705160555, 1.389099307599609, 1.166572697139759, 1.209619877947629, 1.957432819952394, 1.171713118207805, 1.995544396463686, 1.113738650685683, 1.954952493800097, 1.309046349979008, 1.125405858742736, 1.334059551241411, 1.618705235720444, 1.231177186143469, 1.553727846971735, 1.178887689593680, 1.264866781514123, 1.091971065285239, 1.056441862383996, 1.283527024623163, 1.834607590365417, 1.962802242863336, 1.228730340204497, 1.842991683633420, 1.697545988525402, 1.844710792546847, 1.192417542034665, 1.697508607262110, 1.784896632338091, 1.034112834139585, 1.422033286751813, 1.453652054620216, 1.058379823639922, 1.507638941358602, 1.047993066417010, 1.516397461578060, 1.302372136540590, 1.461998564058737, 1.554611626737750, 1.134122374348743, 1.667716941372084, 1.433151414564393, 1.319857533959847, 1.583420071116494, 1.478250465560727, 1.466784271564917, 1.923843580047532, 1.176048670365018, 1.518583880443583, 1.126284343690593, 1.309458927538403, 1.254116920997212, 1.221286762203130, 1.314794812269592, 1.865355356312181, 1.875368141725648, 1.478554967746866, 1.289949440091931, 1.240447745313523, 1.101700136534686, 1.332573248950360, 1.167135678363469, 1.604936747884104, 1.828477968610324, 1.981787275210698, 1.528961708093550, 1.844833688431583, 1.292908212260039, 1.526421493343533, 1.477684242274037, 1.520192575343653, 1.407146775494489, 1.433258876432486, 1.140499612461638, 1.224429147839875, 1.413739425285328, 1.939104296647277, 1.669514052983343, 1.732909897181110, 1.751457852668096, 1.242198740016763, 1.909522621661234, 1.248802188164318, 1.785821368840928, 1.444035896141739, 1.408015292232671, 1.097220772250296, 1.433573415928994, 1.019849701076716, 1.192183652047805, 1.942228730880240, 1.511971120822260, 1.167847411636749, 1.424386751141384, 1.999535966473089, 1.256446120225825, 1.758859587241302, 1.554606274137138, 1.141112413898596, 1.872291378873514, 1.893151469654739, 1.869646558937494, 1.826227167199755, 1.804544311254211, 1.730661202511795, 1.226769815903244, 1.679838430928674, 1.643941207337068, 1.322059748794036, 1.045053637669191, 1.309404672920857, 1.331474945197764, 1.790509417887939, 1.263083376723605, 1.245939409206071, 1.759660309891394, 1.281800922487132, 1.712213197965571, 1.803213756378482, 1.717270512776782, 1.385372857246577, 1.255945382268436, 1.564636086727342, 1.644313176830236, 1.176523282489581, 1.334422402615048, 1.208067092977696, 1.149552540117835, 1.771501288135706, 1.564055713684924, 1.621614271733339, 1.081066576966760, 1.495853964383299, 1.219063833026128, 1.084142314244871, 1.549237225541902, 1.936776127604372, 1.845512189258520, 1.005975975876582, 1.811498259332091, 1.635990011669673, 1.536881182554052, 1.443297379586476, 1.886119584133706, 1.275449488687871, 1.670965527087923, 1.987232750305201, 1.544406415554266, 1.725582465417778, 1.799340284160104, 1.608735841735920, 1.264891652333546, 1.808533254198986, 1.974563992723363, 1.673825352257849, 1.559378666798180, 1.815513818850944, 1.679215902745112, 1.846384704667485, 1.353621521988754, 1.236648508090431, 1.002104116734581, 1.053298883217048, 1.430242739641769, 1.420261924778031, 1.783120431598888, 1.331408790925515, 1.781593450829028, 1.139278556251319, 1.925682266142099, 1.138131587567467, 1.474662993172124, 1.319063477600368, 1.536365678407554, 1.129922971629872, 1.780938176769717, 1.257945861972239, 1.206107632090796, 1.055490753863072, 1.161054816125216, 1.058802624223267, 1.756641825929552, 1.754378196150022, 1.827313268250450, 1.951406696895395, 1.315659554078758, 1.926535624123573, 1.711614142494693, 1.408317616914680, 1.167503504129387, 1.221579231246995, 1.772499449844828, 1.229590547241117, 1.523859240135010, 1.750638838700595, 1.294969757722743, 1.239218469359550, 1.895331049984825, 1.351848818389126, 1.953628356200589, 1.556987376063896, 1.742382503539244, 1.831314773712437, 1.931187779890391, 1.627064275586785, 1.092521265403294, 1.056269664216268, 1.697419776942093, 1.020621151020278, 1.016460701790075, 1.663349935983337, 1.700240650962897, 1.294295439244268, 1.217283432848958, 1.724633019876359, 1.611555526017567, 1.976769804845470, 1.322482963420171, 1.119851357883444, 1.188940717720834, 1.639649300982932, 1.430594405952054, 1.528763701984112, 1.677238553046157, 1.804257644847276, 1.373695667911955, 1.041607859915277, 1.292586152868963, 1.204343281283561, 1.219648415953772, 1.118298775504544, 1.489325174543727, 1.223311365895364, 1.215428634537803, 1.544464527855300, 1.211873174969368, 1.800882969641407, 1.395620323924559, 1.513764352278001, 1.855296462052718, 1.311627987537891, 1.106545691943606, 1.006292260028909, 1.266506021169479, 1.061150534120227, 1.552364586842264, 1.302709575585848, 1.821775657431182, 1.391750759396551, 1.365952489392163, 1.337000387140509, 1.740591934294086, 1.185662060689487, 1.200293174238620, 1.390126083634700, 1.802185187529872, 1.091847733098113 }; size_t test1_dataset_size = sizeof(ref_result1) / sizeof(double); //init_gen_rand(5) generated randoms (0, 1] double ref_result2[] = { 0.576676137904379, 0.994304310329450, 0.127959185148864, 0.178972277952344, 0.501233068055063, 0.859840653012468, 0.546161779037789, 0.805380602145160, 0.381324178276622, 0.229028865043289, 0.666794531244068, 0.821723842976139 }; size_t test2_dataset_size = sizeof(ref_result2) / sizeof(double); using namespace itpp; TEST(Random, Core) { //set test tolerance; double tol = 5 * std::numeric_limits::epsilon(); //verify correctness of RNG core algorithms first { //genrand_close1_open2 test with seed = 0 RNG_reset(0); Random_Generator rng; for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); ASSERT_NEAR(ref_result1[i], r, tol) << "genrand_close1_open2() test failure" << std::endl; } } { //genrand_open_close test with seed = 5 RNG_reset(5); Random_Generator rng; for(size_t i = 0; i < test2_dataset_size; ++i) { double r = rng.genrand_open_close(); ASSERT_NEAR(ref_result2[i], r, tol) << "genrand_open_close() test failure" << std::endl; } } #ifdef _OPENMP //set number of threads in the team to the maximum available value const int threads_cnt = omp_get_max_threads(); omp_set_num_threads(threads_cnt); //repeat test 1 in multithreaded environment //(repeat 3 times for each thread to test a possible clashes on shared data). std::vector err_counters(threads_cnt); #pragma omp parallel { #pragma omp for for(int j = 0; j < threads_cnt; ++j) { //genrand_close1_open2 test with seed = 0 RNG_reset(0); Random_Generator rng; for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { //can't use gtest macro here, omp does not allow to execute the code with flow breaks in parallel loop iterations err_counters[j]++; } } RNG_reset(0); for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { //can't use gtest macro here, omp does not allow to execute the code with flow breaks in parallel loop iterations err_counters[j]++; } } RNG_reset(0); for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { //can't use gtest macro here, omp does not allow to execute the code with flow breaks in parallel loop iterations err_counters[j]++; } } } } //check results when single-threaded again for(int j = 0; j < threads_cnt; ++j) { ASSERT_EQ(err_counters[j], 0) << "multithreading test failure" << std::endl; } #else #pragma message "no OMP support" #endif } itpp-4.3.1/gtests/rand_test.cpp000066400000000000000000000303521216575753400165150ustar00rootroot00000000000000/*! * \file * \brief Random number generator test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; TEST(Rand, All) { const double eps = 2*numeric_limits::epsilon(); int i,j; { RNG_reset(4357U); Bernoulli_RNG b_rng; ASSERT_EQ(bin(0), b_rng()); bvec v_expect = "0 1 1 0 1 0 1 0 0 0"; bvec v = b_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_EQ(v_expect(i), v(i)) << i; } bmat m_expect = "1 1 1 0 0; 1 0 1 0 1; 1 0 0 1 1"; bmat m = b_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_EQ(m_expect(i,j), m(i,j)) << i << "x" << j; } } } { RNG_reset(4357U); Uniform_RNG u_rng; ASSERT_NEAR(0.6776523052396253, u_rng(), eps); vec v_expect = "0.6941770584246434 0.4674258031190679 0.4892392302568118 0.6187760132324469 0.3122587757056146 0.9778712826640192 " "0.2195994049039265 0.8667504766402725 0.55711296390849 0.951397435272191"; vec v = u_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.3585771136429858 0.1794607099116465 0.07970432382915571 0.7640365697101184 0.5859759976605128; " "0.2040934355571897 0.8051015464399693 0.2878831162446251 0.8554638029408097 0.4979499314960036; " "0.1683366265617352 0.6664940489317837 0.8546382205321217 0.4453365941302123 0.1443036942242235"; mat m = u_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); I_Uniform_RNG iu_rng(0, 9); ASSERT_EQ(6, iu_rng()); ivec v_expect = "6 4 4 6 3 9 2 8 5 9"; ivec v = iu_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_EQ(v_expect(i), v(i)) << i; } imat m_expect = "3 2 1 1 8; 6 0 2 8 7; 8 4 5 4 1"; imat m = iu_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_EQ(m_expect(i,j), m(i,j)) << i << "x" << j; } } } { RNG_reset(4357U); Normal_RNG n_rng; ASSERT_NEAR(1.893097921430992, n_rng(), eps); vec v_expect = "0.6402717419207782 -0.6697680324312685 0.7272643156549641 -0.9828709673793459 0.08733966325286896 " "-0.4069743415888314 1.50369957083693 1.708256250743253 -0.3616838528627909 0.5491090382229717"; vec v = n_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "-0.3664826823907004 0.2362398029921575 0.08634252616292722 0.7341571423564899 -0.1914601183139686; " "-0.5005183411687337 0.4395163301393568 0.4302349815876011 -1.572718128851201 0.7524087638759094; " "-1.7451782785168886 -0.4690060611195704 0.1806300166341613 -0.4310872094225911 -0.3197472822012825"; mat m = n_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); Complex_Normal_RNG cn_rng; complex scalar = cn_rng(); ASSERT_NEAR(1.338622377694012, scalar.real(), eps); ASSERT_NEAR(0.4527404905143053, scalar.imag(), eps); cvec v_expect = "-0.4735975175541214+0.5142535293146189i -0.6949947260653173+0.06175846815265315i -0.2877743167063931+1.0632761634060945i " "1.2079195789048613-0.2557491050049569i 0.3882787245382864-0.2591423899058999i -0.3539199131486535-1.234027395118757i " "0.1670467666819286+0.3107849774837645i -0.3316373662352405+0.06105338575458272i 0.3042220729842621+0.1277247096478543i " "0.5191274938168114-1.1120796538057025i"; cvec v = cn_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i).real(), v(i).real(), eps) << i; ASSERT_NEAR(v_expect(i).imag(), v(i).imag(), eps) << i; } cmat m_expect = "-0.3048246890654995-0.1353827479865859i 0.3709934479396093-0.4304478413979487i -0.1411731426937465-0.1305120155848639i " "-1.364128829828384+0.8726592365224727i 0.7522775207792468+0.4907727192185704i; 0.5320333391608433-0.2260954715104955i " "0.6321816921398413-0.2125745439342603i -0.4673563954429671+0.210388106679149i 0.7942460734239527-0.30166557762441i " "0.1343997864207408-0.001025126590916942i; 0.4398725368242644-0.3404948025920709i 0.6039173090419301+1.294761311710982i " "0.7862861082444027+0.3639643058675799i 1.306621454125742+0.2472936168443791i 0.2281929123280635-0.2856873610294465i"; cmat m = cn_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j).real(), m(i,j).real(), eps) << i << "x" << j; ASSERT_NEAR(m_expect(i,j).imag(), m(i,j).imag(), eps) << i << "x" << j; } } } { RNG_reset(4357U); Exponential_RNG e_rng; ASSERT_NEAR(1.132124518607137, e_rng(), eps); vec v_expect = "1.184748966799 0.6300330542394361 0.6718539593722301 0.9643681848177544 0.3743426392815667 3.810879087015543 " "0.2479479076808403 2.015531792980273 0.8144405389904958 3.0240789772909515"; vec v = e_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.4440663104809407 0.2282734813807377 0.1843275192661373 0.1977934840550751 1.6352766070304716; " "1.098094569503158 0.08306027343061394 0.3395132184655891 1.928529613170319 1.444078442362317; " "1.934225304119688 0.5893938251269003 0.8818313301719766 0.6890554262081474 0.155839748762987"; mat m = e_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); Gamma_RNG g_rng; ASSERT_NEAR(2.7345773127255977, g_rng(), eps); vec v_expect = "1.0552274663898724 0.1385497867625918 0.04651410856398541 0.2536327119715227 2.4374544334557107 0.2769546973504614 " "0.2744349992171708 6.406185233749446 0.3737814962396139 0.2994641096082811"; vec v = g_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.2174735527040358 2.6329647388627526 1.5954090302534676 1.509676054135247 1.48296617377091; " "0.1621948306841281 0.368791785415268 0.9301993138404147 0.06886240299088112 0.5479410473121604; " "0.3100194244301691 0.1418546047377545 2.161406742662151 3.905612567710304 1.565773718382246"; mat m = g_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); Laplace_RNG lap_rng; ASSERT_NEAR(0.3104038525203892, lap_rng(), eps); vec v_expect = "0.3476149566930553 -0.04763599642043614 -0.0153841723257936 0.1917822113109224 -0.3328887924675951 " "2.2045693729764233 -0.5818096506718954 0.9350671267791583 0.08576735625913316 1.648217679951838"; vec v = lap_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "-0.2350878039510808 -0.6335890249101929 -0.7697864192777591 -0.7245382366575881 0.6661861062127028; " "0.2863410447455327 -1.2984490544054614 -0.390360806687952 0.8735472954575282 0.5309885874254274; " "0.8775747571513712 -0.08186720446773095 0.1334198416930847 -0.002905194608440886 -0.8787131343057741"; mat m = lap_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); AR1_Normal_RNG ar1_rng; ASSERT_NEAR(-0.6758828355068255, ar1_rng(), eps); vec v_expect = "1.382996864155973 -1.134989861747717 -0.2355969704269518 -0.6352883048864264 0.5874470599446935 0.6974029497987103 " "0.09759580407854659 0.8544948376298329 0.9480082544181549 0.8988055902561795"; vec v = ar1_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.283339252286234 0.1727133610040758 -0.582086877933999 0.775548110744278 -1.63373141672122; " "-0.2041721536057245 0.3527524323845667 -0.463068243353409 -1.908566747153011 0.1732392237249772; " "1.9591934002549476 -1.2504661196749935 -0.4472104022592917 -0.5582363180520757 -0.00719101756607896"; mat m = ar1_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); Weibull_RNG w_rng; ASSERT_NEAR(1.132124518607137, w_rng(), eps); vec v_expect = "1.184748966799 0.6300330542394361 0.6718539593722301 0.9643681848177544 0.3743426392815667 3.810879087015543 " "0.2479479076808403 2.015531792980273 0.8144405389904958 3.0240789772909515"; vec v = w_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.4440663104809407 0.2282734813807377 0.1843275192661373 0.1977934840550751 1.6352766070304716; " "1.098094569503158 0.08306027343061394 0.3395132184655891 1.928529613170319 1.444078442362317; " "1.934225304119688 0.5893938251269003 0.8818313301719766 0.6890554262081474 0.155839748762987"; mat m = w_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); Rayleigh_RNG ray_rng; ASSERT_NEAR(1.998441303523476, ray_rng(), eps); vec v_expect = "0.9886873125978385 0.9867439157625122 1.557799895380286 1.746125604767615 0.6601744408491138 1.815534586190379 " "0.498982814310214 0.4768875309662541 0.4666147686164047 1.7356350487617695"; vec v = ray_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.4716918051361034 0.8175312057850639 0.7866696374519958 0.8036435560349791 0.9432302249245959; " "2.0204568644066563 0.2718942530839984 0.7248243315362419 1.2253292291982576 2.290144802171662; " "1.201523154893684 1.880645504774169 1.27025928864855 0.1900755295900456 0.5170865952405508"; mat m = ray_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } { RNG_reset(4357U); Rice_RNG ric_rng; ASSERT_NEAR(2.9631003166431262, ric_rng(), eps); vec v_expect = "0.7987280746470597 0.0890034860870291 1.616413261164721 2.7323007025420125 1.5918694572094734 1.815249060409068 " "1.312045523204609 0.5379680240980399 1.441596096507667 2.3410987393109353"; vec v = ric_rng(10); for (i = 0; i < v.length(); ++i) { ASSERT_NEAR(v_expect(i), v(i), eps) << i; } mat m_expect = "0.6002655580552441 1.781340731074266 1.692039164166575 1.641697565452313 1.91774948912197; " "2.6058361496697944 0.8213577410479846 0.4510951183425345 2.173794994082281 1.544805564133882; " "2.165669649217335 2.8692352774305294 2.1774574176104475 1.1900708837802285 1.383042143204967"; mat m = ric_rng(3, 5); for (i = 0; i < m.rows(); ++i) { for (j = 0; j < m.cols(); ++j) { ASSERT_NEAR(m_expect(i,j), m(i,j), eps) << i << "x" << j; } } } } itpp-4.3.1/gtests/rec_syst_conv_code_test.cpp000066400000000000000000000046451216575753400214510ustar00rootroot00000000000000/*! * \file * \brief Recursive systematic convolutional codes class test program * \author Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; TEST(RSCC, All) { RNG_reset(0); bvec uncoded_bits = "0 1 1 0 1 0 1", tail_bits(4), decoded_bits(11); bmat parity_bits(11, 1); vec received_systematic(11), extrinsic_output(11), L(11), symbols; mat received_parity(11, 1); double Ec = 1.0, N0 = 1e-10, Lc = 4.0 * sqrt(Ec) / N0; Normal_RNG noise(0.0, N0 / 2.0); BPSK bpsk; Rec_Syst_Conv_Code rscc; // Fixed by ediap: ivec("string") constructor uses only decimal notation // rscc.set_generator_polynomials("031 027",5); rscc.set_generator_polynomials("25 23", 5); rscc.set_awgn_channel_parameters(Ec, N0); rscc.encode_tail(uncoded_bits, tail_bits, parity_bits); bpsk.modulate_bits(concat(uncoded_bits, tail_bits), symbols); received_systematic = symbols + noise(11); bpsk.modulate_bits(parity_bits.get_col(0), symbols); received_parity.set_col(0, symbols + noise(11)); vec extrinsic_input = zeros(11); rscc.map_decode(received_systematic, received_parity, extrinsic_input, extrinsic_output); L = Lc * received_systematic + extrinsic_output; for (int k = 0; k < 11; k++) { (L(k) > 0) ? (decoded_bits(k) = bin(0)) : (decoded_bits(k) = bin(1)); } bvec ref = concat(uncoded_bits, tail_bits); ASSERT_TRUE(ref == decoded_bits); } itpp-4.3.1/gtests/reedsolomon_test.cpp000066400000000000000000000111251216575753400201140ustar00rootroot00000000000000/*! * \file * \brief Reed-Solomon encoder/decoder class test program * \author Steve Peters and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(ReedSolomon, All) { // Test of Reed-Solomon encoder/decoder RNG_reset(0); bmat u = randb(8, 15); bmat c(u.rows(), 21); bmat y(u.rows(), 21); bvec codeword, errorword; bmat decoded(u.rows(), u.cols()); Reed_Solomon rs(3, 1); Reed_Solomon rs_sys(3, 1, true); bmat f = "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0"; // Non-systematic case for (int i = 0; i < u.rows(); i++) { codeword = rs.encode(u.get_row(i)); ASSERT_TRUE(c.cols() == length(codeword)) << "Error 1"; c.set_row(i, rs.encode(u.get_row(i))); errorword = f.get_row(i) + c.get_row(i); ASSERT_TRUE(y.cols() == length(errorword)) << "Error 2"; y.set_row(i, f.get_row(i) + c.get_row(i)); decoded.set_row(i, rs.decode(y.get_row(i))); ASSERT_TRUE(u.get_row(i) == decoded.get_row(i)) << i; } // Systematic case for (int i = 0; i < u.rows(); i++) { c.set_row(i, rs_sys.encode(u.get_row(i))); y.set_row(i, f.get_row(i) + c.get_row(i)); decoded.set_row(i, rs_sys.decode(y.get_row(i))); ASSERT_TRUE(u.get_row(i) == decoded.get_row(i)) << i; } bmat g = "1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1; 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0"; // Systematic case with decoder failure indicator for (int i = 0; i < u.rows(); i++) { c.set_row(i, rs_sys.encode(u.get_row(i))); y.set_row(i, g.get_row(i) + c.get_row(i)); bvec message, cw_is_valid; rs_sys.decode(y.get_row(i), message, cw_is_valid); decoded.set_row(i, message); //decoded bits are wrong without a decoding failure switch (i) { case 0: case 6: ASSERT_TRUE(u.get_row(i) == decoded.get_row(i)); break; case 1: case 2: case 3: case 4: case 5: case 7: ASSERT_FALSE(u.get_row(i) == decoded.get_row(i)); break; default: void(0); } } rs = Reed_Solomon(3, 1, false, 0); rs_sys = Reed_Solomon(3, 1, true, 0); // Erasure decoding (1 erasure) and non-narrow-sense // Non-systematic case for (int i = 0; i < u.rows(); i++) { codeword = rs.encode(u.get_row(i)); ASSERT_TRUE(c.cols() == length(codeword)) << "Error 1"; c.set_row(i, rs.encode(u.get_row(i))); ASSERT_TRUE(y.cols() == length(errorword)) << "Error 2"; y.set_row(i, c.get_row(i)); bvec decoded_tmp; bvec cw_isvalid; ivec erasure(1); erasure(0) = i/y.cols(); rs.decode(y.get_row(i), erasure, decoded_tmp, cw_isvalid); decoded.set_row(i, decoded_tmp); ASSERT_TRUE(u.get_row(i) == decoded.get_row(i)); } // Systematic case for (int i = 0; i < u.rows(); i++) { c.set_row(i, rs_sys.encode(u.get_row(i))); y.set_row(i, c.get_row(i)); bvec decoded_tmp; bvec cw_isvalid; ivec erasure(1); erasure(0) = 0;//i/y.cols(); rs_sys.decode(y.get_row(i), erasure, decoded_tmp, cw_isvalid); decoded.set_row(i, decoded_tmp); ASSERT_TRUE(u.get_row(i) == decoded.get_row(i)); } } itpp-4.3.1/gtests/schur_test.cpp000066400000000000000000000041351216575753400167150ustar00rootroot00000000000000/*! * \file * \brief Schur decomposition test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(Schur, All) { RNG_reset(0); static const double tol = 1e-9; int size = 5; // Test of Schur decomposition routines { // Real matrix mat A = randn(size, size); mat T, U; schur(A, U, T); ASSERT_NEAR(3.52148e-15, norm(A - (U * T * transpose(U))), tol); ASSERT_NEAR(9.92862e-16, norm(eye(size) - (U * transpose(U))), tol); double temp_sum = 0; for (int i = 2; i < size; i++) for (int j = 0; j < i - 1; j++) temp_sum += sqr(T(i, j)); ASSERT_NEAR(0, sqrt(temp_sum), tol); } { // Complex matrix cmat A = randn_c(size, size); cmat T, U; schur(A, U, T); ASSERT_NEAR(7.24721e-15, norm(A - (U * T * hermitian_transpose(U))), tol); ASSERT_NEAR(1.73911e-15, norm(eye(size) - (U * hermitian_transpose(U))), tol); double temp_sum = 0; for (int i = 1; i < size; i++) for (int j = 0; j < i; j++) temp_sum += sqr(T(i, j)); ASSERT_NEAR(0, sqrt(temp_sum), tol); } } itpp-4.3.1/gtests/sigfun_test.cpp000066400000000000000000000140371216575753400170660ustar00rootroot00000000000000/*! * \file * \brief Signal processing routines test program * \author Tony Ottosson, Thomas Eriksson, Pal Frenger, Tobias Ringstrom * and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static void assert_vec_p(const vec &ref, const vec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()); for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol); } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) TEST(SigFun, All) { RNG_reset(12345); vec x = randn(10); vec y = randn(10); int max_lag; // Testing cross correlation vec ref = "0.343673 2.34251 -0.276029 -1.69426 0.575064 0.236971 -1.39007 -2.51791 3.36735 3.37605 -0.551727 " "-1.91208 1.41728 1.65607 -3.27706 -0.802629 1.02004 0.841397 0.149574"; assert_vec(ref, xcorr(x, y)); max_lag = 0; ref = "3.37605"; assert_vec(ref, xcorr(x, y, max_lag)); max_lag = 5; ref = "0.575064 0.236971 -1.39007 -2.51791 3.36735 3.37605 -0.551727 -1.91208 1.41728 1.65607 -3.27706"; assert_vec(ref, xcorr(x, y, max_lag)); max_lag = -1; ref = "0.343673 2.34251 -0.276029 -1.69426 0.575064 0.236971 -1.39007 -2.51791 3.36735 3.37605 -0.551727 " "-1.91208 1.41728 1.65607 -3.27706 -0.802629 1.02004 0.841397 0.149574"; assert_vec(ref, xcorr(x, y, max_lag)); max_lag = 0; ref = "0.337605"; assert_vec(ref, xcorr(x, y, max_lag, "biased")); max_lag = 5; ref = "0.0575064 0.0236971 -0.139007 -0.251791 0.336735 0.337605 -0.0551727 -0.191208 0.141728 0.165607 -0.327706"; assert_vec(ref, xcorr(x, y, max_lag, "biased")); max_lag = -1; ref = "0.0343673 0.234251 -0.0276029 -0.169426 0.0575064 0.0236971 -0.139007 -0.251791 0.336735 0.337605 -0.0551727 " "-0.191208 0.141728 0.165607 -0.327706 -0.0802629 0.102004 0.0841397 0.0149574"; assert_vec(ref, xcorr(x, y, max_lag, "biased")); max_lag = 0; ref = "0.337605"; assert_vec(ref, xcorr(x, y, max_lag, "unbiased")); max_lag = 5; ref = "0.115013 0.0394951 -0.198582 -0.314739 0.37415 0.337605 -0.061303 -0.23901 0.202469 0.276012 -0.655413"; assert_vec(ref, xcorr(x, y, max_lag, "unbiased")); max_lag = -1; ref = "0.343673 1.17126 -0.0920096 -0.423564 0.115013 0.0394951 -0.198582 -0.314739 0.37415 0.337605 -0.061303 " "-0.23901 0.202469 0.276012 -0.655413 -0.200657 0.340014 0.420698 0.149574"; assert_vec(ref, xcorr(x, y, max_lag, "unbiased")); max_lag = 0; ref = "0.453329"; assert_vec(ref, xcorr(x, y, max_lag, "coeff")); max_lag = 5; ref = "0.0772185 0.03182 -0.186656 -0.3381 0.452161 0.453329 -0.0740849 -0.25675 0.19031 0.222374 -0.440038"; assert_vec(ref, xcorr(x, y, max_lag, "coeff")); max_lag = -1; ref = "0.0461477 0.314548 -0.0370646 -0.227502 0.0772185 0.03182 -0.186656 -0.3381 0.452161 0.453329 -0.0740849 " "-0.25675 0.19031 0.222374 -0.440038 -0.107776 0.136969 0.112981 0.0200845"; assert_vec(ref, xcorr(x, y, max_lag, "coeff")); // Testing auto correlation ref = "0.170114 1.41078 1.78954 -0.36962 -5.83 3.57721 -2.23494 -1.06105 -3.00721 14.5 -3.00721 -1.06105 -2.23494 " "3.57721 -5.83 -0.36962 1.78954 1.41078 0.170114"; assert_vec(ref, xcorr(x)); max_lag = 0; ref = "14.5"; assert_vec(ref, xcorr(x, max_lag)); max_lag = 5; ref = "-5.83 3.57721 -2.23494 -1.06105 -3.00721 14.5 -3.00721 -1.06105 -2.23494 3.57721 -5.83"; assert_vec(ref, xcorr(x, max_lag)); max_lag = -1; ref = "0.170114 1.41078 1.78954 -0.36962 -5.83 3.57721 -2.23494 -1.06105 -3.00721 14.5 -3.00721 -1.06105 -2.23494 " "3.57721 -5.83 -0.36962 1.78954 1.41078 0.170114"; assert_vec(ref, xcorr(x, max_lag)); max_lag = 0; ref = "1.45"; assert_vec(ref, xcorr(x, max_lag, "biased")); max_lag = 5; ref = "-0.583 0.357721 -0.223494 -0.106105 -0.300721 1.45 -0.300721 -0.106105 -0.223494 0.357721 -0.583"; assert_vec(ref, xcorr(x, max_lag, "biased")); max_lag = -1; ref = "0.0170114 0.141078 0.178954 -0.036962 -0.583 0.357721 -0.223494 -0.106105 -0.300721 1.45 -0.300721 -0.106105 " "-0.223494 0.357721 -0.583 -0.036962 0.178954 0.141078 0.0170114"; assert_vec(ref, xcorr(x, max_lag, "biased")); max_lag = 0; ref = "1.45"; assert_vec(ref, xcorr(x, max_lag, "unbiased")); max_lag = 5; ref = "-1.166 0.596201 -0.319278 -0.132632 -0.334135 1.45 -0.334135 -0.132632 -0.319278 0.596201 -1.166"; assert_vec(ref, xcorr(x, max_lag, "unbiased")); max_lag = -1; ref = "0.170114 0.70539 0.596515 -0.092405 -1.166 0.596201 -0.319278 -0.132632 -0.334135 1.45 -0.334135 -0.132632 " "-0.319278 0.596201 -1.166 -0.092405 0.596515 0.70539 0.170114"; assert_vec(ref, xcorr(x, max_lag, "unbiased")); max_lag = 0; ref = "1"; assert_vec(ref, xcorr(x, max_lag, "coeff")); max_lag = 5; ref = "-0.402069 0.246704 -0.154134 -0.0731761 -0.207394 1 -0.207394 -0.0731761 -0.154134 0.246704 -0.402069"; assert_vec(ref, xcorr(x, max_lag, "coeff")); max_lag = -1; ref = "0.011732 0.0972952 0.123417 -0.025491 -0.402069 0.246704 -0.154134 -0.0731761 -0.207394 1 -0.207394 " "-0.0731761 -0.154134 0.246704 -0.402069 -0.025491 0.123417 0.0972952 0.011732"; assert_vec(ref, xcorr(x, max_lag, "coeff")); } itpp-4.3.1/gtests/siso_test.cpp000066400000000000000000000161251216575753400165500ustar00rootroot00000000000000/*! * \file * \brief SISO class test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" #include "gtest/gtest.h" using namespace itpp; using std::string; static void assert_vec_p(const vec &ref, const vec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) TEST(SISO, all) { //general parameters string map_metric="maxlogMAP"; ivec gen = "07 05";//octal form, feedback first int constraint_length = 3; int nb_errors_lim = 300; int nb_bits_lim = int(1e4); int perm_len = (1<<14);//total number of bits in a block (with tail) int nb_iter = 10;//number of iterations in the turbo decoder vec EbN0_dB = "0.0 0.5 1.0 1.5 2.0"; double R = 1.0/3.0;//coding rate (non punctured PCCC) double Ec = 1.0;//coded bit energy //other parameters int nb_bits = perm_len-(constraint_length-1);//number of bits in a block (without tail) vec sigma2 = (0.5*Ec/R)*pow(inv_dB(EbN0_dB), -1.0);//N0/2 double Lc;//scaling factor int nb_blocks;//number of blocks int nb_errors; ivec perm(perm_len); ivec inv_perm(perm_len); bvec bits(nb_bits); int cod_bits_len = perm_len*gen.length(); bmat cod1_bits;//tail is added bvec tail; bvec cod2_input; bmat cod2_bits; int rec_len = int(1.0/R)*perm_len; bvec coded_bits(rec_len); vec rec(rec_len); vec dec1_intrinsic_coded(cod_bits_len); vec dec2_intrinsic_coded(cod_bits_len); vec apriori_data(perm_len);//a priori LLR for information bits vec extrinsic_coded(perm_len); vec extrinsic_data(perm_len); bvec rec_bits(perm_len); int snr_len = EbN0_dB.length(); mat ber(nb_iter,snr_len); ber.zeros(); register int en,n; //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code cc; cc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; //SISO modules SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //BER BERC berc; //Fix random generators RNG_reset(12345); //main loop for (en=0;en-1,0->+1) + AWGN channel rec = channel(bpsk.modulate_bits(coded_bits)); //form input for SISO blocks for (n=0;n. * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(Sort, All) { vec A; ivec B; ivec I; int failedSort; Uniform_RNG URNG; I_Uniform_RNG IURNG(0, 10); // Sorting Tests // Vectors of length 15, using uniform random doubles (0,1) A = URNG(15); sort(A); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); sort(A, QUICKSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); sort(A, HEAPSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); sort(A, INSERTSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); I = sort_index(A); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); I = sort_index(A, QUICKSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); I = sort_index(A, HEAPSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(15); I = sort_index(A, INSERTSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); // Vectors of length 20000, using uniform random doubles (0,1) A = URNG(20000); sort(A); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(20000); sort(A, QUICKSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(20000); sort(A, HEAPSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(20000); I = sort_index(A); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(20000); I = sort_index(A, QUICKSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); A = URNG(20000); I = sort_index(A, HEAPSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); // Vectors of length 15, using uniform random integers (0,10) B = IURNG(15); sort(B); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); sort(B, QUICKSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); sort(B, HEAPSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); sort(B, INSERTSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); I = sort_index(B); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); I = sort_index(B, QUICKSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); I = sort_index(B, HEAPSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(15); I = sort_index(B, INSERTSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); // Vectors of length 20000, using uniform random integers (0,10) B = IURNG(20000); sort(B); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(20000); sort(B, QUICKSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(20000); sort(B, HEAPSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(20000); I = sort_index(B); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(20000); I = sort_index(B, QUICKSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); B = IURNG(20000); I = sort_index(B, HEAPSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { failedSort++; } } ASSERT_TRUE(0 == failedSort); } itpp-4.3.1/gtests/source_test.cpp000066400000000000000000000045631216575753400170760ustar00rootroot00000000000000/*! * \file * \brief Deterministic sources test program * \author Tobias Ringstrom, Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; #define LOOP_SIZE 100000 static const double tol = 1e-4; static double m; static double var; #define REALRUN(name,s) \ for (int i = 0; i < LOOP_SIZE; i++) \ real_result(i) = s(); \ m = mean(real_result), var = variance(real_result); TEST(Source, All) { Sine_Source s10(20.0 / LOOP_SIZE); Square_Source s11(20.0 / LOOP_SIZE); Triangle_Source s12(20.0 / LOOP_SIZE); Sawtooth_Source s13(20.0 / LOOP_SIZE); Impulse_Source s14(20.0 / LOOP_SIZE); Pattern_Source s15(vec("1 3")); RNG_reset(12345); vec real_result(LOOP_SIZE); REALRUN("Sine", s10); ASSERT_NEAR(5.38742e-14, m, tol); ASSERT_NEAR(0.500005, var, tol); REALRUN("Square", s11); ASSERT_NEAR(2e-05, m, tol); ASSERT_NEAR(1.00001, var, tol); REALRUN("Triangle", s12); ASSERT_NEAR(-1.52056e-17, m, tol); ASSERT_NEAR(0.333337, var, tol); REALRUN("Sawtooth", s13); ASSERT_NEAR(0.0002, m, tol); ASSERT_NEAR(0.333337, var, tol); REALRUN("Impulse", s14); ASSERT_NEAR(0.00019, m, tol); ASSERT_NEAR(0.000189966, var, tol); REALRUN("Pattern", s15); ASSERT_NEAR(2, m, tol); ASSERT_NEAR(1.00001, var, tol); } itpp-4.3.1/gtests/sparse_test.cpp000066400000000000000000000130431216575753400170640ustar00rootroot00000000000000/*! * \file * \brief Sparse vectors and matrices test program * \author * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static const double tol = 1e-4; static void assert_vec_p(const vec &ref, const vec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) static void assert_mat_p(const mat &ref, const mat &act, int line) { ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol) << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) TEST(Sparse, All) { RNG_reset(0); //********* Testing Sparse_Vec ********* Sparse_Vec v1(5), v2(5); Sparse_Vec v_out(5); ivec index_vec; vec v; v1.set(1, 3); v2.set(1, 1); v2.set(2, 2); vec ref = "0 3 0 0 0"; assert_vec(ref, v1.full()); ref = "0 1 2 0 0"; assert_vec(ref, v2.full()); v_out = v1 + v2; ref = "0 4 2 0 0"; assert_vec(ref, v_out.full()); ASSERT_NEAR(3, v1*v2, tol); ASSERT_NEAR(0.2, v1.density(), tol); v1.zeros(); ref = "0 0 0 0 0"; assert_vec(ref, v1.full()); index_vec = "0 2 2 3"; v = "1 2 4 3"; v1.set(index_vec, v); ref = "1 0 6 3 0"; assert_vec(ref, v1.full()); v1.set_new(index_vec, v); // Unnoticed error in set_new() if the same index is used several times ref = "1 0 4 3 0"; assert_vec(ref, v1.full()); v1.zeros(); v1 -= v2; ref = "0 -1 -2 0 0"; assert_vec(ref, v1.full()); v1 /= 4; ref = "0 -0.25 -0.5 0 0"; assert_vec(ref, v1.full()); v1 *= 2; ref = "0 -0.5 -1 0 0"; assert_vec(ref, v1.full()); v2 /= 2; v1 += v2; ref = "0 0 0 0 0"; assert_vec(ref, v1.full()); ASSERT_EQ(0, v1.nnz()); index_vec = "0 2 2 1"; v = "-1 5 -2 4"; v1.add(index_vec, v); ref = "-1 4 3 0 0"; assert_vec(ref, v1.full()); v1.clear_elem(2); ref = "-1 4 0 0 0"; assert_vec(ref, v1.full()); Sparse_Vec v3; v3.set_size(2); v3.set(0, 3); ref = "3 0"; assert_vec(ref, v3.full()); v3.set_size(5); ref = "0 0 0 0 0"; assert_vec(ref, v3.full()); Sparse_Vec v4(5), v5(5); v4.set(1, 1); v5.set(1, 1); v4.set(2, 2); v5.set(2, 4); ref = "0 1 2 0 0"; assert_vec(ref, v4.full()); ref = "0 1 4 0 0"; assert_vec(ref, v5.full()); //********* Testing Sparse_Mat ********* Sparse_Mat m1(3, 3), m2(3, 3); m1.set(1, 1, 3); m2.set(1, 2, 1); m2.set(2, 1, 2); mat ref_m = "0 0 0; 0 3 0; 0 0 0"; assert_mat(ref_m, full(m1)); ref_m = "0 0 0; 0 0 1; 0 2 0"; assert_mat(ref_m, full(m2)); ref_m = "0 0 0; 0 3 1; 0 2 0"; assert_mat(ref_m, full(m1 + m2)); ref_m = "0 0 0; 0 0 3; 0 0 0"; assert_mat(ref_m, full(m1*m2)); ASSERT_NEAR(0.111111, m1.density(), tol); ref_m = "0 0 0; 0 0 2; 0 1 0"; assert_mat(ref_m, full(transpose(m2))); m1.zeros(); ref_m = "0 0 0; 0 0 0; 0 0 0"; assert_mat(ref_m, full(m1)); m1 -= m2; ref_m = "0 0 0; 0 0 -1; 0 -2 0"; assert_mat(ref_m, full(m1)); m1 /= 4; ref_m = "0 0 0; 0 0 -0.25; 0 -0.5 0"; assert_mat(ref_m, full(m1)); m1 *= 2; ref_m = "0 0 0; 0 0 -0.5; 0 -1 0"; assert_mat(ref_m, full(m1)); m1.add_elem(0, 2, 4); ref_m = "0 0 4; 0 0 -0.5; 0 -1 0"; assert_mat(ref_m, full(m1)); m1.clear_elem(1, 2); ref_m = "0 0 4; 0 0 0; 0 -1 0"; assert_mat(ref_m, full(m1)); Sparse_Mat m3(2, 3), m4(3, 2); m3.set(0, 0, 3); m4.set(0, 1, 1); m4.set(2, 0, 2); ref_m = "3 0 0; 0 0 0"; assert_mat(ref_m, full(m3)); ref_m = "0 1; 0 0; 2 0"; assert_mat(ref_m, full(m4)); ref_m = "0 3; 0 0"; assert_mat(ref_m, full(m3*m4)); ref_m = "0 0 2; 1 0 0"; assert_mat(ref_m, full(transpose(m4))); ref_m = "4 0; 0 1"; assert_mat(ref_m, full(trans_mult(m4, m4))); ref_m = "1 0 0; 0 0 0; 0 0 4"; assert_mat(ref_m, full(mult_trans(m4, m4))); ref_m = "1 0 0; 0 0 0; 0 0 4"; assert_mat(ref_m, full(mult_trans(m4, m4))); v = "1 2 3"; ref = "3 0"; assert_vec(ref, m3*v); Sparse_Mat A(3, 5), B(5, 3), C; vec x(3), y(5), z1, z2; A = randn(3, 5); B = randn(5, 3); x = randn(3); y = randn(5); C = A * B; z1 = A * y; z2 = x * A; ref_m = "0.0511847 1.39674 2.48276;" "0.916172 -1.00692 -1.16731;" "-1.21703 -4.20494 -4.17853"; assert_mat(ref_m, full(C)); ref = "-1.31897 -1.49449 5.33006"; assert_vec(ref, z1); ref = "0.123808 -0.590395 0.45136 -1.52973 0.00504626"; assert_vec(ref, z2); } itpp-4.3.1/gtests/specmat_test.cpp000066400000000000000000000111661216575753400172270ustar00rootroot00000000000000/*! * \file * \brief Test program of special vectors and matrices * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace std; using namespace itpp; static const double tol = 1e-4; static void assert_mat_p(const mat &ref, const mat &act, int line) { ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol) << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) static void assert_cmat_p(const cmat &ref, const cmat &act, int line) { ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k).real(), act(n,k).real(), tol) << line; ASSERT_NEAR(ref(n,k).imag(), act(n,k).imag(), tol) << line; } } } #define assert_cmat(ref, act) assert_cmat_p(ref, act, __LINE__) TEST(SpecMat, All) { RNG_reset(0); // Test of specmat routines bvec b1 = randb(7); bvec b2 = randb(13); bmat ref_b = "1 0 1 0 0 0 1 1 1 0 1 1 0;" "1 1 0 1 0 0 0 1 1 1 0 1 1;" "1 1 1 0 1 0 0 0 1 1 1 0 1;" "1 1 1 1 0 1 0 0 0 1 1 1 0;" "0 1 1 1 1 0 1 0 0 0 1 1 1;" "1 0 1 1 1 1 0 1 0 0 0 1 1;" "1 1 0 1 1 1 1 0 1 0 0 0 1"; ASSERT_TRUE(ref_b == toeplitz(b1, b2)); ref_b = "1 1 1 1 0 1 1;" "1 1 1 1 1 0 1;" "1 1 1 1 1 1 0;" "1 1 1 1 1 1 1;" "0 1 1 1 1 1 1;" "1 0 1 1 1 1 1;" "1 1 0 1 1 1 1"; ASSERT_TRUE(ref_b == toeplitz(b1)); vec v1 = randn(5); vec v2 = randn(7); mat ref = "0.0146015 -0.19548 -0.466618 0.640813 1.44749 0.585136 0.254363;" "0.875791 0.0146015 -0.19548 -0.466618 0.640813 1.44749 0.585136;" "0.382527 0.875791 0.0146015 -0.19548 -0.466618 0.640813 1.44749;" "-0.610395 0.382527 0.875791 0.0146015 -0.19548 -0.466618 0.640813;" "0.349783 -0.610395 0.382527 0.875791 0.0146015 -0.19548 -0.466618"; assert_mat(ref, toeplitz(v1, v2)); ref = "0.0146015 0.875791 0.382527 -0.610395 0.349783;" "0.875791 0.0146015 0.875791 0.382527 -0.610395;" "0.382527 0.875791 0.0146015 0.875791 0.382527;" "-0.610395 0.382527 0.875791 0.0146015 0.875791;" "0.349783 -0.610395 0.382527 0.875791 0.0146015"; assert_mat(ref, toeplitz(v1)); cvec c1 = randn_c(4); cvec c2 = randn_c(3); cmat ref_c = "0.480134+0.0415308i -1.01547-0.104848i 0.118973+1.59312i;" "0.388173+0.90716i 0.480134+0.0415308i -1.01547-0.104848i;" "-1.03694-0.106531i 0.388173+0.90716i 0.480134+0.0415308i;" "-0.45369+0.630181i -1.03694-0.106531i 0.388173+0.90716i"; assert_cmat(ref_c, toeplitz(c1, c2)); ref_c = "0.480134+0.0415308i 0.388173+0.90716i -1.03694-0.106531i -0.45369+0.630181i;" "0.388173+0.90716i 0.480134+0.0415308i 0.388173+0.90716i -1.03694-0.106531i;" "-1.03694-0.106531i 0.388173+0.90716i 0.480134+0.0415308i 0.388173+0.90716i;" "-0.45369+0.630181i -1.03694-0.106531i 0.388173+0.90716i 0.480134+0.0415308i"; assert_cmat(ref_c, toeplitz(c1, c1)); ref_c = "0.480134+0.0415308i 0.388173+0.90716i -1.03694-0.106531i -0.45369+0.630181i;" "0.388173-0.90716i 0.480134+0.0415308i 0.388173+0.90716i -1.03694-0.106531i;" "-1.03694+0.106531i 0.388173-0.90716i 0.480134+0.0415308i 0.388173+0.90716i;" "-0.45369-0.630181i -1.03694+0.106531i 0.388173-0.90716i 0.480134+0.0415308i"; assert_cmat(ref_c, toeplitz(c1)); } itpp-4.3.1/gtests/stat_test.cpp000066400000000000000000000060231216575753400165420ustar00rootroot00000000000000/*! * \file * \brief Miscellaneous statistical routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static const double tol = 1e-4; static void assert_vec_p(const vec &ref, const vec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) TEST(Stat, All) { RNG_reset(0); // Test of statistical routines vec a = randn(5); ASSERT_NEAR(1.02823, max(a), tol); ASSERT_NEAR(-1.27491, min(a), tol); ASSERT_NEAR(-0.255701, mean(a), tol); ASSERT_NEAR(0.505336, geometric_mean(abs(a)), tol); ASSERT_NEAR(1.76712, norm(a), tol); ASSERT_NEAR(1.76712, norm(a, 2), tol); ASSERT_NEAR(3.33497, norm(a, 1), tol); ASSERT_NEAR(1.76712, norm(a, "fro"), tol); ASSERT_NEAR(3.1227, energy(a), tol); ASSERT_NEAR(0.698947, variance(a), tol); ASSERT_NEAR(0, moment(a, 1), tol); ASSERT_NEAR(0.559158, moment(a, 2), tol); ASSERT_NEAR(0.207182, moment(a, 3), tol); ASSERT_NEAR(0.528541, skewness(a), tol); ASSERT_NEAR(-1.7716, kurtosisexcess(a), tol); ASSERT_NEAR(1.2284, kurtosis(a), tol); mat A = randn(5, 5); vec ref = "1.29011 0.249247 0.875791 1.29677 1.44749"; assert_vec(ref, max(A)); ref = "1.29011 0.249247 0.875791 1.29677 1.44749"; assert_vec(ref, max(A, 1)); ref = "0.382527 1.29011 1.44749 1.29677 0.875791"; assert_vec(ref, max(A, 2)); ref = "-0.878434 -3.7327 -1.27628 -0.610395 -0.466618"; assert_vec(ref, min(A)); ref = "-0.878434 -3.7327 -1.27628 -0.610395 -0.466618"; assert_vec(ref, min(A, 1)); ref = "-1.27628 -3.7327 -0.675383 -0.940147 -0.19548"; assert_vec(ref, min(A, 2)); ASSERT_NEAR(-0.0769627, mean(A), tol); ASSERT_NEAR(0.518696, geometric_mean(abs(A)), tol); ASSERT_NEAR(4.11346, norm(A), tol); ASSERT_NEAR(4.11346, norm(A, 2), tol); ASSERT_NEAR(5.56682, norm(A, 1), tol); ASSERT_NEAR(5.23492, norm(A, "fro"), tol); } itpp-4.3.1/gtests/stc_test.cpp000066400000000000000000000130601216575753400163570ustar00rootroot00000000000000/*! * \file * \brief STC class test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" #include "gtest/gtest.h" //returns true if the absolute difference of all elements of matrices is below err bool near(const itpp::cmat &M1, const itpp::cmat &M2, double err) { if (M1.rows() != M2.rows() || M1.cols() != M2.cols()) { return false; } register int n, k; for (n = 0; n < M1.rows(); ++n) { for (k = 0; k < M1.cols(); ++k) { if (std::abs(M1(n,k)-M2(n,k)) >= err) { return false; } } } return true; } TEST(STC, All) { int em_antenna = 2; int channel_uses = 2; const int const_size = 4;//QAM const double abs_err = 1e-12; // Checking V-BLAST std::string code_name("V-BLAST_MxN"); //should succeed itpp::STC stc(code_name, const_size, em_antenna, channel_uses); //check parameters ASSERT_EQ(2, stc.get_nb_emission_antenna()); ASSERT_EQ(2, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); //check generated matrices itpp::cmat ref_vblast("1 0; 0 0; 0 1; 0 0; 0 0; 1 0; 0 0; 0 1"); ASSERT_TRUE(near(ref_vblast, stc.get_1st_gen_matrix(), abs_err)); ASSERT_TRUE(near(ref_vblast, stc.get_2nd_gen_matrix(), abs_err)); // Checking improved V-BLAST code_name = "imp_V-BLAST_MxN"; //should succeed stc.setup(code_name, const_size, em_antenna, channel_uses); //check parameters ASSERT_EQ(2, stc.get_nb_emission_antenna()); ASSERT_EQ(2, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); //check generated matrices itpp::cmat ref_imp_vblast("1 0; 0 1; 0 1; 1 0; 1 0; 0 -1; 0 1; -1 0"); ref_imp_vblast /= std::sqrt(2.0); ASSERT_TRUE(near(ref_imp_vblast, stc.get_1st_gen_matrix(), abs_err)); ASSERT_TRUE(near(ref_imp_vblast, stc.get_2nd_gen_matrix(), abs_err)); // Checking Alamouti code code_name = "Alamouti_2xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(2, stc.get_nb_emission_antenna()); ASSERT_EQ(2, stc.get_channel_uses()); ASSERT_EQ(2, stc.get_nb_symbols_per_block()); //check generated matrices itpp::cmat ref_A("1 0; 0 1; 0 1; -1 0"); itpp::cmat ref_B("1 0; 0 -1; 0 1; 1 0"); ASSERT_TRUE(near(ref_A, stc.get_1st_gen_matrix(), abs_err)); ASSERT_TRUE(near(ref_B, stc.get_2nd_gen_matrix(), abs_err)); // Checking switched Alamouti code code_name = "Switched_Alamouti_4xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(4, stc.get_nb_emission_antenna()); ASSERT_EQ(4, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); // Checking double Alamouti code code_name = "Double_Alamouti_4xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(4, stc.get_nb_emission_antenna()); ASSERT_EQ(2, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); // Checking Jafarkhani code code_name = "Jafarkhani_4xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(4, stc.get_nb_emission_antenna()); ASSERT_EQ(4, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); // Checking Golden code code_name = "Golden_2x2"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(2, stc.get_nb_emission_antenna()); ASSERT_EQ(2, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); // Checking Damen code code_name = "Damen_2x2"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(2, stc.get_nb_emission_antenna()); ASSERT_EQ(2, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); // Checking orthogonal code 3xN code_name = "34ortho_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(3, stc.get_nb_emission_antenna()); ASSERT_EQ(4, stc.get_channel_uses()); ASSERT_EQ(3, stc.get_nb_symbols_per_block()); // Checking 36 LD code 3xN code_name = "36LD_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(3, stc.get_nb_emission_antenna()); ASSERT_EQ(4, stc.get_channel_uses()); ASSERT_EQ(4, stc.get_nb_symbols_per_block()); // Checking 37 LD code 3xN code_name = "37LD_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(3, stc.get_nb_emission_antenna()); ASSERT_EQ(6, stc.get_channel_uses()); ASSERT_EQ(6, stc.get_nb_symbols_per_block()); // Checking 39 LD code 3xN code_name = "39LD_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters ASSERT_EQ(3, stc.get_nb_emission_antenna()); ASSERT_EQ(6, stc.get_channel_uses()); ASSERT_EQ(6, stc.get_nb_symbols_per_block()); } itpp-4.3.1/gtests/svd_test.cpp000066400000000000000000000031531216575753400163640ustar00rootroot00000000000000/*! * \file * \brief SVD decomposition test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; TEST(SVD, All) { RNG_reset(0); static const double tol = 1e-4; // Test of svd routines { // Real matrix mat A = randn(5, 5); mat U, V; vec S; svd(A, U, S, V); ASSERT_NEAR(2.38835e-15, norm(A - U * diag(S) * transpose(V)), tol); } { // Complex matrix cmat A = randn_c(5, 5); cmat U, V; vec S; svd(A, U, S, V); ASSERT_NEAR(6.20568e-15, norm(A - U * diag(S) * hermitian_transpose(V)), tol); } } itpp-4.3.1/gtests/timer_test.cpp000066400000000000000000000032431216575753400167100ustar00rootroot00000000000000/*! * \file * \brief Timer classes test program * \author Thomas Eriksson, Tony Ottosson, Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace std; using namespace itpp; TEST(Timer, All) { const double period = 2.0; const double relative_error = 0.05; CPU_Timer t1; Real_Timer t2; t1.start(); while (t1.get_time() < period) ; t1.stop(); tic(); t2.start(); while (t2.get_time() < period) ; t2.stop(); double t3 = toc(); ASSERT_TRUE(fabs(t1.get_time() - period) <= relative_error * period); ASSERT_TRUE(fabs(t2.get_time() - period) <= relative_error * period); ASSERT_TRUE(t3 >= t2.get_time()); } itpp-4.3.1/gtests/transforms_test.cpp000066400000000000000000000325521216575753400177730ustar00rootroot00000000000000/*! * \file * \brief Transforms test program * \author Tony Ottosson, Thomas Eriksson, Simon Wood, Adam Piatyszek, Andy Panov and Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" #ifdef _OPENMP #include #endif using namespace itpp; //set test tolerance (measure of relative and absolute error) const double max_rel_error = 1e-6; const double max_abs_error = 1e-6; //transform results tester template inline void test_result(const Vec& in, const Vec& ref) { int n = size(in); it_assert(n == ref.size(), "compute_rel_error(): input and reference sizes must be equal."); for(int i = 0; i < n ; ++i) { if(abs(in(i) - ref(i)) < max_abs_error) continue; //handle numbers with absolute value close to zero (relative error can be huge for them) double rel_error = abs(in(i) - ref(i)) / abs(in(i)); ASSERT_LE(rel_error, max_rel_error); } } //tester for multiple results collected in std::vector template inline void test_result(const std::vector >& in, const Vec& ref) { typename std::vector >::size_type i; for(i = 0; i < in.size(); ++i) test_result(in[i], ref); } //Reference transform implementations. These functions are not intended to be fast. //They just strictly follow the transform definitions //reference DFT implementation template inline cvec ref_dft(const Vec& in) { int n = size(in); it_assert(n > 0, "ref_dft(): zero-sized input detected."); cvec ret(n); for(int i = 0; i < n; ++i) { std::complex res = 0.0; for(int j = 0; j < n; ++j) { res += std::complex(cos(2 * pi * i * j / n), -sin(2 * pi * i * j / n)) * in(j); } ret(i) = res; } return ret; } //reference IDFT implementation inline cvec ref_idft(const cvec& in) { int n = size(in); it_assert(n > 0, "ref_idft(): zero-sized input detected."); cvec ret(n); for(int i = 0; i < n; ++i) { std::complex res = 0.0; for(int j = 0; j < n; ++j) { res += std::complex(cos(2 * pi * i * j / n), sin(2 * pi * i * j / n)) * in(j); } ret(i) = res; } ret *= 1.0 / n; return ret; } //Type-II DCT reference implementation inline vec ref_dct(const vec& in) { int n = size(in); it_assert(n > 0, "ref_dct(): zero-sized input detected."); vec ret(n); for(int i = 0; i < n; ++i) { double res = 0.0; for(int j = 0; j < n; ++j) { res += cos(pi * (j + 0.5) * i / n) * in(j); } ret(i) = 2 * res; } // Scale to matlab definition format ret /= std::sqrt(2.0 * n); ret(0) /= std::sqrt(2.0); return ret; } //Type-III DCT (IDCT) reference implementation inline vec ref_idct(const vec& in) { int n = size(in); it_assert(n > 0, "ref_dct(): zero-sized input detected."); vec tmp = in; tmp(0) *= std::sqrt(2.0); tmp /= std::sqrt(2.0 * n); vec ret(n); for(int i = 0; i < n; ++i) { double res = 0.0; for(int j = 1; j < n; ++j) { res += cos(pi * (i + 0.5) * j / n) * tmp(j); } ret(i) = 2 * res + tmp(0); } return ret; } //Transform testers run the same transform function in single or multiple threads (if OMP is enabled). template std::vector run_transform_test(OutType(*transform_function)(const InType&), const InType& test_input) { //select number of results. Multiple threads run the same code if OMP is enabled #ifdef _OPENMP static const int threads_cnt = omp_get_max_threads(); omp_set_num_threads(threads_cnt); #else static const int threads_cnt = 1; #endif std::vector ret(threads_cnt); #pragma omp parallel { //parallel region start. Spawn the threads. #pragma omp for for(int j = 0; j < threads_cnt; ++j) { ret[j] = transform_function(test_input); } //parallel region end. Join the threads. } return ret; } template std::vector run_transform_test(OutType(*transform_function)(const InType&, int), const InType& test_input, int N) { //select number of results. Multiple threads run the same code if OMP is enabled #ifdef _OPENMP static const int threads_cnt = omp_get_max_threads(); omp_set_num_threads(threads_cnt); #else static const int threads_cnt = 1; #endif std::vector ret(threads_cnt); #pragma omp parallel { //parallel region start. Spawn the threads. #pragma omp for for(int j = 0; j < threads_cnt; ++j) { ret[j] = transform_function(test_input, N); } //parallel region end. Join the threads. } return ret; } //---------------------------------------------- //Gtest test cases //---------------------------------------------- TEST(Transforms, FFTReal) { int N = 16; vec x = randn(N); if(!have_fourier_transforms()) FAIL() << "Fourier Transforms are not supported with this library build."; //vector processing test { SCOPED_TRACE("y = fft_real(x) test"); //cvec y = fft_real(x); std::vector y = run_transform_test(fft_real, x); test_result(y, ref_dft(x)); } //subvector processing test { SCOPED_TRACE("y = fft_real(x, N) test, N < length(x)"); int N_sub = 11; //odd subvector length //cvec y = fft_real(x, N_sub); std::vector y = run_transform_test(fft_real, x, N_sub); test_result(y, ref_dft(x(0, N_sub - 1))); } //zero-padded vector processing test { SCOPED_TRACE("y = fft_real(x, N) test, N > length(x)"); int N_zp = 8; //zero-padding length //cvec y = fft_real(x, N + N_zp); std::vector y = run_transform_test(fft_real, x, N + N_zp); x.set_size(N + N_zp, true); test_result(y, ref_dft(x)); } } TEST(Transforms, IFFTReal) { if(!have_fourier_transforms()) FAIL() << "Fourier Transforms are not supported with this library build."; //vector processing test { SCOPED_TRACE("y = ifft_real(x) test"); int N = 16; cvec t = randn_c(N - 1); cvec x(N); //generate test complex sequence with real spectra x.set_subvector(1, 0.5 * (t + conj(reverse(t)))); x(0) = randn(); //run transform & test results //vec y = ifft_real(x); std::vector y = run_transform_test(ifft_real, x); test_result(y, real(ref_idft(x))); } //subvector processing test { SCOPED_TRACE("y = ifft_real(x, N) test, N < length(x)"); int N = 16, N_sub = 11; //define odd subvector length to test odd-length transform cvec t = randn_c(N - 1); cvec x(N); //fill subvector samples with Hermitian sequence x.set_subvector(1, 0.5 * (t(1, N_sub - 1) + conj(reverse(t(1, N_sub - 1))))); x(0) = randn(); //fill the rest of x with random data (these data should be ignored by IFFT implementation) x.set_subvector(N_sub, randn_c(N - N_sub)); //run transform & test results //vec y = ifft_real(x, N_sub); std::vector y = run_transform_test(ifft_real, x, N_sub); test_result(y, real(ref_idft(x(0, N_sub - 1)))); } //zero-padded vector processing test { SCOPED_TRACE("y = ifft_real(x, N) test, N > length(x)"); int N_data = 32, N_zp = 8; //define data and zero-padding length cvec t = randn_c(N_data); cvec x(N_data + N_zp + 1); //generate the test data. sequence posesses Hermitian symmetry after zero-padding with N_zp zeros. x(0) = randn(); x.set_subvector(1, N_zp, std::complex(0)); x.set_subvector(N_zp + 1, 0.5 * (t + conj(reverse(t)))); //run transform & test results //vec y = ifft_real(x, N_data + 2*N_zp + 1); std::vector y = run_transform_test(ifft_real, x, N_data + 2 * N_zp + 1); x.set_size(N_data + 2 * N_zp + 1, true); test_result(y, real(ref_idft(x))); } } TEST(Transforms, FFTCplx) { if(!have_fourier_transforms()) FAIL() << "Fourier Transforms are not supported with this library build."; int N = 16; cvec x = randn_c(N); //vector processing test { SCOPED_TRACE("y = fft(x) test"); //cvec y = fft(x); std::vector y = run_transform_test(fft, x); test_result(y, ref_dft(x)); } //subvector processing test { SCOPED_TRACE("y = fft(x, N) test, N < length(x)"); int N_sub = 11; //odd subvector length //cvec y = fft(x, N_sub); std::vector y = run_transform_test(fft, x, N_sub); test_result(y, ref_dft(x(0, N_sub - 1))); } //zero-padded vector processing test { SCOPED_TRACE("y = fft(x, N) test, N > length(x)"); int N_zp = 8; //zero-padding length //cvec y = fft(x, N + N_zp); std::vector y = run_transform_test(fft, x, N + N_zp); x.set_size(N + N_zp, true); test_result(y, ref_dft(x)); } } TEST(Transforms, IFFTCplx) { if(!have_fourier_transforms()) FAIL() << "Fourier Transforms are not supported with this library build."; int N = 16; cvec x = randn_c(N), y; //vector processing test { SCOPED_TRACE("y = ifft(x) test"); //cvec y = ifft(x); std::vector y = run_transform_test(ifft, x); test_result(y, ref_idft(x)); } //subvector processing test { SCOPED_TRACE("y = ifft(x, N) test, N < length(x)"); int N_sub = 11; //odd subvector length //cvec y = ifft(x, N_sub); std::vector y = run_transform_test(ifft, x, N_sub); test_result(y, ref_idft(x(0, N_sub - 1))); } //zero-padded vector processing test { SCOPED_TRACE("y = ifft(x, N) test, N > length(x)"); int N_zp = 8; //zero-padding length //cvec y = ifft(x, N + N_zp); std::vector y = run_transform_test(ifft, x, N + N_zp); x.set_size(N + N_zp, true); test_result(y, ref_idft(x)); } } TEST(Transforms, DCT) { if(!have_cosine_transforms()) FAIL() << "Cosine Transforms are not supported with this library build."; int N = 16; vec x = randn(N); //vector processing test { SCOPED_TRACE("y = dct(x) test"); //vec y = dct(x); std::vector y = run_transform_test(dct, x); test_result(y, ref_dct(x)); } //subvector processing test { SCOPED_TRACE("y = dct(x, N) test, N < length(x)"); int N_sub = 11; //odd subvector length //vec y = dct(x, N_sub); std::vector y = run_transform_test(dct, x, N_sub); test_result(y, ref_dct(x(0, N_sub - 1))); } //zero-padded vector processing test { SCOPED_TRACE("y = dct(x, N) test, N > length(x)"); int N_zp = 8; //zero-padding length //vec y = dct(x, N + N_zp); std::vector y = run_transform_test(dct, x, N + N_zp); x.set_size(N + N_zp, true); test_result(y, ref_dct(x)); } } TEST(Transforms, IDCT) { if(!have_cosine_transforms()) FAIL() << "Cosine Transforms are not supported with this library build."; int N = 16; vec x = randn(N); //vector processing test { SCOPED_TRACE("y = idct(x) test"); //vec y = idct(x); std::vector y = run_transform_test(idct, x); test_result(y, ref_idct(x)); } //subvector processing test { SCOPED_TRACE("y = idct(x, N) test, N < length(x)"); int N_sub = 11; //odd subvector length //vec y = idct(x, N_sub); std::vector y = run_transform_test(idct, x, N_sub); test_result(y, ref_idct(x(0, N_sub - 1))); } //zero-padded vector processing test { SCOPED_TRACE("y = idct(x, N) test, N > length(x)"); int N_zp = 8; //zero-padding length //vec y = idct(x, N + N_zp); std::vector y = run_transform_test(idct, x, N + N_zp); x.set_size(N + N_zp, true); test_result(y, ref_idct(x)); } } //Run several transforms sequentially. This test runs three FFT transforms sequentially in each thread. //The test is intended to verify FFT operation on larger data sets and test for possible clashes on shared //data in multithreaded environment. cvec seq_transforms_test(const cvec& test_input) { //run 128,256,512-point FFT on test dataset and store results in output vector cvec output(128 + 256 + 512); output.set_subvector(0, fft(test_input, 128)); output.set_subvector(128, fft(test_input, 256)); output.set_subvector(128 + 256, fft(test_input)); return output; } cvec seq_transforms_ref(const cvec& test_input) { //compute reference transforms to verify test results cvec output(128 + 256 + 512); output.set_subvector(0, ref_dft(test_input(0, 127))); output.set_subvector(128, ref_dft(test_input(0, 255))); output.set_subvector(128 + 256, ref_dft(test_input)); return output; } TEST(Transforms, FFT_128_256_512) { if(!have_fourier_transforms()) FAIL() << "Fourier Transforms are not supported with this library build."; cvec test_input = randn_c(512); std::vector y = run_transform_test(seq_transforms_test, test_input); test_result(y, seq_transforms_ref(test_input)); } itpp-4.3.1/gtests/turbo_test.cpp000066400000000000000000000304721216575753400167270ustar00rootroot00000000000000/*! * \file * \brief Turbo encoder/decoder class test program * \author Pal Frenger and Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static void assert_mat_p(const mat &ref, const mat &act, int line, double tol = 1e-4) { ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for (int n = 0; n < ref.rows(); ++n) { for (int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n,k), act(n,k), tol) << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) #define assert_mat_tol(ref, act, tol) assert_mat_p(ref, act, __LINE__, tol) TEST(Turbo, All) { RNG_reset(12345); Turbo_Codec turbo; ivec gen(2); gen(0) = 07; gen(1) = 05; int constraint_length = 3; int block_length = 400; ivec interleaver_sequence = wcdma_turbo_interleaver_sequence(block_length); int iterations = 8; string metric = "LOGMAX"; double logmax_scale_factor = 0.7; bool adaptive_stop = true; turbo.set_parameters(gen, gen, constraint_length, interleaver_sequence, iterations, metric, logmax_scale_factor, adaptive_stop); int num_blocks = 50; bmat puncture_matrix = "1 1;1 1;1 1"; Punctured_Turbo_Codec pturbo_ref; pturbo_ref.set_parameters(gen, gen, constraint_length, interleaver_sequence, puncture_matrix, iterations, metric, logmax_scale_factor, adaptive_stop); vec EbN0db = "0.0 0.5 1.0 1.5 2.0"; double A = 1.0; double Ts = 1.0; double Ec = A * A * Ts; double r = block_length / (3.0 * block_length + 8.0); // 8 tailbits double Eb = Ec / r; vec EbN0 = pow(10.0, 0.1 * EbN0db); vec N0 = Eb * pow(EbN0, -1.0); vec sigma2 = N0 / 2; ivec nrof_used_iterations; vec symbols, received; bvec input, coded_bits, decoded_bits, transmitted; bvec decoded_bits_p; Normal_RNG noise_src; BPSK bpsk; BERC berc; mat err = zeros(4, EbN0db.length()); mat cor = zeros(4, EbN0db.length()); mat ber = zeros(4, EbN0db.length()); mat avg_nrof_iterations = zeros(4, EbN0db.length()); LLR_calc_unit lowresllrcalc(10, 7, 9); // table with low resolution Array timer(4); for(int i = 0; i < 4; i++) { timer(i).reset(); } for(int i = 0; i < EbN0db.length(); i++) { noise_src.setup(0.0, sigma2(i)); turbo.set_awgn_channel_parameters(Ec, N0(i)); pturbo_ref.set_awgn_channel_parameters(Ec, N0(i)); input = randb(block_length * num_blocks); turbo.encode(input, transmitted); bpsk.modulate_bits(transmitted, symbols); received = symbols + noise_src(transmitted.length()); // -- logmax decoding -- turbo.set_metric("LOGMAX", 1.0); timer(0).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(0).stop(); pturbo_ref.set_metric("LOGMAX", 1.0); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); ASSERT_TRUE(decoded_bits == decoded_bits_p); berc.clear(); berc.count(input, decoded_bits); err(0, i) = berc.get_errors(); cor(0, i) = berc.get_corrects(); ber(0, i) = berc.get_errorrate(); avg_nrof_iterations(0, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- logmap decoding -- turbo.set_metric("LOGMAP", 1.0); timer(1).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(1).stop(); pturbo_ref.set_metric("LOGMAP", 1.0); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); ASSERT_TRUE(decoded_bits == decoded_bits_p); berc.clear(); berc.count(input, decoded_bits); err(1, i) = berc.get_errors(); cor(1, i) = berc.get_corrects(); ber(1, i) = berc.get_errorrate(); avg_nrof_iterations(1, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, default resolution -- turbo.set_metric("TABLE", 1.0); timer(2).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(2).stop(); pturbo_ref.set_metric("TABLE", 1.0); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); ASSERT_TRUE(decoded_bits == decoded_bits_p); berc.clear(); berc.count(input, decoded_bits); err(2, i) = berc.get_errors(); cor(2, i) = berc.get_corrects(); ber(2, i) = berc.get_errorrate(); avg_nrof_iterations(2, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, low resolution -- turbo.set_metric("TABLE", 1.0, lowresllrcalc); timer(3).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(3).stop(); pturbo_ref.set_metric("TABLE", 1.0, lowresllrcalc); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); ASSERT_TRUE(decoded_bits == decoded_bits_p); berc.clear(); berc.count(input, decoded_bits); err(3, i) = berc.get_errors(); cor(3, i) = berc.get_corrects(); ber(3, i) = berc.get_errorrate(); avg_nrof_iterations(3, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); } mat ref = "0.1174 0.0586 0.005 0.00065 0;" "0.0518 0.02005 0.0017 0 0;" "0.0522 0.0199 0.0017 0 0;" "0.05495 0.01905 0.0017 0 0"; assert_mat(ref, ber); ref = "7.7 7.04 4.7 3.46 3.02;" "7.16 6.06 4.12 3.24 3;" "7.2 6.06 4.08 3.24 3;" "7.26 6.1 4.06 3.22 3.06"; assert_mat(ref, avg_nrof_iterations); ref = "2348 1172 100 13 0;" "1036 401 34 0 0;" "1044 398 34 0 0;" "1099 381 34 0 0"; assert_mat(ref, err); ref = "17652 18828 19900 19987 20000;" "18964 19599 19966 20000 20000;" "18956 19602 19966 20000 20000;" "18901 19619 19966 20000 20000"; assert_mat(ref, cor); /* ###################################### * # now test for punctured turbo codec # * ###################################### */ puncture_matrix = "1 1;1 0;0 1"; Punctured_Turbo_Codec pturbo; pturbo.set_parameters(gen, gen, constraint_length, interleaver_sequence, puncture_matrix, iterations, metric, logmax_scale_factor, adaptive_stop); r = pturbo.get_rate(); Eb = Ec / r; N0 = Eb * pow(EbN0, -1.0); sigma2 = N0 / 2; err.zeros(); cor.zeros(); ber.zeros(); avg_nrof_iterations.zeros(); for(int i = 0; i < 4; i++) { timer(i).reset(); } for(int i = 0; i < EbN0db.length(); i++) { noise_src.setup(0.0, sigma2(i)); pturbo.set_awgn_channel_parameters(Ec, N0(i)); input = randb(block_length * num_blocks); pturbo.encode(input, transmitted); bpsk.modulate_bits(transmitted, symbols); received = symbols + noise_src(transmitted.length()); // -- logmax decoding -- pturbo.set_metric("LOGMAX", 1.0); timer(0).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(0).stop(); berc.clear(); berc.count(input, decoded_bits); err(0, i) = berc.get_errors(); cor(0, i) = berc.get_corrects(); ber(0, i) = berc.get_errorrate(); avg_nrof_iterations(0, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- logmap decoding -- pturbo.set_metric("LOGMAP", 1.0); timer(1).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(1).stop(); berc.clear(); berc.count(input, decoded_bits); err(1, i) = berc.get_errors(); cor(1, i) = berc.get_corrects(); ber(1, i) = berc.get_errorrate(); avg_nrof_iterations(1, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, default resolution -- pturbo.set_metric("TABLE", 1.0); timer(2).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(2).stop(); berc.clear(); berc.count(input, decoded_bits); err(2, i) = berc.get_errors(); cor(2, i) = berc.get_corrects(); ber(2, i) = berc.get_errorrate(); avg_nrof_iterations(2, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, low resolution -- pturbo.set_metric("TABLE", 1.0, lowresllrcalc); timer(3).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(3).stop(); berc.clear(); berc.count(input, decoded_bits); err(3, i) = berc.get_errors(); cor(3, i) = berc.get_corrects(); ber(3, i) = berc.get_errorrate(); avg_nrof_iterations(3, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); } ref = "0.1489 0.0907 0.0519 0.00355 0.00195;" "0.1068 0.0428 0.0242 0.0002 0;" "0.10685 0.04285 0.02435 0.0002 0;" "0.10745 0.04645 0.0244 0.00035 0"; assert_mat(ref, ber); ref = "8 7.74 6.92 4.42 3.26;" "6.38 7.26 6.18 4.08 3.32;" "6.48 7.2 6.2 4.08 3.3;" "7.88 7.44 6.42 4.02 3.28"; assert_mat(ref, avg_nrof_iterations); ref = "2978 1814 1038 71 39;" "2136 856 484 4 0;" "2137 857 487 4 0;" "2149 929 488 7 0"; assert_mat_tol(ref, err, 2); ref = "17022 18186 18962 19929 19961;" "17864 19144 19516 19996 20000;" "17863 19143 19513 19996 20000;" "17851 19071 19512 19993 20000"; assert_mat_tol(ref, cor, 2); /* // The test program cannot print this out, but on my system // the QLLR based decoder is about 8 times faster than logmap. -EGL cerr << "Timers: "; for (int i=0; i<4; i++) { cerr << timer(i).get_time() << " "; } cerr << endl; */ //test interleavers ivec interleaver; ivec block_lengths = "40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 " "160 168 176 184 192 200 208 216 224 232 240 248 256 264 272 280 288 296 " "304 312 320 328 336 344 352 360 368 376 384 392 400 " "408 416 424 432 440 448 456 464 472 480 488 496 504 512 528 544 560 576 " "592 608 624 640 656 672 688 704 720 736 752 768 784 " "800 816 832 848 864 880 896 912 928 944 960 976 992 1008 1024 1056 1088 " "1120 1152 1184 1216 1248 1280 1312 1344 1376 1408 " "1440 1472 1504 1536 1568 1600 1632 1664 1696 1728 1760 1792 1824 1856 1888 " "1920 1952 1984 2016 2048 2112 2176 2240 2304 2368 " "2432 2496 2560 2624 2688 2752 2816 2880 2944 3008 3072 3136 3200 3264 3328 " "3392 3456 3520 3584 3648 3712 3776 3840 3904 3968 " "4032 4096 4160 4224 4288 4352 4416 4480 4544 4608 4672 4736 4800 4864 4928 " "4992 5056 5120 5184 5248 5312 5376 5440 5504 5568 " "5632 5696 5760 5824 5888 5952 6016 6080 6144"; for(int i = 0; i < block_lengths.length(); ++i) { if(5114 >= block_lengths[i]) { //use allowed lengths interleaver = wcdma_turbo_interleaver_sequence(block_lengths[i]); sort(interleaver); for(int j = 0; j < block_lengths[i]; ++j) { ASSERT_TRUE(j == interleaver[j]) << "WCDMA: wrong value for intl length " << block_lengths[i]; } } interleaver = lte_turbo_interleaver_sequence(block_lengths[i]); sort(interleaver); for(int j = 0; j < block_lengths[i]; ++j) { ASSERT_TRUE(j == interleaver[j]) << "LTE: wrong value for intl length " << block_lengths[i]; } } } itpp-4.3.1/gtests/vec_test.cpp000066400000000000000000001306001216575753400163430ustar00rootroot00000000000000/*! * \file * \brief Vector class test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include "gtest/gtest.h" using namespace itpp; using namespace std; static const double tol = 1e-4; static void assert_vec_p(const vec &ref, const vec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for(int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) static void assert_cvec_p(const cvec &ref, const cvec &act, int line) { ASSERT_EQ(ref.length(), act.length()) << line; for(int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line; ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line; } } #define assert_cvec(ref, act) assert_cvec_p(ref, act, __LINE__) static void assert_mat_p(const mat &ref, const mat &act, int line) { ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for(int n = 0; n < ref.rows(); ++n) { for(int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n, k), act(n, k), tol) << line; } } } #define assert_mat(ref, act) assert_mat_p(ref, act, __LINE__) static void assert_cmat_p(const cmat &ref, const cmat &act, int line) { ASSERT_EQ(ref.rows(), act.rows()) << line; ASSERT_EQ(ref.cols(), act.cols()) << line; for(int n = 0; n < ref.rows(); ++n) { for(int k = 0; k < ref.cols(); ++k) { ASSERT_NEAR(ref(n, k).real(), act(n, k).real(), tol) << line; ASSERT_NEAR(ref(n, k).imag(), act(n, k).imag(), tol) << line; } } } #define assert_cmat(ref, act) assert_cmat_p(ref, act, __LINE__) void common_operators(const bvec &a, const bvec &b, bin c) { bvec a2 = a; bvec x1; bvec b2 = b; bvec x2; bvec ref = "1 1 1 0 1 0 1 1 1 1"; ASSERT_TRUE(ref == a + b); ASSERT_TRUE((a + c) == (c + a)); ref = "1 1 1 0 1 0 1 1 1 1"; a2 += b; ASSERT_TRUE(ref == a2); a2 = a; a2 += c; ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); ref = "1 1 1 0 1 0 1 1 1 1"; ASSERT_TRUE(ref == a - b); ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a - c); ASSERT_TRUE(ref == c - a); a2 = a; a2 -= b; ref = "1 1 1 0 1 0 1 1 1 1"; ASSERT_TRUE(ref == a2); a2 = a; a2 -= c; ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == -a); ASSERT_TRUE(bin(0) == a * b); ASSERT_TRUE(bin(0) == dot(a, b)); bmat ref_m = "0 0 0 1 1 1 0 1 1 0;" "0 0 0 1 1 1 0 1 1 0;" "0 0 0 1 1 1 0 1 1 0;" "0 0 0 1 1 1 0 1 1 0;" "0 0 0 0 0 0 0 0 0 0;" "0 0 0 1 1 1 0 1 1 0;" "0 0 0 1 1 1 0 1 1 0;" "0 0 0 0 0 0 0 0 0 0;" "0 0 0 0 0 0 0 0 0 0;" "0 0 0 1 1 1 0 1 1 0"; ASSERT_TRUE(ref_m == outer_product(a, b)); ASSERT_TRUE(a * c == c * a); a2 = a; a2 *= c; ASSERT_TRUE(a * c == a2); ref = "0 0 0 1 0 1 0 0 0 0"; ASSERT_TRUE(ref == elem_mult(a, b)); elem_mult_out(a, b, x1); ref = "0 0 0 1 0 1 0 0 0 0"; ASSERT_TRUE(ref == x1); elem_mult_inplace(a, b2); ref = "0 0 0 1 0 1 0 0 0 0"; ASSERT_TRUE(ref == b2); ASSERT_TRUE(bin(0) == elem_mult_sum(a, b)); ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a / c); ASSERT_TRUE(ref == c / a); a2 = a; a2 /= c; ASSERT_TRUE(ref == a2); a2 = a; a2 /= b; ref = "1 1 1 1 1 1 1 1 1 1"; ASSERT_TRUE(ref == a2); ASSERT_TRUE(ref == elem_div(a, b)); elem_div_out(a, b, x2); ASSERT_TRUE(ref == x2); ASSERT_TRUE(bin(0) == elem_div_sum(a, b)); ref = "1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0"; ASSERT_TRUE(ref == concat(a, b)); ref = "1 1 1 1 0 1 1 0 0 1 0"; ASSERT_TRUE(ref == concat(a, c)); ref = "0 1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == concat(c, a)); ref = "1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == concat(a, b, a)); ref = "1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0"; ASSERT_TRUE(ref == concat(a, b, a, b)); ref = "1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == concat(a, b, a, b, a)); ref_m = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref_m == a.T()); ref_m = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref_m == a.H()); ASSERT_TRUE(10 == a.size()); a2 = a; a2.set_size(a2.size() + 3, true); ref = "1 1 1 1 0 1 1 0 0 1 0 0 0"; ASSERT_TRUE(ref == a2); a2.set_size(a2.size() - 6, true); ref = "1 1 1 1 0 1 1"; ASSERT_TRUE(ref == a2); ASSERT_TRUE(bin(1) == a(5)); ASSERT_TRUE(bin(1) == a.get(5)); ref = "1 1 1 1 0 1"; ASSERT_TRUE(ref == a(0, 5)); ASSERT_TRUE(ref == a.get(0, 5)); ref = "1 0 0 1"; ASSERT_TRUE(ref == a(6, -1)); ivec idx_list = "0 5 6 7"; ref = "1 1 1 0"; ASSERT_TRUE(ref == a(idx_list)); ASSERT_TRUE(ref == a.get(idx_list)); bvec bin_list = "1 0 0 0 0 1 1 1 0 0"; ref = "1 1 1 0"; ASSERT_TRUE(ref == a(bin_list)); ASSERT_TRUE(ref == a.get(bin_list)); ref = "0 0 1"; ASSERT_TRUE(ref == a.right(3)); ref = "1 1 1 1"; ASSERT_TRUE(ref == a.left(4)); ref = "1 0"; ASSERT_TRUE(ref == a.mid(3, 2)); a2 = a; ASSERT_TRUE(0 == a2.split(0).length()); a2 = a; ASSERT_TRUE(a == a2.split(a2.size())); ASSERT_TRUE(0 == a2.length()); a2 = a; ref = "1 1 1 1"; ASSERT_TRUE(ref == a2.split(4)); ref = "0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2(5) = a(6); ref = "0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_left(c, 2); ref = "1 1 0 1 1 0 0 1 0 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_right(c); ref = "0 1 1 1 1 0 1 1 0 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_left(b.mid(0, 2)); ref = "1 1 0 1 1 0 0 1 0 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_right(b.right(5)); ref = "1 0 1 1 0 1 1 1 1 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.set_subvector(0, b); ref = "0 0 0 1 1 1 0 1 1 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.set_subvector(4, b(3, 5)); ref = "1 1 1 1 1 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.replace_mid(4, b(3, 5)); ref = "1 1 1 1 1 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.del(6); ref = "1 1 1 1 0 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.del(3, 9); ref = "1 1 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(0, c); ref = "0 1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(2, c); ref = "1 1 0 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(10, c); ref = "1 1 1 1 0 1 1 0 0 1 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(3, b(0, 2)); ref = "1 1 1 0 0 0 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.zeros(); ASSERT_FALSE(any(a2)); a2 = a; a2.ones(); ASSERT_TRUE(all(a2)); a2 = a; a2 = c; ASSERT_FALSE(any(a2)); a2 = a; a2 = b(0, 4); ref = "0 0 0 1 1"; ASSERT_TRUE(ref == a2); a2 = a; a2 = b.T(); ref = "0 0 0 1 1 1 0 1 1 0"; ASSERT_TRUE(ref == a2); a2 = a; a2 = b.T().T(); ref = "0 0 0 1 1 1 0 1 1 0"; ASSERT_TRUE(ref == a2); } void common_operators(const ivec &a, const ivec &b, int c) { ivec a2 = a; ivec x1; ivec b2 = b; ivec x2; ivec ref = "15 7 11 10 15 5 9 13 12 7"; ivec act = a + b; ASSERT_TRUE(ref == act); ASSERT_TRUE((a + c) == (c + a)); ref = "15 7 11 10 15 5 9 13 12 7"; a2 += b; ASSERT_TRUE(ref == a2); a2 = a; a2 += c; ref = "14 10 12 13 15 9 7 11 14 11"; ASSERT_TRUE(ref == a2); ref = "1 1 1 4 3 1 -7 -3 4 3"; ASSERT_TRUE(ref == a - b); ref = "2 -2 0 1 3 -3 -5 -1 2 -1"; ASSERT_TRUE(ref == a - c); ref = "-2 2 0 -1 -3 3 5 1 -2 1"; ASSERT_TRUE(ref == c - a); a2 = a; a2 -= b; ref = "1 1 1 4 3 1 -7 -3 4 3"; ASSERT_TRUE(ref == a2); a2 = a; a2 -= c; ref = "2 -2 0 1 3 -3 -5 -1 2 -1"; ASSERT_TRUE(ref == a2); ref = "-8 -4 -6 -7 -9 -3 -1 -5 -8 -5"; ASSERT_TRUE(ref == -a); ASSERT_TRUE(269 == a * b); ASSERT_TRUE(269 == dot(a, b)); imat ref_m = "56 24 40 24 48 16 64 64 32 16;" "28 12 20 12 24 8 32 32 16 8;" "42 18 30 18 36 12 48 48 24 12;" "49 21 35 21 42 14 56 56 28 14;" "63 27 45 27 54 18 72 72 36 18;" "21 9 15 9 18 6 24 24 12 6;" "7 3 5 3 6 2 8 8 4 2;" "35 15 25 15 30 10 40 40 20 10;" "56 24 40 24 48 16 64 64 32 16;" "35 15 25 15 30 10 40 40 20 10"; ASSERT_TRUE(ref_m == outer_product(a, b)); ASSERT_TRUE(a * c == c * a); a2 = a; a2 *= c; ASSERT_TRUE(a * c == a2); ref = "56 12 30 21 54 6 8 40 32 10"; ASSERT_TRUE(ref == elem_mult(a, b)); elem_mult_out(a, b, x1); ref = "56 12 30 21 54 6 8 40 32 10"; ASSERT_TRUE(ref == x1); elem_mult_inplace(a, b2); ref = "56 12 30 21 54 6 8 40 32 10"; ASSERT_TRUE(ref == b2); ASSERT_TRUE(269 == elem_mult_sum(a, b)); ref = "1 0 1 1 1 0 0 0 1 0"; ASSERT_TRUE(ref == a / c); ref = "0 1 1 0 0 2 6 1 0 1"; ASSERT_TRUE(ref == c / a); a2 = a; a2 /= c; ref = "1 0 1 1 1 0 0 0 1 0"; ASSERT_TRUE(ref == a2); a2 = a; a2 /= b; ref = "1 1 1 2 1 1 0 0 2 2"; ASSERT_TRUE(ref == a2); ASSERT_TRUE(ref == elem_div(a, b)); elem_div_out(a, b, x2); ASSERT_TRUE(ref == x2); ASSERT_TRUE(11 == elem_div_sum(a, b)); ref = "8 4 6 7 9 3 1 5 8 5 7 3 5 3 6 2 8 8 4 2"; ASSERT_TRUE(ref == concat(a, b)); ref = "8 4 6 7 9 3 1 5 8 5 6"; ASSERT_TRUE(ref == concat(a, c)); ref = "6 8 4 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref == concat(c, a)); ref = "8 4 6 7 9 3 1 5 8 5 7 3 5 3 6 2 8 8 4 2 8 4 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref == concat(a, b, a)); ref = "8 4 6 7 9 3 1 5 8 5 7 3 5 3 6 2 8 8 4 2 8 4 6 7 9 3 1 5 8 5 7 3 5 3 6 2 8 8 4 2"; ASSERT_TRUE(ref == concat(a, b, a, b)); ref = "8 4 6 7 9 3 1 5 8 5 7 3 5 3 6 2 8 8 4 2 8 4 6 7 9 3 1 5 8 5 7 3 5 3 6 2 8 8 4 2 8 4 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref == concat(a, b, a, b, a)); ref_m = "8 4 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref_m == a.T()); ref_m = "8 4 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref_m == a.H()); ASSERT_TRUE(10 == a.size()); a2 = a; a2.set_size(a2.size() + 3, true); ref = "8 4 6 7 9 3 1 5 8 5 0 0 0"; ASSERT_TRUE(ref == a2); a2.set_size(a2.size() - 6, true); ref = "8 4 6 7 9 3 1"; ASSERT_TRUE(ref == a2); ASSERT_TRUE(3 == a(5)); ASSERT_TRUE(3 == a.get(5)); ref = "8 4 6 7 9 3"; ASSERT_TRUE(ref == a(0, 5)); ASSERT_TRUE(ref == a.get(0, 5)); ref = "1 5 8 5"; ASSERT_TRUE(ref == a(6, -1)); ivec idx_list = "0 5 6 7"; ref = "8 3 1 5"; ASSERT_TRUE(ref == a(idx_list)); ASSERT_TRUE(ref == a.get(idx_list)); bvec bin_list = "1 0 0 0 0 1 1 1 0 0"; ref = "8 3 1 5"; ASSERT_TRUE(ref == a(bin_list)); ASSERT_TRUE(ref == a.get(bin_list)); ref = "5 8 5"; ASSERT_TRUE(ref == a.right(3)); ref = "8 4 6 7"; ASSERT_TRUE(ref == a.left(4)); ref = "7 9"; ASSERT_TRUE(ref == a.mid(3, 2)); a2 = a; ASSERT_TRUE(0 == a2.split(0).length()); a2 = a; ASSERT_TRUE(a == a2.split(a2.size())); ASSERT_TRUE(0 == a2.length()); a2 = a; ref = "8 4 6 7"; ASSERT_TRUE(ref == a2.split(4)); ref = "9 3 1 5 8 5"; ASSERT_TRUE(ref == a2); a2(5) = a(6); ref = "9 3 1 5 8 1"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_left(c, 2); ref = "6 7 9 3 1 5 8 5 6 6"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_right(c); ref = "6 8 4 6 7 9 3 1 5 8"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_left(b.mid(0, 2)); ref = "6 7 9 3 1 5 8 5 7 3"; ASSERT_TRUE(ref == a2); a2 = a; a2.shift_right(b.right(5)); ref = "2 8 8 4 2 8 4 6 7 9"; ASSERT_TRUE(ref == a2); a2 = a; a2.set_subvector(0, b); ref = "7 3 5 3 6 2 8 8 4 2"; ASSERT_TRUE(ref == a2); a2 = a; a2.set_subvector(4, b(3, 5)); ref = "8 4 6 7 3 6 2 5 8 5"; ASSERT_TRUE(ref == a2); a2 = a; a2.replace_mid(4, b(3, 5)); ref = "8 4 6 7 3 6 2 5 8 5"; ASSERT_TRUE(ref == a2); a2 = a; a2.del(6); ref = "8 4 6 7 9 3 5 8 5"; ASSERT_TRUE(ref == a2); a2 = a; a2.del(3, 9); ref = "8 4 6"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(0, c); ref = "6 8 4 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(2, c); ref = "8 4 6 6 7 9 3 1 5 8 5"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(10, c); ref = "8 4 6 7 9 3 1 5 8 5 6"; ASSERT_TRUE(ref == a2); a2 = a; a2.ins(3, b(0, 2)); ref = "8 4 6 7 3 5 7 9 3 1 5 8 5"; ASSERT_TRUE(ref == a2); a2 = a; a2.zeros(); ref = "0 0 0 0 0 0 0 0 0 0"; ASSERT_TRUE(ref == a2); a2 = a; a2.ones(); ref = "1 1 1 1 1 1 1 1 1 1"; ASSERT_TRUE(ref == a2); a2 = a; a2 = c; ref = "6 6 6 6 6 6 6 6 6 6"; ASSERT_TRUE(ref == a2); a2 = a; a2 = b(0, 4); ref = "7 3 5 3 6"; ASSERT_TRUE(ref == a2); a2 = a; a2 = b.T(); ref = "7 3 5 3 6 2 8 8 4 2"; ASSERT_TRUE(ref == a2); a2 = a; a2 = b.T().T(); ref = "7 3 5 3 6 2 8 8 4 2"; ASSERT_TRUE(ref == a2); } void common_operators(const vec &a, const vec &b, double c) { vec a2 = a; vec x1; vec b2 = b; vec x2; vec ref = "0.444997 1.38884 1.04291 0.566956 0.729646 0.74925 0.732926 0.331245 0.85397 1.83142"; assert_vec(ref, a + b); assert_vec((a + c), (c + a)); a2 += b; assert_vec(ref, a2); a2 = a; a2 += c; ref = "1.10195 1.41587 1.20924 1.01898 1.45767 1.44645 1.52906 1.11209 1.22129 1.76434"; assert_vec(ref, a2); ref = "0.0776177 -0.238389 -0.305723 -0.210277 0.504406 0.462364 0.643916 0.211661 -0.0926674 0.0159702"; assert_vec(ref, a - b); ref = "-0.579334 -0.265414 -0.472048 -0.662302 -0.223616 -0.234835 -0.152221 -0.569189 -0.459991 0.0830525"; assert_vec(ref, a - c); ref = -ref; assert_vec(ref, c - a); a2 = a; a2 -= b; ref = "0.0776177 -0.238389 -0.305723 -0.210277 0.504406 0.462364 0.643916 0.211661 -0.0926674 0.0159702"; assert_vec(ref, a2); a2 = a; a2 -= c; ref = "-0.579334 -0.265414 -0.472048 -0.662302 -0.223616 -0.234835 -0.152221 -0.569189 -0.459991 0.0830525"; assert_vec(ref, a2); ref = "-0.261307 -0.575228 -0.368593 -0.17834 -0.617026 -0.605807 -0.688421 -0.271453 -0.380651 -0.923694"; assert_vec(ref, -a); ASSERT_NEAR(2.05575, a * b, tol); ASSERT_NEAR(2.05575, dot(a, b), tol); mat ref_m = "0.0479994 0.212604 0.176204 0.101548 0.0294284 0.0374828 0.0116294 0.0156241 0.123682 0.237195;" "0.105663 0.468015 0.387886 0.223543 0.0647821 0.0825125 0.0256003 0.0343942 0.272266 0.522148;" "0.0677068 0.299894 0.248549 0.143241 0.041511 0.0528722 0.0164041 0.022039 0.174462 0.334581;" "0.0327592 0.1451 0.120258 0.0693058 0.0200846 0.0255816 0.00793693 0.0106633 0.0844115 0.161883;" "0.113341 0.502023 0.416071 0.239787 0.0694895 0.0885082 0.0274605 0.0368934 0.29205 0.56009;" "0.11128 0.492895 0.408506 0.235427 0.068226 0.0868989 0.0269612 0.0362225 0.28674 0.549906;" "0.126456 0.560111 0.464214 0.267532 0.0775299 0.0987493 0.0306379 0.0411622 0.325842 0.624896;" "0.0498631 0.220859 0.183045 0.105491 0.030571 0.0389381 0.0120809 0.0162308 0.128484 0.246404;" "0.0699217 0.309704 0.256679 0.147927 0.0428689 0.0546018 0.0169407 0.02276 0.180169 0.345526;" "0.169673 0.751533 0.622863 0.358963 0.104026 0.132498 0.0411086 0.0552297 0.437202 0.838459"; assert_mat(ref_m, outer_product(a, b)); ASSERT_TRUE(a * c == c * a); a2 = a; a2 *= c; ASSERT_TRUE(a * c == a2); ref = "0.0479994 0.468015 0.248549 0.0693058 0.0694895 0.0868989 0.0306379 0.0162308 0.180169 0.838459"; assert_vec(ref, elem_mult(a, b)); elem_mult_out(a, b, x1); ref = "0.0479994 0.468015 0.248549 0.0693058 0.0694895 0.0868989 0.0306379 0.0162308 0.180169 0.838459"; assert_vec(ref, x1); elem_mult_inplace(a, b2); ref = "0.0479994 0.468015 0.248549 0.0693058 0.0694895 0.0868989 0.0306379 0.0162308 0.180169 0.838459"; assert_vec(ref, b2); ASSERT_NEAR(2.05575, elem_mult_sum(a, b), tol); ref = "0.310843 0.684272 0.438467 0.212147 0.733994 0.720648 0.818923 0.322911 0.45281 1.0988"; assert_vec(ref, a / c); ref = "3.21706 1.46141 2.28067 4.71371 1.36241 1.38764 1.22112 3.09683 2.20843 0.910087"; assert_vec(ref, c / a); a2 = a; a2 /= c; ref = "0.310843 0.684272 0.438467 0.212147 0.733994 0.720648 0.818923 0.322911 0.45281 1.0988"; assert_vec(ref, a2); a2 = a; a2 /= b; ref = "1.42255 0.707001 0.546618 0.45891 5.47884 4.22332 15.4686 4.53993 0.804218 1.01759"; assert_vec(ref, a2); assert_vec(ref, elem_div(a, b)); ref = "1.42255 0.707001 0.546618 0.45891 5.47884 4.22332 15.4686 4.53993 0.804218 1.01759"; elem_div_out(a, b, x2); assert_vec(ref, x2); ASSERT_NEAR(34.6675, elem_div_sum(a, b), tol); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 " "0.813617 0.674317 0.388616 0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724"; assert_vec(ref, concat(a, b)); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.840642"; assert_vec(ref, concat(a, c)); ref = "0.840642 0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, concat(c, a)); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 " "0.813617 0.674317 0.388616 0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724 0.261307 0.575228 " "0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, concat(a, b, a)); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 " "0.813617 0.674317 0.388616 0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724 0.261307 0.575228 " "0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 0.813617 0.674317 0.388616 " "0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724"; assert_vec(ref, concat(a, b, a, b)); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 " "0.813617 0.674317 0.388616 0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724 0.261307 0.575228 " "0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 0.813617 0.674317 0.388616 " "0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724 0.261307 0.575228 0.368593 0.17834 0.617026 " "0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, concat(a, b, a, b, a)); ref_m = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_mat(ref_m, a.T()); assert_mat(ref_m, a.H()); ASSERT_TRUE(10 == a.size()); a2 = a; a2.set_size(a2.size() + 3, true); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0 0 0"; assert_vec(ref, a2); a2.set_size(a2.size() - 6, true); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421"; assert_vec(ref, a2); ASSERT_NEAR(0.605807, a(5), tol); ASSERT_NEAR(0.605807, a.get(5), tol); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807"; assert_vec(ref, a(0, 5)); assert_vec(ref, a.get(0, 5)); ref = "0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, a(6, -1)); ivec idx_list = "0 5 6 7"; ref = "0.261307 0.605807 0.688421 0.271453"; assert_vec(ref, a(idx_list)); assert_vec(ref, a.get(idx_list)); bvec bin_list = "1 0 0 0 0 1 1 1 0 0"; ref = "0.261307 0.605807 0.688421 0.271453"; assert_vec(ref, a(bin_list)); assert_vec(ref, a.get(bin_list)); ref = "0.271453 0.380651 0.923694"; assert_vec(ref, a.right(3)); ref = "0.261307 0.575228 0.368593 0.17834"; assert_vec(ref, a.left(4)); ref = "0.17834 0.617026"; assert_vec(ref, a.mid(3, 2)); a2 = a; ASSERT_TRUE(0 == a2.split(0).length()); a2 = a; assert_vec(a, a2.split(a2.size())); ASSERT_TRUE(0 == a2.length()); a2 = a; ref = "0.261307 0.575228 0.368593 0.17834"; assert_vec(ref, a2.split(4)); ref = "0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2(5) = a(6); ref = "0.617026 0.605807 0.688421 0.271453 0.380651 0.688421"; assert_vec(ref, a2); a2 = a; a2.shift_left(c, 2); ref = "0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.840642 0.840642"; assert_vec(ref, a2); a2 = a; a2.shift_right(c); ref = "0.840642 0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651"; assert_vec(ref, a2); a2 = a; a2.shift_left(b.mid(0, 2)); ref = "0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.18369 0.813617"; assert_vec(ref, a2); a2 = a; a2.shift_right(b.right(5)); ref = "0.143443 0.0445045 0.0597922 0.473318 0.907724 0.261307 0.575228 0.368593 0.17834 0.617026"; assert_vec(ref, a2); a2 = a; a2.set_subvector(0, b); ref = "0.18369 0.813617 0.674317 0.388616 0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724"; assert_vec(ref, a2); a2 = a; a2.set_subvector(4, b(3, 5)); ref = "0.261307 0.575228 0.368593 0.17834 0.388616 0.11262 0.143443 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2 = a; a2.replace_mid(4, b(3, 5)); ref = "0.261307 0.575228 0.368593 0.17834 0.388616 0.11262 0.143443 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2 = a; a2.del(6); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2 = a; a2.del(3, 9); ref = "0.261307 0.575228 0.368593"; assert_vec(ref, a2); a2 = a; a2.ins(0, c); ref = "0.840642 0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2 = a; a2.ins(2, c); ref = "0.261307 0.575228 0.840642 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2 = a; a2.ins(10, c); ref = "0.261307 0.575228 0.368593 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694 0.840642"; assert_vec(ref, a2); a2 = a; a2.ins(3, b(0, 2)); ref = "0.261307 0.575228 0.368593 0.18369 0.813617 0.674317 0.17834 0.617026 0.605807 0.688421 0.271453 0.380651 0.923694"; assert_vec(ref, a2); a2 = a; a2.zeros(); ref = "0 0 0 0 0 0 0 0 0 0"; assert_vec(ref, a2); a2 = a; a2.ones(); ref = "1 1 1 1 1 1 1 1 1 1"; assert_vec(ref, a2); a2 = a; a2 = c; ref = "0.840642 0.840642 0.840642 0.840642 0.840642 0.840642 0.840642 0.840642 0.840642 0.840642"; assert_vec(ref, a2); a2 = a; a2 = b(0, 4); ref = "0.18369 0.813617 0.674317 0.388616 0.11262"; assert_vec(ref, a2); a2 = a; a2 = b.T(); ref = "0.18369 0.813617 0.674317 0.388616 0.11262 0.143443 0.0445045 0.0597922 0.473318 0.907724"; assert_vec(ref, a2); a2 = a; a2 = b.T().T(); assert_vec(ref, a2); } void common_operators(const cvec &a, const cvec &b, complex c) { cvec a2 = a; cvec x1; cvec b2 = b; cvec x2; cvec ref = "-0.868942-0.457227i 0.449875-0.969414i 0.0252512+1.74683i -0.8595-2.69579i 0.96306-0.65313i " "0.505363-0.555045i -0.388457-0.827127i -0.804482+0.173017i -1.72448+0.367115i 0.837401+0.282386i"; assert_cvec(ref, a + b); assert_cvec((a + c), (c + a)); a2 += b; assert_cvec(ref, a2); a2 = a; a2 += c; ref = "-0.779698+0.528737i -0.421426+0.0486936i -1.43411+2.73273i -0.0208198-0.188316i -0.367156+1.54651i " "0.198414+1.18689i -1.02644+0.93711i -1.23285+1.59869i -1.23005+1.19476i -0.016846+1.03072i"; assert_cvec(ref, a2); ref = "0.250684-0.7905i -0.351589-1.2384i -1.95234+1.41343i 1.759+0.0139543i -0.756234+1.44096i " "0.832603+0.623633i -0.723294+0.396147i -0.720078+0.719172i 0.205516-0.282798i 0.0700463-0.526148i"; assert_cvec(ref, a - b); ref = "0.16144-1.77646i 0.519713-2.25651i -0.492974+0.427534i 0.920319-2.49352i 0.573983-0.758688i " "1.13955-1.11831i -0.085306-1.36809i -0.29171-0.706505i -0.28891-1.11044i 0.924293-1.27448i"; assert_cvec(ref, a - c); ref = -ref; assert_cvec(ref, c - a); a2 = a; a2 -= b; ref = "0.250684-0.7905i -0.351589-1.2384i -1.95234+1.41343i 1.759+0.0139543i -0.756234+1.44096i " "0.832603+0.623633i -0.723294+0.396147i -0.720078+0.719172i 0.205516-0.282798i 0.0700463-0.526148i"; assert_cvec(ref, a2); a2 = a; a2 -= c; ref = "0.16144-1.77646i 0.519713-2.25651i -0.492974+0.427534i 0.920319-2.49352i 0.573983-0.758688i " "1.13955-1.11831i -0.085306-1.36809i -0.29171-0.706505i -0.28891-1.11044i 0.924293-1.27448i"; assert_cvec(ref, a2); ref = "0.309129+0.623863i -0.0491432+1.10391i 0.963544-1.58013i -0.44975+1.34092i -0.103413-0.393913i " "-0.668983-0.034294i 0.555875+0.21549i 0.76228-0.446095i 0.75948-0.0421585i -0.453723+0.121881i"; assert_cvec(ref, -a); complex act = a * b; ASSERT_NEAR(-1.89282, act.real(), tol); ASSERT_NEAR(2.58293, act.imag(), tol); act = dot(a, b); ASSERT_NEAR(-1.89282, act.real(), tol); ASSERT_NEAR(2.58293, act.imag(), tol); cmat ref_m = "0.277013+0.297734i -0.0399727-0.291577i -0.201667-0.668405i -0.440527+1.23562i " "-0.918953-0.212631i -0.317087+0.284258i -0.433332+0.0846286i -0.157317+0.110744i 0.501037+0.501572i 0.133602-0.364333i;" "0.15644+0.62617i 0.168161-0.435761i 0.232614-1.08334i -1.55999+1.37871i -1.11359-1.00042i " "-0.658616+0.151659i -0.666962-0.214872i -0.303526+0.0331671i 0.311299+1.08123i 0.465128-0.403677i;" "0.276096-1.04514i -0.598639+0.50362i -1.21616+1.4018i 3.4024-0.763313i 0.82616+2.36723i 1.08889+0.309313i " "0.805153+0.853882i 0.472162+0.196437i 0.416341-1.83793i -1.00849+0.216732i;" "-0.0283301+0.825607i 0.360573-0.47686i 0.668242-1.25092i -2.4056+1.14624i -1.01737-1.62362i " "-0.863842-0.0456547i -0.744858-0.499577i -0.385154-0.0662272i 0.001733+1.44013i 0.714647-0.33266i;" "-0.123532-0.203285i -0.0115374+0.171762i 0.0365891+0.406738i 0.398307-0.655842i 0.501342+0.230348i " "0.215228-0.125397i 0.258245+0.00269673i 0.103204-0.0448637i -0.227798-0.346519i -0.119569+0.192942i;" "-0.38022+0.0922787i 0.26347+0.103716i 0.65577+0.14543i -0.829402-0.951285i 0.610996-0.670973i " "-0.089248-0.399869i 0.132975-0.403433i -0.0188674-0.184131i -0.65671+0.184297i 0.24281+0.283606i;" "0.347095+0.0280051i -0.193775-0.161115i -0.513724-0.30574i 0.435819+1.03527i -0.703484+0.39678i " "-0.0360446+0.362858i -0.224865+0.303917i -0.0353865+0.160891i 0.606442+0.0273118i -0.126161-0.307401i;" "0.352398-0.376753i -0.365466+0.0762432i -0.828102+0.314024i 1.60242+0.448741i -0.188211+1.18162i " "0.387625+0.376251i 0.145229+0.540923i 0.153988+0.189335i 0.590635-0.678187i -0.472811-0.137008i;" "0.418141-0.150158i -0.310018-0.0852504i -0.757998-0.0849196i 1.05147+0.973801i -0.608743+0.831449i " "0.149112+0.440693i -0.101365+0.471584i 0.043564+0.205618i 0.719195-0.287481i -0.308438-0.290857i;" "-0.23369+0.143838i 0.198214+0.0121808i 0.468957-0.0448797i -0.759171-0.455163i 0.262427-0.579843i " "-0.146068-0.247455i 0.00141441-0.297919i -0.0524311-0.118758i -0.398235+0.265055i 0.223356+0.136662i"; assert_cmat(ref_m, outer_product(a, b)); ASSERT_TRUE((a * c) == (c * a)); a2 = a; a2 *= c; assert_cvec(a*c, a2); ref = "0.277013+0.297734i 0.168161-0.435761i -1.21616+1.4018i -2.4056+1.14624i 0.501342+0.230348i " "-0.089248-0.399869i -0.224865+0.303917i 0.153988+0.189335i 0.719195-0.287481i 0.223356+0.136662i"; assert_cvec(ref, elem_mult(a, b)); elem_mult_out(a, b, x1); ref = "0.277013+0.297734i 0.168161-0.435761i -1.21616+1.4018i -2.4056+1.14624i 0.501342+0.230348i " "-0.089248-0.399869i -0.224865+0.303917i 0.153988+0.189335i 0.719195-0.287481i 0.223356+0.136662i"; assert_cvec(ref, x1); elem_mult_inplace(a, b2); ref = "0.277013+0.297734i 0.168161-0.435761i -1.21616+1.4018i -2.4056+1.14624i 0.501342+0.230348i " "-0.089248-0.399869i -0.224865+0.303917i 0.153988+0.189335i 0.719195-0.287481i 0.223356+0.136662i"; assert_cvec(ref, b2); act = elem_mult_sum(a, b); ASSERT_NEAR(-1.89282, act.real(), tol); ASSERT_NEAR(2.58293, act.imag(), tol); ref = "-0.370082+0.419294i -0.83584+0.29861i 1.46761+0.236797i -1.13372+0.072657i 0.261536-0.196498i " "-0.177606-0.507901i 0.00851914+0.478801i 0.563173+0.431431i 0.261936+0.551988i -0.228391-0.300407i"; assert_cvec(ref, a / c); ref = "-1.18325-1.34059i -1.06098-0.379044i 0.664093-0.107151i -0.878444-0.0562971i 2.44397+1.83622i " "-0.613476+1.75436i 0.037149-2.08789i 1.11897-0.857211i 0.701675-1.47867i -1.60379+2.1095i"; assert_cvec(ref, c / a); a2 = a; a2 /= c; ref = "-0.370082+0.419294i -0.83584+0.29861i 1.46761+0.236797i -1.13372+0.072657i 0.261536-0.196498i " "-0.177606-0.507901i 0.00851914+0.478801i 0.563173+0.431431i 0.261936+0.551988i -0.228391-0.300407i"; assert_cvec(ref, a2); a2 = a; a2 /= b; ref = "0.202534+1.1747i -0.720721-2.51284i -0.685564+1.71362i 0.345915+0.666218i -0.17629+0.243506i " "-0.346625+1.03891i 0.0963326-0.935201i -1.17415-2.9729i 0.720086+0.198797i 0.401786-0.741014i"; assert_cvec(ref, a2); assert_cvec(ref, elem_div(a, b)); ref = "0.202534+1.1747i -0.720721-2.51284i -0.685564+1.71362i 0.345915+0.666218i -0.17629+0.243506i " "-0.346625+1.03891i 0.0963326-0.935201i -1.17415-2.9729i 0.720086+0.198797i 0.401786-0.741014i"; elem_div_out(a, b, x2); assert_cvec(ref, x2); act = elem_div_sum(a, b); ASSERT_NEAR(-1.33669, act.real(), tol); ASSERT_NEAR(-2.1262, act.imag(), tol); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i " "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i"; assert_cvec(ref, concat(a, b)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i -0.470569+1.1526i"; assert_cvec(ref, concat(a, c)); ref = "-0.470569+1.1526i -0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i " "0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, concat(c, a)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i " "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i " "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, concat(a, b, a)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i " "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i " "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i " "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i"; assert_cvec(ref, concat(a, b, a, b)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i " "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i " "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i " "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i " "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, concat(a, b, a, b, a)); ref_m = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cmat(ref_m, a.T()); ref_m = "-0.309129+0.623863i 0.0491432+1.10391i -0.963544-1.58013i 0.44975+1.34092i 0.103413-0.393913i " "0.668983-0.034294i -0.555875+0.21549i -0.76228-0.446095i -0.75948-0.0421585i 0.453723+0.121881i"; assert_cmat(ref_m, a.H()); ASSERT_TRUE(10 == a.size()); a2 = a; a2.set_size(a2.size() + 3, true); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i 0+0i 0+0i 0+0i"; assert_cvec(ref, a2); a2.set_size(a2.size() - 6, true); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i"; assert_cvec(ref, a2); ASSERT_NEAR(0.668983, a(5).real(), tol); ASSERT_NEAR(0.034294, a(5).imag(), tol); ASSERT_NEAR(0.668983, a.get(5).real(), tol); ASSERT_NEAR(0.034294, a.get(5).imag(), tol); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i 0.668983+0.034294i"; assert_cvec(ref, a(0, 5)); assert_cvec(ref, a.get(0, 5)); ref = "-0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a(6, -1)); ivec idx_list = "0 5 6 7"; ref = "-0.309129-0.623863i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i"; assert_cvec(ref, a(idx_list)); assert_cvec(ref, a.get(idx_list)); bvec bin_list = "1 0 0 0 0 1 1 1 0 0"; ref = "-0.309129-0.623863i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i"; assert_cvec(ref, a(bin_list)); assert_cvec(ref, a.get(bin_list)); ref = "-0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a.right(3)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i"; assert_cvec(ref, a.left(4)); ref = "0.44975-1.34092i 0.103413+0.393913i"; assert_cvec(ref, a.mid(3, 2)); a2 = a; ASSERT_TRUE(0 == a2.split(0).length()); a2 = a; assert_cvec(a, a2.split(a2.size())); ASSERT_TRUE(0 == a2.length()); a2 = a; ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i"; assert_cvec(ref, a2.split(4)); ref = "0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2(5) = a(6); ref = "0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i -0.555875-0.21549i"; assert_cvec(ref, a2); a2 = a; a2.shift_left(c, 2); ref = "-0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i " "-0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i -0.470569+1.1526i -0.470569+1.1526i"; assert_cvec(ref, a2); a2 = a; a2.shift_right(c); ref = "-0.470569+1.1526i -0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i " "0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i"; assert_cvec(ref, a2); a2 = a; a2.shift_left(b.mid(0, 2)); ref = "-0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i " "-0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i -0.559813+0.166636i 0.400732+0.134493i"; assert_cvec(ref, a2); a2 = a; a2.shift_right(b.right(5)); ref = "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i " "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i"; assert_cvec(ref, a2); a2 = a; a2.set_subvector(0, b); ref = "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i"; assert_cvec(ref, a2); a2 = a; a2.set_subvector(4, b(3, 5)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i -1.30925-1.35487i " "0.859647-1.04704i -0.16362-0.589339i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2 = a; a2.replace_mid(4, b(3, 5)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i -1.30925-1.35487i " "0.859647-1.04704i -0.16362-0.589339i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2 = a; a2.del(6); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2 = a; a2.del(3, 9); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i"; assert_cvec(ref, a2); a2 = a; a2.ins(0, c); ref = "-0.470569+1.1526i -0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i " "0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2 = a; a2.ins(2, c); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.470569+1.1526i -0.963544+1.58013i 0.44975-1.34092i " "0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2 = a; a2.ins(10, c); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i 0.44975-1.34092i 0.103413+0.393913i " "0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i -0.75948+0.0421585i 0.453723-0.121881i -0.470569+1.1526i"; assert_cvec(ref, a2); a2 = a; a2.ins(3, b(0, 2)); ref = "-0.309129-0.623863i 0.0491432-1.10391i -0.963544+1.58013i -0.559813+0.166636i 0.400732+0.134493i " "0.988795+0.166701i 0.44975-1.34092i 0.103413+0.393913i 0.668983+0.034294i -0.555875-0.21549i -0.76228+0.446095i " "-0.75948+0.0421585i 0.453723-0.121881i"; assert_cvec(ref, a2); a2 = a; a2.zeros(); ref = "0+0i 0+0i 0+0i 0+0i 0+0i 0+0i 0+0i 0+0i 0+0i 0+0i"; assert_cvec(ref, a2); a2 = a; a2.ones(); ref = "1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i"; assert_cvec(ref, a2); a2 = a; a2 = c; ref = "-0.470569+1.1526i -0.470569+1.1526i -0.470569+1.1526i -0.470569+1.1526i -0.470569+1.1526i " "-0.470569+1.1526i -0.470569+1.1526i -0.470569+1.1526i -0.470569+1.1526i -0.470569+1.1526i"; assert_cvec(ref, a2); a2 = a; a2 = b(0, 4); ref = "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i"; assert_cvec(ref, a2); a2 = a; a2 = b.T(); ref = "-0.559813+0.166636i 0.400732+0.134493i 0.988795+0.166701i -1.30925-1.35487i 0.859647-1.04704i " "-0.16362-0.589339i 0.167418-0.611637i -0.0422019-0.273077i -0.964996+0.324957i 0.383677+0.404267i"; assert_cvec(ref, a2); a2 = a; a2 = b.T().T(); assert_cvec(ref, a2); } void logical_operators(const bvec &a, const bvec &b, bin c) { bvec a2 = a; bvec ref = "0 0 0 0 1 0 0 1 1 0"; ASSERT_TRUE(ref == (a == c)); ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == (a != c)); ref = "0 0 0 0 1 0 0 1 1 0"; ASSERT_TRUE(ref == (a <= c)); ref = "1 1 1 1 1 1 1 1 1 1"; ASSERT_TRUE(ref == (a >= c)); ref = "0 0 0 0 0 0 0 0 0 0"; ASSERT_TRUE(ref == (a < c)); ref = "1 1 1 1 0 1 1 0 0 1"; ASSERT_TRUE(ref == (a > c)); ASSERT_FALSE(a == b); ASSERT_TRUE(a != b); ASSERT_TRUE(a2 == a); ASSERT_FALSE(a2 != a); } void logical_operators(const ivec &a, const ivec &b, int c) { ivec a2 = a; bvec ref = "0 0 1 0 0 0 0 0 0 0"; ASSERT_TRUE(ref == (a == c)); ref = "1 1 0 1 1 1 1 1 1 1"; ASSERT_TRUE(ref == (a != c)); ref = "0 1 1 0 0 1 1 1 0 1"; ASSERT_TRUE(ref == (a <= c)); ref = "1 0 1 1 1 0 0 0 1 0"; ASSERT_TRUE(ref == (a >= c)); ref = "0 1 0 0 0 1 1 1 0 1"; ASSERT_TRUE(ref == (a < c)); ref = "1 0 0 1 1 0 0 0 1 0"; ASSERT_TRUE(ref == (a > c)); ASSERT_FALSE(a == b); ASSERT_TRUE(a != b); ASSERT_TRUE(a2 == a); ASSERT_FALSE(a2 != a); } void logical_operators(const vec &a, const vec &b, double c) { vec a2 = a; bvec ref = "0 0 0 0 0 0 0 0 0 0"; ASSERT_TRUE(ref == (a == c)); ref = "1 1 1 1 1 1 1 1 1 1"; ASSERT_TRUE(ref == (a != c)); ref = "1 1 1 1 1 1 1 1 1 0"; ASSERT_TRUE(ref == (a <= c)); ref = "0 0 0 0 0 0 0 0 0 1"; ASSERT_TRUE(ref == (a >= c)); ref = "1 1 1 1 1 1 1 1 1 0"; ASSERT_TRUE(ref == (a < c)); ref = "0 0 0 0 0 0 0 0 0 1"; ASSERT_TRUE(ref == (a > c)); ASSERT_FALSE(a == b); ASSERT_TRUE(a != b); ASSERT_TRUE(a2 == a); ASSERT_FALSE(a2 != a); } TEST(Vec, All) { RNG_reset(0); // Testing Vec (bvec) bvec bv1 = randb(10); bvec bv2 = randb(10); bin bx = randb(); common_operators(bv1, bv2, bx); logical_operators(bv1, bv2, bx); // Testing Vec (ivec) ivec iv1 = randi(10, 1, 9); ivec iv2 = randi(10, 1, 9); int ix = randi(1, 9); common_operators(iv1, iv2, ix); logical_operators(iv1, iv2, ix); // Testing Vec (vec) vec dv1 = randu(10); vec dv2 = randu(10); double dx = randu(); common_operators(dv1, dv2, dx); logical_operators(dv1, dv2, dx); // Testing Vec > (cvec) cvec cv1 = randn_c(10); cvec cv2 = randn_c(10); complex cx = randn_c(); common_operators(cv1, cv2, cx); ASSERT_FALSE(any(cv1 == cx)); ASSERT_TRUE(all(cv1 != cx)); // Test vectror initialisation with string vec v = "-10.000 :.5:-4.5 1.33e+1, -.9, 1e0:1.5:1E+1"; vec ref = "-10.0000 -9.5000 -9.0000 -8.5000 -8.0000 -7.5000 -7.0000 -6.5000 -6.0000 -5.5000 -5.0000 " "-4.5000 13.3000 -0.9000 1.0000 2.5000 4.0000 5.5000 7.0000 8.5000 10.0000"; assert_vec(ref, v); ivec iv = "0xA :-0x1: -010"; ivec ref_i = "10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8"; ASSERT_TRUE(ref_i == iv); iv = "-5:3:9, 7, 1:10"; ref_i = "-5 -2 1 4 7 7 1 2 3 4 5 6 7 8 9 10"; ASSERT_TRUE(ref_i == iv); svec sv = "3 0xF -10, 0133 0177, 0x0 "; svec ref_s = "3 15 -10 91 127 0"; ASSERT_TRUE(ref_s == sv); cvec cv = " (0.3, 0.4) .2-.01i, 1e-3+0.25i"; cvec ref_c = "0.3000+0.4000i 0.2000-0.0100i 0.0010+0.2500i"; assert_cvec(ref_c, cv); bvec bv = "1 1 0,1 1 , 0 ,1 "; bvec ref_b = "1 1 0 1 1 0 1"; ASSERT_TRUE(ref_b == bv); // Test of rem: v = "1.0 2.0 3.4 -4.5 6.7"; double y = 0.76; ref = "0.2400 0.4800 0.3600 -0.7000 0.6200"; assert_vec(ref, rem(v, y)); ref = "0.0000 0.0000 3.2000 1.0000 3.3000"; assert_vec(ref, rem(10, v)); mat M = "1.0 2.3; 4.5 -6.7"; mat ref_m = "0.2400 0.0200; 0.7000 -0.6200"; assert_mat(ref_m, rem(M, y)); ref_m = "0.0000 0.8000; 1.0000 3.3000"; assert_mat(ref_m, rem(10, M)); // Test of all and any: bvec b1 = "0 0 0 0 0 0 0 1 0 0"; bvec b2 = "0 0 0 0 0 0 0 0 0 0"; bvec b3 = "1 1 1 1 1 1 1 1 1 1 1 1 1"; bvec b4 = "1 1 1 1 1 1 1 1 1 1 1 0 1"; ASSERT_TRUE(any(b1)); ASSERT_FALSE(any(b2)); ASSERT_TRUE(all(b3)); ASSERT_FALSE(all(b4)); } itpp-4.3.1/gtests/window_test.cpp000066400000000000000000000277361216575753400171140ustar00rootroot00000000000000/*! * \file * \brief Windowing functions test program * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger, Adam Piatyszek * and Kumar Appaiah * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include "gtest/gtest.h" using namespace itpp; static void assert_vec_p(const vec &ref, const vec &act, int line) { static const double tol = 1e-4; ASSERT_EQ(ref.length(), act.length()) << line; for (int n = 0; n < ref.length(); ++n) { ASSERT_NEAR(ref(n), act(n), tol) << line; } } #define assert_vec(ref, act) assert_vec_p(ref, act, __LINE__) TEST(Window, All) { // Test of window functions vec ref = "0.08 0.0894162 0.117279 0.162449 0.223075 0.296677 0.38024 0.470343 0.563299 0.6553 0.742581 " "0.821569 0.889029 0.942199 0.978904 0.99764 0.99764 0.978904 0.942199 0.889029 0.821569 0.742581 " "0.6553 0.563299 0.470343 0.38024 0.296677 0.223075 0.162449 0.117279 0.0894162 0.08"; assert_vec(ref, hamming(32)); ref = "0.08 0.0805628 0.08225 0.0850574 0.0889781 0.0940025 0.100118 0.107311 0.115562 0.124852 0.135157 0.146454 0.158713 0.171906 0.185999 0.200959 0.216749 0.233329 0.25066 0.268699 0.287402 0.306723 0.326615 0.347029 0.367915 0.389223 0.410899 0.432892 0.455146 0.477608 0.500223 0.522935 0.545689 0.568429 0.5911 0.613645 0.63601 0.658141 0.679982 0.70148 0.722584 0.74324 0.763399 0.783012 0.80203 0.820406 0.838097 0.855058 0.871247 0.886627 0.901158 0.914805 0.927535 0.939317 0.950121 0.959922 0.968695 0.976419 0.983075 0.988647 0.993121 0.996486 0.998734 0.999859 0.999859 0.998734 0.996486 0.993121 0.988647 0.983075 0.976419 0.968695 0.959922 0.950121 0.939317 0.927535 0.914805 0.901158 0.886627 0.871247 0.855058 0.838097 0.820406 0.80203 0.783012 0.763399 0.74324 0.722584 0.70148 0.679982 0.658141 0.63601 0.613645 0.5911 0.568429 0.545689 0.522935 0.500223 0.477608 0.455146 0.432892 0.410899 0.389223 0.367915 0.347029 0.326615 0.306723 0.287402 0.268699 0.25066 0.233329 0.216749 0.200959 0.185999 0.171906 0.158713 0.146454 0.135157 0.124852 0.115562 0.107311 0.100118 0.0940025 0.0889781 0.0850574 0.08225 0.0805628 0.08"; assert_vec(ref, hamming(128)); ref = "0.00903565 0.035816 0.0793732 0.138133 0.209972 0.292292 0.382121 0.476209 0.571157 0.663534 0.75 0.82743 0.893027 0.944418 0.979746 0.997736 0.997736 0.979746 0.944418 0.893027 0.82743 0.75 0.663534 0.571157 0.476209 0.382121 0.292292 0.209972 0.138133 0.0793732 0.035816 0.00903565"; assert_vec(ref, hanning(32)); ref = "0.000592972 0.00237048 0.00532832 0.00945946 0.0147541 0.0211997 0.028781 0.0374799 0.0472759 0.0581457 0.0700635 0.0830011 0.0969278 0.11181 0.127614 0.144301 0.161831 0.180163 0.199255 0.219059 0.23953 0.260618 0.282275 0.304448 0.327084 0.350131 0.373533 0.397236 0.421181 0.445314 0.469577 0.493912 0.518261 0.542567 0.566772 0.590818 0.61465 0.638209 0.66144 0.684289 0.7067 0.728621 0.75 0.770786 0.790929 0.810383 0.8291 0.847037 0.864151 0.880401 0.895748 0.910157 0.923593 0.936025 0.947422 0.957758 0.967008 0.975151 0.982166 0.988038 0.992752 0.996298 0.998666 0.999852 0.999852 0.998666 0.996298 0.992752 0.988038 0.982166 0.975151 0.967008 0.957758 0.947422 0.936025 0.923593 0.910157 0.895748 0.880401 0.864151 0.847037 0.8291 0.810383 0.790929 0.770786 0.75 0.728621 0.7067 0.684289 0.66144 0.638209 0.61465 0.590818 0.566772 0.542567 0.518261 0.493912 0.469577 0.445314 0.421181 0.397236 0.373533 0.350131 0.327084 0.304448 0.282275 0.260618 0.23953 0.219059 0.199255 0.180163 0.161831 0.144301 0.127614 0.11181 0.0969278 0.0830011 0.0700635 0.0581457 0.0472759 0.0374799 0.028781 0.0211997 0.0147541 0.00945946 0.00532832 0.00237048 0.000592972"; assert_vec(ref, hanning(128)); ref = "0 0.010235 0.0405211 0.0896183 0.155517 0.235518 0.326347 0.424286 0.525325 0.625326 0.720197 0.806053 0.879379 0.937173 0.97707 0.997435 0.997435 0.97707 0.937173 0.879379 0.806053 0.720197 0.625326 0.525325 0.424286 0.326347 0.235518 0.155517 0.0896183 0.0405211 0.010235 0"; assert_vec(ref, hann(32)); ref = "0 0.000611792 0.00244567 0.00549715 0.00975876 0.0152201 0.0218677 0.0296854 0.0386541 0.0487517 0.0599537 0.0722325 0.0855581 0.0998979 0.115217 0.131477 0.14864 0.166662 0.1855 0.205108 0.225437 0.246438 0.26806 0.290249 0.312952 0.336112 0.359673 0.383578 0.407768 0.432183 0.456764 0.481452 0.506184 0.530901 0.555543 0.580049 0.604359 0.628414 0.652154 0.675522 0.69846 0.720913 0.742825 0.764143 0.784815 0.804789 0.824018 0.842454 0.860052 0.876768 0.892563 0.907397 0.921234 0.93404 0.945784 0.956437 0.965973 0.974369 0.981603 0.98766 0.992523 0.99618 0.998624 0.999847 0.999847 0.998624 0.99618 0.992523 0.98766 0.981603 0.974369 0.965973 0.956437 0.945784 0.93404 0.921234 0.907397 0.892563 0.876768 0.860052 0.842454 0.824018 0.804789 0.784815 0.764143 0.742825 0.720913 0.69846 0.675522 0.652154 0.628414 0.604359 0.580049 0.555543 0.530901 0.506184 0.481452 0.456764 0.432183 0.407768 0.383578 0.359673 0.336112 0.312952 0.290249 0.26806 0.246438 0.225437 0.205108 0.1855 0.166662 0.14864 0.131477 0.115217 0.0998979 0.0855581 0.0722325 0.0599537 0.0487517 0.0386541 0.0296854 0.0218677 0.0152201 0.00975876 0.00549715 0.00244567 0.000611792 0"; assert_vec(ref, hann(128)); ref = "-1.38778e-17 0.00375165 0.0156384 0.0374027 0.0714646 0.120286 0.185647 0.267955 0.365735 0.475379 0.591229 0.706001 0.811493 0.89949 0.962731 0.995797 0.995797 0.962731 0.89949 0.811493 0.706001 0.591229 0.475379 0.365735 0.267955 0.185647 0.120286 0.0714646 0.0374027 0.0156384 0.00375165 -1.38778e-17"; assert_vec(ref, blackman(32)); ref = "-1.38778e-17 0.000220485 0.000884269 0.00199831 0.0035741 0.00562748 0.00817842 0.0112507 0.0148717 0.0190717 0.0238838 0.0293429 0.0354858 0.0423502 0.049974 0.0583951 0.0676504 0.0777751 0.0888026 0.100763 0.113683 0.127586 0.142489 0.158406 0.175343 0.193302 0.212276 0.232253 0.253212 0.275127 0.297961 0.321672 0.346209 0.371513 0.397518 0.42415 0.451329 0.478967 0.506971 0.535239 0.563668 0.592147 0.620562 0.648797 0.676731 0.704243 0.73121 0.75751 0.783019 0.807619 0.83119 0.853619 0.874794 0.89461 0.912966 0.929771 0.944936 0.958385 0.970046 0.97986 0.987773 0.993745 0.997744 0.999749 0.999749 0.997744 0.993745 0.987773 0.97986 0.970046 0.958385 0.944936 0.929771 0.912966 0.89461 0.874794 0.853619 0.83119 0.807619 0.783019 0.75751 0.73121 0.704243 0.676731 0.648797 0.620562 0.592147 0.563668 0.535239 0.506971 0.478967 0.451329 0.42415 0.397518 0.371513 0.346209 0.321672 0.297961 0.275127 0.253212 0.232253 0.212276 0.193302 0.175343 0.158406 0.142489 0.127586 0.113683 0.100763 0.0888026 0.0777751 0.0676504 0.0583951 0.049974 0.0423502 0.0354858 0.0293429 0.0238838 0.0190717 0.0148717 0.0112507 0.00817842 0.00562748 0.0035741 0.00199831 0.000884269 0.000220485 -1.38778e-17"; assert_vec(ref, blackman(128)); ref = "0.03125 0.09375 0.15625 0.21875 0.28125 0.34375 0.40625 0.46875 0.53125 0.59375 0.65625 0.71875 0.78125 0.84375 0.90625 0.96875 0.96875 0.90625 0.84375 0.78125 0.71875 0.65625 0.59375 0.53125 0.46875 0.40625 0.34375 0.28125 0.21875 0.15625 0.09375 0.03125"; assert_vec(ref, triang(32)); ref = "0.0078125 0.0234375 0.0390625 0.0546875 0.0703125 0.0859375 0.101562 0.117188 0.132812 0.148438 0.164062 0.179688 0.195312 0.210938 0.226562 0.242188 0.257812 0.273438 0.289062 0.304688 0.320312 0.335938 0.351562 0.367188 0.382812 0.398438 0.414062 0.429688 0.445312 0.460938 0.476562 0.492188 0.507812 0.523438 0.539062 0.554688 0.570312 0.585938 0.601562 0.617188 0.632812 0.648438 0.664062 0.679688 0.695312 0.710938 0.726562 0.742188 0.757812 0.773438 0.789062 0.804688 0.820312 0.835938 0.851562 0.867188 0.882812 0.898438 0.914062 0.929688 0.945312 0.960938 0.976562 0.992188 0.992188 0.976562 0.960938 0.945312 0.929688 0.914062 0.898438 0.882812 0.867188 0.851562 0.835938 0.820312 0.804688 0.789062 0.773438 0.757812 0.742188 0.726562 0.710938 0.695312 0.679688 0.664062 0.648438 0.632812 0.617188 0.601562 0.585938 0.570312 0.554688 0.539062 0.523438 0.507812 0.492188 0.476562 0.460938 0.445312 0.429688 0.414062 0.398438 0.382812 0.367188 0.351562 0.335938 0.320312 0.304688 0.289062 0.273438 0.257812 0.242188 0.226562 0.210938 0.195312 0.179688 0.164062 0.148438 0.132812 0.117188 0.101562 0.0859375 0.0703125 0.0546875 0.0390625 0.0234375 0.0078125"; assert_vec(ref, triang(128)); ref = "0.0506644 0.0660694 0.10498 0.15479 0.215657 0.287019 0.367536 0.455085 0.546825 0.639332 0.728786 0.811205 0.882711 0.939797 0.979577 1 1 0.979577 0.939797 0.882711 0.811205 0.728786 0.639332 0.546825 0.455085 0.367536 0.287019 0.215657 0.15479 0.10498 0.0660694 0.0506644"; assert_vec(ref, chebwin(32, 50)); ref = "1.56678 0.436121 0.491129 0.546501 0.601556 0.655594 0.707906 0.757788 0.804557 0.847559 0.886183 0.919874 0.948143 0.970576 0.986841 0.996698 1 0.996698 0.986841 0.970576 0.948143 0.919874 0.886183 0.847559 0.804557 0.757788 0.707906 0.655594 0.601556 0.546501 0.491129 0.436121 1.56678"; assert_vec(ref, chebwin(33, 20)); ref = "2.80628 0.283796 0.297805 0.312035 0.326476 0.341115 0.35594 0.370939 0.386096 0.401399 0.416834 0.432385 0.448038 0.463778 0.479588 0.495453 0.511356 0.527281 0.543212 0.55913 0.57502 0.590863 0.606643 0.622342 0.637942 0.653425 0.668774 0.683972 0.699 0.713841 0.728478 0.742894 0.75707 0.770991 0.784639 0.797997 0.811051 0.823783 0.836177 0.84822 0.859895 0.871188 0.882084 0.892571 0.902636 0.912264 0.921444 0.930165 0.938415 0.946184 0.953461 0.960238 0.966505 0.972255 0.97748 0.982174 0.98633 0.989942 0.993007 0.99552 0.997478 0.998879 0.99972 1 0.99972 0.998879 0.997478 0.99552 0.993007 0.989942 0.98633 0.982174 0.97748 0.972255 0.966505 0.960238 0.953461 0.946184 0.938415 0.930165 0.921444 0.912264 0.902636 0.892571 0.882084 0.871188 0.859895 0.84822 0.836177 0.823783 0.811051 0.797997 0.784639 0.770991 0.75707 0.742894 0.728478 0.713841 0.699 0.683972 0.668774 0.653425 0.637942 0.622342 0.606643 0.590863 0.57502 0.55913 0.543212 0.527281 0.511356 0.495453 0.479588 0.463778 0.448038 0.432385 0.416834 0.401399 0.386096 0.370939 0.35594 0.341115 0.326476 0.312035 0.297805 0.283796 2.80628"; assert_vec(ref, chebwin(127, 25)); ref = "2.82761 0.283705 0.297601 0.311716 0.326039 0.340557 0.355259 0.370131 0.385162 0.400336 0.415641 0.431062 0.446584 0.462193 0.477873 0.493609 0.509385 0.525184 0.54099 0.556787 0.572558 0.588287 0.603955 0.619547 0.635045 0.650431 0.665689 0.6808 0.695749 0.710518 0.725089 0.739446 0.753573 0.767451 0.781066 0.7944 0.807438 0.820163 0.832562 0.844618 0.856317 0.867644 0.878586 0.889128 0.899259 0.908965 0.918235 0.927056 0.935417 0.943309 0.950721 0.957643 0.964068 0.969986 0.975391 0.980275 0.984632 0.988457 0.991744 0.99449 0.996691 0.998345 0.999448 1 1 0.999448 0.998345 0.996691 0.99449 0.991744 0.988457 0.984632 0.980275 0.975391 0.969986 0.964068 0.957643 0.950721 0.943309 0.935417 0.927056 0.918235 0.908965 0.899259 0.889128 0.878586 0.867644 0.856317 0.844618 0.832562 0.820163 0.807438 0.7944 0.781066 0.767451 0.753573 0.739446 0.725089 0.710518 0.695749 0.6808 0.665689 0.650431 0.635045 0.619547 0.603955 0.588287 0.572558 0.556787 0.54099 0.525184 0.509385 0.493609 0.477873 0.462193 0.446584 0.431062 0.415641 0.400336 0.385162 0.370131 0.355259 0.340557 0.326039 0.311716 0.297601 0.283705 2.82761"; assert_vec(ref, chebwin(128, 25)); } itpp-4.3.1/itpp-config.1.cmake.in000066400000000000000000000041771216575753400165100ustar00rootroot00000000000000.TH "itpp-config" 1 "@PACKAGE_DATE@" "IT++ @PACKAGE_VERSION@" .SH NAME .P itpp\-config \- script to get information about intalled IT++ library prefix, compiler flags and its version .SH SYNOPSIS .P \fBitpp\-config\fR [\-\-prefix] [\-\-exec\-prefix] [\-\-debug] [\-\-static] [\-\-cflags] [\-\-libs] [\-\-help] [\-\-version] .SH DESCRIPTION .P \fIitpp\-config\fR is a tool that can be used to determine the compiler and linker flags required for compiling and linking programs that use IT++. It can be also used for checking the intalled libitpp library version. .SH OPTIONS .P \fIitpp\-config\fR accepts the following options: .TP \fB\-\-prefix\fR output libitpp installation prefix .TP \fB\-\-exec\-prefix\fR output libitpp installation exec prefix .TP \fB\-\-debug\fR use debugging pre\-processor, compiler and linker flags (needs to be used in front of \fB\-\-cflags\fR and \fB\-\-libs\fR) .TP \fB\-\-static\fR use static linker flags (needs to be used in front of \fB\-\-libs\fR) .TP \fB\-\-cflags\fR output pre\-processor and compiler flags .TP \fB\-\-libs\fR output linker flags .TP \fB\-\-help\fR display brief help and exit .TP \fB\-\-version\fR output version number .SH AUTHOR .P This manual page was written by Adam Piatyszek as a text file, then converted to man format by txt2tags. .SH COPYRIGHT .P Copyright (C) 1995\-2013 (see AUTHORS file for a list of contributors) .P This file is part of IT++ \- a C++ library of mathematical, signal processing, speech processing, and communications classes and functions. .P IT++ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. .P IT++ 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 General Public License for more details. .P You should have received a copy of the GNU General Public License along with IT++. If not, see . itpp-4.3.1/itpp-config.1.in000066400000000000000000000041771216575753400154310ustar00rootroot00000000000000.TH "itpp-config" 1 "@PACKAGE_DATE@" "IT++ @PACKAGE_VERSION@" .SH NAME .P itpp\-config \- script to get information about intalled IT++ library prefix, compiler flags and its version .SH SYNOPSIS .P \fBitpp\-config\fR [\-\-prefix] [\-\-exec\-prefix] [\-\-debug] [\-\-static] [\-\-cflags] [\-\-libs] [\-\-help] [\-\-version] .SH DESCRIPTION .P \fIitpp\-config\fR is a tool that can be used to determine the compiler and linker flags required for compiling and linking programs that use IT++. It can be also used for checking the intalled libitpp library version. .SH OPTIONS .P \fIitpp\-config\fR accepts the following options: .TP \fB\-\-prefix\fR output libitpp installation prefix .TP \fB\-\-exec\-prefix\fR output libitpp installation exec prefix .TP \fB\-\-debug\fR use debugging pre\-processor, compiler and linker flags (needs to be used in front of \fB\-\-cflags\fR and \fB\-\-libs\fR) .TP \fB\-\-static\fR use static linker flags (needs to be used in front of \fB\-\-libs\fR) .TP \fB\-\-cflags\fR output pre\-processor and compiler flags .TP \fB\-\-libs\fR output linker flags .TP \fB\-\-help\fR display brief help and exit .TP \fB\-\-version\fR output version number .SH AUTHOR .P This manual page was written by Adam Piatyszek as a text file, then converted to man format by txt2tags. .SH COPYRIGHT .P Copyright (C) 1995\-2010 (see AUTHORS file for a list of contributors) .P This file is part of IT++ \- a C++ library of mathematical, signal processing, speech processing, and communications classes and functions. .P IT++ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. .P IT++ 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 General Public License for more details. .P You should have received a copy of the GNU General Public License along with IT++. If not, see . itpp-4.3.1/itpp-config.cmake.in000066400000000000000000000043161216575753400163440ustar00rootroot00000000000000#!/bin/sh prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include debug_flag=no static_flag=no flags="" usage() { cat < BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prereq: /sbin/ldconfig #BuildRequires: fftw-devel %description IT++ is a C++ library of mathematical, signal processing, speech processing, and communications classes and functions. The kernel of the IT++ library is built upon templated vector and matrix classes with many functions for their manipulation. Such a kernel makes IT++ similar to Octave. IT++ makes extensive use of existing open-source libraries (but not only) for increased functionality, speed, and accuracy. %package doc Summary: HTML documentation for itpp Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} %description doc This package contains the IT++ reference documentation in the HTML format. %prep %setup -q %build %configure --with-docdir=%{_docdir}/%{name}-%{version} make %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version} cp -p AUTHORS ChangeLog ChangeLog-2005 ChangeLog-2006 INSTALL NEWS \ NEWS-3.10 NEWS-3.9 NEWS-3.99 README \ $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version} %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %post /sbin/ldconfig %postun /sbin/ldconfig %files %defattr(-,root,root,-) %{_docdir}/%{name}-%{version}/[A-Z]* %{_libdir}/*.la %{_libdir}/*.a %{_libdir}/*.so %{_libdir}/*.so.* %{_libdir}/pkgconfig/%{name}.pc %{_bindir}/%{name}-config %{_includedir}/%{name} %{_datadir}/%{name} %files doc %defattr(-,root,root,-) %{_docdir}/%{name}-%{version}/html %changelog * Tue Apr 4 2007 Adam Piatyszek - Minor cleanups and changes according to the latest itpp.spec from Fedora Extras * Mon Feb 13 2006 Adam Piatyszek - Created subpackage itpp-html-doc with HTML documentation * Fri Feb 10 2006 Adam Piatyszek - Added missing *.a and *.m files * Thu Feb 09 2006 Adam Piatyszek - Changes in Name, Version and Release definitions - Removed distribution dependent release settings - Added DESTDIR to make install command * Wed Dec 28 2005 Adam Piatyszek - Fixed name and version definitions - Added itpp-config in %files section * Fri Dec 23 2005 Adam Piatyszek - Initial spec file prepared itpp-4.3.1/itpp/000077500000000000000000000000001216575753400134665ustar00rootroot00000000000000itpp-4.3.1/itpp/CMakeLists.txt000066400000000000000000000105001216575753400162220ustar00rootroot00000000000000# # \file CMakeLists.txt # \brief cmake configuration file for generating IT++ library # \author Bogdan Cristea # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- file ( GLOB ITPP_SRCS "base/*.cpp" "base/algebra/*.cpp" "base/bessel/*.cpp" "base/math/*.cpp" "comm/*.cpp" "fixed/*.cpp" "optim/*.cpp" "protocol/*.cpp" "signal/*.cpp" "srccode/*.cpp" "stat/*.cpp" ) include_directories ( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${BLAS_INCLUDES} ${LAPACK_INCLUDES} ${FFT_INCLUDES} ) if (ITPP_SHARED_LIB) add_library (${libitpp_target} SHARED ${ITPP_SRCS}) else() add_library (${libitpp_target} STATIC ${ITPP_SRCS}) endif() #remove duplicates in external libraries list if (ITPP_LIBS) list(REMOVE_DUPLICATES ITPP_LIBS) endif() target_link_libraries (${libitpp_target} ${ITPP_LIBS}) set(LIBITPP_VERSION_MAJOR 8) set(LIBITPP_VERSION_MINOR 2) set(LIBITPP_VERSION_PATCH 1) set(LIBITPP_VERSION_STRING ${LIBITPP_VERSION_MAJOR}.${LIBITPP_VERSION_MINOR}.${LIBITPP_VERSION_PATCH}) set_target_properties(${libitpp_target} PROPERTIES VERSION ${LIBITPP_VERSION_STRING} SOVERSION ${LIBITPP_VERSION_MAJOR}) #library install(TARGETS ${libitpp_target} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) #headers install(DIRECTORY ${CMAKE_SOURCE_DIR}/itpp DESTINATION include FILES_MATCHING PATTERN "*.h") if (WIN32 AND NOT MINGW) install(FILES ${CMAKE_BINARY_DIR}/itpp/config_msvc.h DESTINATION include/itpp) else() install(FILES ${CMAKE_BINARY_DIR}/itpp/config.h DESTINATION include/itpp) endif() install(FILES ${CMAKE_BINARY_DIR}/itpp/itexports.h DESTINATION include/itpp) #extra files (MATLAB and python) install(FILES ${CMAKE_SOURCE_DIR}/extras/itsave.m ${CMAKE_SOURCE_DIR}/extras/itload.m ${CMAKE_SOURCE_DIR}/extras/pyitpp.py DESTINATION share/itpp) #html help if (HTML_DOCS AND DOXYGEN_FOUND) configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen_html.cfg.cmake.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY) configure_file(${CMAKE_SOURCE_DIR}/doc/local/index.doc.in ${CMAKE_BINARY_DIR}/doc/local/index.doc @ONLY) #make sure that this target is executed last add_custom_target(itpp_doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) file(COPY ${CMAKE_SOURCE_DIR}/doc/images/itpp_logo.png DESTINATION ${CMAKE_BINARY_DIR}/html) install(DIRECTORY ${CMAKE_BINARY_DIR}/html DESTINATION share/doc/itpp) endif() #itpp-config script for UNIX-like systems if (UNIX) if (ITPP_LIBS) string (REPLACE ";" " " ITPP_LIBS "${ITPP_LIBS}") endif() configure_file(${CMAKE_SOURCE_DIR}/itpp-config.cmake.in ${CMAKE_BINARY_DIR}/itpp-config @ONLY) configure_file(${CMAKE_SOURCE_DIR}/itpp-config.1.cmake.in ${CMAKE_BINARY_DIR}/itpp-config.1 @ONLY) configure_file(${CMAKE_SOURCE_DIR}/itpp.pc.cmake.in ${CMAKE_BINARY_DIR}/itpp.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/itpp-config DESTINATION bin PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(FILES ${CMAKE_BINARY_DIR}/itpp-config.1 DESTINATION share/man/man1) install(FILES ${CMAKE_BINARY_DIR}/itpp.pc DESTINATION lib/pkgconfig) endif() itpp-4.3.1/itpp/Makefile.am000066400000000000000000000043051216575753400155240ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk if ENABLE_COMM COMM_DIR = comm COMM_LIB = $(top_builddir)/@PACKAGE@/comm/libcomm.la COMM_D_LIB = $(top_builddir)/@PACKAGE@/comm/libcomm_debug.la endif if ENABLE_FIXED FIXED_DIR = fixed FIXED_LIB = $(top_builddir)/@PACKAGE@/fixed/libfixed.la FIXED_D_LIB = $(top_builddir)/@PACKAGE@/fixed/libfixed_debug.la endif if ENABLE_OPTIM OPTIM_DIR = optim OPTIM_LIB = $(top_builddir)/@PACKAGE@/optim/liboptim.la OPTIM_D_LIB = $(top_builddir)/@PACKAGE@/optim/liboptim_debug.la endif if ENABLE_PROTOCOL PROTOCOL_DIR = protocol PROTOCOL_LIB = $(top_builddir)/@PACKAGE@/protocol/libprotocol.la PROTOCOL_D_LIB = $(top_builddir)/@PACKAGE@/protocol/libprotocol_debug.la endif if ENABLE_SIGNAL SIGNAL_DIR = signal SIGNAL_LIB = $(top_builddir)/@PACKAGE@/signal/libsignal.la SIGNAL_D_LIB = $(top_builddir)/@PACKAGE@/signal/libsignal_debug.la endif if ENABLE_SRCCODE SRCCODE_DIR = srccode SRCCODE_LIB = $(top_builddir)/@PACKAGE@/srccode/libsrccode.la SRCCODE_D_LIB = $(top_builddir)/@PACKAGE@/srccode/libsrccode_debug.la endif SUBDIRS = base stat $(COMM_DIR) $(FIXED_DIR) $(OPTIM_DIR) $(PROTOCOL_DIR) \ $(SIGNAL_DIR) $(SRCCODE_DIR) EXTRA_DIST = config_msvc.h lib_LTLIBRARIES = lib@PACKAGE@.la if ENABLE_DEBUG lib_LTLIBRARIES += lib@PACKAGE@_debug.la endif # Dummy C++ source to cause C++ linking nodist_EXTRA_lib@PACKAGE@_la_SOURCES = dummy.cxx lib@PACKAGE@_la_SOURCES = lib@PACKAGE@_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) \ $(NO_UNDEFINED) lib@PACKAGE@_la_LIBADD = $(top_builddir)/@PACKAGE@/base/libbase.la \ $(top_builddir)/@PACKAGE@/stat/libstat.la \ $(COMM_LIB) $(FIXED_LIB) $(OPTIM_LIB) $(PROTOCOL_LIB) $(SIGNAL_LIB) \ $(SRCCODE_LIB) # Dummy C++ source to cause C++ linking nodist_EXTRA_lib@PACKAGE@_debug_la_SOURCES = dummy.cxx lib@PACKAGE@_debug_la_SOURCES = lib@PACKAGE@_debug_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) \ $(NO_UNDEFINED) lib@PACKAGE@_debug_la_LIBADD = $(top_builddir)/@PACKAGE@/base/libbase_debug.la \ $(top_builddir)/@PACKAGE@/stat/libstat_debug.la \ $(COMM_D_LIB) $(FIXED_D_LIB) $(OPTIM_D_LIB) $(PROTOCOL_D_LIB) \ $(SIGNAL_D_LIB) $(SRCCODE_D_LIB) nobase_pkginclude_HEADERS = $(h_sources) itpp-4.3.1/itpp/Makefile.in000066400000000000000000000707411216575753400155440ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(am__nobase_pkginclude_HEADERS_DIST) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_COMM_TRUE@am__append_1 = $(top_srcdir)/itpp/itcomm.h @ENABLE_FIXED_TRUE@am__append_2 = $(top_srcdir)/itpp/itfixed.h @ENABLE_OPTIM_TRUE@am__append_3 = $(top_srcdir)/itpp/itoptim.h @ENABLE_PROTOCOL_TRUE@am__append_4 = $(top_srcdir)/itpp/itprotocol.h @ENABLE_SIGNAL_TRUE@am__append_5 = $(top_srcdir)/itpp/itsignal.h @ENABLE_SRCCODE_TRUE@am__append_6 = $(top_srcdir)/itpp/itsrccode.h @ENABLE_DEBUG_TRUE@am__append_7 = lib@PACKAGE@_debug.la subdir = itpp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) lib@PACKAGE@_la_DEPENDENCIES = \ $(top_builddir)/@PACKAGE@/base/libbase.la \ $(top_builddir)/@PACKAGE@/stat/libstat.la $(COMM_LIB) \ $(FIXED_LIB) $(OPTIM_LIB) $(PROTOCOL_LIB) $(SIGNAL_LIB) \ $(SRCCODE_LIB) am_lib@PACKAGE@_la_OBJECTS = lib@PACKAGE@_la_OBJECTS = $(am_lib@PACKAGE@_la_OBJECTS) lib@PACKAGE@_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(lib@PACKAGE@_la_LDFLAGS) $(LDFLAGS) -o $@ lib@PACKAGE@_debug_la_DEPENDENCIES = \ $(top_builddir)/@PACKAGE@/base/libbase_debug.la \ $(top_builddir)/@PACKAGE@/stat/libstat_debug.la $(COMM_D_LIB) \ $(FIXED_D_LIB) $(OPTIM_D_LIB) $(PROTOCOL_D_LIB) \ $(SIGNAL_D_LIB) $(SRCCODE_D_LIB) am_lib@PACKAGE@_debug_la_OBJECTS = lib@PACKAGE@_debug_la_OBJECTS = $(am_lib@PACKAGE@_debug_la_OBJECTS) lib@PACKAGE@_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(lib@PACKAGE@_debug_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_lib@PACKAGE@_debug_la_rpath = -rpath $(libdir) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(lib@PACKAGE@_la_SOURCES) \ $(nodist_EXTRA_lib@PACKAGE@_la_SOURCES) \ $(lib@PACKAGE@_debug_la_SOURCES) \ $(nodist_EXTRA_lib@PACKAGE@_debug_la_SOURCES) DIST_SOURCES = $(lib@PACKAGE@_la_SOURCES) \ $(lib@PACKAGE@_debug_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__nobase_pkginclude_HEADERS_DIST = $(top_srcdir)/itpp/itbase.h \ $(top_srcdir)/itpp/itstat.h $(top_srcdir)/itpp/itmex.h \ $(top_srcdir)/itpp/itcomm.h $(top_srcdir)/itpp/itfixed.h \ $(top_srcdir)/itpp/itoptim.h $(top_srcdir)/itpp/itprotocol.h \ $(top_srcdir)/itpp/itsignal.h $(top_srcdir)/itpp/itsrccode.h HEADERS = $(nobase_pkginclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = base stat comm fixed optim protocol signal srccode DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_sources = $(top_srcdir)/itpp/itbase.h $(top_srcdir)/itpp/itstat.h \ $(top_srcdir)/itpp/itmex.h $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) \ $(am__append_6) @ENABLE_COMM_TRUE@COMM_DIR = comm @ENABLE_COMM_TRUE@COMM_LIB = $(top_builddir)/@PACKAGE@/comm/libcomm.la @ENABLE_COMM_TRUE@COMM_D_LIB = $(top_builddir)/@PACKAGE@/comm/libcomm_debug.la @ENABLE_FIXED_TRUE@FIXED_DIR = fixed @ENABLE_FIXED_TRUE@FIXED_LIB = $(top_builddir)/@PACKAGE@/fixed/libfixed.la @ENABLE_FIXED_TRUE@FIXED_D_LIB = $(top_builddir)/@PACKAGE@/fixed/libfixed_debug.la @ENABLE_OPTIM_TRUE@OPTIM_DIR = optim @ENABLE_OPTIM_TRUE@OPTIM_LIB = $(top_builddir)/@PACKAGE@/optim/liboptim.la @ENABLE_OPTIM_TRUE@OPTIM_D_LIB = $(top_builddir)/@PACKAGE@/optim/liboptim_debug.la @ENABLE_PROTOCOL_TRUE@PROTOCOL_DIR = protocol @ENABLE_PROTOCOL_TRUE@PROTOCOL_LIB = $(top_builddir)/@PACKAGE@/protocol/libprotocol.la @ENABLE_PROTOCOL_TRUE@PROTOCOL_D_LIB = $(top_builddir)/@PACKAGE@/protocol/libprotocol_debug.la @ENABLE_SIGNAL_TRUE@SIGNAL_DIR = signal @ENABLE_SIGNAL_TRUE@SIGNAL_LIB = $(top_builddir)/@PACKAGE@/signal/libsignal.la @ENABLE_SIGNAL_TRUE@SIGNAL_D_LIB = $(top_builddir)/@PACKAGE@/signal/libsignal_debug.la @ENABLE_SRCCODE_TRUE@SRCCODE_DIR = srccode @ENABLE_SRCCODE_TRUE@SRCCODE_LIB = $(top_builddir)/@PACKAGE@/srccode/libsrccode.la @ENABLE_SRCCODE_TRUE@SRCCODE_D_LIB = $(top_builddir)/@PACKAGE@/srccode/libsrccode_debug.la SUBDIRS = base stat $(COMM_DIR) $(FIXED_DIR) $(OPTIM_DIR) $(PROTOCOL_DIR) \ $(SIGNAL_DIR) $(SRCCODE_DIR) EXTRA_DIST = config_msvc.h lib_LTLIBRARIES = lib@PACKAGE@.la $(am__append_7) # Dummy C++ source to cause C++ linking nodist_EXTRA_lib@PACKAGE@_la_SOURCES = dummy.cxx lib@PACKAGE@_la_SOURCES = lib@PACKAGE@_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) \ $(NO_UNDEFINED) lib@PACKAGE@_la_LIBADD = $(top_builddir)/@PACKAGE@/base/libbase.la \ $(top_builddir)/@PACKAGE@/stat/libstat.la \ $(COMM_LIB) $(FIXED_LIB) $(OPTIM_LIB) $(PROTOCOL_LIB) $(SIGNAL_LIB) \ $(SRCCODE_LIB) # Dummy C++ source to cause C++ linking nodist_EXTRA_lib@PACKAGE@_debug_la_SOURCES = dummy.cxx lib@PACKAGE@_debug_la_SOURCES = lib@PACKAGE@_debug_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) \ $(NO_UNDEFINED) lib@PACKAGE@_debug_la_LIBADD = $(top_builddir)/@PACKAGE@/base/libbase_debug.la \ $(top_builddir)/@PACKAGE@/stat/libstat_debug.la \ $(COMM_D_LIB) $(FIXED_D_LIB) $(OPTIM_D_LIB) $(PROTOCOL_D_LIB) \ $(SIGNAL_D_LIB) $(SRCCODE_D_LIB) nobase_pkginclude_HEADERS = $(h_sources) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status itpp/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done lib@PACKAGE@.la: $(lib@PACKAGE@_la_OBJECTS) $(lib@PACKAGE@_la_DEPENDENCIES) $(lib@PACKAGE@_la_LINK) -rpath $(libdir) $(lib@PACKAGE@_la_OBJECTS) $(lib@PACKAGE@_la_LIBADD) $(LIBS) lib@PACKAGE@_debug.la: $(lib@PACKAGE@_debug_la_OBJECTS) $(lib@PACKAGE@_debug_la_DEPENDENCIES) $(lib@PACKAGE@_debug_la_LINK) $(am_lib@PACKAGE@_debug_la_rpath) $(lib@PACKAGE@_debug_la_OBJECTS) $(lib@PACKAGE@_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nobase_pkgincludeHEADERS: $(nobase_pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo "$(MKDIR_P) '$(DESTDIR)$(pkgincludedir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)/$$dir"; }; \ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(pkgincludedir)/$$dir'"; \ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(pkgincludedir)/$$dir" || exit $$?; }; \ done uninstall-nobase_pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-nobase_pkgincludeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLTLIBRARIES \ uninstall-nobase_pkgincludeHEADERS .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \ distclean distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man \ install-nobase_pkgincludeHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-libLTLIBRARIES uninstall-nobase_pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/base/000077500000000000000000000000001216575753400144005ustar00rootroot00000000000000itpp-4.3.1/itpp/base/Makefile.am000066400000000000000000000016371216575753400164430ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk SUBDIRS = algebra bessel math noinst_LTLIBRARIES = libbase.la if ENABLE_DEBUG noinst_LTLIBRARIES += libbase_debug.la endif libbase_la_SOURCES = $(noinst_h_base_sources) $(h_base_sources) \ $(cpp_base_sources) libbase_la_CXXFLAGS = $(CXXFLAGS_OPT) libbase_la_LIBADD = \ $(top_builddir)/@PACKAGE@/base/algebra/libalgebra.la \ $(top_builddir)/@PACKAGE@/base/bessel/libbessel.la \ $(top_builddir)/@PACKAGE@/base/math/libmath.la libbase_debug_la_SOURCES = $(noinst_h_base_sources) $(h_base_sources) \ $(cpp_base_sources) libbase_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) libbase_debug_la_LIBADD = \ $(top_builddir)/@PACKAGE@/base/algebra/libalgebra_debug.la \ $(top_builddir)/@PACKAGE@/base/bessel/libbessel_debug.la \ $(top_builddir)/@PACKAGE@/base/math/libmath_debug.la pkgincludedir = $(includedir)/@PACKAGE@/base pkginclude_HEADERS = $(h_base_sources) itpp-4.3.1/itpp/base/Makefile.in000066400000000000000000002351121216575753400164510ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libbase_debug.la subdir = itpp/base ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbase_la_DEPENDENCIES = \ $(top_builddir)/@PACKAGE@/base/algebra/libalgebra.la \ $(top_builddir)/@PACKAGE@/base/bessel/libbessel.la \ $(top_builddir)/@PACKAGE@/base/math/libmath.la am__objects_1 = am__objects_2 = libbase_la-bessel.lo libbase_la-binary.lo \ libbase_la-binfile.lo libbase_la-converters.lo \ libbase_la-copy_vector.lo libbase_la-fastmath.lo \ libbase_la-gf2mat.lo libbase_la-help_functions.lo \ libbase_la-itassert.lo libbase_la-itcompat.lo \ libbase_la-itfile.lo libbase_la-mat.lo libbase_la-matfunc.lo \ libbase_la-operators.lo libbase_la-parser.lo \ libbase_la-random.lo libbase_la-smat.lo libbase_la-specmat.lo \ libbase_la-svec.lo libbase_la-timing.lo libbase_la-vec.lo am_libbase_la_OBJECTS = $(am__objects_1) $(am__objects_1) \ $(am__objects_2) libbase_la_OBJECTS = $(am_libbase_la_OBJECTS) libbase_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libbase_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libbase_debug_la_DEPENDENCIES = \ $(top_builddir)/@PACKAGE@/base/algebra/libalgebra_debug.la \ $(top_builddir)/@PACKAGE@/base/bessel/libbessel_debug.la \ $(top_builddir)/@PACKAGE@/base/math/libmath_debug.la am__objects_3 = libbase_debug_la-bessel.lo libbase_debug_la-binary.lo \ libbase_debug_la-binfile.lo libbase_debug_la-converters.lo \ libbase_debug_la-copy_vector.lo libbase_debug_la-fastmath.lo \ libbase_debug_la-gf2mat.lo libbase_debug_la-help_functions.lo \ libbase_debug_la-itassert.lo libbase_debug_la-itcompat.lo \ libbase_debug_la-itfile.lo libbase_debug_la-mat.lo \ libbase_debug_la-matfunc.lo libbase_debug_la-operators.lo \ libbase_debug_la-parser.lo libbase_debug_la-random.lo \ libbase_debug_la-smat.lo libbase_debug_la-specmat.lo \ libbase_debug_la-svec.lo libbase_debug_la-timing.lo \ libbase_debug_la-vec.lo am_libbase_debug_la_OBJECTS = $(am__objects_1) $(am__objects_1) \ $(am__objects_3) libbase_debug_la_OBJECTS = $(am_libbase_debug_la_OBJECTS) libbase_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libbase_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbase_la_SOURCES) $(libbase_debug_la_SOURCES) DIST_SOURCES = $(libbase_la_SOURCES) $(libbase_debug_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" pkgincludedir = $(includedir)/@PACKAGE@/base ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) noinst_h_base_sources = \ $(top_srcdir)/itpp/base/blas.h \ $(top_srcdir)/itpp/base/itcompat.h h_base_sources = \ $(top_srcdir)/itpp/base/array.h \ $(top_srcdir)/itpp/base/bessel.h \ $(top_srcdir)/itpp/base/binary.h \ $(top_srcdir)/itpp/base/binfile.h \ $(top_srcdir)/itpp/base/circular_buffer.h \ $(top_srcdir)/itpp/base/converters.h \ $(top_srcdir)/itpp/base/copy_vector.h \ $(top_srcdir)/itpp/base/factory.h \ $(top_srcdir)/itpp/base/fastmath.h \ $(top_srcdir)/itpp/base/gf2mat.h \ $(top_srcdir)/itpp/base/help_functions.h \ $(top_srcdir)/itpp/base/itassert.h \ $(top_srcdir)/itpp/base/itfile.h \ $(top_srcdir)/itpp/base/ittypes.h \ $(top_srcdir)/itpp/base/matfunc.h \ $(top_srcdir)/itpp/base/mat.h \ $(top_srcdir)/itpp/base/operators.h \ $(top_srcdir)/itpp/base/parser.h \ $(top_srcdir)/itpp/base/random.h \ $(top_srcdir)/itpp/base/random_dsfmt.h \ $(top_srcdir)/itpp/base/smat.h \ $(top_srcdir)/itpp/base/sort.h \ $(top_srcdir)/itpp/base/specmat.h \ $(top_srcdir)/itpp/base/stack.h \ $(top_srcdir)/itpp/base/svec.h \ $(top_srcdir)/itpp/base/timing.h \ $(top_srcdir)/itpp/base/vec.h cpp_base_sources = \ $(top_srcdir)/itpp/base/bessel.cpp \ $(top_srcdir)/itpp/base/binary.cpp \ $(top_srcdir)/itpp/base/binfile.cpp \ $(top_srcdir)/itpp/base/converters.cpp \ $(top_srcdir)/itpp/base/copy_vector.cpp \ $(top_srcdir)/itpp/base/fastmath.cpp \ $(top_srcdir)/itpp/base/gf2mat.cpp \ $(top_srcdir)/itpp/base/help_functions.cpp \ $(top_srcdir)/itpp/base/itassert.cpp \ $(top_srcdir)/itpp/base/itcompat.cpp \ $(top_srcdir)/itpp/base/itfile.cpp \ $(top_srcdir)/itpp/base/mat.cpp \ $(top_srcdir)/itpp/base/matfunc.cpp \ $(top_srcdir)/itpp/base/operators.cpp \ $(top_srcdir)/itpp/base/parser.cpp \ $(top_srcdir)/itpp/base/random.cpp \ $(top_srcdir)/itpp/base/smat.cpp \ $(top_srcdir)/itpp/base/specmat.cpp \ $(top_srcdir)/itpp/base/svec.cpp \ $(top_srcdir)/itpp/base/timing.cpp \ $(top_srcdir)/itpp/base/vec.cpp SUBDIRS = algebra bessel math noinst_LTLIBRARIES = libbase.la $(am__append_1) libbase_la_SOURCES = $(noinst_h_base_sources) $(h_base_sources) \ $(cpp_base_sources) libbase_la_CXXFLAGS = $(CXXFLAGS_OPT) libbase_la_LIBADD = \ $(top_builddir)/@PACKAGE@/base/algebra/libalgebra.la \ $(top_builddir)/@PACKAGE@/base/bessel/libbessel.la \ $(top_builddir)/@PACKAGE@/base/math/libmath.la libbase_debug_la_SOURCES = $(noinst_h_base_sources) $(h_base_sources) \ $(cpp_base_sources) libbase_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) libbase_debug_la_LIBADD = \ $(top_builddir)/@PACKAGE@/base/algebra/libalgebra_debug.la \ $(top_builddir)/@PACKAGE@/base/bessel/libbessel_debug.la \ $(top_builddir)/@PACKAGE@/base/math/libmath_debug.la pkginclude_HEADERS = $(h_base_sources) all: all-recursive .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/base/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/base/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libbase.la: $(libbase_la_OBJECTS) $(libbase_la_DEPENDENCIES) $(libbase_la_LINK) $(libbase_la_OBJECTS) $(libbase_la_LIBADD) $(LIBS) libbase_debug.la: $(libbase_debug_la_OBJECTS) $(libbase_debug_la_DEPENDENCIES) $(libbase_debug_la_LINK) $(am_libbase_debug_la_rpath) $(libbase_debug_la_OBJECTS) $(libbase_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-bessel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-binary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-binfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-converters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-copy_vector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-fastmath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-gf2mat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-help_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-itassert.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-itcompat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-itfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-mat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-matfunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-operators.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-random.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-smat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-specmat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-svec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-timing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_debug_la-vec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-bessel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-binary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-binfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-converters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-copy_vector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-fastmath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-gf2mat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-help_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-itassert.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-itcompat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-itfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-mat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-matfunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-operators.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-random.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-smat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-specmat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-svec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-timing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbase_la-vec.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libbase_la-bessel.lo: $(top_srcdir)/itpp/base/bessel.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-bessel.lo -MD -MP -MF $(DEPDIR)/libbase_la-bessel.Tpo -c -o libbase_la-bessel.lo `test -f '$(top_srcdir)/itpp/base/bessel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-bessel.Tpo $(DEPDIR)/libbase_la-bessel.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel.cpp' object='libbase_la-bessel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-bessel.lo `test -f '$(top_srcdir)/itpp/base/bessel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel.cpp libbase_la-binary.lo: $(top_srcdir)/itpp/base/binary.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-binary.lo -MD -MP -MF $(DEPDIR)/libbase_la-binary.Tpo -c -o libbase_la-binary.lo `test -f '$(top_srcdir)/itpp/base/binary.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binary.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-binary.Tpo $(DEPDIR)/libbase_la-binary.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/binary.cpp' object='libbase_la-binary.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-binary.lo `test -f '$(top_srcdir)/itpp/base/binary.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binary.cpp libbase_la-binfile.lo: $(top_srcdir)/itpp/base/binfile.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-binfile.lo -MD -MP -MF $(DEPDIR)/libbase_la-binfile.Tpo -c -o libbase_la-binfile.lo `test -f '$(top_srcdir)/itpp/base/binfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binfile.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-binfile.Tpo $(DEPDIR)/libbase_la-binfile.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/binfile.cpp' object='libbase_la-binfile.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-binfile.lo `test -f '$(top_srcdir)/itpp/base/binfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binfile.cpp libbase_la-converters.lo: $(top_srcdir)/itpp/base/converters.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-converters.lo -MD -MP -MF $(DEPDIR)/libbase_la-converters.Tpo -c -o libbase_la-converters.lo `test -f '$(top_srcdir)/itpp/base/converters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/converters.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-converters.Tpo $(DEPDIR)/libbase_la-converters.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/converters.cpp' object='libbase_la-converters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-converters.lo `test -f '$(top_srcdir)/itpp/base/converters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/converters.cpp libbase_la-copy_vector.lo: $(top_srcdir)/itpp/base/copy_vector.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-copy_vector.lo -MD -MP -MF $(DEPDIR)/libbase_la-copy_vector.Tpo -c -o libbase_la-copy_vector.lo `test -f '$(top_srcdir)/itpp/base/copy_vector.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/copy_vector.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-copy_vector.Tpo $(DEPDIR)/libbase_la-copy_vector.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/copy_vector.cpp' object='libbase_la-copy_vector.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-copy_vector.lo `test -f '$(top_srcdir)/itpp/base/copy_vector.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/copy_vector.cpp libbase_la-fastmath.lo: $(top_srcdir)/itpp/base/fastmath.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-fastmath.lo -MD -MP -MF $(DEPDIR)/libbase_la-fastmath.Tpo -c -o libbase_la-fastmath.lo `test -f '$(top_srcdir)/itpp/base/fastmath.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/fastmath.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-fastmath.Tpo $(DEPDIR)/libbase_la-fastmath.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/fastmath.cpp' object='libbase_la-fastmath.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-fastmath.lo `test -f '$(top_srcdir)/itpp/base/fastmath.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/fastmath.cpp libbase_la-gf2mat.lo: $(top_srcdir)/itpp/base/gf2mat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-gf2mat.lo -MD -MP -MF $(DEPDIR)/libbase_la-gf2mat.Tpo -c -o libbase_la-gf2mat.lo `test -f '$(top_srcdir)/itpp/base/gf2mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/gf2mat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-gf2mat.Tpo $(DEPDIR)/libbase_la-gf2mat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/gf2mat.cpp' object='libbase_la-gf2mat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-gf2mat.lo `test -f '$(top_srcdir)/itpp/base/gf2mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/gf2mat.cpp libbase_la-help_functions.lo: $(top_srcdir)/itpp/base/help_functions.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-help_functions.lo -MD -MP -MF $(DEPDIR)/libbase_la-help_functions.Tpo -c -o libbase_la-help_functions.lo `test -f '$(top_srcdir)/itpp/base/help_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/help_functions.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-help_functions.Tpo $(DEPDIR)/libbase_la-help_functions.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/help_functions.cpp' object='libbase_la-help_functions.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-help_functions.lo `test -f '$(top_srcdir)/itpp/base/help_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/help_functions.cpp libbase_la-itassert.lo: $(top_srcdir)/itpp/base/itassert.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-itassert.lo -MD -MP -MF $(DEPDIR)/libbase_la-itassert.Tpo -c -o libbase_la-itassert.lo `test -f '$(top_srcdir)/itpp/base/itassert.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itassert.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-itassert.Tpo $(DEPDIR)/libbase_la-itassert.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/itassert.cpp' object='libbase_la-itassert.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-itassert.lo `test -f '$(top_srcdir)/itpp/base/itassert.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itassert.cpp libbase_la-itcompat.lo: $(top_srcdir)/itpp/base/itcompat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-itcompat.lo -MD -MP -MF $(DEPDIR)/libbase_la-itcompat.Tpo -c -o libbase_la-itcompat.lo `test -f '$(top_srcdir)/itpp/base/itcompat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itcompat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-itcompat.Tpo $(DEPDIR)/libbase_la-itcompat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/itcompat.cpp' object='libbase_la-itcompat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-itcompat.lo `test -f '$(top_srcdir)/itpp/base/itcompat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itcompat.cpp libbase_la-itfile.lo: $(top_srcdir)/itpp/base/itfile.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-itfile.lo -MD -MP -MF $(DEPDIR)/libbase_la-itfile.Tpo -c -o libbase_la-itfile.lo `test -f '$(top_srcdir)/itpp/base/itfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itfile.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-itfile.Tpo $(DEPDIR)/libbase_la-itfile.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/itfile.cpp' object='libbase_la-itfile.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-itfile.lo `test -f '$(top_srcdir)/itpp/base/itfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itfile.cpp libbase_la-mat.lo: $(top_srcdir)/itpp/base/mat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-mat.lo -MD -MP -MF $(DEPDIR)/libbase_la-mat.Tpo -c -o libbase_la-mat.lo `test -f '$(top_srcdir)/itpp/base/mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/mat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-mat.Tpo $(DEPDIR)/libbase_la-mat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/mat.cpp' object='libbase_la-mat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-mat.lo `test -f '$(top_srcdir)/itpp/base/mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/mat.cpp libbase_la-matfunc.lo: $(top_srcdir)/itpp/base/matfunc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-matfunc.lo -MD -MP -MF $(DEPDIR)/libbase_la-matfunc.Tpo -c -o libbase_la-matfunc.lo `test -f '$(top_srcdir)/itpp/base/matfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/matfunc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-matfunc.Tpo $(DEPDIR)/libbase_la-matfunc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/matfunc.cpp' object='libbase_la-matfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-matfunc.lo `test -f '$(top_srcdir)/itpp/base/matfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/matfunc.cpp libbase_la-operators.lo: $(top_srcdir)/itpp/base/operators.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-operators.lo -MD -MP -MF $(DEPDIR)/libbase_la-operators.Tpo -c -o libbase_la-operators.lo `test -f '$(top_srcdir)/itpp/base/operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/operators.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-operators.Tpo $(DEPDIR)/libbase_la-operators.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/operators.cpp' object='libbase_la-operators.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-operators.lo `test -f '$(top_srcdir)/itpp/base/operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/operators.cpp libbase_la-parser.lo: $(top_srcdir)/itpp/base/parser.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-parser.lo -MD -MP -MF $(DEPDIR)/libbase_la-parser.Tpo -c -o libbase_la-parser.lo `test -f '$(top_srcdir)/itpp/base/parser.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/parser.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-parser.Tpo $(DEPDIR)/libbase_la-parser.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/parser.cpp' object='libbase_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-parser.lo `test -f '$(top_srcdir)/itpp/base/parser.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/parser.cpp libbase_la-random.lo: $(top_srcdir)/itpp/base/random.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-random.lo -MD -MP -MF $(DEPDIR)/libbase_la-random.Tpo -c -o libbase_la-random.lo `test -f '$(top_srcdir)/itpp/base/random.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/random.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-random.Tpo $(DEPDIR)/libbase_la-random.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/random.cpp' object='libbase_la-random.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-random.lo `test -f '$(top_srcdir)/itpp/base/random.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/random.cpp libbase_la-smat.lo: $(top_srcdir)/itpp/base/smat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-smat.lo -MD -MP -MF $(DEPDIR)/libbase_la-smat.Tpo -c -o libbase_la-smat.lo `test -f '$(top_srcdir)/itpp/base/smat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/smat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-smat.Tpo $(DEPDIR)/libbase_la-smat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/smat.cpp' object='libbase_la-smat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-smat.lo `test -f '$(top_srcdir)/itpp/base/smat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/smat.cpp libbase_la-specmat.lo: $(top_srcdir)/itpp/base/specmat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-specmat.lo -MD -MP -MF $(DEPDIR)/libbase_la-specmat.Tpo -c -o libbase_la-specmat.lo `test -f '$(top_srcdir)/itpp/base/specmat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/specmat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-specmat.Tpo $(DEPDIR)/libbase_la-specmat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/specmat.cpp' object='libbase_la-specmat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-specmat.lo `test -f '$(top_srcdir)/itpp/base/specmat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/specmat.cpp libbase_la-svec.lo: $(top_srcdir)/itpp/base/svec.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-svec.lo -MD -MP -MF $(DEPDIR)/libbase_la-svec.Tpo -c -o libbase_la-svec.lo `test -f '$(top_srcdir)/itpp/base/svec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/svec.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-svec.Tpo $(DEPDIR)/libbase_la-svec.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/svec.cpp' object='libbase_la-svec.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-svec.lo `test -f '$(top_srcdir)/itpp/base/svec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/svec.cpp libbase_la-timing.lo: $(top_srcdir)/itpp/base/timing.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-timing.lo -MD -MP -MF $(DEPDIR)/libbase_la-timing.Tpo -c -o libbase_la-timing.lo `test -f '$(top_srcdir)/itpp/base/timing.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/timing.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-timing.Tpo $(DEPDIR)/libbase_la-timing.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/timing.cpp' object='libbase_la-timing.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-timing.lo `test -f '$(top_srcdir)/itpp/base/timing.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/timing.cpp libbase_la-vec.lo: $(top_srcdir)/itpp/base/vec.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_la-vec.lo -MD -MP -MF $(DEPDIR)/libbase_la-vec.Tpo -c -o libbase_la-vec.lo `test -f '$(top_srcdir)/itpp/base/vec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/vec.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_la-vec.Tpo $(DEPDIR)/libbase_la-vec.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/vec.cpp' object='libbase_la-vec.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_la-vec.lo `test -f '$(top_srcdir)/itpp/base/vec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/vec.cpp libbase_debug_la-bessel.lo: $(top_srcdir)/itpp/base/bessel.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-bessel.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-bessel.Tpo -c -o libbase_debug_la-bessel.lo `test -f '$(top_srcdir)/itpp/base/bessel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-bessel.Tpo $(DEPDIR)/libbase_debug_la-bessel.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel.cpp' object='libbase_debug_la-bessel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-bessel.lo `test -f '$(top_srcdir)/itpp/base/bessel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel.cpp libbase_debug_la-binary.lo: $(top_srcdir)/itpp/base/binary.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-binary.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-binary.Tpo -c -o libbase_debug_la-binary.lo `test -f '$(top_srcdir)/itpp/base/binary.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binary.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-binary.Tpo $(DEPDIR)/libbase_debug_la-binary.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/binary.cpp' object='libbase_debug_la-binary.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-binary.lo `test -f '$(top_srcdir)/itpp/base/binary.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binary.cpp libbase_debug_la-binfile.lo: $(top_srcdir)/itpp/base/binfile.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-binfile.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-binfile.Tpo -c -o libbase_debug_la-binfile.lo `test -f '$(top_srcdir)/itpp/base/binfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binfile.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-binfile.Tpo $(DEPDIR)/libbase_debug_la-binfile.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/binfile.cpp' object='libbase_debug_la-binfile.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-binfile.lo `test -f '$(top_srcdir)/itpp/base/binfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/binfile.cpp libbase_debug_la-converters.lo: $(top_srcdir)/itpp/base/converters.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-converters.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-converters.Tpo -c -o libbase_debug_la-converters.lo `test -f '$(top_srcdir)/itpp/base/converters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/converters.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-converters.Tpo $(DEPDIR)/libbase_debug_la-converters.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/converters.cpp' object='libbase_debug_la-converters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-converters.lo `test -f '$(top_srcdir)/itpp/base/converters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/converters.cpp libbase_debug_la-copy_vector.lo: $(top_srcdir)/itpp/base/copy_vector.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-copy_vector.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-copy_vector.Tpo -c -o libbase_debug_la-copy_vector.lo `test -f '$(top_srcdir)/itpp/base/copy_vector.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/copy_vector.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-copy_vector.Tpo $(DEPDIR)/libbase_debug_la-copy_vector.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/copy_vector.cpp' object='libbase_debug_la-copy_vector.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-copy_vector.lo `test -f '$(top_srcdir)/itpp/base/copy_vector.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/copy_vector.cpp libbase_debug_la-fastmath.lo: $(top_srcdir)/itpp/base/fastmath.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-fastmath.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-fastmath.Tpo -c -o libbase_debug_la-fastmath.lo `test -f '$(top_srcdir)/itpp/base/fastmath.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/fastmath.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-fastmath.Tpo $(DEPDIR)/libbase_debug_la-fastmath.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/fastmath.cpp' object='libbase_debug_la-fastmath.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-fastmath.lo `test -f '$(top_srcdir)/itpp/base/fastmath.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/fastmath.cpp libbase_debug_la-gf2mat.lo: $(top_srcdir)/itpp/base/gf2mat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-gf2mat.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-gf2mat.Tpo -c -o libbase_debug_la-gf2mat.lo `test -f '$(top_srcdir)/itpp/base/gf2mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/gf2mat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-gf2mat.Tpo $(DEPDIR)/libbase_debug_la-gf2mat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/gf2mat.cpp' object='libbase_debug_la-gf2mat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-gf2mat.lo `test -f '$(top_srcdir)/itpp/base/gf2mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/gf2mat.cpp libbase_debug_la-help_functions.lo: $(top_srcdir)/itpp/base/help_functions.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-help_functions.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-help_functions.Tpo -c -o libbase_debug_la-help_functions.lo `test -f '$(top_srcdir)/itpp/base/help_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/help_functions.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-help_functions.Tpo $(DEPDIR)/libbase_debug_la-help_functions.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/help_functions.cpp' object='libbase_debug_la-help_functions.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-help_functions.lo `test -f '$(top_srcdir)/itpp/base/help_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/help_functions.cpp libbase_debug_la-itassert.lo: $(top_srcdir)/itpp/base/itassert.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-itassert.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-itassert.Tpo -c -o libbase_debug_la-itassert.lo `test -f '$(top_srcdir)/itpp/base/itassert.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itassert.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-itassert.Tpo $(DEPDIR)/libbase_debug_la-itassert.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/itassert.cpp' object='libbase_debug_la-itassert.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-itassert.lo `test -f '$(top_srcdir)/itpp/base/itassert.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itassert.cpp libbase_debug_la-itcompat.lo: $(top_srcdir)/itpp/base/itcompat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-itcompat.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-itcompat.Tpo -c -o libbase_debug_la-itcompat.lo `test -f '$(top_srcdir)/itpp/base/itcompat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itcompat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-itcompat.Tpo $(DEPDIR)/libbase_debug_la-itcompat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/itcompat.cpp' object='libbase_debug_la-itcompat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-itcompat.lo `test -f '$(top_srcdir)/itpp/base/itcompat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itcompat.cpp libbase_debug_la-itfile.lo: $(top_srcdir)/itpp/base/itfile.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-itfile.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-itfile.Tpo -c -o libbase_debug_la-itfile.lo `test -f '$(top_srcdir)/itpp/base/itfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itfile.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-itfile.Tpo $(DEPDIR)/libbase_debug_la-itfile.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/itfile.cpp' object='libbase_debug_la-itfile.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-itfile.lo `test -f '$(top_srcdir)/itpp/base/itfile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/itfile.cpp libbase_debug_la-mat.lo: $(top_srcdir)/itpp/base/mat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-mat.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-mat.Tpo -c -o libbase_debug_la-mat.lo `test -f '$(top_srcdir)/itpp/base/mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/mat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-mat.Tpo $(DEPDIR)/libbase_debug_la-mat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/mat.cpp' object='libbase_debug_la-mat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-mat.lo `test -f '$(top_srcdir)/itpp/base/mat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/mat.cpp libbase_debug_la-matfunc.lo: $(top_srcdir)/itpp/base/matfunc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-matfunc.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-matfunc.Tpo -c -o libbase_debug_la-matfunc.lo `test -f '$(top_srcdir)/itpp/base/matfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/matfunc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-matfunc.Tpo $(DEPDIR)/libbase_debug_la-matfunc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/matfunc.cpp' object='libbase_debug_la-matfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-matfunc.lo `test -f '$(top_srcdir)/itpp/base/matfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/matfunc.cpp libbase_debug_la-operators.lo: $(top_srcdir)/itpp/base/operators.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-operators.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-operators.Tpo -c -o libbase_debug_la-operators.lo `test -f '$(top_srcdir)/itpp/base/operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/operators.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-operators.Tpo $(DEPDIR)/libbase_debug_la-operators.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/operators.cpp' object='libbase_debug_la-operators.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-operators.lo `test -f '$(top_srcdir)/itpp/base/operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/operators.cpp libbase_debug_la-parser.lo: $(top_srcdir)/itpp/base/parser.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-parser.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-parser.Tpo -c -o libbase_debug_la-parser.lo `test -f '$(top_srcdir)/itpp/base/parser.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/parser.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-parser.Tpo $(DEPDIR)/libbase_debug_la-parser.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/parser.cpp' object='libbase_debug_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-parser.lo `test -f '$(top_srcdir)/itpp/base/parser.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/parser.cpp libbase_debug_la-random.lo: $(top_srcdir)/itpp/base/random.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-random.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-random.Tpo -c -o libbase_debug_la-random.lo `test -f '$(top_srcdir)/itpp/base/random.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/random.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-random.Tpo $(DEPDIR)/libbase_debug_la-random.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/random.cpp' object='libbase_debug_la-random.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-random.lo `test -f '$(top_srcdir)/itpp/base/random.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/random.cpp libbase_debug_la-smat.lo: $(top_srcdir)/itpp/base/smat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-smat.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-smat.Tpo -c -o libbase_debug_la-smat.lo `test -f '$(top_srcdir)/itpp/base/smat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/smat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-smat.Tpo $(DEPDIR)/libbase_debug_la-smat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/smat.cpp' object='libbase_debug_la-smat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-smat.lo `test -f '$(top_srcdir)/itpp/base/smat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/smat.cpp libbase_debug_la-specmat.lo: $(top_srcdir)/itpp/base/specmat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-specmat.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-specmat.Tpo -c -o libbase_debug_la-specmat.lo `test -f '$(top_srcdir)/itpp/base/specmat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/specmat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-specmat.Tpo $(DEPDIR)/libbase_debug_la-specmat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/specmat.cpp' object='libbase_debug_la-specmat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-specmat.lo `test -f '$(top_srcdir)/itpp/base/specmat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/specmat.cpp libbase_debug_la-svec.lo: $(top_srcdir)/itpp/base/svec.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-svec.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-svec.Tpo -c -o libbase_debug_la-svec.lo `test -f '$(top_srcdir)/itpp/base/svec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/svec.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-svec.Tpo $(DEPDIR)/libbase_debug_la-svec.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/svec.cpp' object='libbase_debug_la-svec.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-svec.lo `test -f '$(top_srcdir)/itpp/base/svec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/svec.cpp libbase_debug_la-timing.lo: $(top_srcdir)/itpp/base/timing.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-timing.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-timing.Tpo -c -o libbase_debug_la-timing.lo `test -f '$(top_srcdir)/itpp/base/timing.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/timing.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-timing.Tpo $(DEPDIR)/libbase_debug_la-timing.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/timing.cpp' object='libbase_debug_la-timing.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-timing.lo `test -f '$(top_srcdir)/itpp/base/timing.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/timing.cpp libbase_debug_la-vec.lo: $(top_srcdir)/itpp/base/vec.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbase_debug_la-vec.lo -MD -MP -MF $(DEPDIR)/libbase_debug_la-vec.Tpo -c -o libbase_debug_la-vec.lo `test -f '$(top_srcdir)/itpp/base/vec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/vec.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbase_debug_la-vec.Tpo $(DEPDIR)/libbase_debug_la-vec.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/vec.cpp' object='libbase_debug_la-vec.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbase_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbase_debug_la-vec.lo `test -f '$(top_srcdir)/itpp/base/vec.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/vec.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/base/algebra/000077500000000000000000000000001216575753400157755ustar00rootroot00000000000000itpp-4.3.1/itpp/base/algebra/Makefile.am000066400000000000000000000011311216575753400200250ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libalgebra.la if ENABLE_DEBUG noinst_LTLIBRARIES += libalgebra_debug.la endif libalgebra_la_SOURCES = $(noinst_h_base_algebra_sources) \ $(h_base_algebra_sources) \ $(cpp_base_algebra_sources) libalgebra_la_CXXFLAGS = $(CXXFLAGS_OPT) libalgebra_debug_la_SOURCES = $(noinst_h_base_algebra_sources) \ $(h_base_algebra_sources) \ $(cpp_base_algebra_sources) libalgebra_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/base/algebra pkginclude_HEADERS = $(h_base_algebra_sources) itpp-4.3.1/itpp/base/algebra/Makefile.in000066400000000000000000001250551216575753400200520ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libalgebra_debug.la subdir = itpp/base/algebra ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libalgebra_la_LIBADD = am__objects_1 = am__objects_2 = libalgebra_la-cholesky.lo libalgebra_la-det.lo \ libalgebra_la-eigen.lo libalgebra_la-inv.lo \ libalgebra_la-ls_solve.lo libalgebra_la-lu.lo \ libalgebra_la-qr.lo libalgebra_la-schur.lo \ libalgebra_la-svd.lo am_libalgebra_la_OBJECTS = $(am__objects_1) $(am__objects_1) \ $(am__objects_2) libalgebra_la_OBJECTS = $(am_libalgebra_la_OBJECTS) libalgebra_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libalgebra_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libalgebra_debug_la_LIBADD = am__objects_3 = libalgebra_debug_la-cholesky.lo \ libalgebra_debug_la-det.lo libalgebra_debug_la-eigen.lo \ libalgebra_debug_la-inv.lo libalgebra_debug_la-ls_solve.lo \ libalgebra_debug_la-lu.lo libalgebra_debug_la-qr.lo \ libalgebra_debug_la-schur.lo libalgebra_debug_la-svd.lo am_libalgebra_debug_la_OBJECTS = $(am__objects_1) $(am__objects_1) \ $(am__objects_3) libalgebra_debug_la_OBJECTS = $(am_libalgebra_debug_la_OBJECTS) libalgebra_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libalgebra_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libalgebra_la_SOURCES) $(libalgebra_debug_la_SOURCES) DIST_SOURCES = $(libalgebra_la_SOURCES) $(libalgebra_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/base/algebra ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) noinst_h_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/lapack.h h_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/cholesky.h \ $(top_srcdir)/itpp/base/algebra/det.h \ $(top_srcdir)/itpp/base/algebra/eigen.h \ $(top_srcdir)/itpp/base/algebra/inv.h \ $(top_srcdir)/itpp/base/algebra/ls_solve.h \ $(top_srcdir)/itpp/base/algebra/lu.h \ $(top_srcdir)/itpp/base/algebra/qr.h \ $(top_srcdir)/itpp/base/algebra/schur.h \ $(top_srcdir)/itpp/base/algebra/svd.h cpp_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/cholesky.cpp \ $(top_srcdir)/itpp/base/algebra/det.cpp \ $(top_srcdir)/itpp/base/algebra/eigen.cpp \ $(top_srcdir)/itpp/base/algebra/inv.cpp \ $(top_srcdir)/itpp/base/algebra/ls_solve.cpp \ $(top_srcdir)/itpp/base/algebra/lu.cpp \ $(top_srcdir)/itpp/base/algebra/qr.cpp \ $(top_srcdir)/itpp/base/algebra/schur.cpp \ $(top_srcdir)/itpp/base/algebra/svd.cpp noinst_LTLIBRARIES = libalgebra.la $(am__append_1) libalgebra_la_SOURCES = $(noinst_h_base_algebra_sources) \ $(h_base_algebra_sources) \ $(cpp_base_algebra_sources) libalgebra_la_CXXFLAGS = $(CXXFLAGS_OPT) libalgebra_debug_la_SOURCES = $(noinst_h_base_algebra_sources) \ $(h_base_algebra_sources) \ $(cpp_base_algebra_sources) libalgebra_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_base_algebra_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/base/algebra/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/base/algebra/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libalgebra.la: $(libalgebra_la_OBJECTS) $(libalgebra_la_DEPENDENCIES) $(libalgebra_la_LINK) $(libalgebra_la_OBJECTS) $(libalgebra_la_LIBADD) $(LIBS) libalgebra_debug.la: $(libalgebra_debug_la_OBJECTS) $(libalgebra_debug_la_DEPENDENCIES) $(libalgebra_debug_la_LINK) $(am_libalgebra_debug_la_rpath) $(libalgebra_debug_la_OBJECTS) $(libalgebra_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-cholesky.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-det.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-eigen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-inv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-ls_solve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-lu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-qr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-schur.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_debug_la-svd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-cholesky.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-det.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-eigen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-inv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-ls_solve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-lu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-qr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-schur.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalgebra_la-svd.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libalgebra_la-cholesky.lo: $(top_srcdir)/itpp/base/algebra/cholesky.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-cholesky.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-cholesky.Tpo -c -o libalgebra_la-cholesky.lo `test -f '$(top_srcdir)/itpp/base/algebra/cholesky.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/cholesky.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-cholesky.Tpo $(DEPDIR)/libalgebra_la-cholesky.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/cholesky.cpp' object='libalgebra_la-cholesky.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-cholesky.lo `test -f '$(top_srcdir)/itpp/base/algebra/cholesky.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/cholesky.cpp libalgebra_la-det.lo: $(top_srcdir)/itpp/base/algebra/det.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-det.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-det.Tpo -c -o libalgebra_la-det.lo `test -f '$(top_srcdir)/itpp/base/algebra/det.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/det.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-det.Tpo $(DEPDIR)/libalgebra_la-det.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/det.cpp' object='libalgebra_la-det.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-det.lo `test -f '$(top_srcdir)/itpp/base/algebra/det.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/det.cpp libalgebra_la-eigen.lo: $(top_srcdir)/itpp/base/algebra/eigen.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-eigen.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-eigen.Tpo -c -o libalgebra_la-eigen.lo `test -f '$(top_srcdir)/itpp/base/algebra/eigen.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/eigen.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-eigen.Tpo $(DEPDIR)/libalgebra_la-eigen.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/eigen.cpp' object='libalgebra_la-eigen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-eigen.lo `test -f '$(top_srcdir)/itpp/base/algebra/eigen.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/eigen.cpp libalgebra_la-inv.lo: $(top_srcdir)/itpp/base/algebra/inv.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-inv.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-inv.Tpo -c -o libalgebra_la-inv.lo `test -f '$(top_srcdir)/itpp/base/algebra/inv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/inv.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-inv.Tpo $(DEPDIR)/libalgebra_la-inv.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/inv.cpp' object='libalgebra_la-inv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-inv.lo `test -f '$(top_srcdir)/itpp/base/algebra/inv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/inv.cpp libalgebra_la-ls_solve.lo: $(top_srcdir)/itpp/base/algebra/ls_solve.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-ls_solve.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-ls_solve.Tpo -c -o libalgebra_la-ls_solve.lo `test -f '$(top_srcdir)/itpp/base/algebra/ls_solve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/ls_solve.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-ls_solve.Tpo $(DEPDIR)/libalgebra_la-ls_solve.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/ls_solve.cpp' object='libalgebra_la-ls_solve.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-ls_solve.lo `test -f '$(top_srcdir)/itpp/base/algebra/ls_solve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/ls_solve.cpp libalgebra_la-lu.lo: $(top_srcdir)/itpp/base/algebra/lu.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-lu.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-lu.Tpo -c -o libalgebra_la-lu.lo `test -f '$(top_srcdir)/itpp/base/algebra/lu.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/lu.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-lu.Tpo $(DEPDIR)/libalgebra_la-lu.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/lu.cpp' object='libalgebra_la-lu.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-lu.lo `test -f '$(top_srcdir)/itpp/base/algebra/lu.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/lu.cpp libalgebra_la-qr.lo: $(top_srcdir)/itpp/base/algebra/qr.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-qr.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-qr.Tpo -c -o libalgebra_la-qr.lo `test -f '$(top_srcdir)/itpp/base/algebra/qr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/qr.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-qr.Tpo $(DEPDIR)/libalgebra_la-qr.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/qr.cpp' object='libalgebra_la-qr.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-qr.lo `test -f '$(top_srcdir)/itpp/base/algebra/qr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/qr.cpp libalgebra_la-schur.lo: $(top_srcdir)/itpp/base/algebra/schur.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-schur.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-schur.Tpo -c -o libalgebra_la-schur.lo `test -f '$(top_srcdir)/itpp/base/algebra/schur.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/schur.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-schur.Tpo $(DEPDIR)/libalgebra_la-schur.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/schur.cpp' object='libalgebra_la-schur.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-schur.lo `test -f '$(top_srcdir)/itpp/base/algebra/schur.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/schur.cpp libalgebra_la-svd.lo: $(top_srcdir)/itpp/base/algebra/svd.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_la-svd.lo -MD -MP -MF $(DEPDIR)/libalgebra_la-svd.Tpo -c -o libalgebra_la-svd.lo `test -f '$(top_srcdir)/itpp/base/algebra/svd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/svd.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_la-svd.Tpo $(DEPDIR)/libalgebra_la-svd.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/svd.cpp' object='libalgebra_la-svd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_la-svd.lo `test -f '$(top_srcdir)/itpp/base/algebra/svd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/svd.cpp libalgebra_debug_la-cholesky.lo: $(top_srcdir)/itpp/base/algebra/cholesky.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-cholesky.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-cholesky.Tpo -c -o libalgebra_debug_la-cholesky.lo `test -f '$(top_srcdir)/itpp/base/algebra/cholesky.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/cholesky.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-cholesky.Tpo $(DEPDIR)/libalgebra_debug_la-cholesky.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/cholesky.cpp' object='libalgebra_debug_la-cholesky.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-cholesky.lo `test -f '$(top_srcdir)/itpp/base/algebra/cholesky.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/cholesky.cpp libalgebra_debug_la-det.lo: $(top_srcdir)/itpp/base/algebra/det.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-det.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-det.Tpo -c -o libalgebra_debug_la-det.lo `test -f '$(top_srcdir)/itpp/base/algebra/det.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/det.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-det.Tpo $(DEPDIR)/libalgebra_debug_la-det.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/det.cpp' object='libalgebra_debug_la-det.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-det.lo `test -f '$(top_srcdir)/itpp/base/algebra/det.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/det.cpp libalgebra_debug_la-eigen.lo: $(top_srcdir)/itpp/base/algebra/eigen.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-eigen.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-eigen.Tpo -c -o libalgebra_debug_la-eigen.lo `test -f '$(top_srcdir)/itpp/base/algebra/eigen.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/eigen.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-eigen.Tpo $(DEPDIR)/libalgebra_debug_la-eigen.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/eigen.cpp' object='libalgebra_debug_la-eigen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-eigen.lo `test -f '$(top_srcdir)/itpp/base/algebra/eigen.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/eigen.cpp libalgebra_debug_la-inv.lo: $(top_srcdir)/itpp/base/algebra/inv.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-inv.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-inv.Tpo -c -o libalgebra_debug_la-inv.lo `test -f '$(top_srcdir)/itpp/base/algebra/inv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/inv.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-inv.Tpo $(DEPDIR)/libalgebra_debug_la-inv.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/inv.cpp' object='libalgebra_debug_la-inv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-inv.lo `test -f '$(top_srcdir)/itpp/base/algebra/inv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/inv.cpp libalgebra_debug_la-ls_solve.lo: $(top_srcdir)/itpp/base/algebra/ls_solve.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-ls_solve.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-ls_solve.Tpo -c -o libalgebra_debug_la-ls_solve.lo `test -f '$(top_srcdir)/itpp/base/algebra/ls_solve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/ls_solve.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-ls_solve.Tpo $(DEPDIR)/libalgebra_debug_la-ls_solve.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/ls_solve.cpp' object='libalgebra_debug_la-ls_solve.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-ls_solve.lo `test -f '$(top_srcdir)/itpp/base/algebra/ls_solve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/ls_solve.cpp libalgebra_debug_la-lu.lo: $(top_srcdir)/itpp/base/algebra/lu.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-lu.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-lu.Tpo -c -o libalgebra_debug_la-lu.lo `test -f '$(top_srcdir)/itpp/base/algebra/lu.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/lu.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-lu.Tpo $(DEPDIR)/libalgebra_debug_la-lu.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/lu.cpp' object='libalgebra_debug_la-lu.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-lu.lo `test -f '$(top_srcdir)/itpp/base/algebra/lu.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/lu.cpp libalgebra_debug_la-qr.lo: $(top_srcdir)/itpp/base/algebra/qr.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-qr.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-qr.Tpo -c -o libalgebra_debug_la-qr.lo `test -f '$(top_srcdir)/itpp/base/algebra/qr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/qr.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-qr.Tpo $(DEPDIR)/libalgebra_debug_la-qr.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/qr.cpp' object='libalgebra_debug_la-qr.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-qr.lo `test -f '$(top_srcdir)/itpp/base/algebra/qr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/qr.cpp libalgebra_debug_la-schur.lo: $(top_srcdir)/itpp/base/algebra/schur.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-schur.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-schur.Tpo -c -o libalgebra_debug_la-schur.lo `test -f '$(top_srcdir)/itpp/base/algebra/schur.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/schur.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-schur.Tpo $(DEPDIR)/libalgebra_debug_la-schur.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/schur.cpp' object='libalgebra_debug_la-schur.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-schur.lo `test -f '$(top_srcdir)/itpp/base/algebra/schur.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/schur.cpp libalgebra_debug_la-svd.lo: $(top_srcdir)/itpp/base/algebra/svd.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libalgebra_debug_la-svd.lo -MD -MP -MF $(DEPDIR)/libalgebra_debug_la-svd.Tpo -c -o libalgebra_debug_la-svd.lo `test -f '$(top_srcdir)/itpp/base/algebra/svd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/svd.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalgebra_debug_la-svd.Tpo $(DEPDIR)/libalgebra_debug_la-svd.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/algebra/svd.cpp' object='libalgebra_debug_la-svd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalgebra_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libalgebra_debug_la-svd.lo `test -f '$(top_srcdir)/itpp/base/algebra/svd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/algebra/svd.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/base/algebra/cholesky.cpp000066400000000000000000000050231216575753400203220ustar00rootroot00000000000000/*! * \file * \brief Implementation of Cholesky factorisation functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include namespace itpp { #if defined(HAVE_LAPACK) bool chol(const mat &X, mat &F) { char uplo = 'U'; int n, lda, info; n = lda = X.rows(); F = X; // input matrix is overwritten dpotrf_(&uplo, &n, F._data(), &lda, &info); // Set lower part to zero for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) F(j, i) = 0; return (info == 0); } bool chol(const cmat &X, cmat &F) { char uplo = 'U'; int n, lda, info; n = lda = X.rows(); F = X; // input matrix is overwritten zpotrf_(&uplo, &n, F._data(), &lda, &info); // Set lower part to zero for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) F(j, i) = 0; return (info == 0); } #else // HAVE_LAPACK bool chol(const mat &X, mat &F) { it_error("LAPACK library is needed to use chol() function"); return false; } bool chol(const cmat &X, cmat &F) { it_error("LAPACK library is needed to use chol() function"); return false; } #endif // HAVE_LAPACK cmat chol(const cmat &X) { cmat F; if (!chol(X, F)) { it_warning("cholesky factorization didn't succeed"); } return F; } mat chol(const mat &X) { mat F; if (!chol(X, F)) { it_warning("cholesky factorization didn't succeed"); } return F; } } // namespace itpp itpp-4.3.1/itpp/base/algebra/cholesky.h000066400000000000000000000061451216575753400177750ustar00rootroot00000000000000/*! * \file * \brief Definitions of Cholesky factorisation functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CHOLESKY_H #define CHOLESKY_H #include #include namespace itpp { /*! \addtogroup matrixdecomp */ //!@{ /*! \brief Cholesky factorisation of real symmetric and positive definite matrix The Cholesky factorisation of a real symmetric positive-definite matrix \f$\mathbf{X}\f$ of size \f$n \times n\f$ is given by \f[ \mathbf{X} = \mathbf{F}^T \mathbf{F} \f] where \f$\mathbf{F}\f$ is an upper triangular \f$n \times n\f$ matrix. Returns true if calculation succeeded. False otherwise. */ ITPP_EXPORT bool chol(const mat &X, mat &F); /*! \brief Cholesky factorisation of real symmetric and positive definite matrix The Cholesky factorisation of a real symmetric positive-definite matrix \f$\mathbf{X}\f$ of size \f$n \times n\f$ is given by \f[ \mathbf{X} = \mathbf{F}^T \mathbf{F} \f] where \f$\mathbf{F}\f$ is an upper triangular \f$n \times n\f$ matrix. */ ITPP_EXPORT mat chol(const mat &X); /*! \brief Cholesky factorisation of complex hermitian and positive-definite matrix The Cholesky factorisation of a hermitian positive-definite matrix \f$\mathbf{X}\f$ of size \f$n \times n\f$ is given by \f[ \mathbf{X} = \mathbf{F}^H \mathbf{F} \f] where \f$\mathbf{F}\f$ is an upper triangular \f$n \times n\f$ matrix. Returns true if calculation succeeded. False otherwise. If \c X is positive definite, true is returned and \c F=chol(X) produces an upper triangular \c F. If also \c X is symmetric then \c F'*F = X. If \c X is not positive definite, false is returned. */ ITPP_EXPORT bool chol(const cmat &X, cmat &F); /*! \brief Cholesky factorisation of complex hermitian and positive-definite matrix The Cholesky factorisation of a hermitian positive-definite matrix \f$\mathbf{X}\f$ of size \f$n \times n\f$ is given by \f[ \mathbf{X} = \mathbf{F}^H \mathbf{F} \f] where \f$\mathbf{F}\f$ is an upper triangular \f$n \times n\f$ matrix. */ ITPP_EXPORT cmat chol(const cmat &X); //!@} } // namespace itpp #endif // #ifndef CHOLESKY_H itpp-4.3.1/itpp/base/algebra/det.cpp000066400000000000000000000051041216575753400172550ustar00rootroot00000000000000/*! * \file * \brief Implementation of determinant calculations * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { /* Determinant of square matrix. Calculate determinant of inmatrix (Uses LU-factorisation) (See Theorem 3.2.1 p. 97 in Golub & van Loan, "Matrix Computations"). det(X) = det(P')*det(L)*det(U) = det(P')*1*prod(diag(U)) */ double det(const mat &X) { it_assert_debug(X.rows() == X.cols(), "det : Only square matrices"); mat L, U; ivec p; double s = 1.0; int i; lu(X, L, U, p); // calculate LU-factorisation double temp = U(0, 0); for (i = 1;i < X.rows();i++) { temp *= U(i, i); } // Calculate det(P'). Equal to (-1)^(no row changes) for (i = 0; i < p.size(); i++) if (i != p(i)) s *= -1.0; return temp*s; } /* Determinant of complex square matrix. Calculate determinant of inmatrix (Uses LU-factorisation) (See Theorem 3.2.1 p. 97 in Golub & van Loan, "Matrix Computations"). det(X) = det(P')*det(L)*det(U) = det(P')*1*prod(diag(U)) Needs LU-factorization of complex matrices (LAPACK) */ std::complex det(const cmat &X) { it_assert_debug(X.rows() == X.cols(), "det : Only square matrices"); int i; cmat L, U; ivec p; double s = 1.0; lu(X, L, U, p); // calculate LU-factorisation std::complex temp = U(0, 0); for (i = 1;i < X.rows();i++) { temp *= U(i, i); } // Calculate det(P'). Equal to (-1)^(no row changes) for (i = 0; i < p.size(); i++) if (i != p(i)) s *= -1.0; return temp*s; } } // namespace itpp itpp-4.3.1/itpp/base/algebra/det.h000066400000000000000000000041541216575753400167260ustar00rootroot00000000000000/*! * \file * \brief Definitions of determinant calculations * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef DET_H #define DET_H #include #include namespace itpp { /*! \brief Determinant of real square matrix. \ingroup determinant Calculate determinant of the real matrix \f$\mathbf{X}\f$ Uses LU-factorisation. \f[ \det(\mathbf{X}) = \det(\mathbf{P}^T \mathbf{L}) \det(\mathbf{U}) = \det(\mathbf{P}^T) \prod(\mathrm{diag}(\mathbf{U})) \f] and the determinant of the permuation matrix is \f$ \pm 1\f$ depending on the number of row permutations */ ITPP_EXPORT double det(const mat &X); /*! \brief Determinant of complex square matrix. \ingroup determinant Calculate determinant of the complex matrix \f$\mathbf{X}\f$ Uses LU-factorisation. \f[ \det(\mathbf{X}) = \det(\mathbf{P}^T \mathbf{L}) \det(\mathbf{U}) = \det(\mathbf{P}^T) \prod(\mathrm{diag}(\mathbf{U})) \f] and the determinant of the permuation matrix is \f$ \pm 1\f$ depending on the number of row permutations */ ITPP_EXPORT std::complex det(const cmat &X); } // namespace itpp #endif // #ifndef DET_H itpp-4.3.1/itpp/base/algebra/eigen.cpp000066400000000000000000000173471216575753400176040ustar00rootroot00000000000000/*! * \file * \brief Eigenvalue decomposition functions. * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include #include namespace itpp { #if defined(HAVE_LAPACK) bool eig_sym(const mat &A, vec &d, mat &V) { it_assert_debug(A.rows() == A.cols(), "eig_sym: Matrix is not symmetric"); // Test for symmetric? char jobz = 'V', uplo = 'U'; int n, lda, lwork, info; n = lda = A.rows(); lwork = std::max(1, 3 * n - 1); // This may be choosen better! d.set_size(n, false); vec work(lwork); V = A; // The routine overwrites input matrix with eigenvectors dsyev_(&jobz, &uplo, &n, V._data(), &lda, d._data(), work._data(), &lwork, &info); return (info == 0); } bool eig_sym(const mat &A, vec &d) { it_assert_debug(A.rows() == A.cols(), "eig_sym: Matrix is not symmetric"); // Test for symmetric? char jobz = 'N', uplo = 'U'; int n, lda, lwork, info; n = lda = A.rows(); lwork = std::max(1, 3 * n - 1); // This may be choosen better! d.set_size(n, false); vec work(lwork); mat B(A); // The routine overwrites input matrix dsyev_(&jobz, &uplo, &n, B._data(), &lda, d._data(), work._data(), &lwork, &info); return (info == 0); } bool eig_sym(const cmat &A, vec &d, cmat &V) { it_assert_debug(A.rows() == A.cols(), "eig_sym: Matrix is not hermitian"); // Test for symmetric? char jobz = 'V', uplo = 'U'; int n, lda, lwork, info; n = lda = A.rows(); lwork = std::max(1, 2 * n - 1); // This may be choosen better! d.set_size(n, false); cvec work(lwork); vec rwork(std::max(1, 3*n - 2)); // This may be choosen better! V = A; // The routine overwrites input matrix with eigenvectors zheev_(&jobz, &uplo, &n, V._data(), &lda, d._data(), work._data(), &lwork, rwork._data(), &info); return (info == 0); } bool eig_sym(const cmat &A, vec &d) { it_assert_debug(A.rows() == A.cols(), "eig_sym: Matrix is not hermitian"); // Test for symmetric? char jobz = 'N', uplo = 'U'; int n, lda, lwork, info; n = lda = A.rows(); lwork = std::max(1, 2 * n - 1); // This may be choosen better! d.set_size(n, false); cvec work(lwork); vec rwork(std::max(1, 3*n - 2)); // This may be choosen better! cmat B(A); // The routine overwrites input matrix zheev_(&jobz, &uplo, &n, B._data(), &lda, d._data(), work._data(), &lwork, rwork._data(), &info); return (info == 0); } // Non-symmetric matrix bool eig(const mat &A, cvec &d, cmat &V) { it_assert_debug(A.rows() == A.cols(), "eig: Matrix is not square"); char jobvl = 'N', jobvr = 'V'; int n, lda, ldvl, ldvr, lwork, info; n = lda = A.rows(); ldvl = 1; ldvr = n; lwork = std::max(1, 4 * n); // This may be choosen better! vec work(lwork); vec rwork(std::max(1, 2*n)); // This may be choosen better vec wr(n), wi(n); mat vl, vr(n, n); mat B(A); // The routine overwrites input matrix dgeev_(&jobvl, &jobvr, &n, B._data(), &lda, wr._data(), wi._data(), vl._data(), &ldvl, vr._data(), &ldvr, work._data(), &lwork, &info); d = to_cvec(wr, wi); // Fix V V.set_size(n, n, false); for (int j = 0; j < n; j++) { // if d(j) and d(j+1) are complex conjugate pairs, treat special if ((j < n - 1) && d(j) == std::conj(d(j + 1))) { V.set_col(j, to_cvec(vr.get_col(j), vr.get_col(j + 1))); V.set_col(j + 1, to_cvec(vr.get_col(j), -vr.get_col(j + 1))); j++; } else { V.set_col(j, to_cvec(vr.get_col(j))); } } return (info == 0); } // Non-symmetric matrix bool eig(const mat &A, cvec &d) { it_assert_debug(A.rows() == A.cols(), "eig: Matrix is not square"); char jobvl = 'N', jobvr = 'N'; int n, lda, ldvl, ldvr, lwork, info; n = lda = A.rows(); ldvl = 1; ldvr = 1; lwork = std::max(1, 4 * n); // This may be choosen better! vec work(lwork); vec rwork(std::max(1, 2*n)); // This may be choosen better vec wr(n), wi(n); mat vl, vr; mat B(A); // The routine overwrites input matrix dgeev_(&jobvl, &jobvr, &n, B._data(), &lda, wr._data(), wi._data(), vl._data(), &ldvl, vr._data(), &ldvr, work._data(), &lwork, &info); d = to_cvec(wr, wi); return (info == 0); } bool eig(const cmat &A, cvec &d, cmat &V) { it_assert_debug(A.rows() == A.cols(), "eig: Matrix is not square"); char jobvl = 'N', jobvr = 'V'; int n, lda, ldvl, ldvr, lwork, info; n = lda = A.rows(); ldvl = 1; ldvr = n; lwork = std::max(1, 2 * n); // This may be choosen better! d.set_size(n, false); V.set_size(n, n, false); cvec work(lwork); vec rwork(std::max(1, 2*n)); // This may be choosen better! cmat vl; cmat B(A); // The routine overwrites input matrix zgeev_(&jobvl, &jobvr, &n, B._data(), &lda, d._data(), vl._data(), &ldvl, V._data(), &ldvr, work._data(), &lwork, rwork._data(), &info); return (info == 0); } bool eig(const cmat &A, cvec &d) { it_assert_debug(A.rows() == A.cols(), "eig: Matrix is not square"); char jobvl = 'N', jobvr = 'N'; int n, lda, ldvl, ldvr, lwork, info; n = lda = A.rows(); ldvl = 1; ldvr = 1; lwork = std::max(1, 2 * n); // This may be choosen better! d.set_size(n, false); cvec work(lwork); vec rwork(std::max(1, 2*n)); // This may be choosen better! cmat vl, vr; cmat B(A); // The routine overwrites input matrix zgeev_(&jobvl, &jobvr, &n, B._data(), &lda, d._data(), vl._data(), &ldvl, vr._data(), &ldvr, work._data(), &lwork, rwork._data(), &info); return (info == 0); } #else bool eig_sym(const mat &A, vec &d, mat &V) { it_error("LAPACK library is needed to use eig_sym() function"); return false; } bool eig_sym(const mat &A, vec &d) { it_error("LAPACK library is needed to use eig_sym() function"); return false; } bool eig_sym(const cmat &A, vec &d, cmat &V) { it_error("LAPACK library is needed to use eig_sym() function"); return false; } bool eig_sym(const cmat &A, vec &d) { it_error("LAPACK library is needed to use eig_sym() function"); return false; } bool eig(const mat &A, cvec &d, cmat &V) { it_error("LAPACK library is needed to use eig() function"); return false; } bool eig(const mat &A, cvec &d) { it_error("LAPACK library is needed to use eig() function"); return false; } bool eig(const cmat &A, cvec &d, cmat &V) { it_error("LAPACK library is needed to use eig() function"); return false; } bool eig(const cmat &A, cvec &d) { it_error("LAPACK library is needed to use eig() function"); return false; } #endif // HAVE_LAPACK vec eig_sym(const mat &A) { vec d; eig_sym(A, d); return d; } vec eig_sym(const cmat &A) { vec d; eig_sym(A, d); return d; } cvec eig(const mat &A) { cvec d; eig(A, d); return d; } cvec eig(const cmat &A) { cvec d; eig(A, d); return d; } } //namespace itpp itpp-4.3.1/itpp/base/algebra/eigen.h000066400000000000000000000166361216575753400172510ustar00rootroot00000000000000/*! * \file * \brief Definitions of eigenvalue decomposition functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef EIGEN_H #define EIGEN_H #include #include namespace itpp { /*! \ingroup matrixdecomp \brief Calculates the eigenvalues and eigenvectors of a symmetric real matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real and symmetric \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] The eigenvectors are the columns of the matrix V. True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine DSYEV. */ ITPP_EXPORT bool eig_sym(const mat &A, vec &d, mat &V); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a symmetric real matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real and symmetric \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine DSYEV. */ ITPP_EXPORT bool eig_sym(const mat &A, vec &d); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a symmetric real matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real and symmetric \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] Uses the LAPACK routine DSYEV. */ ITPP_EXPORT vec eig_sym(const mat &A); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues and eigenvectors of a hermitian complex matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex and hermitian \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] The eigenvectors are the columns of the matrix V. True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine ZHEEV. */ ITPP_EXPORT bool eig_sym(const cmat &A, vec &d, cmat &V); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a hermitian complex matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex and hermitian \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine ZHEEV. */ ITPP_EXPORT bool eig_sym(const cmat &A, vec &d); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a hermitian complex matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex and hermitian \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] Uses the LAPACK routine ZHEEV. */ ITPP_EXPORT vec eig_sym(const cmat &A); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues and eigenvectors of a real non-symmetric matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] The eigenvectors are the columns of the matrix V. True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine DGEEV. */ ITPP_EXPORT bool eig(const mat &A, cvec &d, cmat &V); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a real non-symmetric matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine DGEEV. */ ITPP_EXPORT bool eig(const mat &A, cvec &d); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a real non-symmetric matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] Uses the LAPACK routine DGEEV. */ ITPP_EXPORT cvec eig(const mat &A); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues and eigenvectors of a complex non-hermitian matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] The eigenvectors are the columns of the matrix V. True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine ZGEEV. */ ITPP_EXPORT bool eig(const cmat &A, cvec &d, cmat &V); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a complex non-hermitian matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] True is returned if the calculation was successful. Otherwise false. Uses the LAPACK routine ZGEEV. */ ITPP_EXPORT bool eig(const cmat &A, cvec &d); /*! \ingroup matrixdecomp \brief Calculates the eigenvalues of a complex non-hermitian matrix The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex \f$n \times n\f$ matrix \f$\mathbf{A}\f$ satisfies \f[ \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. \f] Uses the LAPACK routine ZGEEV. */ ITPP_EXPORT cvec eig(const cmat &A); } // namespace itpp #endif // #ifndef EIGEN_H itpp-4.3.1/itpp/base/algebra/inv.cpp000066400000000000000000000050521216575753400172770ustar00rootroot00000000000000/*! * \file * \brief Implementation of matrix inversion routines * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include namespace itpp { #if defined(HAVE_LAPACK) bool inv(const mat &X, mat &Y) { it_assert_debug(X.rows() == X.cols(), "inv: matrix is not square"); int m = X.rows(), info, lwork; lwork = m; // may be choosen better ivec p(m); Y = X; vec work(lwork); dgetrf_(&m, &m, Y._data(), &m, p._data(), &info); // LU-factorization if (info != 0) return false; dgetri_(&m, Y._data(), &m, p._data(), work._data(), &lwork, &info); return (info == 0); } bool inv(const cmat &X, cmat &Y) { it_assert_debug(X.rows() == X.cols(), "inv: matrix is not square"); int m = X.rows(), info, lwork; lwork = m; // may be choosen better ivec p(m); Y = X; cvec work(lwork); zgetrf_(&m, &m, Y._data(), &m, p._data(), &info); // LU-factorization if (info != 0) return false; zgetri_(&m, Y._data(), &m, p._data(), work._data(), &lwork, &info); return (info == 0); } #else bool inv(const mat &X, mat &Y) { it_error("LAPACK library is needed to use inv() function"); return false; } bool inv(const cmat &X, cmat &Y) { it_error("LAPACK library is needed to use inv() function"); return false; } #endif // HAVE_LAPACK cmat inv(const cmat &X) { cmat Y; inv(X, Y); return Y; } mat inv(const mat &X) { mat Y; inv(X, Y); return Y; } } // namespace itpp itpp-4.3.1/itpp/base/algebra/inv.h000066400000000000000000000051151216575753400167440ustar00rootroot00000000000000/*! * \file * \brief Definitions of matrix inversion routines * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef INV_H #define INV_H #include #include namespace itpp { /*! \brief Inverse of real square matrix. \ingroup inverse Calculate the inverse of the real matrix \f$\mathbf{X}\f$ Solves the equation system \f$ \mathbf{Y} \mathbf{X} = \mathbf{I}\f$ using LU-factorization. IT++ needs to be compiled with the LAPACK for the inverse to be available. */ ITPP_EXPORT bool inv(const mat &X, mat &Y); /*! \brief Inverse of real square matrix. \ingroup inverse Calculate the inverse of the real matrix \f$\mathbf{X}\f$ Solves the equation system \f$ \mathbf{Y} \mathbf{X} = \mathbf{I}\f$ using LU-factorization. IT++ needs to be compiled with LAPACK support for the inverse to be available. */ ITPP_EXPORT mat inv(const mat &X); /*! \brief Inverse of complex square matrix. \ingroup inverse Calculate the inverse of the complex matrix \f$\mathbf{X}\f$ Solves the equation system \f$ \mathbf{Y} \mathbf{X} = \mathbf{I}\f$ using LU-factorization. IT++ needs to be compiled with LAPACK support for the inverse to be available. */ ITPP_EXPORT bool inv(const cmat &X, cmat &Y); /*! \brief Inverse of real square matrix. \ingroup inverse Calculate the inverse of the complex matrix \f$\mathbf{X}\f$ Solves the equation system \f$ \mathbf{Y} \mathbf{X} = \mathbf{I}\f$ using LU-factorization. IT++ needs to be compiled with the LAPACK for the inverse to be available. */ ITPP_EXPORT cmat inv(const cmat &X); } // namespace itpp #endif // #ifndef INV_H itpp-4.3.1/itpp/base/algebra/lapack.h000077500000000000000000000241071216575753400174100ustar00rootroot00000000000000/*! * \file * \brief Lapack header functions. For internal use only. * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef LAPACK_H #define LAPACK_H #ifndef _MSC_VER # include #else # include #endif #include // Note: HAVE_MKL and HAVE_ACML are hard-defined in #if defined(_MSC_VER) && (defined(HAVE_ACML) || defined(HAVE_MKL)) # define dgetrf_ DGETRF # define zgetrf_ ZGETRF # define dgetri_ DGETRI # define zgetri_ ZGETRI # define dgesvd_ DGESVD # define zgesvd_ ZGESVD # define dsyev_ DSYEV # define zheev_ ZHEEV # define dgeev_ DGEEV # define zgeev_ ZGEEV # define dpotrf_ DPOTRF # define zpotrf_ ZPOTRF # define dgeqrf_ DGEQRF # define zgeqrf_ ZGEQRF # define dgeqp3_ DGEQP3 # define zgeqp3_ ZGEQP3 # define dorgqr_ DORGQR # define zungqr_ ZUNGQR # define dormqr_ DORMQR # define zunmqr_ ZUNMQR # define dgesv_ DGESV # define zgesv_ ZGESV # define dposv_ DPOSV # define zposv_ ZPOSV # define dtrtrs_ DTRTRS # define ztrtrs_ ZTRTRS # define dgels_ DGELS # define zgels_ ZGELS # define dgees_ DGEES # define zgees_ ZGEES #endif // #if defined(_MSC_VER) && (defined(HAVE_ACML) || defined(HAVE_MKL)) #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ // Exists in ATLAS /* LU factorization * a is of size m*n and with lda rows. * ipiv is the permutation vector of rows. Row i should be replaced by row * ipiv(i). * info=0 if OK. info=-i if ith value is illegal. info=i factorization OK * but the system is singular if solved. */ void dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info); void zgetrf_(int *m, int *n, std::complex *a, int *lda, int *ipiv, int *info); // In ATLAS /* Inverting a matrix of an LU-factored general matrix (first call xGETRF) * a is of square size n*n with lda rows containing the factorization as * returned by xGETRF * ipiv is vector as returned by xGETRF * lwork >= n * output: a is overwritten by the inverse * info=0 if OK. info=-i if ith parameter is illegal. info=i the ith * diagonal element = 0 and U is singular. */ void dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info); void zgetri_(int *n, std::complex *a, int *lda, int *ipiv, std::complex *work, int *lwork, int *info); /* SVD of a general rectangular matrix A = U S V^H a is of size m*n and with lda rows. Output: s with sorted singular values (vector) u, and vt (for U and V^H). U is m*m, and V^H is n*n jobu='A','S','O','N'. Different versions. 'A' = all columns of U calculated and returned in u. jobvt='A','S','O','N'. Different versions. 'A' = all columns of V^H calculated and returned in vt. ldu = no rows in U ldvt = no rows in V^H info = 0 successful, = -i ith parameter is illegal, = i did not converge work is a workspace vector of size lwork. lwork >= max(3*min(m,n)+max(m,n), 5*min(m,n)) for double lwork >= 2*min(m,n)+max(m,n) for std::complex Good performance. Make lwork larger! rwork is a workspace array for complex version. Size max(1, 5*min(m,n)). */ void dgesvd_(char *jobu, char *jobvt, int *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info); void zgesvd_(char *jobu, char *jobvt, int *m, int *n, std::complex *a, int *lda, double *s, std::complex *u, int *ldu, std::complex *vt, int *ldvt, std::complex *work, int *lwork, double *rwork, int *info); /* Eigenvalues and eigenvectors of a symmetric/hermitian matrix A */ void dsyev_(char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *info); void zheev_(char *jobz, char *uplo, int *n, std::complex *a, int *lda, double *w, std::complex *work, int *lwork, double *rwork, int *info); /* Eigenvalues and eigenvectors of a general matrix A */ void dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wi, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info); void zgeev_(char *jobvl, char *jobvr, int *n, std::complex *a, int *lda, std::complex *w, std::complex *vl, int *ldvl, std::complex *vr, int *ldvr, std::complex *work, int *lwork, double *rwork, int *info); // In ATLAS /* Cholesky factorization */ void dpotrf_(char *uplo, int *n, double *a, int *lda, int *info); void zpotrf_(char *uplo, int *n, std::complex *a, int *lda, int *info); /* QR factorization of a general matrix A */ void dgeqrf_(int *m, int *n, double *a, int *lda, double *tau, double *work, int *lwork, int *info); void zgeqrf_(int *m, int *n, std::complex *a, int *lda, std::complex *tau, std::complex *work, int *lwork, int *info); /* QR factorization of a general matrix A with pivoting */ void dgeqp3_(int *m, int *n, double *a, int *lda, int *jpvt, double *tau, double *work, int *lwork, int *info); void zgeqp3_(int *m, int *n, std::complex *a, int *lda, int *jpvt, std::complex *tau, std::complex *work, int *lwork, double *rwork, int *info); /* Calculation of Q matrix from QR-factorization */ void dorgqr_(int *m, int *n, int *k, double *a, int *lda, double *tau, double *work, int *lwork, int *info); void zungqr_(int *m, int *n, int *k, std::complex *a, int *lda, std::complex *tau, std::complex *work, int *lwork, int *info); /* * Multiplies a real matrix by the orthogonal matix Q of the QR * factorization formed by dgeqp3_() */ void dormqr_(char *side, char *trans, int *m, int *n, int *k, double *a, int *lda, double *tau, double *c, int *ldc, double *work, int *lwork, int *info); /* * Multiplies a complex matrix by the unitary matix Q of the QR * factorization formed by zgeqp3_() */ void zunmqr_(char *side, char *trans, int *m, int *n, int *k, std::complex *a, int *lda, std::complex *tau, std::complex *c, int *ldc, std::complex *work, int *lwork, int *info); // In ATLAS /* * Solves a system on linear equations, Ax=b, with a square matrix A, * Using LU-factorization */ void dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info); void zgesv_(int *n, int *nrhs, std::complex *a, int *lda, int *ipiv, std::complex *b, int *ldb, int *info); // In ATLAS /* * Solves a system on linear equations, Ax=b, with a square * symmetric/hermitian positive definite matrix A, using * Cholesky-factorization */ void dposv_(char *uplo, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, int *info); void zposv_(char *uplo, int *n, int *nrhs, std::complex *a, int *lda, std::complex *b, int *ldb, int *info); /* * Solves a system of linear equations with a triangular matrix with * multiple right-hand sides */ void dtrtrs_(char *uplo, char *trans, char *diag, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, int *info); void ztrtrs_(char *uplo, char *trans, char *diag, int *n, int *nrhs, std::complex *a, int *lda, std::complex *b, int *ldb, int *info); /* * Solves a linear over/underdetermined system using QR or LQ * factorization. Assumes a full rank matrix */ void dgels_(char *trans, int *m, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *work, int *lwork, int *info); void zgels_(char *trans, int *m, int *n, int *nrhs, std::complex *a, int *lda, std::complex *b, int *ldb, std::complex *work, int *lwork, int *info); /* * Compute for an N-by-N real nonsymmetric matrix A, the eigenvalues, * the real Schur form T, and, optionally, the matrix of Schur vectors Z */ void dgees_(char *jobvs, char *sort, int* select, int *n, double *a, int *lda, int *sdim, double *wr, double *wi, double *vs, int *ldvs, double *work, int *lwork, int *bwork, int *info); /* * Compute for an N-by-N complex nonsymmetric matrix A, the eigenvalues, * the Schur form T, and, optionally, the matrix of Schur vectors Z */ void zgees_(char *jobvs, char *sort, int* select, int *n, std::complex *a, int *lda, int *sdim, std::complex *w, std::complex *vs, int *ldvs, std::complex *work, int *lwork, double *rwork, int *bwork, int *info); #ifdef __cplusplus } // extern C #endif /* __cplusplus */ #endif // #ifndef LAPACK_H itpp-4.3.1/itpp/base/algebra/ls_solve.cpp000066400000000000000000000467101216575753400203370ustar00rootroot00000000000000/*! * \file * \brief Implementation of functions for solving linear equation systems * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include namespace itpp { // ----------- ls_solve_chol ----------------------------------------------------------- #if defined(HAVE_LAPACK) bool ls_solve_chol(const mat &A, const vec &b, vec &x) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = 1; char uplo = 'U'; it_assert_debug(A.cols() == n, "ls_solve_chol: System-matrix is not square"); it_assert_debug(n == b.size(), "The number of rows in A must equal the length of b!"); ivec ipiv(n); x = b; mat Chol = A; dposv_(&uplo, &n, &nrhs, Chol._data(), &lda, x._data(), &ldb, &info); return (info == 0); } bool ls_solve_chol(const mat &A, const mat &B, mat &X) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = B.cols(); char uplo = 'U'; it_assert_debug(A.cols() == n, "ls_solve_chol: System-matrix is not square"); it_assert_debug(n == B.rows(), "The number of rows in A must equal the length of B!"); ivec ipiv(n); X = B; mat Chol = A; dposv_(&uplo, &n, &nrhs, Chol._data(), &lda, X._data(), &ldb, &info); return (info == 0); } bool ls_solve_chol(const cmat &A, const cvec &b, cvec &x) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = 1; char uplo = 'U'; it_assert_debug(A.cols() == n, "ls_solve_chol: System-matrix is not square"); it_assert_debug(n == b.size(), "The number of rows in A must equal the length of b!"); ivec ipiv(n); x = b; cmat Chol = A; zposv_(&uplo, &n, &nrhs, Chol._data(), &lda, x._data(), &ldb, &info); return (info == 0); } bool ls_solve_chol(const cmat &A, const cmat &B, cmat &X) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = B.cols(); char uplo = 'U'; it_assert_debug(A.cols() == n, "ls_solve_chol: System-matrix is not square"); it_assert_debug(n == B.rows(), "The number of rows in A must equal the length of B!"); ivec ipiv(n); X = B; cmat Chol = A; zposv_(&uplo, &n, &nrhs, Chol._data(), &lda, X._data(), &ldb, &info); return (info == 0); } #else bool ls_solve_chol(const mat &A, const vec &b, vec &x) { it_error("LAPACK library is needed to use ls_solve_chol() function"); return false; } bool ls_solve_chol(const mat &A, const mat &B, mat &X) { it_error("LAPACK library is needed to use ls_solve_chol() function"); return false; } bool ls_solve_chol(const cmat &A, const cvec &b, cvec &x) { it_error("LAPACK library is needed to use ls_solve_chol() function"); return false; } bool ls_solve_chol(const cmat &A, const cmat &B, cmat &X) { it_error("LAPACK library is needed to use ls_solve_chol() function"); return false; } #endif // HAVE_LAPACK vec ls_solve_chol(const mat &A, const vec &b) { vec x; bool info; info = ls_solve_chol(A, b, x); it_assert_debug(info, "ls_solve_chol: Failed solving the system"); return x; } mat ls_solve_chol(const mat &A, const mat &B) { mat X; bool info; info = ls_solve_chol(A, B, X); it_assert_debug(info, "ls_solve_chol: Failed solving the system"); return X; } cvec ls_solve_chol(const cmat &A, const cvec &b) { cvec x; bool info; info = ls_solve_chol(A, b, x); it_assert_debug(info, "ls_solve_chol: Failed solving the system"); return x; } cmat ls_solve_chol(const cmat &A, const cmat &B) { cmat X; bool info; info = ls_solve_chol(A, B, X); it_assert_debug(info, "ls_solve_chol: Failed solving the system"); return X; } // --------- ls_solve --------------------------------------------------------------- #if defined(HAVE_LAPACK) bool ls_solve(const mat &A, const vec &b, vec &x) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = 1; it_assert_debug(A.cols() == n, "ls_solve: System-matrix is not square"); it_assert_debug(n == b.size(), "The number of rows in A must equal the length of b!"); ivec ipiv(n); x = b; mat LU = A; dgesv_(&n, &nrhs, LU._data(), &lda, ipiv._data(), x._data(), &ldb, &info); return (info == 0); } bool ls_solve(const mat &A, const mat &B, mat &X) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = B.cols(); it_assert_debug(A.cols() == n, "ls_solve: System-matrix is not square"); it_assert_debug(n == B.rows(), "The number of rows in A must equal the length of B!"); ivec ipiv(n); X = B; mat LU = A; dgesv_(&n, &nrhs, LU._data(), &lda, ipiv._data(), X._data(), &ldb, &info); return (info == 0); } bool ls_solve(const cmat &A, const cvec &b, cvec &x) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = 1; it_assert_debug(A.cols() == n, "ls_solve: System-matrix is not square"); it_assert_debug(n == b.size(), "The number of rows in A must equal the length of b!"); ivec ipiv(n); x = b; cmat LU = A; zgesv_(&n, &nrhs, LU._data(), &lda, ipiv._data(), x._data(), &ldb, &info); return (info == 0); } bool ls_solve(const cmat &A, const cmat &B, cmat &X) { int n, lda, ldb, nrhs, info; n = lda = ldb = A.rows(); nrhs = B.cols(); it_assert_debug(A.cols() == n, "ls_solve: System-matrix is not square"); it_assert_debug(n == B.rows(), "The number of rows in A must equal the length of B!"); ivec ipiv(n); X = B; cmat LU = A; zgesv_(&n, &nrhs, LU._data(), &lda, ipiv._data(), X._data(), &ldb, &info); return (info == 0); } #else bool ls_solve(const mat &A, const vec &b, vec &x) { it_error("LAPACK library is needed to use ls_solve() function"); return false; } bool ls_solve(const mat &A, const mat &B, mat &X) { it_error("LAPACK library is needed to use ls_solve() function"); return false; } bool ls_solve(const cmat &A, const cvec &b, cvec &x) { it_error("LAPACK library is needed to use ls_solve() function"); return false; } bool ls_solve(const cmat &A, const cmat &B, cmat &X) { it_error("LAPACK library is needed to use ls_solve() function"); return false; } #endif // HAVE_LAPACK vec ls_solve(const mat &A, const vec &b) { vec x; bool info; info = ls_solve(A, b, x); it_assert_debug(info, "ls_solve: Failed solving the system"); return x; } mat ls_solve(const mat &A, const mat &B) { mat X; bool info; info = ls_solve(A, B, X); it_assert_debug(info, "ls_solve: Failed solving the system"); return X; } cvec ls_solve(const cmat &A, const cvec &b) { cvec x; bool info; info = ls_solve(A, b, x); it_assert_debug(info, "ls_solve: Failed solving the system"); return x; } cmat ls_solve(const cmat &A, const cmat &B) { cmat X; bool info; info = ls_solve(A, B, X); it_assert_debug(info, "ls_solve: Failed solving the system"); return X; } // ----------------- ls_solve_od ------------------------------------------------------------------ #if defined(HAVE_LAPACK) bool ls_solve_od(const mat &A, const vec &b, vec &x) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = ldb = A.rows(); n = A.cols(); nrhs = 1; lwork = n + std::max(m, nrhs); it_assert_debug(m >= n, "The system is under-determined!"); it_assert_debug(m == b.size(), "The number of rows in A must equal the length of b!"); vec work(lwork); x = b; mat QR = A; dgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, x._data(), &ldb, work._data(), &lwork, &info); x.set_size(n, true); return (info == 0); } bool ls_solve_od(const mat &A, const mat &B, mat &X) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = ldb = A.rows(); n = A.cols(); nrhs = B.cols(); lwork = n + std::max(m, nrhs); it_assert_debug(m >= n, "The system is under-determined!"); it_assert_debug(m == B.rows(), "The number of rows in A must equal the length of b!"); vec work(lwork); X = B; mat QR = A; dgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, X._data(), &ldb, work._data(), &lwork, &info); X.set_size(n, nrhs, true); return (info == 0); } bool ls_solve_od(const cmat &A, const cvec &b, cvec &x) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = ldb = A.rows(); n = A.cols(); nrhs = 1; lwork = n + std::max(m, nrhs); it_assert_debug(m >= n, "The system is under-determined!"); it_assert_debug(m == b.size(), "The number of rows in A must equal the length of b!"); cvec work(lwork); x = b; cmat QR = A; zgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, x._data(), &ldb, work._data(), &lwork, &info); x.set_size(n, true); return (info == 0); } bool ls_solve_od(const cmat &A, const cmat &B, cmat &X) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = ldb = A.rows(); n = A.cols(); nrhs = B.cols(); lwork = n + std::max(m, nrhs); it_assert_debug(m >= n, "The system is under-determined!"); it_assert_debug(m == B.rows(), "The number of rows in A must equal the length of b!"); cvec work(lwork); X = B; cmat QR = A; zgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, X._data(), &ldb, work._data(), &lwork, &info); X.set_size(n, nrhs, true); return (info == 0); } #else bool ls_solve_od(const mat &A, const vec &b, vec &x) { it_error("LAPACK library is needed to use ls_solve_od() function"); return false; } bool ls_solve_od(const mat &A, const mat &B, mat &X) { it_error("LAPACK library is needed to use ls_solve_od() function"); return false; } bool ls_solve_od(const cmat &A, const cvec &b, cvec &x) { it_error("LAPACK library is needed to use ls_solve_od() function"); return false; } bool ls_solve_od(const cmat &A, const cmat &B, cmat &X) { it_error("LAPACK library is needed to use ls_solve_od() function"); return false; } #endif // HAVE_LAPACK vec ls_solve_od(const mat &A, const vec &b) { vec x; bool info; info = ls_solve_od(A, b, x); it_assert_debug(info, "ls_solve_od: Failed solving the system"); return x; } mat ls_solve_od(const mat &A, const mat &B) { mat X; bool info; info = ls_solve_od(A, B, X); it_assert_debug(info, "ls_solve_od: Failed solving the system"); return X; } cvec ls_solve_od(const cmat &A, const cvec &b) { cvec x; bool info; info = ls_solve_od(A, b, x); it_assert_debug(info, "ls_solve_od: Failed solving the system"); return x; } cmat ls_solve_od(const cmat &A, const cmat &B) { cmat X; bool info; info = ls_solve_od(A, B, X); it_assert_debug(info, "ls_solve_od: Failed solving the system"); return X; } // ------------------- ls_solve_ud ----------------------------------------------------------- #if defined(HAVE_LAPACK) bool ls_solve_ud(const mat &A, const vec &b, vec &x) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = A.rows(); n = A.cols(); ldb = n; nrhs = 1; lwork = m + std::max(n, nrhs); it_assert_debug(m < n, "The system is over-determined!"); it_assert_debug(m == b.size(), "The number of rows in A must equal the length of b!"); vec work(lwork); x = b; x.set_size(n, true); mat QR = A; dgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, x._data(), &ldb, work._data(), &lwork, &info); return (info == 0); } bool ls_solve_ud(const mat &A, const mat &B, mat &X) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = A.rows(); n = A.cols(); ldb = n; nrhs = B.cols(); lwork = m + std::max(n, nrhs); it_assert_debug(m < n, "The system is over-determined!"); it_assert_debug(m == B.rows(), "The number of rows in A must equal the length of b!"); vec work(lwork); X = B; X.set_size(n, std::max(m, nrhs), true); mat QR = A; dgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, X._data(), &ldb, work._data(), &lwork, &info); X.set_size(n, nrhs, true); return (info == 0); } bool ls_solve_ud(const cmat &A, const cvec &b, cvec &x) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = A.rows(); n = A.cols(); ldb = n; nrhs = 1; lwork = m + std::max(n, nrhs); it_assert_debug(m < n, "The system is over-determined!"); it_assert_debug(m == b.size(), "The number of rows in A must equal the length of b!"); cvec work(lwork); x = b; x.set_size(n, true); cmat QR = A; zgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, x._data(), &ldb, work._data(), &lwork, &info); return (info == 0); } bool ls_solve_ud(const cmat &A, const cmat &B, cmat &X) { int m, n, lda, ldb, nrhs, lwork, info; char trans = 'N'; m = lda = A.rows(); n = A.cols(); ldb = n; nrhs = B.cols(); lwork = m + std::max(n, nrhs); it_assert_debug(m < n, "The system is over-determined!"); it_assert_debug(m == B.rows(), "The number of rows in A must equal the length of b!"); cvec work(lwork); X = B; X.set_size(n, std::max(m, nrhs), true); cmat QR = A; zgels_(&trans, &m, &n, &nrhs, QR._data(), &lda, X._data(), &ldb, work._data(), &lwork, &info); X.set_size(n, nrhs, true); return (info == 0); } #else bool ls_solve_ud(const mat &A, const vec &b, vec &x) { it_error("LAPACK library is needed to use ls_solve_ud() function"); return false; } bool ls_solve_ud(const mat &A, const mat &B, mat &X) { it_error("LAPACK library is needed to use ls_solve_ud() function"); return false; } bool ls_solve_ud(const cmat &A, const cvec &b, cvec &x) { it_error("LAPACK library is needed to use ls_solve_ud() function"); return false; } bool ls_solve_ud(const cmat &A, const cmat &B, cmat &X) { it_error("LAPACK library is needed to use ls_solve_ud() function"); return false; } #endif // HAVE_LAPACK vec ls_solve_ud(const mat &A, const vec &b) { vec x; bool info; info = ls_solve_ud(A, b, x); it_assert_debug(info, "ls_solve_ud: Failed solving the system"); return x; } mat ls_solve_ud(const mat &A, const mat &B) { mat X; bool info; info = ls_solve_ud(A, B, X); it_assert_debug(info, "ls_solve_ud: Failed solving the system"); return X; } cvec ls_solve_ud(const cmat &A, const cvec &b) { cvec x; bool info; info = ls_solve_ud(A, b, x); it_assert_debug(info, "ls_solve_ud: Failed solving the system"); return x; } cmat ls_solve_ud(const cmat &A, const cmat &B) { cmat X; bool info; info = ls_solve_ud(A, B, X); it_assert_debug(info, "ls_solve_ud: Failed solving the system"); return X; } // ---------------------- backslash ----------------------------------------- bool backslash(const mat &A, const vec &b, vec &x) { int m = A.rows(), n = A.cols(); bool info; if (m == n) info = ls_solve(A, b, x); else if (m > n) info = ls_solve_od(A, b, x); else info = ls_solve_ud(A, b, x); return info; } vec backslash(const mat &A, const vec &b) { vec x; bool info; info = backslash(A, b, x); it_assert_debug(info, "backslash(): solution was not found"); return x; } bool backslash(const mat &A, const mat &B, mat &X) { int m = A.rows(), n = A.cols(); bool info; if (m == n) info = ls_solve(A, B, X); else if (m > n) info = ls_solve_od(A, B, X); else info = ls_solve_ud(A, B, X); return info; } mat backslash(const mat &A, const mat &B) { mat X; bool info; info = backslash(A, B, X); it_assert_debug(info, "backslash(): solution was not found"); return X; } bool backslash(const cmat &A, const cvec &b, cvec &x) { int m = A.rows(), n = A.cols(); bool info; if (m == n) info = ls_solve(A, b, x); else if (m > n) info = ls_solve_od(A, b, x); else info = ls_solve_ud(A, b, x); return info; } cvec backslash(const cmat &A, const cvec &b) { cvec x; bool info; info = backslash(A, b, x); it_assert_debug(info, "backslash(): solution was not found"); return x; } bool backslash(const cmat &A, const cmat &B, cmat &X) { int m = A.rows(), n = A.cols(); bool info; if (m == n) info = ls_solve(A, B, X); else if (m > n) info = ls_solve_od(A, B, X); else info = ls_solve_ud(A, B, X); return info; } cmat backslash(const cmat &A, const cmat &B) { cmat X; bool info; info = backslash(A, B, X); it_assert_debug(info, "backslash(): solution was not found"); return X; } // -------------------------------------------------------------------------- vec forward_substitution(const mat &L, const vec &b) { int n = L.rows(); vec x(n); forward_substitution(L, b, x); return x; } void forward_substitution(const mat &L, const vec &b, vec &x) { it_assert(L.rows() == L.cols() && L.cols() == b.size() && b.size() == x.size(), "forward_substitution: dimension mismatch"); int n = L.rows(), i, j; double temp; x(0) = b(0) / L(0, 0); for (i = 1;i < n;i++) { // Should be: x(i)=((b(i)-L(i,i,0,i-1)*x(0,i-1))/L(i,i))(0); but this is to slow. //i_pos=i*L._row_offset(); temp = 0; for (j = 0; j < i; j++) { temp += L._elem(i, j) * x(j); //temp+=L._data()[i_pos+j]*x(j); } x(i) = (b(i) - temp) / L._elem(i, i); //x(i)=(b(i)-temp)/L._data()[i_pos+i]; } } vec forward_substitution(const mat &L, int p, const vec &b) { int n = L.rows(); vec x(n); forward_substitution(L, p, b, x); return x; } void forward_substitution(const mat &L, int p, const vec &b, vec &x) { it_assert(L.rows() == L.cols() && L.cols() == b.size() && b.size() == x.size() && p <= L.rows() / 2, "forward_substitution: dimension mismatch"); int n = L.rows(), i, j; x = b; for (j = 0;j < n;j++) { x(j) /= L(j, j); for (i = j + 1;i < std::min(j + p + 1, n);i++) { x(i) -= L(i, j) * x(j); } } } vec backward_substitution(const mat &U, const vec &b) { vec x(U.rows()); backward_substitution(U, b, x); return x; } void backward_substitution(const mat &U, const vec &b, vec &x) { it_assert(U.rows() == U.cols() && U.cols() == b.size() && b.size() == x.size(), "backward_substitution: dimension mismatch"); int n = U.rows(), i, j; double temp; x(n - 1) = b(n - 1) / U(n - 1, n - 1); for (i = n - 2; i >= 0; i--) { // Should be: x(i)=((b(i)-U(i,i,i+1,n-1)*x(i+1,n-1))/U(i,i))(0); but this is too slow. temp = 0; //i_pos=i*U._row_offset(); for (j = i + 1; j < n; j++) { temp += U._elem(i, j) * x(j); //temp+=U._data()[i_pos+j]*x(j); } x(i) = (b(i) - temp) / U._elem(i, i); //x(i)=(b(i)-temp)/U._data()[i_pos+i]; } } vec backward_substitution(const mat &U, int q, const vec &b) { vec x(U.rows()); backward_substitution(U, q, b, x); return x; } void backward_substitution(const mat &U, int q, const vec &b, vec &x) { it_assert(U.rows() == U.cols() && U.cols() == b.size() && b.size() == x.size() && q <= U.rows() / 2, "backward_substitution: dimension mismatch"); int n = U.rows(), i, j; x = b; for (j = n - 1; j >= 0; j--) { x(j) /= U(j, j); for (i = std::max(0, j - q); i < j; i++) { x(i) -= U(i, j) * x(j); } } } } // namespace itpp itpp-4.3.1/itpp/base/algebra/ls_solve.h000066400000000000000000000360411216575753400200000ustar00rootroot00000000000000/*! * \file * \brief Definitions of functions for solving linear equation systems * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef LS_SOLVE_H #define LS_SOLVE_H #include #include namespace itpp { /*! \addtogroup linearequations */ //!@{ /*! \brief Solve linear equation system by LU factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. Uses the LAPACK routine DGESV. */ ITPP_EXPORT bool ls_solve(const mat &A, const vec &b, vec &x); /*! \brief Solve linear equation system by LU factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. Uses the LAPACK routine DGESV. */ ITPP_EXPORT vec ls_solve(const mat &A, const vec &b); /*! \brief Solve multiple linear equations by LU factorisation. Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. Uses the LAPACK routine DGESV. */ bool ls_solve(const mat &A, const mat &B, mat &X); /*! \brief Solve multiple linear equations by LU factorisation. Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. Uses the LAPACK routine DGESV. */ ITPP_EXPORT mat ls_solve(const mat &A, const mat &B); /*! \brief Solve linear equation system by LU factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. Uses the LAPACK routine ZGESV. */ ITPP_EXPORT bool ls_solve(const cmat &A, const cvec &b, cvec &x); /*! \brief Solve linear equation system by LU factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. Uses the LAPACK routine ZGESV. */ ITPP_EXPORT cvec ls_solve(const cmat &A, const cvec &b); /*! \brief Solve multiple linear equations by LU factorisation. Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. Uses the LAPACK routine ZGESV. */ ITPP_EXPORT bool ls_solve(const cmat &A, const cmat &B, cmat &X); /*! \brief Solve multiple linear equations by LU factorisation. Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. Uses the LAPACK routine ZGESV. */ ITPP_EXPORT cmat ls_solve(const cmat &A, const cmat &B); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a symmetric positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine DPOSV. */ ITPP_EXPORT bool ls_solve_chol(const mat &A, const vec &b, vec &x); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a symmetric positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine DPOSV. */ ITPP_EXPORT vec ls_solve_chol(const mat &A, const vec &b); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$AX=B\f$, where \f$A\f$ is a symmetric positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine DPOSV. */ ITPP_EXPORT bool ls_solve_chol(const mat &A, const mat &B, mat &X); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$AX=B\f$, where \f$A\f$ is a symmetric positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine DPOSV. */ ITPP_EXPORT mat ls_solve_chol(const mat &A, const mat &B); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a Hermitian positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine ZPOSV. */ ITPP_EXPORT bool ls_solve_chol(const cmat &A, const cvec &b, cvec &x); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a Hermitian positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine ZPOSV. */ ITPP_EXPORT cvec ls_solve_chol(const cmat &A, const cvec &b); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$AX=B\f$, where \f$A\f$ is a Hermitian positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine ZPOSV. */ ITPP_EXPORT bool ls_solve_chol(const cmat &A, const cmat &B, cmat &X); /*! \brief Solve linear equation system by Cholesky factorisation. Solves the linear system \f$AX=B\f$, where \f$A\f$ is a Hermitian positive definite \f$n \times n\f$ matrix. Uses the LAPACK routine ZPOSV. */ ITPP_EXPORT cmat ls_solve_chol(const cmat &A, const cmat &B); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and is built upon the LAPACK routine DGELS. */ ITPP_EXPORT bool ls_solve_od(const mat &A, const vec &b, vec &x); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. */ ITPP_EXPORT vec ls_solve_od(const mat &A, const vec &b); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. */ ITPP_EXPORT bool ls_solve_od(const mat &A, const mat &B, mat &X); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. */ ITPP_EXPORT mat ls_solve_od(const mat &A, const mat &B); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and is built upon the LAPACK routine ZGELS. */ ITPP_EXPORT bool ls_solve_od(const cmat &A, const cvec &b, cvec &x); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. */ ITPP_EXPORT cvec ls_solve_od(const cmat &A, const cvec &b); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. */ ITPP_EXPORT bool ls_solve_od(const cmat &A, const cmat &B, cmat &X); /*! \brief Solves overdetermined linear equation systems. Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. */ ITPP_EXPORT cmat ls_solve_od(const cmat &A, const cmat &B); /*! \brief Solves underdetermined linear equation systems. Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and is built upon the LAPACK routine DGELS. */ ITPP_EXPORT bool ls_solve_ud(const mat &A, const vec &b, vec &x); /*! \brief Solves overdetermined linear equation systems. Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. */ ITPP_EXPORT vec ls_solve_ud(const mat &A, const vec &b); /*! \brief Solves underdetermined linear equation systems. Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. */ ITPP_EXPORT bool ls_solve_ud(const mat &A, const mat &B, mat &X); /*! \brief Solves underdetermined linear equation systems. Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. */ ITPP_EXPORT mat ls_solve_ud(const mat &A, const mat &B); /*! \brief Solves underdetermined linear equation systems. Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and is built upon the LAPACK routine ZGELS. */ ITPP_EXPORT bool ls_solve_ud(const cmat &A, const cvec &b, cvec &x); /*! \brief Solves overdetermined linear equation systems. Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. */ ITPP_EXPORT cvec ls_solve_ud(const cmat &A, const cvec &b); /*! \brief Solves underdetermined linear equation systems. Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. */ ITPP_EXPORT bool ls_solve_ud(const cmat &A, const cmat &B, cmat &X); /*! \brief Solves underdetermined linear equation systems. Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. */ ITPP_EXPORT cmat ls_solve_ud(const cmat &A, const cmat &B); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,b,x), ls_solve_od(A,b,x) or ls_solve_ud(A,b,x) */ ITPP_EXPORT bool backslash(const mat &A, const vec &b, vec &x); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,b), ls_solve_od(A,b) or ls_solve_ud(A,b) */ ITPP_EXPORT vec backslash(const mat &A, const vec &b); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,B,X), ls_solve_od(A,B,X), or ls_solve_ud(A,B,X). */ ITPP_EXPORT bool backslash(const mat &A, const mat &B, mat &X); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,B), ls_solve_od(A,B), or ls_solve_ud(A,B). */ ITPP_EXPORT mat backslash(const mat &A, const mat &B); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,b,x), ls_solve_od(A,b,x) or ls_solve_ud(A,b,x) */ ITPP_EXPORT bool backslash(const cmat &A, const cvec &b, cvec &x); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,b), ls_solve_od(A,b) or ls_solve_ud(A,b) */ ITPP_EXPORT cvec backslash(const cmat &A, const cvec &b); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,B,X), ls_solve_od(A,B,X), or ls_solve_ud(A,B,X). */ ITPP_EXPORT bool backslash(const cmat &A, const cmat &B, cmat &X); /*! \brief A general linear equation system solver. Tries to emulate the backslash operator in Matlab by calling ls_solve(A,B), ls_solve_od(A,B), or ls_solve_ud(A,B). */ ITPP_EXPORT cmat backslash(const cmat &A, const cmat &B); /*! \brief Forward substitution of square matrix. Solves Lx=b, where L is a lower triangular n by n matrix. Assumes that L is nonsingular. Requires n^2 flops. Uses Alg. 3.1.1 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. */ ITPP_EXPORT vec forward_substitution(const mat &L, const vec &b); /*! \brief Forward substitution of square matrix. Solves Lx=b, where L is a lower triangular n by n matrix. Assumes that L is nonsingular. Requires n^2 flops. Uses Alg. 3.1.1 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. */ ITPP_EXPORT void forward_substitution(const mat &L, const vec &b, vec &x); /*! \brief Forward substitution of band matrices. Solves Lx=b, where L is a lower triangular n by n band-matrix with lower bandwidth p. Assumes that L is nonsingular. Requires about 2np flops (if n >> p). Uses Alg. 4.3.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. */ ITPP_EXPORT vec forward_substitution(const mat &L, int p, const vec &b); /*! \brief Forward substitution of band matrices. Solves Lx=b, where L is a lower triangular n by n band-matrix with lower bandwidth p. Assumes that L is nonsingular. Requires about 2np flops (if n >> p). Uses Alg. 4.3.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. */ ITPP_EXPORT void forward_substitution(const mat &L, int p, const vec &b, vec &x); /*! \brief Backward substitution of square matrix. Solves Ux=b, where U is a upper triangular n by n matrix. Assumes that U is nonsingular. Requires n^2 flops. Uses Alg. 3.1.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. */ ITPP_EXPORT vec backward_substitution(const mat &U, const vec &b); /*! \brief Backward substitution of square matrix. Solves Ux=b, where U is a upper triangular n by n matrix. Assumes that U is nonsingular. Requires n^2 flops. Uses Alg. 3.1.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. */ ITPP_EXPORT void backward_substitution(const mat &U, const vec &b, vec &x); /*! \brief Backward substitution of band matrix. Solves Ux=b, where U is a upper triangular n by n matrix band-matrix with upper bandwidth q. Assumes that U is nonsingular. Requires about 2nq flops (if n >> q). Uses Alg. 4.3.3 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. */ ITPP_EXPORT vec backward_substitution(const mat &U, int q, const vec &b); /*! \brief Backward substitution of band matrix. Solves Ux=b, where U is a upper triangular n by n matrix band-matrix with upper bandwidth q. Assumes that U is nonsingular. Requires about 2nq flops (if n >> q). Uses Alg. 4.3.3 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. */ ITPP_EXPORT void backward_substitution(const mat &U, int q, const vec &b, vec &x); //!@} } //namespace itpp #endif // #ifndef LS_SOLVE_H itpp-4.3.1/itpp/base/algebra/lu.cpp000066400000000000000000000077571216575753400171410ustar00rootroot00000000000000/*! * \file * \brief Implementation of LU factorisation functions. * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include #include namespace itpp { #if defined(HAVE_LAPACK) bool lu(const mat &X, mat &L, mat &U, ivec &p) { it_assert_debug(X.rows() == X.cols(), "lu: matrix is not quadratic"); //int m, n, lda, info; //m = n = lda = X.rows(); int m = X.rows(), info; mat A(X); L.set_size(m, m, false); U.set_size(m, m, false); p.set_size(m, false); dgetrf_(&m, &m, A._data(), &m, p._data(), &info); for (int i = 0; i < m; i++) { for (int j = i; j < m; j++) { if (i == j) { // diagonal L(i, j) = 1; U(i, j) = A(i, j); } else { // upper and lower triangular parts L(i, j) = U(j, i) = 0; L(j, i) = A(j, i); U(i, j) = A(i, j); } } } p = p - 1; // Fortran counts from 1 return (info == 0); } // Slower than not using LAPACK when matrix size smaller than approx 20. bool lu(const cmat &X, cmat &L, cmat &U, ivec &p) { it_assert_debug(X.rows() == X.cols(), "lu: matrix is not quadratic"); //int m, n, lda, info; //m = n = lda = X.rows(); int m = X.rows(), info; cmat A(X); L.set_size(m, m, false); U.set_size(m, m, false); p.set_size(m, false); zgetrf_(&m, &m, A._data(), &m, p._data(), &info); for (int i = 0; i < m; i++) { for (int j = i; j < m; j++) { if (i == j) { // diagonal L(i, j) = 1; U(i, j) = A(i, j); } else { // upper and lower triangular parts L(i, j) = U(j, i) = 0; L(j, i) = A(j, i); U(i, j) = A(i, j); } } } p = p - 1; // Fortran counts from 1 return (info == 0); } #else bool lu(const mat &X, mat &L, mat &U, ivec &p) { it_error("LAPACK library is needed to use lu() function"); return false; } bool lu(const cmat &X, cmat &L, cmat &U, ivec &p) { it_error("LAPACK library is needed to use lu() function"); return false; } #endif // HAVE_LAPACK void interchange_permutations(vec &b, const ivec &p) { it_assert(b.size() == p.size(), "interchange_permutations(): dimension mismatch"); double temp; for (int k = 0; k < b.size(); k++) { temp = b(k); b(k) = b(p(k)); b(p(k)) = temp; } } bmat permutation_matrix(const ivec &p) { it_assert(p.size() > 0, "permutation_matrix(): vector must have nonzero size"); int n = p.size(), k; bmat P, identity; bvec row_k, row_pk; identity = eye_b(n); for (k = n - 1; k >= 0; k--) { // swap rows k and p(k) in identity row_k = identity.get_row(k); row_pk = identity.get_row(p(k)); identity.set_row(k, row_pk); identity.set_row(p(k), row_k); if (k == n - 1) { P = identity; } else { P *= identity; } // swap back identity.set_row(k, row_k); identity.set_row(p(k), row_pk); } return P; } } // namespace itpp itpp-4.3.1/itpp/base/algebra/lu.h000066400000000000000000000066641216575753400166020ustar00rootroot00000000000000/*! * \file * \brief Definitions of LU factorisation functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef LU_H #define LU_H #include #include namespace itpp { /*! \addtogroup matrixdecomp */ //!@{ /*! \brief LU factorisation of real matrix The LU factorization of the real matrix \f$\mathbf{X}\f$ of size \f$n \times n\f$ is given by \f[ \mathbf{X} = \mathbf{P}^T \mathbf{L} \mathbf{U} , \f] where \f$\mathbf{L}\f$ and \f$\mathbf{U}\f$ are lower and upper triangular matrices and \f$\mathbf{P}\f$ is a permutation matrix. The interchange permutation vector \a p is such that \a k and \a p(k) should be changed for all \a k. Given this vector a permutation matrix can be constructed using the function \code bmat permutation_matrix(const ivec &p) \endcode If \a X is an \a n by \a n matrix \a lu(X,L,U,p) computes the LU decomposition. \a L is a lower triangular, \a U an upper triangular matrix. \a p is the interchange permutation vector such that \a k and \a p(k) should be changed for all \a k. Returns true is calculation succeeds. False otherwise. */ ITPP_EXPORT bool lu(const mat &X, mat &L, mat &U, ivec &p); /*! \brief LU factorisation of real matrix The LU factorization of the complex matrix \f$\mathbf{X}\f$ of size \f$n \times n\f$ is given by \f[ \mathbf{X} = \mathbf{P}^T \mathbf{L} \mathbf{U} , \f] where \f$\mathbf{L}\f$ and \f$\mathbf{U}\f$ are lower and upper triangular matrices and \f$\mathbf{P}\f$ is a permutation matrix. The interchange permutation vector \a p is such that \a k and \a p(k) should be changed for all \a k. Given this vector a permutation matrix can be constructed using the function \code bmat permutation_matrix(const ivec &p) \endcode If \a X is an \a n by \a n matrix \a lu(X,L,U,p) computes the LU decomposition. \a L is a lower triangular, \a U an upper triangular matrix. \a p is the interchange permutation vector such that elements \a k and row \a p(k) should be interchanged. Returns true is calculation succeeds. False otherwise. */ ITPP_EXPORT bool lu(const cmat &X, cmat &L, cmat &U, ivec &p); //! Makes swapping of vector b according to the interchange permutation vector p. ITPP_EXPORT void interchange_permutations(vec &b, const ivec &p); //! Make permutation matrix P from the interchange permutation vector p. ITPP_EXPORT bmat permutation_matrix(const ivec &p); //!@} } // namespace itpp #endif // #ifndef LU_H itpp-4.3.1/itpp/base/algebra/qr.cpp000066400000000000000000000177211216575753400171330ustar00rootroot00000000000000/*! * \file * \brief Implementation of QR factorisation functions * \author Tony Ottosson, Simon Wood, Adam Piatyszek and Vasek Smidl * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include #include namespace itpp { #if defined(HAVE_LAPACK) bool qr(const mat &A, mat &Q, mat &R) { int info; int m = A.rows(); int n = A.cols(); int lwork = n; int k = std::min(m, n); vec tau(k); vec work(lwork); R = A; // perform workspace query for optimum lwork value int lwork_tmp = -1; dgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork, &info); Q = R; Q.set_size(m, m, true); // construct R for (int i = 0; i < m; i++) for (int j = 0; j < std::min(i, n); j++) R(i, j) = 0; // perform workspace query for optimum lwork value lwork_tmp = -1; dorgqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dorgqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork, &info); return (info == 0); } bool qr(const mat &A, mat &R) { int info; int m = A.rows(); int n = A.cols(); int lwork = n; int k = std::min(m, n); vec tau(k); vec work(lwork); R = A; // perform workspace query for optimum lwork value int lwork_tmp = -1; dgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork, &info); // construct R for (int i = 0; i < m; i++) for (int j = 0; j < std::min(i, n); j++) R(i, j) = 0; return (info == 0); } bool qr(const mat &A, mat &Q, mat &R, bmat &P) { int info; int m = A.rows(); int n = A.cols(); int lwork = n; int k = std::min(m, n); vec tau(k); vec work(lwork); ivec jpvt(n); jpvt.zeros(); R = A; // perform workspace query for optimum lwork value int lwork_tmp = -1; dgeqp3_(&m, &n, R._data(), &m, jpvt._data(), tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dgeqp3_(&m, &n, R._data(), &m, jpvt._data(), tau._data(), work._data(), &lwork, &info); Q = R; Q.set_size(m, m, true); // construct permutation matrix P = zeros_b(n, n); for (int j = 0; j < n; j++) P(jpvt(j) - 1, j) = 1; // construct R for (int i = 0; i < m; i++) for (int j = 0; j < std::min(i, n); j++) R(i, j) = 0; // perform workspace query for optimum lwork value lwork_tmp = -1; dorgqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dorgqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork, &info); return (info == 0); } bool qr(const cmat &A, cmat &Q, cmat &R) { int info; int m = A.rows(); int n = A.cols(); int lwork = n; int k = std::min(m, n); cvec tau(k); cvec work(lwork); R = A; // perform workspace query for optimum lwork value int lwork_tmp = -1; zgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork, &info); Q = R; Q.set_size(m, m, true); // construct R for (int i = 0; i < m; i++) for (int j = 0; j < std::min(i, n); j++) R(i, j) = 0; // perform workspace query for optimum lwork value lwork_tmp = -1; zungqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zungqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork, &info); return (info == 0); } bool qr(const cmat &A, cmat &R) { int info; int m = A.rows(); int n = A.cols(); int lwork = n; int k = std::min(m, n); cvec tau(k); cvec work(lwork); R = A; // perform workspace query for optimum lwork value int lwork_tmp = -1; zgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zgeqrf_(&m, &n, R._data(), &m, tau._data(), work._data(), &lwork, &info); // construct R for (int i = 0; i < m; i++) for (int j = 0; j < std::min(i, n); j++) R(i, j) = 0; return (info == 0); } bool qr(const cmat &A, cmat &Q, cmat &R, bmat &P) { int info; int m = A.rows(); int n = A.cols(); int lwork = n; int k = std::min(m, n); cvec tau(k); cvec work(lwork); vec rwork(std::max(1, 2*n)); ivec jpvt(n); jpvt.zeros(); R = A; // perform workspace query for optimum lwork value int lwork_tmp = -1; zgeqp3_(&m, &n, R._data(), &m, jpvt._data(), tau._data(), work._data(), &lwork_tmp, rwork._data(), &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zgeqp3_(&m, &n, R._data(), &m, jpvt._data(), tau._data(), work._data(), &lwork, rwork._data(), &info); Q = R; Q.set_size(m, m, true); // construct permutation matrix P = zeros_b(n, n); for (int j = 0; j < n; j++) P(jpvt(j) - 1, j) = 1; // construct R for (int i = 0; i < m; i++) for (int j = 0; j < std::min(i, n); j++) R(i, j) = 0; // perform workspace query for optimum lwork value lwork_tmp = -1; zungqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zungqr_(&m, &m, &k, Q._data(), &m, tau._data(), work._data(), &lwork, &info); return (info == 0); } #else bool qr(const mat &A, mat &Q, mat &R) { it_error("LAPACK library is needed to use qr() function"); return false; } bool qr(const mat &A, mat &R) { it_error("LAPACK library is needed to use qr() function"); return false; } bool qr(const mat &A, mat &Q, mat &R, bmat &P) { it_error("LAPACK library is needed to use qr() function"); return false; } bool qr(const cmat &A, cmat &Q, cmat &R) { it_error("LAPACK library is needed to use qr() function"); return false; } bool qr(const cmat &A, cmat &R) { it_error("LAPACK library is needed to use qr() function"); return false; } bool qr(const cmat &A, cmat &Q, cmat &R, bmat &P) { it_error("LAPACK library is needed to use qr() function"); return false; } #endif // HAVE_LAPACK } // namespace itpp itpp-4.3.1/itpp/base/algebra/qr.h000066400000000000000000000111011216575753400165620ustar00rootroot00000000000000/*! * \file * \brief Definitions of QR factorisation functions * \author Tony Ottosson, Simon Wood, Adam Piatyszek and Vasek Smidl * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef QR_H #define QR_H #include #include namespace itpp { /*! \addtogroup matrixdecomp */ //!@{ /*! \brief QR factorisation of real matrix The QR factorization of the real matrix \f$\mathbf{A}\f$ of size \f$m \times n\f$ is given by \f[ \mathbf{A} = \mathbf{Q} \mathbf{R} , \f] where \f$\mathbf{Q}\f$ is an \f$m \times m\f$ orthogonal matrix and \f$\mathbf{R}\f$ is an \f$m \times n\f$ upper triangular matrix. Returns true is calculation succeeds. False otherwise. Uses the LAPACK routine DGEQRF and DORGQR. */ ITPP_EXPORT bool qr(const mat &A, mat &Q, mat &R); /*! * \brief QR factorisation of real matrix with suppressed evaluation of Q * * For certain type of applications only the \f$\mathbf{R}\f$ matrix of full * QR factorization of the real matrix \f$\mathbf{A}=\mathbf{Q}\mathbf{R}\f$ * is needed. These situations arise typically in designs of square-root * algorithms where it is required that * \f$\mathbf{A}^{T}\mathbf{A}=\mathbf{R}^{T}\mathbf{R}\f$. In such cases, * evaluation of \f$\mathbf{Q}\f$ can be skipped. * * Modification of qr(A,Q,R). * * \author Vasek Smidl */ ITPP_EXPORT bool qr(const mat &A, mat &R); /*! \brief QR factorisation of real matrix with pivoting The QR factorization of the real matrix \f$\mathbf{A}\f$ of size \f$m \times n\f$ is given by \f[ \mathbf{A} \mathbf{P} = \mathbf{Q} \mathbf{R} , \f] where \f$\mathbf{Q}\f$ is an \f$m \times m\f$ orthogonal matrix, \f$\mathbf{R}\f$ is an \f$m \times n\f$ upper triangular matrix and \f$\mathbf{P}\f$ is an \f$n \times n\f$ permutation matrix. Returns true is calculation succeeds. False otherwise. Uses the LAPACK routines DGEQP3 and DORGQR. */ ITPP_EXPORT bool qr(const mat &A, mat &Q, mat &R, bmat &P); /*! \brief QR factorisation of a complex matrix The QR factorization of the complex matrix \f$\mathbf{A}\f$ of size \f$m \times n\f$ is given by \f[ \mathbf{A} = \mathbf{Q} \mathbf{R} , \f] where \f$\mathbf{Q}\f$ is an \f$m \times m\f$ unitary matrix and \f$\mathbf{R}\f$ is an \f$m \times n\f$ upper triangular matrix. Returns true is calculation succeeds. False otherwise. Uses the LAPACK routines ZGEQRF and ZUNGQR. */ ITPP_EXPORT bool qr(const cmat &A, cmat &Q, cmat &R); /*! * \brief QR factorisation of complex matrix with suppressed evaluation of Q * * For certain type of applications only the \f$\mathbf{R}\f$ matrix of full * QR factorization of the complex matrix * \f$\mathbf{A}=\mathbf{Q}\mathbf{R}\f$ is needed. These situations arise * typically in designs of square-root algorithms where it is required that * \f$\mathbf{A}^{H}\mathbf{A}=\mathbf{R}^{H}\mathbf{R}\f$. In such cases, * evaluation of \f$\mathbf{Q}\f$ can be skipped. * * Modification of qr(A,Q,R). * * \author Vasek Smidl */ ITPP_EXPORT bool qr(const cmat &A, cmat &R); /*! \brief QR factorisation of a complex matrix with pivoting The QR factorization of the complex matrix \f$\mathbf{A}\f$ of size \f$m \times n\f$ is given by \f[ \mathbf{A} \mathbf{P} = \mathbf{Q} \mathbf{R} , \f] where \f$\mathbf{Q}\f$ is an \f$m \times m\f$ unitary matrix, \f$\mathbf{R}\f$ is an \f$m \times n\f$ upper triangular matrix and \f$\mathbf{P}\f$ is an \f$n \times n\f$ permutation matrix. Returns true is calculation succeeds. False otherwise. Uses the LAPACK routines ZGEQP3 and ZUNGQR. */ ITPP_EXPORT bool qr(const cmat &A, cmat &Q, cmat &R, bmat &P); //!@} } // namespace itpp #endif // #ifndef QR_H itpp-4.3.1/itpp/base/algebra/schur.cpp000066400000000000000000000057561216575753400176420ustar00rootroot00000000000000/*! * \file * \brief Schur decomposition functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include namespace itpp { #if defined(HAVE_LAPACK) bool schur(const mat &A, mat &U, mat &T) { it_assert_debug(A.rows() == A.cols(), "schur(): Matrix is not square"); char jobvs = 'V'; char sort = 'N'; int info; int n = A.rows(); int lda = n; int ldvs = n; int lwork = 3 * n; // This may be choosen better! int sdim = 0; vec wr(n); vec wi(n); vec work(lwork); T.set_size(lda, n, false); U.set_size(ldvs, n, false); T = A; // The routine overwrites input matrix with eigenvectors dgees_(&jobvs, &sort, 0, &n, T._data(), &lda, &sdim, wr._data(), wi._data(), U._data(), &ldvs, work._data(), &lwork, 0, &info); return (info == 0); } bool schur(const cmat &A, cmat &U, cmat &T) { it_assert_debug(A.rows() == A.cols(), "schur(): Matrix is not square"); char jobvs = 'V'; char sort = 'N'; int info; int n = A.rows(); int lda = n; int ldvs = n; int lwork = 2 * n; // This may be choosen better! int sdim = 0; vec rwork(n); cvec w(n); cvec work(lwork); T.set_size(lda, n, false); U.set_size(ldvs, n, false); T = A; // The routine overwrites input matrix with eigenvectors zgees_(&jobvs, &sort, 0, &n, T._data(), &lda, &sdim, w._data(), U._data(), &ldvs, work._data(), &lwork, rwork._data(), 0, &info); return (info == 0); } #else bool schur(const mat &A, mat &U, mat &T) { it_error("LAPACK library is needed to use schur() function"); return false; } bool schur(const cmat &A, cmat &U, cmat &T) { it_error("LAPACK library is needed to use schur() function"); return false; } #endif // HAVE_LAPACK mat schur(const mat &A) { mat U, T; schur(A, U, T); return T; } cmat schur(const cmat &A) { cmat U, T; schur(A, U, T); return T; } } // namespace itpp itpp-4.3.1/itpp/base/algebra/schur.h000066400000000000000000000073051216575753400172770ustar00rootroot00000000000000/*! * \file * \brief Definitions of Schur decomposition functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SCHUR_H #define SCHUR_H #include #include namespace itpp { /*! * \ingroup matrixdecomp * \brief Schur decomposition of a real matrix * * This function computes the Schur form of a square real matrix * \f$ \mathbf{A} \f$. The Schur decomposition satisfies the * following equation: * \f[ \mathbf{U} \mathbf{T} \mathbf{U}^{T} = \mathbf{A} \f] * where: \f$ \mathbf{U} \f$ is a unitary, \f$ \mathbf{T} \f$ is upper * quasi-triangular, and \f$ \mathbf{U}^{T} \f$ is the transposed * \f$ \mathbf{U} \f$ matrix. * * The upper quasi-triangular matrix may have \f$ 2 \times 2 \f$ blocks on * its diagonal. * * Uses the LAPACK routine DGEES. */ ITPP_EXPORT bool schur(const mat &A, mat &U, mat &T); /*! * \ingroup matrixdecomp * \brief Schur decomposition of a real matrix * * This function computes the Schur form of a square real matrix * \f$ \mathbf{A} \f$. The Schur decomposition satisfies the * following equation: * \f[ \mathbf{U} \mathbf{T} \mathbf{U}^{T} = \mathbf{A} \f] * where: \f$ \mathbf{U} \f$ is a unitary, \f$ \mathbf{T} \f$ is upper * quasi-triangular, and \f$ \mathbf{U}^{T} \f$ is the transposed * \f$ \mathbf{U} \f$ matrix. * * The upper quasi-triangular matrix may have \f$ 2 \times 2 \f$ blocks on * its diagonal. * * \return Real Schur matrix \f$ \mathbf{T} \f$ * * uses the LAPACK routine DGEES. */ ITPP_EXPORT mat schur(const mat &A); /*! * \ingroup matrixdecomp * \brief Schur decomposition of a complex matrix * * This function computes the Schur form of a square complex matrix * \f$ \mathbf{A} \f$. The Schur decomposition satisfies * the following equation: * \f[ \mathbf{U} \mathbf{T} \mathbf{U}^{H} = \mathbf{A} \f] * where: \f$ \mathbf{U} \f$ is a unitary, \f$ \mathbf{T} \f$ is upper * triangular, and \f$ \mathbf{U}^{H} \f$ is the Hermitian * transposition of the \f$ \mathbf{U} \f$ matrix. * * Uses the LAPACK routine ZGEES. */ ITPP_EXPORT bool schur(const cmat &A, cmat &U, cmat &T); /*! * \ingroup matrixdecomp * \brief Schur decomposition of a complex matrix * * This function computes the Schur form of a square complex matrix * \f$ \mathbf{A} \f$. The Schur decomposition satisfies * the following equation: * \f[ \mathbf{U} \mathbf{T} \mathbf{U}^{H} = \mathbf{A} \f] * where: \f$ \mathbf{U} \f$ is a unitary, \f$ \mathbf{T} \f$ is upper * triangular, and \f$ \mathbf{U}^{H} \f$ is the Hermitian * transposition of the \f$ \mathbf{U} \f$ matrix. * * \return Complex Schur matrix \f$ \mathbf{T} \f$ * * Uses the LAPACK routine ZGEES. */ ITPP_EXPORT cmat schur(const cmat &A); } // namespace itpp #endif // #ifndef SCHUR_H itpp-4.3.1/itpp/base/algebra/sources.mk000066400000000000000000000016171216575753400200160ustar00rootroot00000000000000noinst_h_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/lapack.h h_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/cholesky.h \ $(top_srcdir)/itpp/base/algebra/det.h \ $(top_srcdir)/itpp/base/algebra/eigen.h \ $(top_srcdir)/itpp/base/algebra/inv.h \ $(top_srcdir)/itpp/base/algebra/ls_solve.h \ $(top_srcdir)/itpp/base/algebra/lu.h \ $(top_srcdir)/itpp/base/algebra/qr.h \ $(top_srcdir)/itpp/base/algebra/schur.h \ $(top_srcdir)/itpp/base/algebra/svd.h cpp_base_algebra_sources = \ $(top_srcdir)/itpp/base/algebra/cholesky.cpp \ $(top_srcdir)/itpp/base/algebra/det.cpp \ $(top_srcdir)/itpp/base/algebra/eigen.cpp \ $(top_srcdir)/itpp/base/algebra/inv.cpp \ $(top_srcdir)/itpp/base/algebra/ls_solve.cpp \ $(top_srcdir)/itpp/base/algebra/lu.cpp \ $(top_srcdir)/itpp/base/algebra/qr.cpp \ $(top_srcdir)/itpp/base/algebra/schur.cpp \ $(top_srcdir)/itpp/base/algebra/svd.cpp itpp-4.3.1/itpp/base/algebra/svd.cpp000066400000000000000000000143161216575753400173020ustar00rootroot00000000000000/*! * \file * \brief Implementation of Singular Value Decompositions * \author Tony Ottosson, Simon Wood and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_LAPACK) # include #endif #include namespace itpp { #if defined(HAVE_LAPACK) bool svd(const mat &A, vec &S) { char jobu = 'N', jobvt = 'N'; int m, n, lda, ldu, ldvt, lwork, info; m = lda = ldu = A.rows(); n = ldvt = A.cols(); lwork = std::max(3 * std::min(m, n) + std::max(m, n), 5 * std::min(m, n)); mat U, V; S.set_size(std::min(m, n), false); vec work(lwork); mat B(A); // The theoretical calculation of lwork above results in the minimum size // needed for dgesvd_ to run to completion without having memory errors. // For speed improvement it is best to set lwork=-1 and have dgesvd_ // calculate the best workspace requirement. int lwork_tmp = -1; dgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork, &info); return (info == 0); } bool svd(const cmat &A, vec &S) { char jobu = 'N', jobvt = 'N'; int m, n, lda, ldu, ldvt, lwork, info; m = lda = ldu = A.rows(); n = ldvt = A.cols(); lwork = 2 * std::min(m, n) + std::max(m, n); cvec U, V; S.set_size(std::min(m, n), false); cvec work(lwork); vec rwork(5*std::min(m, n)); cmat B(A); // The theoretical calculation of lwork above results in the minimum size // needed for zgesvd_ to run to completion without having memory errors. // For speed improvement it is best to set lwork=-1 and have zgesvd_ // calculate the best workspace requirement. int lwork_tmp = -1; zgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork_tmp, rwork._data(), &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork, rwork._data(), &info); return (info == 0); } bool svd(const mat &A, mat &U, vec &S, mat &V) { char jobu = 'A', jobvt = 'A'; int m, n, lda, ldu, ldvt, lwork, info; m = lda = ldu = A.rows(); n = ldvt = A.cols(); lwork = std::max(3 * std::min(m, n) + std::max(m, n), 5 * std::min(m, n)); U.set_size(m, m, false); V.set_size(n, n, false); S.set_size(std::min(m, n), false); vec work(lwork); mat B(A); // The theoretical calculation of lwork above results in the minimum size // needed for dgesvd_ to run to completion without having memory errors. // For speed improvement it is best to set lwork=-1 and have dgesvd_ // calculate the best workspace requirement. int lwork_tmp = -1; dgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork_tmp, &info); if (info == 0) { lwork = static_cast(work(0)); work.set_size(lwork, false); } dgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork, &info); V = V.T(); // This is probably slow!!! return (info == 0); } bool svd(const cmat &A, cmat &U, vec &S, cmat &V) { char jobu = 'A', jobvt = 'A'; int m, n, lda, ldu, ldvt, lwork, info; m = lda = ldu = A.rows(); n = ldvt = A.cols(); lwork = 2 * std::min(m, n) + std::max(m, n); U.set_size(m, m, false); V.set_size(n, n, false); S.set_size(std::min(m, n), false); cvec work(lwork); vec rwork(5 * std::min(m, n)); cmat B(A); // The theoretical calculation of lwork above results in the minimum size // needed for zgesvd_ to run to completion without having memory errors. // For speed improvement it is best to set lwork=-1 and have zgesvd_ // calculate the best workspace requirement. int lwork_tmp = -1; zgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork_tmp, rwork._data(), &info); if (info == 0) { lwork = static_cast(real(work(0))); work.set_size(lwork, false); } zgesvd_(&jobu, &jobvt, &m, &n, B._data(), &lda, S._data(), U._data(), &ldu, V._data(), &ldvt, work._data(), &lwork, rwork._data(), &info); V = V.H(); // This is slow!!! return (info == 0); } #else bool svd(const mat &A, vec &S) { it_error("LAPACK library is needed to use svd() function"); return false; } bool svd(const cmat &A, vec &S) { it_error("LAPACK library is needed to use svd() function"); return false; } bool svd(const mat &A, mat &U, vec &S, mat &V) { it_error("LAPACK library is needed to use svd() function"); return false; } bool svd(const cmat &A, cmat &U, vec &S, cmat &V) { it_error("LAPACK library is needed to use svd() function"); return false; } #endif // HAVE_LAPACK vec svd(const mat &A) { vec S; svd(A, S); return S; } vec svd(const cmat &A) { vec S; svd(A, S); return S; } } //namespace itpp itpp-4.3.1/itpp/base/algebra/svd.h000066400000000000000000000141351216575753400167460ustar00rootroot00000000000000/*! * \file * \brief Definitions of Singular Value Decompositions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SVD_H #define SVD_H #include #include namespace itpp { /*! * \ingroup matrixdecomp * \brief Get singular values \c s of a real matrix \c A using SVD * * This function calculates singular values \f$s\f$ from the SVD * decomposition of a real matrix \f$A\f$. The SVD algorithm computes the * decomposition of a real \f$m \times n\f$ matrix \f$\mathbf{A}\f$ so * that * \f[ * \mathrm{diag}(\mathbf{U}^T \mathbf{A} \mathbf{V}) = \mathbf{s} * = \sigma_1, \ldots, \sigma_p * \f] * where \f$\sigma_1 \geq \sigma_2 \geq \ldots \sigma_p \geq 0\f$ are the * singular values of \f$\mathbf{A}\f$. * Or put differently: * \f[ * \mathbf{A} = \mathbf{U} \mathbf{S} \mathbf{V}^T * \f] * where \f$ \mathrm{diag}(\mathbf{S}) = \mathbf{s} \f$ * * \note An external LAPACK library is required by this function. */ ITPP_EXPORT bool svd(const mat &A, vec &s); /*! * \ingroup matrixdecomp * \brief Get singular values \c s of a complex matrix \c A using SVD * * This function calculates singular values \f$s\f$ from the SVD * decomposition of a complex matrix \f$A\f$. The SVD algorithm computes * the decomposition of a complex \f$m \times n\f$ matrix \f$\mathbf{A}\f$ * so that * \f[ * \mathrm{diag}(\mathbf{U}^H \mathbf{A} \mathbf{V}) = \mathbf{s} * = \sigma_1, \ldots, \sigma_p * \f] * where \f$\sigma_1 \geq \sigma_2 \geq \ldots \sigma_p \geq 0\f$ * are the singular values of \f$\mathbf{A}\f$. * Or put differently: * \f[ * \mathbf{A} = \mathbf{U} \mathbf{S} \mathbf{V}^H * \f] * where \f$ \mathrm{diag}(\mathbf{S}) = \mathbf{s} \f$ * * \note An external LAPACK library is required by this function. */ ITPP_EXPORT bool svd(const cmat &A, vec &s); /*! * \ingroup matrixdecomp * \brief Return singular values of a real matrix \c A using SVD * * This function returns singular values from the SVD decomposition * of a real matrix \f$A\f$. The SVD algorithm computes the decomposition * of a real \f$m \times n\f$ matrix \f$\mathbf{A}\f$ so that * \f[ * \mathrm{diag}(\mathbf{U}^T \mathbf{A} \mathbf{V}) = \mathbf{s} * = \sigma_1, \ldots, \sigma_p * \f] * where \f$\sigma_1 \geq \sigma_2 \geq \ldots \sigma_p \geq 0\f$ are the * singular values of \f$\mathbf{A}\f$. * Or put differently: * \f[ * \mathbf{A} = \mathbf{U} \mathbf{S} \mathbf{V}^T * \f] * where \f$ \mathrm{diag}(\mathbf{S}) = \mathbf{s} \f$ * * \note An external LAPACK library is required by this function. */ ITPP_EXPORT vec svd(const mat &A); /*! * \ingroup matrixdecomp * \brief Return singular values of a complex matrix \c A using SVD * * This function returns singular values from the SVD * decomposition of a complex matrix \f$A\f$. The SVD algorithm computes * the decomposition of a complex \f$m \times n\f$ matrix \f$\mathbf{A}\f$ * so that * \f[ * \mathrm{diag}(\mathbf{U}^H \mathbf{A} \mathbf{V}) = \mathbf{s} * = \sigma_1, \ldots, \sigma_p * \f] * where \f$\sigma_1 \geq \sigma_2 \geq \ldots \sigma_p \geq 0\f$ * are the singular values of \f$\mathbf{A}\f$. * Or put differently: * \f[ * \mathbf{A} = \mathbf{U} \mathbf{S} \mathbf{V}^H * \f] * where \f$ \mathrm{diag}(\mathbf{S}) = \mathbf{s} \f$ * * \note An external LAPACK library is required by this function. */ ITPP_EXPORT vec svd(const cmat &A); /*! * \ingroup matrixdecomp * \brief Perform Singular Value Decomposition (SVD) of a real matrix \c A * * This function returns two orthonormal matrices \f$U\f$ and \f$V\f$ * and a vector of singular values \f$s\f$. * The SVD algorithm computes the decomposition of a real \f$m \times n\f$ * matrix \f$\mathbf{A}\f$ so that * \f[ * \mathrm{diag}(\mathbf{U}^T \mathbf{A} \mathbf{V}) = \mathbf{s} * = \sigma_1, \ldots, \sigma_p * \f] * where the elements of \f$\mathbf{s}\f$, \f$\sigma_1 \geq \sigma_2 \geq * \ldots \sigma_p \geq 0\f$ are the singular values of \f$\mathbf{A}\f$. * Or put differently: * \f[ * \mathbf{A} = \mathbf{U} \mathbf{S} \mathbf{V}^T * \f] * where \f$ \mathrm{diag}(\mathbf{S}) = \mathbf{s} \f$ * * \note An external LAPACK library is required by this function. */ ITPP_EXPORT bool svd(const mat &A, mat &U, vec &s, mat &V); /*! * \ingroup matrixdecomp * \brief Perform Singular Value Decomposition (SVD) of a complex matrix \c A * * This function returns two orthonormal matrices \f$U\f$ and \f$V\f$ * and a vector of singular values \f$s\f$. * The SVD algorithm computes the decomposition of a complex \f$m \times n\f$ * matrix \f$\mathbf{A}\f$ so that * \f[ * \mathrm{diag}(\mathbf{U}^H \mathbf{A} \mathbf{V}) = \mathbf{s} * = \sigma_1, \ldots, \sigma_p * \f] * where the elements of \f$\mathbf{s}\f$, \f$\sigma_1 \geq \sigma_2 \geq * \ldots \sigma_p \geq 0\f$ are the singular values of \f$\mathbf{A}\f$. * Or put differently: * \f[ * \mathbf{A} = \mathbf{U} \mathbf{S} \mathbf{V}^H * \f] * where \f$ \mathrm{diag}(\mathbf{S}) = \mathbf{s} \f$ * * \note An external LAPACK library is required by this function. */ ITPP_EXPORT bool svd(const cmat &A, cmat &U, vec &s, cmat &V); } // namespace itpp #endif // #ifndef SVD_H itpp-4.3.1/itpp/base/array.h000066400000000000000000000400631216575753400156720ustar00rootroot00000000000000/*! * \file * \brief Definition of Array class (container) * \author Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ARRAY_H #define ARRAY_H #include #include #include #include namespace itpp { // Forward declarations template class Array; //! Append element \c e to the end of the Array \c a template const Array concat(const Array &a, const T &e); //! Append element \c e to the beginning of the Array \c a template const Array concat(const T &e, const Array &a); //! Concat Arrays \c a1 and \c a2 template const Array concat(const Array &a1, const Array &a2); //! Concat Arrays \c a1, \c a2 and \c a3 template const Array concat(const Array &a1, const Array &a2, const Array &a3); /*! \ingroup arr_vec_mat \brief General array class \author Tobias Ringstrom and Adam Piatyszek This class is a general linear array class for arbitrary types. The operations and functions are the same as for the vector \c Vec class (except for the arithmetics). For rarely used types you will need to instantiate the class by \code template class Array; \endcode The following example shows how to define an Array of vectors: \code vec a = randn(10); vec b = randn(20); vec c = randn(30); Array my_array(3); my_array(0) = a; my_array(1) = b; my_array(2) = c; \endcode For types T with istream \c operator>> defined special constructor or \c operator= or \c set_array functions (see Related Functions) can be used to assign a string literal to an Array. The string literal has the same format that is used by the istream/ostream operators: \code // Initialise an array with three bit vectors Array B = "{[1 0 1] [0 0 1] [1 0 0 0 1]}"; // Declare an Array of Arrays of vectors Array > an_array; // Assign with an Array containing 2 Arrays, // the first Array containing [1 2] and // the second Array containing [3 4 5] and [6 7] set_array(an_array, "{{[1 2]} {[3 4 5] [6 7]}}"); \endcode By default, Array elements are created using the default constructor for the element type. This can be changed by specifying a suitable Factory in the Array constructor call (see Detailed Description for Factory). */ template class Array { public: //! Default constructor. An element factory \c f can be specified. explicit Array(const Factory &f = DEFAULT_FACTORY); //! Create an Array of size \c n. An element factory \c f can be specified. Array(int n, const Factory &f = DEFAULT_FACTORY); //! Copy constructor. An element factory \c f can be specified. Array(const Array &a, const Factory &f = DEFAULT_FACTORY); //! Create an Array from string. An element factory \c f can be specified. Array(const std::string& values, const Factory &f = DEFAULT_FACTORY); //! Create an Array from char*. An element factory \c f can be specified. Array(const char* values, const Factory &f = DEFAULT_FACTORY); //! Destructor virtual ~Array(); //! Get the \c i element T &operator()(int i); //! Get the \c i element const T &operator()(int i) const; //! Sub-array from element \c i1 to element \c i2 const Array operator()(int i1, int i2) const; //! Sub-array with the elements given by the integer Array const Array operator()(const Array &indices) const; //! Get \c n left elements of the array Array left(int n) const; //! Get \c n right elements of the array Array right(int n) const; //! Get \c n elements of the array starting from \c pos Array mid(int pos, int n) const; //! Assignment operator Array& operator=(const T &e); //! Assignment operator Array& operator=(const Array &a); //! Assignment operator Array& operator=(const char* values); //! Append element \c e to the end of the Array \c a friend const Array concat <>(const Array &a1, const T &e); //! Concat element \c e to the beginning of the Array \c a friend const Array concat <>(const T &e, const Array &a); //! Concat Arrays \c a1 and \c a2 friend const Array concat <>(const Array &a1, const Array &a2); //! Concat Arrays \c a1, \c a2 and \c a3 friend const Array concat <>(const Array &a1, const Array &a2, const Array &a3); //! Returns the number of data elements in the array object int size() const { return ndata; } //! Returns the number of data elements in the array object int length() const { return ndata; } //! Resizing an Array. void set_size(int n, bool copy = false); //! Resizing an Array. void set_length(int n, bool copy = false) { set_size(n, copy); } //! Shift in data at position 0. Return data from the last position. T shift_right(const T& e); //! Shift in array at position 0. Return data from the last position. const Array shift_right(const Array &a); //! Shift in data at the last position. Return data from position 0. T shift_left(const T& e); //! Shift in array at the last position. Return data from position 0. const Array shift_left(const Array &a); //! Swap elements i and j. void swap(int i, int j); //! Set the subarray defined by indicies i1 to i2 to Array a. void set_subarray(int i1, int i2, const Array &a); //! Set the subarray defined by indicies i1 to i2 the element value t. void set_subarray(int i1, int i2, const T &t); protected: //! Allocate storage for an array of length \c n void alloc(int n); //! Free the storage space allocated by the array void free(); //! Check whether index \c i is in the allowed range bool in_range(int i) const { return ((i < ndata) && (i >= 0)); } //! The current number of elements in the Array int ndata; //! A pointer to the data area T *data; //! Element factory (by default set to DEFAULT_FACTORY) const Factory &factory; }; // -------------------- Implementation starts here -------------------- template inline void Array::alloc(int n) { if (n > 0) { create_elements(data, n, factory); ndata = n; } else { data = 0; ndata = 0; } } template inline void Array::free() { destroy_elements(data, ndata); ndata = 0; } template inline Array::Array(const Factory &f) : ndata(0), data(0), factory(f) {} template inline Array::Array(const int n, const Factory &f) : ndata(0), data(0), factory(f) { alloc(n); } template inline Array::Array(const Array &a, const Factory &f) : ndata(0), data(0), factory(f) { alloc(a.ndata); for (int i = 0; i < a.ndata; i++) data[i] = a.data[i]; } template inline Array::Array(const std::string& values, const Factory &f) : ndata(0), data(0), factory(f) { std::istringstream buffer(values); buffer >> *this; } template inline Array::Array(const char* values, const Factory &f) : ndata(0), data(0), factory(f) { std::istringstream buffer(values); buffer >> *this; } template Array::~Array() { free(); } template void Array::set_size(int size, bool copy) { it_assert_debug(size >= 0, "Array::set_size(): New size must not be negative"); if (ndata == size) return; if (copy) { // create a temporary pointer to the allocated data T* tmp = data; // store the current number of elements int old_ndata = ndata; // check how many elements we need to copy int min = (ndata < size) ? ndata : size; // allocate new memory alloc(size); // copy old elements into a new memory region for (int i = 0; i < min; ++i) { data[i] = tmp[i]; } // initialize the rest of resized array for (int i = min; i < size; ++i) { data[i] = T(); } // delete old elements destroy_elements(tmp, old_ndata); } else { free(); alloc(size); } } template inline T& Array::operator()(int i) { it_assert_debug(in_range(i), "Array::operator(): Improper index"); return data[i]; } template inline const T& Array::operator()(int i) const { it_assert_debug(in_range(i), "Array::operator(): Improper index"); return data[i]; } template inline const Array Array::operator()(int i1, int i2) const { it_assert_debug(in_range(i1) && in_range(i2) && (i2 >= i1), "Array::operator()(i1, i2): Improper indexes."); Array s(i2 - i1 + 1); for (int i = 0; i < s.ndata; i++) s.data[i] = data[i1+i]; return s; } template inline const Array Array::operator()(const Array &indices) const { Array a(indices.size()); for (int i = 0; i < a.size(); i++) { it_assert_debug(in_range(indices(i)), "Array::operator()(indices): Improper indices."); a(i) = data[indices(i)]; } return a; } template inline Array& Array::operator=(const Array &a) { if (this != &a) { set_size(a.ndata); for (int i = 0; i < ndata; i++) data[i] = a.data[i]; } return *this; } template inline Array& Array::operator=(const T &e) { if (ndata == 0) set_size(1); for (int i = 0; i < ndata; i++) data[i] = e; return *this; } template Array& Array::operator=(const char* values) { std::istringstream buffer(values); buffer >> *this; return *this; } template Array Array::left(int n) const { it_assert_debug(in_range(n), "Array::left(): Index out of range"); Array tmp(n); for (int i = 0; i < n; ++i) tmp.data[i] = data[i]; return tmp; } template Array Array::right(int n) const { it_assert_debug(in_range(n), "Array::right(): Index out of range"); Array tmp(n); for (int i = 0; i < n; ++i) tmp.data[i] = data[ndata-n+i]; return tmp; } template Array Array::mid(int pos, int n) const { it_assert_debug((pos >= 0) && (n > 0) && (pos + n <= ndata), "Array::mid(): Indexing out of range"); Array tmp(n); for (int i = 0; i < n; ++i) tmp.data[i] = data[pos+i]; return tmp; } template T Array::shift_right(const T& x) { it_assert_debug(ndata > 0, "Array::shift_right(x): Array empty!"); T ret; ret = data[ndata-1]; for (int i = ndata - 1; i > 0; i--) data[i] = data[i-1]; data[0] = x; return ret; } template const Array Array::shift_right(const Array &a) { it_assert_debug(a.ndata <= ndata, "Array::shift_right(): Shift Array too large"); Array out(a.ndata); for (int i = 0; i < a.ndata; i++) out.data[i] = data[ndata-a.ndata+i]; for (int i = ndata - 1; i >= a.ndata; i--) data[i] = data[i-a.ndata]; for (int i = 0; i < a.ndata; i++) data[i] = a.data[i]; return out; } template T Array::shift_left(const T& x) { T temp = data[0]; for (int i = 0; i < ndata - 1; i++) data[i] = data[i+1]; data[ndata-1] = x; return temp; } template const Array Array::shift_left(const Array &a) { it_assert_debug(a.ndata <= ndata, "Array::shift_left(): Shift Array too large"); Array out(a.ndata); for (int i = 0; i < a.ndata; i++) out.data[i] = data[i]; for (int i = 0; i < ndata - a.ndata; i++) data[i] = data[i+a.ndata]; for (int i = ndata - a.ndata; i < ndata; i++) data[i] = a.data[i-ndata+a.ndata]; return out; } template void Array::swap(int i, int j) { it_assert_debug(in_range(i) && in_range(j), "Array::swap(): Indices out of range."); T temp = data[i]; data[i] = data[j]; data[j] = temp; } template void Array::set_subarray(int i1, int i2, const Array &a) { if (i1 == -1) i1 = ndata - 1; if (i2 == -1) i2 = ndata - 1; it_assert_debug(in_range(i1) && in_range(i2), "Array::set_subarray(): Indices out of range."); it_assert_debug(i2 >= i1, "Array::set_subarray(): i2 >= i1 necessary."); it_assert_debug(i2 - i1 + 1 == a.ndata, "Array::set_subarray(): Wrong sizes."); copy_vector(a.ndata, a.data, data + i1); } template void Array::set_subarray(int i1, int i2, const T &t) { if (i1 == -1) i1 = ndata - 1; if (i2 == -1) i2 = ndata - 1; it_assert_debug(in_range(i1) && in_range(i2), "Array::set_subarray(): Indices out of range"); it_assert_debug(i2 >= i1, "Array::set_subarray(): i2 >= i1 necessary"); for (int i = i1; i <= i2; i++) data[i] = t; } template const Array concat(const Array &a, const T &e) { Array temp(a.size() + 1); for (int i = 0; i < a.size(); i++) temp(i) = a(i); temp(a.size()) = e; return temp; } template const Array concat(const T &e, const Array &a) { Array temp(a.size() + 1); temp(0) = e; for (int i = 0; i < a.size(); i++) temp(i + 1) = a(i); return temp; } template const Array concat(const Array &a1, const Array &a2) { Array temp(a1.size() + a2.size()); for (int i = 0; i < a1.size(); i++) temp(i) = a1(i); for (int i = 0; i < a2.size(); i++) temp(a1.size() + i) = a2(i); return temp; } template const Array concat(const Array &a1, const Array &a2, const Array &a3) { // There should be some error control? Array temp(a1.size() + a2.size() + a3.size()); for (int i = 0; i < a1.size(); i++) temp(i) = a1(i); for (int i = 0; i < a2.size(); i++) temp(a1.size() + i) = a2(i); for (int i = 0; i < a3.size(); i++) temp(a1.size() + a2.size() + i) = a3(i); return temp; } /*! \relates Array \brief Output stream for Array. T must have ostream operator<< defined. */ template std::ostream &operator<<(std::ostream &os, const Array &a) { os << "{"; for (int i = 0; i < a.size() - 1; i++) os << a(i) << " "; if (a.size() > 0) os << a(a.size() - 1); os << "}"; return os; } /*! \relates Array \brief Input stream for Array. T must have istream operator>> defined. */ template std::istream &operator>>(std::istream &is, Array &a) { int nrof_elements = 0; char c; is >> c; if (c == '{') { is >> c; while (c != '}') { if (is.eof()) { is.setstate(std::ios_base::failbit); break; } if (c != ',') { // Discard comma signs between elements is.putback(c); } if (++nrof_elements > a.size()) { a.set_size(nrof_elements, true); // Too slow? } is >> a(nrof_elements - 1); is >> c; } if (a.size() > nrof_elements) { a.set_size(nrof_elements, true); } } else { is.setstate(std::ios_base::failbit); } return is; } /*! \relates Array \brief Assign a C-style string to an Array. T must have istream operator>> defined. */ template void set_array(Array &a, const char *values) { std::istringstream buffer(values); buffer >> a; } /*! \relates Array \brief Assign a string to an Array. T must have istream operator>> defined. */ template void set_array(Array &a, const std::string &str) { set_array(a, str.c_str()); } } // namespace itpp #endif // #ifndef ARRAY_H itpp-4.3.1/itpp/base/base_exports.h000066400000000000000000000037771216575753400172650ustar00rootroot00000000000000/*! * \file * \brief Import/Export definitions for some templates defined in base folder. * * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BASEEXPORTS_H #define BASEEXPORTS_H #include namespace itpp { //! \cond #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB)) //MSVC needs to explicitely instantiate required templates while building the //shared library. Also, these definitions are marked as imported when library is //linked with user's code. template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; template class ITPP_EXPORT Array >; template class ITPP_EXPORT Array >; template class ITPP_EXPORT Array >; template class ITPP_EXPORT Array >; #endif //! \endcond } #endif itpp-4.3.1/itpp/base/bessel.cpp000066400000000000000000000053361216575753400163700ustar00rootroot00000000000000/*! * \file * \brief Implementation of Bessel functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #ifndef _MSC_VER # include #else # include #endif namespace itpp { // Bessel function of order nu double besselj(int nu, double x) { return jn(nu, x); } vec besselj(int nu, const vec &x) { vec out(x.size()); for (int i = 0; i < x.size(); i++) out(i) = jn(nu, x(i)); return out; } // Bessel function of order nu. nu is real. double besselj(double nu, double x) { return jv(nu, x); } vec besselj(double nu, const vec &x) { vec out(x.size()); for (int i = 0; i < x.size(); i++) out(i) = jv(nu, x(i)); return out; } // Bessel function of second kind of order nu double bessely(int nu, double x) { return yn(nu, x); } vec bessely(int nu, const vec &x) { vec out(x.size()); for (int i = 0; i < x.size(); i++) out(i) = yn(nu, x(i)); return out; } // Bessel function of second kind of order nu double bessely(double nu, double x) { return yv(nu, x); } vec bessely(double nu, const vec &x) { vec out(x.size()); for (int i = 0; i < x.size(); i++) out(i) = yv(nu, x(i)); return out; } // Modified Bessel function of order nu double besseli(double nu, double x) { return iv(nu, x); } vec besseli(double nu, const vec &x) { vec out(x.size()); for (int i = 0; i < x.size(); i++) out(i) = iv(nu, x(i)); return out; } // Modified Bessel function of second kind of order n double besselk(int n, double x) { return kn(n, x); } vec besselk(int nu, const vec &x) { vec out(x.size()); for (int i = 0; i < x.size(); i++) out(i) = kn(nu, x(i)); return out; } } // namespace itpp itpp-4.3.1/itpp/base/bessel.h000066400000000000000000000077331216575753400160400ustar00rootroot00000000000000/*! * \file * \brief Definitions of Bessel functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BESSEL_H #define BESSEL_H #include #include namespace itpp { /*! \addtogroup besselfunctions */ /*! \ingroup besselfunctions \brief Bessel function of first kind of order \a nu for \a nu integer The bessel function of first kind is defined as: \f[ J_{\nu}(x) = \sum_{k=0}^{\infty} \frac{ (-1)^{k} }{k! \Gamma(\nu+k+1) } \left(\frac{x}{2}\right)^{\nu+2k} \f] where \f$\nu\f$ is the order and \f$ 0 < x < \infty \f$. */ ITPP_EXPORT double besselj(int nu, double x); /*! \ingroup besselfunctions \brief Bessel function of first kind of order \a nu for \a nu integer */ ITPP_EXPORT vec besselj(int nu, const vec &x); /*! \ingroup besselfunctions \brief Bessel function of first kind of order \a nu. \a nu is real. */ ITPP_EXPORT double besselj(double nu, double x); /*! \ingroup besselfunctions \brief Bessel function of first kind of order \a nu. \a nu is real. */ ITPP_EXPORT vec besselj(double nu, const vec &x); /*! \ingroup besselfunctions \brief Bessel function of second kind of order \a nu. \a nu is integer. The Bessel function of second kind is defined as: \f[ Y_{\nu}(x) = \frac{J_{\nu}(x) \cos(\nu\pi) - J_{-\nu}(x)}{\sin(\nu\pi)} \f] where \f$\nu\f$ is the order and \f$ 0 < x < \infty \f$. */ ITPP_EXPORT double bessely(int nu, double x); /*! \ingroup besselfunctions \brief Bessel function of second kind of order \a nu. \a nu is integer. */ ITPP_EXPORT vec bessely(int nu, const vec &x); /*! \ingroup besselfunctions \brief Bessel function of second kind of order \a nu. \a nu is real. */ ITPP_EXPORT double bessely(double nu, double x); /*! \ingroup besselfunctions \brief Bessel function of second kind of order \a nu. \a nu is real. */ ITPP_EXPORT vec bessely(double nu, const vec &x); /*! \ingroup besselfunctions \brief Modified Bessel function of first kind of order \a nu. \a nu is \a double. \a x is \a double. The Modified Bessel function of first kind is defined as: \f[ I_{\nu}(x) = i^{-\nu} J_{\nu}(ix) \f] where \f$\nu\f$ is the order and \f$ 0 < x < \infty \f$. */ ITPP_EXPORT double besseli(double nu, double x); /*! \ingroup besselfunctions \brief Modified Bessel function of first kind of order \a nu. \a nu is \a double. \a x is \a double. */ ITPP_EXPORT vec besseli(double nu, const vec &x); /*! \ingroup besselfunctions \brief Modified Bessel function of second kind of order \a nu. \a nu is double. \a x is double. The Modified Bessel function of second kind is defined as: \f[ K_{\nu}(x) = \frac{\pi}{2} i^{\nu+1} [J_{\nu}(ix) + i Y_{\nu}(ix)] \f] where \f$\nu\f$ is the order and \f$ 0 < x < \infty \f$. */ ITPP_EXPORT double besselk(int nu, double x); /*! \ingroup besselfunctions \brief Modified Bessel function of second kind of order \a nu. \a nu is double. \a x is double. */ ITPP_EXPORT vec besselk(int nu, const vec &x); } //namespace itpp #endif // #ifndef BESSEL_H itpp-4.3.1/itpp/base/bessel/000077500000000000000000000000001216575753400156555ustar00rootroot00000000000000itpp-4.3.1/itpp/base/bessel/Makefile.am000066400000000000000000000006611216575753400177140ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libbessel.la if ENABLE_DEBUG noinst_LTLIBRARIES += libbessel_debug.la endif libbessel_la_SOURCES = $(noinst_h_base_bessel_sources) \ $(cpp_base_bessel_sources) libbessel_la_CXXFLAGS = $(CXXFLAGS_OPT) libbessel_debug_la_SOURCES = $(noinst_h_base_bessel_sources) \ $(cpp_base_bessel_sources) libbessel_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) itpp-4.3.1/itpp/base/bessel/Makefile.in000066400000000000000000001431071216575753400177300ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/sources.mk $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libbessel_debug.la subdir = itpp/base/bessel ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbessel_la_LIBADD = am__objects_1 = am__objects_2 = libbessel_la-airy.lo libbessel_la-chbevl.lo \ libbessel_la-gamma.lo libbessel_la-hyperg.lo \ libbessel_la-i0.lo libbessel_la-i1.lo libbessel_la-iv.lo \ libbessel_la-jv.lo libbessel_la-k0.lo libbessel_la-k1.lo \ libbessel_la-kn.lo libbessel_la-polevl.lo \ libbessel_la-struve.lo am_libbessel_la_OBJECTS = $(am__objects_1) $(am__objects_2) libbessel_la_OBJECTS = $(am_libbessel_la_OBJECTS) libbessel_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libbessel_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libbessel_debug_la_LIBADD = am__objects_3 = libbessel_debug_la-airy.lo \ libbessel_debug_la-chbevl.lo libbessel_debug_la-gamma.lo \ libbessel_debug_la-hyperg.lo libbessel_debug_la-i0.lo \ libbessel_debug_la-i1.lo libbessel_debug_la-iv.lo \ libbessel_debug_la-jv.lo libbessel_debug_la-k0.lo \ libbessel_debug_la-k1.lo libbessel_debug_la-kn.lo \ libbessel_debug_la-polevl.lo libbessel_debug_la-struve.lo am_libbessel_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libbessel_debug_la_OBJECTS = $(am_libbessel_debug_la_OBJECTS) libbessel_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libbessel_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbessel_la_SOURCES) $(libbessel_debug_la_SOURCES) DIST_SOURCES = $(libbessel_la_SOURCES) $(libbessel_debug_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) noinst_h_base_bessel_sources = \ $(top_srcdir)/itpp/base/bessel/bessel_internal.h cpp_base_bessel_sources = \ $(top_srcdir)/itpp/base/bessel/airy.cpp \ $(top_srcdir)/itpp/base/bessel/chbevl.cpp \ $(top_srcdir)/itpp/base/bessel/gamma.cpp \ $(top_srcdir)/itpp/base/bessel/hyperg.cpp \ $(top_srcdir)/itpp/base/bessel/i0.cpp \ $(top_srcdir)/itpp/base/bessel/i1.cpp \ $(top_srcdir)/itpp/base/bessel/iv.cpp \ $(top_srcdir)/itpp/base/bessel/jv.cpp \ $(top_srcdir)/itpp/base/bessel/k0.cpp \ $(top_srcdir)/itpp/base/bessel/k1.cpp \ $(top_srcdir)/itpp/base/bessel/kn.cpp \ $(top_srcdir)/itpp/base/bessel/polevl.cpp \ $(top_srcdir)/itpp/base/bessel/struve.cpp noinst_LTLIBRARIES = libbessel.la $(am__append_1) libbessel_la_SOURCES = $(noinst_h_base_bessel_sources) \ $(cpp_base_bessel_sources) libbessel_la_CXXFLAGS = $(CXXFLAGS_OPT) libbessel_debug_la_SOURCES = $(noinst_h_base_bessel_sources) \ $(cpp_base_bessel_sources) libbessel_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/base/bessel/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/base/bessel/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libbessel.la: $(libbessel_la_OBJECTS) $(libbessel_la_DEPENDENCIES) $(libbessel_la_LINK) $(libbessel_la_OBJECTS) $(libbessel_la_LIBADD) $(LIBS) libbessel_debug.la: $(libbessel_debug_la_OBJECTS) $(libbessel_debug_la_DEPENDENCIES) $(libbessel_debug_la_LINK) $(am_libbessel_debug_la_rpath) $(libbessel_debug_la_OBJECTS) $(libbessel_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-airy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-chbevl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-gamma.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-hyperg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-i0.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-i1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-iv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-jv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-k0.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-k1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-kn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-polevl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_debug_la-struve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-airy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-chbevl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-gamma.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-hyperg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-i0.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-i1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-iv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-jv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-k0.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-k1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-kn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-polevl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbessel_la-struve.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libbessel_la-airy.lo: $(top_srcdir)/itpp/base/bessel/airy.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-airy.lo -MD -MP -MF $(DEPDIR)/libbessel_la-airy.Tpo -c -o libbessel_la-airy.lo `test -f '$(top_srcdir)/itpp/base/bessel/airy.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/airy.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-airy.Tpo $(DEPDIR)/libbessel_la-airy.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/airy.cpp' object='libbessel_la-airy.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-airy.lo `test -f '$(top_srcdir)/itpp/base/bessel/airy.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/airy.cpp libbessel_la-chbevl.lo: $(top_srcdir)/itpp/base/bessel/chbevl.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-chbevl.lo -MD -MP -MF $(DEPDIR)/libbessel_la-chbevl.Tpo -c -o libbessel_la-chbevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/chbevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/chbevl.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-chbevl.Tpo $(DEPDIR)/libbessel_la-chbevl.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/chbevl.cpp' object='libbessel_la-chbevl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-chbevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/chbevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/chbevl.cpp libbessel_la-gamma.lo: $(top_srcdir)/itpp/base/bessel/gamma.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-gamma.lo -MD -MP -MF $(DEPDIR)/libbessel_la-gamma.Tpo -c -o libbessel_la-gamma.lo `test -f '$(top_srcdir)/itpp/base/bessel/gamma.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/gamma.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-gamma.Tpo $(DEPDIR)/libbessel_la-gamma.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/gamma.cpp' object='libbessel_la-gamma.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-gamma.lo `test -f '$(top_srcdir)/itpp/base/bessel/gamma.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/gamma.cpp libbessel_la-hyperg.lo: $(top_srcdir)/itpp/base/bessel/hyperg.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-hyperg.lo -MD -MP -MF $(DEPDIR)/libbessel_la-hyperg.Tpo -c -o libbessel_la-hyperg.lo `test -f '$(top_srcdir)/itpp/base/bessel/hyperg.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/hyperg.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-hyperg.Tpo $(DEPDIR)/libbessel_la-hyperg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/hyperg.cpp' object='libbessel_la-hyperg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-hyperg.lo `test -f '$(top_srcdir)/itpp/base/bessel/hyperg.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/hyperg.cpp libbessel_la-i0.lo: $(top_srcdir)/itpp/base/bessel/i0.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-i0.lo -MD -MP -MF $(DEPDIR)/libbessel_la-i0.Tpo -c -o libbessel_la-i0.lo `test -f '$(top_srcdir)/itpp/base/bessel/i0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i0.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-i0.Tpo $(DEPDIR)/libbessel_la-i0.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/i0.cpp' object='libbessel_la-i0.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-i0.lo `test -f '$(top_srcdir)/itpp/base/bessel/i0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i0.cpp libbessel_la-i1.lo: $(top_srcdir)/itpp/base/bessel/i1.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-i1.lo -MD -MP -MF $(DEPDIR)/libbessel_la-i1.Tpo -c -o libbessel_la-i1.lo `test -f '$(top_srcdir)/itpp/base/bessel/i1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i1.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-i1.Tpo $(DEPDIR)/libbessel_la-i1.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/i1.cpp' object='libbessel_la-i1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-i1.lo `test -f '$(top_srcdir)/itpp/base/bessel/i1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i1.cpp libbessel_la-iv.lo: $(top_srcdir)/itpp/base/bessel/iv.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-iv.lo -MD -MP -MF $(DEPDIR)/libbessel_la-iv.Tpo -c -o libbessel_la-iv.lo `test -f '$(top_srcdir)/itpp/base/bessel/iv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/iv.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-iv.Tpo $(DEPDIR)/libbessel_la-iv.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/iv.cpp' object='libbessel_la-iv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-iv.lo `test -f '$(top_srcdir)/itpp/base/bessel/iv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/iv.cpp libbessel_la-jv.lo: $(top_srcdir)/itpp/base/bessel/jv.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-jv.lo -MD -MP -MF $(DEPDIR)/libbessel_la-jv.Tpo -c -o libbessel_la-jv.lo `test -f '$(top_srcdir)/itpp/base/bessel/jv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/jv.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-jv.Tpo $(DEPDIR)/libbessel_la-jv.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/jv.cpp' object='libbessel_la-jv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-jv.lo `test -f '$(top_srcdir)/itpp/base/bessel/jv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/jv.cpp libbessel_la-k0.lo: $(top_srcdir)/itpp/base/bessel/k0.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-k0.lo -MD -MP -MF $(DEPDIR)/libbessel_la-k0.Tpo -c -o libbessel_la-k0.lo `test -f '$(top_srcdir)/itpp/base/bessel/k0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k0.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-k0.Tpo $(DEPDIR)/libbessel_la-k0.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/k0.cpp' object='libbessel_la-k0.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-k0.lo `test -f '$(top_srcdir)/itpp/base/bessel/k0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k0.cpp libbessel_la-k1.lo: $(top_srcdir)/itpp/base/bessel/k1.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-k1.lo -MD -MP -MF $(DEPDIR)/libbessel_la-k1.Tpo -c -o libbessel_la-k1.lo `test -f '$(top_srcdir)/itpp/base/bessel/k1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k1.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-k1.Tpo $(DEPDIR)/libbessel_la-k1.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/k1.cpp' object='libbessel_la-k1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-k1.lo `test -f '$(top_srcdir)/itpp/base/bessel/k1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k1.cpp libbessel_la-kn.lo: $(top_srcdir)/itpp/base/bessel/kn.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-kn.lo -MD -MP -MF $(DEPDIR)/libbessel_la-kn.Tpo -c -o libbessel_la-kn.lo `test -f '$(top_srcdir)/itpp/base/bessel/kn.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/kn.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-kn.Tpo $(DEPDIR)/libbessel_la-kn.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/kn.cpp' object='libbessel_la-kn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-kn.lo `test -f '$(top_srcdir)/itpp/base/bessel/kn.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/kn.cpp libbessel_la-polevl.lo: $(top_srcdir)/itpp/base/bessel/polevl.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-polevl.lo -MD -MP -MF $(DEPDIR)/libbessel_la-polevl.Tpo -c -o libbessel_la-polevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/polevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/polevl.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-polevl.Tpo $(DEPDIR)/libbessel_la-polevl.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/polevl.cpp' object='libbessel_la-polevl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-polevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/polevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/polevl.cpp libbessel_la-struve.lo: $(top_srcdir)/itpp/base/bessel/struve.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_la-struve.lo -MD -MP -MF $(DEPDIR)/libbessel_la-struve.Tpo -c -o libbessel_la-struve.lo `test -f '$(top_srcdir)/itpp/base/bessel/struve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/struve.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_la-struve.Tpo $(DEPDIR)/libbessel_la-struve.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/struve.cpp' object='libbessel_la-struve.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_la-struve.lo `test -f '$(top_srcdir)/itpp/base/bessel/struve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/struve.cpp libbessel_debug_la-airy.lo: $(top_srcdir)/itpp/base/bessel/airy.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-airy.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-airy.Tpo -c -o libbessel_debug_la-airy.lo `test -f '$(top_srcdir)/itpp/base/bessel/airy.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/airy.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-airy.Tpo $(DEPDIR)/libbessel_debug_la-airy.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/airy.cpp' object='libbessel_debug_la-airy.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-airy.lo `test -f '$(top_srcdir)/itpp/base/bessel/airy.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/airy.cpp libbessel_debug_la-chbevl.lo: $(top_srcdir)/itpp/base/bessel/chbevl.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-chbevl.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-chbevl.Tpo -c -o libbessel_debug_la-chbevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/chbevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/chbevl.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-chbevl.Tpo $(DEPDIR)/libbessel_debug_la-chbevl.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/chbevl.cpp' object='libbessel_debug_la-chbevl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-chbevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/chbevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/chbevl.cpp libbessel_debug_la-gamma.lo: $(top_srcdir)/itpp/base/bessel/gamma.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-gamma.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-gamma.Tpo -c -o libbessel_debug_la-gamma.lo `test -f '$(top_srcdir)/itpp/base/bessel/gamma.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/gamma.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-gamma.Tpo $(DEPDIR)/libbessel_debug_la-gamma.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/gamma.cpp' object='libbessel_debug_la-gamma.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-gamma.lo `test -f '$(top_srcdir)/itpp/base/bessel/gamma.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/gamma.cpp libbessel_debug_la-hyperg.lo: $(top_srcdir)/itpp/base/bessel/hyperg.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-hyperg.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-hyperg.Tpo -c -o libbessel_debug_la-hyperg.lo `test -f '$(top_srcdir)/itpp/base/bessel/hyperg.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/hyperg.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-hyperg.Tpo $(DEPDIR)/libbessel_debug_la-hyperg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/hyperg.cpp' object='libbessel_debug_la-hyperg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-hyperg.lo `test -f '$(top_srcdir)/itpp/base/bessel/hyperg.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/hyperg.cpp libbessel_debug_la-i0.lo: $(top_srcdir)/itpp/base/bessel/i0.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-i0.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-i0.Tpo -c -o libbessel_debug_la-i0.lo `test -f '$(top_srcdir)/itpp/base/bessel/i0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i0.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-i0.Tpo $(DEPDIR)/libbessel_debug_la-i0.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/i0.cpp' object='libbessel_debug_la-i0.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-i0.lo `test -f '$(top_srcdir)/itpp/base/bessel/i0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i0.cpp libbessel_debug_la-i1.lo: $(top_srcdir)/itpp/base/bessel/i1.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-i1.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-i1.Tpo -c -o libbessel_debug_la-i1.lo `test -f '$(top_srcdir)/itpp/base/bessel/i1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i1.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-i1.Tpo $(DEPDIR)/libbessel_debug_la-i1.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/i1.cpp' object='libbessel_debug_la-i1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-i1.lo `test -f '$(top_srcdir)/itpp/base/bessel/i1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/i1.cpp libbessel_debug_la-iv.lo: $(top_srcdir)/itpp/base/bessel/iv.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-iv.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-iv.Tpo -c -o libbessel_debug_la-iv.lo `test -f '$(top_srcdir)/itpp/base/bessel/iv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/iv.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-iv.Tpo $(DEPDIR)/libbessel_debug_la-iv.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/iv.cpp' object='libbessel_debug_la-iv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-iv.lo `test -f '$(top_srcdir)/itpp/base/bessel/iv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/iv.cpp libbessel_debug_la-jv.lo: $(top_srcdir)/itpp/base/bessel/jv.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-jv.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-jv.Tpo -c -o libbessel_debug_la-jv.lo `test -f '$(top_srcdir)/itpp/base/bessel/jv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/jv.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-jv.Tpo $(DEPDIR)/libbessel_debug_la-jv.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/jv.cpp' object='libbessel_debug_la-jv.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-jv.lo `test -f '$(top_srcdir)/itpp/base/bessel/jv.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/jv.cpp libbessel_debug_la-k0.lo: $(top_srcdir)/itpp/base/bessel/k0.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-k0.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-k0.Tpo -c -o libbessel_debug_la-k0.lo `test -f '$(top_srcdir)/itpp/base/bessel/k0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k0.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-k0.Tpo $(DEPDIR)/libbessel_debug_la-k0.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/k0.cpp' object='libbessel_debug_la-k0.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-k0.lo `test -f '$(top_srcdir)/itpp/base/bessel/k0.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k0.cpp libbessel_debug_la-k1.lo: $(top_srcdir)/itpp/base/bessel/k1.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-k1.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-k1.Tpo -c -o libbessel_debug_la-k1.lo `test -f '$(top_srcdir)/itpp/base/bessel/k1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k1.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-k1.Tpo $(DEPDIR)/libbessel_debug_la-k1.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/k1.cpp' object='libbessel_debug_la-k1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-k1.lo `test -f '$(top_srcdir)/itpp/base/bessel/k1.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/k1.cpp libbessel_debug_la-kn.lo: $(top_srcdir)/itpp/base/bessel/kn.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-kn.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-kn.Tpo -c -o libbessel_debug_la-kn.lo `test -f '$(top_srcdir)/itpp/base/bessel/kn.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/kn.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-kn.Tpo $(DEPDIR)/libbessel_debug_la-kn.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/kn.cpp' object='libbessel_debug_la-kn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-kn.lo `test -f '$(top_srcdir)/itpp/base/bessel/kn.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/kn.cpp libbessel_debug_la-polevl.lo: $(top_srcdir)/itpp/base/bessel/polevl.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-polevl.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-polevl.Tpo -c -o libbessel_debug_la-polevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/polevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/polevl.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-polevl.Tpo $(DEPDIR)/libbessel_debug_la-polevl.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/polevl.cpp' object='libbessel_debug_la-polevl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-polevl.lo `test -f '$(top_srcdir)/itpp/base/bessel/polevl.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/polevl.cpp libbessel_debug_la-struve.lo: $(top_srcdir)/itpp/base/bessel/struve.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libbessel_debug_la-struve.lo -MD -MP -MF $(DEPDIR)/libbessel_debug_la-struve.Tpo -c -o libbessel_debug_la-struve.lo `test -f '$(top_srcdir)/itpp/base/bessel/struve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/struve.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libbessel_debug_la-struve.Tpo $(DEPDIR)/libbessel_debug_la-struve.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/bessel/struve.cpp' object='libbessel_debug_la-struve.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbessel_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libbessel_debug_la-struve.lo `test -f '$(top_srcdir)/itpp/base/bessel/struve.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/bessel/struve.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/base/bessel/airy.cpp000066400000000000000000000227241216575753400173340ustar00rootroot00000000000000/*! * \file * \brief Implementation of Airy function * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include /* * Airy function * * double x, ai, aip, bi, bip; * int airy(); * * airy( x, _&ai, _&aip, _&bi, _&bip ); * * DESCRIPTION: * * Solution of the differential equation * * y"(x) = xy. * * The function returns the two independent solutions Ai, Bi * and their first derivatives Ai'(x), Bi'(x). * * Evaluation is by power series summation for small x, * by rational minimax approximations for large x. * * ACCURACY: * Error criterion is absolute when function <= 1, relative * when function > 1, except * denotes relative error criterion. * For large negative x, the absolute error increases as x^1.5. * For large positive x, the relative error increases as x^1.5. * * Arithmetic domain function # trials peak rms * IEEE -10, 0 Ai 10000 1.6e-15 2.7e-16 * IEEE 0, 10 Ai 10000 2.3e-14* 1.8e-15* * IEEE -10, 0 Ai' 10000 4.6e-15 7.6e-16 * IEEE 0, 10 Ai' 10000 1.8e-14* 1.5e-15* * IEEE -10, 10 Bi 30000 4.2e-15 5.3e-16 * IEEE -10, 10 Bi' 30000 4.9e-15 7.3e-16 */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier */ static double c1 = 0.35502805388781723926; static double c2 = 0.258819403792806798405; static double sqrt3 = 1.732050807568877293527; static double sqpii = 5.64189583547756286948E-1; #define MAXAIRY 25.77 #define PI 3.14159265358979323846 /* pi */ #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ #define MACHEP 1.11022302462515654042E-16 /* 2**-53 */ static double AN[8] = { 3.46538101525629032477E-1, 1.20075952739645805542E1, 7.62796053615234516538E1, 1.68089224934630576269E2, 1.59756391350164413639E2, 7.05360906840444183113E1, 1.40264691163389668864E1, 9.99999999999999995305E-1, }; static double AD[8] = { 5.67594532638770212846E-1, 1.47562562584847203173E1, 8.45138970141474626562E1, 1.77318088145400459522E2, 1.64234692871529701831E2, 7.14778400825575695274E1, 1.40959135607834029598E1, 1.00000000000000000470E0, }; static double APN[8] = { 6.13759184814035759225E-1, 1.47454670787755323881E1, 8.20584123476060982430E1, 1.71184781360976385540E2, 1.59317847137141783523E2, 6.99778599330103016170E1, 1.39470856980481566958E1, 1.00000000000000000550E0, }; static double APD[8] = { 3.34203677749736953049E-1, 1.11810297306158156705E1, 7.11727352147859965283E1, 1.58778084372838313640E2, 1.53206427475809220834E2, 6.86752304592780337944E1, 1.38498634758259442477E1, 9.99999999999999994502E-1, }; static double BN16[5] = { -2.53240795869364152689E-1, 5.75285167332467384228E-1, -3.29907036873225371650E-1, 6.44404068948199951727E-2, -3.82519546641336734394E-3, }; static double BD16[5] = { /* 1.00000000000000000000E0,*/ -7.15685095054035237902E0, 1.06039580715664694291E1, -5.23246636471251500874E0, 9.57395864378383833152E-1, -5.50828147163549611107E-2, }; static double BPPN[5] = { 4.65461162774651610328E-1, -1.08992173800493920734E0, 6.38800117371827987759E-1, -1.26844349553102907034E-1, 7.62487844342109852105E-3, }; static double BPPD[5] = { /* 1.00000000000000000000E0,*/ -8.70622787633159124240E0, 1.38993162704553213172E1, -7.14116144616431159572E0, 1.34008595960680518666E0, -7.84273211323341930448E-2, }; static double AFN[9] = { -1.31696323418331795333E-1, -6.26456544431912369773E-1, -6.93158036036933542233E-1, -2.79779981545119124951E-1, -4.91900132609500318020E-2, -4.06265923594885404393E-3, -1.59276496239262096340E-4, -2.77649108155232920844E-6, -1.67787698489114633780E-8, }; static double AFD[9] = { /* 1.00000000000000000000E0,*/ 1.33560420706553243746E1, 3.26825032795224613948E1, 2.67367040941499554804E1, 9.18707402907259625840E0, 1.47529146771666414581E0, 1.15687173795188044134E-1, 4.40291641615211203805E-3, 7.54720348287414296618E-5, 4.51850092970580378464E-7, }; static double AGN[11] = { 1.97339932091685679179E-2, 3.91103029615688277255E-1, 1.06579897599595591108E0, 9.39169229816650230044E-1, 3.51465656105547619242E-1, 6.33888919628925490927E-2, 5.85804113048388458567E-3, 2.82851600836737019778E-4, 6.98793669997260967291E-6, 8.11789239554389293311E-8, 3.41551784765923618484E-10, }; static double AGD[10] = { /* 1.00000000000000000000E0,*/ 9.30892908077441974853E0, 1.98352928718312140417E1, 1.55646628932864612953E1, 5.47686069422975497931E0, 9.54293611618961883998E-1, 8.64580826352392193095E-2, 4.12656523824222607191E-3, 1.01259085116509135510E-4, 1.17166733214413521882E-6, 4.91834570062930015649E-9, }; static double APFN[9] = { 1.85365624022535566142E-1, 8.86712188052584095637E-1, 9.87391981747398547272E-1, 4.01241082318003734092E-1, 7.10304926289631174579E-2, 5.90618657995661810071E-3, 2.33051409401776799569E-4, 4.08718778289035454598E-6, 2.48379932900442457853E-8, }; static double APFD[9] = { /* 1.00000000000000000000E0,*/ 1.47345854687502542552E1, 3.75423933435489594466E1, 3.14657751203046424330E1, 1.09969125207298778536E1, 1.78885054766999417817E0, 1.41733275753662636873E-1, 5.44066067017226003627E-3, 9.39421290654511171663E-5, 5.65978713036027009243E-7, }; static double APGN[11] = { -3.55615429033082288335E-2, -6.37311518129435504426E-1, -1.70856738884312371053E0, -1.50221872117316635393E0, -5.63606665822102676611E-1, -1.02101031120216891789E-1, -9.48396695961445269093E-3, -4.60325307486780994357E-4, -1.14300836484517375919E-5, -1.33415518685547420648E-7, -5.63803833958893494476E-10, }; static double APGD[11] = { /* 1.00000000000000000000E0,*/ 9.85865801696130355144E0, 2.16401867356585941885E1, 1.73130776389749389525E1, 6.17872175280828766327E0, 1.08848694396321495475E0, 9.95005543440888479402E-2, 4.78468199683886610842E-3, 1.18159633322838625562E-4, 1.37480673554219441465E-6, 5.79912514929147598821E-9, }; int airy(double x, double *ai, double *aip, double *bi, double *bip) { double z, zz, t, f, g, uf, ug, k, zeta, theta; int domflg; domflg = 0; if (x > MAXAIRY) { *ai = 0; *aip = 0; *bi = MAXNUM; *bip = MAXNUM; return(-1); } if (x < -2.09) { domflg = 15; t = sqrt(-x); zeta = -2.0 * x * t / 3.0; t = sqrt(t); k = sqpii / t; z = 1.0 / zeta; zz = z * z; uf = 1.0 + zz * polevl(zz, AFN, 8) / p1evl(zz, AFD, 9); ug = z * polevl(zz, AGN, 10) / p1evl(zz, AGD, 10); theta = zeta + 0.25 * PI; f = sin(theta); g = cos(theta); *ai = k * (f * uf - g * ug); *bi = k * (g * uf + f * ug); uf = 1.0 + zz * polevl(zz, APFN, 8) / p1evl(zz, APFD, 9); ug = z * polevl(zz, APGN, 10) / p1evl(zz, APGD, 10); k = sqpii * t; *aip = -k * (g * uf + f * ug); *bip = k * (f * uf - g * ug); return(0); } if (x >= 2.09) { /* cbrt(9) */ domflg = 5; t = sqrt(x); zeta = 2.0 * x * t / 3.0; g = exp(zeta); t = sqrt(t); k = 2.0 * t * g; z = 1.0 / zeta; f = polevl(z, AN, 7) / polevl(z, AD, 7); *ai = sqpii * f / k; k = -0.5 * sqpii * t / g; f = polevl(z, APN, 7) / polevl(z, APD, 7); *aip = f * k; if (x > 8.3203353) { /* zeta > 16 */ f = z * polevl(z, BN16, 4) / p1evl(z, BD16, 5); k = sqpii * g; *bi = k * (1.0 + f) / t; f = z * polevl(z, BPPN, 4) / p1evl(z, BPPD, 5); *bip = k * t * (1.0 + f); return(0); } } f = 1.0; g = x; t = 1.0; uf = 1.0; ug = x; k = 1.0; z = x * x * x; while (t > MACHEP) { uf *= z; k += 1.0; uf /= k; ug *= z; k += 1.0; ug /= k; uf /= k; f += uf; k += 1.0; ug /= k; g += ug; t = fabs(uf / f); } uf = c1 * f; ug = c2 * g; if ((domflg & 1) == 0) *ai = uf - ug; if ((domflg & 2) == 0) *bi = sqrt3 * (uf + ug); /* the deriviative of ai */ k = 4.0; uf = x * x / 2.0; ug = z / 3.0; f = uf; g = 1.0 + ug; uf /= 3.0; t = 1.0; while (t > MACHEP) { uf *= z; ug /= k; k += 1.0; ug *= z; uf /= k; f += uf; k += 1.0; ug /= k; uf /= k; g += ug; k += 1.0; t = fabs(ug / g); } uf = c1 * f; ug = c2 * g; if ((domflg & 4) == 0) *aip = uf - ug; if ((domflg & 8) == 0) *bip = sqrt3 * (uf + ug); return(0); } itpp-4.3.1/itpp/base/bessel/bessel_internal.h000066400000000000000000000035151216575753400212030ustar00rootroot00000000000000/*! * \file * \brief Bessel help functions header. For internal use only. * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BESSEL_INTERNAL_H #define BESSEL_INTERNAL_H //! \cond #include double chbevl(double x, double array[], int n); double hyperg(double a, double b, double x); int airy(double x, double *ai, double *aip, double *bi, double *bip); double polevl(double x, double coef[], int N); double p1evl(double x, double coef[], int N); double i0(double x); double i0e(double x); double i1(double x); double i1e(double x); double k0(double x); double k0e(double x); double k1(double x); double k1e(double x); double iv(double nu, double x); double jv(double nu, double x); double yv(double nu, double x); double kn(int n, double x); double gam(double x); double lgam(double x); extern int sgngam; //! \endcond #endif // #ifndef BESSEL_INTERNAL_H itpp-4.3.1/itpp/base/bessel/chbevl.cpp000066400000000000000000000052651216575753400176340ustar00rootroot00000000000000/*! * \file * \brief Implementation of Chebyshev series evaluation function * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include /* * Evaluate Chebyshev series * * int N; * double x, y, coef[N], chebevl(); * * y = chbevl( x, coef, N ); * * DESCRIPTION: * * Evaluates the series * * N-1 * - ' * y = > coef[i] T (x/2) * - i * i=0 * * of Chebyshev polynomials Ti at argument x/2. * * Coefficients are stored in reverse order, i.e. the zero * order term is last in the array. Note N is the number of * coefficients, not the order. * * If coefficients are for the interval a to b, x must * have been transformed to x -> 2(2x - b - a)/(b-a) before * entering the routine. This maps x from (a, b) to (-1, 1), * over which the Chebyshev polynomials are defined. * * If the coefficients are for the inverted interval, in * which (a, b) is mapped to (1/b, 1/a), the transformation * required is x -> 2(2ab/x - b - a)/(b-a). If b is infinity, * this becomes x -> 4a/x - 1. * * SPEED: * * Taking advantage of the recurrence properties of the * Chebyshev polynomials, the routine requires one more * addition per loop than evaluating a nested polynomial of * the same degree. */ /* Cephes Math Library Release 2.0: April, 1987 Copyright 1985, 1987 by Stephen L. Moshier */ double chbevl(double x, double array[], int n) { double b0, b1, b2, *p; int i; p = array; b0 = *p++; b1 = 0.0; i = n - 1; do { b2 = b1; b1 = b0; b0 = x * b1 - b2 + *p++; } while (--i); return(0.5*(b0 - b2)); } itpp-4.3.1/itpp/base/bessel/gamma.cpp000066400000000000000000000214001216575753400174400ustar00rootroot00000000000000/*! * \file * \brief Implementation of gamma functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include #include #include /* * Gamma function * * * SYNOPSIS: * * double x, y, gam(); * extern int sgngam; * * y = gam( x ); * * * DESCRIPTION: * * Returns gamma function of the argument. The result is * correctly signed, and the sign (+1 or -1) is also * returned in a global (extern) variable named sgngam. * This variable is also filled in by the logarithmic gamma * function lgam(). * * Arguments |x| <= 34 are reduced by recurrence and the function * approximated by a rational function of degree 6/7 in the * interval (2,3). Large arguments are handled by Stirling's * formula. Large negative arguments are made positive using * a reflection formula. * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE -170,-33 20000 2.3e-15 3.3e-16 * IEEE -33, 33 20000 9.4e-16 2.2e-16 * IEEE 33, 171.6 20000 2.3e-15 3.2e-16 * * Error for arguments outside the test range will be larger * owing to error amplification by the exponential function. */ /* * Natural logarithm of gamma function * * * SYNOPSIS: * * double x, y, lgam(); * extern int sgngam; * * y = lgam( x ); * * * DESCRIPTION: * * Returns the base e (2.718...) logarithm of the absolute * value of the gamma function of the argument. * The sign (+1 or -1) of the gamma function is returned in a * global (extern) variable named sgngam. * * For arguments greater than 13, the logarithm of the gamma * function is approximated by the logarithmic version of * Stirling's formula using a polynomial approximation of * degree 4. Arguments between -33 and +33 are reduced by * recurrence to the interval [2,3] of a rational approximation. * The cosecant reflection formula is employed for arguments * less than -33. * * Arguments greater than MAXLGM return INFINITY and an error * message. MAXLGM = 2.556348e305 for IEEE arithmetic. * * * ACCURACY: * * arithmetic domain # trials peak rms * IEEE 0, 3 28000 5.4e-16 1.1e-16 * IEEE 2.718, 2.556e305 40000 3.5e-16 8.3e-17 * The error criterion was relative when the function magnitude * was greater than one but absolute when it was less than one. * * The following test used the relative error criterion, though * at certain points the relative error could be much higher than * indicated. * IEEE -200, -4 10000 4.8e-16 1.3e-16 */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier */ #ifndef INFINITY # define INFINITY 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ #endif #ifndef NAN # define NAN 0.0 #endif static double P[] = { 1.60119522476751861407E-4, 1.19135147006586384913E-3, 1.04213797561761569935E-2, 4.76367800457137231464E-2, 2.07448227648435975150E-1, 4.94214826801497100753E-1, 9.99999999999999996796E-1 }; static double Q[] = { -2.31581873324120129819E-5, 5.39605580493303397842E-4, -4.45641913851797240494E-3, 1.18139785222060435552E-2, 3.58236398605498653373E-2, -2.34591795718243348568E-1, 7.14304917030273074085E-2, 1.00000000000000000320E0 }; static double LOGPI = 1.14472988584940017414; /* Stirling's formula for the gamma function */ static double STIR[5] = { 7.87311395793093628397E-4, -2.29549961613378126380E-4, -2.68132617805781232825E-3, 3.47222221605458667310E-3, 8.33333333333482257126E-2, }; static double MAXSTIR = 143.01608; static double SQTPI = 2.50662827463100050242E0; static double MAXLGM = 2.556348e305; int sgngam = 0; /*! * \brief Gamma function computed by Stirling's formula. * The polynomial STIR is valid for 33 <= x <= 172. */ static double stirf(double x) { double y, w, v; w = 1.0 / x; w = 1.0 + w * polevl(w, STIR, 4); y = exp(x); if (x > MAXSTIR) { /* Avoid overflow in pow() */ v = pow(x, 0.5 * x - 0.25); y = v * (v / y); } else { y = pow(x, x - 0.5) / y; } y = SQTPI * y * w; return(y); } double gam(double x) { double p, q, z; int i; sgngam = 1; if (std::isnan(x)) return(x); if (std::isinf(x) == 1) return(x); if (std::isinf(x) == -1) return(NAN); q = fabs(x); if (q > 33.0) { if (x < 0.0) { p = floor(q); if (p == q) { gamnan: it_warning("gam(): argument domain error"); return (NAN); } i = int(p); if ((i & 1) == 0) sgngam = -1; z = q - p; if (z > 0.5) { p += 1.0; z = q - p; } z = q * sin(itpp::pi * z); if (z == 0.0) { return(sgngam * INFINITY); } z = fabs(z); z = itpp::pi / (z * stirf(q)); } else { z = stirf(x); } return(sgngam * z); } z = 1.0; while (x >= 3.0) { x -= 1.0; z *= x; } while (x < 0.0) { if (x > -1.E-9) goto small; z /= x; x += 1.0; } while (x < 2.0) { if (x < 1.e-9) goto small; z /= x; x += 1.0; } if (x == 2.0) return(z); x -= 2.0; p = polevl(x, P, 6); q = polevl(x, Q, 7); return(z * p / q); small: if (x == 0.0) { goto gamnan; } else return(z / ((1.0 + 0.5772156649015329 * x) * x)); } /* A[]: Stirling's formula expansion of log gamma * B[], C[]: log gamma function between 2 and 3 */ static double A[] = { 8.11614167470508450300E-4, -5.95061904284301438324E-4, 7.93650340457716943945E-4, -2.77777777730099687205E-3, 8.33333333333331927722E-2 }; static double B[] = { -1.37825152569120859100E3, -3.88016315134637840924E4, -3.31612992738871184744E5, -1.16237097492762307383E6, -1.72173700820839662146E6, -8.53555664245765465627E5 }; static double C[] = { /* 1.00000000000000000000E0, */ -3.51815701436523470549E2, -1.70642106651881159223E4, -2.20528590553854454839E5, -1.13933444367982507207E6, -2.53252307177582951285E6, -2.01889141433532773231E6 }; /* log( sqrt( 2*pi ) ) */ static double LS2PI = 0.91893853320467274178; /*! Logarithm of gamma function */ double lgam(double x) { double p, q, u, w, z; int i; sgngam = 1; if (std::isnan(x)) return(x); if (!std::isfinite(x)) return(INFINITY); if (x < -34.0) { q = -x; w = lgam(q); /* note this modifies sgngam! */ p = floor(q); if (p == q) { lgsing: it_warning("lgam(): function singularity"); return (INFINITY); } i = int(p); if ((i & 1) == 0) sgngam = -1; else sgngam = 1; z = q - p; if (z > 0.5) { p += 1.0; z = p - q; } z = q * sin(itpp::pi * z); if (z == 0.0) goto lgsing; /* z = log(PI) - log( z ) - w;*/ z = LOGPI - log(z) - w; return(z); } if (x < 13.0) { z = 1.0; p = 0.0; u = x; while (u >= 3.0) { p -= 1.0; u = x + p; z *= u; } while (u < 2.0) { if (u == 0.0) goto lgsing; z /= u; p += 1.0; u = x + p; } if (z < 0.0) { sgngam = -1; z = -z; } else sgngam = 1; if (u == 2.0) return(log(z)); p -= 2.0; x = x + p; p = x * polevl(x, B, 5) / p1evl(x, C, 6); return(log(z) + p); } if (x > MAXLGM) { return(sgngam * INFINITY); } q = (x - 0.5) * log(x) - x + LS2PI; if (x > 1.0e8) return(q); p = 1.0 / (x * x); if (x >= 1000.0) q += ((7.9365079365079365079365e-4 * p - 2.7777777777777777777778e-3) * p + 0.0833333333333333333333) / x; else q += polevl(p, A, 4) / x; return(q); } itpp-4.3.1/itpp/base/bessel/hyperg.cpp000066400000000000000000000203671216575753400176670ustar00rootroot00000000000000/*! * \file * \brief Implementation of confluent hypergeometric function * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include /* * Confluent hypergeometric function * * double a, b, x, y, hyperg(); * * y = hyperg( a, b, x ); * * DESCRIPTION: * * Computes the confluent hypergeometric function * * 1 2 * a x a(a+1) x * F ( a,b;x ) = 1 + ---- + --------- + ... * 1 1 b 1! b(b+1) 2! * * Many higher transcendental functions are special cases of * this power series. * * As is evident from the formula, b must not be a negative * integer or zero unless a is an integer with 0 >= a > b. * * The routine attempts both a direct summation of the series * and an asymptotic expansion. In each case error due to * roundoff, cancellation, and nonconvergence is estimated. * The result with smaller estimated error is returned. * * ACCURACY: * * Tested at random points (a, b, x), all three variables * ranging from 0 to 30. * Relative error: * arithmetic domain # trials peak rms * DEC 0,30 2000 1.2e-15 1.3e-16 qtst1: 21800 max = 1.4200E-14 rms = 1.0841E-15 ave = -5.3640E-17 ltstd: 25500 max = 1.2759e-14 rms = 3.7155e-16 ave = 1.5384e-18 * IEEE 0,30 30000 1.8e-14 1.1e-15 * * Larger errors can be observed when b is near a negative * integer or zero. Certain combinations of arguments yield * serious cancellation error in the power series summation * and also are not in the region of near convergence of the * asymptotic series. An error message is printed if the * self-estimated relative error is greater than 1.0e-12. */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier */ double hyp2f0(double, double, double, int, double *); static double hy1f1p(double, double, double, double *); static double hy1f1a(double, double, double, double *); #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ #define MACHEP 1.11022302462515654042E-16 /* 2**-53 */ double hyperg(double a, double b, double x) { double asum, psum, acanc, pcanc = 0, temp; /* See if a Kummer transformation will help */ temp = b - a; if (fabs(temp) < 0.001 * fabs(a)) return(exp(x) * hyperg(temp, b, -x)); psum = hy1f1p(a, b, x, &pcanc); if (pcanc < 1.0e-15) goto done; /* try asymptotic series */ asum = hy1f1a(a, b, x, &acanc); /* Pick the result with less estimated error */ if (acanc < pcanc) { pcanc = acanc; psum = asum; } done: if (pcanc > 1.0e-12) { it_warning("hyperg(): partial loss of precision"); } return(psum); } /* Power series summation for confluent hypergeometric function */ static double hy1f1p(double a, double b, double x, double *err) { double n, a0, sum, t, u, temp; double an, bn, maxt, pcanc; /* set up for power series summation */ an = a; bn = b; a0 = 1.0; sum = 1.0; n = 1.0; t = 1.0; maxt = 0.0; while (t > MACHEP) { if (bn == 0) { /* check bn first since if both */ it_warning("hy1f1p(): function singularity"); return(MAXNUM); /* an and bn are zero it is */ } if (an == 0) /* a singularity */ return(sum); if (n > 200) goto pdone; u = x * (an / (bn * n)); /* check for blowup */ temp = fabs(u); if ((temp > 1.0) && (maxt > (MAXNUM / temp))) { pcanc = 1.0; /* estimate 100% error */ goto blowup; } a0 *= u; sum += a0; t = fabs(a0); if (t > maxt) maxt = t; /* if( (maxt/fabs(sum)) > 1.0e17 ) { pcanc = 1.0; goto blowup; } */ an += 1.0; bn += 1.0; n += 1.0; } pdone: /* estimate error due to roundoff and cancellation */ if (sum != 0.0) maxt /= fabs(sum); maxt *= MACHEP; /* this way avoids multiply overflow */ pcanc = fabs(MACHEP * n + maxt); blowup: *err = pcanc; return(sum); } /* hy1f1a() */ /* asymptotic formula for hypergeometric function: * * ( -a * -- ( |z| * | (b) ( -------- 2f0( a, 1+a-b, -1/x ) * ( -- * ( | (b-a) * * * x a-b ) * e |x| ) * + -------- 2f0( b-a, 1-a, 1/x ) ) * -- ) * | (a) ) */ static double hy1f1a(double a, double b, double x, double *err) { double h1, h2, t, u, temp, acanc, asum, err1, err2; if (x == 0) { acanc = 1.0; asum = MAXNUM; goto adone; } temp = log(fabs(x)); t = x + temp * (a - b); u = -temp * a; if (b > 0) { temp = lgam(b); t += temp; u += temp; } h1 = hyp2f0(a, a - b + 1, -1.0 / x, 1, &err1); temp = exp(u) / gam(b - a); h1 *= temp; err1 *= temp; h2 = hyp2f0(b - a, 1.0 - a, 1.0 / x, 2, &err2); if (a < 0) temp = exp(t) / gam(a); else temp = exp(t - lgam(a)); h2 *= temp; err2 *= temp; if (x < 0.0) asum = h1; else asum = h2; acanc = fabs(err1) + fabs(err2); if (b < 0) { temp = gam(b); asum *= temp; acanc *= fabs(temp); } if (asum != 0.0) acanc /= fabs(asum); acanc *= 30.0; /* fudge factor, since error of asymptotic formula * often seems this much larger than advertised */ adone: *err = acanc; return(asum); } double hyp2f0(double a, double b, double x, int type, double *err) { double a0, alast, t, tlast, maxt; double n, an, bn, u, sum, temp; an = a; bn = b; a0 = 1.0e0; alast = 1.0e0; sum = 0.0; n = 1.0e0; t = 1.0e0; tlast = 1.0e9; maxt = 0.0; do { if (an == 0) goto pdone; if (bn == 0) goto pdone; u = an * (bn * x / n); /* check for blowup */ temp = fabs(u); if ((temp > 1.0) && (maxt > (MAXNUM / temp))) goto error; a0 *= u; t = fabs(a0); /* terminating condition for asymptotic series */ if (t > tlast) goto ndone; tlast = t; sum += alast; /* the sum is one term behind */ alast = a0; if (n > 200) goto ndone; an += 1.0e0; bn += 1.0e0; n += 1.0e0; if (t > maxt) maxt = t; } while (t > MACHEP); pdone: /* series converged! */ /* estimate error due to roundoff and cancellation */ *err = fabs(MACHEP * (n + maxt)); alast = a0; goto done; ndone: /* series did not converge */ /* The following "Converging factors" are supposed to improve accuracy, * but do not actually seem to accomplish very much. */ n -= 1.0; x = 1.0 / x; switch (type) { /* "type" given as subroutine argument */ case 1: alast *= (0.5 + (0.125 + 0.25 * b - 0.5 * a + 0.25 * x - 0.25 * n) / x); break; case 2: alast *= 2.0 / 3.0 - b + 2.0 * a + x - n; break; default: ; } /* estimate error due to roundoff, cancellation, and nonconvergence */ *err = MACHEP * (n + maxt) + fabs(a0); done: sum += alast; return(sum); /* series blew up: */ error: *err = MAXNUM; it_warning("hy1f1a(): total loss of precision"); return(sum); } itpp-4.3.1/itpp/base/bessel/i0.cpp000066400000000000000000000113121216575753400166670ustar00rootroot00000000000000/*! * \file * \brief Implementation of modified Bessel functions of order zero * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include /* * * Modified Bessel function of order zero * * double x, y, i0(); * * y = i0( x ); * * * DESCRIPTION: * * Returns modified Bessel function of order zero of the * argument. * * The function is defined as i0(x) = j0( ix ). * * The range is partitioned into the two intervals [0,8] and * (8, infinity). Chebyshev polynomial expansions are employed * in each interval. * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0,30 30000 5.8e-16 1.4e-16 * */ /* * Modified Bessel function of order zero, * exponentially scaled * * double x, y, i0e(); * * y = i0e( x ); * * DESCRIPTION: * * Returns exponentially scaled modified Bessel function * of order zero of the argument. * * The function is defined as i0e(x) = exp(-|x|) j0( ix ). * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0,30 30000 5.4e-16 1.2e-16 * See i0(). */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 2000 by Stephen L. Moshier */ /* Chebyshev coefficients for exp(-x) I0(x) * in the interval [0,8]. * * lim(x->0){ exp(-x) I0(x) } = 1. */ static double A[] = { -4.41534164647933937950E-18, 3.33079451882223809783E-17, -2.43127984654795469359E-16, 1.71539128555513303061E-15, -1.16853328779934516808E-14, 7.67618549860493561688E-14, -4.85644678311192946090E-13, 2.95505266312963983461E-12, -1.72682629144155570723E-11, 9.67580903537323691224E-11, -5.18979560163526290666E-10, 2.65982372468238665035E-9, -1.30002500998624804212E-8, 6.04699502254191894932E-8, -2.67079385394061173391E-7, 1.11738753912010371815E-6, -4.41673835845875056359E-6, 1.64484480707288970893E-5, -5.75419501008210370398E-5, 1.88502885095841655729E-4, -5.76375574538582365885E-4, 1.63947561694133579842E-3, -4.32430999505057594430E-3, 1.05464603945949983183E-2, -2.37374148058994688156E-2, 4.93052842396707084878E-2, -9.49010970480476444210E-2, 1.71620901522208775349E-1, -3.04682672343198398683E-1, 6.76795274409476084995E-1 }; /* Chebyshev coefficients for exp(-x) sqrt(x) I0(x) * in the inverted interval [8,infinity]. * * lim(x->inf){ exp(-x) sqrt(x) I0(x) } = 1/sqrt(2pi). */ static double B[] = { -7.23318048787475395456E-18, -4.83050448594418207126E-18, 4.46562142029675999901E-17, 3.46122286769746109310E-17, -2.82762398051658348494E-16, -3.42548561967721913462E-16, 1.77256013305652638360E-15, 3.81168066935262242075E-15, -9.55484669882830764870E-15, -4.15056934728722208663E-14, 1.54008621752140982691E-14, 3.85277838274214270114E-13, 7.18012445138366623367E-13, -1.79417853150680611778E-12, -1.32158118404477131188E-11, -3.14991652796324136454E-11, 1.18891471078464383424E-11, 4.94060238822496958910E-10, 3.39623202570838634515E-9, 2.26666899049817806459E-8, 2.04891858946906374183E-7, 2.89137052083475648297E-6, 6.88975834691682398426E-5, 3.36911647825569408990E-3, 8.04490411014108831608E-1 }; double i0(double x) { double y; if (x < 0) x = -x; if (x <= 8.0) { y = (x / 2.0) - 2.0; return(exp(x) * chbevl(y, A, 30)); } return(exp(x) * chbevl(32.0 / x - 2.0, B, 25) / sqrt(x)); } double i0e(double x) { double y; if (x < 0) x = -x; if (x <= 8.0) { y = (x / 2.0) - 2.0; return(chbevl(y, A, 30)); } return(chbevl(32.0 / x - 2.0, B, 25) / sqrt(x)); } itpp-4.3.1/itpp/base/bessel/i1.cpp000066400000000000000000000113761216575753400167020ustar00rootroot00000000000000/*! * \file * \brief Implementation of modified Bessel functions of order one * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include /* * Modfied Bessel function of order one * * double x, y, i1(); * * y = i1( x ); * * DESCRIPTION: * * Returns modified Bessel function of order one of the * argument. * * The function is defined as i1(x) = -i j1( ix ). * * The range is partitioned into the two intervals [0,8] and * (8, infinity). Chebyshev polynomial expansions are employed * in each interval. * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0, 30 30000 1.9e-15 2.1e-16 */ /* * Modified Bessel function of order one, exponentially scaled * * double x, y, i1e(); * * y = i1e( x ); * * DESCRIPTION: * * Returns exponentially scaled modified Bessel function * of order one of the argument. * * The function is defined as i1(x) = -i exp(-|x|) j1( ix ). * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0, 30 30000 2.0e-15 2.0e-16 * See i1(). */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1985, 1987, 2000 by Stephen L. Moshier */ /* Chebyshev coefficients for exp(-x) I1(x) / x * in the interval [0,8]. * * lim(x->0){ exp(-x) I1(x) / x } = 1/2. */ static double A[] = { 2.77791411276104639959E-18, -2.11142121435816608115E-17, 1.55363195773620046921E-16, -1.10559694773538630805E-15, 7.60068429473540693410E-15, -5.04218550472791168711E-14, 3.22379336594557470981E-13, -1.98397439776494371520E-12, 1.17361862988909016308E-11, -6.66348972350202774223E-11, 3.62559028155211703701E-10, -1.88724975172282928790E-9, 9.38153738649577178388E-9, -4.44505912879632808065E-8, 2.00329475355213526229E-7, -8.56872026469545474066E-7, 3.47025130813767847674E-6, -1.32731636560394358279E-5, 4.78156510755005422638E-5, -1.61760815825896745588E-4, 5.12285956168575772895E-4, -1.51357245063125314899E-3, 4.15642294431288815669E-3, -1.05640848946261981558E-2, 2.47264490306265168283E-2, -5.29459812080949914269E-2, 1.02643658689847095384E-1, -1.76416518357834055153E-1, 2.52587186443633654823E-1 }; /* Chebyshev coefficients for exp(-x) sqrt(x) I1(x) * in the inverted interval [8,infinity]. * * lim(x->inf){ exp(-x) sqrt(x) I1(x) } = 1/sqrt(2pi). */ static double B[] = { 7.51729631084210481353E-18, 4.41434832307170791151E-18, -4.65030536848935832153E-17, -3.20952592199342395980E-17, 2.96262899764595013876E-16, 3.30820231092092828324E-16, -1.88035477551078244854E-15, -3.81440307243700780478E-15, 1.04202769841288027642E-14, 4.27244001671195135429E-14, -2.10154184277266431302E-14, -4.08355111109219731823E-13, -7.19855177624590851209E-13, 2.03562854414708950722E-12, 1.41258074366137813316E-11, 3.25260358301548823856E-11, -1.89749581235054123450E-11, -5.58974346219658380687E-10, -3.83538038596423702205E-9, -2.63146884688951950684E-8, -2.51223623787020892529E-7, -3.88256480887769039346E-6, -1.10588938762623716291E-4, -9.76109749136146840777E-3, 7.78576235018280120474E-1 }; double i1(double x) { double y, z; z = fabs(x); if (z <= 8.0) { y = (z / 2.0) - 2.0; z = chbevl(y, A, 29) * z * exp(z); } else { z = exp(z) * chbevl(32.0 / z - 2.0, B, 25) / sqrt(z); } if (x < 0.0) z = -z; return(z); } double i1e(double x) { double y, z; z = fabs(x); if (z <= 8.0) { y = (z / 2.0) - 2.0; z = chbevl(y, A, 29) * z; } else { z = chbevl(32.0 / z - 2.0, B, 25) / sqrt(z); } if (x < 0.0) z = -z; return(z); } itpp-4.3.1/itpp/base/bessel/iv.cpp000066400000000000000000000063301216575753400170010ustar00rootroot00000000000000/*! * \file * \brief Implementation of modified Bessel functions of noninteager order * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include /* * Modified Bessel function of noninteger order * * double v, x, y, iv(); * * y = iv( v, x ); * * DESCRIPTION: * * Returns modified Bessel function of order v of the * argument. If x is negative, v must be integer valued. * * The function is defined as Iv(x) = Jv( ix ). It is * here computed in terms of the confluent hypergeometric * function, according to the formula * * v -x * Iv(x) = (x/2) e hyperg( v+0.5, 2v+1, 2x ) / gamma(v+1) * * If v is a negative integer, then v is replaced by -v. * * * ACCURACY: * * Tested at random points (v, x), with v between 0 and * 30, x between 0 and 28. * Relative error: * arithmetic domain # trials peak rms * IEEE 0,30 10000 1.7e-14 2.7e-15 * * Accuracy is diminished if v is near a negative integer. * * See also hyperg.c. */ /* Mdified Bessel function of noninteger order */ /* If x < 0, then v must be an integer. */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier */ #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ double iv(double v, double x) { int sign; double t, ax; /* If v is a negative integer, invoke symmetry */ t = floor(v); if (v < 0.0) { if (t == v) { v = -v; /* symmetry */ t = -t; } } /* If x is negative, require v to be an integer */ sign = 1; if (x < 0.0) { if (t != v) { it_warning("iv(): argument domain error"); return(0.0); } if (v != 2.0 * floor(v / 2.0)) sign = -1; } /* Avoid logarithm singularity */ if (x == 0.0) { if (v == 0.0) return(1.0); if (v < 0.0) { it_warning("iv(): overflow range error"); return(MAXNUM); } else return(0.0); } ax = fabs(x); t = v * log(0.5 * ax) - x; t = sign * exp(t) / gam(v + 1.0); ax = v + 0.5; return(t * hyperg(ax, 2.0 * ax, 2.0 * x)); } itpp-4.3.1/itpp/base/bessel/jv.cpp000066400000000000000000000375071216575753400170140ustar00rootroot00000000000000/*! * \file * \brief Implementation of Bessel functions of noninteager order * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include #include #include /* * Bessel function of noninteger order * * double v, x, y, jv(); * * y = jv( v, x ); * * DESCRIPTION: * * Returns Bessel function of order v of the argument, * where v is real. Negative x is allowed if v is an integer. * * Several expansions are included: the ascending power * series, the Hankel expansion, and two transitional * expansions for large v. If v is not too large, it * is reduced by recurrence to a region of best accuracy. * The transitional expansions give 12D accuracy for v > 500. * * ACCURACY: * Results for integer v are indicated by *, where x and v * both vary from -125 to +125. Otherwise, * x ranges from 0 to 125, v ranges as indicated by "domain." * Error criterion is absolute, except relative when |jv()| > 1. * * arithmetic v domain x domain # trials peak rms * IEEE 0,125 0,125 100000 4.6e-15 2.2e-16 * IEEE -125,0 0,125 40000 5.4e-11 3.7e-13 * IEEE 0,500 0,500 20000 4.4e-15 4.0e-16 * Integer v: * IEEE -125,125 -125,125 50000 3.5e-15* 1.9e-16* */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier */ static double recur(double *, double, double *, int); static double jvs(double, double); static double hankel(double, double); static double jnx(double, double); static double jnt(double, double); #define MAXGAM 171.624376956302725 #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ #define MACHEP 1.11022302462515654042E-16 /* 2**-53 */ #define MAXLOG 7.08396418532264106224E2 /* log 2**1022 */ #define MINLOG -7.08396418532264106224E2 /* log 2**-1022 */ #define PI 3.14159265358979323846 /* pi */ #define BIG 1.44115188075855872E+17 // ---------------------------- jv() ------------------------------------------------------- double jv(double n, double x) { double k, q, t, y, an; int i, sign, nint; nint = 0; /* Flag for integer n */ sign = 1; /* Flag for sign inversion */ an = fabs(n); y = floor(an); if (y == an) { nint = 1; i = int(an - 16384.0 * floor(an / 16384.0)); if (n < 0.0) { if (i & 1) sign = -sign; n = an; } if (x < 0.0) { if (i & 1) sign = -sign; x = -x; } if (n == 0.0) // use 0th order bessel function return j0(x); if (n == 1.0) // use 1th order bessel function return (sign * j1(x)); } it_error_if((x < 0.0) && (y != an), "besselj:: negative values only allowed for integer orders."); y = fabs(x); if (y < MACHEP) goto underf; k = 3.6 * sqrt(y); t = 3.6 * sqrt(an); if ((y < t) && (an > 21.0)) return(sign * jvs(n, x)); if ((an < k) && (y > 21.0)) return(sign * hankel(n, x)); if (an < 500.0) { /* Note: if x is too large, the continued * fraction will fail; but then the * Hankel expansion can be used. */ if (nint != 0) { k = 0.0; q = recur(&n, x, &k, 1); if (k == 0.0) { y = j0(x) / q; goto done; } if (k == 1.0) { y = j1(x) / q; goto done; } } if (an > 2.0 * y) goto rlarger; if ((n >= 0.0) && (n < 20.0) && (y > 6.0) && (y < 20.0)) { /* Recur backwards from a larger value of n */ rlarger: k = n; y = y + an + 1.0; if (y < 30.0) y = 30.0; y = n + floor(y - n); q = recur(&y, x, &k, 0); y = jvs(y, x) * q; goto done; } if (k <= 30.0) { k = 2.0; } else if (k < 90.0) { k = (3 * k) / 4; } if (an > (k + 3.0)) { if (n < 0.0) k = -k; q = n - floor(n); k = floor(k) + q; if (n > 0.0) q = recur(&n, x, &k, 1); else { t = k; k = n; q = recur(&t, x, &k, 1); k = t; } if (q == 0.0) { underf: y = 0.0; goto done; } } else { k = n; q = 1.0; } /* boundary between convergence of * power series and Hankel expansion */ y = fabs(k); if (y < 26.0) t = (0.0083 * y + 0.09) * y + 12.9; else t = 0.9 * y; if (x > t) y = hankel(k, x); else y = jvs(k, x); if (n > 0.0) y /= q; else y *= q; } else { /* For large n, use the uniform expansion * or the transitional expansion. * But if x is of the order of n**2, * these may blow up, whereas the * Hankel expansion will then work. */ if (n < 0.0) { it_warning("jv(): partial loss of precision"); y = 0.0; goto done; } t = x / n; t /= n; if (t > 0.3) y = hankel(n, x); else y = jnx(n, x); } done: return(sign * y); } /* Reduce the order by backward recurrence. * AMS55 #9.1.27 and 9.1.73. */ static double recur(double *n, double x, double *newn, int cancel) { double pkm2, pkm1, pk, qkm2, qkm1; /* double pkp1; */ double k, ans, qk, xk, yk, r, t, kf; static double big = BIG; int nflag, ctr; /* continued fraction for Jn(x)/Jn-1(x) */ if (*n < 0.0) nflag = 1; else nflag = 0; fstart: pkm2 = 0.0; qkm2 = 1.0; pkm1 = x; qkm1 = *n + *n; xk = -x * x; yk = qkm1; ans = 1.0; ctr = 0; do { yk += 2.0; pk = pkm1 * yk + pkm2 * xk; qk = qkm1 * yk + qkm2 * xk; pkm2 = pkm1; pkm1 = pk; qkm2 = qkm1; qkm1 = qk; if (qk != 0) r = pk / qk; else r = 0.0; if (r != 0) { t = fabs((ans - r) / r); ans = r; } else t = 1.0; if (++ctr > 1000) { it_warning("recur(): underflow range error"); goto done; } if (t < MACHEP) goto done; if (fabs(pk) > big) { pkm2 /= big; pkm1 /= big; qkm2 /= big; qkm1 /= big; } } while (t > MACHEP); done: /* Change n to n-1 if n < 0 and the continued fraction is small */ if (nflag > 0) { if (fabs(ans) < 0.125) { nflag = -1; *n = *n - 1.0; goto fstart; } } kf = *newn; /* backward recurrence * 2k * J (x) = --- J (x) - J (x) * k-1 x k k+1 */ pk = 1.0; pkm1 = 1.0 / ans; k = *n - 1.0; r = 2 * k; do { pkm2 = (pkm1 * r - pk * x) / x; /* pkp1 = pk; */ pk = pkm1; pkm1 = pkm2; r -= 2.0; /* t = fabs(pkp1) + fabs(pk); if( (k > (kf + 2.5)) && (fabs(pkm1) < 0.25*t) ) { k -= 1.0; t = x*x; pkm2 = ( (r*(r+2.0)-t)*pk - r*x*pkp1 )/t; pkp1 = pk; pk = pkm1; pkm1 = pkm2; r -= 2.0; } */ k -= 1.0; } while (k > (kf + 0.5)); /* Take the larger of the last two iterates * on the theory that it may have less cancellation error. */ if (cancel) { if ((kf >= 0.0) && (fabs(pk) > fabs(pkm1))) { k += 1.0; pkm2 = pk; } } *newn = k; return(pkm2); } /* Ascending power series for Jv(x). * AMS55 #9.1.10. */ static double jvs(double n, double x) { double t, u, y, z, k; int ex; z = -x * x / 4.0; u = 1.0; y = u; k = 1.0; t = 1.0; while (t > MACHEP) { u *= z / (k * (n + k)); y += u; k += 1.0; if (y != 0) t = fabs(u / y); } t = frexp(0.5 * x, &ex); ex = int(ex * n); if ((ex > -1023) && (ex < 1023) && (n > 0.0) && (n < (MAXGAM - 1.0))) { t = pow(0.5 * x, n) / gam(n + 1.0); y *= t; } else { t = n * log(0.5 * x) - lgam(n + 1.0); if (y < 0) { sgngam = -sgngam; y = -y; } t += log(y); if (t < -MAXLOG) { return(0.0); } if (t > MAXLOG) { it_warning("jvs(): overflow range error"); return(MAXNUM); } y = sgngam * exp(t); } return(y); } /* Hankel's asymptotic expansion * for large x. * AMS55 #9.2.5. */ static double hankel(double n, double x) { double t, u, z, k, sign, conv; double p, q, j, m, pp, qq; int flag; m = 4.0 * n * n; j = 1.0; z = 8.0 * x; k = 1.0; p = 1.0; u = (m - 1.0) / z; q = u; sign = 1.0; conv = 1.0; flag = 0; t = 1.0; pp = 1.0e38; qq = 1.0e38; while (t > MACHEP) { k += 2.0; j += 1.0; sign = -sign; u *= (m - k * k) / (j * z); p += sign * u; k += 2.0; j += 1.0; u *= (m - k * k) / (j * z); q += sign * u; t = fabs(u / p); if (t < conv) { conv = t; qq = q; pp = p; flag = 1; } /* stop if the terms start getting larger */ if ((flag != 0) && (t > conv)) { goto hank1; } } hank1: u = x - (0.5 * n + 0.25) * PI; t = sqrt(2.0 / (PI * x)) * (pp * cos(u) - qq * sin(u)); return(t); } /* Asymptotic expansion for large n. * AMS55 #9.3.35. */ static double lambda[] = { 1.0, 1.041666666666666666666667E-1, 8.355034722222222222222222E-2, 1.282265745563271604938272E-1, 2.918490264641404642489712E-1, 8.816272674437576524187671E-1, 3.321408281862767544702647E+0, 1.499576298686255465867237E+1, 7.892301301158651813848139E+1, 4.744515388682643231611949E+2, 3.207490090890661934704328E+3 }; static double mu[] = { 1.0, -1.458333333333333333333333E-1, -9.874131944444444444444444E-2, -1.433120539158950617283951E-1, -3.172272026784135480967078E-1, -9.424291479571202491373028E-1, -3.511203040826354261542798E+0, -1.572726362036804512982712E+1, -8.228143909718594444224656E+1, -4.923553705236705240352022E+2, -3.316218568547972508762102E+3 }; static double P1[] = { -2.083333333333333333333333E-1, 1.250000000000000000000000E-1 }; static double P2[] = { 3.342013888888888888888889E-1, -4.010416666666666666666667E-1, 7.031250000000000000000000E-2 }; static double P3[] = { -1.025812596450617283950617E+0, 1.846462673611111111111111E+0, -8.912109375000000000000000E-1, 7.324218750000000000000000E-2 }; static double P4[] = { 4.669584423426247427983539E+0, -1.120700261622299382716049E+1, 8.789123535156250000000000E+0, -2.364086914062500000000000E+0, 1.121520996093750000000000E-1 }; static double P5[] = { -2.8212072558200244877E1, 8.4636217674600734632E1, -9.1818241543240017361E1, 4.2534998745388454861E1, -7.3687943594796316964E0, 2.27108001708984375E-1 }; static double P6[] = { 2.1257013003921712286E2, -7.6525246814118164230E2, 1.0599904525279998779E3, -6.9957962737613254123E2, 2.1819051174421159048E2, -2.6491430486951555525E1, 5.7250142097473144531E-1 }; static double P7[] = { -1.9194576623184069963E3, 8.0617221817373093845E3, -1.3586550006434137439E4, 1.1655393336864533248E4, -5.3056469786134031084E3, 1.2009029132163524628E3, -1.0809091978839465550E2, 1.7277275025844573975E0 }; static double jnx(double n, double x) { double zeta, sqz, zz, zp, np; double cbn, n23, t, z, sz; double pp, qq, z32i, zzi; double ak, bk, akl, bkl; int sign, doa, dob, nflg, k, s, tk, tkp1, m; static double u[8]; static double ai, aip, bi, bip; /* Test for x very close to n. * Use expansion for transition region if so. */ cbn = cbrt(n); z = (x - n) / cbn; if (fabs(z) <= 0.7) return(jnt(n, x)); z = x / n; zz = 1.0 - z * z; if (zz == 0.0) return(0.0); if (zz > 0.0) { sz = sqrt(zz); t = 1.5 * (log((1.0 + sz) / z) - sz); /* zeta ** 3/2 */ zeta = cbrt(t * t); nflg = 1; } else { sz = sqrt(-zz); t = 1.5 * (sz - acos(1.0 / z)); zeta = -cbrt(t * t); nflg = -1; } z32i = fabs(1.0 / t); sqz = cbrt(t); /* Airy function */ n23 = cbrt(n * n); t = n23 * zeta; airy(t, &ai, &aip, &bi, &bip); /* polynomials in expansion */ u[0] = 1.0; zzi = 1.0 / zz; u[1] = polevl(zzi, P1, 1) / sz; u[2] = polevl(zzi, P2, 2) / zz; u[3] = polevl(zzi, P3, 3) / (sz * zz); pp = zz * zz; u[4] = polevl(zzi, P4, 4) / pp; u[5] = polevl(zzi, P5, 5) / (pp * sz); pp *= zz; u[6] = polevl(zzi, P6, 6) / pp; u[7] = polevl(zzi, P7, 7) / (pp * sz); pp = 0.0; qq = 0.0; np = 1.0; /* flags to stop when terms get larger */ doa = 1; dob = 1; akl = MAXNUM; bkl = MAXNUM; for (k = 0; k <= 3; k++) { tk = 2 * k; tkp1 = tk + 1; zp = 1.0; ak = 0.0; bk = 0.0; for (s = 0; s <= tk; s++) { if (doa) { if ((s & 3) > 1) sign = nflg; else sign = 1; ak += sign * mu[s] * zp * u[tk-s]; } if (dob) { m = tkp1 - s; if (((m + 1) & 3) > 1) sign = nflg; else sign = 1; bk += sign * lambda[s] * zp * u[m]; } zp *= z32i; } if (doa) { ak *= np; t = fabs(ak); if (t < akl) { akl = t; pp += ak; } else doa = 0; } if (dob) { bk += lambda[tkp1] * zp * u[0]; bk *= -np / sqz; t = fabs(bk); if (t < bkl) { bkl = t; qq += bk; } else dob = 0; } if (np < MACHEP) break; np /= n * n; } /* normalizing factor ( 4*zeta/(1 - z**2) )**1/4 */ t = 4.0 * zeta / zz; t = sqrt(sqrt(t)); t *= ai * pp / cbrt(n) + aip * qq / (n23 * n); return(t); } /* Asymptotic expansion for transition region, * n large and x close to n. * AMS55 #9.3.23. */ static double PF2[] = { -9.0000000000000000000e-2, 8.5714285714285714286e-2 }; static double PF3[] = { 1.3671428571428571429e-1, -5.4920634920634920635e-2, -4.4444444444444444444e-3 }; static double PF4[] = { 1.3500000000000000000e-3, -1.6036054421768707483e-1, 4.2590187590187590188e-2, 2.7330447330447330447e-3 }; static double PG1[] = { -2.4285714285714285714e-1, 1.4285714285714285714e-2 }; static double PG2[] = { -9.0000000000000000000e-3, 1.9396825396825396825e-1, -1.1746031746031746032e-2 }; static double PG3[] = { 1.9607142857142857143e-2, -1.5983694083694083694e-1, 6.3838383838383838384e-3 }; static double jnt(double n, double x) { double z, zz, z3; double cbn, n23, cbtwo; double ai, aip, bi, bip; /* Airy functions */ double nk, fk, gk, pp, qq; double F[5], G[4]; int k; cbn = cbrt(n); z = (x - n) / cbn; cbtwo = cbrt(2.0); /* Airy function */ zz = -cbtwo * z; airy(zz, &ai, &aip, &bi, &bip); /* polynomials in expansion */ zz = z * z; z3 = zz * z; F[0] = 1.0; F[1] = -z / 5.0; F[2] = polevl(z3, PF2, 1) * zz; F[3] = polevl(z3, PF3, 2); F[4] = polevl(z3, PF4, 3) * z; G[0] = 0.3 * zz; G[1] = polevl(z3, PG1, 1); G[2] = polevl(z3, PG2, 2) * z; G[3] = polevl(z3, PG3, 2) * zz; pp = 0.0; qq = 0.0; nk = 1.0; n23 = cbrt(n * n); for (k = 0; k <= 4; k++) { fk = F[k] * nk; pp += fk; if (k != 4) { gk = G[k] * nk; qq += gk; } nk /= n23; } fk = cbtwo * ai * pp / cbn + cbrt(4.0) * aip * qq / n; return(fk); } itpp-4.3.1/itpp/base/bessel/k0.cpp000066400000000000000000000114141216575753400166740ustar00rootroot00000000000000/*! * \file * \brief Implementation of modified Bessel functions of third kind * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include /* * Modified Bessel function, third kind, order zero * * doule x, y, k0(); * * y = k0( x ); * * DESCRIPTION: * * Returns modified Bessel function of the third kind * of order zero of the argument. * * The range is partitioned into the two intervals [0,8] and * (8, infinity). Chebyshev polynomial expansions are employed * in each interval. * * ACCURACY: * * Tested at 2000 random points between 0 and 8. Peak absolute * error (relative when K0 > 1) was 1.46e-14; rms, 4.26e-15. * Relative error: * arithmetic domain # trials peak rms * IEEE 0, 30 30000 1.2e-15 1.6e-16 * * ERROR MESSAGES: * * message condition value returned * K0 domain x <= 0 MAXNUM */ /* * Modified Bessel function, third kind, order zero, exponentially scaled * * double x, y, k0e(); * * y = k0e( x ); * * DESCRIPTION: * * Returns exponentially scaled modified Bessel function * of the third kind of order zero of the argument. * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0, 30 30000 1.4e-15 1.4e-16 * See k0(). */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 2000 by Stephen L. Moshier */ /* Chebyshev coefficients for K0(x) + log(x/2) I0(x) * in the interval [0,2]. The odd order coefficients are all * zero; only the even order coefficients are listed. * * lim(x->0){ K0(x) + log(x/2) I0(x) } = -EUL. */ static double A[] = { 1.37446543561352307156E-16, 4.25981614279661018399E-14, 1.03496952576338420167E-11, 1.90451637722020886025E-9, 2.53479107902614945675E-7, 2.28621210311945178607E-5, 1.26461541144692592338E-3, 3.59799365153615016266E-2, 3.44289899924628486886E-1, -5.35327393233902768720E-1 }; /* Chebyshev coefficients for exp(x) sqrt(x) K0(x) * in the inverted interval [2,infinity]. * * lim(x->inf){ exp(x) sqrt(x) K0(x) } = sqrt(pi/2). */ static double B[] = { 5.30043377268626276149E-18, -1.64758043015242134646E-17, 5.21039150503902756861E-17, -1.67823109680541210385E-16, 5.51205597852431940784E-16, -1.84859337734377901440E-15, 6.34007647740507060557E-15, -2.22751332699166985548E-14, 8.03289077536357521100E-14, -2.98009692317273043925E-13, 1.14034058820847496303E-12, -4.51459788337394416547E-12, 1.85594911495471785253E-11, -7.95748924447710747776E-11, 3.57739728140030116597E-10, -1.69753450938905987466E-9, 8.57403401741422608519E-9, -4.66048989768794782956E-8, 2.76681363944501510342E-7, -1.83175552271911948767E-6, 1.39498137188764993662E-5, -1.28495495816278026384E-4, 1.56988388573005337491E-3, -3.14481013119645005427E-2, 2.44030308206595545468E0 }; #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ double k0(double x) { double y, z; if (x <= 0.0) { it_warning("besselk:: argument domain error"); //mtherr( "k0", DOMAIN ); return(MAXNUM); } if (x <= 2.0) { y = x * x - 2.0; y = chbevl(y, A, 10) - log(0.5 * x) * i0(x); return(y); } z = 8.0 / x - 2.0; y = exp(-x) * chbevl(z, B, 25) / sqrt(x); return(y); } double k0e(double x) { double y; if (x <= 0.0) { it_warning("besselk:: argument domain error"); //mtherr( "k0e", DOMAIN ); return(MAXNUM); } if (x <= 2.0) { y = x * x - 2.0; y = chbevl(y, A, 10) - log(0.5 * x) * i0(x); return(y * exp(x)); } y = chbevl(8.0 / x - 2.0, B, 25) / sqrt(x); return(y); } itpp-4.3.1/itpp/base/bessel/k1.cpp000066400000000000000000000111331216575753400166730ustar00rootroot00000000000000/*! * \file * \brief Implementation of modified Bessel functions of third kind * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include /* * Modified Bessel function, third kind, order one (should be second kind?) * * double x, y, k1(); * * y = k1( x ); * * DESCRIPTION: * * Computes the modified Bessel function of the third kind * of order one of the argument. * * The range is partitioned into the two intervals [0,2] and * (2, infinity). Chebyshev polynomial expansions are employed * in each interval. * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0, 30 30000 1.2e-15 1.6e-16 * * ERROR MESSAGES: * * message condition value returned * k1 domain x <= 0 MAXNUM */ /* * Modified Bessel function, third kind, order one, exponentially scaled * * SYNOPSIS: * * double x, y, k1e(); * * y = k1e( x ); * * DESCRIPTION: * * Returns exponentially scaled modified Bessel function * of the third kind of order one of the argument: * * k1e(x) = exp(x) * k1(x). * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0, 30 30000 7.8e-16 1.2e-16 * See k1(). */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 2000 by Stephen L. Moshier */ /* Chebyshev coefficients for x(K1(x) - log(x/2) I1(x)) * in the interval [0,2]. * * lim(x->0){ x(K1(x) - log(x/2) I1(x)) } = 1. */ static double A[] = { -7.02386347938628759343E-18, -2.42744985051936593393E-15, -6.66690169419932900609E-13, -1.41148839263352776110E-10, -2.21338763073472585583E-8, -2.43340614156596823496E-6, -1.73028895751305206302E-4, -6.97572385963986435018E-3, -1.22611180822657148235E-1, -3.53155960776544875667E-1, 1.52530022733894777053E0 }; /* Chebyshev coefficients for exp(x) sqrt(x) K1(x) * in the interval [2,infinity]. * * lim(x->inf){ exp(x) sqrt(x) K1(x) } = sqrt(pi/2). */ static double B[] = { -5.75674448366501715755E-18, 1.79405087314755922667E-17, -5.68946255844285935196E-17, 1.83809354436663880070E-16, -6.05704724837331885336E-16, 2.03870316562433424052E-15, -7.01983709041831346144E-15, 2.47715442448130437068E-14, -8.97670518232499435011E-14, 3.34841966607842919884E-13, -1.28917396095102890680E-12, 5.13963967348173025100E-12, -2.12996783842756842877E-11, 9.21831518760500529508E-11, -4.19035475934189648750E-10, 2.01504975519703286596E-9, -1.03457624656780970260E-8, 5.74108412545004946722E-8, -3.50196060308781257119E-7, 2.40648494783721712015E-6, -1.93619797416608296024E-5, 1.95215518471351631108E-4, -2.85781685962277938680E-3, 1.03923736576817238437E-1, 2.72062619048444266945E0 }; #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ double k1(double x) { double y, z; z = 0.5 * x; if (z <= 0.0) { it_warning("k1(): argument domain error"); return(MAXNUM); } if (x <= 2.0) { y = x * x - 2.0; y = log(z) * i1(x) + chbevl(y, A, 11) / x; return(y); } return(exp(-x) * chbevl(8.0 / x - 2.0, B, 25) / sqrt(x)); } double k1e(double x) { double y; if (x <= 0.0) { it_warning("k1e(): argument domain error"); return(MAXNUM); } if (x <= 2.0) { y = x * x - 2.0; y = log(0.5 * x) * i1(x) + chbevl(y, A, 11) / x; return(y * exp(x)); } return(chbevl(8.0 / x - 2.0, B, 25) / sqrt(x)); } itpp-4.3.1/itpp/base/bessel/kn.cpp000066400000000000000000000134421216575753400167750ustar00rootroot00000000000000/*! * \file * \brief Implementation of modified Bessel functions of third kind * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include /* * Modified Bessel function, third kind, integer order * * double x, y, kn(); * int n; * * y = kn( n, x ); * * DESCRIPTION: * * Returns modified Bessel function of the third kind * of order n of the argument. * * The range is partitioned into the two intervals [0,9.55] and * (9.55, infinity). An ascending power series is used in the * low range, and an asymptotic expansion in the high range. * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0,30 90000 1.8e-8 3.0e-10 * * Error is high only near the crossover point x = 9.55 * between the two expansions used. */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier */ /* Algorithm for Kn. n-1 -n - (n-k-1)! 2 k K (x) = 0.5 (x/2) > -------- (-x /4) n - k! k=0 inf. 2 k n n - (x /4) + (-1) 0.5(x/2) > {p(k+1) + p(n+k+1) - 2log(x/2)} --------- - k! (n+k)! k=0 where p(m) is the psi function: p(1) = -EUL and m-1 - p(m) = -EUL + > 1/k - k=1 For large x, 2 2 2 u-1 (u-1 )(u-3 ) K (z) = sqrt(pi/2z) exp(-z) { 1 + ------- + ------------ + ...} v 1 2 1! (8z) 2! (8z) asymptotically, where 2 u = 4 v . */ #define EUL 5.772156649015328606065e-1 #define MAXFAC 31 #define MACHEP 1.11022302462515654042E-16 /* 2**-53 */ #define MAXLOG 7.08396418532264106224E2 /* log 2**1022 */ #define MINLOG -7.08396418532264106224E2 /* log 2**-1022 */ #define MAXNUM 1.79769313486231570815E308 /* 2**1024*(1-MACHEP) */ #define PI 3.14159265358979323846 /* pi */ double kn(int nn, double x) { double k, kf, nk1f, nkf, zn, t, s, z0, z; double ans, fn, pn, pk, zmn, tlg, tox; int i, n; if (nn < 0) n = -nn; else n = nn; if (n > MAXFAC) { overf: it_warning("kn(): overflow range error"); return(MAXNUM); } if (x <= 0.0) { if (x < 0.0) it_warning("kn(): argument domain error"); else it_warning("kn(): function singularity"); return(MAXNUM); } if (x > 9.55) goto asymp; ans = 0.0; z0 = 0.25 * x * x; fn = 1.0; pn = 0.0; zmn = 1.0; tox = 2.0 / x; if (n > 0) { /* compute factorial of n and psi(n) */ pn = -EUL; k = 1.0; for (i = 1; i < n; i++) { pn += 1.0 / k; k += 1.0; fn *= k; } zmn = tox; if (n == 1) { ans = 1.0 / x; } else { nk1f = fn / n; kf = 1.0; s = nk1f; z = -z0; zn = 1.0; for (i = 1; i < n; i++) { nk1f = nk1f / (n - i); kf = kf * i; zn *= z; t = nk1f * zn / kf; s += t; if ((MAXNUM - fabs(t)) < fabs(s)) goto overf; if ((tox > 1.0) && ((MAXNUM / tox) < zmn)) goto overf; zmn *= tox; } s *= 0.5; t = fabs(s); if ((zmn > 1.0) && ((MAXNUM / zmn) < t)) goto overf; if ((t > 1.0) && ((MAXNUM / t) < zmn)) goto overf; ans = s * zmn; } } tlg = 2.0 * log(0.5 * x); pk = -EUL; if (n == 0) { pn = pk; t = 1.0; } else { pn = pn + 1.0 / n; t = 1.0 / fn; } s = (pk + pn - tlg) * t; k = 1.0; do { t *= z0 / (k * (k + n)); pk += 1.0 / k; pn += 1.0 / (k + n); s += (pk + pn - tlg) * t; k += 1.0; } while (fabs(t / s) > MACHEP); s = 0.5 * s / zmn; if (n & 1) s = -s; ans += s; return(ans); /* Asymptotic expansion for Kn(x) */ /* Converges to 1.4e-17 for x > 18.4 */ asymp: if (x > MAXLOG) { it_warning("kn(): underflow range error"); return(0.0); } k = n; pn = 4.0 * k * k; pk = 1.0; z0 = 8.0 * x; fn = 1.0; t = 1.0; s = t; nkf = MAXNUM; i = 0; do { z = pn - pk * pk; t = t * z / (fn * z0); nk1f = fabs(t); if ((i >= n) && (nk1f > nkf)) { goto adone; } nkf = nk1f; s += t; fn += 1.0; pk += 2.0; i += 1; } while (fabs(t / s) > MACHEP); adone: ans = exp(-x) * sqrt(PI / (2.0 * x)) * s; return(ans); } itpp-4.3.1/itpp/base/bessel/polevl.cpp000066400000000000000000000052501216575753400176640ustar00rootroot00000000000000/*! * \file * \brief Implementation of polynomial evaluation function * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include /* * Evaluate polynomial * * int N; * double x, y, coef[N+1], polevl[]; * * y = polevl( x, coef, N ); * * DESCRIPTION: * * Evaluates polynomial of degree N: * * 2 N * y = C + C x + C x +...+ C x * 0 1 2 N * * Coefficients are stored in reverse order: * * coef[0] = C , ..., coef[N] = C . * N 0 * * The function p1evl() assumes that coef[N] = 1.0 and is * omitted from the array. Its calling arguments are * otherwise the same as polevl(). * * SPEED: * * In the interest of speed, there are no checks for out * of bounds arithmetic. This routine is used by most of * the functions in the library. Depending on available * equipment features, the user may wish to rewrite the * program in microcode or assembly language. */ /* Cephes Math Library Release 2.1: December, 1988 Copyright 1984, 1987, 1988 by Stephen L. Moshier */ double polevl(double x, double coef[], int N) { double ans; int i; double *p; p = coef; ans = *p++; i = N; do ans = ans * x + *p++; while (--i); return(ans); } /* N * Evaluate polynomial when coefficient of x is 1.0. * Otherwise same as polevl. */ double p1evl(double x, double coef[], int N) { double ans; double *p; int i; p = coef; ans = x + *p++; i = N - 1; do ans = ans * x + *p++; while (--i); return(ans); } itpp-4.3.1/itpp/base/bessel/sources.mk000066400000000000000000000012301216575753400176650ustar00rootroot00000000000000noinst_h_base_bessel_sources = \ $(top_srcdir)/itpp/base/bessel/bessel_internal.h cpp_base_bessel_sources = \ $(top_srcdir)/itpp/base/bessel/airy.cpp \ $(top_srcdir)/itpp/base/bessel/chbevl.cpp \ $(top_srcdir)/itpp/base/bessel/gamma.cpp \ $(top_srcdir)/itpp/base/bessel/hyperg.cpp \ $(top_srcdir)/itpp/base/bessel/i0.cpp \ $(top_srcdir)/itpp/base/bessel/i1.cpp \ $(top_srcdir)/itpp/base/bessel/iv.cpp \ $(top_srcdir)/itpp/base/bessel/jv.cpp \ $(top_srcdir)/itpp/base/bessel/k0.cpp \ $(top_srcdir)/itpp/base/bessel/k1.cpp \ $(top_srcdir)/itpp/base/bessel/kn.cpp \ $(top_srcdir)/itpp/base/bessel/polevl.cpp \ $(top_srcdir)/itpp/base/bessel/struve.cpp itpp-4.3.1/itpp/base/bessel/struve.cpp000066400000000000000000000116171216575753400177170ustar00rootroot00000000000000/*! * \file * \brief Implementation of struve function * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is slightly modified routine from the Cephes library: * http://www.netlib.org/cephes/ */ #include #include /* * Struve function * * double v, x, y, struve(); * * y = struve( v, x ); * * DESCRIPTION: * * Computes the Struve function Hv(x) of order v, argument x. * Negative x is rejected unless v is an integer. * * This module also contains the hypergeometric functions 1F2 * and 3F0 and a routine for the Bessel function Yv(x) with * noninteger v. * * ACCURACY: * * Not accurately characterized, but spot checked against tables. */ /* Cephes Math Library Release 2.81: June, 2000 Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier */ static double stop = 1.37e-17; #define MACHEP 1.11022302462515654042E-16 /* 2**-53 */ double onef2(double a, double b, double c, double x, double *err) { double n, a0, sum, t; double an, bn, cn, max, z; an = a; bn = b; cn = c; a0 = 1.0; sum = 1.0; n = 1.0; t = 1.0; max = 0.0; do { if (an == 0) goto done; if (bn == 0) goto error; if (cn == 0) goto error; if ((a0 > 1.0e34) || (n > 200)) goto error; a0 *= (an * x) / (bn * cn * n); sum += a0; an += 1.0; bn += 1.0; cn += 1.0; n += 1.0; z = fabs(a0); if (z > max) max = z; if (sum != 0) t = fabs(a0 / sum); else t = z; } while (t > stop); done: *err = fabs(MACHEP * max / sum); goto xit; error: *err = 1.0e38; xit: return(sum); } double threef0(double a, double b, double c, double x, double *err) { double n, a0, sum, t, conv, conv1; double an, bn, cn, max, z; an = a; bn = b; cn = c; a0 = 1.0; sum = 1.0; n = 1.0; t = 1.0; max = 0.0; conv = 1.0e38; conv1 = conv; do { if (an == 0.0) goto done; if (bn == 0.0) goto done; if (cn == 0.0) goto done; if ((a0 > 1.0e34) || (n > 200)) goto error; a0 *= (an * bn * cn * x) / n; an += 1.0; bn += 1.0; cn += 1.0; n += 1.0; z = fabs(a0); if (z > max) max = z; if (z >= conv) { if ((z < max) && (z > conv1)) goto done; } conv1 = conv; conv = z; sum += a0; if (sum != 0) t = fabs(a0 / sum); else t = z; } while (t > stop); done: t = fabs(MACHEP * max / sum); max = fabs(conv / sum); if (max > t) t = max; goto xit; error: t = 1.0e38; xit: *err = t; return(sum); } #define PI 3.14159265358979323846 /* pi */ double struve(double v, double x) { double y, ya, f, g, h, t; double onef2err, threef0err; f = floor(v); if ((v < 0) && (v - f == 0.5)) { y = jv(-v, x); f = 1.0 - f; g = 2.0 * floor(f / 2.0); if (g != f) y = -y; return(y); } t = 0.25 * x * x; f = fabs(x); g = 1.5 * fabs(v); if ((f > 30.0) && (f > g)) { onef2err = 1.0e38; y = 0.0; } else { y = onef2(1.0, 1.5, 1.5 + v, -t, &onef2err); } if ((f < 18.0) || (x < 0.0)) { threef0err = 1.0e38; ya = 0.0; } else { ya = threef0(1.0, 0.5, 0.5 - v, -1.0 / t, &threef0err); } f = sqrt(PI); h = pow(0.5 * x, v - 1.0); if (onef2err <= threef0err) { g = gam(v + 1.5); y = y * h * t / (0.5 * f * g); return(y); } else { g = gam(v + 0.5); ya = ya * h / (f * g); ya = ya + yv(v, x); return(ya); } } /* * Bessel function of noninteger order */ double yv(double v, double x) { double y, t; int n; y = floor(v); if (y == v) { n = int(v); y = yn(n, x); return(y); } t = PI * v; y = (cos(t) * jv(v, x) - jv(-v, x)) / sin(t); return(y); } /* Crossover points between ascending series and asymptotic series * for Struve function * * v x * * 0 19.2 * 1 18.95 * 2 19.15 * 3 19.3 * 5 19.7 * 10 21.35 * 20 26.35 * 30 32.31 * 40 40.0 */ itpp-4.3.1/itpp/base/binary.cpp000066400000000000000000000027701216575753400163760ustar00rootroot00000000000000/*! * \file * \brief Binary class implemenations * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { std::ostream &operator<<(std::ostream &output, const bin &inbin) { output << static_cast(inbin); return output; } std::istream &operator>>(std::istream &input, bin &outbin) { int tmp; input >> tmp; it_assert((tmp == 0) || (tmp == 1), "bin::operator>>(): input value must be 0 or 1"); outbin = tmp; return input; } } // namespace itpp itpp-4.3.1/itpp/base/binary.h000066400000000000000000000127261216575753400160450ustar00rootroot00000000000000/*! * \file * \brief Binary class definition * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BINARY_H #define BINARY_H #include #include namespace itpp { /*! \brief Binary arithmetic (boolean) class \author Tony Ottosson This class creates a binary arithmetic class, following the ordinary rules for binary (GF(2)) fields. Examples: \code bin a; // Creation of variable bin a = 0; // Creating a variable and assigning it value 0 bin b = 1; // Creating a variable and assigning it value 1 bin c = a + b; // XOR operation c = !a; // NOT c = a * b; // AND c = a / b; // OR \endcode */ class bin { public: //! Default constructor bin(): b(0) {} //! Set the binary object equal to \c value. Either "0" or "1". bin(const int &value): b(static_cast(value)) { it_assert_debug((value == 0) || (value == 1), "bin::bin(): value must be 0 or 1"); } //! Copy constructor bin(const bin &inbin): b(inbin.b) {} //! Assign a value void operator=(const int &value) { it_assert_debug((value == 0) || (value == 1), "bin::operator=(): value must be 0 or 1"); b = static_cast(value); } //! Assign a value void operator=(const bin &inbin) { b = inbin.b; } //! OR void operator/=(const bin &inbin) { b |= inbin.b; } //! OR void operator|=(const bin &inbin) { b |= inbin.b; } //! OR bin operator/(const bin &inbin) const { return bin(b | inbin.b); } //! OR bin operator|(const bin &inbin) const { return bin(b | inbin.b); } //! XOR void operator+=(const bin &inbin) { b ^= inbin.b; } //! XOR void operator^=(const bin &inbin) { b ^= inbin.b; } //! XOR bin operator+(const bin &inbin) const { return bin(b ^ inbin.b); } //! XOR bin operator^(const bin &inbin) const { return bin(b ^ inbin.b); } //! XOR void operator-=(const bin &inbin) { b ^= inbin.b; } //! XOR bin operator-(const bin &inbin) const { return bin(b ^ inbin.b); } //! Dummy definition to be able to use vec bin operator-() const { return bin(b); } //! AND void operator*=(const bin &inbin) { b &= inbin.b; } //! AND void operator&=(const bin &inbin) { b &= inbin.b; } //! AND bin operator*(const bin &inbin) const { return bin(b & inbin.b); } //! AND bin operator&(const bin &inbin) const { return bin(b & inbin.b); } //! NOT bin operator!(void) const { return bin(b ^ 1); } //! NOT bin operator~(void) const { return bin(b ^ 1); } //! Check if equal bool operator==(const bin &inbin) const { return b == inbin.b; } //! Check if equal bool operator==(const int &i) const { return b == i; } //! Check if not equal bool operator!=(const bin &inbin) const { return b != inbin.b; } //! Check if not equal bool operator!=(const int &i) const { return b != i; } //! Less than (interpret the binary values {0,1} as integers) bool operator<(const bin &inbin) const { return b < inbin.b; } //! Less than equal (interpret the binary values {0,1} as integers) bool operator<=(const bin &inbin) const { return b <= inbin.b; } //! Greater than (interpret the binary values {0,1} as integers) bool operator>(const bin &inbin) const { return b > inbin.b; } //! Greater than equal (interpret the binary values {0,1} as integers) bool operator>=(const bin &inbin) const { return b >= inbin.b; } //! Convert \c bin to \c short operator short() const { return static_cast(b); } //! Convert \c bin to \c int operator int() const { return static_cast(b); } //! Convert \c bin to \c bool operator bool() const { return b != 0; } //! Convert \c bin to \c float operator float() const { return static_cast(b); } //! Convert \c bin to \c double operator double() const { return static_cast(b); } //! Output the binary value of the object char value() const { return b; } private: char b; }; /*! \relatesalso bin \brief Output stream of bin */ ITPP_EXPORT std::ostream &operator<<(std::ostream &output, const bin &inbin); /*! \relatesalso bin \brief Input stream of bin */ ITPP_EXPORT std::istream &operator>>(std::istream &input, bin &outbin); /*! \relatesalso bin \brief absolute value of bin */ inline bin abs(const bin &inbin) { return inbin; } } // namespace itpp namespace std // added 11/2005, EGL { /*! \relatesalso itpp::bin \brief absolute value of bin */ inline int abs(const itpp::bin &inbin) { return inbin; } } // namespace std #endif // #ifndef BINARY_H itpp-4.3.1/itpp/base/binfile.cpp000066400000000000000000000343561216575753400165270ustar00rootroot00000000000000/*! * \file * \brief Binary file formats implementations * \author Tony Ottosson, Thomas Eriksson, Adam Piatyszek and Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include using std::ofstream; using std::ifstream; using std::fstream; using std::ios; namespace itpp { namespace binfile_details { //! Default Constructor Ofstream_Binfile_Facade::Ofstream_Binfile_Facade ( ) : _str(new std::ofstream()) {}; //! Constructor from filename and stream mode Ofstream_Binfile_Facade::Ofstream_Binfile_Facade ( const char * filename, std::ios_base::openmode mode) : _str(new std::ofstream(filename,mode)){}; //! Destructor Ofstream_Binfile_Facade::~Ofstream_Binfile_Facade() {delete _str;} //! Default Constructor Ifstream_Binfile_Facade::Ifstream_Binfile_Facade ( ) : _str(new std::ifstream()) {}; //! Constructor from filename and stream mode Ifstream_Binfile_Facade::Ifstream_Binfile_Facade ( const char * filename, std::ios_base::openmode mode) : _str(new std::ifstream(filename,mode)){}; //! Destructor Ifstream_Binfile_Facade::~Ifstream_Binfile_Facade() {delete _str;} //! Default Constructor Fstream_Binfile_Facade::Fstream_Binfile_Facade ( ) : _str(new std::fstream()) {}; //! Constructor from filename and stream mode Fstream_Binfile_Facade::Fstream_Binfile_Facade ( const char * filename, std::ios_base::openmode mode) : _str(new std::fstream(filename,mode)){}; //! Destructor Fstream_Binfile_Facade::~Fstream_Binfile_Facade() {delete _str;} } //! Read binary data and optionally switch endianness template inline void read_endian(T1& st, T2& data, bool switch_endian = false) { int bytes = sizeof(T2); char *c = reinterpret_cast(&data); if (!switch_endian) st.read(c, bytes); else for (int i = bytes - 1; i >= 0; i--) st.get(c[i]); } //! Write binary data and optionally switch endianness template inline void write_endian(T1& st, T2 data, bool switch_endian = false) { int bytes = sizeof(T2); char *c = reinterpret_cast(&data); if (!switch_endian) st.write(c, bytes); else for (int i = bytes - 1; i >= 0; i--) st.put(c[i]); } // ---------------------------------------------------------------------- bool exist(const std::string& name) { bool file_exists = false; ifstream file(name.c_str(), ios::in); if (file.is_open()) { file_exists = true; } file.close(); return file_exists; } // ---------------------------------------------------------------------- // bfstream_base // ---------------------------------------------------------------------- bfstream_base::bfstream_base(endian e): switch_endianity(false), native_endianity(is_bigendian() ? b_endian : l_endian) { if (native_endianity != e) switch_endianity = true; } // ---------------------------------------------------------------------- // bofstream // ---------------------------------------------------------------------- bofstream::bofstream(const std::string& name, endian e) : bfstream_base(e), binfile_details::Ofstream_Binfile_Facade(name.c_str()) {} bofstream::bofstream() : bfstream_base(), binfile_details::Ofstream_Binfile_Facade() {} void bofstream::open(const std::string& name, bool truncate, endian e) { if (native_endianity != e) switch_endianity = true; else switch_endianity = false; Ofstream_Binfile_Facade::open(name.c_str(), truncate? ios::out | ios::binary | ios::trunc : ios::out | ios::binary); } bofstream& bofstream::operator<<(char a) { put(a); return *this; } bofstream& bofstream::operator<<(int8_t a) { it_assert(sizeof(char) == sizeof(int8_t),"Unexpected int8_t size."); put(static_cast(a)); return *this; } bofstream& bofstream::operator<<(uint8_t a) { it_assert(sizeof(char) == sizeof(uint8_t),"Unexpected uint8_t size."); put(static_cast(a)); return *this; } bofstream& bofstream::operator<<(int16_t a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(uint16_t a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(int32_t a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(uint32_t a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(int64_t a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(uint64_t a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(float a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(double a) { write_endian(*this, a, switch_endianity); return *this; } bofstream& bofstream::operator<<(bin a) { write_endian(*this, static_cast(a), switch_endianity); return *this; } bofstream& bofstream::operator<<(const char *a) { write(a, strlen(a) + 1); return *this; } bofstream& bofstream::operator<<(const std::string& a) { write(a.c_str(), a.size() + 1); return *this; } // ---------------------------------------------------------------------- // bifstream // ---------------------------------------------------------------------- bifstream::bifstream(const std::string& name, endian e) : bfstream_base(e), binfile_details::Ifstream_Binfile_Facade(name.c_str(), ios::in | ios::binary) {} bifstream::bifstream() : bfstream_base(), binfile_details::Ifstream_Binfile_Facade() {} void bifstream::open(const std::string& name, endian e) { if (native_endianity != e) switch_endianity = true; else switch_endianity = false; binfile_details::Ifstream_Binfile_Facade::open(name.c_str(), ios::in | ios::binary); } int bifstream::length() // in bytes { std::streampos pos1, len; pos1 = tellg(); seekg(0, ios::end); len = tellg(); seekg(pos1); return int(len); } bifstream& bifstream::operator>>(char& a) { get(a); return *this; } bifstream& bifstream::operator>>(int8_t& a) { it_assert(sizeof(char) == sizeof(int8_t),"Unexpected int8_t size."); char tmp; get(tmp); a = tmp; return *this; } bifstream& bifstream::operator>>(uint8_t& a) { it_assert(sizeof(char) == sizeof(uint8_t),"Unexpected uint8_t size."); char tmp; get(tmp); a = tmp; return *this; } bifstream& bifstream::operator>>(int16_t& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(uint16_t& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(int32_t& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(uint32_t& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(int64_t& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(uint64_t& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(float& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(double& a) { read_endian(*this, a, switch_endianity); return *this; } bifstream& bifstream::operator>>(bin& a) { uint32_t tmp; read_endian(*this, tmp, switch_endianity); it_assert((tmp == 0) || (tmp == 1), "bifstream::operator>>(): binary input value must be 0 or 1"); a = tmp; return *this; } bifstream& bifstream::operator>>(char *a) { getline(a, '\0'); return *this; } bifstream& bifstream::operator>>(std::string& a) { std::getline(*stream(), a, '\0'); return *this; } // ---------------------------------------------------------------------- // bfstream // ---------------------------------------------------------------------- bfstream::bfstream(const std::string& name, endian e) : bfstream_base(e), binfile_details::Fstream_Binfile_Facade(name.c_str(), ios::in | ios::out | ios::binary) {} bfstream::bfstream() : bfstream_base(), binfile_details::Fstream_Binfile_Facade() {} void bfstream::open(const std::string& name, bool trnc, endian e) { if (native_endianity != e) switch_endianity = true; else switch_endianity = false; if (trnc) binfile_details::Fstream_Binfile_Facade::open(name.c_str(), ios::in | ios::out | ios::binary | ios::trunc); else binfile_details::Fstream_Binfile_Facade::open(name.c_str(), ios::in | ios::out | ios::binary); } void bfstream::open_readonly(const std::string& name, endian e) { if (native_endianity != e) switch_endianity = true; else switch_endianity = false; binfile_details::Fstream_Binfile_Facade::open(name.c_str(), ios::in | ios::binary); } int bfstream::length() // in bytes { std::streampos pos1, len; pos1 = tellg(); seekg(0, ios::end); len = tellg(); seekg(pos1); return int(len); } bfstream& bfstream::operator<<(char a) { put(a); return *this; } bfstream& bfstream::operator<<(int8_t a) { it_assert(sizeof(char) == sizeof(int8_t),"Unexpected int8_t size."); put(static_cast(a)); return *this; } bfstream& bfstream::operator<<(uint8_t a) { it_assert(sizeof(char) == sizeof(uint8_t),"Unexpected uint8_t size."); put(static_cast(a)); return *this; } bfstream& bfstream::operator<<(int16_t a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(uint16_t a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(int32_t a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(uint32_t a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(int64_t a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(uint64_t a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(float a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(double a) { write_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator<<(bin a) { write_endian(*this, static_cast(a), switch_endianity); return *this; } bfstream& bfstream::operator<<(const char *a) { write(a, strlen(a) + 1); return *this; } bfstream& bfstream::operator<<(const std::string& a) { write(a.c_str(), a.size() + 1); return *this; } bfstream& bfstream::operator>>(char& a) { get(a); return *this; } bfstream& bfstream::operator>>(int8_t& a) { it_assert(sizeof(char) == sizeof(int8_t),"Unexpected int8_t size."); char tmp; get(tmp); a = tmp; return *this; } bfstream& bfstream::operator>>(uint8_t& a) { it_assert(sizeof(char) == sizeof(uint8_t),"Unexpected uint8_t size."); char tmp; get(tmp); a = tmp; return *this; } bfstream& bfstream::operator>>(int16_t& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(uint16_t& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(int32_t& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(uint32_t& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(int64_t& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(uint64_t& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(float& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(double& a) { read_endian(*this, a, switch_endianity); return *this; } bfstream& bfstream::operator>>(bin& a) { uint32_t tmp; read_endian(*this, tmp, switch_endianity); it_assert((tmp == 0) || (tmp == 1), "bfstream::operator>>(): binary input value must be 0 or 1"); a = tmp; return *this; } bfstream& bfstream::operator>>(char *a) { getline(a, '\0'); return *this; } bfstream& bfstream::operator>>(std::string& a) { std::getline(*stream(), a, '\0'); return *this; } } // namespace itpp itpp-4.3.1/itpp/base/binfile.h000066400000000000000000000702151216575753400161660ustar00rootroot00000000000000/*! * \file * \brief Binary file formats definitions * \author Tony Ottosson, Thomas Eriksson, Adam Piatyszek and Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BINFILE_H #define BINFILE_H #include #include #include #include #ifdef _MSC_VER #pragma warning( disable : 4250 ) #endif namespace itpp { /*! \brief Checks if a file named \c name already exists on the disk \ingroup itfile */ bool exist(const std::string& name); /*! \brief Base class for binary file classes \ingroup itfile This class serves as a base class for the classes \c bofstream, \c bifstream, and \c bfstream. It controls the endianity (i.e. the byte order of multibyte numbers on the disk) of the inhereted classes. */ class ITPP_EXPORT bfstream_base { public: /*! \brief Definition of the endian data type The Endianness defines the order in which multibyte numbers are stored in the file. The two orders are called "Little Endian" (\c l_endian ) and "Big Endian" (\c b_endian ). "Little Endian" means that the low-order byte of the number is stored at the lowest address (i.e. the little end comes first). "Big Endian" means that the high-order byte of the number is stored in memory at the lowest address (i.e. the big end comes first) */ enum endian { l_endian, b_endian }; /*! \brief Class Constructor \param e Defines the endianity of the class. Possible values are \c l_endian for little endian or \c b_endian for big endian. The default value is \c b_endian. */ bfstream_base(endian e = b_endian); /*! \brief Returns the endianity of the class */ endian get_endianity() const { if (switch_endianity) { if (native_endianity == l_endian) return b_endian; else return l_endian; } else return native_endianity; } /*! \brief Returns the native endianity for this computer architecture Intel processors use "Little Endian" byte ordering while e.g. Motorola processors use "Big Endian" byte ordering. */ endian get_native_endianity() const { return native_endianity; } /*! \brief Set the endianity for this class */ void set_endianity(endian e) { if (native_endianity == e) switch_endianity = false; else switch_endianity = true; } /*! \brief Set the endianity of this class to the native endianity for this computer architecture */ void set_native_endianity() { switch_endianity = false; } protected: //! Indicates if the endianity of the processed data needs to be changed bool switch_endianity; //! The native endianity for this computer architecture endian native_endianity; }; namespace binfile_details { /*! \brief Ofstream Interface Facade for Binary Streams. \ingroup itfile This class implements std::ofstream facade to make ITPP binary file streams exportable from dll. This facade implements basic functionality only. It does not provide an access to the following stream facilities (all of them are useless for binary streams) 1. locale(imbue) It does not make sence to change locale settings for binary streams. Changes in formatting or char conversion can result in compatibility problems with resulting binary files 2. stream buffer (rdbuf). DLL and application can use different versions of runtime , so it would be dangerous to use buffer created in DLL in application context 3. stream insertion operators. It is assumed that stream insertion is defined in binary stream classes derived from this class 4. formatting interface (copyfmt, fill, narrow, widen). This is not relevant to binary streams 5. ios_base-related stuff. These things are excluded since they provide unnecessarily formatting facilities. */ class ITPP_EXPORT Ofstream_Binfile_Facade { std::ofstream* _str; //following makes class non-copiable Ofstream_Binfile_Facade(const Ofstream_Binfile_Facade& o); void operator= (const Ofstream_Binfile_Facade& o); public: //! Default Constructor Ofstream_Binfile_Facade ( ); //! Constructor from filename and stream mode explicit Ofstream_Binfile_Facade ( const char * filename, std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary); //! Open state bool is_open() {return _str->is_open();} //! Method to open corresponding file void open ( const char * filename, std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary ) {_str->open(filename,mode);} //! Method to close corresponding file void close() {_str->close();} //! Output multiple characters Ofstream_Binfile_Facade& write (const char* c, std::streamsize n) {_str->write(c,n); return *this;} //! Output single char Ofstream_Binfile_Facade& put (const char c) {_str->put(c); return *this;}; //! Get position std::streampos tellp() {return _str->tellp();} //! Set position Ofstream_Binfile_Facade& seekp (std::streampos pos) {_str->seekp(pos); return *this;} //! Set relative position Ofstream_Binfile_Facade& seekp (std::streamoff pos, std::ios_base::seekdir way) {_str->seekp(pos,way); return *this;} //! Flushes stream buffer Ofstream_Binfile_Facade& flush() {_str->flush(); return *this;} //! This method returns true is stream state is good bool good() const {return _str->good();} //! This method returns true if eof is reached bool eof() const {return _str->eof();} //! This method returns true if either failbit or badbit is set bool fail() const {return _str->fail();} //! This method returns true if badbit is set bool bad() const {return _str->bad();} //! Unary not operator to check the stream state bool operator!() const {return _str->fail();} //! Conversion to bool to validate stream state operator bool() const {return _str->good();} //! Method to read stream state flags std::ios_base::iostate rdstate() const {return _str->rdstate();} //! Method to set the stream state (combines already set flags with flags provide by user) void setstate (std::ios_base::iostate state) {_str->setstate(state);} //! Method to set stream state (overwrites stream state flags) void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);} //! Method to get the exceptions mask std::ios_base::iostate exceptions() const {return _str->exceptions();} //! Method to set the exceptions mask void exceptions (std::ios_base::iostate except) {_str->exceptions(except);} //! Destructor virtual ~Ofstream_Binfile_Facade(); protected: //! Access to internal stream for derived classes std::ofstream* stream() {return _str;} }; /*! \brief Ifstream Interface Facade for Binary Streams. \ingroup itfile This class implements std::ofstream facade to make ITPP binary file streams exportable from dll. This facade implements basic functionality only. It does not provide an access to the following stream facilities (all of them are useless for binary streams) 1. locale(imbue) It does not make sence to change locale settings for binary streams. Changes in formatting or char conversion can result in compatibility problems with resulting binary files 2. stream buffer (rdbuf). DLL and application can use different versions of runtime , so it would be dangerous to use buffer created in DLL in application context 3. stream extraction operators. It is assumed that stream extraction is defined in binary stream classes derived from this class 4. formatting interface (copyfmt, fill, narrow, widen). This is not relevant to binary streams 5. ios_base-related stuff. These things are excluded since they provide unnecessarily formatting facilities. */ class ITPP_EXPORT Ifstream_Binfile_Facade { std::ifstream* _str; //following makes class non-copiable Ifstream_Binfile_Facade(const Ifstream_Binfile_Facade& o); void operator= (const Ifstream_Binfile_Facade& o); public: //! Default Constructor Ifstream_Binfile_Facade ( ); //! Constructor from filename and stream mode explicit Ifstream_Binfile_Facade ( const char * filename, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary); //! Open state bool is_open() {return _str->is_open();} //! Method to open corresponding file void open ( const char * filename, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary) {_str->open(filename,mode);} //! Method to close corresponding file void close() {_str->close();} //! Last extracted chars count std::streamsize gcount() const {return _str->gcount();} //! Get single char int get() {return _str->get();} //! Get single char Ifstream_Binfile_Facade& get(char& c) {_str->get(c); return *this;} //! Get multiple chars to c-string and add trailing 0 Ifstream_Binfile_Facade& get (char* s, std::streamsize n) {_str->get(s,n); return *this;} //! Get multiple chars to c-string without trailing 0 Ifstream_Binfile_Facade& get (char* s, std::streamsize n, char delim) {_str->get(s,n,delim); return *this;} //! Get multiple chars to c-string without trailing 0 Ifstream_Binfile_Facade& getline (char* s, std::streamsize n ) {_str->getline(s,n); return *this;} Ifstream_Binfile_Facade& getline (char* s, std::streamsize n, char delim ) {_str->getline(s,n,delim); return *this;} //! Extract and ignore chars Ifstream_Binfile_Facade& ignore (std::streamsize n = 1, int delim = EOF) {_str->ignore(n,delim); return *this;} //! Peak single char from the top of the buffer int peek() {return _str->peek();} //! Read n chars from stream Ifstream_Binfile_Facade& read (char* s, std::streamsize n) {_str->read(s,n); return *this;} //! Read up to n available chars from stream std::streamsize readsome (char* s, std::streamsize n) {return _str->readsome(s,n);} //! This method attempts to put back single char Ifstream_Binfile_Facade& putback (char c) {_str->putback(c); return *this;} //! Unget last extracted char Ifstream_Binfile_Facade& unget() {_str->unget(); return *this;} //! Get position std::streampos tellg() {return _str->tellg();} //! Set position Ifstream_Binfile_Facade& seekg (std::streampos pos) {_str->seekg(pos); return *this;} //! Set relative position Ifstream_Binfile_Facade& seekg (std::streamoff pos, std::ios_base::seekdir way) {_str->seekg(pos,way); return *this;} //! This method returns true is stream state is good bool good() const {return _str->good();} //! This method returns true if eof is reached bool eof() const {return _str->eof();} //! This method returns true if either failbit or badbit is set bool fail() const {return _str->fail();} //! This method returns true if badbit is set bool bad() const {return _str->bad();} //! Unary not operator to check the stream state bool operator!() const {return _str->fail();} //! Conversion to bool to validate stream state operator bool() const {return _str->good();} //! Method to read stream state flags std::ios_base::iostate rdstate() const {return _str->rdstate();} //! Method to set the stream state (combines already set flags with flags provide by user) void setstate (std::ios_base::iostate state) {_str->setstate(state);} //! Method to set stream state (overwrites stream state flags) void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);} //! Method to get the exceptions mask std::ios_base::iostate exceptions() const {return _str->exceptions();} //! Method to set the exceptions mask void exceptions (std::ios_base::iostate except) {_str->exceptions(except);} //! Destructor virtual ~Ifstream_Binfile_Facade(); protected: //! Access to internal stream for derived classes std::ifstream* stream() {return _str;} }; /*! \brief Fstream Interface Facade for Binary Streams. \ingroup itfile This class implements std::fstream facade to make ITPP binary file streams exportable from dll. This facade implements basic functionality only. It does not provide an access to the following stream facilities (all of them are useless for binary streams) 1. locale(imbue) It does not make sence to change locale settings for binary streams. Changes in formatting or char conversion can result in compatibility problems with resulting binary files 2. stream buffer (rdbuf). DLL and application can use different versions of runtime , so it would be dangerous to use buffer created in DLL in application context 3. stream extraction operators. It is assumed that stream extraction is defined in binary stream classes derived from this class 4. stream insertion operators. It is assumed that stream insertion is defined in binary stream classes derived from this class 5. formatting interface (copyfmt, fill, narrow, widen). This is not relevant to binary streams 6. ios_base-related stuff. These things are excluded since they provide unnecessarily formatting facilities. */ class ITPP_EXPORT Fstream_Binfile_Facade { std::fstream* _str; //following makes class non-copiable Fstream_Binfile_Facade(const Fstream_Binfile_Facade& o); void operator= (const Fstream_Binfile_Facade& o); public: //! Default Constructor Fstream_Binfile_Facade ( ); //! Constructor from filename and stream mode explicit Fstream_Binfile_Facade ( const char * filename, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary); //! Open state bool is_open() {return _str->is_open();} //! Method to open corresponding file void open ( const char * filename, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary) {_str->open(filename,mode);} //! Method to close corresponding file void close() {_str->close();} //! Output multiple characters Fstream_Binfile_Facade& write (const char* c, std::streamsize n) {_str->write(c,n); return *this;}; //! Output single char Fstream_Binfile_Facade& put (const char c) {_str->put(c); return *this;}; //! Get position std::streampos tellp() {return _str->tellp();} //! Set position Fstream_Binfile_Facade& seekp (std::streampos pos) {_str->seekp(pos); return *this;} //! Set relative position Fstream_Binfile_Facade& seekp (std::streamoff pos, std::ios_base::seekdir way) {_str->seekp(pos,way); return *this;} //! Flushes stream buffer Fstream_Binfile_Facade& flush() {_str->flush(); return *this;} //! Last extracted chars count std::streamsize gcount() const {return _str->gcount();} //! Get single char int get() {return _str->get();} //! Get single char Fstream_Binfile_Facade& get(char& c){_str->get(c); return *this;} //! Get multiple chars to c-string and add trailing 0 Fstream_Binfile_Facade& get(char* s, std::streamsize n) {_str->get(s,n); return *this;} //! Get multiple chars to c-string without trailing 0 Fstream_Binfile_Facade& get(char* s, std::streamsize n, char delim) {_str->get(s,n,delim); return *this;} //! Get multiple chars to c-string without trailing 0 Fstream_Binfile_Facade& getline(char* s, std::streamsize n) {_str->getline(s,n); return *this;} Fstream_Binfile_Facade& getline(char* s, std::streamsize n, char delim) {_str->getline(s,n,delim); return *this;} //! Extract and ignore chars Fstream_Binfile_Facade& ignore (std::streamsize n = 1, int delim = EOF) {_str->ignore(n,delim); return *this;} //! Peak single char from the top of the buffer int peek() {return _str->peek();} //! Read n chars from stream Fstream_Binfile_Facade& read (char* s, std::streamsize n) {_str->read(s,n); return *this;} //! Read up to n available chars from stream std::streamsize readsome (char* s, std::streamsize n) {return _str->readsome(s,n);} //! This method attempts to put back single char Fstream_Binfile_Facade& putback (char c) {_str->putback(c); return *this;} //! Unget last extracted char Fstream_Binfile_Facade& unget() {_str->unget(); return *this;} //! Get position std::streampos tellg() {return _str->tellg();} //! Set position Fstream_Binfile_Facade& seekg (std::streampos pos) {_str->seekg(pos); return *this;} //! Set relative position Fstream_Binfile_Facade& seekg (std::streamoff pos, std::ios_base::seekdir way) {_str->seekg(pos,way); return *this;} //! This method returns true is stream state is good bool good() const {return _str->good();} //! This method returns true if eof is reached bool eof() const {return _str->eof();} //! This method returns true if either failbit or badbit is set bool fail() const {return _str->fail();} //! This method returns true if badbit is set bool bad() const {return _str->bad();} //! Unary not operator to check the stream state bool operator!() const {return _str->fail();} //! Conversion to bool to validate stream state operator bool() const {return _str->good();} //! Method to read stream state flags std::ios_base::iostate rdstate() const {return _str->rdstate();} //! Method to set the stream state (combines already set flags with flags provide by user) void setstate (std::ios_base::iostate state) {_str->setstate(state);} //! Method to set stream state (overwrites stream state flags) void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);} //! Method to get the exceptions mask std::ios_base::iostate exceptions() const {return _str->exceptions();} //! Method to set the exceptions mask void exceptions (std::ios_base::iostate except) {_str->exceptions(except);} //! Destructor virtual ~Fstream_Binfile_Facade(); protected: //! Access to internal stream for derived classes std::fstream* stream() {return _str;} }; } /*! \brief Binary Outfile Class \ingroup itfile */ class ITPP_EXPORT bofstream : public bfstream_base, public binfile_details::Ofstream_Binfile_Facade { public: /*! \brief Class constructor that opens a file and sets the endianity \param name The name of the file to open \param e Defines the endianity of the class. Possible values are \c l_endian for "Little Endian" or \c b_endian for "Big Endian". The default value is \c b_endian. Set \c truncate to true to discard file contents. */ bofstream(const std::string& name, endian e = b_endian); //! Class Constructor bofstream(); //! Class Destructor ~bofstream() { } /*! \brief Open a file for writing and set the endianity \param name The name of the file to open \param e Defines the endianity of the class (default value is \c b_endian ) Set \c trunc to true to discard file contents. */ void open(const std::string& name, bool trunc = false, endian e = b_endian); //! Writes a signed char variable to the binary output file bofstream& operator<<(char a); //! Writes a 8-bit signed integer variable to the binary file bofstream& operator<<(int8_t a); //! Writes a 8-bit unsigned integer variable to the binary file bofstream& operator<<(uint8_t a); //! Writes a 16-bit signed integer variable to the binary output file bofstream& operator<<(int16_t a); //! Writes a 16-bit unsigned integer variable to the binary output file bofstream& operator<<(uint16_t a); //! Writes a 32-bit signed integer variable to the binary output file bofstream& operator<<(int32_t a); //! Writes a 32-bit unsigned integer variable to the binary output file bofstream& operator<<(uint32_t a); //! Writes a 64-bit signed integer variable to the binary output file bofstream& operator<<(int64_t a); //! Writes a 64-bit unsigned ingeger variable to the binary output file bofstream& operator<<(uint64_t a); //! Writes a float variable to the binary output file bofstream& operator<<(float a); //! Writes a double variable to the binary output file bofstream& operator<<(double a); //! Writes a binary variable to the binary output file bofstream& operator<<(bin a); //! Writes a char* string to the binary output file bofstream& operator<<(const char* a); //! Writes a string variable to the binary output file bofstream& operator<<(const std::string& a); }; /*! \brief Binary Infile Class \ingroup itfile */ class ITPP_EXPORT bifstream : public bfstream_base, public binfile_details::Ifstream_Binfile_Facade { public: /*! \brief Class constructor that opens a file and sets the endianity \param name The name of the file to open \param e Defines the endianity of the class. Possible values are \c l_endian for "Little Endian" or \c b_endian for "Big Endian". The default value is \c b_endian. */ bifstream(const std::string& name, endian e = b_endian); //! Class Constructor bifstream(); //! Class Destructor ~bifstream() { } /*! \brief Open a file for reading and set the endianity \param name The name of the file to open \param e Defines the endianity of the class (default value is \c b_endian ) */ void open(const std::string& name, endian e = b_endian); //! Returns the length in bytes of the file int length(); //! Reads a signed char variable from the binary input file bifstream& operator>>(char& a); //! Reads a 8-bit signed integer variable from the binary input file bifstream& operator>>(int8_t& a); //! Reads a 8-bit unsigned integer variable from the binary input file bifstream& operator>>(uint8_t& a); //! Reads a 16-bit signed integer variable from the binary input file bifstream& operator>>(int16_t& a); //! Reads a 16-bit unsigned integer variable from the binary input file bifstream& operator>>(uint16_t& a); //! Reads a 32-bit signed integer variable from the binary input file bifstream& operator>>(int32_t& a); //! Reads a 32-bit unsigned integer variable from the binary input file bifstream& operator>>(uint32_t& a); //! Reads a 64-bit signed integer variable from the binary input file bifstream& operator>>(int64_t& a); //! Reads a 64-bit unsigned ingeger variable from the binary input file bifstream& operator>>(uint64_t& a); //! Reads a float variable from the binary input file bifstream& operator>>(float& a); //! Reads a double variable from the binary input file bifstream& operator>>(double& a); //! Reads a binary variable from the binary input file bifstream& operator>>(bin& a); //! Reads a char* string from the binary input file bifstream& operator>>(char* a); //! Reads a string variable from the binary input file bifstream& operator>>(std::string& a); }; /*! \brief Binary in/out-file Class \ingroup itfile */ class ITPP_EXPORT bfstream : public bfstream_base, public binfile_details::Fstream_Binfile_Facade { public: /*! \brief Class constructor that opens a file and sets the endianity \param name The name of the file to open \param e Defines the endianity of the class. Possible values are \c l_endian for "Little Endian" or \c b_endian for "Big Endian". The default value is \c b_endian. */ bfstream(const std::string& name, endian e = b_endian); //! Class Constructor bfstream(); //! Class Destructor ~bfstream() { } /*! \brief Open a file for reading and writing and set the endianity \param name The name of the file to open \param trunc Rewrite the file if it exists (default value is \c false) \param e Defines the endianity of the class (default value is \c b_endian ) */ void open(const std::string& name, bool trunc = false, endian e = b_endian); /*! \brief Open a file for reading only and set the endianity \param name The name of the file to open \param e Defines the endianity of the class (default value is \c b_endian ) */ void open_readonly(const std::string& name, endian e = b_endian); //! Returns the length in bytes of the file int length(); //! Writes an char variable to the binary file bfstream& operator<<(char a); //! Writes a 8-bit signed integer variable to the binary file bfstream& operator<<(int8_t a); //! Writes a 8-bit unsigned integer variable to the binary file bfstream& operator<<(uint8_t a); //! Writes a 16-bit signed integer variable to the binary file bfstream& operator<<(int16_t a); //! Writes a 16-bit unsigned integer variable to the binary file bfstream& operator<<(uint16_t a); //! Writes a 32-bit signed integer variable to the binary file bfstream& operator<<(int32_t a); //! Writes a 32-bit unsigned integer variable to the binary file bfstream& operator<<(uint32_t a); //! Writes a 64-bit signed integer variable to the binary file bfstream& operator<<(int64_t a); //! Writes a 64-bit unsigned ingeger variable to the binary file bfstream& operator<<(uint64_t a); //! Writes a float variable to the binary file bfstream& operator<<(float a); //! Writes a double variable to the binary file bfstream& operator<<(double a); //! Writes a binary variable to the binary file bfstream& operator<<(bin a); //! Writes a char* string to the binary file bfstream& operator<<(const char* a); //! Writes a string variable to the binary file bfstream& operator<<(const std::string& a); //! Reads a char variable from the binary file bfstream& operator>>(char& a); //! Reads a 8-bit signed integer variable from the binary file bfstream& operator>>(int8_t& a); //! Reads a 8-bit unsigned integer variable from the binary file bfstream& operator>>(uint8_t & a); //! Reads a 16-bit signed integer variable from the binary file bfstream& operator>>(int16_t& a); //! Reads a 16-bit unsigned integer variable from the binary file bfstream& operator>>(uint16_t& a); //! Reads a 32-bit signed integer variable from the binary file bfstream& operator>>(int32_t& a); //! Reads a 32-bit unsigned integer variable from the binary file bfstream& operator>>(uint32_t& a); //! Reads a 64-bit signed integer variable from the binary file bfstream& operator>>(int64_t& a); //! Reads a 64-bit unsigned ingeger variable from the binary file bfstream& operator>>(uint64_t& a); //! Reads a float variable from the binary file bfstream& operator>>(float& a); //! Reads a double variable from the binary file bfstream& operator>>(double& a); //! Reads a binary variable from the binary file bfstream& operator>>(bin& a); //! Reads a char* string from the binary file bfstream& operator>>(char* a); //! Reads a string variable from the binary file bfstream& operator>>(std::string& a); }; } //namespace itpp #endif // #ifndef BINFILE_H itpp-4.3.1/itpp/base/blas.h000066400000000000000000000132441216575753400154760ustar00rootroot00000000000000/*! * \file * \brief BLAS header functions. For internal use only. * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BLAS_H #define BLAS_H #ifndef _MSC_VER # include #else # include #endif #include //! \cond #if defined(_MSC_VER) && (defined(HAVE_ACML) || defined(HAVE_MKL)) # define dswap_ DSWAP # define zswap_ ZSWAP # define dscal_ DSCAL # define zscal_ ZSCAL # define dcopy_ DCOPY # define zcopy_ ZCOPY # define daxpy_ DAXPY # define zaxpy_ ZAXPY # define ddot_ DDOT # define dgemv_ DGEMV # define zgemv_ ZGEMV # define dger_ DGER # define zgeru_ ZGERU # define zgerc_ ZGERC # define dgemm_ DGEMM # define zgemm_ ZGEMM #endif // #if defined(_MSC_VER) && (defined(HAVE_ACML) || defined(HAVE_MKL)) namespace blas { #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ // ---------------------------------------------------------------------- // BLAS 1 functions // ---------------------------------------------------------------------- void dswap_(const int *n, double *x, const int *incx, double *y, const int *incy); void zswap_(const int *n, std::complex *x, const int *incx, std::complex *y, const int *incy); void dscal_(const int *n, const double *alpha, double *x, const int *incx); void zscal_(const int *n, const std::complex *alpha, std::complex *x, const int *incx); void dcopy_(const int *n, const double *x, const int *incx, double *y, const int *incy); void zcopy_(const int *n, const std::complex *x, const int *incx, std::complex *y, const int *incy); void daxpy_(const int *n, const double *alpha, const double *x, const int *incx, double *y, const int *incy); void zaxpy_(const int *n, const std::complex *alpha, const std::complex *x, const int *incx, std::complex *y, const int *incy); double ddot_(const int *n, const double *x, const int *incx, const double *y, const int *incy); // ---------------------------------------------------------------------- // BLAS 2 functions // ---------------------------------------------------------------------- void dgemv_(const char *transA, const int *m, const int *n, const double *alpha, const double *A, const int *ldA, const double *x, const int *incx, const double *beta, double *y, const int *incy); void zgemv_(const char *transA, const int *m, const int *n, const std::complex *alpha, const std::complex *A, const int *ldA, const std::complex *x, const int *incx, const std::complex *beta, std::complex *y, const int *incy); void dger_(const int *m, const int *n, const double *alpha, const double *x, const int *incx, const double *y, const int *incy, double *A, const int *ldA); void zgeru_(const int *m, const int *n, const std::complex *alpha, const std::complex *x, const int *inxx, const std::complex *y, const int *incy, std::complex *A, const int *ldA); void zgerc_(const int *m, const int *n, const std::complex *alpha, const std::complex *x, const int *inxx, const std::complex *y, const int *incy, std::complex *A, const int *ldA); // ---------------------------------------------------------------------- // BLAS 3 functions // ---------------------------------------------------------------------- void dgemm_(const char *transA, const char *transB, const int *m, const int *n, const int *k, const double *alpha, const double *A, const int *ldA, const double *B, const int *ldB, const double *beta, double *C, const int *ldC); void zgemm_(const char *transA, const char *transB, const int *m, const int *n, const int *k, const std::complex *alpha, const std::complex *A, const int *ldA, const std::complex *B, const int *ldB, const std::complex *beta, std::complex *C, const int *ldC); #ifdef __cplusplus } #endif /* __cplusplus */ } // namespace blas //! \endcond #endif // #ifndef BLAS_H itpp-4.3.1/itpp/base/circular_buffer.h000066400000000000000000000340431216575753400177120ustar00rootroot00000000000000/*! * \file * \brief Circular_Buffer class (container) * \author Tobias Tynderfeldt * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This file is not separated into .h and .cpp files. The reason is * to avoid problems with template initializations of this class. * A \c Circular_Buffer can contain any type and it is not * possible to initialize and pre-compile all types that might be put * into a \c Circular_Buffer. */ #ifndef CIRCULAR_BUFFER_H #define CIRCULAR_BUFFER_H #include #include namespace itpp { /*! \brief General circular buffer class This class is a general circular buffer class for arbitrary types. For rarely used types you will need to instantiate the class by \code template class Circular_Buffer; \endcode The following example shows how to define a Circular_Buffer of doubles: \code vec a = randn(3); vec b = randn(8); vec out_vec; Array out_array; Circular_Buffer cb1(10); //Put the elements of a to the buffer cb1.put(a); //Vector output: Peek at the two oldest elements of the buffer (the two first extracted) cb1.peek(out_vec,2); cout << "peek(out_vec,2) = " << out_vec << ": display 2 first elements of the buffer, without affecting the content" << endl; //Vector output: Peek at all elements of the buffer in reverse order cb1.peek_reverse(out_vec); cout << "peek_reverse(out_vec,-1) = " << out_vec << ": display buffer, without affecting the content" << endl; //Array output: Peek at all elements of the buffer in reverse order cb1.peek_reverse(out_array); cout << "peek_reverse(out_array,-1) = " << out_array << ": display buffer, without affecting the content" << endl; //Put the elements of \c b to the buffer cb1.put(b); //Extract the oldest element of the buffer cb1.get(out_vec,1); cout << "get(out_vec,1) = " << out_vec << endl ; //Extract all element of the buffer cb1.get(out_vec); cout << "get(out_vec) = " << out_vec << endl ; \endcode */ template class Circular_Buffer { public: //! Default constructor Circular_Buffer(); //! Create a Circular_Buffer of size \c n Circular_Buffer(int n); //! Create a copy of \c s Circular_Buffer(const Circular_Buffer &s); //! Default destructor virtual ~Circular_Buffer(); //! Write the element \a in to the buffer void put(const T& in); //! Write the vector of elements \a in to the circular buffer void put(const Vec& in); //! Write the vector of elements \a in to the circular buffer void put(const Array& in); //! Get the oldest element in the circular buffer void get(T& out); //! Get the oldest element in the circular buffer T get(); //! Get the N oldest element in the circular buffer. \c N=-1 returns all elements in the buffer void get(Vec& out, const int N = -1); //! Get the N oldest element in the circular buffer. \c N=-1 returns all elements in the buffer void get(Array& out, const int N = -1); //! Peek at the oldest element in the circular buffer, without removing it. void peek(T& out) const; //! Peek at the oldest element in the circular buffer, without removing it. T peek() const; //! Peek at the element with index \a index in the circular buffer, without removing it. void peek(const int index, T& out) const; //! Peek at the N first elements of the circular buffer, without removing them. \c N=-1 peeks all elements in the buffer void peek(Vec& out, const int N = -1) const; //! Peek at the elements with index \a index in the circular buffer, without removing them. void peek(const ivec& index, Vec& out) const; //! Peek at the N first elements of the circular buffer, without removing them. \c N=-1 peeks all elements in the buffer void peek(Array& out, const int N = -1) const; //! Peek at the elements with index \a index in the circular buffer, without removing them. void peek(const ivec& index, Array& out) const; //! Peek at the latest element in the circular buffer, without removing it. void peek_reverse(T& out) const; //! Peek at the latest element in the circular buffer, without removing it. T peek_reverse() const; //! Peek at the N latest elements of the circular buffer in reverse order, without removing them. \c N=-1 returns all elements in the buffer void peek_reverse(Vec& out, const int N = -1) const; //! Peek at the N latest elements of the circular buffer in reverse order, without removing them. \c N=-1 returns all elements in the buffer void peek_reverse(Array& out, const int N = -1) const; //! Empty the circular buffer void clear(); //! Assignment operator void operator=(const Circular_Buffer &s); //! Returns the maximum number of data elements the circular buffer can store int size() const { return _ndata; } //! Returns the number of data elements currently stored in the circular buffer int nrof_elements() const { return _rw_dist; } //! Resizing a Circular_Buffer. void set_size(int n, bool copy = false); private: int _write; int _read; int _ndata; int _rw_dist; T *_data; void alloc(int n); void free(); }; // --------------------------- Implementation starts here ---------------------------------- template Circular_Buffer::Circular_Buffer() { _data = 0; _ndata = 0; _rw_dist = 0; _read = 0; _write = 0; } template Circular_Buffer::Circular_Buffer(int n) { alloc(n); _read = 0; _write = 0; _rw_dist = 0; } template Circular_Buffer::Circular_Buffer(const Circular_Buffer &cb) { _data = NULL; _ndata = 0; _read = cb._read; _write = cb._write; _rw_dist = cb._rw_dist; alloc(cb._ndata); for (int i = 0; i < cb._ndata; i++) { _data[i] = cb._data[i]; } } template Circular_Buffer::~Circular_Buffer() { free(); } template void Circular_Buffer::get(T& out) { it_assert_debug(_rw_dist > 0, "Buffer empty. No data left to read from the buffer."); out = _data[_read]; _read++; _rw_dist--; if (_read == _ndata) { _read = 0; } } template T Circular_Buffer::get() { T out; get(out); return out; } template void Circular_Buffer::get(Vec& out, const int N) { int N_out; if (N == -1) N_out = _rw_dist; else N_out = N; out.set_size(N_out); for (int i = 0;i < N_out;i++) { it_assert_debug(_rw_dist > 0, "Buffer empty. No data left to read from the buffer."); out(i) = _data[_read]; _read++; _rw_dist--; if (_read == _ndata) _read = 0; } } template void Circular_Buffer::get(Array& out, const int N) { int N_out; if (N == -1) N_out = _rw_dist; else N_out = N; out.set_size(N_out); for (int i = 0;i < N_out;i++) { it_assert_debug(_rw_dist > 0, "Buffer empty. No data left to read from the buffer."); out(i) = _data[_read]; _read++; _rw_dist--; if (_read == _ndata) _read = 0; } } template void Circular_Buffer::peek(T& out) const { it_assert_debug(_rw_dist > 0, "Attempted to peek at an empty buffer."); out = _data[_read]; } template T Circular_Buffer::peek() const { T out; peek(out); return out; } template void Circular_Buffer::peek(const int index, T& out) const { it_assert_debug(_rw_dist > index && index >= 0, "The index exceeds the number of elements stored in the buffer."); out = _data[(_read+index)%_ndata]; } template void Circular_Buffer::peek(Vec& out, const int N) const { int N_out; int read_tmp = _read; if (N == -1) N_out = _rw_dist; else N_out = N; it_assert_debug(_rw_dist >= N_out, "Attempted to peek at more elements than there are stored in the buffer."); out.set_size(N_out); for (int i = 0;i < N_out;i++) { out(i) = _data[read_tmp]; read_tmp++; if (read_tmp == _ndata) read_tmp = 0; } } template void Circular_Buffer::peek(const ivec& index, Vec& out) const { out.set_size(index.size()); for (int i = 0;i < index.size();i++) { it_assert_debug(_rw_dist >= index(i) && index(i) >= 0, "Attempted to peek at an element, whose index exceeds the number of buffered elements."); out(i) = _data[(_read+index(i))%_ndata]; } } template void Circular_Buffer::peek(Array& out, const int N) const { int N_out; int read_tmp = _read; if (N == -1) N_out = _rw_dist; else N_out = N; it_assert_debug(_rw_dist >= N_out, "Attempted to peek at more elements than there are stored in the buffer."); out.set_size(N_out); for (int i = 0;i < N_out;i++) { out(i) = _data[read_tmp]; read_tmp++; if (read_tmp == _ndata) read_tmp = 0; } } template void Circular_Buffer::peek(const ivec& index, Array& out) const { out.set_size(index.size()); for (int i = 0;i < index.size();i++) { it_assert_debug(_rw_dist >= index(i) && index(i) >= 0, "Attempted to peek at an element, whose index exceeds the number of buffered elements."); out(i) = _data[(_read+index(i))%_ndata]; } } template void Circular_Buffer::peek_reverse(T& out) const { int read_tmp; it_assert_debug(_rw_dist > 0, "Attempted to peek at an empty buffer."); if (_write > 0) read_tmp = _write - 1; else read_tmp = _ndata - 1; out = _data[read_tmp]; } template T Circular_Buffer::peek_reverse() const { T out; peek_reverse(out); return out; } template void Circular_Buffer::peek_reverse(Vec& out, const int N) const { int N_out; int read_tmp; if (N == -1) N_out = _rw_dist; else N_out = N; it_assert_debug(_rw_dist >= N_out, "Attempted to peek at more elements than there are stored in the buffer."); out.set_size(N_out); if (_write > 0) read_tmp = _write - 1; else read_tmp = _ndata - 1; for (int i = 0;i < N_out;i++) { out(i) = _data[read_tmp]; read_tmp--; if (read_tmp < 0) read_tmp = _ndata - 1; } } template void Circular_Buffer::peek_reverse(Array& out, const int N) const { int N_out; int read_tmp; if (N == -1) N_out = _rw_dist; else N_out = N; it_assert_debug(_rw_dist >= N_out, "Attempted to peek at more elements than there are stored in the buffer."); out.set_size(N_out); if (_write > 0) read_tmp = _write - 1; else read_tmp = _ndata - 1; for (int i = 0;i < N_out;i++) { out(i) = _data[read_tmp]; read_tmp--; if (read_tmp < 0) read_tmp = _ndata - 1; } } template void Circular_Buffer::put(const T& in) { //Remove the oldest element of the buffer if the buffer is full if (_rw_dist >= _ndata) { T dummy; get(dummy); } //Write data to the buffer and move the pointer to the next buffer slot _data[_write] = in; _write++; _rw_dist++; //Check if the pointer in the circular buffer should go back to zero if (_write >= _ndata) _write = 0; } template void Circular_Buffer::put(const Vec& in) { for (int i = 0;i < in.size();i++) { //Remove the oldest element of the buffer if the buffer is full if (_rw_dist >= _ndata) { T dummy; get(dummy); } //Write data to the buffer and move the pointer to the next buffer slot _data[_write] = in(i); _write++; _rw_dist++; //Check if the pointer in the circular buffer should go back to zero if (_write >= _ndata) _write = 0; } } template void Circular_Buffer::put(const Array& in) { for (int i = 0;i < in.size();i++) { //Remove the oldest element of the buffer if the buffer is full if (_rw_dist >= _ndata) { T dummy; get(dummy); } //Write data to the buffer and move the pointer to the next buffer slot _data[_write] = in(i); _write++; _rw_dist++; //Check if the pointer in the circular buffer should go back to zero if (_write >= _ndata) _write = 0; } } template void Circular_Buffer::clear() { _write = 0; _read = 0; _rw_dist = 0; } template void Circular_Buffer::alloc(int n) { if (n == 0) { _ndata = 0; _data = NULL; } else if (n > 0) { _ndata = n; _data = new T[_ndata]; it_assert(_data != 0, "Out of memory in Circular_Buffer::alloc"); } else { it_error("Circular_Buffer::alloc(int n): n must be positive"); } } template void Circular_Buffer::free() { delete [] _data; _data = NULL; _ndata = 0; _write = 0; _read = 0; _rw_dist = 0; } template void Circular_Buffer::operator=(const Circular_Buffer &s) { set_size(s._ndata); for (int i = 0; i < _ndata; i++) _data[i] = s._data[i]; _read = s._read; _write = s._write; _rw_dist = _write - _read; } template void Circular_Buffer::set_size(int sz, bool copy) { int i, min_nrof_elem; //T *tmp; Vec tmp; if (_ndata == sz) return; if (copy) { peek_reverse(tmp, -1); min_nrof_elem = _rw_dist < sz ? _rw_dist : sz; alloc(sz); clear(); for (i = 0; i < min_nrof_elem; i++) put(tmp(min_nrof_elem - 1 - i)); } else { free(); alloc(sz); } _ndata = sz; } } // namespace itpp #endif // #ifndef CIRCULAR_BUFFER_H itpp-4.3.1/itpp/base/converters.cpp000066400000000000000000000201471216575753400173020ustar00rootroot00000000000000/*! * \file * \brief Implementation of converters between different vector and matrix types * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include //! \cond namespace itpp { // ---------------------------------------------------------------------- // Vector converters // ---------------------------------------------------------------------- ivec to_ivec(int s) { ivec out(1); out(0) = s; return out; } vec to_vec(double s) { vec out(1); out(0) = s; return out; } cvec to_cvec(double real, double imag) { cvec out(1); out(0) = std::complex(real, imag); return out; } // ---------------------------------------------------------------------- // Miscellaneous converters // ---------------------------------------------------------------------- bvec dec2bin(int length, int index) { int i, bintemp = index; bvec temp(length); for (i = length - 1; i >= 0; i--) { temp(i) = bin(bintemp & 1); bintemp = (bintemp >> 1); } return temp; } bvec dec2bin(int index, bool msb_first) { int length = int2bits(index); int i, bintemp = index; bvec temp(length); for (i = length - 1; i >= 0; i--) { temp(i) = bin(bintemp & 1); bintemp = (bintemp >> 1); } if (msb_first) { return temp; } else { return reverse(temp); } } void dec2bin(int index, bvec &v) { int i, bintemp = index; v.set_size(int2bits(index), false); for (i = v.size() - 1; i >= 0; i--) { v(i) = bin(bintemp & 1); bintemp = (bintemp >> 1); } } int bin2dec(const bvec &inbvec, bool msb_first) { int i, temp = 0; int sizebvec = inbvec.length(); if (msb_first) { for (i = 0; i < sizebvec; i++) { temp += pow2i(sizebvec - i - 1) * int(inbvec(i)); } } else { for (i = 0; i < sizebvec; i++) { temp += pow2i(i) * int(inbvec(i)); } } return temp; } bvec oct2bin(const ivec &octalindex, short keepzeros) { int length = octalindex.length(), i; bvec out(3*length); for (i = 0; i < length; i++) { out.replace_mid(3*i, dec2bin(3, octalindex(i))); } //remove zeros if keepzeros = 0 if (keepzeros == 0) { for (i = 0; i < out.length(); i++) { if ((short)out(i) != 0) { return out.right(out.length() - i); break; } } return bvec("0"); } else { return out; } } ivec bin2oct(const bvec &inbits) { int start, Itterations = ceil_i(inbits.length() / 3.0); ivec out(Itterations); for (int i = Itterations - 1; i > 0; i--) { start = 3 * i - (3 * Itterations - inbits.length()); out(i) = bin2dec(inbits.mid(start, 3)); } out(0) = bin2dec(inbits.left(inbits.length() - ((Itterations - 1) * 3))); return out; } ivec bin2pol(const bvec &inbvec) { return 1 -2*to_ivec(inbvec); } bvec pol2bin(const ivec &inpol) { return to_bvec((1 -inpol) / 2); } // Round to nearest integer, return result in double double round(double x) { return ::rint(x); } // Round to nearest integer vec round(const vec &x) { return apply_function(::rint, x); } // Round to nearest integer mat round(const mat &x) { return apply_function(::rint, x); } // Round to nearest integer int round_i(double x) { return static_cast(::rint(x)); } // Round to nearest integer and return ivec ivec round_i(const vec &x) { return to_ivec(round(x)); } // Round to nearest integer and return imat imat round_i(const mat &x) { return to_imat(round(x)); } // Round to nearest upper integer ivec ceil_i(const vec &x) { return to_ivec(ceil(x)); } // Round to nearest upper integer imat ceil_i(const mat &x) { return to_imat(ceil(x)); } // Round to nearest lower integer ivec floor_i(const vec &x) { return to_ivec(floor(x)); } // Round to nearest lower integer imat floor_i(const mat &x) { return to_imat(floor(x)); } cvec round_to_zero(const cvec &x, double threshold) { cvec temp(x.length()); for (int i = 0; i < x.length(); i++) temp(i) = round_to_zero(x(i), threshold); return temp; } cmat round_to_zero(const cmat &x, double threshold) { cmat temp(x.rows(), x.cols()); for (int i = 0; i < x.rows(); i++) { for (int j = 0; j < x.cols(); j++) { temp(i, j) = round_to_zero(x(i, j), threshold); } } return temp; } cvec round_to_infty(const cvec &in, const double threshold) { cvec temp(in.length()); for (int i = 0; i < in.length(); i++) temp(i) = round_to_infty(in(i), threshold); return temp; } cmat round_to_infty(const cmat &in, const double threshold) { cmat temp(in.rows(), in.cols()); for (int i = 0; i < in.rows(); i++) { for (int j = 0; j < in.cols(); j++) { temp(i, j) = round_to_infty(in(i, j), threshold); } } return temp; } std::string to_str(const double &i, const int precision) { std::ostringstream ss; ss.precision(precision); ss.setf(std::ostringstream::scientific, std::ostringstream::floatfield); ss << i; return ss.str(); } // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- template ITPP_EXPORT bvec to_bvec(const svec &v); template ITPP_EXPORT bvec to_bvec(const ivec &v); template ITPP_EXPORT svec to_svec(const bvec &v); template ITPP_EXPORT svec to_svec(const ivec &v); template ITPP_EXPORT svec to_svec(const vec &v); template ITPP_EXPORT ivec to_ivec(const bvec &v); template ITPP_EXPORT ivec to_ivec(const svec &v); template ITPP_EXPORT ivec to_ivec(const vec &v); template ITPP_EXPORT vec to_vec(const bvec &v); template ITPP_EXPORT vec to_vec(const svec &v); template ITPP_EXPORT vec to_vec(const ivec &v); template ITPP_EXPORT cvec to_cvec(const bvec &v); template ITPP_EXPORT cvec to_cvec(const svec &v); template ITPP_EXPORT cvec to_cvec(const ivec &v); template ITPP_EXPORT cvec to_cvec(const vec &v); template ITPP_EXPORT cvec to_cvec(const bvec &real, const bvec &imag); template ITPP_EXPORT cvec to_cvec(const svec &real, const svec &imag); template ITPP_EXPORT cvec to_cvec(const ivec &real, const ivec &imag); template ITPP_EXPORT cvec to_cvec(const vec &real, const vec &imag); template ITPP_EXPORT bmat to_bmat(const smat &m); template ITPP_EXPORT bmat to_bmat(const imat &m); template ITPP_EXPORT smat to_smat(const bmat &m); template ITPP_EXPORT smat to_smat(const imat &m); template ITPP_EXPORT smat to_smat(const mat &m); template ITPP_EXPORT imat to_imat(const bmat &m); template ITPP_EXPORT imat to_imat(const smat &m); template ITPP_EXPORT imat to_imat(const mat &m); template ITPP_EXPORT mat to_mat(const bmat &m); template ITPP_EXPORT mat to_mat(const smat &m); template ITPP_EXPORT mat to_mat(const imat &m); template ITPP_EXPORT cmat to_cmat(const bmat &m); template ITPP_EXPORT cmat to_cmat(const smat &m); template ITPP_EXPORT cmat to_cmat(const imat &m); template ITPP_EXPORT cmat to_cmat(const mat &m); template ITPP_EXPORT cmat to_cmat(const bmat &real, const bmat &imag); template ITPP_EXPORT cmat to_cmat(const smat &real, const smat &imag); template ITPP_EXPORT cmat to_cmat(const imat &real, const imat &imag); template ITPP_EXPORT cmat to_cmat(const mat &real, const mat &imag); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/converters.h000066400000000000000000000361621216575753400167530ustar00rootroot00000000000000/*! * \file * \brief Definitions of converters between different vector and matrix types * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CONVERTERS_H #define CONVERTERS_H #include #include #include namespace itpp { //! \addtogroup convertfunc //@{ // ---------------------------------------------------------------------- // Converters for vectors // ---------------------------------------------------------------------- /*! \relatesalso Vec \brief Converts a Vec to bvec */ template bvec to_bvec(const Vec &v) { bvec temp(v.length()); for (int i = 0; i < v.length(); ++i) { temp(i) = static_cast(v(i)); } return temp; } /*! \relatesalso Vec \brief Converts a Vec to svec */ template svec to_svec(const Vec &v) { svec temp(v.length()); for (int i = 0; i < v.length(); ++i) { temp(i) = static_cast(v(i)); } return temp; } /*! \relatesalso Vec \brief Converts a Vec to ivec */ template ivec to_ivec(const Vec &v) { ivec temp(v.length()); for (int i = 0; i < v.length(); ++i) { temp(i) = static_cast(v(i)); } return temp; } /*! \relatesalso Vec \brief Converts a Vec to vec */ template vec to_vec(const Vec &v) { vec temp(v.length()); for (int i = 0; i < v.length(); ++i) { temp(i) = static_cast(v(i)); } return temp; } /*! \relatesalso Vec \brief Converts a Vec to cvec */ template cvec to_cvec(const Vec &v) { cvec temp(v.length()); for (int i = 0; i < v.length(); ++i) { temp(i) = std::complex(static_cast(v(i)), 0.0); } return temp; } //! \cond template<> inline cvec to_cvec(const cvec& v) { return v; } //! \endcond /*! \relatesalso Vec \brief Converts real and imaginary Vec to cvec */ template cvec to_cvec(const Vec &real, const Vec &imag) { it_assert(real.length() == imag.length(), "to_cvec(): real and imaginary parts must have the same length"); cvec temp(real.length()); for (int i = 0; i < real.length(); ++i) { temp(i) = std::complex(static_cast(real(i)), static_cast(imag(i))); } return temp; } /*! \relatesalso Vec \brief Converts an int to ivec */ ivec to_ivec(int s); /*! \relatesalso Vec \brief Converts an double to vec */ vec to_vec(double s); /*! \relatesalso Vec \brief Converts real and imaginary double to cvec */ cvec to_cvec(double real, double imag); // ---------------------------------------------------------------------- // Converters for matrices // ---------------------------------------------------------------------- /*! \relatesalso Mat \brief Converts a Mat to bmat */ template bmat to_bmat(const Mat &m) { bmat temp(m.rows(), m.cols()); for (int i = 0; i < temp.rows(); ++i) { for (int j = 0; j < temp.cols(); ++j) { temp(i, j) = static_cast(m(i, j)); } } return temp; } /*! \relatesalso Mat \brief Converts a Mat to smat */ template smat to_smat(const Mat &m) { smat temp(m.rows(), m.cols()); for (int i = 0; i < temp.rows(); ++i) { for (int j = 0; j < temp.cols(); ++j) { temp(i, j) = static_cast(m(i, j)); } } return temp; } /*! \relatesalso Mat \brief Converts a Mat to imat */ template imat to_imat(const Mat &m) { imat temp(m.rows(), m.cols()); for (int i = 0; i < temp.rows(); ++i) { for (int j = 0; j < temp.cols(); ++j) { temp(i, j) = static_cast(m(i, j)); } } return temp; } /*! \relatesalso Mat \brief Converts a Mat to mat */ template mat to_mat(const Mat &m) { mat temp(m.rows(), m.cols()); for (int i = 0; i < temp.rows(); ++i) { for (int j = 0; j < temp.cols(); ++j) { temp(i, j) = static_cast(m(i, j)); } } return temp; } /*! \relatesalso Mat \brief Converts a Mat to cmat */ template cmat to_cmat(const Mat &m) { cmat temp(m.rows(), m.cols()); for (int i = 0; i < temp.rows(); ++i) { for (int j = 0; j < temp.cols(); ++j) { temp(i, j) = std::complex(static_cast(m(i, j)), 0.0); } } return temp; } //! \cond template<> inline cmat to_cmat(const cmat& m) { return m; } //! \endcond /*! \relatesalso Mat \brief Converts real and imaginary Mat to cmat */ template cmat to_cmat(const Mat &real, const Mat &imag) { it_assert_debug((real.rows() == imag.rows()) && (real.cols() == imag.cols()), "to_cmat(): real and imag part sizes does not match"); cmat temp(real.rows(), real.cols()); for (int i = 0; i < temp.rows(); ++i) { for (int j = 0; j < temp.cols(); ++j) { temp(i, j) = std::complex(static_cast(real(i, j)), static_cast(imag(i, j))); } } return temp; } /*! \brief Convert a decimal int \a index to bvec using \a length bits in the representation */ ITPP_EXPORT bvec dec2bin(int length, int index); /*! \brief Convert a decimal int \a index to bvec. Value returned in \a v. */ ITPP_EXPORT void dec2bin(int index, bvec &v); /*! \brief Convert a decimal int \a index to bvec with the first bit as MSB if \a msb_first == true */ ITPP_EXPORT bvec dec2bin(int index, bool msb_first = true); /*! \brief Convert a bvec to decimal int with the first bit as MSB if \a msb_first == true */ ITPP_EXPORT int bin2dec(const bvec &inbvec, bool msb_first = true); /*! \brief Convert ivec of octal form to bvec Converts from ivec containing {0,1,2,...,7} to bvec containing {0,1}. Removes zeros to the left if keepzeros = 0 (default). Example: oct2bin("3 5 5 1") returns {1 1 1 0 1 1 0 1 0 0 1}. */ ITPP_EXPORT bvec oct2bin(const ivec &octalindex, short keepzeros = 0); /*! \brief Convert bvec to octal ivec Converts from bvec containing {0,1} to ivec containing {0,1,2,...,7}. Adds zeros to the left if inbits.length() is not a factor of 3. Example: bin2oct("1 1 1 0 1 1 0 1 0 0 1") returns {3 5 5 1}. */ ITPP_EXPORT ivec bin2oct(const bvec &inbits); //! Convert bvec to polar binary representation as ivec ITPP_EXPORT ivec bin2pol(const bvec &inbvec); //! Convert binary polar ivec to bvec ITPP_EXPORT bvec pol2bin(const ivec &inpol); //! Convert radians to degrees inline double rad_to_deg(double x) { return (180.0 / itpp::pi * x); } //! Convert degrees to radians inline double deg_to_rad(double x) { return (itpp::pi / 180.0 * x); } //! Round to nearest integer, return result in double ITPP_EXPORT double round(double x); //! Round to nearest integer ITPP_EXPORT vec round(const vec &x); //! Round to nearest integer ITPP_EXPORT mat round(const mat &x); //! Round to nearest integer ITPP_EXPORT int round_i(double x); //! Round to nearest integer and return ivec ITPP_EXPORT ivec round_i(const vec &x); //! Round to nearest integer and return imat ITPP_EXPORT imat round_i(const mat &x); //! Round to nearest upper integer inline vec ceil(const vec &x) { return apply_function(std::ceil, x); } //! Round to nearest upper integer inline mat ceil(const mat &x) { return apply_function(std::ceil, x); } //! The nearest larger integer inline int ceil_i(double x) { return static_cast(std::ceil(x)); } //! Round to nearest upper integer ITPP_EXPORT ivec ceil_i(const vec &x); //! Round to nearest upper integer ITPP_EXPORT imat ceil_i(const mat &x); //! Round to nearest lower integer inline vec floor(const vec &x) { return apply_function(std::floor, x); } //! Round to nearest lower integer inline mat floor(const mat &x) { return apply_function(std::floor, x); } //! The nearest smaller integer inline int floor_i(double x) { return static_cast(std::floor(x)); } //! Round to nearest lower integer ITPP_EXPORT ivec floor_i(const vec &x); //! Round to nearest lower integer ITPP_EXPORT imat floor_i(const mat &x); //! Round \a x to zero if \a abs(x) is smaller than \a threshold inline double round_to_zero(double x, double threshold = 1e-14) { return ((std::fabs(x) < threshold) ? 0.0 : x); } //! Round each part of \a x smaller than \a threshold to zero inline std::complex round_to_zero(const std::complex& x, double threshold = 1e-14) { return std::complex(round_to_zero(x.real(), threshold), round_to_zero(x.imag(), threshold)); } //! Round each element to zero if element < threshold inline vec round_to_zero(const vec &x, double threshold = 1e-14) { return apply_function(round_to_zero, x, threshold); } //! Round each element to zero if element < threshold inline mat round_to_zero(const mat &x, double threshold = 1e-14) { return apply_function(round_to_zero, x, threshold); } //! Round each element to zero if element < threshold ITPP_EXPORT cvec round_to_zero(const cvec &x, double threshold = 1e-14); //! Round each element to zero if element < threshold ITPP_EXPORT cmat round_to_zero(const cmat &x, double threshold = 1e-14); //! Remove trailing digits, found after the decimal point, for numbers greater than threshold inline double round_to_infty(const double in, const double threshold = 1e9) { return (std::fabs(in)>threshold)?itpp::round(in):in; } //! Remove trailing digits, found after the decimal point, for complex numbers whose real and imaginary parts are greater than threshold inline std::complex round_to_infty(const std::complex &in, const double threshold = 1e9) { return std::complex(round_to_infty(in.real(), threshold), round_to_infty(in.imag(), threshold)); } //! Remove trailing digits, found after the decimal point, for vectors greater than threshold inline vec round_to_infty(const vec &in, const double threshold = 1e9) { return apply_function(round_to_infty, in, threshold); } //! Remove trailing digits, found after the decimal point, for matrices greater than threshold inline mat round_to_infty(const mat &in, const double threshold = 1e9) { return apply_function(round_to_infty, in, threshold); } //! Remove trailing digits, found after the decimal point, for complex vectors greater than threshold ITPP_EXPORT cvec round_to_infty(const cvec &in, const double threshold = 1e9); //! Remove trailing digits, found after the decimal point, for complex matrices greater than threshold ITPP_EXPORT cmat round_to_infty(const cmat &in, const double threshold = 1e9); //! Convert to Gray Code inline int gray_code(int x) { return x ^(x >> 1); } /*! \brief Convert anything to string \param i (Input) The value to be converted to a string */ template std::string to_str(const T &i); /*! \brief Convert double to string \param[in] i The value to be converted to a string \param[in] precision The number of digits used to represent the fractional part */ ITPP_EXPORT std::string to_str(const double &i, const int precision); //@} template std::string to_str(const T &i) { std::ostringstream ss; ss.precision(8); ss.setf(std::ostringstream::scientific, std::ostringstream::floatfield); ss << i; return ss.str(); } //! \cond // --------------------------------------------------------------------- // Instantiations // --------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec to_bvec(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec to_bvec(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec to_svec(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec to_svec(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec to_svec(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec to_ivec(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec to_ivec(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec to_ivec(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec to_vec(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec to_vec(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec to_vec(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const bvec &real, const bvec &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const svec &real, const svec &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const ivec &real, const ivec &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec to_cvec(const vec &real, const vec &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat to_bmat(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat to_bmat(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat to_smat(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat to_smat(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat to_smat(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat to_imat(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat to_imat(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat to_imat(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat to_mat(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat to_mat(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat to_mat(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const bmat &real, const bmat &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const smat &real, const smat &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const imat &real, const imat &imag); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat to_cmat(const mat &real, const mat &imag); //! \endcond } // namespace itpp #endif // CONVERTERS_H itpp-4.3.1/itpp/base/copy_vector.cpp000066400000000000000000000154331216575753400174460ustar00rootroot00000000000000/*! * \file * \brief Vector copy functions for internal use * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2008 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #ifndef _MSC_VER # include #else # include #endif #if defined (HAVE_BLAS) # include #endif namespace itpp { #if defined (HAVE_BLAS) void copy_vector(int n, const double *x, double *y) { int incr = 1; blas::dcopy_(&n, x, &incr, y, &incr); } void copy_vector(int n, const std::complex *x, std::complex *y) { int incr = 1; blas::zcopy_(&n, x, &incr, y, &incr); } #else void copy_vector(int n, const double *x, double *y) { memcpy(y, x, static_cast(n) * sizeof(double)); } void copy_vector(int n, const std::complex *x, std::complex *y) { memcpy(y, x, static_cast(n) * sizeof(std::complex)); } #endif #if defined (HAVE_BLAS) void copy_vector(int n, const double *x, int incx, double *y, int incy) { blas::dcopy_(&n, x, &incx, y, &incy); } void copy_vector(int n, const std::complex *x, int incx, std::complex *y, int incy) { blas::zcopy_(&n, x, &incx, y, &incy); } #else void copy_vector(int n, const double *x, int incx, double *y, int incy) { for (int i = 0; i < n; i++) y[i*incy] = x[i*incx]; } void copy_vector(int n, const std::complex *x, int incx, std::complex *y, int incy) { for (int i = 0; i < n; i++) y[i*incy] = x[i*incx]; } #endif #if defined (HAVE_BLAS) void swap_vector(int n, double *x, double *y) { int incr = 1; blas::dswap_(&n, x, &incr, y, &incr); } void swap_vector(int n, std::complex *x, std::complex *y) { int incr = 1; blas::zswap_(&n, x, &incr, y, &incr); } #else void swap_vector(int n, double *x, double *y) { for (int i = 0; i < n; i++) std::swap(x[i], y[i]); } void swap_vector(int n, std::complex *x, std::complex *y) { for (int i = 0; i < n; i++) std::swap(x[i], y[i]); } #endif #if defined (HAVE_BLAS) void swap_vector(int n, double *x, int incx, double *y, int incy) { blas::dswap_(&n, x, &incx, y, &incy); } void swap_vector(int n, std::complex *x, int incx, std::complex *y, int incy) { blas::zswap_(&n, x, &incx, y, &incy); } #else void swap_vector(int n, double *x, int incx, double *y, int incy) { for (int i = 0; i < n; i++) std::swap(x[i*incx], y[i*incy]); } void swap_vector(int n, std::complex *x, int incx, std::complex *y, int incy) { for (int i = 0; i < n; i++) std::swap(x[i*incx], y[i*incy]); } #endif #if defined(HAVE_BLAS) void scal_vector(int n, double alpha, double *x) { int incr = 1; blas::dscal_(&n, &alpha, x, &incr); } void scal_vector(int n, std::complex alpha, std::complex *x) { int incr = 1; blas::zscal_(&n, &alpha, x, &incr); } #else void scal_vector(int n, double alpha, double *x) { if (alpha != 1.0) { for (int i = 0; i < n; ++i) { x[i] *= alpha; } } } void scal_vector(int n, std::complex alpha, std::complex *x) { if (alpha != std::complex(1.0)) { for (int i = 0; i < n; ++i) { x[i] *= alpha; } } } #endif #if defined(HAVE_BLAS) void scal_vector(int n, double alpha, double *x, int incx) { blas::dscal_(&n, &alpha, x, &incx); } void scal_vector(int n, std::complex alpha, std::complex *x, int incx) { blas::zscal_(&n, &alpha, x, &incx); } #else void scal_vector(int n, double alpha, double *x, int incx) { if (alpha != 1.0) { for (int i = 0; i < n; ++i) { x[i*incx] *= alpha; } } } void scal_vector(int n, std::complex alpha, std::complex *x, int incx) { if (alpha != std::complex(1.0)) { for (int i = 0; i < n; ++i) { x[i*incx] *= alpha; } } } #endif #if defined(HAVE_BLAS) void axpy_vector(int n, double alpha, const double *x, double *y) { int incr = 1; blas::daxpy_(&n, &alpha, x, &incr, y, &incr); } void axpy_vector(int n, std::complex alpha, const std::complex *x, std::complex *y) { int incr = 1; blas::zaxpy_(&n, &alpha, x, &incr, y, &incr); } #else void axpy_vector(int n, double alpha, const double *x, double *y) { if (alpha != 1.0) { for (int i = 0; i < n; ++i) { y[i] += alpha * x[i]; } } else { for (int i = 0; i < n; ++i) { y[i] += x[i]; } } } void axpy_vector(int n, std::complex alpha, const std::complex *x, std::complex *y) { if (alpha != std::complex(1.0)) { for (int i = 0; i < n; ++i) { y[i] += alpha * x[i]; } } else { for (int i = 0; i < n; ++i) { y[i] += x[i]; } } } #endif #if defined(HAVE_BLAS) void axpy_vector(int n, double alpha, const double *x, int incx, double *y, int incy) { blas::daxpy_(&n, &alpha, x, &incx, y, &incy); } void axpy_vector(int n, std::complex alpha, const std::complex *x, int incx, std::complex *y, int incy) { blas::zaxpy_(&n, &alpha, x, &incx, y, &incy); } #else void axpy_vector(int n, double alpha, const double *x, int incx, double *y, int incy) { if (alpha != 1.0) { for (int i = 0; i < n; ++i) { y[i*incy] += alpha * x[i*incx]; } } else { for (int i = 0; i < n; ++i) { y[i*incy] += x[i*incx]; } } } void axpy_vector(int n, std::complex alpha, const std::complex *x, int incx, std::complex *y, int incy) { if (alpha != std::complex(1.0)) { for (int i = 0; i < n; ++i) { y[i*incy] += alpha * x[i*incx]; } } else { for (int i = 0; i < n; ++i) { y[i*incy] += x[i*incx]; } } } #endif } // namespace itpp itpp-4.3.1/itpp/base/copy_vector.h000066400000000000000000000144431216575753400171130ustar00rootroot00000000000000/*! * \file * \brief Vector copy functions for internal use * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef COPY_VECTOR_H #define COPY_VECTOR_H #include #include #include #include //! \cond namespace itpp { /* Copy vector x to vector y. Both vectors are of size n */ inline void copy_vector(int n, const int *x, int *y) { memcpy(y, x, n * sizeof(int)); } inline void copy_vector(int n, const short *x, short *y) { memcpy(y, x, n * sizeof(short)); } inline void copy_vector(int n, const bin *x, bin *y) { memcpy(y, x, n * sizeof(bin)); } ITPP_EXPORT void copy_vector(int n, const double *x, double *y); ITPP_EXPORT void copy_vector(int n, const std::complex *x, std::complex *y); template inline void copy_vector(int n, const T *x, T *y) { for (int i = 0; i < n; i++) y[i] = x[i]; } /* Copy vector x to vector y. Both vectors are of size n vector x elements are stored linearly with element increament incx vector y elements are stored linearly with element increament incx */ ITPP_EXPORT void copy_vector(int n, const double *x, int incx, double *y, int incy); ITPP_EXPORT void copy_vector(int n, const std::complex *x, int incx, std::complex *y, int incy); template inline void copy_vector(int n, const T *x, int incx, T *y, int incy) { for (int i = 0; i < n; i++) y[i*incy] = x[i*incx]; } /* Swap vector x and vector y. Both vectors are of size n */ inline void swap_vector(int n, int *x, int *y) { for (int i = 0; i < n; i++) std::swap(x[i], y[i]); } inline void swap_vector(int n, short *x, short *y) { for (int i = 0; i < n; i++) std::swap(x[i], y[i]); } inline void swap_vector(int n, bin *x, bin *y) { for (int i = 0; i < n; i++) std::swap(x[i], y[i]); } ITPP_EXPORT void swap_vector(int n, double *x, double *y); ITPP_EXPORT void swap_vector(int n, std::complex *x, std::complex *y); template inline void swap_vector(int n, T *x, T *y) { T tmp; for (int i = 0; i < n; i++) { tmp = y[i]; y[i] = x[i]; x[i] = tmp; } } /* Swap vector x and vector y. Both vectors are of size n vector x elements are stored linearly with element increament incx vector y elements are stored linearly with element increament incx */ inline void swap_vector(int n, int *x, int incx, int *y, int incy) { for (int i = 0; i < n; i++) std::swap(x[i*incx], y[i*incy]); } inline void swap_vector(int n, short *x, int incx, short *y, int incy) { for (int i = 0; i < n; i++) std::swap(x[i*incx], y[i*incy]); } inline void swap_vector(int n, bin *x, int incx, bin *y, int incy) { for (int i = 0; i < n; i++) std::swap(x[i*incx], y[i*incy]); } ITPP_EXPORT void swap_vector(int n, double *x, int incx, double *y, int incy); ITPP_EXPORT void swap_vector(int n, std::complex *x, int incx, std::complex *y, int incy); template inline void swap_vector(int n, T *x, int incx, T *y, int incy) { T tmp; for (int i = 0; i < n; i++) { tmp = y[i*incy]; y[i*incy] = x[i*incx]; x[i*incx] = tmp; } } /* * Realise scaling operation: x = alpha*x */ ITPP_EXPORT void scal_vector(int n, double alpha, double *x); ITPP_EXPORT void scal_vector(int n, std::complex alpha, std::complex *x); template inline void scal_vector(int n, T alpha, T *x) { if (alpha != T(1)) { for (int i = 0; i < n; ++i) { x[i] *= alpha; } } } /* * Realise scaling operation: x = alpha*x * Elements of x are stored linearly with increament incx */ ITPP_EXPORT void scal_vector(int n, double alpha, double *x, int incx); ITPP_EXPORT void scal_vector(int n, std::complex alpha, std::complex *x, int incx); template inline void scal_vector(int n, T alpha, T *x, int incx) { if (alpha != T(1)) { for (int i = 0; i < n; ++i) { x[i*incx] *= alpha; } } } /* * Realise the following equation on vectors: y = alpha*x + y */ ITPP_EXPORT void axpy_vector(int n, double alpha, const double *x, double *y); ITPP_EXPORT void axpy_vector(int n, std::complex alpha, const std::complex *x, std::complex *y); template inline void axpy_vector(int n, T alpha, const T *x, T *y) { if (alpha != T(1)) { for (int i = 0; i < n; ++i) { y[i] += alpha * x[i]; } } else { for (int i = 0; i < n; ++i) { y[i] += x[i]; } } } /* * Realise the following equation on vectors: y = alpha*x + y * Elements of x are stored linearly with increment incx * and elements of y are stored linearly with increment incx */ ITPP_EXPORT void axpy_vector(int n, double alpha, const double *x, int incx, double *y, int incy); ITPP_EXPORT void axpy_vector(int n, std::complex alpha, const std::complex *x, int incx, std::complex *y, int incy); template inline void axpy_vector(int n, T alpha, const T *x, int incx, T *y, int incy) { if (alpha != T(1)) { for (int i = 0; i < n; ++i) { y[i*incy] += alpha * x[i*incx]; } } else { for (int i = 0; i < n; ++i) { y[i*incy] += x[i*incx]; } } } } // namespace itpp //! \endcond #endif // #ifndef COPY_VECTOR_H itpp-4.3.1/itpp/base/factory.h000066400000000000000000000214631216575753400162260ustar00rootroot00000000000000/*! * \file * \brief Base class for class factories and memory allocation functions * \author Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FACTORY_H #define FACTORY_H #include #include #include namespace itpp { // Forward declarations template class Array; template class Mat; template class Vec; /*! \brief Base class for class factories A class factory (or virtual constructor) is a class that can create instances of another class. Factory is a base class for such factories. When declaring an Array, Vec or Mat, a factory can be passed as an (optional) constructor argument: \code // Declare a Vec with size=10 and factory=DEFAULT_FACTORY Vec a(10); // Declare a Vec with size=10 and factory=f Factory f; Vec b(10, f); \endcode By default, the factory (\c DEFAULT_FACTORY and \c f in the above examples) is not used at all! However, by overloading a help function called \e create_elements we can force Array/Vec/Mat to use the factory for element creation (instead of using the default constructor for the element type). \note It is the \e numeric elements that will be created by the factory, i.e. for an Array >, the factory will be used for creating the Mat elements rather than the Array elements. Here is an example that (partly) defines a user-defined numeric type My_Type, a corresponding factory My_Factory and a corresponding help function create_elements that will be used by Array, Vec and Mat for element creation. \code class My_Type { public: // Default constructor My_Type() : data(0) {} // Constructor My_Type(int d) : data(d) {} . . . protected: int data; }; class My_Factory : public Factory { public: // Constructor explicit My_Factory(int d) : init_data(d) {} // Destructor virtual ~My_Factory() {} // Create an n-length array of My_Type virtual void create(My_Type* &ptr, int n) const {ptr = new My_Type[n](init_data);} protected: int init_data; }; // Create an n-length array of My_Type using My_Factory f template<> void create_elements(My_Type* &ptr, int n, const Factory &f) { if (const My_Factory *my_factory_ptr = dynamic_cast(&f)) { // Yes, f seems to be a My_Factory. Now call the My_Factory::create method my_factory_ptr->create(ptr, n); } else { // No, f does not seem to be a My_Factory. As a fallback solution, // assume that f is DEFAULT_FACTORY and use the default constructor ptr = new My_Type[n]; } } \endcode Now, \code // Declare a My_Factory for init_data = 123 My_Factory my123_factory(123); // Declare a Vec with size 10 that uses My_Type() for element creation Vec v1(10); // Declare a Vec with size 10 that uses My_Type(123) for element creation Vec v1(10, my123_factory); \endcode For a more interesting example, see Fix_Factory. */ class ITPP_EXPORT Factory { public: //! Default constructor Factory() {} //! Destructor virtual ~Factory() {} }; //! Default (dummy) factory const Factory DEFAULT_FACTORY; //! Create an n-length array of T to be used as Array, Vec or Mat elements template inline void create_elements(T* &ptr, int n, const Factory &) { void *p = operator new(sizeof(T) * n); ptr = reinterpret_cast(p); for (int i = 0; i < n; i++) { new(ptr + i) T(); } } //! Specialization for unsigned char data arrays (used in GF2Mat) template<> inline void create_elements(unsigned char* &ptr, int n, const Factory &) { void *p = operator new(sizeof(unsigned char) * n); ptr = reinterpret_cast(p); } //! Specialization for binary data arrays template<> inline void create_elements(bin* &ptr, int n, const Factory &) { void *p = operator new(sizeof(bin) * n); ptr = reinterpret_cast(p); } //! Specialization for short integer data arrays template<> inline void create_elements(short int* &ptr, int n, const Factory &) { void *p = operator new(sizeof(short int) * n); ptr = reinterpret_cast(p); } //! Specialization for integer data arrays template<> inline void create_elements(int* &ptr, int n, const Factory &) { void *p = operator new(sizeof(int) * n); ptr = reinterpret_cast(p); } //! Specialization for 16-byte aligned double data arrays template<> inline void create_elements(double* &ptr, int n, const Factory &) { void *p0 = operator new(sizeof(double) * n + 16); void *p1 = reinterpret_cast((reinterpret_cast(p0) + 16) & (~(std::size_t(15)))); *(reinterpret_cast(p1) - 1) = p0; ptr = reinterpret_cast(p1); } //! Specialization for 16-byte aligned complex double data arrays template<> inline void create_elements >(std::complex* &ptr, int n, const Factory &) { void *p0 = operator new(sizeof(std::complex) * n + 16); void *p1 = reinterpret_cast((reinterpret_cast(p0) + 16) & (~(std::size_t(15)))); *(reinterpret_cast(p1) - 1) = p0; ptr = reinterpret_cast*>(p1); } //! Destroy an array of Array, Vec or Mat elements template inline void destroy_elements(T* &ptr, int n) { if (ptr) { for (int i = 0; i < n; ++i) { ptr[i].~T(); } void *p = reinterpret_cast(ptr); operator delete(p); ptr = 0; } } //! Specialization for unsigned char data arrays (used in GF2Mat) template<> inline void destroy_elements(unsigned char* &ptr, int) { if (ptr) { void *p = reinterpret_cast(ptr); operator delete(p); ptr = 0; } } //! Specialization for binary data arrays template<> inline void destroy_elements(bin* &ptr, int) { if (ptr) { void *p = reinterpret_cast(ptr); operator delete(p); ptr = 0; } } //! Specialization for short integer data arrays template<> inline void destroy_elements(short int* &ptr, int) { if (ptr) { void *p = reinterpret_cast(ptr); operator delete(p); ptr = 0; } } //! Specialization for integer data arrays template<> inline void destroy_elements(int* &ptr, int) { if (ptr) { void *p = reinterpret_cast(ptr); operator delete(p); ptr = 0; } } //! Specialisation for 16-byte aligned double data arrays template<> inline void destroy_elements(double* &ptr, int) { if (ptr) { void *p = *(reinterpret_cast(ptr) - 1); operator delete(p); ptr = 0; } } //! Specialisation for 16-byte aligned complex double data arrays template<> inline void destroy_elements >(std::complex* &ptr, int) { if (ptr) { void *p = *(reinterpret_cast(ptr) - 1); operator delete(p); ptr = 0; } } //! Create an n-length array of Array to be used as Array elements template void create_elements(Array* &ptr, int n, const Factory &f) { void *p = operator new(sizeof(Array) * n); ptr = reinterpret_cast*>(p); for (int i = 0; i < n; ++i) { new(ptr + i) Array(f); } } //! Create an n-length array of Mat to be used as Array elements template void create_elements(Mat* &ptr, int n, const Factory &f) { void *p = operator new(sizeof(Mat) * n); ptr = reinterpret_cast*>(p); for (int i = 0; i < n; ++i) { new(ptr + i) Mat(f); } } //! Create an n-length array of Vec to be used as Array elements template void create_elements(Vec* &ptr, int n, const Factory &f) { void *p = operator new(sizeof(Vec) * n); ptr = reinterpret_cast*>(p); for (int i = 0; i < n; ++i) { new(ptr + i) Vec(f); } } } // namespace itpp #endif // #ifndef FACTORY_H itpp-4.3.1/itpp/base/fastmath.cpp000066400000000000000000000044041216575753400167150ustar00rootroot00000000000000/*! * \file * \brief Implementation of special operations on vectors and matricies * optimized for speed * \author Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // m=m-v*v'*m void sub_v_vT_m(mat &m, const vec &v) { vec v2(m.cols()); double tmp, *v2p; const double *vp; int i, j; it_assert(v.size() == m.rows(), "sub_v_vT_m()"); v2p = v2._data(); for (j = 0; j < m.cols(); j++) { tmp = 0.0; vp = v._data(); for (i = 0; i < m.rows(); i++) tmp += *(vp++) * m._elem(i, j); *(v2p++) = tmp; } vp = v._data(); for (i = 0; i < m.rows(); i++) { v2p = v2._data(); for (j = 0; j < m.cols(); j++) m._elem(i, j) -= *vp * *(v2p++); vp++; } } // m=m-m*v*v' void sub_m_v_vT(mat &m, const vec &v) { vec v2(m.rows()); double tmp, *v2p; const double *vp; int i, j; it_assert(v.size() == m.cols(), "sub_m_v_vT()"); v2p = v2._data(); for (i = 0; i < m.rows(); i++) { tmp = 0.0; vp = v._data(); for (j = 0; j < m.cols(); j++) tmp += *(vp++) * m._elem(i, j); *(v2p++) = tmp; } v2p = v2._data(); for (i = 0; i < m.rows(); i++) { vp = v._data(); for (j = 0; j < m.cols(); j++) m._elem(i, j) -= *v2p * *(vp++); v2p++; } } } // namespace itpp itpp-4.3.1/itpp/base/fastmath.h000066400000000000000000000030461216575753400163630ustar00rootroot00000000000000/*! * \file * \brief Definitions of special operations on vectors and matricies optimized * for speed * \author Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FASTMATH_H #define FASTMATH_H #include #include #include namespace itpp { /*! \relatesalso Mat \brief Calculates m=m-v*v'*m */ ITPP_EXPORT void sub_v_vT_m(mat &m, const vec &v); /*! \relatesalso Mat \brief Calculates m=m-m*v*v' */ ITPP_EXPORT void sub_m_v_vT(mat &m, const vec &v); } // namespace itpp #endif // #ifndef FASTMATH_H itpp-4.3.1/itpp/base/gf2mat.cpp000066400000000000000000000644261216575753400163000ustar00rootroot00000000000000/*! * \file * \brief Implementation of a class for algebra on GF(2) (binary) matrices * \author Erik G. Larsson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include namespace itpp { // ====== IMPLEMENTATION OF THE ALIST CLASS ========== GF2mat_sparse_alist::GF2mat_sparse_alist(const std::string &fname) : data_ok(false) { read(fname); } void GF2mat_sparse_alist::read(const std::string &fname) { std::ifstream file; std::string line; std::stringstream ss; file.open(fname.c_str()); it_assert(file.is_open(), "GF2mat_sparse_alist::read(): Could not open file \"" << fname << "\" for reading"); // parse N and M: getline(file, line); ss << line; ss >> N >> M; it_assert(!ss.fail(), "GF2mat_sparse_alist::read(): Wrong alist data (N or M)"); it_assert((N > 0) && (M > 0), "GF2mat_sparse_alist::read(): Wrong alist data"); ss.seekg(0, std::ios::end); ss.clear(); // parse max_num_n and max_num_m getline(file, line); ss << line; ss >> max_num_n >> max_num_m; it_assert(!ss.fail(), "GF2mat_sparse_alist::read(): Wrong alist data (max_num_{n,m})"); it_assert((max_num_n >= 0) && (max_num_n <= N) && (max_num_m >= 0) && (max_num_m <= M), "GF2mat_sparse_alist::read(): Wrong alist data"); ss.seekg(0, std::ios::end); ss.clear(); // parse weight of each column n num_nlist.set_size(N); num_nlist.clear(); getline(file, line); ss << line; for (int i = 0; i < N; i++) { ss >> num_nlist(i); it_assert(!ss.fail(), "GF2mat_sparse_alist::read(): Wrong alist data (num_nlist(" << i << "))"); it_assert((num_nlist(i) >= 0) && (num_nlist(i) <= M), "GF2mat_sparse_alist::read(): Wrong alist data (num_nlist(" << i << "))"); } ss.seekg(0, std::ios::end); ss.clear(); // parse weight of each row m num_mlist.set_size(M); num_mlist.clear(); getline(file, line); ss << line; for (int i = 0; i < M; i++) { ss >> num_mlist(i); it_assert(!ss.fail(), "GF2mat_sparse_alist::read(): Wrong alist data (num_mlist(" << i << "))"); it_assert((num_mlist(i) >= 0) && (num_mlist(i) <= N), "GF2mat_sparse_alist::read(): Wrong alist data (num_mlist(" << i << "))"); } ss.seekg(0, std::ios::end); ss.clear(); // parse coordinates in the n direction with non-zero entries nlist.set_size(N, max_num_n); nlist.clear(); for (int i = 0; i < N; i++) { getline(file, line); ss << line; for (int j = 0; j < num_nlist(i); j++) { ss >> nlist(i, j); it_assert(!ss.fail(), "GF2mat_sparse_alist::read(): Wrong alist data (nlist(" << i << "," << j << "))"); it_assert((nlist(i, j) > 0) && (nlist(i, j) <= M), "GF2mat_sparse_alist::read(): Wrong alist data (nlist(" << i << "," << j << "))"); } ss.seekg(0, std::ios::end); ss.clear(); } // parse coordinates in the m direction with non-zero entries mlist.set_size(M, max_num_m); mlist.clear(); for (int i = 0; i < M; i++) { getline(file, line); ss << line; for (int j = 0; j < num_mlist(i); j++) { ss >> mlist(i, j); it_assert(!ss.fail(), "GF2mat_sparse_alist::read(): Wrong alist data (mlist(" << i << "," << j << "))"); it_assert((mlist(i, j) > 0) && (mlist(i, j) <= N), "GF2mat_sparse_alist::read(): Wrong alist data (mlist(" << i << "," << j << "))"); } ss.seekg(0, std::ios::end); ss.clear(); } file.close(); data_ok = true; } void GF2mat_sparse_alist::write(const std::string &fname) const { it_assert(data_ok, "GF2mat_sparse_alist::write(): alist data not ready for writing"); std::ofstream file(fname.c_str(), std::ofstream::out); it_assert(file.is_open(), "GF2mat_sparse_alist::write(): Could not open file \"" << fname << "\" for writing"); file << N << " " << M << std::endl; file << max_num_n << " " << max_num_m << std::endl; for (int i = 0; i < num_nlist.length() - 1; i++) file << num_nlist(i) << " "; file << num_nlist(num_nlist.length() - 1) << std::endl; for (int i = 0; i < num_mlist.length() - 1; i++) file << num_mlist(i) << " "; file << num_mlist(num_mlist.length() - 1) << std::endl; for (int i = 0; i < N; i++) { for (int j = 0; j < num_nlist(i) - 1; j++) file << nlist(i, j) << " "; file << nlist(i, num_nlist(i) - 1) << std::endl; } for (int i = 0; i < M; i++) { for (int j = 0; j < num_mlist(i) - 1; j++) file << mlist(i, j) << " "; file << mlist(i, num_mlist(i) - 1) << std::endl; } file.close(); } GF2mat_sparse GF2mat_sparse_alist::to_sparse(bool transpose) const { GF2mat_sparse sbmat(M, N, max_num_m); for (int i = 0; i < M; i++) { for (int j = 0; j < num_mlist(i); j++) { sbmat.set_new(i, mlist(i, j) - 1, bin(1)); } } sbmat.compact(); if (transpose) { return sbmat.transpose(); } else { return sbmat; } } // ---------------------------------------------------------------------- // WARNING: This method is very slow. Sparse_Mat has to be extended with // some extra functions to improve the performance of this. // ---------------------------------------------------------------------- void GF2mat_sparse_alist::from_sparse(const GF2mat_sparse &sbmat, bool transpose) { if (transpose) { from_sparse(sbmat.transpose(), false); } else { // check matrix dimension M = sbmat.rows(); N = sbmat.cols(); num_mlist.set_size(M); num_nlist.set_size(N); // fill mlist matrix, num_mlist vector and max_num_m mlist.set_size(0, 0); int tmp_cols = 0; // initial number of allocated columns for (int i = 0; i < M; i++) { ivec temp_row(0); for (int j = 0; j < N; j++) { if (sbmat(i, j) == bin(1)) { temp_row = concat(temp_row, j + 1); } } int trs = temp_row.size(); if (trs > tmp_cols) { tmp_cols = trs; mlist.set_size(M, tmp_cols, true); } else if (trs < tmp_cols) { temp_row.set_size(tmp_cols, true); } mlist.set_row(i, temp_row); num_mlist(i) = trs; } max_num_m = max(num_mlist); // fill nlist matrix, num_nlist vector and max_num_n nlist.set_size(0, 0); tmp_cols = 0; // initial number of allocated columns for (int j = 0; j < N; j++) { ivec temp_row = sbmat.get_col(j).get_nz_indices() + 1; int trs = temp_row.size(); if (trs > tmp_cols) { tmp_cols = trs; nlist.set_size(N, tmp_cols, true); } else if (trs < tmp_cols) { temp_row.set_size(tmp_cols, true); } nlist.set_row(j, temp_row); num_nlist(j) = trs; } max_num_n = max(num_nlist); data_ok = true; } } // ---------------------------------------------------------------------- // Implementation of a dense GF2 matrix class // ---------------------------------------------------------------------- GF2mat::GF2mat(int i, int j): nrows(i), ncols(j), nwords((j >> shift_divisor) + 1) { data.set_size(nrows, nwords); data.clear(); } GF2mat::GF2mat(): nrows(1), ncols(1), nwords(1) { data.set_size(nrows, nwords); data.clear(); } GF2mat::GF2mat(const bvec &x, bool is_column) { if (is_column) { // create column vector nrows = length(x); ncols = 1; nwords = 1; data.set_size(nrows, nwords); data.clear(); for (int i = 0; i < nrows; i++) { set(i, 0, x(i)); } } else { // create row vector nrows = 1; ncols = length(x); nwords = (ncols >> shift_divisor) + 1; data.set_size(nrows, nwords); data.clear(); for (int i = 0; i < ncols; i++) { set(0, i, x(i)); } } } GF2mat::GF2mat(const bmat &X): nrows(X.rows()), ncols(X.cols()) { nwords = (ncols >> shift_divisor) + 1; data.set_size(nrows, nwords); data.clear(); for (int i = 0; i < nrows; i++) { for (int j = 0; j < ncols; j++) { set(i, j, X(i, j)); } } } GF2mat::GF2mat(const GF2mat_sparse &X) { nrows = X.rows(); ncols = X.cols(); nwords = (ncols >> shift_divisor) + 1; data.set_size(nrows, nwords); for (int i = 0; i < nrows; i++) { for (int j = 0; j < nwords; j++) { data(i, j) = 0; } } for (int j = 0; j < ncols; j++) { for (int i = 0; i < X.get_col(j).nnz(); i++) { bin b = X.get_col(j).get_nz_data(i); set(X.get_col(j).get_nz_index(i), j, b); } } } GF2mat::GF2mat(const GF2mat_sparse &X, int m1, int n1, int m2, int n2) { it_assert(X.rows() > m2, "GF2mat(): indexes out of range"); it_assert(X.cols() > n2, "GF2mat(): indexes out of range"); it_assert(m1 >= 0 && n1 >= 0 && m2 >= m1 && n2 >= n1, "GF2mat::GF2mat(): indexes out of range"); nrows = m2 - m1 + 1; ncols = n2 - n1 + 1; nwords = (ncols >> shift_divisor) + 1; data.set_size(nrows, nwords); for (int i = 0; i < nrows; i++) { for (int j = 0; j < nwords; j++) { data(i, j) = 0; } } for (int i = 0; i < nrows; i++) { for (int j = 0; j < ncols; j++) { bin b = X(i + m1, j + n1); set(i, j, b); } } } GF2mat::GF2mat(const GF2mat_sparse &X, const ivec &columns) { it_assert(X.cols() > max(columns), "GF2mat::GF2mat(): index out of range"); it_assert(min(columns) >= 0, "GF2mat::GF2mat(): column index must be positive"); nrows = X.rows(); ncols = length(columns); nwords = (ncols >> shift_divisor) + 1; data.set_size(nrows, nwords); for (int i = 0; i < nrows; i++) { for (int j = 0; j < nwords; j++) { data(i, j) = 0; } } for (int j = 0; j < ncols; j++) { for (int i = 0; i < X.get_col(columns(j)).nnz(); i++) { bin b = X.get_col(columns(j)).get_nz_data(i); set(X.get_col(columns(j)).get_nz_index(i), j, b); } } } void GF2mat::set_size(int m, int n, bool copy) { nrows = m; ncols = n; nwords = (ncols >> shift_divisor) + 1; data.set_size(nrows, nwords, copy); if (!copy) data.clear(); } GF2mat_sparse GF2mat::sparsify() const { GF2mat_sparse Z(nrows, ncols); for (int i = 0; i < nrows; i++) { for (int j = 0; j < ncols; j++) { if (get(i, j) == 1) { Z.set(i, j, 1); } } } return Z; } bvec GF2mat::bvecify() const { it_assert(nrows == 1 || ncols == 1, "GF2mat::bvecify() matrix must be a vector"); int n = (nrows == 1 ? ncols : nrows); bvec result(n); if (nrows == 1) { for (int i = 0; i < n; i++) { result(i) = get(0, i); } } else { for (int i = 0; i < n; i++) { result(i) = get(i, 0); } } return result; } void GF2mat::set_row(int i, bvec x) { it_assert(length(x) == ncols, "GF2mat::set_row(): dimension mismatch"); for (int j = 0; j < ncols; j++) { set(i, j, x(j)); } } void GF2mat::set_col(int j, bvec x) { it_assert(length(x) == nrows, "GF2mat::set_col(): dimension mismatch"); for (int i = 0; i < nrows; i++) { set(i, j, x(i)); } } GF2mat gf2dense_eye(int m) { GF2mat Z(m, m); for (int i = 0; i < m; i++) { Z.set(i, i, 1); } return Z; } GF2mat GF2mat::get_submatrix(int m1, int n1, int m2, int n2) const { it_assert(m1 >= 0 && n1 >= 0 && m2 >= m1 && n2 >= n1 && m2 < nrows && n2 < ncols, "GF2mat::get_submatrix() index out of range"); GF2mat result(m2 - m1 + 1, n2 - n1 + 1); for (int i = m1; i <= m2; i++) { for (int j = n1; j <= n2; j++) { result.set(i - m1, j - n1, get(i, j)); } } return result; } GF2mat GF2mat::concatenate_vertical(const GF2mat &X) const { it_assert(X.ncols == ncols, "GF2mat::concatenate_vertical(): dimension mismatch"); it_assert(X.nwords == nwords, "GF2mat::concatenate_vertical(): dimension mismatch"); GF2mat result(nrows + X.nrows, ncols); for (int i = 0; i < nrows; i++) { for (int j = 0; j < nwords; j++) { result.data(i, j) = data(i, j); } } for (int i = 0; i < X.nrows; i++) { for (int j = 0; j < nwords; j++) { result.data(i + nrows, j) = X.data(i, j); } } return result; } GF2mat GF2mat::concatenate_horizontal(const GF2mat &X) const { it_assert(X.nrows == nrows, "GF2mat::concatenate_horizontal(): dimension mismatch"); GF2mat result(nrows, X.ncols + ncols); for (int i = 0; i < nrows; i++) { for (int j = 0; j < ncols; j++) { result.set(i, j, get(i, j)); } } for (int i = 0; i < nrows; i++) { for (int j = 0; j < X.ncols; j++) { result.set(i, j + ncols, X.get(i, j)); } } return result; } bvec GF2mat::get_row(int i) const { bvec result(ncols); for (int j = 0; j < ncols; j++) { result(j) = get(i, j); } return result; } bvec GF2mat::get_col(int j) const { bvec result(nrows); for (int i = 0; i < nrows; i++) { result(i) = get(i, j); } return result; } int GF2mat::T_fact(GF2mat &T, GF2mat &U, ivec &perm) const { T = gf2dense_eye(nrows); U = *this; perm = zeros_i(ncols); for (int i = 0; i < ncols; i++) { perm(i) = i; } if (nrows > 250) { // avoid cluttering output ... it_info_debug("Performing T-factorization of GF(2) matrix... rows: " << nrows << " cols: " << ncols << " .... " << std::endl); } int pdone = 0; for (int j = 0; j < nrows; j++) { // Now working on diagonal element j,j // First try find a row with a 1 in column i int i1, j1; for (i1 = j; i1 < nrows; i1++) { for (j1 = j; j1 < ncols; j1++) { if (U.get(i1, j1) == 1) { goto found; } } } return j; found: U.swap_rows(i1, j); T.swap_rows(i1, j); U.swap_cols(j1, j); int temp = perm(j); perm(j) = perm(j1); perm(j1) = temp; // now subtract row i from remaining rows for (int i1 = j + 1; i1 < nrows; i1++) { if (U.get(i1, j) == 1) { int ptemp = floor_i(100.0 * (i1 + j * nrows) / (nrows * nrows)); if (nrows > 250 && ptemp > pdone + 10) { it_info_debug(ptemp << "% done."); pdone = ptemp; } U.add_rows(i1, j); T.add_rows(i1, j); } } } return nrows; } int GF2mat::T_fact_update_bitflip(GF2mat &T, GF2mat &U, ivec &perm, int rank, int r, int c) const { // First, update U (before re-triangulization) int c0 = c; for (c = 0; c < ncols; c++) { if (perm(c) == c0) { goto foundidx; } } it_error("GF2mat::T_fact_update_bitflip() - internal error"); foundidx: for (int i = 0; i < nrows; i++) { if (T.get(i, r) == 1) { U.addto_element(i, c, 1); } } // first move column c to the end bvec lastcol = U.get_col(c); int temp_perm = perm(c); for (int j = c; j < ncols - 1; j++) { U.set_col(j, U.get_col(j + 1)); perm(j) = perm(j + 1); } U.set_col(ncols - 1, lastcol); perm(ncols - 1) = temp_perm; // then, if the matrix is tall, also move row c to the end if (nrows >= ncols) { bvec lastrow_U = U.get_row(c); bvec lastrow_T = T.get_row(c); for (int i = c; i < nrows - 1; i++) { U.set_row(i, U.get_row(i + 1)); T.set_row(i, T.get_row(i + 1)); } U.set_row(nrows - 1, lastrow_U); T.set_row(nrows - 1, lastrow_T); // Do Gaussian elimination on the last row for (int j = c; j < ncols; j++) { if (U.get(nrows - 1, j) == 1) { U.add_rows(nrows - 1, j); T.add_rows(nrows - 1, j); } } } // Now, continue T-factorization from the point (rank-1,rank-1) for (int j = rank - 1; j < nrows; j++) { int i1, j1; for (i1 = j; i1 < nrows; i1++) { for (j1 = j; j1 < ncols; j1++) { if (U.get(i1, j1) == 1) { goto found; } } } return j; found: U.swap_rows(i1, j); T.swap_rows(i1, j); U.swap_cols(j1, j); int temp = perm(j); perm(j) = perm(j1); perm(j1) = temp; for (int i1 = j + 1; i1 < nrows; i1++) { if (U.get(i1, j) == 1) { U.add_rows(i1, j); T.add_rows(i1, j); } } } return nrows; } bool GF2mat::T_fact_update_addcol(GF2mat &T, GF2mat &U, ivec &perm, bvec newcol) const { int i0 = T.rows(); int j0 = U.cols(); it_assert(j0 > 0, "GF2mat::T_fact_update_addcol(): dimension mismatch"); it_assert(i0 == T.cols(), "GF2mat::T_fact_update_addcol(): dimension mismatch"); it_assert(i0 == U.rows(), "GF2mat::T_fact_update_addcol(): dimension mismatch"); it_assert(length(perm) == j0, "GF2mat::T_fact_update_addcol(): dimension mismatch"); it_assert(U.get(j0 - 1, j0 - 1) == 1, "GF2mat::T_fact_update_addcol(): dimension mismatch"); // The following test is VERY TIME-CONSUMING it_assert_debug(U.row_rank() == j0, "GF2mat::T_fact_update_addcol(): factorization has incorrect rank"); bvec z = T * newcol; GF2mat Utemp = U.concatenate_horizontal(GF2mat(z, 1)); // start working on position (j0,j0) int i; for (i = j0; i < i0; i++) { if (Utemp.get(i, j0) == 1) { goto found; } } return (false); // adding the new column would not improve the rank found: perm.set_length(j0 + 1, true); perm(j0) = j0; Utemp.swap_rows(i, j0); T.swap_rows(i, j0); for (int i1 = j0 + 1; i1 < i0; i1++) { if (Utemp.get(i1, j0) == 1) { Utemp.add_rows(i1, j0); T.add_rows(i1, j0); } } U = Utemp; return (true); // the new column was successfully added } GF2mat GF2mat::inverse() const { it_assert(nrows == ncols, "GF2mat::inverse(): Matrix must be square"); // first compute the T-factorization GF2mat T, U; ivec perm; int rank = T_fact(T, U, perm); it_assert(rank == ncols, "GF2mat::inverse(): Matrix is not full rank"); // backward substitution for (int i = ncols - 2; i >= 0; i--) { for (int j = ncols - 1; j > i; j--) { if (U.get(i, j) == 1) { U.add_rows(i, j); T.add_rows(i, j); } } } T.permute_rows(perm, 1); return T; } int GF2mat::row_rank() const { GF2mat T, U; ivec perm; int rank = T_fact(T, U, perm); return rank; } bool GF2mat::is_zero() const { for (int i = 0; i < nrows; i++) { for (int j = 0; j < nwords; j++) { if (data(i, j) != 0) { return false; } } } return true; } bool GF2mat::operator==(const GF2mat &X) const { if (X.nrows != nrows) { return false; } if (X.ncols != ncols) { return false; } it_assert(X.nwords == nwords, "GF2mat::operator==() dimension mismatch"); for (int i = 0; i < nrows; i++) { for (int j = 0; j < nwords; j++) { // if (X.get(i,j)!=get(i,j)) { if (X.data(i, j) != data(i, j)) { return false; } } } return true; } void GF2mat::add_rows(int i, int j) { it_assert(i >= 0 && i < nrows, "GF2mat::add_rows(): out of range"); it_assert(j >= 0 && j < nrows, "GF2mat::add_rows(): out of range"); for (int k = 0; k < nwords; k++) { data(i, k) ^= data(j, k); } } void GF2mat::swap_rows(int i, int j) { it_assert(i >= 0 && i < nrows, "GF2mat::swap_rows(): index out of range"); it_assert(j >= 0 && j < nrows, "GF2mat::swap_rows(): index out of range"); for (int k = 0; k < nwords; k++) { unsigned char temp = data(i, k); data(i, k) = data(j, k); data(j, k) = temp; } } void GF2mat::swap_cols(int i, int j) { it_assert(i >= 0 && i < ncols, "GF2mat::swap_cols(): index out of range"); it_assert(j >= 0 && j < ncols, "GF2mat::swap_cols(): index out of range"); bvec temp = get_col(i); set_col(i, get_col(j)); set_col(j, temp); } void GF2mat::operator=(const GF2mat &X) { nrows = X.nrows; ncols = X.ncols; nwords = X.nwords; data = X.data; } GF2mat operator*(const GF2mat &X, const GF2mat &Y) { it_assert(X.ncols == Y.nrows, "GF2mat::operator*(): dimension mismatch"); it_assert(X.nwords > 0, "Gfmat::operator*(): dimension mismatch"); it_assert(Y.nwords > 0, "Gfmat::operator*(): dimension mismatch"); /* // this can be done more efficiently? GF2mat result(X.nrows,Y.ncols); for (int i=0; i 0, "Gfmat::operator*(): dimension mismatch"); /* // this can be done more efficiently? bvec result = zeros_b(X.nrows); for (int i=0; i>= 1; ind++; } } // do the last column separately for (int j=(X.nwords-1)< 0, "GF2mat::mult_trans(): dimension mismatch"); it_assert(Y.nwords > 0, "GF2mat::mult_trans(): dimension mismatch"); it_assert(X.nwords == Y.nwords, "GF2mat::mult_trans(): dimension mismatch"); GF2mat result(X.nrows, Y.nrows); for (int i = 0; i < X.nrows; i++) { for (int j = 0; j < Y.nrows; j++) { bin b = 0; int kindx = i; int kindy = j; for (int k = 0; k < X.nwords; k++) { unsigned char r = X.data(kindx) & Y.data(kindy); /* The following can be speeded up by using a small lookup table for the number of ones and shift only a few times (or not at all if table is large) */ while (r) { b ^= r & 1; r >>= 1; }; kindx += X.nrows; kindy += Y.nrows; } result.set(i, j, b); } } return result; } GF2mat GF2mat::transpose() const { // CAN BE SPEEDED UP GF2mat result(ncols, nrows); for (int i = 0; i < nrows; i++) { for (int j = 0; j < ncols; j++) { result.set(j, i, get(i, j)); } } return result; } GF2mat operator+(const GF2mat &X, const GF2mat &Y) { it_assert(X.nrows == Y.nrows, "GF2mat::operator+(): dimension mismatch"); it_assert(X.ncols == Y.ncols, "GF2mat::operator+(): dimension mismatch"); it_assert(X.nwords == Y.nwords, "GF2mat::operator+(): dimension mismatch"); GF2mat result(X.nrows, X.ncols); for (int i = 0; i < X.nrows; i++) { for (int j = 0; j < X.nwords; j++) { result.data(i, j) = X.data(i, j) ^ Y.data(i, j); } } return result; } void GF2mat::permute_cols(ivec &perm, bool I) { it_assert(length(perm) == ncols, "GF2mat::permute_cols(): dimensions do not match"); GF2mat temp = (*this); for (int j = 0; j < ncols; j++) { if (I == 0) { set_col(j, temp.get_col(perm(j))); } else { set_col(perm(j), temp.get_col(j)); } } } void GF2mat::permute_rows(ivec &perm, bool I) { it_assert(length(perm) == nrows, "GF2mat::permute_rows(): dimensions do not match"); GF2mat temp = (*this); for (int i = 0; i < nrows; i++) { if (I == 0) { for (int j = 0; j < nwords; j++) { data(i, j) = temp.data(perm(i), j); } } else { for (int j = 0; j < nwords; j++) { data(perm(i), j) = temp.data(i, j); } } } } std::ostream &operator<<(std::ostream &os, const GF2mat &X) { int i, j; os << "---- GF(2) matrix of dimension " << X.nrows << "*" << X.ncols << " -- Density: " << X.density() << " ----" << std::endl; for (i = 0; i < X.nrows; i++) { os << " "; for (j = 0; j < X.ncols; j++) { os << X.get(i, j) << " "; } os << std::endl; } return os; } double GF2mat::density() const { int no_of_ones = 0; for (int i = 0; i < nrows; i++) { for (int j = 0; j < ncols; j++) { no_of_ones += (get(i, j) == 1 ? 1 : 0); } } return ((double) no_of_ones) / (nrows*ncols); } it_file &operator<<(it_file &f, const GF2mat &X) { // 3 64-bit unsigned words for: nrows, ncols and nwords + rest for char data uint64_t bytecount = 3 * sizeof(uint64_t) + X.nrows * X.nwords * sizeof(char); f.write_data_header("GF2mat", bytecount); f.low_level_write(static_cast(X.nrows)); f.low_level_write(static_cast(X.ncols)); f.low_level_write(static_cast(X.nwords)); for (int i = 0; i < X.nrows; i++) { for (int j = 0; j < X.nwords; j++) { f.low_level_write(static_cast(X.data(i, j))); } } return f; } it_ifile &operator>>(it_ifile &f, GF2mat &X) { it_file::data_header h; f.read_data_header(h); if (h.type == "GF2mat") { uint64_t tmp; f.low_level_read(tmp); X.nrows = static_cast(tmp); f.low_level_read(tmp); X.ncols = static_cast(tmp); f.low_level_read(tmp); X.nwords = static_cast(tmp); X.data.set_size(X.nrows, X.nwords); for (int i = 0; i < X.nrows; i++) { for (int j = 0; j < X.nwords; j++) { char r; f.low_level_read(r); X.data(i, j) = static_cast(r); } } } else { it_error("it_ifile &operator>>() - internal error"); } return f; } } // namespace itpp itpp-4.3.1/itpp/base/gf2mat.h000066400000000000000000000414461216575753400157420ustar00rootroot00000000000000/*! * \file * \brief Definition of a class for algebra on GF(2) (binary) matrices * \author Erik G. Larsson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * Two representations are offered: GF2mat_sparse for sparse GF(2) * matrices and GF2mat for dense GF(2) matrices. Conversions between * dense and sparse GF(2) are also possible. * * Binary vectors are represented either via the bvec class (memory * typically is not an issue here) or as n*1 (or 1*n) GF(2) matrix. * * Note that the \c bmat class also provides some functionality for * matrix algebra over GF(2) but this class is based on \c Mat<> which * has a fundamentally different addressing mechanism and which is * much less memory efficient (\c Mat<> uses one byte memory minimum * per element). */ #ifndef GF2MAT_H #define GF2MAT_H #include #include #include #include #include #include namespace itpp { //! \cond #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB)) //MSVC needs to explicitely instantiate required templates while building the //shared library. Also, these definitions are marked as imported when library is //linked with user's code. template class ITPP_EXPORT Sparse_Mat; template class ITPP_EXPORT Sparse_Vec; template class ITPP_EXPORT Mat; #endif //! \endcond // ---------------------------------------------------------------------- // Sparse GF(2) matrix class // ---------------------------------------------------------------------- //! Sparse GF(2) vector typedef Sparse_Vec GF2vec_sparse; //! Sparse GF(2) matrix typedef Sparse_Mat GF2mat_sparse; // ---------------------------------------------------------------------- // Alist parameterization of sparse GF(2) matrix class // ---------------------------------------------------------------------- /*! \relatesalso GF2mat_sparse \brief Parameterized "alist" representation of sparse GF(2) matrix \author Adam Piatyszek and Erik G. Larsson This class is used to provide a parameterized representation of a \c GF2mat_sparse class. The format is compatible with the "alist" format defined by David MacKay, Matthew Davey and John Lafferty: - http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html For examples of "alist" representation visit David MacKay's Encyclopedia of Sparse Graph Codes: - http://www.inference.phy.cam.ac.uk/mackay/codes/data.html */ class ITPP_EXPORT GF2mat_sparse_alist { public: //! Default constructor GF2mat_sparse_alist() : data_ok(false) {} //! Constructor, which reads alist data from a file named \c fname GF2mat_sparse_alist(const std::string &fname); //! Read alist data from a file named \c fname void read(const std::string &fname); //! Write alist data to a file named \c fname void write(const std::string &fname) const; /*! \brief Convert "alist" representation to \c GF2mat_sparse \param transpose Indicates whether a matrix should be transposed during the conversion process */ GF2mat_sparse to_sparse(bool transpose = false) const; /*! \brief Import "alist" representation from \c GF2mat_sparse \param mat Matrix to import \param transpose Indicates whether a matrix should be transposed during the conversion process */ void from_sparse(const GF2mat_sparse &mat, bool transpose = false); protected: //! Flag indicating that "alist" matrix data are properly set bool data_ok; //! Size of the matrix: \c M rows x \c N columns int M; //! Size of the matrix: \c M rows x \c N columns int N; //! List of integer coordinates in the m direction with non-zero entries imat mlist; //! List of integer coordinates in the n direction with non-zero entries imat nlist; //! Weight of each row m ivec num_mlist; //! Weight of each column n ivec num_nlist; //! Maximum weight of rows int max_num_m; //! Maximum weight of columns int max_num_n; }; // ---------------------------------------------------------------------- // Dense GF(2) matrix class // ---------------------------------------------------------------------- /*! \relatesalso bmat \brief Class for dense GF(2) matrices \author Erik G. Larsson This class can be used as an alternative to \c bmat to represent GF(2) matrices. It extends the functionality of \c bmat in two ways: - \c GF2mat makes more efficient use of computer memory than \c bmat (one bit in the matrix requires one bit of memory) - \c GF2mat provides several functions for linear algebra and matrix factorizations See also \c GF2mat_sparse which offers an efficient representation of sparse GF(2) matrices, and \c GF2mat_sparse_alist for a parameterized representation of sparse GF(2) matrices. */ class ITPP_EXPORT GF2mat { public: // ----------- Constructors ----------- //! Default constructor (gives an empty 1 x 1 matrix) GF2mat(); //! Construct an empty (all-zero) m x n matrix GF2mat(int m, int n); //! Construct a dense GF(2) matrix from a sparse GF(2) matrix GF2mat(const GF2mat_sparse &X); /*! \brief Constructor, from subset of sparse GF(2) matrix This constructor forms a dense GF(2) matrix from a subset (m1,n1) to (m2,n2) of a sparse GF(2) matrix */ GF2mat(const GF2mat_sparse &X, int m1, int n1, int m2, int n2); /*! \brief Constructor, from subset of sparse GF(2) matrix This constructor forms a dense GF(2) matrix from a subset of columns in sparse GF(2) matrix \param X matrix to copy from \param columns subset of columns to copy */ GF2mat(const GF2mat_sparse &X, const ivec &columns); /*! \brief Create a dense GF(2) matrix from a single vector. \param x The input vector \param is_column A parameter that indicates whether the result should be a row vector (false), or a column vector (true - default) */ GF2mat(const bvec &x, bool is_column = true); //! Create a dense GF(2) matrix from a bmat GF2mat(const bmat &X); //! Set size of GF(2) matrix. If copy = true, keep data before resizing. void set_size(int m, int n, bool copy = false); //! Create a sparse GF(2) matrix from a dense GF(2) matrix GF2mat_sparse sparsify() const; //! Create a bvec from a GF(2) matrix (must have one column or one row) bvec bvecify() const; // ----------- Elementwise manipulation and simple functions ------------- //! Getting element inline bin get(int i, int j) const; //! Getting element inline bin operator()(int i, int j) const { return get(i, j); }; //! Set element i,j to s (0 or 1) inline void set(int i, int j, bin s); //! Add s (0 or 1) to element (i,j) inline void addto_element(int i, int j, bin s); //! Set column j to a binary vector x void set_col(int j, bvec x); //! Set row i to a binary vector x void set_row(int i, bvec x); //! Check whether the matrix is identical to zero bool is_zero() const; //! Swap rows i and j void swap_rows(int i, int j); //! Swap columns i and j void swap_cols(int i, int j); /*! \brief Multiply from left with permutation matrix (permute rows). \param perm Permutation vector \param I Parameter that determines permutation. I=0: apply permutation, I=1: apply inverse permutation */ void permute_rows(ivec &perm, bool I); /*! \brief Multiply a matrix from right with a permutation matrix (i.e., permute the columns). \param perm Permutation vector \param I Parameter that determines permutation. I=0: apply permutation, I=1: apply inverse permutation */ void permute_cols(ivec &perm, bool I); //! Transpose GF2mat transpose() const; //! Submatrix from (m1,n1) to (m2,n2) GF2mat get_submatrix(int m1, int n1, int m2, int n2) const; //! Concatenate horizontally (append X on the right side of matrix) GF2mat concatenate_horizontal(const GF2mat &X) const; //! Concatenate vertically (append X underneath) GF2mat concatenate_vertical(const GF2mat &X) const; //! Get row bvec get_row(int i) const; //! Get column bvec get_col(int j) const; //! Compute the matrix density (fraction of elements equal to "1") double density() const; //! Get number of rows int rows() const { return nrows; } //! Get number of columns int cols() const { return ncols; } /*! \brief Add (or equivalently, subtract) rows This function updates row i according to row_i = row_i+row_j \param i Row to add to. This row will be modified \param j Row to add. This row will not be modified. */ void add_rows(int i, int j); // ---------- Linear algebra -------------- /*! \brief Inversion. The matrix must be invertible, otherwise the function will terminate with an error. */ GF2mat inverse() const; //! Returns the number of linearly independent rows int row_rank() const; /*! \brief TXP factorization. Given X, compute a factorization of the form U=TXP, where U is upper triangular, T is square and invertible, and P is a permutation matrix. This is basically an "LU"-factorization, but not called so here because T is not necessarily lower triangular. The matrix X may have any dimension. The permutation matrix P is represented as a permutation vector. The function returns the row rank of X. (If X is full row rank, then the number of rows is returned.) The function uses Gaussian elimination combined with permutations. The computational complexity is O(m*m*n) for an m*n matrix. */ int T_fact(GF2mat &T, GF2mat &U, ivec &P) const; /*! \brief TXP factorization update, when bit is flipped. Update upper triangular factor U in the TXP-factorization (U=TXP) when the bit at position (r,c) is changed (0->1 or 1->0). The purpose of this function is to avoid re-running a complete T-factorization when a single bit is changed. The function assumes that T, U, and P already exist and that U=TXP before the function is called. The function also assumes that the rank provided is correct. The function updates T, U and P these matrices. The function returns the new rank of the matrix after the bitflip. \note T, U, P and the rank value supplied to the function must be correct one. This is not checked by the function (for reasons of efficiency). The function works by performing permutations to bring the matrix to a form where the Gaussian eliminated can be restarted from the point (rank-1,rank-1). The function is very fast for matrices with close to full rank but it is generally slower for non-full rank matrices. */ int T_fact_update_bitflip(GF2mat &T, GF2mat &U, ivec &P, int rank, int r, int c) const; /*! \brief TXP factorization update, when column is added Update upper triangular factor U in the T-factorization (U=TXP) when a column (newcol) is appended at the right side of the matrix. The purpose of this function is to avoid re-running a complete T-factorization when a column is added. The function ONLY adds the column if it improves the rank of the matrix (nothing is done otherwise). The function returns "true" if the column was added, and "false" otherwise. \note This function does not actually add the column newcol to the GF2 matrix. It only checks whether doing so would increase the rank, and if this is the case, it updates the T-factorization. A typical calling sequence would be \code bool rank_will_improve = X.T_fact_update_addcol(T,U,perm,c); if (rank_will_improve) { X = X.concatenate_horizontal(c); } \endcode The complexity is O(m^2) for an m*n matrix. */ bool T_fact_update_addcol(GF2mat &T, GF2mat &U, ivec &P, bvec newcol) const; // ----- Operators ----------- //! Assignment operator void operator=(const GF2mat &X); //! Check if equal bool operator==(const GF2mat &X) const; // ----- Friends ------ //! Multiplication operator friend ITPP_EXPORT GF2mat operator*(const GF2mat &X, const GF2mat &Y); //! Multiplication operator with binary vector friend ITPP_EXPORT bvec operator*(const GF2mat &X, const bvec &y); /*! \brief Addition operator Subtraction is not implemented because it is equivalent to addition. */ friend ITPP_EXPORT GF2mat operator+(const GF2mat &X, const GF2mat &Y); //! Output stream operator (plain text) friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const GF2mat &X); //! Write the matrix to file friend ITPP_EXPORT it_file &operator<<(it_file &f, const GF2mat &X); //! Read the matrix from file friend ITPP_EXPORT it_ifile &operator>>(it_ifile &f, GF2mat &X); //!Multiplication X*Y' where X and Y are GF(2) matrices friend ITPP_EXPORT GF2mat mult_trans(const GF2mat &X, const GF2mat &Y); private: int nrows, ncols; // number of rows and columns of matrix int nwords; // number of bytes used Mat data; // data structure // This value is used to perform division by bit shift and is equal to // log2(8) static const unsigned char shift_divisor = 3; // This value is used as a mask when computing the bit position of the // division remainder static const unsigned char rem_mask = (1 << shift_divisor) - 1; }; // ---------------------------------------------------------------------- // GF2mat related functions // ---------------------------------------------------------------------- /*! /relatesalso GF2mat /brief Write GF(2) matrix to file. */ ITPP_EXPORT it_file &operator<<(it_file &f, const GF2mat &X); /*! /relatesalso GF2mat /brief Read GF(2) matrix from file. */ ITPP_EXPORT it_ifile &operator>>(it_ifile &f, GF2mat &X); /*! \relatesalso GF2mat \brief GF(2) matrix multiplication */ ITPP_EXPORT GF2mat operator*(const GF2mat &X, const GF2mat &Y); /*! \relatesalso GF2mat \brief GF(2) matrix multiplication with "regular" binary vector */ ITPP_EXPORT bvec operator*(const GF2mat &X, const bvec &y); /*! \relatesalso GF2mat \brief GF(2) matrix addition */ ITPP_EXPORT GF2mat operator+(const GF2mat &X, const GF2mat &Y); /*! \relatesalso GF2mat \brief Output stream (plain text) operator for dense GF(2) matrices */ ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const GF2mat &X); /*! \relatesalso GF2mat \brief GF(2) Identity matrix */ ITPP_EXPORT GF2mat gf2dense_eye(int m); /*! \relatesalso GF2mat \brief Multiplication X*Y' where X and Y are GF(2) matrices */ ITPP_EXPORT GF2mat mult_trans(const GF2mat &X, const GF2mat &Y); // ---------------------------------------------------------------------- // Inline implementations // ---------------------------------------------------------------------- inline void GF2mat::addto_element(int i, int j, bin s) { it_assert_debug(i >= 0 && i < nrows, "GF2mat::addto_element()"); it_assert_debug(j >= 0 && j < ncols, "GF2mat::addto_element()"); if (s == 1) data(i, (j >> shift_divisor)) ^= (1 << (j & rem_mask)); } inline bin GF2mat::get(int i, int j) const { it_assert_debug(i >= 0 && i < nrows, "GF2mat::get_element()"); it_assert_debug(j >= 0 && j < ncols, "GF2mat::get_element()"); return (data(i, (j >> shift_divisor)) >> (j & rem_mask)) & 1; } inline void GF2mat::set(int i, int j, bin s) { it_assert_debug(i >= 0 && i < nrows, "GF2mat::set_element()"); it_assert_debug(j >= 0 && j < ncols, "GF2mat::set_element()"); if (s == 1) // set bit to one data(i, (j >> shift_divisor)) |= (1 << (j & rem_mask)); else // set bit to zero data(i, (j >> shift_divisor)) &= (~(1 << (j & rem_mask))); } } // namespace itpp #endif // #ifndef GF2MAT_H itpp-4.3.1/itpp/base/help_functions.cpp000066400000000000000000000107351216575753400201320ustar00rootroot00000000000000/*! * \file * \brief Help functions to make functions with vec and mat as arguments * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include //! \cond namespace itpp { template ITPP_EXPORT vec apply_function(double(*f)(double), const vec &v); template ITPP_EXPORT cvec apply_function(std::complex (*f)(const std::complex &), const cvec &v); template ITPP_EXPORT svec apply_function(short(*f)(short), const svec &v); template ITPP_EXPORT ivec apply_function(int (*f)(int), const ivec &v); template ITPP_EXPORT bvec apply_function(bin(*f)(bin), const bvec &v); template ITPP_EXPORT mat apply_function(double(*f)(double), const mat &m); template ITPP_EXPORT cmat apply_function(std::complex (*f)(const std::complex &), const cmat &m); template ITPP_EXPORT smat apply_function(short(*f)(short), const smat &m); template ITPP_EXPORT imat apply_function(int (*f)(int), const imat &m); template ITPP_EXPORT bmat apply_function(bin(*f)(bin), const bmat &m); template ITPP_EXPORT vec apply_function(double(*f)(double, double), const double& x, const vec &v); template ITPP_EXPORT cvec apply_function(std::complex (*f)(const std::complex &, const std::complex &), const std::complex& x, const cvec &v); template ITPP_EXPORT svec apply_function(short(*f)(short, short), const short& x, const svec &v); template ITPP_EXPORT ivec apply_function(int (*f)(int, int), const int& x, const ivec &v); template ITPP_EXPORT bvec apply_function(bin(*f)(bin, bin), const bin& x, const bvec &v); template ITPP_EXPORT mat apply_function(double(*f)(double, double), const double& x, const mat &m); template ITPP_EXPORT cmat apply_function(std::complex (*f)(const std::complex &, const std::complex &), const std::complex& x, const cmat &m); template ITPP_EXPORT smat apply_function(short(*f)(short, short), const short& x, const smat &m); template ITPP_EXPORT imat apply_function(int (*f)(int, int), const int& x, const imat &m); template ITPP_EXPORT bmat apply_function(bin(*f)(bin, bin), const bin& x, const bmat &m); template ITPP_EXPORT vec apply_function(double(*f)(double, double), const vec &v, const double& x); template ITPP_EXPORT cvec apply_function(std::complex (*f)(const std::complex &, const std::complex &), const cvec &v, const std::complex& x); template ITPP_EXPORT svec apply_function(short(*f)(short, short), const svec &v, const short& x); template ITPP_EXPORT ivec apply_function(int (*f)(int, int), const ivec &v, const int& x); template ITPP_EXPORT bvec apply_function(bin(*f)(bin, bin), const bvec &v, const bin& x); template ITPP_EXPORT mat apply_function(double(*f)(double, double), const mat &m, const double& x); template ITPP_EXPORT cmat apply_function(std::complex (*f)(const std::complex &, const std::complex &), const cmat &m, const std::complex& x); template ITPP_EXPORT smat apply_function(short(*f)(short, short), const smat &m, const short& x); template ITPP_EXPORT imat apply_function(int (*f)(int, int), const imat &m, const int& x); template ITPP_EXPORT bmat apply_function(bin(*f)(bin, bin), const bmat &m, const bin& x); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/help_functions.h000066400000000000000000000262611216575753400176000ustar00rootroot00000000000000/*! * \file * \brief Help functions to make functions with vec and mat as arguments * \author Tony Ottosson, Adam Piatyszek, Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef HELP_FUNCTIONS_H #define HELP_FUNCTIONS_H #include #include namespace itpp { //! \cond namespace details { //it would be nice to use binders and functors from header, but //bind1st/bind2nd are broken since they can not be used with functions //getting arguments by reference, so we introduce our own simple functors and //binders here //functor made from unary function Ret Ftn(Arg) template class Unary_Function_Wrapper { typedef Ret(*Ftn)(Arg); Ftn _f; public: explicit Unary_Function_Wrapper(Ftn f): _f(f) {} Ret operator()(Arg v) const { return _f(v);} }; //functor made from binary function Ret Ftn(Arg, Arg) with 1st arg bound template class Binary_Function_With_Bound_1st { typedef Ret(*Ftn)(Arg, Arg); Arg _b; Ftn _f; public: Binary_Function_With_Bound_1st(Ftn f, const Arg b): _f(f), _b(b) {} Ret operator()(Arg v) const { return _f(_b, v);} }; //functor made from binary function Ret Ftn(const Arg&, const Arg&) with 1st arg bound //(partially specialize previous template) template class Binary_Function_With_Bound_1st { typedef Ret(*Ftn)(const Arg&, const Arg&); const Arg& _b; Ftn _f; public: Binary_Function_With_Bound_1st(Ftn f, const Arg& b): _f(f), _b(b) {} Ret operator()(const Arg& v) const { return _f(_b, v);} }; //functor made from binary function Ret Ftn(Arg, Arg) with 2nd arg bound template class Binary_Function_With_Bound_2nd { typedef Ret(*Ftn)(Arg, Arg); Arg _b; Ftn _f; public: Binary_Function_With_Bound_2nd(Ftn f, Arg b): _f(f), _b(b) {} Ret operator()(Arg v) const { return _f(v, _b);} }; //functor made from binary function Ret Ftn(const Arg&, const Arg&) with 2nd arg bound //(partially specialize previous template) template class Binary_Function_With_Bound_2nd { typedef Ret(*Ftn)(const Arg&, const Arg&); const Arg& _b; Ftn _f; public: Binary_Function_With_Bound_2nd(Ftn f, const Arg& b): _f(f), _b(b) {} Ret operator()(const Arg& v) const { return _f(v, _b);} }; } //! \endcond //! \addtogroup miscfunc //!@{ //! Help function to apply function object to Vec template inline Vec apply_functor(Ftn f, const Vec& v) { Vec out(v.length()); for(int i = 0; i < v.length(); i++) { out(i) = f(v(i)); } return out; } //! Help function to call for a function: Vec function(Vec) template inline Vec apply_function(T(*f)(T), const Vec& v) { return apply_functor(details::Unary_Function_Wrapper(f), v); } //! Help function to call for a function: Vec function(const Vec&) template inline Vec apply_function(T(*f)(const T&), const Vec& v) { return apply_functor(details::Unary_Function_Wrapper(f), v); } //! Help function to apply function object to Mat template inline Mat apply_functor(Ftn f, const Mat& m) { Mat out(m.rows(), m.cols()); for(int i = 0; i < m.rows(); i++) { for(int j = 0; j < m.cols(); j++) { out(i, j) = f(m(i, j)); } } return out; } //! Help function to call for a function: Mat function(Mat&) template inline Mat apply_function(T(*f)(T), const Mat& m) { return apply_functor(details::Unary_Function_Wrapper(f), m); } //! Help function to call for a function: Mat function(const Mat&) template inline Mat apply_function(T(*f)(const T&), const Mat& m) { return apply_functor(details::Unary_Function_Wrapper(f), m); } //! Help function to call for a function: Vec function(T, Vec) template inline Vec apply_function(T(*f)(T, T), const T& x, const Vec& v) { return apply_functor(details::Binary_Function_With_Bound_1st(f, x), v); } //! \brief Help function to call for a function: //! Vec function(const T&, const Vec&) template inline Vec apply_function(T(*f)(const T&, const T&), const T& x, const Vec& v) { return apply_functor(details::Binary_Function_With_Bound_1st(f, x), v); } //! Help function to call for a function: Mat function(T, Mat) template inline Mat apply_function(T(*f)(T, T), const T& x, const Mat& m) { return apply_functor(details::Binary_Function_With_Bound_1st(f, x), m); } //! \brief Help function to call for a function: //! Mat function(const T&, const Mat&) template inline Mat apply_function(T(*f)(const T&, const T&), const T& x, const Mat& m) { return apply_functor(details::Binary_Function_With_Bound_1st(f, x), m); } //! Help function to call for a function: Vec function(Vec, T) template inline Vec apply_function(T(*f)(T, T), const Vec& v, const T& x) { return apply_functor(details::Binary_Function_With_Bound_2nd(f, x), v); } //! \brief Help function to call for a function: //! Vec function(const Vec&, const T&) template inline Vec apply_function(T(*f)(const T&, const T&), const Vec& v, const T& x) { return apply_functor(details::Binary_Function_With_Bound_2nd(f, x), v); } //! Help function to call for a function: Mat function(Mat, T) template inline Mat apply_function(T(*f)(T, T), const Mat& m, const T& x) { return apply_functor(details::Binary_Function_With_Bound_2nd(f, x), m); } //! \brief Help function to call for a function: //! Mat function(const Mat&, const T&) template inline Mat apply_function(T(*f)(const T&, const T&), const Mat& m, const T& x) { return apply_functor(details::Binary_Function_With_Bound_2nd(f, x), m); } //!@} //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec apply_function(double(*f)(double), const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec apply_function(std::complex (*f)(const std::complex &), const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec apply_function(short(*f)(short), const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec apply_function(int (*f)(int), const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec apply_function(bin(*f)(bin), const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat apply_function(double(*f)(double), const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat apply_function(std::complex (*f)(const std::complex &), const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat apply_function(short(*f)(short), const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat apply_function(int (*f)(int), const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat apply_function(bin(*f)(bin), const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec apply_function(double(*f)(double, double), const double& x, const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec apply_function(std::complex (*f)(const std::complex &, const std::complex &), const std::complex& x, const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec apply_function(short(*f)(short, short), const short& x, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec apply_function(int (*f)(int, int), const int& x, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec apply_function(bin(*f)(bin, bin), const bin& x, const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat apply_function(double(*f)(double, double), const double& x, const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat apply_function(std::complex (*f)(const std::complex &, const std::complex &), const std::complex& x, const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat apply_function(short(*f)(short, short), const short& x, const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat apply_function(int (*f)(int, int), const int& x, const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat apply_function(bin(*f)(bin, bin), const bin& x, const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec apply_function(double(*f)(double, double), const vec &v, const double& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec apply_function(std::complex (*f)(const std::complex &, const std::complex &), const cvec &v, const std::complex& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec apply_function(short(*f)(short, short), const svec &v, const short& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec apply_function(int (*f)(int, int), const ivec &v, const int& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec apply_function(bin(*f)(bin, bin), const bvec &v, const bin& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat apply_function(double(*f)(double, double), const mat &m, const double& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat apply_function(std::complex (*f)(const std::complex &, const std::complex &), const cmat &m, const std::complex& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat apply_function(short(*f)(short, short), const smat &m, const short& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat apply_function(int (*f)(int, int), const imat &m, const int& x); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat apply_function(bin(*f)(bin, bin), const bmat &m, const bin& x); //! \endcond } // namespace itpp #endif // #ifndef HELP_FUNCTIONS_H itpp-4.3.1/itpp/base/itassert.cpp000066400000000000000000000061261216575753400167470ustar00rootroot00000000000000/*! * \file * \brief Error handling functions - source file * \author Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #include #include #include #include namespace itpp { //! \cond static bool warnings_enabled = true; static bool file_line_info_enabled = true; static std::ostream *warn = &std::cerr; //! \endcond void it_assert_f(std::string ass, std::string msg, std::string file, int line) { std::ostringstream error; if (file_line_info_enabled) { error << "*** Assertion failed in " << file << " on line " << line << ":\n" << msg << " (" << ass << ")\n"; } else { error << msg << " (" << ass << ")\n"; } std::cerr << error.str() << std::flush; #ifdef ITPP_EXCEPTIONS throw std::runtime_error(error.str()); #else abort(); #endif } void it_error_f(std::string msg, std::string file, int line) { std::ostringstream error; if (file_line_info_enabled) { error << "*** Error in " << file << " on line " << line << ":\n" << msg << "\n"; } else { error << msg << "\n"; } std::cerr << error.str() << std::flush; #ifdef ITPP_EXCEPTIONS throw std::runtime_error(error.str()); #else abort(); #endif } void it_info_f(std::string msg) { std::cerr << msg << std::flush; } void it_warning_f(std::string msg, std::string file, int line) { if (warnings_enabled) { if (file_line_info_enabled) { (*warn) << "*** Warning in " << file << " on line " << line << ":\n" << msg << std::endl << std::flush; } else { (*warn) << msg << std::endl << std::flush; } } } void it_enable_warnings() { warnings_enabled = true; } void it_disable_warnings() { warnings_enabled = false; } void it_redirect_warnings(std::ostream *warn_stream) { warn = warn_stream; } void it_error_msg_style(error_msg_style style) { switch (style) { case Full: file_line_info_enabled = true; break; case Minimum: file_line_info_enabled = false; break; default: file_line_info_enabled = true; } } } //namespace itpp itpp-4.3.1/itpp/base/itassert.h000066400000000000000000000135341216575753400164150ustar00rootroot00000000000000/*! * \file * \brief Error handling functions - header file * \author Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITASSERT_H #define ITASSERT_H #include #include #include namespace itpp { /*! \addtogroup errorhandlingfunc For the following macros, the argument \c s is a string that is displayed. \code it_assert(t,s); // Abort if t is not true it_assert_debug(t,s); // Abort if t is not true and NDEBUG is not defined it_error_if(t,s); // Abort if t is true it_error(s); // Abort it_info(s); // Display a message it_info_debug(s); // Display a message if NDEBUG is not defined it_info_no_endl(s); // Display a message without appended "std::endl" it_info_no_endl_debug(s); // Display a message without appended "std::endl" if NDEBUG is not defined it_warning(s); // Display a warning \endcode \c it_assert(), \c it_error(), \c it_error_if(), \c it_info(), \c it_info_no_endl() and \c it_warning() are always active, whereas \c it_assert_debug(), \c it_info_debug() and \c it_info_no_endl_debug() depends on the \c NDEBUG compile time definition. If \c NDEBUG is defined, then none of these macros is executed. \note \c it_assert0() and \c it_assert1() macros are still defined for backward compatibility, but \c it_assert_debug() should be used instead of them. */ //!@{ //! Helper function for the \c it_assert and \c it_assert_debug macros ITPP_EXPORT void it_assert_f(std::string ass, std::string msg, std::string file, int line); //! Helper function for the \c it_error and \c it_error_if macros ITPP_EXPORT void it_error_f(std::string msg, std::string file, int line); //! Helper function for the \c it_info and \c it_info_debug macros ITPP_EXPORT void it_info_f(std::string msg); //! Helper function for the \c it_warning macro ITPP_EXPORT void it_warning_f(std::string msg, std::string file, int line); //! Enable/disable using exceptions for error handling. ITPP_EXPORT void it_enable_exceptions(bool on); //! Enable warnings ITPP_EXPORT void it_enable_warnings(); //! Disable warnings ITPP_EXPORT void it_disable_warnings(); //! Redirect warnings to the ostream warn_stream ITPP_EXPORT void it_redirect_warnings(std::ostream *warn_stream); //! Style of assert, error and warning messages. enum error_msg_style { Full, Minimum }; //! Set preferred style of assert, error and warning messages ITPP_EXPORT void it_error_msg_style(error_msg_style style); //! Abort if \c t is not true #define it_assert(t,s) \ if (!(t)) { \ std::ostringstream m_sout; \ m_sout << s; \ itpp::it_assert_f(#t,m_sout.str(),__FILE__,__LINE__); \ } else \ ((void) 0) #if defined(NDEBUG) //! Abort if \c t is not true and NDEBUG is not defined # define it_assert_debug(t,s) ((void) (t)) #else //! Abort if \c t is not true and NDEBUG is not defined # define it_assert_debug(t,s) it_assert(t,s) #endif // if defined(NDEBUG) //! Deprecated macro. Please use \c it_assert_debug() instead. #define it_assert0(t,s) it_assert_debug(t,s) //! Deprecated macro. Please use \c it_assert_debug() instead. #define it_assert1(t,s) it_assert_debug(t,s) //! Abort if \c t is true #define it_error_if(t,s) \ if((t)) { \ std::ostringstream m_sout; \ m_sout << s; \ itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \ } else \ ((void) 0) //! Abort unconditionally #define it_error(s) \ if (true) { \ std::ostringstream m_sout; \ m_sout << s; \ itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \ } else \ ((void) 0) //! Print information message #define it_info(s) \ if (true) { \ std::ostringstream m_sout; \ m_sout << s << std::endl; \ itpp::it_info_f(m_sout.str()); \ } else \ ((void) 0) //! Print information message withot \c std::endl at the end #define it_info_no_endl(s) \ if (true) { \ std::ostringstream m_sout; \ m_sout << s; \ itpp::it_info_f(m_sout.str()); \ } else \ ((void) 0) #if defined(NDEBUG) //! Print information message if NDEBUG is not defined # define it_info_debug(s) ((void) 0) /*! \brief Print information message without \c std::endl at the end if NDEBUG is not defined */ # define it_info_no_endl_debug(s) ((void) 0) #else //! Print information message if NDEBUG is not defined # define it_info_debug(s) it_info(s) /*! \brief Print information message withot \c std::endl at the end if NDEBUG is not defined */ # define it_info_no_endl_debug(s) it_info_no_endl(s) #endif // if defined(NDEBUG) //! Display a warning message #define it_warning(s) \ if (true) { \ std::ostringstream m_sout; \ m_sout << s; \ itpp::it_warning_f(m_sout.str(),__FILE__,__LINE__); \ } else \ ((void) 0) //!@} } // namespace itpp #endif // #ifndef ITASSERT_H itpp-4.3.1/itpp/base/itcompat.cpp000066400000000000000000000126271216575753400167340ustar00rootroot00000000000000/*! * \file * \brief IT++ compatibility types and functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include //! \cond #ifndef HAVE_TGAMMA // "True" gamma function double tgamma(double x) { double s = (2.50662827510730 + 190.9551718930764 / (x + 1) - 216.8366818437280 / (x + 2) + 60.19441764023333 / (x + 3) - 3.08751323928546 / (x + 4) + 0.00302963870525 / (x + 5) - 0.00001352385959072596 / (x + 6)) / x; if (s < 0) return -exp((x + 0.5) * log(x + 5.5) - x - 5.5 + log(-s)); else return exp((x + 0.5) * log(x + 5.5) - x - 5.5 + log(s)); } #endif #if !defined(HAVE_LGAMMA) || (HAVE_DECL_SIGNGAM != 1) // The sign of the Gamma function is returned in the external integer // signgam declared in . It is 1 when the Gamma function is positive // or zero, -1 when it is negative. However, MinGW definition of lgamma() // function does not use the global signgam variable. int signgam; // Logarithm of an absolute value of gamma function double lgamma(double x) { double gam = tgamma(x); signgam = (gam < 0) ? -1 : 1; return log(fabs(gam)); } #endif #ifndef HAVE_CBRT // Cubic root double cbrt(double x) { return std::pow(x, 1.0 / 3.0); } #endif #ifndef HAVE_EXPM1 #ifndef M_LN2 #define M_LN2 0.69314718055994530941723212146 // ln(2) #endif // Implementation taken from GSL (http://www.gnu.org/software/gsl/) double expm1(double x) { /* FIXME: this should be improved */ if (std::fabs(x) < M_LN2) { /* Compute the taylor series S = x + (1/2!) x^2 + (1/3!) x^3 + ... */ double i = 1.0; double sum = x; double term = x / 1.0; do { i++; term *= x / i; sum += term; } while (std::fabs(term) > (std::fabs(sum) * std::numeric_limits::epsilon())); return sum; } else { return std::exp(x) - 1.0; } } #endif // HAVE_EXPM1 #ifndef HAVE_ERFC // Complementary error function double erfc(double Y) { int ISW, I; double P[4], Q[3], P1[6], Q1[5], P2[4], Q2[3]; double XMIN, XLARGE, SQRPI; double X, RES, XSQ, XNUM, XDEN, XI, XBIG, ERFCret; P[1] = 0.3166529; P[2] = 1.722276; P[3] = 21.38533; Q[1] = 7.843746; Q[2] = 18.95226; P1[1] = 0.5631696; P1[2] = 3.031799; P1[3] = 6.865018; P1[4] = 7.373888; P1[5] = 4.318779e-5; Q1[1] = 5.354217; Q1[2] = 12.79553; Q1[3] = 15.18491; Q1[4] = 7.373961; P2[1] = 5.168823e-2; P2[2] = 0.1960690; P2[3] = 4.257996e-2; Q2[1] = 0.9214524; Q2[2] = 0.1509421; XMIN = 1.0E-5; XLARGE = 4.1875E0; XBIG = 9.0; SQRPI = 0.5641896; X = Y; ISW = 1; if (X < 0) { ISW = -1; X = -X; } if (X < 0.477) { if (X >= XMIN) { XSQ = X * X; XNUM = (P[1] * XSQ + P[2]) * XSQ + P[3]; XDEN = (XSQ + Q[1]) * XSQ + Q[2]; RES = X * XNUM / XDEN; } else RES = X * P[3] / Q[2]; if (ISW == -1) RES = -RES; RES = 1.0 - RES; goto slut; } if (X > 4.0) { if (ISW > 0) goto ulf; if (X < XLARGE) goto eva; RES = 2.0; goto slut; } XSQ = X * X; XNUM = P1[5] * X + P1[1]; XDEN = X + Q1[1]; for (I = 2;I <= 4;I++) { XNUM = XNUM * X + P1[I]; XDEN = XDEN * X + Q1[I]; } RES = XNUM / XDEN; goto elin; ulf: if (X > XBIG) goto fred; eva: XSQ = X * X; XI = 1.0 / XSQ; XNUM = (P2[1] * XI + P2[2]) * XI + P2[3]; XDEN = XI + Q2[1] * XI + Q2[2]; RES = (SQRPI + XI * XNUM / XDEN) / X; elin: RES = RES * exp(-XSQ); if (ISW == -1) RES = 2.0 - RES; goto slut; fred: RES = 0.0; slut: ERFCret = RES; return ERFCret; } #endif #ifndef HAVE_ASINH // Arcus sinhyp double asinh(double x) { return ((x >= 0) ? std::log(x + std::sqrt(x * x + 1)) : -std::log(-x + std::sqrt(x * x + 1))); } #endif #ifndef HAVE_ACOSH // Arcus coshyp double acosh(double x) { it_error_if(x < 1, "acosh(): Argument out of range"); return std::log(x + std::sqrt(x * x - 1.0)); } #endif #ifndef HAVE_ATANH // Arcus tanhyp double atanh(double x) { it_error_if(std::fabs(x) >= 1, "atanh(): Argument out of range"); return 0.5 * std::log((x + 1) / (x - 1)); } #endif #ifndef HAVE_RINT double rint(double x) { // zero or NaN case if ((x == 0.0) || (x != x)) return x; // negative case bool neg = false; if (x < 0.0) { x = -x; neg = true; } double y = std::floor(x + 0.5); int i = static_cast(y); if ((y - x >= 0.5) && (i & 1)) --y; return neg ? -y : y; } #endif // HAVE_RINT //! \endcond itpp-4.3.1/itpp/base/itcompat.h000066400000000000000000000110101216575753400163620ustar00rootroot00000000000000/*! * \file * \brief IT++ compatibility types and functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITCOMPAT_H #define ITCOMPAT_H #ifndef _MSC_VER # include #else # include #endif //! \cond // Microsoft Visual C++ underscore prefixed functions #if defined(_MSC_VER) # include # define finite(x) _finite(x) # define isfinite(x) _finite(x) # define isnan(x) _isnan(x) # define fpclass(x) _fpclass(x) # define FP_NINF _FPCLASS_NINF # define FP_PINF _FPCLASS_PINF # define jn(a, b) _jn(a, b) # define yn(a, b) _yn(a, b) # define j0(a) _j0(a) # define j1(a) _j1(a) #endif // defined(_MSC_VER) // Solaris uses for declaring isnan() and finite() functions #if defined(HAVE_IEEEFP_H) # include #endif // These definitions would collide with IT++ functions #if defined(min) # undef min #endif #if defined(max) # undef max #endif #if defined(log2) # undef log2 #endif namespace std { #ifndef HAVE_STD_ISINF #if (HAVE_DECL_ISINF == 1) || defined(HAVE_ISINF) inline int isinf(double x) { return ::isinf(x); } #elif defined(FPCLASS) inline int isinf(double x) { if (::fpclass(a) == FP_NINF) return -1; else if (::fpclass(a) == FP_PINF) return 1; else return 0; } #else inline int isinf(double x) { if ((x == x) && ((x - x) != 0.0)) return (x < 0.0 ? -1 : 1); else return 0; } #endif // #if (HAVE_DECL_ISINF == 1) || defined(HAVE_ISINF) #endif // #ifndef HAVE_STD_ISINF #ifndef HAVE_STD_ISNAN #if (HAVE_DECL_ISNAN == 1) || defined(HAVE_ISNAN) inline int isnan(double x) { return ::isnan(x); } #else inline int isnan(double x) { return ((x != x) ? 1 : 0); } #endif // #if (HAVE_DECL_ISNAN == 1) || defined(HAVE_ISNAN) #endif // #ifndef HAVE_STD_ISNAN #ifndef HAVE_STD_ISFINITE #if (HAVE_DECL_ISFINITE == 1) || defined(HAVE_ISFINITE) inline int isfinite(double x) { return ::isfinite(x); } #elif defined(HAVE_FINITE) inline int isfinite(double x) { return ::finite(x); } #else inline int isfinite(double x) { return ((!std::isnan(x) && !std::isinf(x)) ? 1 : 0); } #endif // #if (HAVE_DECL_ISFINITE == 1) || defined(HAVE_ISFINITE) #endif // #ifndef HAVE_STD_ISFINITE } // namespace std #ifndef HAVE_TGAMMA //! True gamma function double tgamma(double x); #endif #if !defined(HAVE_LGAMMA) || (HAVE_DECL_SIGNGAM != 1) //! Lograrithm of an absolute gamma function double lgamma(double x); //! Global variable needed by \c lgamma function extern int signgam; #endif #ifndef HAVE_CBRT //! Cubic root double cbrt(double x); #endif #ifndef HAVE_LOG1P //! Lograrithm of an argument \c x plus one inline double log1p(double x) { return std::log(1.0 + x); } #endif #ifndef HAVE_LOG2 //! Base-2 logarithm inline double log2(double x) { static const double one_over_log2 = 1.0 / std::log(2.0); return std::log(x) * one_over_log2; } #endif #ifndef HAVE_EXPM1 //! C99 exponential minus one (exp(x) - 1.0) double expm1(double x); #endif // HAVE_EXPM1 #ifndef HAVE_ERFC //! Complementary error function double erfc(double x); #endif #ifndef HAVE_ERF //! Error function inline double erf(double x) { return (1.0 - ::erfc(x)); } #endif #ifndef HAVE_ASINH //! Arcus sinhyp double asinh(double x); #endif #ifndef HAVE_ACOSH //! Arcus coshyp double acosh(double x); #endif #ifndef HAVE_ATANH //! Arcus tanhyp double atanh(double x); #endif #ifndef HAVE_RINT double rint(double x); #endif // Represent GCC version in a concise form #define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) //! \endcond #endif // ITCOMPAT_H itpp-4.3.1/itpp/base/itfile.cpp000066400000000000000000002347651216575753400164010ustar00rootroot00000000000000/*! * \file * \brief Implementation of classes for the IT++ file format * \author Tony Ottosson, Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { char it_file_base::file_magic[4] = { 'I', 'T', '+', '+' }; char it_file_base::file_version = 3; // ---------------------------------------------------------------------- // it_ifile class // ---------------------------------------------------------------------- it_ifile::it_ifile() {} it_ifile::it_ifile(const std::string &name) { open(name); } void it_ifile::open(const std::string &name) { it_assert(exist(name), "it_ifile::open(): File does not exist"); s.open_readonly(name, bfstream_base::l_endian); if (!read_check_file_header()) { s.close(); it_error("it_ifile::open(): Corrupt file (not an it_file)"); } } void it_ifile::close() { s.close(); } bool it_ifile::seek(const std::string &name) { data_header h; std::streampos p; s.clear(); s.seekg(sizeof(file_header)); while (true) { p = s.tellg(); read_data_header(h); if (s.eof()) { s.clear(); return false; } if (h.type != "" && h.name == name) { s.seekg(p); break; } s.seekg(p + static_cast(h.block_bytes)); } return true; } bool it_ifile::seek(int n) { data_header h; std::streampos p; s.clear(); s.seekg(sizeof(file_header)); for (int i = 0; i <= n; i++) { p = s.tellg(); read_data_header(h); if (s.eof()) { s.clear(); return false; } if (h.type == "") i--; s.seekg((i == n) ? p : p + static_cast(h.block_bytes)); } return true; } void it_ifile::info(std::string &name, std::string &type, std::string &desc, uint64_t &bytes) { data_header h; std::streampos p; p = s.tellg(); read_data_header(h); s.seekg(p); name = h.name; type = h.type; desc = h.desc; bytes = h.data_bytes; } bool it_ifile::read_check_file_header() { file_header h; s.read(reinterpret_cast(&h), sizeof(h)); return (memcmp(h.magic, file_magic, 4) == 0 && (h.version == file_version)); } void it_ifile::read_data_header(data_header &h) { s.clear(); s >> h.hdr_bytes; s >> h.data_bytes; s >> h.block_bytes; s >> h.name; s >> h.type; s >> h.desc; } void it_ifile::low_level_read(char &x) { s >> x; } void it_ifile::low_level_read(uint64_t &x) { s >> x; } void it_ifile::low_level_read(bool &x) { char tmp; s >> tmp; x = (tmp == 0) ? false : true; } void it_ifile::low_level_read(bin &x) { char tmp; s >> tmp; x = tmp; } void it_ifile::low_level_read(short &x) { int16_t tmp; s >> tmp; x = tmp; } void it_ifile::low_level_read(int &x) { int32_t tmp; s >> tmp; x = tmp; } void it_ifile::low_level_read(float &x) { s >> x; } void it_ifile::low_level_read(double &x) { s >> x; } void it_ifile::low_level_read(std::complex &x) { float x_real, x_imag; s >> x_real; s >> x_imag; x = std::complex(x_real, x_imag); } void it_ifile::low_level_read(std::complex &x) { double x_real, x_imag; s >> x_real; s >> x_imag; x = std::complex(x_real, x_imag); } void it_ifile::low_level_read(bvec &v) { uint64_t size; char tmp; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> tmp; v(i) = tmp; } } void it_ifile::low_level_read(svec &v) { uint64_t size; int16_t val; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val; v(i) = val; } } void it_ifile::low_level_read(ivec &v) { uint64_t size; int32_t val; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val; v(i) = val; } } void it_ifile::low_level_read_lo(vec &v) { uint64_t size; float val; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val; v(i) = static_cast(val); } } void it_ifile::low_level_read_hi(vec &v) { uint64_t size; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) s >> v(i); } void it_ifile::low_level_read_lo(cvec &v) { uint64_t size; float val_real, val_imag; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile::low_level_read_hi(cvec &v) { uint64_t size; double val_real, val_imag; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile::low_level_read(std::string &str) { uint64_t size; s >> size; std::string::size_type size2 = static_cast(size); str.resize(size2); for (std::string::size_type i = 0; i < size2; ++i) s >> str[i]; } void it_ifile::low_level_read(bmat &m) { uint64_t i, j; char tmp; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) { for (int i = 0; i < m.rows(); ++i) { s >> tmp; m(i, j) = tmp; } } } void it_ifile::low_level_read(smat &m) { uint64_t i, j; int16_t val; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s >> val; m(i, j) = val; } } void it_ifile::low_level_read(imat &m) { uint64_t i, j; int32_t val; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s >> val; m(i, j) = val; } } void it_ifile::low_level_read_lo(mat &m) { uint64_t i, j; float val; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s >> val; m(i, j) = static_cast(val); } } void it_ifile::low_level_read_hi(mat &m) { uint64_t i, j; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) s >> m(i, j); } void it_ifile::low_level_read_lo(cmat &m) { uint64_t i, j; float val_real, val_imag; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s >> val_real; s >> val_imag; m(i, j) = std::complex(val_real, val_imag); } } void it_ifile::low_level_read_hi(cmat &m) { uint64_t i, j; double val_real, val_imag; s >> i >> j; m.set_size(static_cast(i), static_cast(j), false); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s >> val_real; s >> val_imag; m(i, j) = std::complex(val_real, val_imag); } } void it_ifile::low_level_read(Array &v) { uint64_t size; char tmp; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> tmp; v(i) = tmp; } } void it_ifile::low_level_read(Array &v) { uint64_t size; int16_t val; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val; v(i) = val; } } void it_ifile::low_level_read(Array &v) { uint64_t size; int32_t val; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val; v(i) = val; } } void it_ifile::low_level_read(Array &v) { uint64_t size; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) s >> v(i); } void it_ifile::low_level_read_lo(Array &v) { uint64_t size; float val; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val; v(i) = static_cast(val); } } void it_ifile::low_level_read_hi(Array &v) { uint64_t size; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) s >> v(i); } void it_ifile::low_level_read(Array > &v) { uint64_t size; float val_real, val_imag; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile::low_level_read_lo(Array > &v) { uint64_t size; float val_real, val_imag; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile::low_level_read_hi(Array > &v) { uint64_t size; double val_real, val_imag; s >> size; v.set_size(static_cast(size), false); for (int i = 0; i < v.size(); ++i) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } // ---------------------------------------------------------------------- // it_file class // ---------------------------------------------------------------------- it_file::it_file(): low_prec(false), _strings(new Strings_Holder) {} it_file::it_file(const std::string &name, bool trunc): low_prec(false), _strings(new Strings_Holder) { open(name, trunc); } void it_file::open(const std::string &name, bool trunc) { if (!exist(name)) trunc = true; s.open(name, trunc, bfstream_base::l_endian); it_assert(s.is_open(), "it_file::open(): Could not open file for writing"); if (trunc) write_file_header(); else if (!read_check_file_header()) { s.close(); it_error("it_file::open(): Corrupt file (not an it_file)"); } fname() = name; } void it_file::close() { s.close(); } void it_file::flush() { s.flush(); } void it_file::write_file_header() { s.write(file_magic, 4); s.put(file_version); } void it_file::write_data_header(const std::string &type, uint64_t size) { it_error_if(next_name() == "", "it_file::write_data_header(): Can not " "write without a name"); write_data_header(type, next_name(), size, next_desc()); next_name() = ""; next_desc() = ""; } void it_file::write_data_header(const std::string &type, const std::string &name, uint64_t size, const std::string &desc) { data_header h1, h2; // Prepare a new data header h1.hdr_bytes = 3 * sizeof(uint64_t) + type.size() + 1 + name.size() + 1 + desc.size() + 1; h1.data_bytes = size; h1.block_bytes = h1.hdr_bytes + h1.data_bytes; h1.name = name; h1.type = type; h1.desc = desc; // If variable exists, remove it first if (exists(name)) remove(); // Try to find an empty space s.clear(); s.seekg(sizeof(file_header)); // skip file header while (true) { // save the current position std::streampos p = s.tellp(); // read block at the current position read_data_header(h2); // if empty file, stop the search and set write pointer to the end of // file if (s.eof()) { s.clear(); s.seekp(0, std::ios::end); break; } // save the size of the current read block std::streamoff skip = static_cast(h2.block_bytes); // check if we have enough empty space from previously deleted data if ((h2.type == "") && (h2.block_bytes >= h1.block_bytes)) { h1.block_bytes = h2.block_bytes; s.seekp(p); break; } // if not, maybe we can squeeze the current block to find space else if ((h2.block_bytes - h2.hdr_bytes - h2.data_bytes) >= h1.block_bytes) { h1.block_bytes = h2.block_bytes - h2.hdr_bytes - h2.data_bytes; h2.block_bytes = h2.hdr_bytes + h2.data_bytes; s.seekp(p); // rewrite squeezed data block write_data_header_here(h2); s.seekp(p + static_cast(h2.block_bytes)); break; } // otherwise, skip the current block and try again s.seekg(p + skip); } // while(true) write_data_header_here(h1); } void it_file::write_data_header_here(const data_header &h) { s << h.hdr_bytes << h.data_bytes << h.block_bytes << h.name << h.type << h.desc; } void it_file::remove(const std::string &name) { seek(name); remove(); } void it_file::remove() { data_header h; std::streampos p; p = s.tellp(); read_data_header(h); h.type = ""; h.name = ""; h.desc = ""; h.hdr_bytes = 3 * sizeof(uint64_t) + 1 + 1 + 1; h.data_bytes = 0; s.seekp(p); write_data_header_here(h); s.seekp(p + static_cast(h.block_bytes)); } bool it_file::exists(const std::string &name) { return seek(name); } void it_file::pack() { it_assert(s.is_open(), "it_file::pack(): File has to be open"); // check total file size s.seekg(0, std::ios::end); std::streampos p = s.tellg(); s.seekg(0, std::ios::beg); s.clear(); // allocate buffer of size equal to file size char* buffer = new char[int(p)]; char* b_ptr = buffer; // copy file header and start counting the size of compacted file uint64_t size; for (size = 0; size < sizeof(file_header); ++size) s.get(*b_ptr++); // remove empty space between data blocks data_header h; while (true) { p = s.tellg(); read_data_header(h); if (s.eof()) { s.clear(); break; } if (h.type != "") { s.seekg(p); for (uint64_t i = 0; i < h.hdr_bytes + h.data_bytes; ++i) s.get(*b_ptr++); size += h.hdr_bytes + h.data_bytes; } s.seekg(p + static_cast(h.block_bytes)); } // close and reopen file truncating it s.close(); s.open(fname(), true, bfstream_base::l_endian); // write compacted data to the reopend empty file for (uint64_t i = 0; i < size; ++i) s.put(buffer[i]); // free buffer memory delete buffer; // go back to the first data block (skiping file header) s.seekg(sizeof(file_header)); // update block_bytes in headers of compacted data blocks while (true) { p = s.tellg(); read_data_header(h); if (s.eof()) { s.clear(); break; } if (h.hdr_bytes + h.data_bytes < h.block_bytes) { h.block_bytes = h.hdr_bytes + h.data_bytes; s.seekp(p); write_data_header_here(h); } s.seekg(p + static_cast(h.block_bytes)); } } void it_file::low_level_write(char x) { s << x; } void it_file::low_level_write(uint64_t x) { s << x; } void it_file::low_level_write(bool x) { s << static_cast(x); } void it_file::low_level_write(bin x) { s << x.value(); } void it_file::low_level_write(short x) { s << static_cast(x); } void it_file::low_level_write(int x) { s << static_cast(x); } void it_file::low_level_write(float x) { s << x; } void it_file::low_level_write(double x) { s << x; } void it_file::low_level_write(const std::complex &x) { s << x.real(); s << x.imag(); } void it_file::low_level_write(const std::complex &x) { s << x.real(); s << x.imag(); } void it_file::low_level_write(const bvec &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << v(i).value(); } void it_file::low_level_write(const svec &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } void it_file::low_level_write(const ivec &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } void it_file::low_level_write(const vec &v) { s << static_cast(v.size()); if (get_low_precision()) { for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } else { for (int i = 0; i < v.size(); ++i) s << v(i); } } void it_file::low_level_write(const cvec &v) { s << static_cast(v.size()); if (get_low_precision()) { for (int i = 0; i < v.size(); ++i) { s << static_cast(v(i).real()); s << static_cast(v(i).imag()); } } else { for (int i = 0; i < v.size(); ++i) { s << v(i).real(); s << v(i).imag(); } } } void it_file::low_level_write(const std::string &str) { s << static_cast(str.size()); for (std::string::size_type i = 0; i < str.size(); ++i) s << str[i]; } void it_file::low_level_write(const bmat &m) { s << static_cast(m.rows()) << static_cast(m.cols()); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) s << m(i, j).value(); } void it_file::low_level_write(const smat &m) { s << static_cast(m.rows()) << static_cast(m.cols()); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) s << static_cast(m(i, j)); } void it_file::low_level_write(const imat &m) { s << static_cast(m.rows()) << static_cast(m.cols()); for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) s << static_cast(m(i, j)); } void it_file::low_level_write(const mat &m) { s << static_cast(m.rows()) << static_cast(m.cols()); if (get_low_precision()) { for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) s << static_cast(m(i, j)); } else { for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) s << m(i, j); } } void it_file::low_level_write(const cmat &m) { s << static_cast(m.rows()) << static_cast(m.cols()); if (get_low_precision()) { for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s << static_cast(m(i, j).real()); s << static_cast(m(i, j).imag()); } } else { for (int j = 0; j < m.cols(); ++j) for (int i = 0; i < m.rows(); ++i) { s << m(i, j).real(); s << m(i, j).imag(); } } } void it_file::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << v(i).value(); } void it_file::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } void it_file::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } void it_file::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) s << v(i); } void it_file::low_level_write(const Array &v) { s << static_cast(v.size()); if (get_low_precision()) { for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } else { for (int i = 0; i < v.size(); ++i) s << static_cast(v(i)); } } void it_file::low_level_write(const Array > &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); ++i) { s << v(i).real(); s << v(i).imag(); } } void it_file::low_level_write(const Array > &v) { s << static_cast(v.size()); if (get_low_precision()) { for (int i = 0; i < v.size(); ++i) { s << static_cast(v(i).real()); s << static_cast(v(i).imag()); } } else { for (int i = 0; i < v.size(); ++i) { s << v(i).real(); s << v(i).imag(); } } } it_ifile &operator>>(it_ifile &f, char &x) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "int8", "it_ifile::operator>>(): Wrong type"); f.low_level_read(x); return f; } it_ifile &operator>>(it_ifile &f, bool &x) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bool", "it_ifile::operator>>(): Wrong type"); f.low_level_read(x); return f; } it_ifile &operator>>(it_ifile &f, bin &x) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bin", "it_ifile::operator>>(): Wrong type"); f.low_level_read(x); return f; } it_ifile &operator>>(it_ifile &f, short &x) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "int16", "it_ifile::operator>>(): Wrong type"); f.low_level_read(x); return f; } it_ifile &operator>>(it_ifile &f, int &x) { it_file::data_header h; f.read_data_header(h); if (h.type == "int32") f.low_level_read(x); else if (h.type == "int16") { short x16; f.low_level_read(x16); x = static_cast(x16); } else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, float &x) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "float32", "it_ifile::operator>>(): Wrong type"); f.low_level_read(x); return f; } it_ifile &operator>>(it_ifile &f, double &x) { it_file::data_header h; f.read_data_header(h); if (h.type == "float64") f.low_level_read(x); else if (h.type == "float32") { float f32; f.low_level_read(f32); x = static_cast(f32); } else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, std::complex &x) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "cfloat32", "it_ifile::operator>>(): Wrong type"); f.low_level_read(x); return f; } it_ifile &operator>>(it_ifile &f, std::complex &x) { it_file::data_header h; f.read_data_header(h); if (h.type == "cfloat64") f.low_level_read(x); else if (h.type == "cfloat32") { std::complex f32_c; f.low_level_read(f32_c); x = static_cast >(f32_c); } else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, bvec &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bvec", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, svec &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "svec", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, ivec &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "ivec", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, vec &v) { it_ifile::data_header h; f.read_data_header(h); if (h.type == "fvec") f.low_level_read_lo(v); else if (h.type == "dvec") f.low_level_read_hi(v); else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, cvec &v) { it_file::data_header h; f.read_data_header(h); if (h.type == "fcvec") f.low_level_read_lo(v); else if (h.type == "dcvec") f.low_level_read_hi(v); else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, std::string &str) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "string", "it_ifile::operator>>(): Wrong type"); f.low_level_read(str); return f; } it_ifile &operator>>(it_ifile &f, bmat &m) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bmat", "it_ifile::operator>>(): Wrong type"); f.low_level_read(m); return f; } it_ifile &operator>>(it_ifile &f, smat &m) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "smat", "it_ifile::operator>>(): Wrong type"); f.low_level_read(m); return f; } it_ifile &operator>>(it_ifile &f, imat &m) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "imat", "it_ifile::operator>>(): Wrong type"); f.low_level_read(m); return f; } it_ifile &operator>>(it_ifile &f, mat &m) { it_file::data_header h; f.read_data_header(h); if (h.type == "fmat") f.low_level_read_lo(m); else if (h.type == "dmat") f.low_level_read_hi(m); else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, cmat &m) { it_file::data_header h; f.read_data_header(h); if (h.type == "fcmat") f.low_level_read_lo(m); else if (h.type == "dcmat") f.low_level_read_hi(m); else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bArray", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "sArray", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "iArray", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "fArray", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); if (h.type == "fArray") f.low_level_read_lo(v); else if (h.type == "dArray") f.low_level_read_hi(v); else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, Array > &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "fcArray", "it_ifile::operator>>(): Wrong type"); f.low_level_read(v); return f; } it_ifile &operator>>(it_ifile &f, Array > &v) { it_file::data_header h; f.read_data_header(h); if (h.type == "fcArray") f.low_level_read_lo(v); else if (h.type == "dcArray") f.low_level_read_hi(v); else it_error("it_ifile::operator>>(): Wrong type"); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bvecArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "svecArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "ivecArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "vecArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read_hi(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "cvecArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read_hi(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "stringArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "bmatArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "smatArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "imatArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "matArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read_hi(v(i)); return f; } it_ifile &operator>>(it_ifile &f, Array &v) { it_file::data_header h; f.read_data_header(h); it_assert(h.type == "cmatArray", "it_ifile::operator>>(): Wrong type"); uint64_t n; f.low_level_read(n); int size = static_cast(n); v.set_size(size, false); for (int i = 0; i < size; ++i) f.low_level_read_hi(v(i)); return f; } it_file &operator<<(it_file &f, char x) { f.write_data_header("int8", sizeof(char)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, bool x) { f.write_data_header("bool", sizeof(char)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, bin x) { f.write_data_header("bin", sizeof(char)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, short x) { f.write_data_header("int16", sizeof(int16_t)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, int x) { f.write_data_header("int32", sizeof(int32_t)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, float x) { f.write_data_header("float32", sizeof(float)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, double x) { f.write_data_header("float64", sizeof(double)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, std::complex x) { f.write_data_header("cfloat32", 2 * sizeof(float)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, std::complex x) { f.write_data_header("cfloat64", 2 * sizeof(double)); f.low_level_write(x); return f; } it_file &operator<<(it_file &f, const bvec &v) { f.write_data_header("bvec", sizeof(uint64_t) + v.size() * sizeof(char)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const svec &v) { f.write_data_header("svec", sizeof(uint64_t) + v.size() * sizeof(int16_t)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const ivec &v) { f.write_data_header("ivec", sizeof(uint64_t) + v.size() * sizeof(int32_t)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const vec &v) { if (f.get_low_precision()) f.write_data_header("fvec", sizeof(uint64_t) + v.size() * sizeof(float)); else f.write_data_header("dvec", sizeof(uint64_t) + v.size() * sizeof(double)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const cvec &v) { if (f.get_low_precision()) f.write_data_header("fcvec", sizeof(uint64_t) + v.size() * 2 * sizeof(float)); else f.write_data_header("dcvec", sizeof(uint64_t) + v.size() * 2 * sizeof(double)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const std::string &str) { f.write_data_header("string", sizeof(uint64_t) + str.size() * sizeof(char)); f.low_level_write(str); return f; } it_file &operator<<(it_file &f, const bmat &m) { f.write_data_header("bmat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * sizeof(char)); f.low_level_write(m); return f; } it_file &operator<<(it_file &f, const smat &m) { f.write_data_header("smat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * sizeof(int16_t)); f.low_level_write(m); return f; } it_file &operator<<(it_file &f, const imat &m) { f.write_data_header("imat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * sizeof(int32_t)); f.low_level_write(m); return f; } it_file &operator<<(it_file &f, const mat &m) { if (f.get_low_precision()) f.write_data_header("fmat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * sizeof(float)); else f.write_data_header("dmat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * sizeof(double)); f.low_level_write(m); return f; } it_file &operator<<(it_file &f, const cmat &m) { if (f.get_low_precision()) f.write_data_header("fcmat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * 2 * sizeof(float)); else f.write_data_header("dcmat", 2 * sizeof(uint64_t) + m.rows() * m.cols() * 2 * sizeof(double)); f.low_level_write(m); return f; } it_file &operator<<(it_file &f, const Array &v) { f.write_data_header("bArray", sizeof(uint64_t) + v.size() * sizeof(char)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array &v) { f.write_data_header("sArray", sizeof(uint64_t) + v.size() * sizeof(int16_t)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array &v) { f.write_data_header("iArray", sizeof(uint64_t) + v.size() * sizeof(int32_t)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array &v) { f.write_data_header("fArray", sizeof(uint64_t) + v.size() * sizeof(float)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array &v) { if (f.get_low_precision()) f.write_data_header("fArray", sizeof(uint64_t) + v.size() * sizeof(float)); else f.write_data_header("dArray", sizeof(uint64_t) + v.size() * sizeof(double)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array > &v) { f.write_data_header("fcArray", sizeof(uint64_t) + v.size() * 2 * sizeof(float)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array > &v) { if (f.get_low_precision()) f.write_data_header("fcArray", sizeof(uint64_t) + v.size() * 2 * sizeof(float)); else f.write_data_header("dcArray", sizeof(uint64_t) + v.size() * 2 * sizeof(double)); f.low_level_write(v); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i).size(); // write header f.write_data_header("bvecArray", sizeof(uint64_t) * (1 + v.size()) + sum_l * sizeof(char)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i).size(); // write header f.write_data_header("svecArray", sizeof(uint64_t) * (1 + v.size()) + sum_l * sizeof(int16_t)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i).size(); // write header f.write_data_header("ivecArray", sizeof(uint64_t) * (1 + v.size()) + sum_l * sizeof(int32_t)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i).size(); // write header f.write_data_header("vecArray", sizeof(uint64_t) * (1 + v.size()) + sum_l * sizeof(double)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i).size(); // write header f.write_data_header("cvecArray", sizeof(uint64_t) * (1 + v.size()) + sum_l * 2 * sizeof(double)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += int(v(i).size()); // write header f.write_data_header("stringArray", sizeof(uint64_t) * (1 + v.size()) + sum_l * sizeof(char)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i)._datasize(); // write header f.write_data_header("bmatArray", sizeof(uint64_t) * (1 + 2 * v.size()) + sum_l * sizeof(char)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i)._datasize(); // write header f.write_data_header("smatArray", sizeof(uint64_t) * (1 + 2 * v.size()) + sum_l * sizeof(int16_t)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i)._datasize(); // write header f.write_data_header("imatArray", sizeof(uint64_t) * (1 + 2 * v.size()) + sum_l * sizeof(int32_t)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i)._datasize(); // write header f.write_data_header("matArray", sizeof(uint64_t) * (1 + 2 * v.size()) + sum_l * sizeof(double)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } it_file &operator<<(it_file &f, const Array &v) { // calculate total length of Array int sum_l = 0; for (int i = 0; i < v.size(); ++i) sum_l += v(i)._datasize(); // write header f.write_data_header("cmatArray", sizeof(uint64_t) * (1 + 2 * v.size()) + sum_l * 2 * sizeof(double)); // write the length of the array f.low_level_write(static_cast(v.size())); // write one vector at a time (i.e. size and elements) for (int i = 0; i < v.size(); ++i) f.low_level_write(v(i)); return f; } // ---------------------------------------------------------------------- // Deprecated implementation of IT++ file format version 2 // Will be removed in future versions // ---------------------------------------------------------------------- char it_file_base_old::file_magic[4] = { 'I', 'T', '+', '+' }; char it_file_base_old::file_version = 2; it_ifile_old::it_ifile_old() { } it_ifile_old::it_ifile_old(const std::string &name) { open(name); } void it_ifile_old::open(const std::string &name) { it_assert(exist(name), "File does not exist"); s.open_readonly(name); if (!read_check_file_header()) { s.close(); it_error("Corrupt file (Not an it-file)"); } } void it_ifile_old::close() { s.close(); } bool it_ifile_old::seek(const std::string &name) { data_header h; std::streampos p; s.clear(); s.seekg(sizeof(file_header)); while (true) { p = s.tellg(); read_data_header(h); if (s.eof()) { s.clear(); return false; } if (h.type != "" && h.name == name) { s.seekg(p); break; } s.seekg(p + static_cast(h.block_bytes)); } return true; } bool it_ifile_old::seek(int n) { data_header h; std::streampos p; s.clear(); s.seekg(sizeof(file_header)); for (int i = 0; i <= n; i++) { p = s.tellg(); // changed from tellp() since probably an error read_data_header(h); if (s.eof()) { s.clear(); return false; } if (h.type == "") i--; s.seekg(i == n ? p : p + static_cast(h.block_bytes)); } return true; } void it_ifile_old::info(std::string &name, std::string &type, int &bytes) { data_header h; std::streampos p; p = s.tellg(); // changed from tellp() read_data_header(h); s.seekg(p); name = h.name; type = h.type; bytes = h.data_bytes; } bool it_ifile_old::read_check_file_header() { file_header h; memset(&h, 0, sizeof(h)); // Clear the struct s.read(reinterpret_cast(&h), sizeof(h)); return (memcmp(h.magic, file_magic, 4) == 0 && (h.version <= file_version)); } void it_ifile_old::read_data_header(data_header &h) { std::streampos p = s.tellg(); s.clear(); s >> h.endianity; if (s.eof()) return; s.set_endianity(static_cast(h.endianity)); uint32_t tmp; s >> tmp; h.hdr_bytes = tmp; s >> tmp; h.data_bytes = tmp; s >> tmp; h.block_bytes = tmp; s >> h.name; s >> h.type; s.seekg(p + static_cast(h.hdr_bytes)); } void it_ifile_old::low_level_read(char &x) { s >> x; } void it_ifile_old::low_level_read(bin &x) { s >> x; } void it_ifile_old::low_level_read(short &x) { s >> x; } void it_ifile_old::low_level_read(int &x) { int32_t tmp; s >> tmp; x = tmp; } void it_ifile_old::low_level_read(float &x) { s >> x; } void it_ifile_old::low_level_read(double &x) { s >> x; } void it_ifile_old::low_level_read(std::complex &x) { float x_real, x_imag; s >> x_real; s >> x_imag; x = std::complex(x_real, x_imag); } void it_ifile_old::low_level_read(std::complex &x) { double x_real, x_imag; s >> x_real; s >> x_imag; x = std::complex(x_real, x_imag); } void it_ifile_old::low_level_read_lo(vec &v) { int32_t i; float val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = static_cast(val); } } void it_ifile_old::low_level_read_hi(vec &v) { int32_t i; double val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = static_cast(val); } } void it_ifile_old::low_level_read(ivec &v) { int32_t i, val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = val; } } void it_ifile_old::low_level_read(bvec &v) { int32_t i; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) s >> v(i); } void it_ifile_old::low_level_read_lo(cvec &v) { int32_t i; float val_real, val_imag; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile_old::low_level_read_hi(cvec &v) { int32_t i; double val_real, val_imag; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile_old::low_level_read(std::string &str) { int32_t i, j; char val; str = ""; s >> i; for (j = 0; j < i; j++) { s >> val; str += val; } } void it_ifile_old::low_level_read_lo(mat &m) { int32_t i, j; float val; s >> i >> j; m.set_size(i, j, false); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s >> val; m(i, j) = static_cast(val); } } void it_ifile_old::low_level_read_hi(mat &m) { int32_t i, j; double val; s >> i >> j; m.set_size(i, j, false); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s >> val; m(i, j) = static_cast(val); } } void it_ifile_old::low_level_read(imat &m) { int32_t i, j, val; s >> i >> j; m.set_size(i, j, false); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s >> val; m(i, j) = val; } } void it_ifile_old::low_level_read(bmat &m) { int32_t i, j; s >> i >> j; m.set_size(i, j, false); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) s >> m(i, j); } void it_ifile_old::low_level_read_lo(cmat &m) { int32_t i, j; float val_real, val_imag; s >> i >> j; m.set_size(i, j, false); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s >> val_real; s >> val_imag; m(i, j) = std::complex(val_real, val_imag); } } void it_ifile_old::low_level_read_hi(cmat &m) { int32_t i, j; double val_real, val_imag; s >> i >> j; m.set_size(i, j, false); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s >> val_real; s >> val_imag; m(i, j) = std::complex(val_real, val_imag); } } void it_ifile_old::low_level_read_lo(Array &v) { int32_t i; float val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = val; } } void it_ifile_old::low_level_read_lo(Array &v) { int32_t i; float val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = static_cast(val); } } void it_ifile_old::low_level_read_hi(Array &v) { int32_t i; double val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = static_cast(val); } } void it_ifile_old::low_level_read(Array &v) { int32_t i, val; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val; v(i) = val; } } void it_ifile_old::low_level_read(Array &v) { int32_t i; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) s >> v(i); } void it_ifile_old::low_level_read_lo(Array > &v) { int32_t i; float val_real, val_imag; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile_old::low_level_read_lo(Array > &v) { int32_t i; float val_real, val_imag; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } void it_ifile_old::low_level_read_hi(Array > &v) { int32_t i; double val_real, val_imag; s >> i; v.set_size(i, false); for (i = 0; i < v.size(); i++) { s >> val_real; s >> val_imag; v(i) = std::complex(val_real, val_imag); } } it_file_old::it_file_old():_string(new String_Holder()) { low_prec = false; } it_file_old::it_file_old(const std::string &name, bool trunc): _string(new String_Holder()) { low_prec = false; open(name, trunc); } void it_file_old::open(const std::string &name, bool trunc) { if (!exist(name)) trunc = true; s.open(name, trunc); it_error_if(!s.is_open(), "Could not open file for writing"); if (trunc) write_file_header(); else if (!read_check_file_header()) { s.close(); it_error("Corrupt file (Not an it-file)"); } } void it_file_old::close() { s.close(); } void it_file_old::flush() { s.flush(); } void it_file_old::write_file_header() { s.write(file_magic, 4); s << file_version; } void it_file_old::write_data_header(const std::string &type, uint32_t size) { it_error_if(next_name() == "", "Try to write without a name"); write_data_header(type, next_name(), size); next_name() = ""; } void it_file_old::write_data_header(const std::string &type, const std::string &name, uint32_t size) { data_header h1, h2; std::streampos p; int availpos = 0; bool removed = false; int skip; h1.endianity = static_cast(s.get_native_endianity()); h1.hdr_bytes = 1 + 3 * 4 + int(type.size()) + 1 + int(name.size()) + 1; h1.data_bytes = size; h1.block_bytes = h1.hdr_bytes + h1.data_bytes; h1.name = name; h1.type = type; if (exists(name)) remove(); // Try to find an empty space s.clear(); s.seekg(sizeof(file_header)); while (true) { p = s.tellp(); read_data_header(h2); if (s.eof()) { s.clear(); break; } skip = h2.block_bytes; if (h2.type != "" && h2.name == name) { s.seekg(p); remove(); s.seekg(p); read_data_header(h2); removed = true; if (availpos != 0) break; } if (availpos == 0) { if (h2.type == "" && h2.block_bytes >= h1.block_bytes) { h1.block_bytes = h2.block_bytes; availpos = int(p); } else if (h2.block_bytes - h2.hdr_bytes - h2.data_bytes >= h1.block_bytes) { h1.block_bytes = h2.block_bytes - h2.hdr_bytes - h2.data_bytes; h2.block_bytes = h2.hdr_bytes + h2.data_bytes; s.seekp(p); write_data_header_here(h2); availpos = static_cast(p) + h2.block_bytes; if (removed) break; } } s.seekg(p + static_cast(skip)); } if (availpos != 0) s.seekp(availpos); else s.seekp(0, std::ios::end); write_data_header_here(h1); } void it_file_old::write_data_header_here(const data_header &h) { s.set_endianity(static_cast(h.endianity)); s << h.endianity << h.hdr_bytes << h.data_bytes << h.block_bytes << h.name << h.type; } void it_file_old::remove(const std::string &name) { seek(name); remove(); } void it_file_old::remove() { data_header h; std::streampos p; p = s.tellp(); read_data_header(h); h.type = ""; h.name = ""; h.hdr_bytes = 1 + 3 * 4 + 1 + 1; h.data_bytes = 0; s.seekp(p); write_data_header_here(h); s.seekp(p + static_cast(h.block_bytes)); } bool it_file_old::exists(const std::string &name) { if (seek(name)) return true; else return false; } void it_file_old::pack() { it_warning("pack() is not implemented!"); } void it_file_old::low_level_write(char x) { s << x; } void it_file_old::low_level_write(bin x) { s << x.value(); } void it_file_old::low_level_write(short x) { s << x; } void it_file_old::low_level_write(int x) { s << static_cast(x); } void it_file_old::low_level_write(float x) { s << x; } void it_file_old::low_level_write(double x) { s << x; } void it_file_old::low_level_write(const std::complex &x) { s << x.real(); s << x.imag(); } void it_file_old::low_level_write(const std::complex &x) { s << x.real(); s << x.imag(); } void it_file_old::low_level_write(const vec &v) { if (get_low_precision()) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << static_cast(v(i)); } else { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << static_cast(v(i)); } } void it_file_old::low_level_write(const ivec &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << static_cast(v(i)); } void it_file_old::low_level_write(const bvec &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << v(i).value(); } void it_file_old::low_level_write(const cvec &v) { if (get_low_precision()) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) { s << static_cast(v(i).real()); s << static_cast(v(i).imag()); } } else { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) { s << static_cast(v(i).real()); s << static_cast(v(i).imag()); } } } void it_file_old::low_level_write(const std::string &str) { int size = int(str.size()); s << static_cast(size); for (int i = 0; i < size; i++) s << str[i]; } void it_file_old::low_level_write(const mat &m) { int i, j; if (get_low_precision()) { s << static_cast(m.rows()) << static_cast(m.cols()); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) s << static_cast(m(i, j)); } else { s << static_cast(m.rows()) << static_cast(m.cols()); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) s << static_cast(m(i, j)); } } void it_file_old::low_level_write(const imat &m) { int i, j; s << static_cast(m.rows()) << static_cast(m.cols()); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) s << static_cast(m(i, j)); } void it_file_old::low_level_write(const bmat &m) { int i, j; s << static_cast(m.rows()) << static_cast(m.cols()); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) s << m(i, j).value(); } void it_file_old::low_level_write(const cmat &m) { int i, j; if (get_low_precision()) { s << static_cast(m.rows()) << static_cast(m.cols()); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s << static_cast(m(i, j).real()); s << static_cast(m(i, j).imag()); } } else { s << static_cast(m.rows()) << static_cast(m.cols()); for (j = 0; j < m.cols(); j++) for (i = 0; i < m.rows(); i++) { s << static_cast(m(i, j).real()); s << static_cast(m(i, j).imag()); } } } void it_file_old::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << v(i); } void it_file_old::low_level_write(const Array &v) { if (get_low_precision()) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << static_cast(v(i)); } else { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << static_cast(v(i)); } } void it_file_old::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << static_cast(v(i)); } void it_file_old::low_level_write(const Array &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) s << v(i).value(); } void it_file_old::low_level_write(const Array > &v) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) { s << v(i).real(); s << v(i).imag(); } } void it_file_old::low_level_write(const Array > &v) { if (get_low_precision()) { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) { s << static_cast(v(i).real()); s << static_cast(v(i).imag()); } } else { s << static_cast(v.size()); for (int i = 0; i < v.size(); i++) { s << static_cast(v(i).real()); s << static_cast(v(i).imag()); } } } it_ifile_old &operator>>(it_ifile_old &f, char &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "int8") f.low_level_read(x); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, bin &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "bin") f.low_level_read(x); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, short &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "int16") f.low_level_read(x); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, int &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "int32") f.low_level_read(x); else if (h.type == "int16") { short x16; f.low_level_read(x16); x = x16; } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, double &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "float64") f.low_level_read(x); else if (h.type == "float32") { float f32; f.low_level_read(f32); x = f32; } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, float &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "float32") f.low_level_read(x); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, std::complex &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "float32_complex") { std::complex f32_c; f.low_level_read(f32_c); x = f32_c; } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, std::complex &x) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "float64_complex") f.low_level_read(x); else if (h.type == "float32_complex") { std::complex f32_c; f.low_level_read(f32_c); x = f32_c; } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, vec &v) { it_ifile_old::data_header h; f.read_data_header(h); if (h.type == "fvec") f.low_level_read_lo(v); else if (h.type == "dvec") f.low_level_read_hi(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, ivec &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "ivec") f.low_level_read(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, bvec &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "bvec") f.low_level_read(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, cvec &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fcvec") f.low_level_read_lo(v); else if (h.type == "dcvec") f.low_level_read_hi(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, std::string &str) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "string") f.low_level_read(str); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, mat &m) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fmat") f.low_level_read_lo(m); else if (h.type == "dmat") f.low_level_read_hi(m); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, imat &m) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "imat") f.low_level_read(m); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, bmat &m) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "bmat") f.low_level_read(m); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, cmat &m) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fcmat") f.low_level_read_lo(m); else if (h.type == "dcmat") f.low_level_read_hi(m); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fArray") f.low_level_read_lo(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fArray") f.low_level_read_lo(v); else if (h.type == "dArray") f.low_level_read_hi(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "iArray") f.low_level_read(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "bArray") f.low_level_read(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array > &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fcArray") f.low_level_read_lo(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array > &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "fcArray") f.low_level_read_lo(v); else if (h.type == "dcArray") f.low_level_read_hi(v); else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "vecArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read_hi(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "ivecArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "bvecArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "cvecArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read_hi(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "stringArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "matArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read_hi(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "imatArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "bmatArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read(v(i)); } else it_error("Wrong type"); return f; } it_ifile_old &operator>>(it_ifile_old &f, Array &v) { it_file_old::data_header h; f.read_data_header(h); if (h.type == "cmatArray") { int n; f.low_level_read(n); v.set_size(n, false); for (int i = 0; i < n; i++) f.low_level_read_hi(v(i)); } else it_error("Wrong type"); return f; } it_file_old &operator<<(it_file_old &f, char x) { f.write_data_header("int8", sizeof(char)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, bin x) { f.write_data_header("bin", sizeof(bin)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, short x) { f.write_data_header("int16", sizeof(short)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, int x) { f.write_data_header("int32", sizeof(int)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, float x) { f.write_data_header("float32", sizeof(float)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, double x) { f.write_data_header("float64", sizeof(double)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, std::complex x) { f.write_data_header("float32_complex", 2*sizeof(float)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, std::complex x) { f.write_data_header("float64_complex", 2*sizeof(double)); f.low_level_write(x); return f; } it_file_old &operator<<(it_file_old &f, const vec &v) { if (f.get_low_precision()) f.write_data_header("fvec", sizeof(int) + v.size() * sizeof(float)); else f.write_data_header("dvec", sizeof(int) + v.size() * sizeof(double)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const ivec &v) { f.write_data_header("ivec", (1 + v.size()) * sizeof(int)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const bvec &v) { f.write_data_header("bvec", sizeof(int) + v.size() * sizeof(bin)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const cvec &v) { if (f.get_low_precision()) f.write_data_header("fcvec", sizeof(int) + v.size() * 2 * sizeof(float)); else f.write_data_header("dcvec", sizeof(int) + v.size() * 2 * sizeof(double)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const std::string &str) { f.write_data_header("string", sizeof(int) + int(str.size()) * sizeof(char)); f.low_level_write(str); return f; } it_file_old &operator<<(it_file_old &f, const mat &m) { if (f.get_low_precision()) f.write_data_header("fmat", 2*sizeof(int) + m.rows()*m.cols()*sizeof(float)); else f.write_data_header("dmat", 2*sizeof(int) + m.rows()*m.cols()*sizeof(double)); f.low_level_write(m); return f; } it_file_old &operator<<(it_file_old &f, const imat &m) { f.write_data_header("imat", (2 + m.rows()*m.cols()) * sizeof(int)); f.low_level_write(m); return f; } it_file_old &operator<<(it_file_old &f, const bmat &m) { f.write_data_header("bmat", 2*sizeof(int) + m.rows()*m.cols()*sizeof(bin)); f.low_level_write(m); return f; } it_file_old &operator<<(it_file_old &f, const cmat &m) { if (f.get_low_precision()) f.write_data_header("fcmat", 2*sizeof(int) + 2*m.rows()*m.cols()*sizeof(float)); else f.write_data_header("dcmat", 2*sizeof(int) + 2*m.rows()*m.cols()*sizeof(double)); f.low_level_write(m); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { f.write_data_header("fArray", sizeof(int) + v.size() * sizeof(float)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { if (f.get_low_precision()) f.write_data_header("fArray", sizeof(int) + v.size() * sizeof(float)); else f.write_data_header("dArray", sizeof(int) + v.size() * sizeof(double)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { f.write_data_header("iArray", (1 + v.size()) * sizeof(int)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { f.write_data_header("bArray", sizeof(int) + v.size() * sizeof(bin)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const Array > &v) { f.write_data_header("fcArray", sizeof(int) + v.size() * 2 * sizeof(float)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const Array > &v) { if (f.get_low_precision()) f.write_data_header("fcArray", sizeof(int) + v.size() * 2 * sizeof(float)); else f.write_data_header("dcArray", sizeof(int) + v.size() * 2 * sizeof(double)); f.low_level_write(v); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i).size(); } // write header f.write_data_header("vecArray", sizeof(int)*(1 + v.size()) + sum_l * sizeof(double)); f.low_level_write(v.size()); // the length of the array // write one vector at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i).size(); } // write header f.write_data_header("ivecArray", sizeof(int)*(1 + v.size()) + sum_l * sizeof(int)); f.low_level_write(v.size()); // the length of the array // write one vector at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i).size(); } // write header f.write_data_header("bvecArray", sizeof(int)*(1 + v.size()) + sum_l * sizeof(bin)); f.low_level_write(v.size()); // the length of the array // write one vector at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i).size(); } // write header f.write_data_header("cvecArray", sizeof(int)*(1 + v.size()) + sum_l * sizeof(std::complex)); f.low_level_write(v.size()); // the length of the array // write one vector at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += int(v(i).size()); } // write header f.write_data_header("stringArray", sizeof(int)*(1 + v.size()) + sum_l * sizeof(char)); f.low_level_write(v.size()); // the length of the array // write one vector at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i)._datasize(); } // write header f.write_data_header("matArray", sizeof(int)*(1 + 2*v.size()) + sum_l * sizeof(double)); f.low_level_write(v.size()); // the length of the array // write one matrix at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i)._datasize(); } // write header f.write_data_header("imatArray", sizeof(int)*(1 + 2*v.size()) + sum_l * sizeof(int)); f.low_level_write(v.size()); // the length of the array // write one matrix at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i)._datasize(); } // write header f.write_data_header("bmatArray", sizeof(int)*(1 + 2*v.size()) + sum_l * sizeof(bin)); f.low_level_write(v.size()); // the length of the array // write one matrix at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } it_file_old &operator<<(it_file_old &f, const Array &v) { int i, sum_l = 0; // calculate total length of Array for (i = 0; i < v.size(); i++) { sum_l += v(i)._datasize(); } // write header f.write_data_header("cmatArray", sizeof(int)*(1 + 2*v.size()) + sum_l * sizeof(std::complex)); f.low_level_write(v.size()); // the length of the array // write one matrix at a time (i.e. size and elements) for (i = 0; i < v.size(); i++) f.low_level_write(v(i)); return f; } } // namespace itpp itpp-4.3.1/itpp/base/itfile.h000066400000000000000000001335251216575753400160360ustar00rootroot00000000000000/*! * \file * \brief Definition of classes for the IT++ file format * \author Tony Ottosson, Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITFILE_H #define ITFILE_H #include #include #include #include #include namespace itpp { /*! \addtogroup itfile \brief The IT++ file format \author Tony Ottosson, Tobias Ringstrom and Adam Piatyszek The IT++ file format is a file format that can be used to save (load) variables to (from) files. These files can also be read an written by Matlab or Octave using the m-files \c itload.m and \c itsave.m. The class it_ifile is used for reading only, whereas the class it_file can be used for both reading and writing. Saving of a variable is done in two steps. The first step is to supply the name and optionally description of the variable to be saved. This can be done either by calling the function it_file::set_next_name() or by using the helper class Name: \code vec v("1 2 3"); bvec b = "0 1 0 1"; it_file f("file.it"); f << Name("v", "A double vector of tree values") << v; f.set_next_name("b"); f << b; \endcode The reading is done in a similar way: \code vec v; bvec b; it_ifile f("file.it"); f >> Name("v") >> v; f.seek("b"); f >> b; \endcode \note Since version 3, IT++ file format uses the IEEE little endian byte ordering ("ieee-le" in Matlab/Octave). This version is not backward compatible with previous versions. If you need to read/write data in IT++ file format version 2, you can use the it_ifile_old and it_file_old classes. Please have in mind that these "old" classes are deprecated and will be removed from the IT++ library in future. \warning Do not use the names that begin with an existing type. */ /*! \brief Base class for it_ifile and it_file. \ingroup itfile */ class ITPP_EXPORT it_file_base { public: //! Data header structure struct data_header { //! Number of bytes of the header uint64_t hdr_bytes; //! Number of bytes of the data uint64_t data_bytes; //! Number of bytes of the header + data uint64_t block_bytes; //! Data name std::string name; //! Data type, e.g. int32, float32, etc. type = "" means deleted std::string type; //! Data description std::string desc; }; protected: //! File header structure struct file_header { //! IT++ file marker: "IT++" char magic[4]; //! IT++ file format version char version; }; //! IT++ file marker: "IT++" static char file_magic[4]; //! IT++ file version static char file_version; }; /*! \brief The IT++ file format reading class. \ingroup itfile */ class ITPP_EXPORT it_ifile : public it_file_base { public: //! Default constructor it_ifile(); //! Constructor that calls open(filename) explicit it_ifile(const std::string& filename); //! Destructor virtual ~it_ifile() { } //! Open an existing file in read-only mode void open(const std::string& filename); //! Close the file virtual void close(); //! Returns pointer to the underlying \c bfstream used bfstream& low_level() { return s; } //! Read and check the file header. Return true if the header is valid and false otherwise. bool read_check_file_header(); //! Read data header and return the result in the variable \c h void read_data_header(it_file_base::data_header& h); //! Read a char value at the current file pointer position void low_level_read(char& x); //! Read a 64-bit unsigned integer value at the current file pointer position void low_level_read(uint64_t& x); //! Read a bool value at the current file pointer position void low_level_read(bool &x); //! Read a binary value at the current file pointer position void low_level_read(bin& x); //! Read a short value at the current file pointer position void low_level_read(short& x); //! Read an integer value at the current file pointer position void low_level_read(int& x); //! Read a float value at the current file pointer position void low_level_read(float& x); //! Read a double value at the current file pointer position void low_level_read(double& x); //! Read a float complex value at the current file pointer position void low_level_read(std::complex& x); //! Read a double complex value at the current file pointer position void low_level_read(std::complex& x); //! Read a vector of binary values at the current file pointer position void low_level_read(bvec& v); //! Read a vector of short integer values at the current file pointer position void low_level_read(svec& v); //! Read a vector of integer values at the current file pointer position void low_level_read(ivec& v); //! Read a vector of float values at the current file pointer position void low_level_read_lo(vec& v); //! Read a vector of double values at the current file pointer position void low_level_read_hi(vec& v); //! Read a vector of float complex values at the current file pointer position void low_level_read_lo(cvec& v); //! Read a vector of double complex values at the current file pointer position void low_level_read_hi(cvec& v); //! Read a string at the current file pointer position void low_level_read(std::string& str); //! Read a matrix of binary values at the current file pointer position void low_level_read(bmat& m); //! Read a matrix of short integer values at the current file pointer position void low_level_read(smat& m); //! Read a matrix of integer values at the current file pointer position void low_level_read(imat& m); //! Read a matrix of float values at the current file pointer position void low_level_read_lo(mat& m); //! Read a matrix of double values at the current file pointer position void low_level_read_hi(mat& m); //! Read a matrix of float complex values at the current file pointer position void low_level_read_lo(cmat& m); //! Read a matrix of double complex values at the current file pointer position void low_level_read_hi(cmat& m); //! Read an Array of binary values at the current file pointer position void low_level_read(Array& v); //! Read an Array of short integer values at the current file pointer position void low_level_read(Array& v); //! Read an Array of integer values at the current file pointer position void low_level_read(Array& v); //! Read an Array of float values at the current file pointer position void low_level_read(Array& v); //! Read an Array of float values at the current file pointer position void low_level_read_lo(Array& v); //! Read an Array of double values at the current file pointer position void low_level_read_hi(Array& v); //! Read an Array of float complex values at the current file pointer position void low_level_read(Array >& v); //! Read an Array of float complex values at the current file pointer position void low_level_read_lo(Array >& v); //! Read an Array of double complex values at the current file pointer position void low_level_read_hi(Array >& v); //! Find the variable \c name bool seek(const std::string& name); //! Find the variable number \c n bool seek(int n); //! Get information about the current variable void info(std::string& name, std::string& type, std::string& desc, uint64_t& bytes); protected: //! Protected binary file stream bfstream s; }; /*! \brief The IT++ file format reading and writing class \ingroup itfile */ class ITPP_EXPORT it_file : public it_ifile { public: //! ACTION: Add documentation for this typedef typedef it_file& (*it_manip)(it_file&); //! Default constructor it_file(); /*! \brief Constructor that calls open() If the file does not exist it will be created. If \c trunc is true, the file will be truncated. */ explicit it_file(const std::string& filename, bool trunc = false); //! Destructor virtual ~it_file() { delete _strings;} /*! \brief Open a file for reading and writing If the file does not exist it will be created. If \c trunc is true, the file will be truncated. */ void open(const std::string& filename, bool trunc = false); //! Close the file void close(); //! Flush the data to disk void flush(); //! Returns pointer to the underlying \c bfstream used bfstream& low_level() { return s; } //! Set the precision. Low precision means floats, high means doubles. void set_low_precision(bool p = true) { low_prec = p; } //! Get the precision bool get_low_precision() const { return low_prec; } //! Set the name and optionally description of the next variable to be saved void set_next_name(const std::string& name, const std::string& description = "") { next_name() = name; next_desc() = description; } //! Write the header for the \c it_file void write_file_header(); //! Write the data header for a variable, specifying the type and size of the data to follow. void write_data_header(const std::string& type, uint64_t size); //! Write the data header for a variable, specifying the type, name, size and optionally description of the data to follow. void write_data_header(const std::string& type, const std::string& name, uint64_t size, const std::string& description = ""); //! Write a char value at the current file pointer position void low_level_write(char x); //! Write an unsigned integer 64-bit value at the current file pointer position void low_level_write(uint64_t x); //! Write a bool value at the current file pointer position void low_level_write(bool x); //! Write a binary value at the current file pointer position void low_level_write(bin x); //! Write a short value at the current file pointer position void low_level_write(short x); //! Write an integer value at the current file pointer position void low_level_write(int x); //! Write a float value at the current file pointer position void low_level_write(float x); //! Write a double value at the current file pointer position void low_level_write(double x); //! Write a float complex value at the current file pointer position void low_level_write(const std::complex& x); //! Write a double complex value at the current file pointer position void low_level_write(const std::complex& x); //! Write a bvec at the current file pointer position void low_level_write(const bvec& v); //! Write an svec at the current file pointer position void low_level_write(const svec& v); //! Write an ivec at the current file pointer position void low_level_write(const ivec& v); //! Write a vec at the current file pointer position void low_level_write(const vec& v); //! Write a cvec at the current file pointer position void low_level_write(const cvec& v); //! Write a string at the current file pointer position void low_level_write(const std::string& str); //! Write a bmat at the current file pointer position void low_level_write(const bmat& m); //! Write an smat at the current file pointer position void low_level_write(const smat& m); //! Write an imat at the current file pointer position void low_level_write(const imat& m); //! Write a mat at the current file pointer position void low_level_write(const mat& m); //! Write a cmat at the current file pointer position void low_level_write(const cmat& m); //! Write a bin Array at the current file pointer position void low_level_write(const Array& v); //! Write a short Array at the current file pointer position void low_level_write(const Array& v); //! Write an integer Array at the current file pointer position void low_level_write(const Array& v); //! Write a float Array at the current file pointer position void low_level_write(const Array& v); //! Write a double Array at the current file pointer position void low_level_write(const Array& v); //! Write a float complex Array at the current file pointer position void low_level_write(const Array >& v); //! Write a double complex Array at the current file pointer position void low_level_write(const Array >& v); //!ACTION: ADD DOCUMENTATION FOR THIS MEMBER !!!!!!!! it_file& operator<<(it_manip func) { return (*func)(*this); } //! Removes the variable \c name from the file void remove(const std::string& name); //! Returns true if the variable \c name exists in the file bool exists(const std::string& name); //! Remove slack space from the file void pack(); protected: //! Remove the current variable, denoted by \c next_name void remove(); //! Write data header \c h at the current file position void write_data_header_here(const data_header& h); //! Low precision flag. If true, use float type, otherwise double bool low_prec; //! Name to be used for saving the next variable std::string& next_name() {return _strings->_next_name;} //! Description to be used for saving the next variable std::string& next_desc() {return _strings->_next_desc;} private: struct Strings_Holder { std::string _next_name; std::string _next_desc; std::string _fname; Strings_Holder():_next_name(""),_next_desc(""),_fname(""){} }; Strings_Holder* _strings; // Name of the opened file. Needed by the pack() method. std::string& fname() {return _strings->_fname;} }; /*! \brief Flush operator \ingroup itfile Flushes the data. Usage: \code vec v1("1 2 3"), v2; it_file f("file.it"); f << Name("v") << v1 << flush; \endcode */ inline it_file& flush(it_file& f) { f.flush(); return f; } /*! \brief Automatic naming when saving \ingroup itfile An easy way to give a variable a name and optionally description when saving. Usage: \code vec v1("1 2 3"), v2; it_file f("file.it"); f << Name("v", "A vector of consecutive double values") << v1; f >> Name("v") >> v2; \endcode */ class ITPP_EXPORT Name { public: //! Constructor Name(const std::string& n, const std::string& d = ""): name(n), desc(d) {} //! Dummy assignment operator - MSVC++ warning C4512 Name &operator=(const Name&) { return *this; } //! The name string const std::string& name; //! The description const std::string& desc; }; /*! \addtogroup itfile */ //!@{ //! Finds the variable \c Name in the \c it_ifile. Returns file pointer for reading. inline it_ifile& operator>>(it_ifile& f, const Name& s) { f.seek(s.name); return f; } //! Finds the variable \c Name in the \c it_file. Returns file pointer for writing. inline it_file& operator<<(it_file& f, const Name& s) { f.set_next_name(s.name, s.desc); return f; } //! Read the char variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, char& v); //! Read the bool variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile &f, bool &v); //! Read the binary variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, bin& v); //! Read the short variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, short& v); //! Read the integer variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, int& v); //! Read the float variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, float& v); //! Read the double variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, double& v); //! Read the float complex variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, std::complex& v); //! Read the double complex variable \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, std::complex& v); //! Read the bvec \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, bvec& v); //! Read the svec \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, svec& v); //! Read the ivec \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, ivec& v); //! Read the vec \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, vec& v); //! Read the cvec \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, cvec& v); //! Read the string \c str from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, std::string& str); //! Read the bmat \c m from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, bmat& m); //! Read the smat \c m from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, smat& m); //! Read the imat \c m from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, imat& m); //! Read the mat \c m from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, mat& m); //! Read the cmat \c m from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, cmat& m); //! Read the binary Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the short integer Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the integer Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the float Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the double Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the float complex Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array >& v); //! Read the double complex Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array >& v); //! Read the bvec Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the svec Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the ivec Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the vec Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the cvec Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the string Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the bmat Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the bmat Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the imat Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the mat Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Read the cmat Array \c v from the \c it_ifile pointer ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array& v); //! Write the char variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, char x); //! Write the bool variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file &f, bool x); //! Write the binary variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, bin x); //! Write the short variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, short x); //! Write the integer variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, int x); //! Write the float variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, float x); //! Write the double variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, double x); //! Write the float complex variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, std::complex x); //! Write the double complex variable \c x to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, std::complex x); //! Write the bvec \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const bvec& v); //! Write the svec \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const svec& v); //! Write the ivec \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const ivec& v); //! Write the vec \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const vec& v); //! Write the cvec \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const cvec& v); //! Write the string \c str to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const std::string& str); //! Write the bmat \c m to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const bmat& m); //! Write the smat \c m to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const smat& m); //! Write the imat \c m to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const imat& m); //! Write the mat \c m to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const mat& m); //! Write the cmat \c m to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const cmat& m); //! Write the bin Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the short int Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the int Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the float Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the double Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the float complex Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array >& v); //! Write the double complex Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array >& v); //! Write the bvec Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the svec Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the ivec Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the vec Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the cvec Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the string Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the bmat Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the smat Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the imat Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the mat Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Write the cmat Array \c v to the \c it_file pointer ITPP_EXPORT it_file& operator<<(it_file& f, const Array& v); //! Save the variable v in the file name.it as the name name. template inline void it_save_var_as(const T& v, const std::string& name) { it_file f(name + ".it"); f << Name(name) << v; f.close(); } //! Load the variable v from the file name.it as the name name. template inline void it_load_var_as(T& v, const std::string& name) { it_ifile f(name + ".it"); f.seek(name); f >> v; f.close(); } //! A convenient macro. Calling it_save_var(M) saves M as 'M' in the file 'M.it'. #define it_save_var(v) it_save_var_as(v,#v) //! A convenient macro. Calling it_load_var(M) loads M as 'M' in the file 'M.it'. #define it_load_var(v) it_load_var_as(v,#v) //!@} // ---------------------------------------------------------------------- // Deprecated implementation of IT++ file format version 2 // Will be removed in future versions // ---------------------------------------------------------------------- /*! \brief Base class for it_ifile_old and it_file_old. \warning This class is deprecated and will be removed in future. \ingroup itfile */ class ITPP_EXPORT it_file_base_old { public: //! Data header structure struct data_header { //! 0=little, 1=big char endianity; /*! size variables * @{ */ uint32_t hdr_bytes, data_bytes, block_bytes; /*! @} */ //! data name std::string name; //! data type, e.g. int32, float32, etc. type = "" means deleted std::string type; }; protected: //! File header structure struct file_header { //! ACTION: Add documentation char magic[4]; //! ACTION: Add documentation char version; }; //! ACTION: Add documentation static char file_magic[4]; //! ACTION: Add documentation static char file_version; }; /*! \brief The old (version 2) IT++ file format reading class. \warning This class is deprecated and will be removed in future. \ingroup itfile */ class ITPP_EXPORT it_ifile_old : public it_file_base_old { public: //!Constructor. it_ifile_old(); //!Constructor. Calls open(). explicit it_ifile_old(const std::string& name); //!Destructor. virtual ~it_ifile_old() { } //!Open a file. The file must exist. void open(const std::string& name); //!Close a file. virtual void close(); //!Returns pointer to the underlying \c bfstream used bfstream& low_level() { return s; } //!Reads and checks the file data header. Returns true if the header is valid and false otherwise. bool read_check_file_header(); //!Read the data header and return the result in the variable \c h void read_data_header(data_header& h); //!Read a char value at the current file pointer position void low_level_read(char& x); //!Read a binary value at the current file pointer position void low_level_read(bin& x); //!Read a short value at the current file pointer position void low_level_read(short& x); //!Read an integer value at the current file pointer position void low_level_read(int& x); //!Read a float value at the current file pointer position void low_level_read(float& x); //!Read a double value at the current file pointer position void low_level_read(double& x); //!Read a float complex value at the current file pointer position void low_level_read(std::complex& x); //!Read a double complex value at the current file pointer position void low_level_read(std::complex& x); //!Read a vector of float values at the current file pointer position void low_level_read_lo(vec& v); //!Read a vector of double values at the current file pointer position void low_level_read_hi(vec& v); //!Read a vector of integer values at the current file pointer position void low_level_read(ivec& v); //!Read a vector of binary values at the current file pointer position void low_level_read(bvec& v); //!Read a vector of float complex values at the current file pointer position void low_level_read_lo(cvec& v); //!Read a vector of double complex values at the current file pointer position void low_level_read_hi(cvec& v); //!Read a string at the current file pointer position void low_level_read(std::string& str); //!Read a matrix of float values at the current file pointer position void low_level_read_lo(mat& m); //!Read a matrix of double values at the current file pointer position void low_level_read_hi(mat& m); //!Read a matrix of integer values at the current file pointer position void low_level_read(imat& m); //!Read a matrix of binary values at the current file pointer position void low_level_read(bmat& m); //!Read a matrix of float complex values at the current file pointer position void low_level_read_lo(cmat& m); //!Read a matrix of double complex values at the current file pointer position void low_level_read_hi(cmat& m); //!Read an Array of float values at the current file pointer position void low_level_read_lo(Array& v); //!Read an Array of float values at the current file pointer position void low_level_read_lo(Array& v); //!Read an Array of double values at the current file pointer position void low_level_read_hi(Array& v); //!Read an Array of integer values at the current file pointer position void low_level_read(Array& v); //!Read an Array of binary values at the current file pointer position void low_level_read(Array& v); //!Read an Array of float complex values at the current file pointer position void low_level_read_lo(Array >& v); //!Read an Array of float complex values at the current file pointer position void low_level_read_lo(Array >& v); //!Read an Array of double complex values at the current file pointer position void low_level_read_hi(Array >& v); //! Find the variable \c name. bool seek(const std::string& name); //! Find the variable number \c n. bool seek(int n); //! Get information about the current variable. void info(std::string& name, std::string& type, int& bytes); protected: //! Protected binary file stream bfstream s; }; /*! \brief The old (version 2) IT++ file format reading and writing class. \warning This class is deprecated and will be removed in future. \ingroup itfile */ class ITPP_EXPORT it_file_old : public it_ifile_old { public: //! ACTION: Add documentation for this typedef typedef it_file_old& (*it_manip)(it_file_old&); //! Constructor. it_file_old(); /*! \brief Constructor. If the file does not exist it will be created. If \c trunc is true, the file will be truncated. */ explicit it_file_old(const std::string& name, bool trunc = false); //! Destructor. virtual ~it_file_old() { delete _string;} /*! \brief Open a file for reading and writing. If the file does not exist it will be created. If \c trunc is true, the file will be truncated. */ void open(const std::string& name, bool trunc = false); //! Close the file. void close(); //! Flush the data to disk. void flush(); //! Returns pointer to the underlying \c bfstream used bfstream& low_level() { return s; } //! Set the precision. Low precision means floats, high means doubles. void set_low_precision(bool p = true) { low_prec = p; } //! Get the precision. bool get_low_precision() { return low_prec; } //! Set the name of the next name to be saved. See also the \c Name class. void set_next_name(const std::string& n) { next_name() = n; } //!Write the header for the \c it_file_old void write_file_header(); //!Write the data header for a variable, specifying the type and size of the data to follow. void write_data_header(const std::string& type, uint32_t size); //!Write the data header for a variable, specifying the type, name, and size of the data to follow. void write_data_header(const std::string& type, const std::string& name, uint32_t size); //!Write a char value at the current file pointer position void low_level_write(char x); //!Write a binary value at the current file pointer position void low_level_write(bin x); //!Write a short value at the current file pointer position void low_level_write(short x); //!Write an integer value at the current file pointer position void low_level_write(int x); //!Write a float value at the current file pointer position void low_level_write(float x); //!Write a double value at the current file pointer position void low_level_write(double x); //!Write a float complex value at the current file pointer position void low_level_write(const std::complex& x); //!Write a double complex value at the current file pointer position void low_level_write(const std::complex& x); //!Write a vec at the current file pointer position void low_level_write(const vec& v); //!Write an ivec at the current file pointer position void low_level_write(const ivec& v); //!Write a bvec at the current file pointer position void low_level_write(const bvec& v); //!Write a cvec at the current file pointer position void low_level_write(const cvec& v); //!Write a string at the current file pointer position void low_level_write(const std::string& str); //!Write a mat at the current file pointer position void low_level_write(const mat& m); //!Write a imat at the current file pointer position void low_level_write(const imat& m); //!Write a bmat at the current file pointer position void low_level_write(const bmat& m); //!Write a cmat at the current file pointer position void low_level_write(const cmat& m); //!Write a float Array at the current file pointer position void low_level_write(const Array& v); //!Write a double Array at the current file pointer position void low_level_write(const Array& v); //!Write a integer Array at the current file pointer position void low_level_write(const Array& v); //!Write a bin Array at the current file pointer position void low_level_write(const Array& v); //!Write a float complex Array at the current file pointer position void low_level_write(const Array >& v); //!Write a double complex Array at the current file pointer position void low_level_write(const Array >& v); //!ACTION: ADD DOCUMENTATION FOR THIS MEMBER !!!!!!!! it_file_old& operator<<(it_manip func) { return (*func)(*this); } //! Removes the variable \c name from the file. void remove(const std::string& name); //! Returns true if the variable \c name exists in the file. bool exists(const std::string& name); //! Remove slack space from the file. void pack(); protected: //! ACTION: Add documenation for this protected member void remove(); //! ACTION: Add documenation for this protected member void write_data_header_here(const data_header& h); //! ACTION: Add documenation for this protected member bool low_prec; //! ACTION: Add documenation for this protected member std::string& next_name() {return _string->_next_name;} private: struct String_Holder { std::string _next_name; String_Holder():_next_name(""){} }; String_Holder* _string; }; /*! \brief Flush operator. \ingroup itfile Flushes the data. Usage: \code vec v1("1 2 3"), v2; it_file_old f("file.it"); f << Name("v") << v1 << flush; \endcode */ inline it_file_old& flush(it_file_old& f) { f.flush(); return f; } /*! \addtogroup itfile */ //!@{ //!Finds the variable \c Name in the \c it_ifile_old. Returns file pointer for reading. inline it_ifile_old& operator>>(it_ifile_old& f, const Name& s) { f.seek(s.name); return f; } //!Finds the variable \c Name in the \c it_file_old. Returns file pointer for writing. inline it_file_old& operator<<(it_file_old& f, const Name& s) { f.set_next_name(s.name); return f; } //!Read the char variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, char& v); //!Read the binary variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, bin& v); //!Read the short variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, short& v); //!Read the integer variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, int& v); //!Read the float variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, float& v); //!Read the double variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, double& v); //!Read the float complex variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, std::complex& v); //!Read the double complex variable \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, std::complex& v); //!Read the vec \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, vec& v); //!Read the ivec \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, ivec& v); //!Read the bvec \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, bvec& v); //!Read the cvec \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, cvec& v); //!Read the string \c str from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, std::string& str); //!Read the mat \c m from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, mat& m); //!Read the imat \c m from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, imat& m); //!Read the bmat \c m from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, bmat& m); //!Read the cmat \c m from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, cmat& m); //!Read the float Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the double Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the integer Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the binary Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the float complex Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array >& v); //!Read the double complex Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array >& v); //!Read the vec Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the ivec Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the bvec Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the cvec Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the string Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the mat Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the imat Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the bmat Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Read the cmat Array \c v from the \c it_ifile_old pointer ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array& v); //!Write the char variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, char x); //!Write the binary variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, bin x); //!Write the short variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, short x); //!Write the integer variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, int x); //!Write the float variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, float x); //!Write the double variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, double x); //!Write the float complex variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, std::complex x); //!Write the double complex variable \c x to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, std::complex x); //!Write the vec \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const vec& v); //!Write the ivec \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const ivec& v); //!Write the bvec \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const bvec& v); //!Write the cvec \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const cvec& v); //!Write the string \c str to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const std::string& str); //!Write the mat \c m to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const mat& m); //!Write the imat \c m to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const imat& m); //!Write the bmat \c m to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const bmat& m); //!Write the cmat \c m to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const cmat& m); //!Write the float Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the double Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the int Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the bin Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the float complex Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array >& v); //!Write the double complex Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array >& v); //!Write the vec Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the ivec Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the bvec Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the cvec Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the string Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the mat Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the imat Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the bmat Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!Write the cmat Array \c v to the \c it_file_old pointer ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array& v); //!@} // ---------------------------------------------------------------------- // End of the deprecated implementation of IT++ file format version 2 // Will be removed in future versions // ---------------------------------------------------------------------- } // namespace itpp #endif // #ifndef IT_FILE_H itpp-4.3.1/itpp/base/ittypes.h000066400000000000000000000030761216575753400162600ustar00rootroot00000000000000/*! * \file * \brief IT++ type definitions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2008 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITTYPES_H #define ITTYPES_H //! \cond // Fixed size integer types for MSVC++ #if defined(_MSC_VER) typedef signed char int8_t; typedef unsigned char uint8_t; typedef signed short int16_t; typedef unsigned short uint16_t; typedef signed int int32_t; typedef unsigned int uint32_t; typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; #else // Assume that inttypes.h header file is available everywhere # include #endif // defined(_MSC_VER) //! \endcond #endif // ITTYPES_H itpp-4.3.1/itpp/base/mat.cpp000066400000000000000000000431031216575753400156660ustar00rootroot00000000000000/*! * \file * \brief Matrix Class Implementation * \author Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #ifndef _MSC_VER # include #else # include #endif #if defined (HAVE_BLAS) # include #endif //! \cond namespace itpp { template<> cmat cmat::hermitian_transpose() const { cmat temp(no_cols, no_rows); for (int i = 0; i < no_rows; i++) for (int j = 0; j < no_cols; j++) temp(j, i) = std::conj(operator()(i,j)); return temp; } // -------- Multiplication operator ------------- #if defined(HAVE_BLAS) template<> mat& mat::operator*=(const mat &m) { it_assert_debug(no_cols == m.no_rows, "mat::operator*=(): Wrong sizes"); mat r(no_rows, m.no_cols); // unnecessary memory?? double alpha = 1.0; double beta = 0.0; char trans = 'n'; blas::dgemm_(&trans, &trans, &no_rows, &m.no_cols, &no_cols, &alpha, data, &no_rows, m.data, &m.no_rows, &beta, r.data, &r.no_rows); operator=(r); // time consuming return *this; } template<> cmat& cmat::operator*=(const cmat &m) { it_assert_debug(no_cols == m.no_rows, "cmat::operator*=(): Wrong sizes"); cmat r(no_rows, m.no_cols); // unnecessary memory?? std::complex alpha = std::complex(1.0); std::complex beta = std::complex(0.0); char trans = 'n'; blas::zgemm_(&trans, &trans, &no_rows, &m.no_cols, &no_cols, &alpha, data, &no_rows, m.data, &m.no_rows, &beta, r.data, &r.no_rows); operator=(r); // time consuming return *this; } #else template<> mat& mat::operator*=(const mat &m) { it_assert_debug(no_cols == m.no_rows, "Mat<>::operator*=(): Wrong sizes"); mat r(no_rows, m.no_cols); int r_pos = 0, pos = 0, m_pos = 0; for (int i = 0; i < r.no_cols; i++) { for (int j = 0; j < r.no_rows; j++) { double tmp = 0.0; pos = 0; for (int k = 0; k < no_cols; k++) { tmp += data[pos+j] * m.data[m_pos+k]; pos += no_rows; } r.data[r_pos+j] = tmp; } r_pos += r.no_rows; m_pos += m.no_rows; } operator=(r); // time consuming return *this; } template<> cmat& cmat::operator*=(const cmat &m) { it_assert_debug(no_cols == m.no_rows, "Mat<>::operator*=(): Wrong sizes"); cmat r(no_rows, m.no_cols); int r_pos = 0, pos = 0, m_pos = 0; for (int i = 0; i < r.no_cols; i++) { for (int j = 0; j < r.no_rows; j++) { std::complex tmp(0.0); pos = 0; for (int k = 0; k < no_cols; k++) { tmp += data[pos+j] * m.data[m_pos+k]; pos += no_rows; } r.data[r_pos+j] = tmp; } r_pos += r.no_rows; m_pos += m.no_rows; } operator=(r); // time consuming return *this; } #endif // HAVE_BLAS #if defined(HAVE_BLAS) template<> mat operator*(const mat &m1, const mat &m2) { it_assert_debug(m1.cols() == m2.rows(), "mat::operator*(): Wrong sizes"); int m1_r = m1.rows(); int m1_c = m1.cols(); int m2_r = m2.rows(); int m2_c = m2.cols(); mat r(m1_r, m2_c); double alpha = 1.0; double beta = 0.0; char trans = 'n'; blas::dgemm_(&trans, &trans, &m1_r, &m2_c, &m1_c, &alpha, m1._data(), &m1_r, m2._data(), &m2_r, &beta, r._data(), &m1_r); return r; } template<> cmat operator*(const cmat &m1, const cmat &m2) { it_assert_debug(m1.cols() == m2.rows(), "cmat::operator*(): Wrong sizes"); int m1_r = m1.rows(); int m1_c = m1.cols(); int m2_r = m2.rows(); int m2_c = m2.cols(); cmat r(m1_r, m2_c); std::complex alpha = std::complex(1.0); std::complex beta = std::complex(0.0); char trans = 'n'; blas::zgemm_(&trans, &trans, &m1_r, &m2_c, &m1_c, &alpha, m1._data(), &m1_r, m2._data(), &m2_r, &beta, r._data(), &m1_r); return r; } #else template<> mat operator*(const mat &m1, const mat &m2) { it_assert_debug(m1.rows() == m2.cols(), "Mat<>::operator*(): Wrong sizes"); mat r(m1.rows(), m2.cols()); double *tr = r._data(); const double *t1; const double *t2 = m2._data(); for (int i = 0; i < r.cols(); i++) { for (int j = 0; j < r.rows(); j++) { double tmp = 0.0; t1 = m1._data() + j; for (int k = m1.cols(); k > 0; k--) { tmp += *(t1) * *(t2++); t1 += m1.rows(); } *(tr++) = tmp; t2 -= m2.rows(); } t2 += m2.rows(); } return r; } template<> cmat operator*(const cmat &m1, const cmat &m2) { it_assert_debug(m1.cols() == m2.rows(), "Mat<>::operator*(): Wrong sizes"); cmat r(m1.rows(), m2.cols()); std::complex *tr = r._data(); const std::complex *t1; const std::complex *t2 = m2._data(); for (int i = 0; i < r.cols(); i++) { for (int j = 0; j < r.rows(); j++) { std::complex tmp(0.0); t1 = m1._data() + j; for (int k = m1.cols(); k > 0; k--) { tmp += *(t1) * *(t2++); t1 += m1.rows(); } *(tr++) = tmp; t2 -= m2.rows(); } t2 += m2.rows(); } return r; } #endif // HAVE_BLAS #if defined(HAVE_BLAS) template<> vec operator*(const mat &m, const vec &v) { it_assert_debug(m.cols() == v.size(), "mat::operator*(): Wrong sizes"); int m_r = m.rows(); int m_c = m.cols(); vec r(m_r); double alpha = 1.0; double beta = 0.0; char trans = 'n'; int incr = 1; blas::dgemv_(&trans, &m_r, &m_c, &alpha, m._data(), &m_r, v._data(), &incr, &beta, r._data(), &incr); return r; } template<> cvec operator*(const cmat &m, const cvec &v) { it_assert_debug(m.cols() == v.size(), "cmat::operator*(): Wrong sizes"); int m_r = m.rows(); int m_c = m.cols(); cvec r(m_r); std::complex alpha = std::complex(1.0); std::complex beta = std::complex(0.0); char trans = 'n'; int incr = 1; blas::zgemv_(&trans, &m_r, &m_c, &alpha, m._data(), &m_r, v._data(), &incr, &beta, r._data(), &incr); return r; } #else template<> vec operator*(const mat &m, const vec &v) { it_assert_debug(m.cols() == v.size(), "Mat<>::operator*(): Wrong sizes"); vec r(m.rows()); for (int i = 0; i < m.rows(); i++) { r(i) = 0.0; int m_pos = 0; for (int k = 0; k < m.cols(); k++) { r(i) += m._data()[m_pos+i] * v(k); m_pos += m.rows(); } } return r; } template<> cvec operator*(const cmat &m, const cvec &v) { it_assert_debug(m.cols() == v.size(), "Mat<>::operator*(): Wrong sizes"); cvec r(m.rows()); for (int i = 0; i < m.rows(); i++) { r(i) = std::complex(0.0); int m_pos = 0; for (int k = 0; k < m.cols(); k++) { r(i) += m._data()[m_pos+i] * v(k); m_pos += m.rows(); } } return r; } #endif // HAVE_BLAS //--------------------------------------------------------------------- // Instantiations //--------------------------------------------------------------------- // class instantiations template class ITPP_EXPORT Mat; template class ITPP_EXPORT Mat >; template class ITPP_EXPORT Mat; template class ITPP_EXPORT Mat; template class ITPP_EXPORT Mat; // addition operators template ITPP_EXPORT mat operator+(const mat &m1, const mat &m2); template ITPP_EXPORT cmat operator+(const cmat &m1, const cmat &m2); template ITPP_EXPORT imat operator+(const imat &m1, const imat &m2); template ITPP_EXPORT smat operator+(const smat &m1, const smat &m2); template ITPP_EXPORT bmat operator+(const bmat &m1, const bmat &m2); template ITPP_EXPORT mat operator+(const mat &m, double t); template ITPP_EXPORT cmat operator+(const cmat &m, std::complex t); template ITPP_EXPORT imat operator+(const imat &m, int t); template ITPP_EXPORT smat operator+(const smat &m, short t); template ITPP_EXPORT bmat operator+(const bmat &m, bin t); template ITPP_EXPORT mat operator+(double t, const mat &m); template ITPP_EXPORT cmat operator+(std::complex t, const cmat &m); template ITPP_EXPORT imat operator+(int t, const imat &m); template ITPP_EXPORT smat operator+(short t, const smat &m); template ITPP_EXPORT bmat operator+(bin t, const bmat &m); // subraction operators template ITPP_EXPORT mat operator-(const mat &m1, const mat &m2); template ITPP_EXPORT cmat operator-(const cmat &m1, const cmat &m2); template ITPP_EXPORT imat operator-(const imat &m1, const imat &m2); template ITPP_EXPORT smat operator-(const smat &m1, const smat &m2); template ITPP_EXPORT bmat operator-(const bmat &m1, const bmat &m2); template ITPP_EXPORT mat operator-(const mat &m, double t); template ITPP_EXPORT cmat operator-(const cmat &m, std::complex t); template ITPP_EXPORT imat operator-(const imat &m, int t); template ITPP_EXPORT smat operator-(const smat &m, short t); template ITPP_EXPORT bmat operator-(const bmat &m, bin t); template ITPP_EXPORT mat operator-(double t, const mat &m); template ITPP_EXPORT cmat operator-(std::complex t, const cmat &m); template ITPP_EXPORT imat operator-(int t, const imat &m); template ITPP_EXPORT smat operator-(short t, const smat &m); template ITPP_EXPORT bmat operator-(bin t, const bmat &m); // unary minus template ITPP_EXPORT mat operator-(const mat &m); template ITPP_EXPORT cmat operator-(const cmat &m); template ITPP_EXPORT imat operator-(const imat &m); template ITPP_EXPORT smat operator-(const smat &m); template ITPP_EXPORT bmat operator-(const bmat &m); // multiplication operators template ITPP_EXPORT imat operator*(const imat &m1, const imat &m2); template ITPP_EXPORT smat operator*(const smat &m1, const smat &m2); template ITPP_EXPORT bmat operator*(const bmat &m1, const bmat &m2); template ITPP_EXPORT ivec operator*(const imat &m, const ivec &v); template ITPP_EXPORT svec operator*(const smat &m, const svec &v); template ITPP_EXPORT bvec operator*(const bmat &m, const bvec &v); template ITPP_EXPORT mat operator*(const mat &m, double t); template ITPP_EXPORT cmat operator*(const cmat &m, std::complex t); template ITPP_EXPORT imat operator*(const imat &m, int t); template ITPP_EXPORT smat operator*(const smat &m, short t); template ITPP_EXPORT bmat operator*(const bmat &m, bin t); template ITPP_EXPORT mat operator*(double t, const mat &m); template ITPP_EXPORT cmat operator*(std::complex t, const cmat &m); template ITPP_EXPORT imat operator*(int t, const imat &m); template ITPP_EXPORT smat operator*(short t, const smat &m); template ITPP_EXPORT bmat operator*(bin t, const bmat &m); // elementwise multiplication template ITPP_EXPORT mat elem_mult(const mat &m1, const mat &m2); template ITPP_EXPORT cmat elem_mult(const cmat &m1, const cmat &m2); template ITPP_EXPORT imat elem_mult(const imat &m1, const imat &m2); template ITPP_EXPORT smat elem_mult(const smat &m1, const smat &m2); template ITPP_EXPORT bmat elem_mult(const bmat &m1, const bmat &m2); template ITPP_EXPORT void elem_mult_out(const mat &m1, const mat &m2, mat &out); template ITPP_EXPORT void elem_mult_out(const cmat &m1, const cmat &m2, cmat &out); template ITPP_EXPORT void elem_mult_out(const imat &m1, const imat &m2, imat &out); template ITPP_EXPORT void elem_mult_out(const smat &m1, const smat &m2, smat &out); template ITPP_EXPORT void elem_mult_out(const bmat &m1, const bmat &m2, bmat &out); template ITPP_EXPORT void elem_mult_out(const mat &m1, const mat &m2, const mat &m3, mat &out); template ITPP_EXPORT void elem_mult_out(const cmat &m1, const cmat &m2, const cmat &m3, cmat &out); template ITPP_EXPORT void elem_mult_out(const imat &m1, const imat &m2, const imat &m3, imat &out); template ITPP_EXPORT void elem_mult_out(const smat &m1, const smat &m2, const smat &m3, smat &out); template ITPP_EXPORT void elem_mult_out(const bmat &m1, const bmat &m2, const bmat &m3, bmat &out); template ITPP_EXPORT void elem_mult_out(const mat &m1, const mat &m2, const mat &m3, const mat &m4, mat &out); template ITPP_EXPORT void elem_mult_out(const cmat &m1, const cmat &m2, const cmat &m3, const cmat &m4, cmat &out); template ITPP_EXPORT void elem_mult_out(const imat &m1, const imat &m2, const imat &m3, const imat &m4, imat &out); template ITPP_EXPORT void elem_mult_out(const smat &m1, const smat &m2, const smat &m3, const smat &m4, smat &out); template ITPP_EXPORT void elem_mult_out(const bmat &m1, const bmat &m2, const bmat &m3, const bmat &m4, bmat &out); template ITPP_EXPORT void elem_mult_inplace(const mat &m1, mat &m2); template ITPP_EXPORT void elem_mult_inplace(const cmat &m1, cmat &m2); template ITPP_EXPORT void elem_mult_inplace(const imat &m1, imat &m2); template ITPP_EXPORT void elem_mult_inplace(const smat &m1, smat &m2); template ITPP_EXPORT void elem_mult_inplace(const bmat &m1, bmat &m2); template ITPP_EXPORT double elem_mult_sum(const mat &m1, const mat &m2); template ITPP_EXPORT std::complex elem_mult_sum(const cmat &m1, const cmat &m2); template ITPP_EXPORT int elem_mult_sum(const imat &m1, const imat &m2); template ITPP_EXPORT short elem_mult_sum(const smat &m1, const smat &m2); template ITPP_EXPORT bin elem_mult_sum(const bmat &m1, const bmat &m2); // division operator template ITPP_EXPORT mat operator/(double t, const mat &m); template ITPP_EXPORT cmat operator/(std::complex t, const cmat &m); template ITPP_EXPORT imat operator/(int t, const imat &m); template ITPP_EXPORT smat operator/(short t, const smat &m); template ITPP_EXPORT bmat operator/(bin t, const bmat &m); template ITPP_EXPORT mat operator/(const mat &m, double t); template ITPP_EXPORT cmat operator/(const cmat &m, std::complex t); template ITPP_EXPORT imat operator/(const imat &m, int t); template ITPP_EXPORT smat operator/(const smat &m, short t); template ITPP_EXPORT bmat operator/(const bmat &m, bin t); // elementwise division template ITPP_EXPORT mat elem_div(const mat &m1, const mat &m2); template ITPP_EXPORT cmat elem_div(const cmat &m1, const cmat &m2); template ITPP_EXPORT imat elem_div(const imat &m1, const imat &m2); template ITPP_EXPORT smat elem_div(const smat &m1, const smat &m2); template ITPP_EXPORT bmat elem_div(const bmat &m1, const bmat &m2); template ITPP_EXPORT void elem_div_out(const mat &m1, const mat &m2, mat &out); template ITPP_EXPORT void elem_div_out(const cmat &m1, const cmat &m2, cmat &out); template ITPP_EXPORT void elem_div_out(const imat &m1, const imat &m2, imat &out); template ITPP_EXPORT void elem_div_out(const smat &m1, const smat &m2, smat &out); template ITPP_EXPORT void elem_div_out(const bmat &m1, const bmat &m2, bmat &out); template ITPP_EXPORT double elem_div_sum(const mat &m1, const mat &m2); template ITPP_EXPORT std::complex elem_div_sum(const cmat &m1, const cmat &m2); template ITPP_EXPORT int elem_div_sum(const imat &m1, const imat &m2); template ITPP_EXPORT short elem_div_sum(const smat &m1, const smat &m2); template ITPP_EXPORT bin elem_div_sum(const bmat &m1, const bmat &m2); // concatenation template ITPP_EXPORT mat concat_horizontal(const mat &m1, const mat &m2); template ITPP_EXPORT cmat concat_horizontal(const cmat &m1, const cmat &m2); template ITPP_EXPORT imat concat_horizontal(const imat &m1, const imat &m2); template ITPP_EXPORT smat concat_horizontal(const smat &m1, const smat &m2); template ITPP_EXPORT bmat concat_horizontal(const bmat &m1, const bmat &m2); template ITPP_EXPORT mat concat_vertical(const mat &m1, const mat &m2); template ITPP_EXPORT cmat concat_vertical(const cmat &m1, const cmat &m2); template ITPP_EXPORT imat concat_vertical(const imat &m1, const imat &m2); template ITPP_EXPORT smat concat_vertical(const smat &m1, const smat &m2); template ITPP_EXPORT bmat concat_vertical(const bmat &m1, const bmat &m2); // I/O streams template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const mat &m); template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const cmat &m); template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const imat &m); template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const smat &m); template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const bmat &m); template ITPP_EXPORT std::istream &operator>>(std::istream &is, mat &m); template ITPP_EXPORT std::istream &operator>>(std::istream &is, cmat &m); template ITPP_EXPORT std::istream &operator>>(std::istream &is, imat &m); template ITPP_EXPORT std::istream &operator>>(std::istream &is, smat &m); template ITPP_EXPORT std::istream &operator>>(std::istream &is, bmat &m); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/mat.h000066400000000000000000002100041216575753400153270ustar00rootroot00000000000000/*! * \file * \brief Matrix Class Definitions * \author Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MAT_H #define MAT_H #include #include #include #include namespace itpp { // Declaration of Vec template class Vec; // Declaration of Mat template class Mat; // Declaration of bin class bin; //! Horizontal concatenation of two matrices template Mat concat_horizontal(const Mat &m1, const Mat &m2); //! Vertical concatenation of two matrices template Mat concat_vertical(const Mat &m1, const Mat &m2); //! Addition of two matrices template Mat operator+(const Mat &m1, const Mat &m2); //! Addition of a matrix and a scalar template Mat operator+(const Mat &m, Num_T t); //! Addition of a scalar and a matrix template Mat operator+(Num_T t, const Mat &m); //! Subtraction of two matrices template Mat operator-(const Mat &m1, const Mat &m2); //! Subtraction of matrix and scalar template Mat operator-(const Mat &m, Num_T t); //! Subtraction of scalar and matrix template Mat operator-(Num_T t, const Mat &m); //! Negation of matrix template Mat operator-(const Mat &m); //! Multiplication of two matrices template Mat operator*(const Mat &m1, const Mat &m2); //! Multiplication of matrix and vector template Vec operator*(const Mat &m, const Vec &v); //! Multiplication of matrix and scalar template Mat operator*(const Mat &m, Num_T t); //! Multiplication of scalar and matrix template Mat operator*(Num_T t, const Mat &m); //! Element wise multiplication of two matrices template Mat elem_mult(const Mat &m1, const Mat &m2); //! Element wise multiplication of two matrices, storing the result in matrix \c out template void elem_mult_out(const Mat &m1, const Mat &m2, Mat &out); //! Element wise multiplication of three matrices, storing the result in matrix \c out template void elem_mult_out(const Mat &m1, const Mat &m2, const Mat &m3, Mat &out); //! Element wise multiplication of four matrices, storing the result in matrix \c out template void elem_mult_out(const Mat &m1, const Mat &m2, const Mat &m3, const Mat &m4, Mat &out); //! In-place element wise multiplication of two matrices. Fast version of B = elem_mult(A, B). template void elem_mult_inplace(const Mat &m1, Mat &m2); //! Element wise multiplication of two matrices, followed by summation of the resultant elements. Fast version of sumsum(elem_mult(A, B)). template Num_T elem_mult_sum(const Mat &m1, const Mat &m2); //! Element-wise division by a scalar template Mat operator/(const Mat &m, Num_T t); //! Element-wise division (\c t is the dividend, elements of \c m are divisors) template Mat operator/(Num_T t, const Mat &m); //! Element wise division of two matrices template Mat elem_div(const Mat &m1, const Mat &m2); //! Element wise division of two matrices, storing the result in matrix \c out template void elem_div_out(const Mat &m1, const Mat &m2, Mat &out); //! Element wise division of two matrices, followed by summation of the resultant elements. Fast version of sumsum(elem_div(A, B)). template Num_T elem_div_sum(const Mat &m1, const Mat &m2); // ------------------------------------------------------------------------------------- // Declaration of Mat // ------------------------------------------------------------------------------------- /*! \ingroup arr_vec_mat \brief Matrix Class (Templated) \author Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson Matrices can be of arbitrarily types, but conversions and functions are prepared for \c bin, \c short, \c int, \c double, and \c complex vectors and these are predefined as: \c bmat, \c smat, \c imat, \c mat, and \c cmat. \c double and \c complex are usually \c double and \c complex respectively. However, this can be changed when compiling the it++ (see installation notes for more details). (Note: for binary matrices, an alternative to the bmat class is \c GF2mat and \c GF2mat_dense, which offer a more memory efficient representation and additional functions for linear algebra.) Examples: Matrix Constructors: When constructing a matrix without dimensions (memory) use \code mat temp; \endcode For construction of a matrix of a given size use \code mat temp(rows, cols); \endcode It is also possible to assign the constructed matrix the value and dimension of another matrix by \code vec temp(inmatrix); \endcode If you have explicit values you would like to assign to the matrix it is possible to do this using strings as: \code mat a("0 0.7;5 9.3"); // that is a = [0, 0.7; 5, 9.3] mat a="0 0.7;5 9.3"; // the constructor are called implicitly \endcode It is also possible to change dimension by \code temp.set_size(new_rows, new_cols, false); \endcode where \c false is used to indicate that the old values in \c temp is not copied. If you like to preserve the values use \c true. There are a number of methods to access parts of a matrix. Examples are \code a(5,3); // Element number (5,3) a(5,9,3,5); // Sub-matrix from rows 5, 6, 7, 8, 9 the columns 3, 4, and 5 a.get_row(10); // Row 10 a.get_col(10); // Column 10 \endcode It is also possible to modify parts of a vector as e.g. in \code a.set_row(5, invector); // Set row 5 to \c invector a.set_col(3, invector); // Set column 3 to \c invector a.copy_col(1, 5); // Copy column 5 to column 1 a.swap_cols(1, 5); // Swap the contents of columns 1 and 5 \endcode It is of course also possible to perform the common linear algebra methods such as addition, subtraction, and matrix multiplication. Observe though, that vectors are assumed to be column-vectors in operations with matrices. Most elementary functions such as sin(), cosh(), log(), abs(), ..., are available as operations on the individual elements of the matrices. Please see the individual functions for more details. By default, the Mat elements are created using the default constructor for the element type. This can be changed by specifying a suitable Factory in the Mat constructor call; see Detailed Description for Factory. */ template class Mat { public: //! The type of the matrix values typedef Num_T value_type; //! Default constructor. An element factory \c f can be specified explicit Mat(const Factory &f = DEFAULT_FACTORY); //! Create a matrix of size (rows, cols). An element factory \c f can be specified. Mat(int rows, int cols, const Factory &f = DEFAULT_FACTORY); //! Copy constructor Mat(const Mat &m); //! Constructor, similar to the copy constructor, but also takes an element factory \c f as argument Mat(const Mat &m, const Factory &f); //! Construct a matrix from a column vector \c v. An element factory \c f can be specified. Mat(const Vec &v, const Factory &f = DEFAULT_FACTORY); //! Set matrix equal to values in string \c str. An element factory \c f can be specified. Mat(const std::string &str, const Factory &f = DEFAULT_FACTORY); //! Set matrix equal to values in string \c str. An element factory \c f can be specified. Mat(const char *str, const Factory &f = DEFAULT_FACTORY); /*! * \brief Constructor taking a C-array as input. An element factory \c f * can be specified. * * By default the matrix is stored as a row-major matrix (i.e. listing * elements in sequence beginning with the first column). */ Mat(const Num_T *c_array, int rows, int cols, bool row_major = true, const Factory &f = DEFAULT_FACTORY); //! Destructor ~Mat(); //! The number of columns int cols() const { return no_cols; } //! The number of rows int rows() const { return no_rows; } //! The number of elements int size() const { return datasize; } //! Set size of matrix. If copy = true then keep the data before resizing. void set_size(int rows, int cols, bool copy = false); //! Set matrix equal to the all zero matrix void zeros(); //! Set matrix equal to the all zero matrix void clear() { zeros(); } //! Set matrix equal to the all one matrix void ones(); //! Set matrix equal to values in the string \c str void set(const std::string &str); //! Set matrix equal to values in the string \c str void set(const char *str); //! Get element (r,c) from matrix const Num_T &operator()(int r, int c) const; //! Get element (r,c) from matrix Num_T &operator()(int r, int c); //! Get element \c i using linear addressing (by rows) const Num_T &operator()(int i) const; //! Get element \c i using linear addressing (by rows) Num_T &operator()(int i); //! Get element (r,c) from matrix const Num_T &get(int r, int c) const; //! Get element \c i using linear addressing (by rows) const Num_T &get(int i) const; //! Set element (r,c) of matrix void set(int r, int c, Num_T t); /*! \brief Sub-matrix from row \c r1 to row \c r2 and columns \c c1 to \c c2. Value -1 indicates the last row and column, respectively. */ Mat operator()(int r1, int r2, int c1, int c2) const; /*! \brief Sub-matrix from row \c r1 to row \c r2 and columns \c c1 to \c c2. Value -1 indicates the last row and column, respectively. */ Mat get(int r1, int r2, int c1, int c2) const; //! Get row \c r Vec get_row(int r) const; //! Get rows \c r1 through \c r2 Mat get_rows(int r1, int r2) const; //! Get the rows specified by \c indexlist Mat get_rows(const Vec &indexlist) const; //! Get column \c c Vec get_col(int c) const; //! Get columns \c c1 through \c c2 Mat get_cols(int c1, int c2) const; //! Get the columns specified by \c indexlist Mat get_cols(const Vec &indexlist) const; //! Set row \c r to vector \c v void set_row(int r, const Vec &v); //! Set column \c c to vector \c v void set_col(int c, const Vec &v); //! Set rows to matrix \c m, staring from row \c r void set_rows(int r, const Mat &m); //! Set columns to matrix \c m, starting from column \c c void set_cols(int c, const Mat &m); //! Copy row \c from onto row \c to void copy_row(int to, int from); //! Copy column \c from onto column \c to void copy_col(int to, int from); //! Swap the rows \c r1 and \c r2 void swap_rows(int r1, int r2); //! Swap the columns \c c1 and \c c2 void swap_cols(int c1, int c2); //! This function is deprecated. Please use set_submatrix(int r, int c, const Mat<> &m) instead. void set_submatrix(int r1, int r2, int c1, int c2, const Mat &m); //! Set submatrix defined by upper-left element (r,c) and the size of matrix m to m void set_submatrix(int r, int c, const Mat &m); //! Set all elements of submatrix defined by rows r1,r2 and columns c1,c2 to value t void set_submatrix(int r1, int r2, int c1, int c2, Num_T t); //! Delete row number \c r void del_row(int r); //! Delete rows from \c r1 to \c r2 void del_rows(int r1, int r2); //! Delete column number \c c void del_col(int c); //! Delete columns from \c c1 to \c c2 void del_cols(int c1, int c2); //! Insert vector \c v at row number \c r. The matrix can be empty. void ins_row(int r, const Vec &v); //! Insert vector \c v at column number \c c. The matrix can be empty. void ins_col(int c, const Vec &v); //! Append vector \c v to the bottom of the matrix. The matrix can be empty. void append_row(const Vec &v); //! Append vector \c v to the right side of the matrix. The matrix can be empty. void append_col(const Vec &v); //! Matrix transpose Mat transpose() const; //! Matrix transpose Mat T() const { return this->transpose(); } //! Hermitian matrix transpose (conjugate transpose) Mat hermitian_transpose() const; //! Hermitian matrix transpose (conjugate transpose) Mat H() const { return this->hermitian_transpose(); } //! Concatenate the matrices \c m1 and \c m2 horizontally friend Mat concat_horizontal<>(const Mat &m1, const Mat &m2); //! Concatenate the matrices \c m1 and \c m2 vertically friend Mat concat_vertical<>(const Mat &m1, const Mat &m2); //! Set all elements of the matrix equal to \c t Mat& operator=(Num_T t); //! Set matrix equal to \c m Mat& operator=(const Mat &m); //! Set matrix equal to the vector \c v, assuming column vector Mat& operator=(const Vec &v); //! Set matrix equal to values in the string \c str Mat& operator=(const std::string &str); //! Set matrix equal to values in the string \c str Mat& operator=(const char *str); //! Addition of matrices Mat& operator+=(const Mat &m); //! Addition of scalar to matrix Mat& operator+=(Num_T t); //! Addition of two matrices friend Mat operator+<>(const Mat &m1, const Mat &m2); //! Addition of matrix and scalar friend Mat operator+<>(const Mat &m, Num_T t); //! Addition of scalar and matrix friend Mat operator+<>(Num_T t, const Mat &m); //! Subtraction of matrix Mat& operator-=(const Mat &m); //! Subtraction of scalar from matrix Mat& operator-=(Num_T t); //! Subtraction of \c m2 from \c m1 friend Mat operator-<>(const Mat &m1, const Mat &m2); //! Subtraction of scalar from matrix friend Mat operator-<>(const Mat &m, Num_T t); //! Subtract matrix from scalar friend Mat operator-<>(Num_T t, const Mat &m); //! Subtraction of matrix friend Mat operator-<>(const Mat &m); //! Matrix multiplication Mat& operator*=(const Mat &m); //! Multiplication by a scalar Mat& operator*=(Num_T t); //! Element wise multiplication of two matrices friend Mat elem_mult<>(const Mat &m1, const Mat &m2); //! Element wise multiplication of two matrices, storing the result in matrix \c out friend void elem_mult_out<>(const Mat &m1, const Mat &m2, Mat &out); //! Element wise multiplication of three matrices, storing the result in matrix \c out friend void elem_mult_out<>(const Mat &m1, const Mat &m2, const Mat &m3, Mat &out); //! Element wise multiplication of four matrices, storing the result in matrix \c out friend void elem_mult_out<>(const Mat &m1, const Mat &m2, const Mat &m3, const Mat &m4, Mat &out); //! In-place element wise multiplication of two matrices. Fast version of B = elem_mult(A, B). friend void elem_mult_inplace<>(const Mat &m1, Mat &m2); //! Element wise multiplication of two matrices, followed by summation of the resultant elements. Fast version of sumsum(elem_mult(A, B)). friend Num_T elem_mult_sum<>(const Mat &m1, const Mat &m2); //! Division by a scalar Mat& operator/=(Num_T t); //! Element-wise division with the current matrix Mat& operator/=(const Mat &m); //! Element-wise division by a scalar friend Mat operator/<>(const Mat &m, Num_T t); //! Element-wise division (\c t is the dividend, elements of \c m are divisors) friend Mat operator/<>(Num_T t, const Mat &m); //! Element wise division of two matrices friend Mat elem_div<>(const Mat &m1, const Mat &m2); //! Element wise division of two matrices, storing the result in matrix \c out friend void elem_div_out<>(const Mat &m1, const Mat &m2, Mat &out); //! Element wise division of two matrices, followed by summation of the resultant elements. Fast version of sumsum(elem_div(A, B)). friend Num_T elem_div_sum<>(const Mat &m1, const Mat &m2); //! Compare two matrices. False if wrong sizes or different values bool operator==(const Mat &m) const; //! Compare two matrices. True if different bool operator!=(const Mat &m) const; //! Get element (r,c) from matrix without boundary check (not recommended to use) Num_T &_elem(int r, int c) { return data[r+c*no_rows]; } //! Get element (r,c) from matrix without boundary check (not recommended to use) const Num_T &_elem(int r, int c) const { return data[r+c*no_rows]; } //! Get element \c i using linear addressing (by rows) without boundary check (not recommended to use) Num_T &_elem(int i) { return data[i]; } //! Get element \c i using linear addressing (by rows) without boundary check (not recommended to use) const Num_T &_elem(int i) const { return data[i]; } //! Access of the internal data structure (not recommended to use) Num_T *_data() { return data; } //! Access to the internal data structure (not recommended to use) const Num_T *_data() const { return data; } //! Access to the internal data structure (not recommended to use) int _datasize() const { return datasize; } protected: //! Allocate memory for the matrix void alloc(int rows, int cols); //! Free the memory space of the matrix void free(); /*! Protected integer variables * @{ */ int datasize, no_rows, no_cols; /*! @} */ //! Protected data pointer Num_T *data; //! Element factory (set to DEFAULT_FACTORY to use Num_T default constructors only) const Factory &factory; private: //! Check whether element (r,c) is within the matrix bool in_range(int r, int c) const { return ((r >= 0) && (r < no_rows) && (c >= 0) && (c < no_cols)); } //! Check whether row \c r is in the allowed range bool row_in_range(int r) const { return ((r >= 0) && (r < no_rows)); } //! Check whether column \c c is in the allowed range bool col_in_range(int c) const { return ((c >= 0) && (c < no_cols)); } //! Check whether element \c i is in the allowed range bool in_range(int i) const { return ((i >= 0) && (i < datasize)); } }; // ------------------------------------------------------------------------------------- // Type definitions of mat, cmat, imat, smat, and bmat // ------------------------------------------------------------------------------------- /*! \relates Mat \brief Default Matrix Type */ typedef Mat mat; /*! \relates Mat \brief Default Complex Matrix Type */ typedef Mat > cmat; /*! \relates Mat \brief Integer matrix */ typedef Mat imat; /*! \relates Mat \brief short int matrix */ typedef Mat smat; /*! \relates Mat \relates GF2mat \relates GF2mat_sparse \brief bin matrix */ typedef Mat bmat; } //namespace itpp #include namespace itpp { // ---------------------------------------------------------------------- // Declaration of input and output streams for Mat // ---------------------------------------------------------------------- /*! \relatesalso Mat \brief Output stream for matrices */ template std::ostream &operator<<(std::ostream &os, const Mat &m); /*! \relatesalso Mat \brief Input stream for matrices The input can be on the form "1 2 3; 4 5 6" or "[[1 2 3][4 5 6]]", i.e. with brackets or semicolons as row delimiters. The first form is compatible with the set method, while the second form is compatible with the ostream operator. The elements on a row can be separated by blank space or commas. Rows that are shorter than the longest row are padded with zero elements. "[]" means an empty matrix. */ template std::istream &operator>>(std::istream &is, Mat &m); // ---------------------------------------------------------------------- // Implementation of templated Mat members and friends // ---------------------------------------------------------------------- template inline void Mat::alloc(int rows, int cols) { if ((rows > 0) && (cols > 0)) { datasize = rows * cols; no_rows = rows; no_cols = cols; create_elements(data, datasize, factory); } else { data = 0; datasize = 0; no_rows = 0; no_cols = 0; } } template inline void Mat::free() { destroy_elements(data, datasize); datasize = 0; no_rows = 0; no_cols = 0; } template inline Mat::Mat(const Factory &f) : datasize(0), no_rows(0), no_cols(0), data(0), factory(f) {} template inline Mat::Mat(int rows, int cols, const Factory &f) : datasize(0), no_rows(0), no_cols(0), data(0), factory(f) { it_assert_debug((rows >= 0) && (cols >= 0), "Mat<>::Mat(): Wrong size"); alloc(rows, cols); } template inline Mat::Mat(const Mat &m) : datasize(0), no_rows(0), no_cols(0), data(0), factory(m.factory) { alloc(m.no_rows, m.no_cols); copy_vector(m.datasize, m.data, data); } template inline Mat::Mat(const Mat &m, const Factory &f) : datasize(0), no_rows(0), no_cols(0), data(0), factory(f) { alloc(m.no_rows, m.no_cols); copy_vector(m.datasize, m.data, data); } template inline Mat::Mat(const Vec &v, const Factory &f) : datasize(0), no_rows(0), no_cols(0), data(0), factory(f) { int size = v.size(); alloc(size, 1); copy_vector(size, v._data(), data); } template inline Mat::Mat(const std::string &str, const Factory &f) : datasize(0), no_rows(0), no_cols(0), data(0), factory(f) { set(str); } template inline Mat::Mat(const char *str, const Factory &f) : datasize(0), no_rows(0), no_cols(0), data(0), factory(f) { set(std::string(str)); } template Mat::Mat(const Num_T *c_array, int rows, int cols, bool row_major, const Factory &f): datasize(0), no_rows(0), no_cols(0), data(0), factory(f) { alloc(rows, cols); if (!row_major) copy_vector(datasize, c_array, data); else for (int i = 0; i < rows; i++) for (int j = 0; j < cols; j++) data[i+j*no_rows] = c_array[i*no_cols+j]; } template inline Mat::~Mat() { free(); } template void Mat::set_size(int rows, int cols, bool copy) { it_assert_debug((rows >= 0) && (cols >= 0), "Mat<>::set_size(): Wrong size"); // check if we have to resize the current matrix if ((no_rows == rows) && (no_cols == cols)) return; // check if one of dimensions is zero if ((rows == 0) || (cols == 0)) { free(); return; } // conditionally copy previous matrix content if (copy) { // create a temporary pointer to the allocated data Num_T* tmp = data; // store the current number of elements and number of rows int old_datasize = datasize; int old_rows = no_rows; // check the boundaries of the copied data int min_r = (no_rows < rows) ? no_rows : rows; int min_c = (no_cols < cols) ? no_cols : cols; // allocate new memory alloc(rows, cols); // copy the previous data into the allocated memory for (int i = 0; i < min_c; ++i) { copy_vector(min_r, &tmp[i*old_rows], &data[i*no_rows]); } // fill-in the rest of matrix with zeros for (int i = min_r; i < rows; ++i) for (int j = 0; j < cols; ++j) data[i+j*rows] = Num_T(0); for (int j = min_c; j < cols; ++j) for (int i = 0; i < min_r; ++i) data[i+j*rows] = Num_T(0); // delete old elements destroy_elements(tmp, old_datasize); } // if possible, reuse the allocated memory else if (datasize == rows * cols) { no_rows = rows; no_cols = cols; } // finally release old memory and allocate a new one else { free(); alloc(rows, cols); } } template inline void Mat::zeros() { for (int i = 0; i < datasize; i++) data[i] = Num_T(0); } template inline void Mat::ones() { for (int i = 0; i < datasize; i++) data[i] = Num_T(1); } template inline const Num_T& Mat::operator()(int r, int c) const { it_assert_debug(in_range(r, c), "Mat<>::operator(): Indexing out of range"); return data[r+c*no_rows]; } template inline Num_T& Mat::operator()(int r, int c) { it_assert_debug(in_range(r, c), "Mat<>::operator(): Indexing out of range"); return data[r+c*no_rows]; } template inline Num_T& Mat::operator()(int i) { it_assert_debug(in_range(i), "Mat<>::operator(): Index out of range"); return data[i]; } template inline const Num_T& Mat::operator()(int i) const { it_assert_debug(in_range(i), "Mat<>::operator(): Index out of range"); return data[i]; } template inline const Num_T& Mat::get(int r, int c) const { return (*this)(r, c); } template inline const Num_T& Mat::get(int i) const { return (*this)(i); } template inline void Mat::set(int r, int c, Num_T t) { it_assert_debug(in_range(r, c), "Mat<>::set(): Indexing out of range"); data[r+c*no_rows] = t; } template void Mat::set(const std::string &str) { // actual row counter int rows = 0; // number of rows to allocate next time (8, 16, 32, 64, etc.) int maxrows = 8; // clean the current matrix content free(); // variable to store the start of a current vector std::string::size_type beg = 0; std::string::size_type end = 0; while (end != std::string::npos) { // find next occurrence of a semicolon in string str end = str.find(';', beg); // parse first row into a vector v Vec v(str.substr(beg, end - beg)); int v_size = v.size(); // this check is necessary to parse the following two strings as the // same matrix: "1 0 1; ; 1 1; " and "1 0 1; 0 0 0; 1 1 0" if ((end != std::string::npos) || (v_size > 0)) { // matrix empty -> insert v as a first row and allocate maxrows if (rows == 0) { set_size(maxrows, v_size, true); set_row(rows++, v); } else { // check if we need to resize the matrix if ((rows == maxrows) || (v_size != no_cols)) { // we need to add new rows if (rows == maxrows) { maxrows *= 2; } // check if we need to add new columns if (v_size > no_cols) { set_size(maxrows, v_size, true); } else { set_size(maxrows, no_cols, true); // set the size of the parsed vector to the number of columns v.set_size(no_cols, true); } } // set the parsed vector as the next row set_row(rows++, v); } } // update the starting position of the next vector in the parsed // string beg = end + 1; } // if ((end != std::string::npos) || (v.size > 0)) set_size(rows, no_cols, true); } template inline void Mat::set(const char *str) { set(std::string(str)); } template inline Mat Mat::operator()(int r1, int r2, int c1, int c2) const { if (r1 == -1) r1 = no_rows - 1; if (r2 == -1) r2 = no_rows - 1; if (c1 == -1) c1 = no_cols - 1; if (c2 == -1) c2 = no_cols - 1; it_assert_debug((r1 >= 0) && (r1 <= r2) && (r2 < no_rows) && (c1 >= 0) && (c1 <= c2) && (c2 < no_cols), "Mat<>::operator()(r1, r2, c1, c2): Wrong indexing"); Mat s(r2 - r1 + 1, c2 - c1 + 1); for (int i = 0;i < s.no_cols;i++) copy_vector(s.no_rows, data + r1 + (c1 + i)*no_rows, s.data + i*s.no_rows); return s; } template inline Mat Mat::get(int r1, int r2, int c1, int c2) const { return (*this)(r1, r2, c1, c2); } template inline Vec Mat::get_row(int r) const { it_assert_debug(row_in_range(r), "Mat<>::get_row(): Index out of range"); Vec a(no_cols); copy_vector(no_cols, data + r, no_rows, a._data(), 1); return a; } template Mat Mat::get_rows(int r1, int r2) const { it_assert_debug((r1 >= 0) && (r1 <= r2) && (r2 < no_rows), "Mat<>::get_rows(): Wrong indexing"); Mat m(r2 - r1 + 1, no_cols); for (int i = 0; i < m.rows(); i++) copy_vector(no_cols, data + i + r1, no_rows, m.data + i, m.no_rows); return m; } template Mat Mat::get_rows(const Vec &indexlist) const { Mat m(indexlist.size(), no_cols); for (int i = 0;i < indexlist.size();i++) { it_assert_debug(row_in_range(indexlist(i)), "Mat<>::get_rows(indexlist): Indexing out of range"); copy_vector(no_cols, data + indexlist(i), no_rows, m.data + i, m.no_rows); } return m; } template inline Vec Mat::get_col(int c) const { it_assert_debug(col_in_range(c), "Mat<>::get_col(): Index out of range"); Vec a(no_rows); copy_vector(no_rows, data + c*no_rows, a._data()); return a; } template Mat Mat::get_cols(int c1, int c2) const { it_assert_debug((c1 >= 0) && (c1 <= c2) && (c2 < no_cols), "Mat<>::get_cols(): Wrong indexing"); Mat m(no_rows, c2 - c1 + 1); for (int i = 0; i < m.cols(); i++) copy_vector(no_rows, data + (i + c1)*no_rows, m.data + i*m.no_rows); return m; } template Mat Mat::get_cols(const Vec &indexlist) const { Mat m(no_rows, indexlist.size()); for (int i = 0; i < indexlist.size(); i++) { it_assert_debug(col_in_range(indexlist(i)), "Mat<>::get_cols(indexlist): Indexing out of range"); copy_vector(no_rows, data + indexlist(i)*no_rows, m.data + i*m.no_rows); } return m; } template inline void Mat::set_row(int r, const Vec &v) { it_assert_debug(row_in_range(r), "Mat<>::set_row(): Index out of range"); it_assert_debug(v.size() == no_cols, "Mat<>::set_row(): Wrong size of input vector"); copy_vector(v.size(), v._data(), 1, data + r, no_rows); } template inline void Mat::set_col(int c, const Vec &v) { it_assert_debug(col_in_range(c), "Mat<>::set_col(): Index out of range"); it_assert_debug(v.size() == no_rows, "Mat<>::set_col(): Wrong size of input vector"); copy_vector(v.size(), v._data(), data + c*no_rows); } template void Mat::set_rows(int r, const Mat &m) { it_assert_debug(row_in_range(r), "Mat<>::set_rows(): Index out of range"); it_assert_debug(no_cols == m.cols(), "Mat<>::set_rows(): Column sizes do not match"); it_assert_debug(m.rows() + r <= no_rows, "Mat<>::set_rows(): Not enough rows"); for (int i = 0; i < m.rows(); ++i) { copy_vector(no_cols, m.data + i, m.no_rows, data + i + r, no_rows); } } template void Mat::set_cols(int c, const Mat &m) { it_assert_debug(col_in_range(c), "Mat<>::set_cols(): Index out of range"); it_assert_debug(no_rows == m.rows(), "Mat<>::set_cols(): Row sizes do not match"); it_assert_debug(m.cols() + c <= no_cols, "Mat<>::set_cols(): Not enough colums"); for (int i = 0; i < m.cols(); ++i) { copy_vector(no_rows, m.data + i*no_rows, data + (i + c)*no_rows); } } template inline void Mat::copy_row(int to, int from) { it_assert_debug(row_in_range(to) && row_in_range(from), "Mat<>::copy_row(): Indexing out of range"); if (from == to) return; copy_vector(no_cols, data + from, no_rows, data + to, no_rows); } template inline void Mat::copy_col(int to, int from) { it_assert_debug(col_in_range(to) && col_in_range(from), "Mat<>::copy_col(): Indexing out of range"); if (from == to) return; copy_vector(no_rows, data + from*no_rows, data + to*no_rows); } template inline void Mat::swap_rows(int r1, int r2) { it_assert_debug(row_in_range(r1) && row_in_range(r2), "Mat<>::swap_rows(): Indexing out of range"); if (r1 == r2) return; swap_vector(no_cols, data + r1, no_rows, data + r2, no_rows); } template inline void Mat::swap_cols(int c1, int c2) { it_assert_debug(col_in_range(c1) && col_in_range(c2), "Mat<>::swap_cols(): Indexing out of range"); if (c1 == c2) return; swap_vector(no_rows, data + c1*no_rows, data + c2*no_rows); } template void Mat::set_submatrix(int r1, int, int c1, int, const Mat &m) { it_warning("Mat<>::set_submatrix(r1, r2, r3, r4, m): This function is " "deprecated and might be removed from future IT++ releases. " "Please use Mat<>::set_submatrix(r, c, m) function instead."); set_submatrix(r1, c1, m); } template inline void Mat::set_submatrix(int r, int c, const Mat &m) { it_assert_debug((r >= 0) && (r + m.no_rows <= no_rows) && (c >= 0) && (c + m.no_cols <= no_cols), "Mat<>::set_submatrix(): Indexing out of range " "or wrong input matrix"); for (int i = 0; i < m.no_cols; i++) copy_vector(m.no_rows, m.data + i*m.no_rows, data + (c + i)*no_rows + r); } template inline void Mat::set_submatrix(int r1, int r2, int c1, int c2, Num_T t) { if (r1 == -1) r1 = no_rows - 1; if (r2 == -1) r2 = no_rows - 1; if (c1 == -1) c1 = no_cols - 1; if (c2 == -1) c2 = no_cols - 1; it_assert_debug((r1 >= 0) && (r1 <= r2) && (r2 < no_rows) && (c1 >= 0) && (c1 <= c2) && (c2 < no_cols), "Mat<>::set_submatrix(): Wrong indexing"); for (int i = c1; i <= c2; i++) { int pos = i * no_rows + r1; for (int j = r1; j <= r2; j++) data[pos++] = t; } } template void Mat::del_row(int r) { it_assert_debug(row_in_range(r), "Mat<>::del_row(): Index out of range"); Mat Temp(*this); set_size(no_rows - 1, no_cols, false); for (int i = 0 ; i < r ; i++) { copy_vector(no_cols, &Temp.data[i], no_rows + 1, &data[i], no_rows); } for (int i = r ; i < no_rows ; i++) { copy_vector(no_cols, &Temp.data[i+1], no_rows + 1, &data[i], no_rows); } } template void Mat::del_rows(int r1, int r2) { it_assert_debug((r1 >= 0) && (r1 <= r2) && (r2 < no_rows), "Mat<>::del_rows(): Indexing out of range"); Mat Temp(*this); int no_del_rows = r2 - r1 + 1; set_size(no_rows - no_del_rows, no_cols, false); for (int i = 0; i < r1 ; ++i) { copy_vector(no_cols, &Temp.data[i], Temp.no_rows, &data[i], no_rows); } for (int i = r2 + 1; i < Temp.no_rows; ++i) { copy_vector(no_cols, &Temp.data[i], Temp.no_rows, &data[i-no_del_rows], no_rows); } } template void Mat::del_col(int c) { it_assert_debug(col_in_range(c), "Mat<>::del_col(): Index out of range"); Mat Temp(*this); set_size(no_rows, no_cols - 1, false); copy_vector(c*no_rows, Temp.data, data); copy_vector((no_cols - c)*no_rows, &Temp.data[(c+1)*no_rows], &data[c*no_rows]); } template void Mat::del_cols(int c1, int c2) { it_assert_debug((c1 >= 0) && (c1 <= c2) && (c2 < no_cols), "Mat<>::del_cols(): Indexing out of range"); Mat Temp(*this); int n_deleted_cols = c2 - c1 + 1; set_size(no_rows, no_cols - n_deleted_cols, false); copy_vector(c1*no_rows, Temp.data, data); copy_vector((no_cols - c1)*no_rows, &Temp.data[(c2+1)*no_rows], &data[c1*no_rows]); } template void Mat::ins_row(int r, const Vec &v) { it_assert_debug((r >= 0) && (r <= no_rows), "Mat<>::ins_row(): Index out of range"); it_assert_debug((v.size() == no_cols) || (no_rows == 0), "Mat<>::ins_row(): Wrong size of the input vector"); if (no_cols == 0) { no_cols = v.size(); } Mat Temp(*this); set_size(no_rows + 1, no_cols, false); for (int i = 0 ; i < r ; i++) { copy_vector(no_cols, &Temp.data[i], no_rows - 1, &data[i], no_rows); } copy_vector(no_cols, v._data(), 1, &data[r], no_rows); for (int i = r + 1 ; i < no_rows ; i++) { copy_vector(no_cols, &Temp.data[i-1], no_rows - 1, &data[i], no_rows); } } template void Mat::ins_col(int c, const Vec &v) { it_assert_debug((c >= 0) && (c <= no_cols), "Mat<>::ins_col(): Index out of range"); it_assert_debug((v.size() == no_rows) || (no_cols == 0), "Mat<>::ins_col(): Wrong size of the input vector"); if (no_rows == 0) { no_rows = v.size(); } Mat Temp(*this); set_size(no_rows, no_cols + 1, false); copy_vector(c*no_rows, Temp.data, data); copy_vector(no_rows, v._data(), &data[c*no_rows]); copy_vector((no_cols - c - 1)*no_rows, &Temp.data[c*no_rows], &data[(c+1)*no_rows]); } template inline void Mat::append_row(const Vec &v) { ins_row(no_rows, v); } template inline void Mat::append_col(const Vec &v) { ins_col(no_cols, v); } template Mat Mat::transpose() const { Mat temp(no_cols, no_rows); for (int i = 0; i < no_rows; ++i) { copy_vector(no_cols, &data[i], no_rows, &temp.data[i * no_cols], 1); } return temp; } template Mat Mat::hermitian_transpose() const { Mat temp(no_cols, no_rows); for (int i = 0; i < no_rows; ++i) { copy_vector(no_cols, &data[i], no_rows, &temp.data[i * no_cols], 1); } return temp; } //! \cond template<> ITPP_EXPORT cmat cmat::hermitian_transpose() const; //! \endcond template Mat concat_horizontal(const Mat &m1, const Mat &m2) { // if one of the input matrix is empty just copy the other one as a result if (m1.no_cols == 0) return m2; if (m2.no_cols == 0) return m1; it_assert_debug(m1.no_rows == m2.no_rows, "Mat<>::concat_horizontal(): Wrong sizes"); int no_rows = m1.no_rows; Mat temp(no_rows, m1.no_cols + m2.no_cols); for (int i = 0; i < m1.no_cols; ++i) { copy_vector(no_rows, &m1.data[i * no_rows], &temp.data[i * no_rows]); } for (int i = 0; i < m2.no_cols; ++i) { copy_vector(no_rows, &m2.data[i * no_rows], &temp.data[(m1.no_cols + i) * no_rows]); } return temp; } template Mat concat_vertical(const Mat &m1, const Mat &m2) { // if one of the input matrix is empty just copy the other one as a result if (m1.no_rows == 0) return m2; if (m2.no_rows == 0) return m1; it_assert_debug(m1.no_cols == m2.no_cols, "Mat<>::concat_vertical(): Wrong sizes"); int no_cols = m1.no_cols; Mat temp(m1.no_rows + m2.no_rows, no_cols); for (int i = 0; i < no_cols; ++i) { copy_vector(m1.no_rows, &m1.data[i * m1.no_rows], &temp.data[i * temp.no_rows]); copy_vector(m2.no_rows, &m2.data[i * m2.no_rows], &temp.data[i * temp.no_rows + m1.no_rows]); } return temp; } template inline Mat& Mat::operator=(Num_T t) { for (int i = 0; i < datasize; i++) data[i] = t; return *this; } template inline Mat& Mat::operator=(const Mat &m) { if (this != &m) { set_size(m.no_rows, m.no_cols, false); if (m.datasize != 0) copy_vector(m.datasize, m.data, data); } return *this; } template inline Mat& Mat::operator=(const Vec &v) { it_assert_debug(((no_rows == 1) && (no_cols == v.size())) || ((no_cols == 1) && (no_rows == v.size())), "Mat<>::operator=(): Wrong size of the input vector"); set_size(v.size(), 1, false); copy_vector(v.size(), v._data(), data); return *this; } template inline Mat& Mat::operator=(const std::string &str) { set(str); return *this; } template inline Mat& Mat::operator=(const char *str) { set(std::string(str)); return *this; } //-------------------- Templated friend functions -------------------------- template Mat& Mat::operator+=(const Mat &m) { if (datasize == 0) operator=(m); else { int i, j, m_pos = 0, pos = 0; it_assert_debug(m.no_rows == no_rows && m.no_cols == no_cols, "Mat::operator+=: wrong sizes"); for (i = 0; i < no_cols; i++) { for (j = 0; j < no_rows; j++) data[pos+j] += m.data[m_pos+j]; pos += no_rows; m_pos += m.no_rows; } } return *this; } template inline Mat& Mat::operator+=(Num_T t) { for (int i = 0; i < datasize; i++) data[i] += t; return *this; } template Mat operator+(const Mat &m1, const Mat &m2) { Mat r(m1.no_rows, m1.no_cols); int i, j, m1_pos = 0, m2_pos = 0, r_pos = 0; it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::operator+(): Wrong sizes"); for (i = 0; i < r.no_cols; i++) { for (j = 0; j < r.no_rows; j++) r.data[r_pos+j] = m1.data[m1_pos+j] + m2.data[m2_pos+j]; // next column m1_pos += m1.no_rows; m2_pos += m2.no_rows; r_pos += r.no_rows; } return r; } template Mat operator+(const Mat &m, Num_T t) { Mat r(m.no_rows, m.no_cols); for (int i = 0; i < r.datasize; i++) r.data[i] = m.data[i] + t; return r; } template Mat operator+(Num_T t, const Mat &m) { Mat r(m.no_rows, m.no_cols); for (int i = 0; i < r.datasize; i++) r.data[i] = t + m.data[i]; return r; } template Mat& Mat::operator-=(const Mat &m) { int i, j, m_pos = 0, pos = 0; if (datasize == 0) { set_size(m.no_rows, m.no_cols, false); for (i = 0; i < no_cols; i++) { for (j = 0; j < no_rows; j++) data[pos+j] = -m.data[m_pos+j]; // next column m_pos += m.no_rows; pos += no_rows; } } else { it_assert_debug((m.no_rows == no_rows) && (m.no_cols == no_cols), "Mat<>::operator-=(): Wrong sizes"); for (i = 0; i < no_cols; i++) { for (j = 0; j < no_rows; j++) data[pos+j] -= m.data[m_pos+j]; // next column m_pos += m.no_rows; pos += no_rows; } } return *this; } template Mat operator-(const Mat &m1, const Mat &m2) { Mat r(m1.no_rows, m1.no_cols); int i, j, m1_pos = 0, m2_pos = 0, r_pos = 0; it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::operator-(): Wrong sizes"); for (i = 0; i < r.no_cols; i++) { for (j = 0; j < r.no_rows; j++) r.data[r_pos+j] = m1.data[m1_pos+j] - m2.data[m2_pos+j]; // next column m1_pos += m1.no_rows; m2_pos += m2.no_rows; r_pos += r.no_rows; } return r; } template inline Mat& Mat::operator-=(Num_T t) { for (int i = 0; i < datasize; i++) data[i] -= t; return *this; } template Mat operator-(const Mat &m, Num_T t) { Mat r(m.no_rows, m.no_cols); int i, j, m_pos = 0, r_pos = 0; for (i = 0; i < r.no_cols; i++) { for (j = 0; j < r.no_rows; j++) r.data[r_pos+j] = m.data[m_pos+j] - t; // next column m_pos += m.no_rows; r_pos += r.no_rows; } return r; } template Mat operator-(Num_T t, const Mat &m) { Mat r(m.no_rows, m.no_cols); int i, j, m_pos = 0, r_pos = 0; for (i = 0; i < r.no_cols; i++) { for (j = 0; j < r.no_rows; j++) r.data[r_pos+j] = t - m.data[m_pos+j]; // next column m_pos += m.no_rows; r_pos += r.no_rows; } return r; } template Mat operator-(const Mat &m) { Mat r(m.no_rows, m.no_cols); int i, j, m_pos = 0, r_pos = 0; for (i = 0; i < r.no_cols; i++) { for (j = 0; j < r.no_rows; j++) r.data[r_pos+j] = -m.data[m_pos+j]; // next column m_pos += m.no_rows; r_pos += r.no_rows; } return r; } template Mat& Mat::operator*=(const Mat &m) { it_assert_debug(no_cols == m.no_rows, "Mat<>::operator*=(): Wrong sizes"); Mat r(no_rows, m.no_cols); Num_T tmp; int i, j, k, r_pos = 0, pos = 0, m_pos = 0; for (i = 0; i < r.no_cols; i++) { for (j = 0; j < r.no_rows; j++) { tmp = Num_T(0); pos = 0; for (k = 0; k < no_cols; k++) { tmp += data[pos+j] * m.data[m_pos+k]; pos += no_rows; } r.data[r_pos+j] = tmp; } r_pos += r.no_rows; m_pos += m.no_rows; } operator=(r); // time consuming return *this; } //! \cond template<> ITPP_EXPORT mat& mat::operator*=(const mat &m); template<> ITPP_EXPORT cmat& cmat::operator*=(const cmat &m); //! \endcond template inline Mat& Mat::operator*=(Num_T t) { scal_vector(datasize, t, data); return *this; } //! Multiplication of two matrices template Mat operator*(const Mat &m1, const Mat &m2) { it_assert_debug(m1.cols() == m2.rows(), "Mat<>::operator*(): Wrong sizes"); Mat r(m1.rows(), m2.cols()); Num_T tmp; int i, j, k; Num_T *tr = r._data(); const Num_T *t1; const Num_T *t2 = m2._data(); for (i = 0; i < r.cols(); i++) { for (j = 0; j < r.rows(); j++) { tmp = Num_T(0); t1 = m1._data() + j; for (k = m1.cols(); k > 0; k--) { tmp += *(t1) * *(t2++); t1 += m1.rows(); } *(tr++) = tmp; t2 -= m2.rows(); } t2 += m2.rows(); } return r; } //! \cond template<> ITPP_EXPORT mat operator*(const mat &m1, const mat &m2); template<> ITPP_EXPORT cmat operator*(const cmat &m1, const cmat &m2); //! \endcond //! Multiplication of matrix \c m and vector \c v (column vector) template Vec operator*(const Mat &m, const Vec &v) { it_assert_debug(m.cols() == v.size(), "Mat<>::operator*(): Wrong sizes"); Vec r(m.rows()); int i, k, m_pos; for (i = 0; i < m.rows(); i++) { r(i) = Num_T(0); m_pos = 0; for (k = 0; k < m.cols(); k++) { r(i) += m._data()[m_pos+i] * v(k); m_pos += m.rows(); } } return r; } //! \cond template<> ITPP_EXPORT vec operator*(const mat &m, const vec &v); template<> ITPP_EXPORT cvec operator*(const cmat &m, const cvec &v); //! \endcond //! Multiplication of matrix and scalar template Mat operator*(const Mat &m, Num_T t) { Mat r(m.rows(), m.cols()); const Num_T* m_data = m._data(); Num_T* r_data = r._data(); for (int i = 0; i < r._datasize(); i++) r_data[i] = m_data[i] * t; return r; } //! Multiplication of scalar and matrix template inline Mat operator*(Num_T t, const Mat &m) { return operator*(m, t); } template inline Mat elem_mult(const Mat &m1, const Mat &m2) { Mat out; elem_mult_out(m1, m2, out); return out; } template void elem_mult_out(const Mat &m1, const Mat &m2, Mat &out) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::elem_mult_out(): Wrong sizes"); out.set_size(m1.no_rows, m1.no_cols); for (int i = 0; i < out.datasize; i++) out.data[i] = m1.data[i] * m2.data[i]; } template void elem_mult_out(const Mat &m1, const Mat &m2, const Mat &m3, Mat &out) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_rows == m3.no_rows) && (m1.no_cols == m2.no_cols) && (m1.no_cols == m3.no_cols), "Mat<>::elem_mult_out(): Wrong sizes"); out.set_size(m1.no_rows, m1.no_cols); for (int i = 0; i < out.datasize; i++) out.data[i] = m1.data[i] * m2.data[i] * m3.data[i]; } template void elem_mult_out(const Mat &m1, const Mat &m2, const Mat &m3, const Mat &m4, Mat &out) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_rows == m3.no_rows) && (m1.no_rows == m4.no_rows) && (m1.no_cols == m2.no_cols) && (m1.no_cols == m3.no_cols) && (m1.no_cols == m4.no_cols), "Mat<>::elem_mult_out(): Wrong sizes"); out.set_size(m1.no_rows, m1.no_cols); for (int i = 0; i < out.datasize; i++) out.data[i] = m1.data[i] * m2.data[i] * m3.data[i] * m4.data[i]; } template #ifndef _MSC_VER inline #endif void elem_mult_inplace(const Mat &m1, Mat &m2) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::elem_mult_inplace(): Wrong sizes"); for (int i = 0; i < m2.datasize; i++) m2.data[i] *= m1.data[i]; } template inline Num_T elem_mult_sum(const Mat &m1, const Mat &m2) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::elem_mult_sum(): Wrong sizes"); Num_T acc = 0; for (int i = 0; i < m1.datasize; i++) acc += m1.data[i] * m2.data[i]; return acc; } template inline Mat& Mat::operator/=(Num_T t) { for (int i = 0; i < datasize; i++) data[i] /= t; return *this; } template inline Mat& Mat::operator/=(const Mat &m) { it_assert_debug((m.no_rows == no_rows) && (m.no_cols == no_cols), "Mat<>::operator/=(): Wrong sizes"); for (int i = 0; i < datasize; i++) data[i] /= m.data[i]; return *this; } template Mat operator/(const Mat &m, Num_T t) { Mat r(m.no_rows, m.no_cols); for (int i = 0; i < r.datasize; ++i) r.data[i] = m.data[i] / t; return r; } template Mat operator/(Num_T t, const Mat &m) { Mat r(m.no_rows, m.no_cols); for (int i = 0; i < r.datasize; ++i) r.data[i] = t / m.data[i]; return r; } template inline Mat elem_div(const Mat &m1, const Mat &m2) { Mat out; elem_div_out(m1, m2, out); return out; } template void elem_div_out(const Mat &m1, const Mat &m2, Mat &out) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::elem_div_out(): Wrong sizes"); if ((out.no_rows != m1.no_rows) || (out.no_cols != m1.no_cols)) out.set_size(m1.no_rows, m1.no_cols); for (int i = 0; i < out.datasize; i++) out.data[i] = m1.data[i] / m2.data[i]; } template inline Num_T elem_div_sum(const Mat &m1, const Mat &m2) { it_assert_debug((m1.no_rows == m2.no_rows) && (m1.no_cols == m2.no_cols), "Mat<>::elem_div_sum(): Wrong sizes"); Num_T acc = 0; for (int i = 0; i < m1.datasize; i++) acc += m1.data[i] / m2.data[i]; return acc; } template bool Mat::operator==(const Mat &m) const { if (no_rows != m.no_rows || no_cols != m.no_cols) return false; for (int i = 0;i < datasize;i++) { if (data[i] != m.data[i]) return false; } return true; } template bool Mat::operator!=(const Mat &m) const { if (no_rows != m.no_rows || no_cols != m.no_cols) return true; for (int i = 0;i < datasize;i++) { if (data[i] != m.data[i]) return true; } return false; } template std::ostream &operator<<(std::ostream &os, const Mat &m) { int i; switch (m.rows()) { case 0 : os << "[]"; break; case 1 : os << '[' << m.get_row(0) << ']'; break; default: os << '[' << m.get_row(0) << std::endl; for (i = 1; i < m.rows() - 1; i++) os << ' ' << m.get_row(i) << std::endl; os << ' ' << m.get_row(m.rows() - 1) << ']'; } return os; } template std::istream &operator>>(std::istream &is, Mat &m) { std::ostringstream buffer; bool started = false; bool finished = false; bool brackets = false; bool within_double_brackets = false; char c; while (!finished) { if (is.eof()) { finished = true; } else { is.get(c); if (is.eof() || (c == '\n')) { if (brackets) { // Right bracket missing is.setstate(std::ios_base::failbit); finished = true; } else if (!((c == '\n') && !started)) { finished = true; } } else if ((c == ' ') || (c == '\t')) { if (started) { buffer << ' '; } } else if (c == '[') { if ((started && !brackets) || within_double_brackets) { // Unexpected left bracket is.setstate(std::ios_base::failbit); finished = true; } else if (!started) { started = true; brackets = true; } else { within_double_brackets = true; } } else if (c == ']') { if (!started || !brackets) { // Unexpected right bracket is.setstate(std::ios_base::failbit); finished = true; } else if (within_double_brackets) { within_double_brackets = false; buffer << ';'; } else { finished = true; } while (!is.eof() && (((c = static_cast(is.peek())) == ' ') || (c == '\t'))) { is.get(); } if (!is.eof() && (c == '\n')) { is.get(); } } else { started = true; buffer << c; } } } if (!started) { m.set_size(0, false); } else { m.set(buffer.str()); } return is; } //! \cond // --------------------------------------------------------------------- // Instantiations // --------------------------------------------------------------------- // class instantiations ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Mat; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Mat >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Mat; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Mat; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Mat; // addition operators ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator+(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator+(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator+(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator+(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator+(const bmat &m1, const bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator+(const mat &m, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator+(const cmat &m, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator+(const imat &m, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator+(const smat &m, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator+(const bmat &m, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator+(double t, const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator+(std::complex t, const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator+(int t, const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator+(short t, const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator+(bin t, const bmat &m); // subtraction operators ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator-(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator-(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator-(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator-(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator-(const bmat &m1, const bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator-(const mat &m, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator-(const cmat &m, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator-(const imat &m, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator-(const smat &m, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator-(const bmat &m, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator-(double t, const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator-(std::complex t, const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator-(int t, const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator-(short t, const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator-(bin t, const bmat &m); // unary minus ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator-(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator-(const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator-(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator-(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator-(const bmat &m); // multiplication operators ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator*(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator*(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator*(const bmat &m1, const bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator*(const imat &m, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator*(const smat &m, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator*(const bmat &m, const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator*(const mat &m, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator*(const cmat &m, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator*(const imat &m, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator*(const smat &m, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator*(const bmat &m, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator*(double t, const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator*(std::complex t, const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator*(int t, const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator*(short t, const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator*(bin t, const bmat &m); // element-wise multiplication ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat elem_mult(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat elem_mult(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat elem_mult(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat elem_mult(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat elem_mult(const bmat &m1, const bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const mat &m1, const mat &m2, mat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const cmat &m1, const cmat &m2, cmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const imat &m1, const imat &m2, imat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const smat &m1, const smat &m2, smat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const bmat &m1, const bmat &m2, bmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const mat &m1, const mat &m2, const mat &m3, mat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const cmat &m1, const cmat &m2, const cmat &m3, cmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const imat &m1, const imat &m2, const imat &m3, imat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const smat &m1, const smat &m2, const smat &m3, smat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const bmat &m1, const bmat &m2, const bmat &m3, bmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const mat &m1, const mat &m2, const mat &m3, const mat &m4, mat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const cmat &m1, const cmat &m2, const cmat &m3, const cmat &m4, cmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const imat &m1, const imat &m2, const imat &m3, const imat &m4, imat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const smat &m1, const smat &m2, const smat &m3, const smat &m4, smat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const bmat &m1, const bmat &m2, const bmat &m3, const bmat &m4, bmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const mat &m1, mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const cmat &m1, cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const imat &m1, imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const smat &m1, smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const bmat &m1, bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double elem_mult_sum(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex elem_mult_sum(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int elem_mult_sum(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short elem_mult_sum(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin elem_mult_sum(const bmat &m1, const bmat &m2); // division operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator/(double t, const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator/(std::complex t, const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator/(int t, const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator/(short t, const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator/(bin t, const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat operator/(const mat &m, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat operator/(const cmat &m, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat operator/(const imat &m, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat operator/(const smat &m, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat operator/(const bmat &m, bin t); // element-wise division ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat elem_div(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat elem_div(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat elem_div(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat elem_div(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat elem_div(const bmat &m1, const bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const mat &m1, const mat &m2, mat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const cmat &m1, const cmat &m2, cmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const imat &m1, const imat &m2, imat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const smat &m1, const smat &m2, smat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const bmat &m1, const bmat &m2, bmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double elem_div_sum(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex elem_div_sum(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int elem_div_sum(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short elem_div_sum(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin elem_div_sum(const bmat &m1, const bmat &m2); // concatenation ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat concat_horizontal(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat concat_horizontal(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat concat_horizontal(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat concat_horizontal(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat concat_horizontal(const bmat &m1, const bmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat concat_vertical(const mat &m1, const mat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat concat_vertical(const cmat &m1, const cmat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat concat_vertical(const imat &m1, const imat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat concat_vertical(const smat &m1, const smat &m2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat concat_vertical(const bmat &m1, const bmat &m2); // I/O streams ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream &is, mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream &is, cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream &is, imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream &is, smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream &is, bmat &m); //! \endcond } // namespace itpp #endif // #ifndef MAT_H itpp-4.3.1/itpp/base/matfunc.cpp000066400000000000000000000276141216575753400165530ustar00rootroot00000000000000/*! * \file * \brief Various functions on vectors and matrices - source file * \author Tony Ottosson, Adam Piatyszek, Conrad Sanderson, Mark Dobossy * and Martin Senst * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include //! \cond namespace itpp { // Square root of a square matrix (based on Octave sqrtm implementation) cmat sqrtm(const mat& A) { return sqrtm(to_cmat(A)); } // Square root of the complex square matrix A cmat sqrtm(const cmat& A) { cmat U, T; schur(A, U, T); int n = U.rows(); cmat R(n, n); R.zeros(); for (int j = 0; j < n; j++) R(j, j) = std::sqrt(T(j, j)); const double fudge = std::sqrt(std::numeric_limits::min()); for (int p = 0; p < n - 1; p++) { for (int i = 0; i < n - (p + 1); i++) { const int j = i + p + 1; std::complex s = T(i, j); for (int k = i + 1; k < j; k++) s -= R(i, k) * R(k, j); const std::complex d = R(i, i) + R(j, j) + fudge; const std::complex conj_d = conj(d); R(i, j) = (s * conj_d) / (d * conj_d); } } return U * R * U.H(); } bool all(const bvec &testvec) { for (int i = 0; i < testvec.length(); i++) if (!testvec(i)) return false; return true; } bool any(const bvec &testvec) { for (int i = 0; i < testvec.length(); i++) if (testvec(i)) return true; return false; } // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- template ITPP_EXPORT int length(const vec &v); template ITPP_EXPORT int length(const cvec &v); template ITPP_EXPORT int length(const svec &v); template ITPP_EXPORT int length(const ivec &v); template ITPP_EXPORT int length(const bvec &v); template ITPP_EXPORT double sum(const vec &v); template ITPP_EXPORT std::complex sum(const cvec &v); template ITPP_EXPORT short sum(const svec &v); template ITPP_EXPORT int sum(const ivec &v); template ITPP_EXPORT bin sum(const bvec &v); template ITPP_EXPORT double sum_sqr(const vec &v); template ITPP_EXPORT std::complex sum_sqr(const cvec &v); template ITPP_EXPORT short sum_sqr(const svec &v); template ITPP_EXPORT int sum_sqr(const ivec &v); template ITPP_EXPORT bin sum_sqr(const bvec &v); template ITPP_EXPORT vec cumsum(const vec &v); template ITPP_EXPORT cvec cumsum(const cvec &v); template ITPP_EXPORT svec cumsum(const svec &v); template ITPP_EXPORT ivec cumsum(const ivec &v); template ITPP_EXPORT bvec cumsum(const bvec &v); template ITPP_EXPORT double prod(const vec &v); template ITPP_EXPORT std::complex prod(const cvec &v); template ITPP_EXPORT short prod(const svec &v); template ITPP_EXPORT int prod(const ivec &v); template ITPP_EXPORT bin prod(const bvec &v); template ITPP_EXPORT vec cross(const vec &v1, const vec &v2); template ITPP_EXPORT cvec cross(const cvec &v1, const cvec &v2); template ITPP_EXPORT ivec cross(const ivec &v1, const ivec &v2); template ITPP_EXPORT svec cross(const svec &v1, const svec &v2); template ITPP_EXPORT bvec cross(const bvec &v1, const bvec &v2); template ITPP_EXPORT vec reverse(const vec &in); template ITPP_EXPORT cvec reverse(const cvec &in); template ITPP_EXPORT svec reverse(const svec &in); template ITPP_EXPORT ivec reverse(const ivec &in); template ITPP_EXPORT bvec reverse(const bvec &in); template ITPP_EXPORT vec zero_pad(const vec &v, int n); template ITPP_EXPORT cvec zero_pad(const cvec &v, int n); template ITPP_EXPORT ivec zero_pad(const ivec &v, int n); template ITPP_EXPORT svec zero_pad(const svec &v, int n); template ITPP_EXPORT bvec zero_pad(const bvec &v, int n); template ITPP_EXPORT vec zero_pad(const vec &v); template ITPP_EXPORT cvec zero_pad(const cvec &v); template ITPP_EXPORT ivec zero_pad(const ivec &v); template ITPP_EXPORT svec zero_pad(const svec &v); template ITPP_EXPORT bvec zero_pad(const bvec &v); template ITPP_EXPORT mat zero_pad(const mat &, int, int); template ITPP_EXPORT cmat zero_pad(const cmat &, int, int); template ITPP_EXPORT imat zero_pad(const imat &, int, int); template ITPP_EXPORT smat zero_pad(const smat &, int, int); template ITPP_EXPORT bmat zero_pad(const bmat &, int, int); template ITPP_EXPORT vec sum(const mat &m, int dim); template ITPP_EXPORT cvec sum(const cmat &m, int dim); template ITPP_EXPORT svec sum(const smat &m, int dim); template ITPP_EXPORT ivec sum(const imat &m, int dim); template ITPP_EXPORT bvec sum(const bmat &m, int dim); template ITPP_EXPORT double sumsum(const mat &X); template ITPP_EXPORT std::complex sumsum(const cmat &X); template ITPP_EXPORT short sumsum(const smat &X); template ITPP_EXPORT int sumsum(const imat &X); template ITPP_EXPORT bin sumsum(const bmat &X); template ITPP_EXPORT vec sum_sqr(const mat & m, int dim); template ITPP_EXPORT cvec sum_sqr(const cmat &m, int dim); template ITPP_EXPORT svec sum_sqr(const smat &m, int dim); template ITPP_EXPORT ivec sum_sqr(const imat &m, int dim); template ITPP_EXPORT bvec sum_sqr(const bmat &m, int dim); template ITPP_EXPORT mat cumsum(const mat &m, int dim); template ITPP_EXPORT cmat cumsum(const cmat &m, int dim); template ITPP_EXPORT smat cumsum(const smat &m, int dim); template ITPP_EXPORT imat cumsum(const imat &m, int dim); template ITPP_EXPORT bmat cumsum(const bmat &m, int dim); template ITPP_EXPORT vec prod(const mat &m, int dim); template ITPP_EXPORT cvec prod(const cmat &v, int dim); template ITPP_EXPORT svec prod(const smat &m, int dim); template ITPP_EXPORT ivec prod(const imat &m, int dim); template ITPP_EXPORT bvec prod(const bmat &m, int dim); template ITPP_EXPORT vec diag(const mat &in); template ITPP_EXPORT cvec diag(const cmat &in); template ITPP_EXPORT void diag(const vec &in, mat &m); template ITPP_EXPORT void diag(const cvec &in, cmat &m); template ITPP_EXPORT mat diag(const vec &v, const int K); template ITPP_EXPORT cmat diag(const cvec &v, const int K); template ITPP_EXPORT mat bidiag(const vec &, const vec &); template ITPP_EXPORT cmat bidiag(const cvec &, const cvec &); template ITPP_EXPORT void bidiag(const vec &, const vec &, mat &); template ITPP_EXPORT void bidiag(const cvec &, const cvec &, cmat &); template ITPP_EXPORT void bidiag(const mat &, vec &, vec &); template ITPP_EXPORT void bidiag(const cmat &, cvec &, cvec &); template ITPP_EXPORT mat tridiag(const vec &main, const vec &, const vec &); template ITPP_EXPORT cmat tridiag(const cvec &main, const cvec &, const cvec &); template ITPP_EXPORT void tridiag(const vec &main, const vec &, const vec &, mat &); template ITPP_EXPORT void tridiag(const cvec &main, const cvec &, const cvec &, cmat &); template ITPP_EXPORT void tridiag(const mat &m, vec &, vec &, vec &); template ITPP_EXPORT void tridiag(const cmat &m, cvec &, cvec &, cvec &); template ITPP_EXPORT double trace(const mat &in); template ITPP_EXPORT std::complex trace(const cmat &in); template ITPP_EXPORT short trace(const smat &in); template ITPP_EXPORT int trace(const imat &in); template ITPP_EXPORT bin trace(const bmat &in); template ITPP_EXPORT void transpose(const mat &m, mat &out); template ITPP_EXPORT void transpose(const cmat &m, cmat &out); template ITPP_EXPORT void transpose(const smat &m, smat &out); template ITPP_EXPORT void transpose(const imat &m, imat &out); template ITPP_EXPORT void transpose(const bmat &m, bmat &out); template ITPP_EXPORT mat transpose(const mat &m); template ITPP_EXPORT cmat transpose(const cmat &m); template ITPP_EXPORT smat transpose(const smat &m); template ITPP_EXPORT imat transpose(const imat &m); template ITPP_EXPORT bmat transpose(const bmat &m); template ITPP_EXPORT void hermitian_transpose(const mat &m, mat &out); template ITPP_EXPORT void hermitian_transpose(const cmat &m, cmat &out); template ITPP_EXPORT void hermitian_transpose(const smat &m, smat &out); template ITPP_EXPORT void hermitian_transpose(const imat &m, imat &out); template ITPP_EXPORT void hermitian_transpose(const bmat &m, bmat &out); template ITPP_EXPORT mat hermitian_transpose(const mat &m); template ITPP_EXPORT cmat hermitian_transpose(const cmat &m); template ITPP_EXPORT smat hermitian_transpose(const smat &m); template ITPP_EXPORT imat hermitian_transpose(const imat &m); template ITPP_EXPORT bmat hermitian_transpose(const bmat &m); template ITPP_EXPORT bool is_hermitian(const mat &X); template ITPP_EXPORT bool is_hermitian(const cmat &X); template ITPP_EXPORT bool is_unitary(const mat &X); template ITPP_EXPORT bool is_unitary(const cmat &X); template ITPP_EXPORT vec rvectorize(const mat &m); template ITPP_EXPORT cvec rvectorize(const cmat &m); template ITPP_EXPORT ivec rvectorize(const imat &m); template ITPP_EXPORT svec rvectorize(const smat &m); template ITPP_EXPORT bvec rvectorize(const bmat &m); template ITPP_EXPORT vec cvectorize(const mat &m); template ITPP_EXPORT cvec cvectorize(const cmat &m); template ITPP_EXPORT ivec cvectorize(const imat &m); template ITPP_EXPORT svec cvectorize(const smat &m); template ITPP_EXPORT bvec cvectorize(const bmat &m); template ITPP_EXPORT mat reshape(const mat &m, int rows, int cols); template ITPP_EXPORT cmat reshape(const cmat &m, int rows, int cols); template ITPP_EXPORT imat reshape(const imat &m, int rows, int cols); template ITPP_EXPORT smat reshape(const smat &m, int rows, int cols); template ITPP_EXPORT bmat reshape(const bmat &m, int rows, int cols); template ITPP_EXPORT mat reshape(const vec &m, int rows, int cols); template ITPP_EXPORT cmat reshape(const cvec &m, int rows, int cols); template ITPP_EXPORT imat reshape(const ivec &m, int rows, int cols); template ITPP_EXPORT smat reshape(const svec &m, int rows, int cols); template ITPP_EXPORT bmat reshape(const bvec &m, int rows, int cols); template ITPP_EXPORT mat kron(const mat &X, const mat &Y); template ITPP_EXPORT cmat kron(const cmat &X, const cmat &Y); template ITPP_EXPORT imat kron(const imat &X, const imat &Y); template ITPP_EXPORT smat kron(const smat &X, const smat &Y); template ITPP_EXPORT bmat kron(const bmat &X, const bmat &Y); template ITPP_EXPORT vec repmat(const vec &v, int n); template ITPP_EXPORT cvec repmat(const cvec &v, int n); template ITPP_EXPORT ivec repmat(const ivec &v, int n); template ITPP_EXPORT svec repmat(const svec &v, int n); template ITPP_EXPORT bvec repmat(const bvec &v, int n); template ITPP_EXPORT mat repmat(const vec &v, int m, int n, bool transpose); template ITPP_EXPORT cmat repmat(const cvec &v, int m, int n, bool transpose); template ITPP_EXPORT imat repmat(const ivec &v, int m, int n, bool transpose); template ITPP_EXPORT smat repmat(const svec &v, int m, int n, bool transpose); template ITPP_EXPORT bmat repmat(const bvec &v, int m, int n, bool transpose); template ITPP_EXPORT mat repmat(const mat &data, int m, int n); template ITPP_EXPORT cmat repmat(const cmat &data, int m, int n); template ITPP_EXPORT imat repmat(const imat &data, int m, int n); template ITPP_EXPORT smat repmat(const smat &data, int m, int n); template ITPP_EXPORT bmat repmat(const bmat &data, int m, int n); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/matfunc.h000066400000000000000000001040341216575753400162100ustar00rootroot00000000000000/*! * \file * \brief Various functions on vectors and matrices - header file * \author Tony Ottosson, Adam Piatyszek, Conrad Sanderson, Mark Dobossy * and Martin Senst * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MATFUNC_H #define MATFUNC_H #include #include #include #include #include #include namespace itpp { /*! \addtogroup matrix_functions \brief Functions on vectors and matrices */ //!@{ //! Length of vector template int length(const Vec &v) { return v.length(); } //! Length of vector template int size(const Vec &v) { return v.length(); } //! Sum of all elements in the vector template T sum(const Vec &v) { T M = 0; for (int i = 0;i < v.length();i++) M += v[i]; return M; } /*! * \brief Sum of elements in the matrix \c m, either along columns or rows * * sum(m) = sum(m, 1) returns a vector where the elements are sum * over each column, whereas sum(m, 2) returns a vector where the * elements are sum over each row. */ template Vec sum(const Mat &m, int dim = 1) { it_assert((dim == 1) || (dim == 2), "sum: dimension need to be 1 or 2"); Vec out; if (dim == 1) { out.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = sum(m.get_col(i)); } else { out.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = sum(m.get_row(i)); } return out; } //! Sum of all elements in the given matrix. Fast version of sum(sum(X)) template T sumsum(const Mat &X) { const T * X_data = X._data(); const int X_datasize = X._datasize(); T acc = 0; for (int i = 0;i < X_datasize;i++) acc += X_data[i]; return acc; } //! Sum of square of the elements in a vector template T sum_sqr(const Vec &v) { T M = 0; for (int i = 0; i < v.length(); i++) M += v[i] * v[i]; return M; } /*! * \brief Sum of the square of elements in the matrix \c m * * sum(m) = sum(m, 1) returns a vector where the elements are sum * squared over each column, whereas sum(m, 2) returns a vector * where the elements are sum squared over each row */ template Vec sum_sqr(const Mat &m, int dim = 1) { it_assert((dim == 1) || (dim == 2), "sum_sqr: dimension need to be 1 or 2"); Vec out; if (dim == 1) { out.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = sum_sqr(m.get_col(i)); } else { out.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = sum_sqr(m.get_row(i)); } return out; } //! Cumulative sum of all elements in the vector template Vec cumsum(const Vec &v) { Vec out(v.size()); out(0) = v(0); for (int i = 1; i < v.size(); i++) out(i) = out(i - 1) + v(i); return out; } /*! * \brief Cumulative sum of elements in the matrix \c m * * cumsum(m) = cumsum(m, 1) returns a matrix where the elements * are sums over each column, whereas cumsum(m, 2) returns a * matrix where the elements are sums over each row */ template Mat cumsum(const Mat &m, int dim = 1) { it_assert((dim == 1) || (dim == 2), "cumsum: dimension need to be 1 or 2"); Mat out(m.rows(), m.cols()); if (dim == 1) { for (int i = 0; i < m.cols(); i++) out.set_col(i, cumsum(m.get_col(i))); } else { for (int i = 0; i < m.rows(); i++) out.set_row(i, cumsum(m.get_row(i))); } return out; } //! The product of all elements in the vector template T prod(const Vec &v) { it_assert(v.size() >= 1, "prod: size of vector should be at least 1"); T out = v(0); for (int i = 1; i < v.size(); i++) out *= v(i); return out; } /*! * \brief Product of elements in the matrix \c m * * prod(m) = prod(m, 1) returns a vector where the elements are * products over each column, whereas prod(m, 2) returns a vector * where the elements are products over each row */ template Vec prod(const Mat &m, int dim = 1) { it_assert((dim == 1) || (dim == 2), "prod: dimension need to be 1 or 2"); Vec out(m.cols()); if (dim == 1) { it_assert((m.cols() >= 1) && (m.rows() >= 1), "prod: number of columns should be at least 1"); out.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = prod(m.get_col(i)); } else { it_assert((m.cols() >= 1) && (m.rows() >= 1), "prod: number of rows should be at least 1"); out.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = prod(m.get_row(i)); } return out; } //! Vector cross product. Vectors need to be of size 3 template Vec cross(const Vec &v1, const Vec &v2) { it_assert((v1.size() == 3) && (v2.size() == 3), "cross: vectors should be of size 3"); Vec r(3); r(0) = v1(1) * v2(2) - v1(2) * v2(1); r(1) = v1(2) * v2(0) - v1(0) * v2(2); r(2) = v1(0) * v2(1) - v1(1) * v2(0); return r; } //! Zero-pad a vector to size n template Vec zero_pad(const Vec &v, int n) { it_assert(n >= v.size(), "zero_pad() cannot shrink the vector!"); Vec v2(n); v2.set_subvector(0, v); if (n > v.size()) v2.set_subvector(v.size(), n - 1, T(0)); return v2; } //! Zero-pad a vector to the nearest greater power of two template Vec zero_pad(const Vec &v) { int n = pow2i(levels2bits(v.size())); return (n == v.size()) ? v : zero_pad(v, n); } //! Zero-pad a matrix to size rows x cols template Mat zero_pad(const Mat &m, int rows, int cols) { it_assert((rows >= m.rows()) && (cols >= m.cols()), "zero_pad() cannot shrink the matrix!"); Mat m2(rows, cols); m2.set_submatrix(0, 0, m); if (cols > m.cols()) // Zero m2.set_submatrix(0, m.rows() - 1, m.cols(), cols - 1, T(0)); if (rows > m.rows()) // Zero m2.set_submatrix(m.rows(), rows - 1, 0, cols - 1, T(0)); return m2; } //! Return zero if indexing outside the vector \c v otherwise return the //! element \c index template T index_zero_pad(const Vec &v, const int index) { if (index >= 0 && index < v.size()) return v(index); else return T(0); } //! Transposition of the matrix \c m returning the transposed matrix in \c out template void transpose(const Mat &m, Mat &out) { out = m.T(); } //! Transposition of the matrix \c m template Mat transpose(const Mat &m) { return m.T(); } //! Hermitian transpose (complex conjugate transpose) of the matrix \c m //! returning the transposed matrix in \c out template void hermitian_transpose(const Mat &m, Mat &out) { out = m.H(); } //! Hermitian transpose (complex conjugate transpose) of the matrix \c m template Mat hermitian_transpose(const Mat &m) { return m.H(); } /*! * \brief Returns true if matrix \c X is hermitian, false otherwise * \author M. Szalay * * A square matrix \f$\mathbf{X}\f$ is hermitian if * \f[ * \mathbf{X} = \mathbf{X}^H * \f] */ template bool is_hermitian(const Mat& X) { if (X == X.H()) return true; else return false; } /*! * \brief Returns true if matrix \c X is unitary, false otherwise * \author M. Szalay * * A square matrix \f$\mathbf{X}\f$ is unitary if * \f[ * \mathbf{X}^H = \mathbf{X}^{-1} * \f] */ template bool is_unitary(const Mat& X) { if (inv(X) == X.H()) return true; else return false; } /*! * \relates Vec * \brief Creates a vector with \c n copies of the vector \c v * \author Martin Senst * * \param v Vector to be repeated * \param n Number of times to repeat \c v */ template Vec repmat(const Vec &v, int n) { it_assert(n > 0, "repmat(): Wrong repetition parameter"); int data_length = v.length(); it_assert(data_length > 0, "repmat(): Input vector can not be empty"); Vec assembly(data_length * n); for (int j = 0; j < n; ++j) { assembly.set_subvector(j * data_length, v); } return assembly; } /*! * \relates Mat * \brief Creates a matrix with \c m by \c n copies of the matrix \c data * \author Mark Dobossy * * \param data Matrix to be repeated * \param m Number of times to repeat data vertically * \param n Number of times to repeat data horizontally */ template Mat repmat(const Mat &data, int m, int n) { it_assert((m > 0) && (n > 0), "repmat(): Wrong repetition parameters"); int data_rows = data.rows(); int data_cols = data.cols(); it_assert((data_rows > 0) && (data_cols > 0), "repmat(): Input matrix can " "not be empty"); Mat assembly(data_rows*m, data_cols*n); for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { assembly.set_submatrix(i*data_rows, j*data_cols, data); } } return assembly; } /*! * \relates Mat * \brief Returns a matrix with \c m by \c n copies of the vector \c data * \author Adam Piatyszek * * \param v Vector to be repeated * \param m Number of times to repeat data vertically * \param n Number of times to repeat data horizontally * \param transpose Specifies the input vector orientation (column vector * by default) */ template inline Mat repmat(const Vec &v, int m, int n, bool transpose = false) { return repmat((transpose ? v.T() : Mat(v)), m, n); } /*! * \brief Computes the Kronecker product of two matrices * * K = kron(X, Y) returns the Kronecker tensor product of \c X * and \c Y. The result is a large array formed by taking all possible * products between the elements of \c X and those of \c Y. If \c X is * (m x n) and \c Y is (p x q), then kron(X, Y) * is (m*p x n*q). * * \author Adam Piatyszek */ template Mat kron(const Mat& X, const Mat& Y) { Mat result(X.rows() * Y.rows(), X.cols() * Y.cols()); for (int i = 0; i < X.rows(); i++) for (int j = 0; j < X.cols(); j++) result.set_submatrix(i * Y.rows(), j * Y.cols(), X(i, j) * Y); return result; } /*! * \brief Square root of the complex square matrix \c A * * This function computes the matrix square root of the complex square * matrix \c A. The implementation is based on the Matlab/Octave \c * sqrtm() function. * * Ref: N. J. Higham, "Numerical Analysis Report No. 336", Manchester * Centre for Computational Mathematics, Manchester, England, January 1999 * * \author Adam Piatyszek */ ITPP_EXPORT cmat sqrtm(const cmat& A); /*! * \brief Square root of the real square matrix \c A * * This function computes the matrix square root of the real square matrix * \c A. Please note that the returned matrix is complex. The * implementation is based on the Matlab/Octave \c sqrtm() function. * * Ref: N. J. Higham, "Numerical Analysis Report No. 336", Manchester * Centre for Computational Mathematics, Manchester, England, January 1999 * * \author Adam Piatyszek */ ITPP_EXPORT cmat sqrtm(const mat& A); /*! * \brief Calculate the rank of matrix \c m * \author Martin Senst * * \param m Input matrix * \param tol Tolerance used for comparing the singular values with zero. * If negative, it is automatically determined. */ template int rank(const Mat &m, double tol = -1.0) { int rows = m.rows(); int cols = m.cols(); if ((rows == 0) || (cols == 0)) return 0; vec sing_val = svd(m); if (tol < 0.0) { // Calculate default tolerance tol = eps * sing_val(0) * (rows > cols ? rows : cols); } // Count number of nonzero singular values int r = 0; while ((r < sing_val.length()) && (sing_val(r) > tol)) { r++; } return r; } //! Specialisation of rank() function template<> inline int rank(const imat &m, double tol) { return rank(to_mat(m), tol); } //! Specialisation of rank() function template<> inline int rank(const smat &m, double tol) { return rank(to_mat(m), tol); } //! Specialisation of rank() function template<> inline int rank(const bmat &, double) { it_error("rank(bmat): Function not implemented for GF(2) algebra"); return 0; } //!@} // -------------------- Diagonal matrix functions ------------------------- //! \addtogroup diag //!@{ /*! * \brief Create a diagonal matrix using vector \c v as its diagonal * * All other matrix elements except the ones on its diagonal are set to * zero. An optional parameter \c K can be used to shift the diagonal in * the resulting matrix. By default \c K is equal to zero. * * The size of the diagonal matrix will be \f$n+|K| \times n+|K|\f$, where * \f$n\f$ is the length of the input vector \c v. */ template Mat diag(const Vec &v, const int K = 0) { Mat m(v.size() + std::abs(K), v.size() + std::abs(K)); m = T(0); if (K > 0) for (int i = v.size() - 1; i >= 0; i--) m(i, i + K) = v(i); else for (int i = v.size() - 1; i >= 0; i--) m(i - K, i) = v(i); return m; } /*! * \brief Create a diagonal matrix using vector \c v as its diagonal * * All other matrix elements except the ones on its diagonal are set to * zero. * * The size of the diagonal matrix will be \f$n \times n\f$, where \f$n\f$ * is the length of the input vector \c v. */ template void diag(const Vec &v, Mat &m) { m.set_size(v.size(), v.size(), false); m = T(0); for (int i = v.size() - 1; i >= 0; i--) m(i, i) = v(i); } /*! * \brief Get the diagonal elements of the input matrix \c m * * The size of the output vector with diagonal elements will be * \f$n = min(r, c)\f$, where \f$r \times c\f$ are the dimensions of * matrix \c m. */ template Vec diag(const Mat &m) { Vec t(std::min(m.rows(), m.cols())); for (int i = 0; i < t.size(); i++) t(i) = m(i, i); return t; } /*! \brief Returns a matrix with the elements of the input vector \c main on the diagonal and the elements of the input vector \c sup on the diagonal row above. If the number of elements in the vector \c main is \f$n\f$, then the number of elements in the input vector \c sup must be \f$n-1\f$. The size of the return matrix will be \f$n \times n\f$. */ template Mat bidiag(const Vec &main, const Vec &sup) { it_assert(main.size() == sup.size() + 1, "bidiag()"); int n = main.size(); Mat m(n, n); m = T(0); for (int i = 0; i < n - 1; i++) { m(i, i) = main(i); m(i, i + 1) = sup(i); } m(n - 1, n - 1) = main(n - 1); return m; } /*! \brief Returns in the output variable \c m a matrix with the elements of the input vector \c main on the diagonal and the elements of the input vector \c sup on the diagonal row above. If the number of elements in the vector \c main is \f$n\f$, then the number of elements in the input vector \c sup must be \f$n-1\f$. The size of the output matrix \c m will be \f$n \times n\f$. */ template void bidiag(const Vec &main, const Vec &sup, Mat &m) { it_assert(main.size() == sup.size() + 1, "bidiag()"); int n = main.size(); m.set_size(n, n); m = T(0); for (int i = 0; i < n - 1; i++) { m(i, i) = main(i); m(i, i + 1) = sup(i); } m(n - 1, n - 1) = main(n - 1); } /*! \brief Returns the main diagonal and the diagonal row above in the two output vectors \c main and \c sup. The input matrix \c in must be a square \f$n \times n\f$ matrix. The length of the output vector \c main will be \f$n\f$ and the length of the output vector \c sup will be \f$n-1\f$. */ template void bidiag(const Mat &m, Vec &main, Vec &sup) { it_assert(m.rows() == m.cols(), "bidiag(): Matrix must be square!"); int n = m.cols(); main.set_size(n); sup.set_size(n - 1); for (int i = 0; i < n - 1; i++) { main(i) = m(i, i); sup(i) = m(i, i + 1); } main(n - 1) = m(n - 1, n - 1); } /*! \brief Returns a matrix with the elements of \c main on the diagonal, the elements of \c sup on the diagonal row above, and the elements of \c sub on the diagonal row below. If the length of the input vector \c main is \f$n\f$ then the lengths of the vectors \c sup and \c sub must equal \f$n-1\f$. The size of the return matrix will be \f$n \times n\f$. */ template Mat tridiag(const Vec &main, const Vec &sup, const Vec &sub) { it_assert(main.size() == sup.size() + 1 && main.size() == sub.size() + 1, "bidiag()"); int n = main.size(); Mat m(n, n); m = T(0); for (int i = 0; i < n - 1; i++) { m(i, i) = main(i); m(i, i + 1) = sup(i); m(i + 1, i) = sub(i); } m(n - 1, n - 1) = main(n - 1); return m; } /*! \brief Returns in the output matrix \c m a matrix with the elements of \c main on the diagonal, the elements of \c sup on the diagonal row above, and the elements of \c sub on the diagonal row below. If the length of the input vector \c main is \f$n\f$ then the lengths of the vectors \c sup and \c sub must equal \f$n-1\f$. The size of the output matrix \c m will be \f$n \times n\f$. */ template void tridiag(const Vec &main, const Vec &sup, const Vec &sub, Mat &m) { it_assert(main.size() == sup.size() + 1 && main.size() == sub.size() + 1, "bidiag()"); int n = main.size(); m.set_size(n, n); m = T(0); for (int i = 0; i < n - 1; i++) { m(i, i) = main(i); m(i, i + 1) = sup(i); m(i + 1, i) = sub(i); } m(n - 1, n - 1) = main(n - 1); } /*! \brief Returns the main diagonal, the diagonal row above, and the diagonal row below int the output vectors \c main, \c sup, and \c sub. The input matrix \c m must be a square \f$n \times n\f$ matrix. The length of the output vector \c main will be \f$n\f$ and the length of the output vectors \c sup and \c sup will be \f$n-1\f$. */ template void tridiag(const Mat &m, Vec &main, Vec &sup, Vec &sub) { it_assert(m.rows() == m.cols(), "tridiag(): Matrix must be square!"); int n = m.cols(); main.set_size(n); sup.set_size(n - 1); sub.set_size(n - 1); for (int i = 0; i < n - 1; i++) { main(i) = m(i, i); sup(i) = m(i, i + 1); sub(i) = m(i + 1, i); } main(n - 1) = m(n - 1, n - 1); } /*! \brief The trace of the matrix \c m, i.e. the sum of the diagonal elements. */ template T trace(const Mat &m) { return sum(diag(m)); } //!@} // ----------------- reshaping vectors and matrices ------------------------ //! \addtogroup reshaping //!@{ //! Reverse the input vector template Vec reverse(const Vec &in) { int i, s = in.length(); Vec out(s); for (i = 0;i < s;i++) out[i] = in[s-1-i]; return out; } //! Row vectorize the matrix [(0,0) (0,1) ... (N-1,N-2) (N-1,N-1)] template Vec rvectorize(const Mat &m) { int i, j, n = 0, r = m.rows(), c = m.cols(); Vec v(r * c); for (i = 0; i < r; i++) for (j = 0; j < c; j++) v(n++) = m(i, j); return v; } //! Column vectorize the matrix [(0,0) (1,0) ... (N-2,N-1) (N-1,N-1)] template Vec cvectorize(const Mat &m) { int i, j, n = 0, r = m.rows(), c = m.cols(); Vec v(r * c); for (j = 0; j < c; j++) for (i = 0; i < r; i++) v(n++) = m(i, j); return v; } /*! \brief Reshape the matrix into an rows*cols matrix The data is taken columnwise from the original matrix and written columnwise into the new matrix. */ template Mat reshape(const Mat &m, int rows, int cols) { it_assert_debug(m.rows()*m.cols() == rows*cols, "Mat::reshape: Sizes must match"); Mat temp(rows, cols); int i, j, ii = 0, jj = 0; for (j = 0; j < m.cols(); j++) { for (i = 0; i < m.rows(); i++) { temp(ii++, jj) = m(i, j); if (ii == rows) { jj++; ii = 0; } } } return temp; } /*! \brief Reshape the vector into an rows*cols matrix The data is element by element from the vector and written columnwise into the new matrix. */ template Mat reshape(const Vec &v, int rows, int cols) { it_assert_debug(v.size() == rows*cols, "Mat::reshape: Sizes must match"); Mat temp(rows, cols); int i, j, ii = 0; for (j = 0; j < cols; j++) { for (i = 0; i < rows; i++) { temp(i, j) = v(ii++); } } return temp; } //!@} //! Returns \a true if all elements are ones and \a false otherwise ITPP_EXPORT bool all(const bvec &testvec); //! Returns \a true if any element is one and \a false otherwise ITPP_EXPORT bool any(const bvec &testvec); //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int length(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int length(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int length(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int length(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int length(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double sum(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex sum(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short sum(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int sum(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin sum(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double sum_sqr(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex sum_sqr(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short sum_sqr(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int sum_sqr(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin sum_sqr(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec cumsum(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec cumsum(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec cumsum(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec cumsum(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec cumsum(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double prod(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex prod(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short prod(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int prod(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin prod(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec cross(const vec &v1, const vec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec cross(const cvec &v1, const cvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec cross(const ivec &v1, const ivec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec cross(const svec &v1, const svec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec cross(const bvec &v1, const bvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec reverse(const vec &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec reverse(const cvec &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec reverse(const svec &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec reverse(const ivec &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec reverse(const bvec &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec zero_pad(const vec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec zero_pad(const cvec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec zero_pad(const ivec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec zero_pad(const svec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec zero_pad(const bvec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec zero_pad(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec zero_pad(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec zero_pad(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec zero_pad(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec zero_pad(const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat zero_pad(const mat &, int, int); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat zero_pad(const cmat &, int, int); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat zero_pad(const imat &, int, int); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat zero_pad(const smat &, int, int); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat zero_pad(const bmat &, int, int); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec sum(const mat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec sum(const cmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec sum(const smat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec sum(const imat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec sum(const bmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double sumsum(const mat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex sumsum(const cmat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short sumsum(const smat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int sumsum(const imat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin sumsum(const bmat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec sum_sqr(const mat & m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec sum_sqr(const cmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec sum_sqr(const smat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec sum_sqr(const imat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec sum_sqr(const bmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat cumsum(const mat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat cumsum(const cmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat cumsum(const smat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat cumsum(const imat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat cumsum(const bmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec prod(const mat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec prod(const cmat &v, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec prod(const smat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec prod(const imat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec prod(const bmat &m, int dim); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec diag(const mat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec diag(const cmat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void diag(const vec &in, mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void diag(const cvec &in, cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat diag(const vec &v, const int K); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat diag(const cvec &v, const int K); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat bidiag(const vec &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat bidiag(const cvec &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void bidiag(const vec &, const vec &, mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void bidiag(const cvec &, const cvec &, cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void bidiag(const mat &, vec &, vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void bidiag(const cmat &, cvec &, cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat tridiag(const vec &main, const vec &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat tridiag(const cvec &main, const cvec &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void tridiag(const vec &main, const vec &, const vec &, mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void tridiag(const cvec &main, const cvec &, const cvec &, cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void tridiag(const mat &m, vec &, vec &, vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void tridiag(const cmat &m, cvec &, cvec &, cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double trace(const mat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex trace(const cmat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short trace(const smat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int trace(const imat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin trace(const bmat &in); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void transpose(const mat &m, mat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void transpose(const cmat &m, cmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void transpose(const smat &m, smat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void transpose(const imat &m, imat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void transpose(const bmat &m, bmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat transpose(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat transpose(const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat transpose(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat transpose(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat transpose(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void hermitian_transpose(const mat &m, mat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void hermitian_transpose(const cmat &m, cmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void hermitian_transpose(const smat &m, smat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void hermitian_transpose(const imat &m, imat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void hermitian_transpose(const bmat &m, bmat &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat hermitian_transpose(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat hermitian_transpose(const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat hermitian_transpose(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat hermitian_transpose(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat hermitian_transpose(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bool is_hermitian(const mat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bool is_hermitian(const cmat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bool is_unitary(const mat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bool is_unitary(const cmat &X); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec rvectorize(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec rvectorize(const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec rvectorize(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec rvectorize(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec rvectorize(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec cvectorize(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec cvectorize(const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec cvectorize(const imat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec cvectorize(const smat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec cvectorize(const bmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat reshape(const mat &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat reshape(const cmat &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat reshape(const imat &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat reshape(const smat &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat reshape(const bmat &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat reshape(const vec &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat reshape(const cvec &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat reshape(const ivec &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat reshape(const svec &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat reshape(const bvec &m, int rows, int cols); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat kron(const mat &X, const mat &Y); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat kron(const cmat &X, const cmat &Y); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat kron(const imat &X, const imat &Y); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat kron(const smat &X, const smat &Y); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat kron(const bmat &X, const bmat &Y); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec repmat(const vec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec repmat(const cvec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec repmat(const ivec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec repmat(const svec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec repmat(const bvec &v, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat repmat(const vec &v, int m, int n, bool transpose); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat repmat(const cvec &v, int m, int n, bool transpose); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat repmat(const ivec &v, int m, int n, bool transpose); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat repmat(const svec &v, int m, int n, bool transpose); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat repmat(const bvec &v, int m, int n, bool transpose); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat repmat(const mat &data, int m, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat repmat(const cmat &data, int m, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat repmat(const imat &data, int m, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat repmat(const smat &data, int m, int n); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat repmat(const bmat &data, int m, int n); //! \endcond } // namespace itpp #endif // #ifndef MATFUNC_H itpp-4.3.1/itpp/base/math/000077500000000000000000000000001216575753400153315ustar00rootroot00000000000000itpp-4.3.1/itpp/base/math/Makefile.am000066400000000000000000000007471216575753400173750ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libmath.la if ENABLE_DEBUG noinst_LTLIBRARIES += libmath_debug.la endif libmath_la_SOURCES = $(h_base_math_sources) $(cpp_base_math_sources) libmath_la_CXXFLAGS = $(CXXFLAGS_OPT) libmath_debug_la_SOURCES = $(h_base_math_sources) $(cpp_base_math_sources) libmath_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/base/math pkginclude_HEADERS = $(h_base_math_sources) itpp-4.3.1/itpp/base/math/Makefile.in000066400000000000000000001043261216575753400174040ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libmath_debug.la subdir = itpp/base/math ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmath_la_LIBADD = am__objects_1 = am__objects_2 = libmath_la-elem_math.lo libmath_la-error.lo \ libmath_la-integration.lo libmath_la-log_exp.lo \ libmath_la-misc.lo libmath_la-trig_hyp.lo am_libmath_la_OBJECTS = $(am__objects_1) $(am__objects_2) libmath_la_OBJECTS = $(am_libmath_la_OBJECTS) libmath_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libmath_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libmath_debug_la_LIBADD = am__objects_3 = libmath_debug_la-elem_math.lo \ libmath_debug_la-error.lo libmath_debug_la-integration.lo \ libmath_debug_la-log_exp.lo libmath_debug_la-misc.lo \ libmath_debug_la-trig_hyp.lo am_libmath_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libmath_debug_la_OBJECTS = $(am_libmath_debug_la_OBJECTS) libmath_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libmath_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libmath_la_SOURCES) $(libmath_debug_la_SOURCES) DIST_SOURCES = $(libmath_la_SOURCES) $(libmath_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/base/math ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_base_math_sources = \ $(top_srcdir)/itpp/base/math/elem_math.h \ $(top_srcdir)/itpp/base/math/error.h \ $(top_srcdir)/itpp/base/math/integration.h \ $(top_srcdir)/itpp/base/math/log_exp.h \ $(top_srcdir)/itpp/base/math/min_max.h \ $(top_srcdir)/itpp/base/math/misc.h \ $(top_srcdir)/itpp/base/math/trig_hyp.h cpp_base_math_sources = \ $(top_srcdir)/itpp/base/math/elem_math.cpp \ $(top_srcdir)/itpp/base/math/error.cpp \ $(top_srcdir)/itpp/base/math/integration.cpp \ $(top_srcdir)/itpp/base/math/log_exp.cpp \ $(top_srcdir)/itpp/base/math/misc.cpp \ $(top_srcdir)/itpp/base/math/trig_hyp.cpp noinst_LTLIBRARIES = libmath.la $(am__append_1) libmath_la_SOURCES = $(h_base_math_sources) $(cpp_base_math_sources) libmath_la_CXXFLAGS = $(CXXFLAGS_OPT) libmath_debug_la_SOURCES = $(h_base_math_sources) $(cpp_base_math_sources) libmath_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_base_math_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/base/math/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/base/math/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libmath.la: $(libmath_la_OBJECTS) $(libmath_la_DEPENDENCIES) $(libmath_la_LINK) $(libmath_la_OBJECTS) $(libmath_la_LIBADD) $(LIBS) libmath_debug.la: $(libmath_debug_la_OBJECTS) $(libmath_debug_la_DEPENDENCIES) $(libmath_debug_la_LINK) $(am_libmath_debug_la_rpath) $(libmath_debug_la_OBJECTS) $(libmath_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_debug_la-elem_math.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_debug_la-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_debug_la-integration.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_debug_la-log_exp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_debug_la-misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_debug_la-trig_hyp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_la-elem_math.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_la-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_la-integration.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_la-log_exp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_la-misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath_la-trig_hyp.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libmath_la-elem_math.lo: $(top_srcdir)/itpp/base/math/elem_math.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_la-elem_math.lo -MD -MP -MF $(DEPDIR)/libmath_la-elem_math.Tpo -c -o libmath_la-elem_math.lo `test -f '$(top_srcdir)/itpp/base/math/elem_math.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/elem_math.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_la-elem_math.Tpo $(DEPDIR)/libmath_la-elem_math.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/elem_math.cpp' object='libmath_la-elem_math.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_la-elem_math.lo `test -f '$(top_srcdir)/itpp/base/math/elem_math.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/elem_math.cpp libmath_la-error.lo: $(top_srcdir)/itpp/base/math/error.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_la-error.lo -MD -MP -MF $(DEPDIR)/libmath_la-error.Tpo -c -o libmath_la-error.lo `test -f '$(top_srcdir)/itpp/base/math/error.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/error.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_la-error.Tpo $(DEPDIR)/libmath_la-error.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/error.cpp' object='libmath_la-error.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_la-error.lo `test -f '$(top_srcdir)/itpp/base/math/error.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/error.cpp libmath_la-integration.lo: $(top_srcdir)/itpp/base/math/integration.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_la-integration.lo -MD -MP -MF $(DEPDIR)/libmath_la-integration.Tpo -c -o libmath_la-integration.lo `test -f '$(top_srcdir)/itpp/base/math/integration.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/integration.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_la-integration.Tpo $(DEPDIR)/libmath_la-integration.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/integration.cpp' object='libmath_la-integration.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_la-integration.lo `test -f '$(top_srcdir)/itpp/base/math/integration.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/integration.cpp libmath_la-log_exp.lo: $(top_srcdir)/itpp/base/math/log_exp.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_la-log_exp.lo -MD -MP -MF $(DEPDIR)/libmath_la-log_exp.Tpo -c -o libmath_la-log_exp.lo `test -f '$(top_srcdir)/itpp/base/math/log_exp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/log_exp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_la-log_exp.Tpo $(DEPDIR)/libmath_la-log_exp.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/log_exp.cpp' object='libmath_la-log_exp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_la-log_exp.lo `test -f '$(top_srcdir)/itpp/base/math/log_exp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/log_exp.cpp libmath_la-misc.lo: $(top_srcdir)/itpp/base/math/misc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_la-misc.lo -MD -MP -MF $(DEPDIR)/libmath_la-misc.Tpo -c -o libmath_la-misc.lo `test -f '$(top_srcdir)/itpp/base/math/misc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/misc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_la-misc.Tpo $(DEPDIR)/libmath_la-misc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/misc.cpp' object='libmath_la-misc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_la-misc.lo `test -f '$(top_srcdir)/itpp/base/math/misc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/misc.cpp libmath_la-trig_hyp.lo: $(top_srcdir)/itpp/base/math/trig_hyp.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_la-trig_hyp.lo -MD -MP -MF $(DEPDIR)/libmath_la-trig_hyp.Tpo -c -o libmath_la-trig_hyp.lo `test -f '$(top_srcdir)/itpp/base/math/trig_hyp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/trig_hyp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_la-trig_hyp.Tpo $(DEPDIR)/libmath_la-trig_hyp.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/trig_hyp.cpp' object='libmath_la-trig_hyp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_la-trig_hyp.lo `test -f '$(top_srcdir)/itpp/base/math/trig_hyp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/trig_hyp.cpp libmath_debug_la-elem_math.lo: $(top_srcdir)/itpp/base/math/elem_math.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_debug_la-elem_math.lo -MD -MP -MF $(DEPDIR)/libmath_debug_la-elem_math.Tpo -c -o libmath_debug_la-elem_math.lo `test -f '$(top_srcdir)/itpp/base/math/elem_math.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/elem_math.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_debug_la-elem_math.Tpo $(DEPDIR)/libmath_debug_la-elem_math.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/elem_math.cpp' object='libmath_debug_la-elem_math.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_debug_la-elem_math.lo `test -f '$(top_srcdir)/itpp/base/math/elem_math.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/elem_math.cpp libmath_debug_la-error.lo: $(top_srcdir)/itpp/base/math/error.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_debug_la-error.lo -MD -MP -MF $(DEPDIR)/libmath_debug_la-error.Tpo -c -o libmath_debug_la-error.lo `test -f '$(top_srcdir)/itpp/base/math/error.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/error.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_debug_la-error.Tpo $(DEPDIR)/libmath_debug_la-error.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/error.cpp' object='libmath_debug_la-error.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_debug_la-error.lo `test -f '$(top_srcdir)/itpp/base/math/error.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/error.cpp libmath_debug_la-integration.lo: $(top_srcdir)/itpp/base/math/integration.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_debug_la-integration.lo -MD -MP -MF $(DEPDIR)/libmath_debug_la-integration.Tpo -c -o libmath_debug_la-integration.lo `test -f '$(top_srcdir)/itpp/base/math/integration.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/integration.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_debug_la-integration.Tpo $(DEPDIR)/libmath_debug_la-integration.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/integration.cpp' object='libmath_debug_la-integration.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_debug_la-integration.lo `test -f '$(top_srcdir)/itpp/base/math/integration.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/integration.cpp libmath_debug_la-log_exp.lo: $(top_srcdir)/itpp/base/math/log_exp.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_debug_la-log_exp.lo -MD -MP -MF $(DEPDIR)/libmath_debug_la-log_exp.Tpo -c -o libmath_debug_la-log_exp.lo `test -f '$(top_srcdir)/itpp/base/math/log_exp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/log_exp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_debug_la-log_exp.Tpo $(DEPDIR)/libmath_debug_la-log_exp.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/log_exp.cpp' object='libmath_debug_la-log_exp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_debug_la-log_exp.lo `test -f '$(top_srcdir)/itpp/base/math/log_exp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/log_exp.cpp libmath_debug_la-misc.lo: $(top_srcdir)/itpp/base/math/misc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_debug_la-misc.lo -MD -MP -MF $(DEPDIR)/libmath_debug_la-misc.Tpo -c -o libmath_debug_la-misc.lo `test -f '$(top_srcdir)/itpp/base/math/misc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/misc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_debug_la-misc.Tpo $(DEPDIR)/libmath_debug_la-misc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/misc.cpp' object='libmath_debug_la-misc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_debug_la-misc.lo `test -f '$(top_srcdir)/itpp/base/math/misc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/misc.cpp libmath_debug_la-trig_hyp.lo: $(top_srcdir)/itpp/base/math/trig_hyp.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libmath_debug_la-trig_hyp.lo -MD -MP -MF $(DEPDIR)/libmath_debug_la-trig_hyp.Tpo -c -o libmath_debug_la-trig_hyp.lo `test -f '$(top_srcdir)/itpp/base/math/trig_hyp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/trig_hyp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmath_debug_la-trig_hyp.Tpo $(DEPDIR)/libmath_debug_la-trig_hyp.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/base/math/trig_hyp.cpp' object='libmath_debug_la-trig_hyp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmath_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libmath_debug_la-trig_hyp.lo `test -f '$(top_srcdir)/itpp/base/math/trig_hyp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/base/math/trig_hyp.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/base/math/elem_math.cpp000066400000000000000000000126301216575753400177720ustar00rootroot00000000000000/*! * \file * \brief Elementary mathematical functions - source file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { vec sqr(const cvec &data) { vec temp(data.length()); for (int i = 0; i < data.length(); i++) temp(i) = sqr(data(i)); return temp; } mat sqr(const cmat &data) { mat temp(data.rows(), data.cols()); for (int i = 0; i < temp.rows(); i++) { for (int j = 0; j < temp.cols(); j++) { temp(i, j) = sqr(data(i, j)); } } return temp; } vec abs(const cvec &data) { vec temp(data.length()); for (int i = 0;i < data.length();i++) temp[i] = std::abs(data[i]); return temp; } mat abs(const cmat &data) { mat temp(data.rows(), data.cols()); for (int i = 0;i < temp.rows();i++) { for (int j = 0;j < temp.cols();j++) { temp(i, j) = std::abs(data(i, j)); } } return temp; } // Deprecated gamma function. Will be changed to tgamma(). double gamma(double x) { return tgamma(x); } vec gamma(const vec &x) { return apply_function(tgamma, x); } mat gamma(const mat &x) { return apply_function(tgamma, x); } // Calculates factorial coefficient for index <= 170. double fact(int index) { it_error_if(index > 170, "fact(int index): Function overflows if index > 170."); it_error_if(index < 0, "fact(int index): index must be non-negative integer"); double prod = 1; for (int i = 1; i <= index; i++) prod *= static_cast(i); return prod; } // Calculates binomial coefficient "n over k". double binom(int n, int k) { it_assert(k <= n, "binom(n, k): k can not be larger than n"); it_assert((n >= 0) && (k >= 0), "binom(n, k): n and k must be non-negative integers"); k = ((n - k) < k) ? n - k : k; double out = 1.0; for (int i = 1; i <= k; ++i) { out *= (i + n - k); out /= i; } return out; } // Calculates binomial coefficient "n over k". int binom_i(int n, int k) { it_assert(k <= n, "binom_i(n, k): k can not be larger than n"); it_assert((n >= 0) && (k >= 0), "binom_i(n, k): n and k must be non-negative integers"); k = ((n - k) < k) ? n - k : k; int out = 1; for (int i = 1; i <= k; ++i) { out *= (i + n - k); out /= i; } return out; } // Calculates the base 10-logarithm of the binomial coefficient "n over k". double log_binom(int n, int k) { it_assert(k <= n, "log_binom(n, k): k can not be larger than n"); it_assert((n >= 0) && (k >= 0), "log_binom(n, k): n and k must be non-negative integers"); k = ((n - k) < k) ? n - k : k; double out = 0.0; for (int i = 1; i <= k; i++) out += log10(static_cast(i + n - k)) - log10(static_cast(i)); return out; } // Calculates the greatest common divisor int gcd(int a, int b) { it_assert((a >= 0) && (b >= 0), "gcd(a, b): a and b must be non-negative integers"); int v, u, t, q; u = a; v = b; while (v > 0) { q = u / v; t = u - v * q; u = v; v = t; } return u; } vec real(const cvec &data) { vec temp(data.length()); for (int i = 0;i < data.length();i++) temp[i] = data[i].real(); return temp; } mat real(const cmat &data) { mat temp(data.rows(), data.cols()); for (int i = 0;i < temp.rows();i++) { for (int j = 0;j < temp.cols();j++) { temp(i, j) = data(i, j).real(); } } return temp; } vec imag(const cvec &data) { vec temp(data.length()); for (int i = 0;i < data.length();i++) temp[i] = data[i].imag(); return temp; } mat imag(const cmat &data) { mat temp(data.rows(), data.cols()); for (int i = 0;i < temp.rows();i++) { for (int j = 0;j < temp.cols();j++) { temp(i, j) = data(i, j).imag(); } } return temp; } vec arg(const cvec &data) { vec temp(data.length()); for (int i = 0;i < data.length();i++) temp[i] = std::arg(data[i]); return temp; } mat arg(const cmat &data) { mat temp(data.rows(), data.cols()); for (int i = 0;i < temp.rows();i++) { for (int j = 0;j < temp.cols();j++) { temp(i, j) = std::arg(data(i, j)); } } return temp; } #ifdef _MSC_VER cvec conj(const cvec &x) { cvec temp(x.size()); for (int i = 0; i < x.size(); i++) { temp(i) = std::conj(x(i)); } return temp; } cmat conj(const cmat &x) { cmat temp(x.rows(), x.cols()); for (int i = 0; i < x.rows(); i++) { for (int j = 0; j < x.cols(); j++) { temp(i, j) = std::conj(x(i, j)); } } return temp; } #endif } // namespace itpp itpp-4.3.1/itpp/base/math/elem_math.h000066400000000000000000000165041216575753400174430ustar00rootroot00000000000000/*! * \file * \brief Elementary mathematical functions - header file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ELEM_MATH_H #define ELEM_MATH_H #include #include #include // required by std::abs() #include namespace itpp { //!\addtogroup miscfunc //!@{ // -------------------- sqr function -------------------- //! Square of x inline double sqr(double x) { return (x * x); } //! Absolute square of complex-valued x, ||x||^2 inline double sqr(const std::complex& x) { return (x.real() * x.real() + x.imag() * x.imag()); } //! Square of elements inline vec sqr(const vec &x) { return apply_function(sqr, x); } //! Square of elements inline mat sqr(const mat &x) { return apply_function(sqr, x); } //! Absolute square of elements ITPP_EXPORT vec sqr(const cvec &x); //! Absolute square of elements ITPP_EXPORT mat sqr(const cmat &x); // -------------------- abs function -------------------- //! Absolute value inline vec abs(const vec &x) { return apply_function(std::fabs, x); } //! Absolute value inline mat abs(const mat &x) { return apply_function(std::fabs, x); } //! Absolute value inline ivec abs(const ivec &x) { return apply_function(std::abs, x); } //! Absolute value inline imat abs(const imat &x) { return apply_function(std::abs, x); } //! Absolute value ITPP_EXPORT vec abs(const cvec &x); //! Absolute value ITPP_EXPORT mat abs(const cmat &x); // -------------------- sign/sgn functions -------------------- //! Signum function inline double sign(double x) { return (x == 0.0 ? 0.0 : (x < 0.0 ? -1.0 : 1.0)); } //! Signum function inline vec sign(const vec &x) { return apply_function(sign, x); } //! Signum function inline mat sign(const mat &x) { return apply_function(sign, x); } //! Signum function inline double sgn(double x) { return sign(x); } //! Signum function inline vec sgn(const vec &x) { return apply_function(sign, x); } //! Signum function inline mat sgn(const mat &x) { return apply_function(sign, x); } //! Signum function inline int sign_i(int x) { return (x == 0 ? 0 : (x < 0 ? -1 : 1)); } //! Signum function inline ivec sign_i(const ivec &x) { return apply_function(sign_i, x); } //! Signum function inline imat sign_i(const imat &x) { return apply_function(sign_i, x); } //! Signum function inline int sgn_i(int x) { return sign_i(x); } //! Signum function inline ivec sgn_i(const ivec &x) { return apply_function(sign_i, x); } //! Signum function inline imat sgn_i(const imat &x) { return apply_function(sign_i, x); } //! Signum function inline int sign_i(double x) { return (x == 0.0 ? 0 : (x < 0.0 ? -1 : 1)); } // -------------------- sqrt function -------------------- //! Square root of the elements inline vec sqrt(const vec &x) { return apply_function(std::sqrt, x); } //! Square root of the elements inline mat sqrt(const mat &x) { return apply_function(std::sqrt, x); } // -------------------- gamma function -------------------- //! Deprecated gamma function - please use tgamma() instead ITPP_EXPORT double gamma(double x); //! Deprecated gamma function for vectors. Will be changed to tgamma(). ITPP_EXPORT vec gamma(const vec &x); //! Deprecated gamma function for matrices. Will be changed to tgamma(). ITPP_EXPORT mat gamma(const mat &x); // -------------------- rem function -------------------- //! The reminder of the division x/y inline double rem(double x, double y) { return fmod(x, y); } //! Elementwise reminder of the division x/y for vec and double inline vec rem(const vec &x, double y) { return apply_function(rem, x, y); } //! Elementwise reminder of the division x/y for double and vec inline vec rem(double x, const vec &y) { return apply_function(rem, x, y); } //! Elementwise reminder of the division x/y for mat and double inline mat rem(const mat &x, double y) { return apply_function(rem, x, y); } //! Elementwise reminder of the division x/y for double and mat inline mat rem(double x, const mat &y) { return apply_function(rem, x, y); } // -------------------- mod function -------------------- //! Calculates the modulus, i.e. the signed reminder after division inline int mod(int k, int n) { return (n == 0) ? k : (k - n * floor_i(static_cast(k) / n)); } // -------------------- factorial coefficient function -------------------- //! Calculates factorial coefficient for index <= 170. ITPP_EXPORT double fact(int index); // -------------------- binomial coefficient function -------------------- //! Compute the binomial coefficient "n over k". ITPP_EXPORT double binom(int n, int k); //! Compute the binomial coefficient "n over k". ITPP_EXPORT int binom_i(int n, int k); //! Compute the base 10 logarithm of the binomial coefficient "n over k". ITPP_EXPORT double log_binom(int n, int k); // -------------------- greatest common divisor function -------------------- /*! * \brief Compute the greatest common divisor (GCD) \a g of the elements * \a a and \a b. * * \a a and \a b must be non-negative integers. \a gdc(0, 0) is 0 by * convention; all other GCDs are positive integers. */ ITPP_EXPORT int gcd(int a, int b); // -------------------- complex related functions -------------------- //! Real part of complex values ITPP_EXPORT vec real(const cvec &x); //! Real part of complex values ITPP_EXPORT mat real(const cmat &x); //! Imaginary part of complex values ITPP_EXPORT vec imag(const cvec &x); //! Imaginary part of complex values ITPP_EXPORT mat imag(const cmat &x); //! Argument (angle) ITPP_EXPORT vec arg(const cvec &x); //! Argument (angle) ITPP_EXPORT mat arg(const cmat &x); //! Angle inline vec angle(const cvec &x) { return arg(x); } //! Angle inline mat angle(const cmat &x) { return arg(x); } // Added due to a failure in MSVC++ .NET 2005, which crashes on this // code. #ifndef _MSC_VER //! Conjugate of complex value inline cvec conj(const cvec &x) { return apply_function >(std::conj, x); } //! Conjugate of complex value inline cmat conj(const cmat &x) { return apply_function >(std::conj, x); } #else //! Conjugate of complex value ITPP_EXPORT cvec conj(const cvec &x); //! Conjugate of complex value ITPP_EXPORT cmat conj(const cmat &x); #endif //!@} } // namespace itpp #endif // #ifndef ELEM_MATH_H itpp-4.3.1/itpp/base/math/error.cpp000066400000000000000000000163211216575753400171710ustar00rootroot00000000000000/*! * \file * \brief Error functions - source file * \author Tony Ottosson, Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { /*! * Abramowitz and Stegun: Eq. (7.1.14) gives this continued fraction * for erfc(z) * * erfc(z) = sqrt(pi).exp(-z^2). 1 1/2 1 3/2 2 5/2 * --- --- --- --- --- --- ... * z + z + z + z + z + z + * * This is evaluated using Lentz's method, as described in the * narative of Numerical Recipes in C. * * The continued fraction is true providing real(z) > 0. In practice * we like real(z) to be significantly greater than 0, say greater * than 0.5. */ std::complex cerfc_continued_fraction(const std::complex& z) { const double tiny = std::numeric_limits::min(); // first calculate z+ 1/2 1 // --- --- ... // z + z + std::complex f(z); std::complex C(f); std::complex D(0.0); std::complex delta; double a; a = 0.0; do { a += 0.5; D = z + a * D; C = z + a / C; if ((D.real() == 0.0) && (D.imag() == 0.0)) D = tiny; D = 1.0 / D; delta = C * D; f = f * delta; } while (abs(1.0 - delta) > eps); // Do the first term of the continued fraction f = 1.0 / f; // and do the final scaling f = f * exp(-z * z) / std::sqrt(pi); return f; } //! Complementary function to \c cerfc_continued_fraction std::complex cerf_continued_fraction(const std::complex& z) { if (z.real() > 0) return 1.0 - cerfc_continued_fraction(z); else return -1.0 + cerfc_continued_fraction(-z); } /*! * Abramawitz and Stegun: Eq. (7.1.5) gives a series for erf(z) good * for all z, but converges faster for smallish abs(z), say abs(z) < 2. */ std::complex cerf_series(const std::complex& z) { const double tiny = std::numeric_limits::min(); std::complex sum(0.0); std::complex term(z); std::complex z2(z*z); for (int n = 0; (n < 3) || (abs(term) > abs(sum) * tiny); n++) { sum += term / static_cast(2 * n + 1); term *= -z2 / static_cast(n + 1); } return sum * 2.0 / std::sqrt(pi); } /*! * Numerical Recipes quotes a formula due to Rybicki for evaluating * Dawson's Integral: * * exp(-x^2) integral exp(t^2).dt = 1/sqrt(pi) lim sum exp(-(z-n.h)^2) / n * 0 to x h->0 n odd * * This can be adapted to erf(z). */ std::complex cerf_rybicki(const std::complex& z) { double h = 0.2; // numerical experiment suggests this is small enough // choose an even n0, and then shift z->z-n0.h and n->n-h. // n0 is chosen so that real((z-n0.h)^2) is as small as possible. int n0 = 2 * static_cast(z.imag() / (2 * h) + 0.5); std::complex z0(0.0, n0 * h); std::complex zp(z - z0); std::complex sum(0.0, 0.0); // limits of sum chosen so that the end sums of the sum are // fairly small. In this case exp(-(35.h)^2)=5e-22 for (int np = -35; np <= 35; np += 2) { std::complex t(zp.real(), zp.imag() - np * h); std::complex b(exp(t * t) / static_cast(np + n0)); sum += b; } sum *= 2.0 * exp(-z * z) / pi; return std::complex(-sum.imag(), sum.real()); } /* * This function calculates a well known error function erf(z) for * complex z. Three methods are implemented. Which one is used * depends on z. */ std::complex erf(const std::complex& z) { // Use the method appropriate to size of z - // there probably ought to be an extra option for NaN z, or infinite z if (abs(z) < 2.0) return cerf_series(z); else { if (std::abs(z.real()) < 0.5) return cerf_rybicki(z); else return cerf_continued_fraction(z); } } double erfinv(double P) { double Y, A, B, X, Z, W, WI, SN, SD, F, Z2, SIGMA; double A1 = -.5751703, A2 = -1.896513, A3 = -.5496261E-1; double B0 = -.1137730, B1 = -3.293474, B2 = -2.374996, B3 = -1.187515; double C0 = -.1146666, C1 = -.1314774, C2 = -.2368201, C3 = .5073975e-1; double D0 = -44.27977, D1 = 21.98546, D2 = -7.586103; double E0 = -.5668422E-1, E1 = .3937021, E2 = -.3166501, E3 = .6208963E-1; double F0 = -6.266786, F1 = 4.666263, F2 = -2.962883; double G0 = .1851159E-3, G1 = -.2028152E-2, G2 = -.1498384, G3 = .1078639E-1; double H0 = .9952975E-1, H1 = .5211733, H2 = -.6888301E-1; // double RINFM=1.7014E+38; X = P; SIGMA = sign(X); it_error_if(X < -1 || X > 1, "erfinv : argument out of bounds"); Z = fabs(X); if (Z > .85) { A = 1 - Z; B = Z; W = std::sqrt(-log(A + A * B)); if (W >= 2.5) { if (W >= 4.) { WI = 1. / W; SN = ((G3 * WI + G2) * WI + G1) * WI; SD = ((WI + H2) * WI + H1) * WI + H0; F = W + W * (G0 + SN / SD); } else { SN = ((E3 * W + E2) * W + E1) * W; SD = ((W + F2) * W + F1) * W + F0; F = W + W * (E0 + SN / SD); } } else { SN = ((C3 * W + C2) * W + C1) * W; SD = ((W + D2) * W + D1) * W + D0; F = W + W * (C0 + SN / SD); } } else { Z2 = Z * Z; F = Z + Z * (B0 + A1 * Z2 / (B1 + Z2 + A2 / (B2 + Z2 + A3 / (B3 + Z2)))); } Y = SIGMA * F; return Y; } double Qfunc(double x) { return (0.5 * ::erfc(x / 1.41421356237310)); } // Error function vec erf(const vec &x) { return apply_function(::erf, x); } mat erf(const mat &x) { return apply_function(::erf, x); } cvec erf(const cvec &x) { return apply_function >(erf, x); } cmat erf(const cmat &x) { return apply_function >(erf, x); } // Inverse of error function vec erfinv(const vec &x) { return apply_function(erfinv, x); } mat erfinv(const mat &x) { return apply_function(erfinv, x); } // Complementary error function vec erfc(const vec &x) { return apply_function(::erfc, x); } mat erfc(const mat &x) { return apply_function(::erfc, x); } // Q-function vec Qfunc(const vec &x) { return apply_function(Qfunc, x); } mat Qfunc(const mat &x) { return apply_function(Qfunc, x); } } // namespace itpp itpp-4.3.1/itpp/base/math/error.h000066400000000000000000000056521216575753400166430ustar00rootroot00000000000000/*! * \file * \brief Error functions - header file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ERROR_H #define ERROR_H #include #include namespace itpp { //!\addtogroup errorfunc //!@{ /*! * \brief Error function for complex argument * \author Adam Piatyszek * * This function calculates a well known error function \c erf(z) * for complex \c z. The implementation is based on unofficial * implementation for Octave. Here is a part of the author's note * from original sources: * * Put together by John Smith john at arrows dot demon dot co dot uk, * using ideas by others. * * Calculate \c erf(z) for complex \c z. * Three methods are implemented; which one is used depends on z. * * The code includes some hard coded constants that are intended to * give about 14 decimal places of accuracy. This is appropriate for * 64-bit floating point numbers. */ ITPP_EXPORT std::complex erf(const std::complex& z); //! Inverse of error function ITPP_EXPORT double erfinv(double x); //! Q-function ITPP_EXPORT double Qfunc(double x); // ---------------------------------------------------------------------- // functions for matrices and vectors // ---------------------------------------------------------------------- //! Error function ITPP_EXPORT vec erf(const vec &x); //! Error function ITPP_EXPORT mat erf(const mat &x); //! Error function ITPP_EXPORT cvec erf(const cvec &x); //! Error function ITPP_EXPORT cmat erf(const cmat &x); //! Inverse of error function ITPP_EXPORT vec erfinv(const vec &x); //! Inverse of error function ITPP_EXPORT mat erfinv(const mat &x); //! Complementary error function ITPP_EXPORT vec erfc(const vec &x); //! Complementary error function ITPP_EXPORT mat erfc(const mat &x); //! Q-function ITPP_EXPORT vec Qfunc(const vec &x); //! Q-function ITPP_EXPORT mat Qfunc(const mat &x); //!@} } // namespace itpp #endif // #ifndef ERROR_H itpp-4.3.1/itpp/base/math/integration.cpp000066400000000000000000000036641216575753400203710ustar00rootroot00000000000000/*! * \file * \brief Implementation of numerical integration * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include //! \cond namespace itpp { //wrapper to convert double(*f)(double) to function object class Integrand_Wrapper { typedef double(*Ftn)(double); Ftn _f; public: explicit Integrand_Wrapper(Ftn f): _f(f) {} double operator()(double x) const {return _f(x);} }; template double quad(Integrand_Wrapper, double, double, double); template double quadl(Integrand_Wrapper, double, double, double); //--------------------- quad() ---------------------------------------- double quad(double(*f)(double), double a, double b, double tol) { return quad(Integrand_Wrapper(f), a, b, tol); } //--------------------- quadl() ---------------------------------------- double quadl(double(*f)(double), double a, double b, double tol) { return quadl(Integrand_Wrapper(f), a, b, tol); } } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/math/integration.h000066400000000000000000000212621216575753400200300ustar00rootroot00000000000000/*! * \file * \brief Definition of numerical integration * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef INTEGRATION_H #define INTEGRATION_H #include #include #include #include #include #include namespace itpp { namespace details { //! Simpson quadrature integration recursion step template double quadstep(Ftn f, double a, double b, double fa, double fm, double fb, double is) { double Q, m, h, fml, fmr, i1, i2; m = (a + b) / 2; h = (b - a) / 4; fml = f(a + h); fmr = f(b - h); i1 = h / 1.5 * (fa + 4 * fm + fb); i2 = h / 3 * (fa + 4 * (fml + fmr) + 2 * fm + fb); i1 = (16 * i2 - i1) / 15; if((is + (i1 - i2) == is) || (m <= a) || (b <= m)) { if((m <= a) || (b <= m)) { it_warning("Interval contains no more machine number. Required tolerance may not be met"); } Q = i1; return Q; } else { Q = quadstep(f, a, m, fa, fml, fm, is) + quadstep(f, m, b, fm, fmr, fb, is); } return Q; } //! Adaptive Lobatto quadrature integration recursion step template double quadlstep(Ftn f, double a, double b, double fa, double fb, double is) { static const double alpha = std::sqrt(2.0 / 3); static const double beta = 1.0 / std::sqrt(5.0); double Q, h, m, mll, ml, mr, mrr, fmll, fml, fm, fmr, fmrr, i1, i2; h = (b - a) / 2; m = (a + b) / 2; mll = m - alpha * h; ml = m - beta * h; mr = m + beta * h; mrr = m + alpha * h; fmll = f(mll); fml = f(ml); fm = f(m); fmr = f(mr); fmrr = f(mrr); i2 = (h / 6) * (fa + fb + 5 * (fml + fmr)); i1 = (h / 1470) * (77 * (fa + fb) + 432 * (fmll + fmrr) + 625 * (fml + fmr) + 672 * fm); if((is + (i1 - i2) == is) || (mll <= a) || (b <= mrr)) { if((m <= a) || (b <= m)) { it_warning("Interval contains no more machine number. Required tolerance may not be met"); } Q = i1; return Q; } else { Q = quadlstep(f, a, mll, fa, fmll, is) + quadlstep(f, mll, ml, fmll, fml, is) + quadlstep(f, ml, m, fml, fm, is) + quadlstep(f, m, mr, fm, fmr, is) + quadlstep(f, mr, mrr, fmr, fmrr, is) + quadlstep(f, mrr, b, fmrr, fb, is); } return Q; } } /*! \addtogroup integration \brief Numerical integration routines */ //@{ /*! 1-dimensional numerical Simpson quadrature integration Calculate the 1-dimensional integral \f[ \int_a^b f(x) dx \f] Uses an adaptive Simpson quadrature method. See [Gander] for more details. The integrand is specified as a templated function object. Example: \code #include "itpp/itbase.h" struct Integrand_Functor { double operator()(const double x) const { return x*log(x); } }; int main() { double res = quad(Integrand_Functor(), 1.5, 3.5); cout << "res = " << res << endl; return 0; } \endcode References: [Gander] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at http://www.inf.ethz.ch/personal/gander. */ template double quad(Ftn f, double a, double b, double tol = std::numeric_limits::epsilon()) { vec x(3), y(3), yy(5); double Q, fa, fm, fb, is; x = vec_3(a, (a + b) / 2, b); y = apply_functor(f, x); fa = y(0); fm = y(1); fb = y(2); yy = apply_functor(f, a + vec(".9501 .2311 .6068 .4860 .8913") * (b - a)); is = (b - a) / 8 * (sum(y) + sum(yy)); if(is == 0.0) is = b - a; is = is * tol / std::numeric_limits::epsilon(); Q = details::quadstep(f, a, b, fa, fm, fb, is); return Q; } /*! 1-dimensional numerical Simpson quadrature integration Calculate the 1-dimensional integral \f[ \int_a^b f(x) dx \f] Uses an adaptive Simpson quadrature method. See [Gander] for more details. The integrand is specified as a function: \code double f(double) \endcode Example: \code #include "itpp/itbase.h" double f(const double x) { return x*log(x); } int main() { double res = quad( f, 1.5, 3.5); cout << "res = " << res << endl; return 0; } \endcode References: [Gander] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at http://www.inf.ethz.ch/personal/gander. */ ITPP_EXPORT double quad(double(*f)(double), double a, double b, double tol = std::numeric_limits::epsilon()); /*! 1-dimensional numerical adaptive Lobatto quadrature integration Calculate the 1-dimensional integral \f[ \int_a^b f(x) dx \f] Uses an adaptive Lobatto quadrature method. See [Gander] for more details. The integrand is specified as a templated function object. Example: \code #include "itpp/itbase.h" struct Integrand_Functor { double operator()(const double x) const { return x*log(x); } }; int main() { double res = quadl(Integrand_Functor(), 1.5, 3.5); cout << "res = " << res << endl; return 0; } \endcode References: [Gander] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at http:// www.inf.ethz.ch/personal/gander. */ template double quadl(Ftn f, double a, double b, double tol = std::numeric_limits::epsilon()) { static const double alpha = std::sqrt(2.0 / 3); static const double beta = 1.0 / std::sqrt(5.0); double Q, m, h, x1, x2, x3, fa, fb, i1, i2, is, s, erri1, erri2, R; vec x(13), y(13); double tol2 = tol; m = (a + b) / 2; h = (b - a) / 2; x1 = .942882415695480; x2 = .641853342345781; x3 = .236383199662150; x(0) = a; x(1) = m - x1 * h; x(2) = m - alpha * h; x(3) = m - x2 * h; x(4) = m - beta * h; x(5) = m - x3 * h; x(6) = m; x(7) = m + x3 * h; x(8) = m + beta * h; x(9) = m + x2 * h; x(10) = m + alpha * h; x(11) = m + x1 * h; x(12) = b; y = apply_functor(f, x); fa = y(0); fb = y(12); i2 = (h / 6) * (y(0) + y(12) + 5 * (y(4) + y(8))); i1 = (h / 1470) * (77 * (y(0) + y(12)) + 432 * (y(2) + y(10)) + 625 * (y(4) + y(8)) + 672 * y(6)); is = h * (.0158271919734802 * (y(0) + y(12)) + .0942738402188500 * (y(1) + y(11)) + .155071987336585 * (y(2) + y(10)) + .188821573960182 * (y(3) + y(9)) + .199773405226859 * (y(4) + y(8)) + .224926465333340 * (y(5) + y(7)) + .242611071901408 * y(6)); s = sign(is); if(s == 0.0) s = 1; erri1 = std::abs(i1 - is); erri2 = std::abs(i2 - is); R = 1; if(erri2 != 0.0) R = erri1 / erri2; if(R > 0 && R < 1) tol2 = tol2 / R; is = s * std::abs(is) * tol2 / std::numeric_limits::epsilon(); if(is == 0.0) is = b - a; Q = details::quadlstep(f, a, b, fa, fb, is); return Q; } /*! 1-dimensional numerical adaptive Lobatto quadrature integration Calculate the 1-dimensional integral \f[ \int_a^b f(x) dx \f] Uses an adaptive Lobatto quadrature method. See [Gander] for more details. The integrand is specified as a function: \code double f(double) \endcode Example: \code #include "itpp/itbase.h" double f(const double x) { return x*log(x); } int main() { double res = quadl( f, 1.5, 3.5); cout << "res = " << res << endl; return 0; } \endcode References: [Gander] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at http:// www.inf.ethz.ch/personal/gander. */ ITPP_EXPORT double quadl(double(*f)(double), double a, double b, double tol = std::numeric_limits::epsilon()); //@} } // namespace itpp #endif // #ifndef INTEGRATION_H itpp-4.3.1/itpp/base/math/log_exp.cpp000066400000000000000000000033521216575753400174750ustar00rootroot00000000000000/*! * \file * \brief Logarithmic and exponenential functions - source file * \author Tony Ottosson, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2008 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { // log-2 of the elements vec log2(const vec &x) { return apply_function(::log2, x); } mat log2(const mat &x) { return apply_function(::log2, x); } // Safe substitute for log(exp(log_a) + exp(log_b)) double log_add(double log_a, double log_b) { if (log_a < log_b) { double tmp = log_a; log_a = log_b; log_b = tmp; } double negdelta = log_b - log_a; if ((negdelta < log_double_min) || std::isnan(negdelta)) return log_a; else return (log_a + log1p(std::exp(negdelta))); } } itpp-4.3.1/itpp/base/math/log_exp.h000066400000000000000000000210411216575753400171350ustar00rootroot00000000000000/*! * \file * \brief Logarithmic and exponenential functions - header file * \author Tony Ottosson, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef LOG_EXP_H #define LOG_EXP_H #include #include #include namespace itpp { //!\addtogroup logexpfunc //!@{ // ---------------------------------------------------------------------- // scalar functions // ---------------------------------------------------------------------- //! Base-b logarithm inline double logb(double b, double x) { return (std::log(x) / std::log(b)); } //! Calculate two to the power of x (2^x); x is integer inline int pow2i(int x) { return ((x < 0) ? 0 : (1 << x)); } //! Calculate two to the power of x (2^x) inline double pow2(double x) { return std::pow(2.0, x); } //! Calculate two to the power of x (2^x) for large integer x inline double pow2(int x) { #ifdef _MSC_VER //use pow since it seems to be faster on MSVC return std::pow(2.0, x); #else return std::ldexp(1.0,x); #endif } //! Calculate ten to the power of x (10^x) inline double pow10(double x) { return std::pow(10.0, x); } //! Decibel of x (10*log10(x)) inline double dB(double x) { return 10.0 * std::log10(x); } //! Inverse of decibel of x inline double inv_dB(double x) { return std::pow(10.0, 0.1 * x); } //! Calculate the number of bits needed to represent an integer \c n inline int int2bits(int n) { it_assert(n >= 0, "int2bits(): Improper argument value"); if (n == 0) return 1; int b = 0; while (n) { n >>= 1; ++b; } return b; } //! Calculate the number of bits needed to represent \c n different values (levels). inline int levels2bits(int n) { it_assert(n > 0, "levels2bits(): Improper argument value"); return int2bits(--n); } //! Constant definition to speed up trunc_log() and trunc_exp() const double log_double_max = std::log(std::numeric_limits::max()); //! Constant definition to speed up trunc_log(), trunc_exp() and log_add() const double log_double_min = std::log(std::numeric_limits::min()); /*! \brief Truncated natural logarithm function This truncated function provides a solution in the cases when the logarithm argument is less or equal to zero or infinity. The function checks for such extreme values and use some kind of truncation (saturation) before calculating the logarithm. The truncated logarithm function can be used for calculation of log-likelihood in soft demodulators, when numerical instability problem might occur. */ inline double trunc_log(double x) { if (std::numeric_limits::is_iec559) { if (x == std::numeric_limits::infinity()) return log_double_max; if (x <= 0) return log_double_min; } return std::log(x); } /*! \brief Truncated exponential function This truncated function provides a solution in the case when the exponent function results in infinity. The function checks for an extreme value and use truncation (saturation) before calculating the result. The truncated exponential function can be used when numerical instability problem occurs for a standard exp function. */ inline double trunc_exp(double x) { if (std::numeric_limits::is_iec559 && (x >= log_double_max)) return std::numeric_limits::max(); return std::exp(x); } //! Safe substitute for log(exp(log_a) + exp(log_b)) ITPP_EXPORT double log_add(double log_a, double log_b); // ---------------------------------------------------------------------- // functions on vectors and matrices // ---------------------------------------------------------------------- //! Exp of the elements of a vector \c x inline vec exp(const vec &x) { return apply_function(std::exp, x); } //! Exp of the elements of a complex vector \c x inline cvec exp(const cvec &x) { return apply_function >(std::exp, x); } //! Exp of the elements of a matrix \c m inline mat exp(const mat &m) { return apply_function(std::exp, m); } //! Exp of the elements of a complex matrix \c m inline cmat exp(const cmat &m) { return apply_function >(std::exp, m); } //! Calculates x to the power of y (x^y) inline vec pow(const double x, const vec &y) { return apply_function(std::pow, x, y); } //! Calculates x to the power of y (x^y) inline mat pow(const double x, const mat &y) { return apply_function(std::pow, x, y); } //! Calculates x to the power of y (x^y) inline vec pow(const vec &x, const double y) { return apply_function(std::pow, x, y); } //! Calculates x to the power of y (x^y) inline mat pow(const mat &x, const double y) { return apply_function(std::pow, x, y); } //! Calculates two to the power of x (2^x) inline vec pow2(const vec &x) { return apply_function(pow2, x); } //! Calculates two to the power of x (2^x) for integer x inline vec pow2(const ivec &x) { vec out(x.length()); for(int i = 0; i < x.length(); i++) out(i) = pow2(x(i)); return out; } //! Calculates two to the power of x (2^x) inline mat pow2(const mat &x) { return apply_function(pow2, x); } //! Calculates two to the power of x (2^x) for integer x inline mat pow2(const imat &x) { mat out(x.rows(), x.cols()); for(int i = 0; i < x.rows(); i++) { for(int j = 0; j < x.cols(); j++) { out(i, j) = pow2(x(i, j)); } } return out; } //! Calculates ten to the power of x (10^x) inline vec pow10(const vec &x) { return apply_function(pow10, x); } //! Calculates ten to the power of x (10^x) inline mat pow10(const mat &x) { return apply_function(pow10, x); } //! The natural logarithm of the elements inline vec log(const vec &x) { return apply_function(std::log, x); } //! The natural logarithm of the elements inline mat log(const mat &x) { return apply_function(std::log, x); } //! The natural logarithm of the elements inline cvec log(const cvec &x) { return apply_function >(std::log, x); } //! The natural logarithm of the elements inline cmat log(const cmat &x) { return apply_function >(std::log, x); } // Cygwin defines log2 macro conflicting with IT++ functions #if defined(log2) # undef log2 #endif //! log-2 of the elements ITPP_EXPORT vec log2(const vec &x); //! log-2 of the elements ITPP_EXPORT mat log2(const mat &x); //! log-10 of the elements inline vec log10(const vec &x) { return apply_function(std::log10, x); } //! log-10 of the elements inline mat log10(const mat &x) { return apply_function(std::log10, x); } //! log-b of \c x inline vec logb(double b, const vec &x) { return apply_function(itpp::logb, b, x); } //! log-b of \c x inline mat logb(double b, const mat &x) { return apply_function(itpp::logb, b, x); } //! Calculates 10*log10(x) inline vec dB(const vec &x) { return apply_function(dB, x); } //! Calculates 10*log10(x) inline mat dB(const mat &x) { return apply_function(dB, x); } //! Calulates the inverse of dB, 10^(x/10) inline vec inv_dB(const vec &x) { return apply_function(inv_dB, x); } //! Calculates the inverse of dB, 10^(x/10) inline mat inv_dB(const mat &x) { return apply_function(inv_dB, x); } //! Calculate the number of bits needed to represent each integer in a vector inline ivec int2bits(const ivec& v) { return apply_function(int2bits, v); } //! Calculate the number of bits needed to represent a numer of levels saved in a vector inline ivec levels2bits(const ivec& v) { return apply_function(levels2bits, v); } //!@} } // namespace itpp #endif // #ifndef LOG_EXP_H itpp-4.3.1/itpp/base/math/min_max.h000066400000000000000000000147711216575753400171440ustar00rootroot00000000000000/*! * \file * \brief Minimum and maximum functions on vectors and matrices * \author Tony Ottosson, Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MIN_MAX_H #define MIN_MAX_H #include namespace itpp { /*! * \addtogroup miscfunc * @{ */ //! Maximum value of vector template T max(const Vec &v) { T maxdata = v(0); for (int i = 1; i < v.length(); i++) if (v(i) > maxdata) maxdata = v(i); return maxdata; } //! Maximum value of vector, also returns the index position of max value template T max(const Vec &v, int& index) { T maxdata = v(0); index = 0; for (int i = 1; i < v.length(); i++) if (v(i) > maxdata) { maxdata = v(i); index = i; } return maxdata; } /*! * Maximum values over each row/column in the matrix \c m * * max(m) = max(m, 1) returns a vector where the elements are * maximum over each column, whereas max(m, 2) returns a vector * where the elements are maximum over each row. */ template Vec max(const Mat &m, int dim = 1) { it_assert((dim == 1) || (dim == 2), "max(): dimension need to be 1 or 2"); Vec out; if (dim == 1) { out.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = max(m.get_col(i)); } else { out.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = max(m.get_row(i)); } return out; } /*! * Maximum values over each row/column in the matrix \c m * * max(m) = max(m, 1) returns a vector where the elements are * maximum over each column, whereas max(m, 2) returns a vector * where the elements are maximum over each row. * * Also returns a vector of indices with positions of maximum value within * a column/row. */ template Vec max(const Mat &m, ivec &index, int dim = 1) { it_assert((dim == 1) || (dim == 2), "max(): dimension need to be 1 or 2"); Vec out; if (dim == 1) { out.set_size(m.cols(), false); index.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = max(m.get_col(i), index(i)); } else { out.set_size(m.rows(), false); index.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = max(m.get_row(i), index(i)); } return out; } //! Minimum value of vector template T min(const Vec &in) { T mindata = in[0]; for (int i = 1; i < in.length(); i++) if (in[i] < mindata) mindata = in[i]; return mindata; } //! Minimum value of vector, also returns the index position of min value template T min(const Vec &in, int& index) { T mindata = in[0]; index = 0; for (int i = 1; i < in.length(); i++) if (in[i] < mindata) { mindata = in[i]; index = i; } return mindata; } /*! * Minimum values over each row/column in the matrix \c m * * min(m) = min(m, 1) returns a vector where the elements are * minimum over each column, whereas min(m, 2) returns a vector * where the elements are minimum over each row. */ template Vec min(const Mat &m, int dim = 1) { it_assert((dim == 1) || (dim == 2), "min(): dimension need to be 1 or 2"); Vec out; if (dim == 1) { out.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = min(m.get_col(i)); } else { out.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = min(m.get_row(i)); } return out; } /*! * Minimum values over each row/column in the matrix \c m * * min(m) = min(m, 1) returns a vector where the elements are * minimum over each column, whereas min(m, 2) returns a vector * where the elements are minimum over each row. * * Also returns a vector of indices with positions of minimum value within * a column/row. */ template Vec min(const Mat &m, ivec &index, int dim = 1) { it_assert((dim == 1) || (dim == 2), "min(): dimension need to be 1 or 2"); Vec out; if (dim == 1) { out.set_size(m.cols(), false); index.set_size(m.cols(), false); for (int i = 0; i < m.cols(); i++) out(i) = min(m.get_col(i), index(i)); } else { out.set_size(m.rows(), false); index.set_size(m.rows(), false); for (int i = 0; i < m.rows(); i++) out(i) = min(m.get_row(i), index(i)); } return out; } //! Return the postion of the maximum element in the vector template int max_index(const Vec &in) { int maxindex = 0; for (int i = 1; i < in.length(); i++) if (in[i] > in[maxindex]) maxindex = i; return maxindex; } //! Return the postion of the maximum element in the matrix template void max_index(const Mat &m, int &row, int &col) { T maxdata = m(0, 0); row = col = 0; for (int i = 0; i < m.rows(); i++) for (int j = 0; j < m.cols(); j++) if (m(i, j) > maxdata) { row = i; col = j; maxdata = m(i, j); } } //! Return the postion of the minimum element in the vector template int min_index(const Vec &in) { int minindex = 0; for (int i = 1; i < in.length(); i++) if (in[i] < in[minindex]) minindex = i; return minindex; } //! Return the postion of the minimum element in the matrix template void min_index(const Mat &m, int &row, int &col) { T mindata = m(0, 0); row = col = 0; for (int i = 0; i < m.rows(); i++) for (int j = 0; j < m.cols(); j++) if (m(i, j) < mindata) { row = i; col = j; mindata = m(i, j); } } /*! * @} */ } //namespace itpp #endif /* MIN_MAX_H */ itpp-4.3.1/itpp/base/math/misc.cpp000066400000000000000000000032041216575753400167670ustar00rootroot00000000000000/*! * \file * \brief Miscellaneous functions - source file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #ifndef _MSC_VER # include #else # include #endif namespace itpp { std::string itpp_version(void) { #ifdef PACKAGE_VERSION return std::string(PACKAGE_VERSION); #else return std::string("Warning: Version unknown!"); #endif } bool is_bigendian() { int i = 1; char *p = reinterpret_cast(&i); if (p[0] == 1) // Lowest address contains the least significant byte return false; // LITTLE_ENDIAN else return true; // BIG_ENDIAN } } //namespace itpp itpp-4.3.1/itpp/base/math/misc.h000066400000000000000000000062561216575753400164460ustar00rootroot00000000000000/*! * \file * \brief Miscellaneous functions - header file * \author Tony Ottosson, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MISC_H #define MISC_H #include #include #include #include namespace std { //! Output stream operator for complex numbers template std::ostream& operator<<(std::ostream &os, const std::complex &x) { os << x.real(); ios::fmtflags saved_format = os.setf(ios::showpos); os << x.imag(); os.setf(saved_format, ios::showpos); return os << 'i'; } //! Input stream operator for complex numbers template std::istream& operator>>(std::istream &is, std::complex &x) { T re, im; char c; is >> c; if (c == '(') { is >> re >> c; if (c == ',') { is >> im >> c; if (c == ')') { x = complex(re, im); } else { is.setstate(ios_base::failbit); } } else if (c == ')') { x = complex(re, T(0)); } else { is.setstate(ios_base::failbit); } } else { is.putback(c); is >> re; if (!is.eof() && ((c = static_cast(is.peek())) == '+' || c == '-')) { is >> im >> c; if (c == 'i') { x = complex(re, im); } else { is.setstate(ios_base::failbit); } } else { x = complex(re, T(0)); } } return is; } } // namespace std //! itpp namespace namespace itpp { //! Constant Pi const double pi = 3.14159265358979323846; //! Constant 2*Pi const double m_2pi = 2 * pi; //! Constant eps const double eps = std::numeric_limits::epsilon(); //! \addtogroup miscfunc //!@{ //! Return true if x is an integer inline bool is_int(double x) { double dummy; return (modf(x, &dummy) == 0.0); } //! Return true if x is an even integer inline bool is_even(int x) { return ((x&1) == 0); } //! Returns IT++ library version number, e.g. "3.7.1". ITPP_EXPORT std::string itpp_version(); //! Returns true if machine endianness is BIG_ENDIAN ITPP_EXPORT bool is_bigendian(); //! This function is deprecated. Please use is_bigendian() instead. inline bool check_big_endianness() { return is_bigendian(); } //!@} } //namespace itpp #endif // #ifndef MISC_H itpp-4.3.1/itpp/base/math/sources.mk000066400000000000000000000011411216575753400173420ustar00rootroot00000000000000h_base_math_sources = \ $(top_srcdir)/itpp/base/math/elem_math.h \ $(top_srcdir)/itpp/base/math/error.h \ $(top_srcdir)/itpp/base/math/integration.h \ $(top_srcdir)/itpp/base/math/log_exp.h \ $(top_srcdir)/itpp/base/math/min_max.h \ $(top_srcdir)/itpp/base/math/misc.h \ $(top_srcdir)/itpp/base/math/trig_hyp.h cpp_base_math_sources = \ $(top_srcdir)/itpp/base/math/elem_math.cpp \ $(top_srcdir)/itpp/base/math/error.cpp \ $(top_srcdir)/itpp/base/math/integration.cpp \ $(top_srcdir)/itpp/base/math/log_exp.cpp \ $(top_srcdir)/itpp/base/math/misc.cpp \ $(top_srcdir)/itpp/base/math/trig_hyp.cpp itpp-4.3.1/itpp/base/math/trig_hyp.cpp000066400000000000000000000035461216575753400176720ustar00rootroot00000000000000/*! * \file * \brief Trigonometric and hyperbolic functions - source file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2008 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { //! Inverse sine hyperbolic function vec asinh(const vec &x) { return apply_function(::asinh, x); } //! Inverse sine hyperbolic function mat asinh(const mat &x) { return apply_function(::asinh, x); } //! Inverse cosine hyperbolic function vec acosh(const vec &x) { return apply_function(::acosh, x); } //! Inverse cosine hyperbolic function mat acosh(const mat &x) { return apply_function(::acosh, x); } //! Inverse tan hyperbolic function vec atanh(const vec &x) { return apply_function(::atanh, x); } //! Inverse tan hyperbolic function mat atanh(const mat &x) { return apply_function(::atanh, x); } } // namespace itpp itpp-4.3.1/itpp/base/math/trig_hyp.h000066400000000000000000000077731216575753400173450ustar00rootroot00000000000000/*! * \file * \brief Trigonometric and hyperbolic functions - header file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef TRIG_HYP_H #define TRIG_HYP_H #include #include namespace itpp { //!\addtogroup trifunc //!@{ //! Sinc function: sinc(x) = sin(pi*x)/pi*x inline double sinc(double x) { if (x == 0) { return 1.0; } else { double pix = itpp::pi * x; return sin(pix) / pix; } } //! Sine function inline vec sin(const vec &x) { return apply_function(std::sin, x); } //! Sine function inline mat sin(const mat &x) { return apply_function(std::sin, x); } //! Cosine function inline vec cos(const vec &x) { return apply_function(std::cos, x); } //! Cosine function inline mat cos(const mat &x) { return apply_function(std::cos, x); } //! Tan function inline vec tan(const vec &x) { return apply_function(std::tan, x); } //! Tan function inline mat tan(const mat &x) { return apply_function(std::tan, x); } //! Inverse sine function inline vec asin(const vec &x) { return apply_function(std::asin, x); } //! Inverse sine function inline mat asin(const mat &x) { return apply_function(std::asin, x); } //! Inverse cosine function inline vec acos(const vec &x) { return apply_function(std::acos, x); } //! Inverse cosine function inline mat acos(const mat &x) { return apply_function(std::acos, x); } //! Inverse tan function inline vec atan(const vec &x) { return apply_function(std::atan, x); } //! Inverse tan function inline mat atan(const mat &x) { return apply_function(std::atan, x); } //! Sinc function, sin(pi*x)/(pi*x) inline vec sinc(const vec &x) { return apply_function(sinc, x); } //! Sinc function, sin(pi*x)/(pi*x) inline mat sinc(const mat &x) { return apply_function(sinc, x); } //!@} //!\addtogroup hypfunc //!@{ //! Sine hyperbolic function inline vec sinh(const vec &x) { return apply_function(std::sinh, x); } //! Sine hyperbolic function inline mat sinh(const mat &x) { return apply_function(std::sinh, x); } //! Cosine hyperbolic function inline vec cosh(const vec &x) { return apply_function(std::cosh, x); } //! Cosine hyperbolic function inline mat cosh(const mat &x) { return apply_function(std::cosh, x); } //! Tan hyperbolic function inline vec tanh(const vec &x) { return apply_function(std::tanh, x); } //! Tan hyperbolic function inline mat tanh(const mat &x) { return apply_function(std::tanh, x); } //! Inverse sine hyperbolic function ITPP_EXPORT vec asinh(const vec &x); //! Inverse sine hyperbolic function ITPP_EXPORT mat asinh(const mat &x); //! Inverse cosine hyperbolic function ITPP_EXPORT vec acosh(const vec &x); //! Inverse cosine hyperbolic function ITPP_EXPORT mat acosh(const mat &x); //! Inverse tan hyperbolic function ITPP_EXPORT vec atanh(const vec &x); //! Inverse tan hyperbolic function ITPP_EXPORT mat atanh(const mat &x); //!@} } // namespace itpp #endif // #ifndef TRIG_HYP_H itpp-4.3.1/itpp/base/operators.cpp000066400000000000000000000300501216575753400171200ustar00rootroot00000000000000/*! * \file * \brief Implementation of operators for vectors and matricies of different * types * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { //----------- Scalar and a ivec ----------------- vec operator+(const double &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator+(): Vector of zero length"); vec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s + double(v(i)); } return temp; } vec operator-(const double &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator-(): Vector of zero length"); vec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s - double(v(i)); } return temp; } vec operator*(const double &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator*(): Vector of zero length"); vec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s * double(v(i)); } return temp; } vec operator/(const double &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator/(): Vector of zero length"); vec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s / double(v(i)); } return temp; } vec operator/(const ivec &v, const double &s) { it_assert_debug(v.size() > 0, "operator/(): Vector of zero length"); vec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = double(v(i)) / s; } return temp; } cvec operator+(const std::complex &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator+(): Vector of zero length"); cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s + std::complex(v(i)); } return temp; } cvec operator-(const std::complex &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator-(): Vector of zero length"); cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s - std::complex(v(i)); } return temp; } cvec operator*(const std::complex &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator*(): Vector of zero length"); cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s * std::complex(v(i)); } return temp; } cvec operator/(const std::complex &s, const ivec &v) { it_assert_debug(v.size() > 0, "operator/(): Vector of zero length"); cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s / std::complex(v(i)); } return temp; } cvec operator/(const ivec &v, const std::complex &s) { it_assert_debug(v.size() > 0, "operator/(): Vector of zero length"); cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = std::complex(v(i)) / s; } return temp; } //----------- Scalar and a cvec ----------------- cvec operator+(const double &s, const cvec &v) { it_assert_debug(v.size() > 0, "operator+(): Vector of zero length"); cvec temp = v; for (int i = 0;i < v.size();i++) { temp(i) += s; } return temp; } cvec operator-(const double &s, const cvec &v) { it_assert_debug(v.size() > 0, "operator-(): Vector of zero length"); cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = std::complex((double)s - v(i).real(), -v(i).imag()); } return temp; } cvec operator*(const double &s, const cvec &v) { it_assert_debug(v.size() > 0, "operator*(): Vector of zero length"); cvec temp = v; for (int i = 0;i < v.size();i++) { temp(i) *= (double)s; } return temp; } cvec operator/(const cvec &v, const double &s) { it_assert_debug(v.size() > 0, "operator/(): Vector of zero length"); cvec temp = v; for (int i = 0;i < v.size();i++) { temp(i) /= (double)s; } return temp; } cvec operator/(const double &s, const cvec &v) { it_assert_debug(v.size() > 0, "operator/(): Vector of zero length"); cvec temp(v.length()); for (int i = 0;i < v.size();i++) { temp(i) = s / v(i); } return temp; } //----------- Scalar and a cmat ----------------- cmat operator+(const double &s, const cmat &m) { it_assert_debug(m.rows() > 0 && m.cols() > 0, "operator+(): Matrix of zero length"); cmat temp = m; for (int i = 0;i < m._datasize();i++) { temp._data()[i] += s; } return temp; } cmat operator-(const double &s, const cmat &m) { it_assert_debug(m.rows() > 0 && m.cols() > 0, "operator-(): Matrix of zero length"); cmat temp(m.rows(), m.cols()); for (int i = 0;i < m._datasize();i++) { temp._data()[i] = std::complex((double)s - m(i).real(), -m(i).imag()); } return temp; } cmat operator*(const double &s, const cmat &m) { it_assert_debug(m.rows() > 0 && m.cols() > 0, "operator*(): Matrix of zero length"); cmat temp = m; for (int i = 0;i < m._datasize();i++) { temp._data()[i] *= (double)s; } return temp; } cmat operator*(const std::complex &s, const mat &m) { it_assert_debug(m.rows() > 0 && m.cols() > 0, "operator*(): Matrix of zero length"); cmat temp(m.rows(), m.cols()); for (int i = 0;i < m._datasize();i++) { temp._data()[i] = s * m._data()[i]; } return temp; } cmat operator/(const cmat &m, const double &s) { it_assert_debug(m.rows() > 0 && m.cols() > 0, "operator/(): Matrix of zero length"); cmat temp = m; for (int i = 0;i < m._datasize();i++) { temp._data()[i] /= (double)s; } return temp; } //---------------------- between matrix and scalar -------------------- //----------- Multiplication of a scalar and a vec ----------------- cvec operator*(const std::complex &s, const vec &v) { cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s * std::complex(v(i), 0.0); } return temp; } cvec operator*(const vec &v, const std::complex &s) { cvec temp(v.size()); for (int i = 0;i < v.size();i++) { temp(i) = s * std::complex(v(i), 0.0); } return temp; } // =============================================================================================== // ---------------- Addition of vectors --------------- vec operator+(const bvec &a, const vec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes does not match"); vec temp(a.size()); for (int i = 0;i < a.size();i++) {temp(i) = (double)a(i) + b(i);} return temp; } vec operator+(const svec &a, const vec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes does not match"); vec temp(a.size()); for (int i = 0;i < a.size();i++) {temp(i) = (double)a(i) + b(i);} return temp; } vec operator+(const ivec &a, const vec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes does not match"); vec temp(a.size()); for (int i = 0;i < a.size();i++) {temp(i) = (double)a(i) + b(i);} return temp; } cvec operator+(const bvec &a, const cvec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes does not match"); cvec temp = b; for (int i = 0;i < a.size();i++) {temp(i) += (double)a(i);} return temp; } cvec operator+(const svec &a, const cvec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes does not match"); cvec temp = b; for (int i = 0;i < a.size();i++) {temp(i) += (double)a(i);} return temp; } cvec operator+(const ivec &a, const cvec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes does not match"); cvec temp = b; for (int i = 0;i < a.size();i++) {temp(i) += (double)a(i);} return temp; } // ---------------- Multiplication of vectors --------------- double operator*(const bvec &a, const vec &b) { it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match"); double temp = 0; for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);} return temp; } double operator*(const svec &a, const vec &b) { it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match"); double temp = 0; for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);} return temp; } double operator*(const ivec &a, const vec &b) { it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match"); double temp = 0; for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);} return temp; } std::complex operator*(const bvec &a, const cvec &b) { it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match"); std::complex temp = 0; for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);} return temp; } std::complex operator*(const svec &a, const cvec &b) { it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match"); std::complex temp = 0; for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);} return temp; } std::complex operator*(const ivec &a, const cvec &b) { it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match"); std::complex temp = 0; for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);} return temp; } // ---------------- Addition of matricies --------------- mat operator+(const bmat &a, const mat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); mat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += (double)a(i, j); } } return temp; } mat operator+(const smat &a, const mat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); mat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += (double)a(i, j); } } return temp; } mat operator+(const imat &a, const mat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); mat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += (double)a(i, j); } } return temp; } // ---------------- Addition of cmat and matrices --------------- cmat operator+(const bmat &a, const cmat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); cmat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += std::complex(static_cast(a(i, j)), 0.0); } } return temp; } cmat operator+(const smat &a, const cmat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); cmat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += (double)a(i, j); } } return temp; } cmat operator+(const imat &a, const cmat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); cmat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += std::complex(static_cast(a(i, j)), 0.0); } } return temp; } cmat operator+(const mat &a, const cmat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes does not match"); cmat temp(b); for (int i = 0;i < a.rows();i++) { for (int j = 0;j < a.cols();j++) { temp(i, j) += std::complex(static_cast(a(i, j)), 0.0); } } return temp; } } // namespace itpp itpp-4.3.1/itpp/base/operators.h000066400000000000000000000720461216575753400166000ustar00rootroot00000000000000/*! * \file * \brief Definitions of operators for vectors and matricies of different * types * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef OPERATORS_H #define OPERATORS_H #include #include #include #include namespace itpp { //---------------------- between scalars and complex ----------------- //! Addition operator for int and complex double inline std::complex operator+(const int &x, const std::complex &y) {return std::complex(x + y.real(), y.imag());} //! Addition operator for float and complex double inline std::complex operator+(const float &x, const std::complex &y) {return std::complex(x + y.real(), y.imag());} //! Addition operator for int and complex double inline std::complex operator+(const std::complex &x, const int &y) {return std::complex(x.real() + y, x.imag());} //! Addition operator for float and complex double inline std::complex operator+(const std::complex &x, const float &y) {return std::complex(x.real() + y, x.imag());} //! Subtraction operator for int and complex double inline std::complex operator-(const int &x, const std::complex &y) {return std::complex(x - y.real(), -y.imag());} //! Subtraction operator for float and complex double inline std::complex operator-(const float &x, const std::complex &y) {return std::complex(x - y.real(), -y.imag());} //! Subtraction operator for int and complex double inline std::complex operator-(const std::complex &x, const int &y) {return std::complex(x.real() - y, x.imag());} //! Subtraction operator for float and complex double inline std::complex operator-(const std::complex &x, const float &y) {return std::complex(x.real() - y, x.imag());} //! Multiplication operator for int and complex double inline std::complex operator*(const int &x, const std::complex &y) {return std::complex(x*y.real(), x*y.imag());} //! Multiplication operator for float and complex double inline std::complex operator*(const float &x, const std::complex &y) {return std::complex(x*y.real(), x*y.imag());} //! Multiplication operator for int and complex double inline std::complex operator*(const std::complex &x, const int &y) {return std::complex(x.real()*y, x.imag()*y);} //! Multiplication operator for float and complex double inline std::complex operator*(const std::complex &x, const float &y) {return std::complex(x.real()*y, x.imag()*y);} //! Division operator for complex double and int inline std::complex operator/(const std::complex &x, const int &y) {return std::complex(x.real() / y, x.imag() / y);} //! Division operator for complex double and float inline std::complex operator/(const std::complex &x, const float &y) {return std::complex(x.real() / y, x.imag() / y);} //---------------------- between vec and scalar -------------------- /*! \relatesalso Vec \brief Addition operator for float and vec */ inline vec operator+(const float &s, const vec &v) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for short and vec */ inline vec operator+(const short &s, const vec &v) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for int and vec */ inline vec operator+(const int &s, const vec &v) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for vec and float */ inline vec operator+(const vec &v, const float &s) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for vec and short */ inline vec operator+(const vec &v, const short &s) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for vec and int */ inline vec operator+(const vec &v, const int &s) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Subtraction operator for float and vec */ inline vec operator-(const float &s, const vec &v) {return static_cast(s) - v;} /*! \relatesalso Vec \brief Subtraction operator for short and vec */ inline vec operator-(const short &s, const vec &v) {return static_cast(s) - v;} /*! \relatesalso Vec \brief Subtraction operator for int and vec */ inline vec operator-(const int &s, const vec &v) {return static_cast(s) - v;} /*! \relatesalso Vec \brief Subtraction operator for vec and float */ inline vec operator-(const vec &v, const float &s) {return v -static_cast(s);} /*! \relatesalso Vec \brief Subtraction operator for vec and short */ inline vec operator-(const vec &v, const short &s) {return v -static_cast(s);} /*! \relatesalso Vec \brief Subtraction operator for vec and int */ inline vec operator-(const vec &v, const int &s) {return v -static_cast(s);} /*! \relatesalso Vec \brief Multiplication operator for float and vec */ inline vec operator*(const float &s, const vec &v) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for short and vec */ inline vec operator*(const short &s, const vec &v) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for int and vec */ inline vec operator*(const int &s, const vec &v) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for complex and vec */ cvec operator*(const std::complex &s, const vec &v); /*! \relatesalso Vec \brief Multiplication operator for vec and float */ inline vec operator*(const vec &v, const float &s) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for vec and short */ inline vec operator*(const vec &v, const short &s) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for vec and int */ inline vec operator*(const vec &v, const int &s) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for vec and complex */ cvec operator*(const vec &v, const std::complex &s); /*! \relatesalso Vec \brief Division operator for vec and float */ inline vec operator/(const vec &v, const float &s) {return v / static_cast(s);} /*! \relatesalso Vec \brief Division operator for vec and short */ inline vec operator/(const vec &v, const short &s) {return v / static_cast(s);} /*! \relatesalso Vec \brief Division operator for vec and int */ inline vec operator/(const vec &v, const int &s) {return v / static_cast(s);} //---------------------- between ivec and scalar -------------------- /*! \relatesalso Vec \brief Addition operator for double and ivec */ ITPP_EXPORT vec operator+(const double &s, const ivec &v); /*! \relatesalso Vec \brief Addition operator for ivec and double */ inline vec operator+(const ivec &v, const double &s) { return s + v;} /*! \relatesalso Vec \brief Subtraction operator for double and ivec */ ITPP_EXPORT vec operator-(const double &s, const ivec &v); /*! \relatesalso Vec \brief Subtraction operator for ivec and double */ inline vec operator-(const ivec &v, const double &s) { return v + (-s); } /*! \relatesalso Vec \brief Multiplication operator for double and ivec */ ITPP_EXPORT vec operator*(const double &s, const ivec &v); /*! \relatesalso Vec \brief Multiplication operator for ivec and double */ inline vec operator*(const ivec &v, const double &s) { return s*v; } /*! \relatesalso Vec \brief Division operator for double and ivec */ ITPP_EXPORT vec operator/(const double &s, const ivec &v); /*! \relatesalso Vec \brief Division operator for ivec and double */ ITPP_EXPORT vec operator/(const ivec &v, const double &s); /*! \relatesalso Vec \brief Addition operator for complex and ivec */ ITPP_EXPORT cvec operator+(const std::complex &s, const ivec &v); /*! \relatesalso Vec \brief Addition operator for ivec and complex */ inline cvec operator+(const ivec &v, const std::complex &s) { return s + v;} /*! \relatesalso Vec \brief Subtraction operator for complex and ivec */ ITPP_EXPORT cvec operator-(const std::complex &s, const ivec &v); /*! \relatesalso Vec \brief Subtraction operator for ivec and complex */ inline cvec operator-(const ivec &v, const std::complex &s) { return v + (-s); } /*! \relatesalso Vec \brief Multiplication operator for complex and ivec */ ITPP_EXPORT cvec operator*(const std::complex &s, const ivec &v); /*! \relatesalso Vec \brief Multiplication operator for ivec and complex */ inline cvec operator*(const ivec &v, const std::complex &s) { return s*v; } /*! \relatesalso Vec \brief Division operator for complex and ivec */ ITPP_EXPORT cvec operator/(const std::complex &s, const ivec &v); /*! \relatesalso Vec \brief Division operator for ivec and complex */ ITPP_EXPORT cvec operator/(const ivec &v, const std::complex &s); //---------------------- between cvec and scalar -------------------- /*! \relatesalso Vec \brief Addition operator for double and cvec */ ITPP_EXPORT cvec operator+(const double &s, const cvec &v); /*! \relatesalso Vec \brief Addition operator for float and cvec */ inline cvec operator+(const float &s, const cvec &v) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for short and cvec */ inline cvec operator+(const short &s, const cvec &v) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for int and cvec */ inline cvec operator+(const int &s, const cvec &v) {return static_cast(s) + v;} /*! \relatesalso Vec \brief Addition operator for cvec and float */ inline cvec operator+(const cvec &v, const float &s) {return s + v;} /*! \relatesalso Vec \brief Addition operator for cvec and double */ inline cvec operator+(const cvec &v, const double &s) {return s + v;} /*! \relatesalso Vec \brief Addition operator for cvec and short */ inline cvec operator+(const cvec &v, const short &s) {return s + v;} /*! \relatesalso Vec \brief Addition operator for cvec and int */ inline cvec operator+(const cvec &v, const int &s) {return s + v;} /*! \relatesalso Vec \brief Subtraction operator for double and cvec */ ITPP_EXPORT cvec operator-(const double &s, const cvec &v); /*! \relatesalso Vec \brief Subtraction operator for float and cvec */ inline cvec operator-(const float &s, const cvec &v) {return static_cast(s) - v;} /*! \relatesalso Vec \brief Subtraction operator for short and cvec */ inline cvec operator-(const short &s, const cvec &v) {return static_cast(s) - v;} /*! \relatesalso Vec \brief Subtraction operator for int and cvec */ inline cvec operator-(const int &s, const cvec &v) {return static_cast(s) - v;} /*! \relatesalso Vec \brief Subtraction operator for cvec and float */ inline cvec operator-(const cvec &v, const float &s) {return v + (-s);} /*! \relatesalso Vec \brief Subtraction operator for cvec and double */ inline cvec operator-(const cvec &v, const double &s) {return v + (-s);} /*! \relatesalso Vec \brief Subtraction operator for cvec and short */ inline cvec operator-(const cvec &v, const short &s) {return v + (-s);} /*! \relatesalso Vec \brief Subtraction operator for cvec and int */ inline cvec operator-(const cvec &v, const int &s) {return v + (-s);} /*! \relatesalso Vec \brief Multiplication operator for double and cvec */ ITPP_EXPORT cvec operator*(const double &s, const cvec &v); /*! \relatesalso Vec \brief Multiplication operator for float and cvec */ inline cvec operator*(const float &s, const cvec &v) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for short and cvec */ inline cvec operator*(const short &s, const cvec &v) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for int and cvec */ inline cvec operator*(const int &s, const cvec &v) {return static_cast(s)*v;} /*! \relatesalso Vec \brief Multiplication operator for cvec and float */ inline cvec operator*(const cvec &v, const float &s) {return s*v;} /*! \relatesalso Vec \brief Multiplication operator for cvec and double */ inline cvec operator*(const cvec &v, const double &s) {return s*v;} /*! \relatesalso Vec \brief Multiplication operator for cvec and short */ inline cvec operator*(const cvec &v, const short &s) {return s*v;} /*! \relatesalso Vec \brief Multiplication operator for cvec and int */ inline cvec operator*(const cvec &v, const int &s) {return s*v;} /*! \relatesalso Vec \brief Division operator for cvec and double */ ITPP_EXPORT cvec operator/(const cvec &v, const double &s); /*! \relatesalso Vec \brief Division operator for double and cvec */ ITPP_EXPORT cvec operator/(const double &s, const cvec &v); /*! \relatesalso Vec \brief Division operator for cvec and float */ inline cvec operator/(const cvec &v, const float &s) {return v / static_cast(s);} /*! \relatesalso Vec \brief Division operator for cvec and short */ inline cvec operator/(const cvec &v, const short &s) {return v / static_cast(s);} /*! \relatesalso Vec \brief Division operator for cvec and int */ inline cvec operator/(const cvec &v, const int &s) {return v / static_cast(s);} //---------------------- between mat and scalar -------------------- /*! \relatesalso Mat \brief Addition operator for float and mat */ inline mat operator+(const float &s, const mat &m) {return static_cast(s) + m;} /*! \relatesalso Mat \brief Addition operator for short and mat */ inline mat operator+(const short &s, const mat &m) {return static_cast(s) + m;} /*! \relatesalso Mat \brief Addition operator for int and mat */ inline mat operator+(const int &s, const mat &m) {return static_cast(s) + m;} /*! \relatesalso Mat \brief Addition operator for mat and float */ inline mat operator+(const mat &m, const float &s) {return static_cast(s) + m;} /*! \relatesalso Mat \brief Addition operator for mat and short */ inline mat operator+(const mat &m, const short &s) {return static_cast(s) + m;} /*! \relatesalso Mat \brief Addition operator for mat and int */ inline mat operator+(const mat &m, const int &s) {return static_cast(s) + m;} /*! \relatesalso Mat \brief Subtraction operator for float and mat */ inline mat operator-(const float &s, const mat &m) {return static_cast(s) - m;} /*! \relatesalso Mat \brief Subtraction operator for short and mat */ inline mat operator-(const short &s, const mat &m) {return static_cast(s) - m;} /*! \relatesalso Mat \brief Subtraction operator for int and mat */ inline mat operator-(const int &s, const mat &m) {return static_cast(s) - m;} /*! \relatesalso Mat \brief Subtraction operator for mat and float */ inline mat operator-(const mat &m, const float &s) {return m -static_cast(s);} /*! \relatesalso Mat \brief Subtraction operator for mat and short */ inline mat operator-(const mat &m, const short &s) {return m -static_cast(s);} /*! \relatesalso Mat \brief Subtraction operator for mat and int */ inline mat operator-(const mat &m, const int &s) {return m -static_cast(s);} /*! \relatesalso Mat \brief Multiplication operator for float and mat */ inline mat operator*(const float &s, const mat &m) {return static_cast(s)*m;} /*! \relatesalso Mat \brief Multiplication operator for short and mat */ inline mat operator*(const short &s, const mat &m) {return static_cast(s)*m;} /*! \relatesalso Mat \brief Multiplication operator for int and mat */ inline mat operator*(const int &s, const mat &m) {return static_cast(s)*m;} /*! \relatesalso Mat \brief Multiplication operator for mat and float */ inline mat operator*(const mat &m, const float &s) {return static_cast(s)*m;} /*! \relatesalso Mat \brief Multiplication operator for mat and short */ inline mat operator*(const mat &m, const short &s) {return static_cast(s)*m;} /*! \relatesalso Mat \brief Multiplication operator for mat and int */ inline mat operator*(const mat &m, const int &s) {return static_cast(s)*m;} /*! \relatesalso Mat \brief Division operator for mat and float */ inline mat operator/(const mat &m, const float &s) {return m / static_cast(s);} /*! \relatesalso Mat \brief Division operator for mat and short */ inline mat operator/(const mat &m, const short &s) {return m / static_cast(s);} /*! \relatesalso Mat \brief Division operator for mat and int */ inline mat operator/(const mat &m, const int &s) {return m / static_cast(s);} //---------------------- between cmat and scalar -------------------- /*! \relatesalso Mat \brief Addition operator for double and cmat */ ITPP_EXPORT cmat operator+(const double &s, const cmat &m); /*! \relatesalso Mat \brief Subtraction operator for double and cmat */ ITPP_EXPORT cmat operator-(const double &s, const cmat &m); /*! \relatesalso Mat \brief Multiplication operator for double and cmat */ ITPP_EXPORT cmat operator*(const double &s, const cmat &m); /*! \relatesalso Mat \brief Multiplication operator for complex and mat */ ITPP_EXPORT cmat operator*(const std::complex &s, const mat &m); /*! \relatesalso Mat \brief Multiplication operator for mat and complex */ inline cmat operator*(const mat &m, const std::complex &s) {return s*m;} /*! \relatesalso Mat \brief Division operator for cmat and double */ ITPP_EXPORT cmat operator/(const cmat &m, const double &s); //---------------------- between vec and vectors -------------------- /*! \relatesalso Vec \brief Addition operator for bvec and vec */ ITPP_EXPORT vec operator+(const bvec &a, const vec &b); /*! \relatesalso Vec \brief Addition operator for svec and vec */ ITPP_EXPORT vec operator+(const svec &a, const vec &b); /*! \relatesalso Vec \brief Addition operator for ivec and vec */ ITPP_EXPORT vec operator+(const ivec &a, const vec &b); /*! \relatesalso Vec \brief Addition operator for vec and bvec */ inline vec operator+(const vec &a, const bvec &b) {return b + a;} /*! \relatesalso Vec \brief Addition operator for vec and svec */ inline vec operator+(const vec &a, const svec &b) {return b + a;} /*! \relatesalso Vec \brief Addition operator for vec and ivec */ inline vec operator+(const vec &a, const ivec &b) {return b + a;} /*! \relatesalso Vec \brief Subtraction operator for bvec and vec */ inline vec operator-(const bvec &a, const vec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for svec and vec */ inline vec operator-(const svec &a, const vec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for ivec and vec */ inline vec operator-(const ivec &a, const vec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for vec and bvec */ inline vec operator-(const vec &a, const bvec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for vec and svec */ inline vec operator-(const vec &a, const svec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for vec and ivec */ inline vec operator-(const vec &a, const ivec &b) {return a + (-b);} /*! \relatesalso Vec \brief Multiplication operator for bvec and vec */ ITPP_EXPORT double operator*(const bvec &a, const vec &b); /*! \relatesalso Vec \brief Multiplication operator for svec and vec */ ITPP_EXPORT double operator*(const svec &a, const vec &b); /*! \relatesalso Vec \brief Multiplication operator for ivec and vec */ ITPP_EXPORT double operator*(const ivec &a, const vec &b); /*! \relatesalso Vec \brief Multiplication operator for vec and bvec */ inline double operator*(const vec &a, const bvec &b) {return b*a;} /*! \relatesalso Vec \brief Multiplication operator for vec and svec */ inline double operator*(const vec &a, const svec &b) {return b*a;} /*! \relatesalso Vec \brief Multiplication operator for vec and ivec */ inline double operator*(const vec &a, const ivec &b) {return b*a;} //---------------------- between cvec and vectors -------------------- /*! \relatesalso Vec \brief Addition operator for bvec and cvec */ ITPP_EXPORT cvec operator+(const bvec &a, const cvec &b); /*! \relatesalso Vec \brief Addition operator for svec and cvec */ ITPP_EXPORT cvec operator+(const svec &a, const cvec &b); /*! \relatesalso Vec \brief Addition operator for ivec and cvec */ ITPP_EXPORT cvec operator+(const ivec &a, const cvec &b); /*! \relatesalso Vec \brief Addition operator for cvec and bvec */ inline cvec operator+(const cvec &a, const bvec &b) {return b + a;} /*! \relatesalso Vec \brief Addition operator for cvec and svec */ inline cvec operator+(const cvec &a, const svec &b) {return b + a;} /*! \relatesalso Vec \brief Addition operator for cvec and ivec */ inline cvec operator+(const cvec &a, const ivec &b) {return b + a;} /*! \relatesalso Vec \brief Subtraction operator for bvec and cvec */ inline cvec operator-(const bvec &a, const cvec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for svec and cvec */ inline cvec operator-(const svec &a, const cvec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for ivec and cvec */ inline cvec operator-(const ivec &a, const cvec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for cvec and bvec */ inline cvec operator-(const cvec &a, const bvec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for cvec and svec */ inline cvec operator-(const cvec &a, const svec &b) {return a + (-b);} /*! \relatesalso Vec \brief Subtraction operator for cvec and ivec */ inline cvec operator-(const cvec &a, const ivec &b) {return a + (-b);} /*! \relatesalso Vec \brief Multiplication operator for bvec and cvec */ ITPP_EXPORT std::complex operator*(const bvec &a, const cvec &b); /*! \relatesalso Vec \brief Multiplication operator for svec and cvec */ ITPP_EXPORT std::complex operator*(const svec &a, const cvec &b); /*! \relatesalso Vec \brief Multiplication operator for ivec and cvec */ ITPP_EXPORT std::complex operator*(const ivec &a, const cvec &b); /*! \relatesalso Vec \brief Multiplication operator for cvec and bvec */ inline std::complex operator*(const cvec &a, const bvec &b) {return b*a;} /*! \relatesalso Vec \brief Multiplication operator for cvec and svec */ inline std::complex operator*(const cvec &a, const svec &b) {return b*a;} /*! \relatesalso Vec \brief Multiplication operator for cvec and ivec */ inline std::complex operator*(const cvec &a, const ivec &b) {return b*a;} //---------------------- between mat and matricies -------------------- /*! \relatesalso Mat \brief Addition operator for bmat and mat */ ITPP_EXPORT mat operator+(const bmat &a, const mat &b); /*! \relatesalso Mat \brief Addition operator for smat and mat */ ITPP_EXPORT mat operator+(const smat &a, const mat &b); /*! \relatesalso Mat \brief Addition operator for imat and mat */ ITPP_EXPORT mat operator+(const imat &a, const mat &b); /*! \relatesalso Mat \brief Addition operator for mat and bmat */ inline mat operator+(const mat &a, const bmat &b) {return b + a;} /*! \relatesalso Mat \brief Addition operator for mat and smat */ inline mat operator+(const mat &a, const smat &b) {return b + a;} /*! \relatesalso Mat \brief Addition operator for mat and imat */ inline mat operator+(const mat &a, const imat &b) {return b + a;} /*! \relatesalso Mat \brief Subtraction operator for bmat and mat */ inline mat operator-(const bmat &a, const mat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for smat and mat */ inline mat operator-(const smat &a, const mat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for imat and mat */ inline mat operator-(const imat &a, const mat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for mat and bmat */ inline mat operator-(const mat &a, const bmat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for mat and smat */ inline mat operator-(const mat &a, const smat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for mat and imat */ inline mat operator-(const mat &a, const imat &b) {return a + (-b);} //---------------------- between cmat and matricies -------------------- /*! \relatesalso Mat \brief Addition operator for bmat and cmat */ ITPP_EXPORT cmat operator+(const bmat &a, const cmat &b); /*! \relatesalso Mat \brief Addition operator for smat and cmat */ ITPP_EXPORT cmat operator+(const smat &a, const cmat &b); /*! \relatesalso Mat \brief Addition operator for imat and cmat */ ITPP_EXPORT cmat operator+(const imat &a, const cmat &b); /*! \relatesalso Mat \brief Addition operator for mat and cmat */ ITPP_EXPORT cmat operator+(const mat &a, const cmat &b); /*! \relatesalso Mat \brief Addition operator for cmat and bmat */ inline cmat operator+(const cmat &a, const bmat &b) {return b + a;} /*! \relatesalso Mat \brief Addition operator for cmat and smat */ inline cmat operator+(const cmat &a, const smat &b) {return b + a;} /*! \relatesalso Mat \brief Addition operator for cmat and imat */ inline cmat operator+(const cmat &a, const imat &b) {return b + a;} /*! \relatesalso Mat \brief Addition operator for cmat and mat */ inline cmat operator+(const cmat &a, const mat &b) {return b + a;} /*! \relatesalso Mat \brief Subtraction operator for bmat and cmat */ inline cmat operator-(const bmat &a, const cmat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for smat and cmat */ inline cmat operator-(const smat &a, const cmat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for imat and cmat */ inline cmat operator-(const imat &a, const cmat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for mat and cmat */ inline cmat operator-(const mat &a, const cmat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for cmat and bmat */ inline cmat operator-(const cmat &a, const bmat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for cmat and smat */ inline cmat operator-(const cmat &a, const smat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for cmat and imat */ inline cmat operator-(const cmat &a, const imat &b) {return a + (-b);} /*! \relatesalso Mat \brief Subtraction operator for cmat and mat */ inline cmat operator-(const cmat &a, const mat &b) {return a + (-b);} /*! \relatesalso Mat \brief Multiplication operator for mat and cmat */ inline cmat operator*(const mat &a, const cmat &b) {return to_cmat(a)*b;} /*! \relatesalso Mat \brief Multiplication operator for bmat and cmat */ inline cmat operator*(const bmat &a, const cmat &b) {return to_cmat(a)*b;} /*! \relatesalso Mat \brief Multiplication operator for smat and cmat */ inline cmat operator*(const smat &a, const cmat &b) {return to_cmat(a)*b;} /*! \relatesalso Mat \brief Multiplication operator for imat and cmat */ inline cmat operator*(const imat &a, const cmat &b) {return to_cmat(a)*b;} /*! \relatesalso Mat \brief Multiplication operator for cmat and mat */ inline cmat operator*(const cmat &a, const mat &b) {return a*to_cmat(b);} /*! \relatesalso Mat \brief Multiplication operator for cmat and bmat */ inline cmat operator*(const cmat &a, const bmat &b) {return a*to_cmat(b);} /*! \relatesalso Mat \brief Multiplication operator for cmat and smat */ inline cmat operator*(const cmat &a, const smat &b) {return a*to_cmat(b);} /*! \relatesalso Mat \brief Multiplication operator for cmat and imat */ inline cmat operator*(const cmat &a, const imat &b) {return a*to_cmat(b);} } // namespace itpp #endif // #ifndef OPERATORS_H itpp-4.3.1/itpp/base/parser.cpp000066400000000000000000000433421216575753400164060ustar00rootroot00000000000000/*! * \file * \brief Implementation of an argument parser class * \author Thomas Eriksson, Pal Frenger and Johan Bergman * * Thanks to Svante Signell for valuable input * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include using std::cout; using std::endl; namespace itpp { Parser::Parser() { VERBOSE = true; } Parser::Parser(const std::string &filename) { VERBOSE = true; init(filename); } Parser::Parser(int argc, char *argv[]) { VERBOSE = true; init(argc, argv); } Parser::Parser(const std::string &filename, int argc, char *argv[]) { VERBOSE = true; init(filename, argc, argv); } Parser::Parser(const Array &setup) { VERBOSE = true; init(setup); } void Parser::pre_parsing(void) { int i, j, n, k; int count = 0; int size = SetupStrings.size(); bool cont_line; std::string Line, NewLine; Array TempSetupStrings; // Remove lines starting with '%' or have zero length: for (i = 0; i < size; i++) { Line = SetupStrings(i); if ((Line.length() != 0) && (Line[0] != '%')) { SetupStrings(count) = Line; count++; } } SetupStrings.set_size(count, true); size = SetupStrings.size(); //Check for '...' continuation as in Matlab: count = 0; NewLine = ""; for (i = 0; i < SetupStrings.size(); i++) { Line = SetupStrings(i); n = int(Line.size()); cont_line = false; for (k = 0; k < (n - 2); k++) { if ((Line[k] == '.') && (Line[k+1] == '.') && (Line[k+2] == '.')) { cont_line = true; break; } } if (cont_line) { for (j = 0; j < k; j++) { NewLine += Line[j]; } } else { NewLine += Line; SetupStrings(count) = NewLine; count++; NewLine = ""; } } SetupStrings.set_size(count, true); //Strip unneccesary blanks, tabs, and newlines: size = SetupStrings.size(); for (i = 0; i < size; i++) { NewLine = ""; Line = SetupStrings(i); n = int(Line.length()); j = 0; //counter in Line while (j < n) { switch (Line[j]) { case '\n': //Remove newlines j++; break; case ' ': //Remove blanks j++; break; case '\t': //Remove tabs j++; break; case '[': //Don't remove blanks between '[' and ']' while ((j < n) && (Line[j] != ']')) { NewLine += Line[j]; j++; } if (j < n) { NewLine += Line[j]; j++; } break; case '{': //Don't remove blanks between '{' and '}' while ((j < n) && (Line[j] != '}')) { NewLine += Line[j]; j++; } if (j < n) { NewLine += Line[j]; j++; } break; case '"': //Don't remove blanks between '"' and '"' NewLine += Line[j]; j++; //Read in the first '"' while ((j < n) && (Line[j] != '"')) { NewLine += Line[j]; j++; } NewLine += Line[j]; j++; break; case '\'': //Don't remove blanks between '\'' and '\'' NewLine += Line[j]; j++; //Read in the first '\'' while ((j < n) && (Line[j] != '\'')) { NewLine += Line[j]; j++; } NewLine += Line[j]; j++; break; case '%': //Remove trailing comments j = n; break; default: //Keep the current character: NewLine += Line[j]; j++; break; } } SetupStrings(i) = NewLine; } // Split lines with several expressions (i.e. a=3;b=[1 2 3],c="Hello World") on the same line // (separated by comma or semicolon) TempSetupStrings.set_size(size, false); count = 0; //Counter in TempSetupStrings for (i = 0; i < size; i++) { NewLine = ""; Line = SetupStrings(i); n = int(Line.length()); j = 0; while (j < n) { switch (Line[j]) { case '[': //A vector or a matrix while ((j < n) && (Line[j] != ']')) { NewLine += Line[j]; j++; } if (Line[j] == ']') { NewLine += Line[j]; j++; } if (j == n) { if (count >= TempSetupStrings.size()) { TempSetupStrings.set_size(2*count, true); } TempSetupStrings(count) = NewLine; NewLine = ""; count++; } break; case '"': //A string NewLine += Line[j]; j++; //Read in the first '"' while ((j < n) && (Line[j] != '"')) { NewLine += Line[j]; j++; } if (Line[j] == '"') { NewLine += Line[j]; j++; } if (j == n) { if (count >= TempSetupStrings.size()) { TempSetupStrings.set_size(2*count, true); } TempSetupStrings(count) = NewLine; NewLine = ""; count++; } break; case '\'': //A string NewLine += Line[j]; j++; //Read in the first '\'' while ((j < n) && (Line[j] != '\'')) { NewLine += Line[j]; j++; } if (Line[j] == '\'') { NewLine += Line[j]; j++; } if (j == n) { if (count >= TempSetupStrings.size()) { TempSetupStrings.set_size(2*count, true); } TempSetupStrings(count) = NewLine; NewLine = ""; count++; } break; case ',': //Expression ends here if (count >= TempSetupStrings.size()) { TempSetupStrings.set_size(2*count, true); } TempSetupStrings(count) = NewLine; NewLine = ""; count++; j++; break; case ';': //Expression ends here if (count >= TempSetupStrings.size()) { TempSetupStrings.set_size(2*count, true); } TempSetupStrings(count) = NewLine + ';'; NewLine = ""; count++; j++; break; default: //Copy the current character: NewLine += Line[j]; j++; if (j == n) { if (count >= TempSetupStrings.size()) { TempSetupStrings.set_size(2*count, true); } TempSetupStrings(count) = NewLine; NewLine = ""; count++; } break; } } } TempSetupStrings.set_size(count, true); SetupStrings = TempSetupStrings; } void Parser::init(const std::string &filename) { std::string Line; SetupStrings.set_size(0, false); std::ifstream SetupFile(filename.c_str()); it_assert(SetupFile.is_open(), "Parser::init(): Could not open `" + filename + "' file"); while (getline(SetupFile, Line, '\n')) { SetupStrings.set_size(SetupStrings.size() + 1, true); SetupStrings(SetupStrings.size() - 1) = Line; } SetupFile.close(); pre_parsing(); } void Parser::init(int argc, char *argv[]) { SetupStrings.set_size(argc); int i; for (i = 0; i < argc; i++) { SetupStrings(i) = argv[i]; } pre_parsing(); } void Parser::init(const std::string &filename, int argc, char *argv[]) { std::string Line; int i; std::ifstream SetupFile(filename.c_str()); it_assert(SetupFile.is_open(), "Parser::init(): Could not open `" + filename + "' file"); //Read the command line parameters: SetupStrings.set_size(argc); for (i = 0; i < argc; i++) { SetupStrings(i) = argv[i]; } //Read the file parameters: while (getline(SetupFile, Line, '\n')) { SetupStrings.set_size(SetupStrings.size() + 1, true); SetupStrings(SetupStrings.size() - 1) = Line; } SetupFile.close(); pre_parsing(); } void Parser::init(const Array &setup) { SetupStrings = setup; pre_parsing(); } void Parser::set_silentmode(bool v) { VERBOSE = !v; } bool Parser::exist(const std::string &name) { bool error_flag, print_flag; std::string temp = findname(name, error_flag, print_flag); if (error_flag) { return false; } else { return true; } } template<> bool Parser::get(std::string &var, const std::string &name, int num) { bool error_flag, print_flag; std::string str = findname(name, error_flag, print_flag, num); if (error_flag) { if (VERBOSE) { cout << name << " = '" << var << "';" << endl; } } else { var = str; if (print_flag) { cout << name << " = '" << var << "'" << endl; } else if (VERBOSE) { cout << name << " = '" << var << "';" << endl; } } return !error_flag; } template<> bool Parser::get(int &var, const std::string &name, int num) { ivec out; bool error_flag, print_flag; out = ivec(findname(name, error_flag, print_flag, num)); if (error_flag) { if (VERBOSE) { cout << name << " = " << var << ";" << endl; } } else { it_assert(out.size() == 1, "Parser::get(int): Improper variable string: " + name); var = out(0); if (print_flag) { cout << name << " = " << var << endl; } else if (VERBOSE) { cout << name << " = " << var << ";" << endl; } } return !error_flag; } template<> bool Parser::get(bool &var, const std::string &name, int num) { std::string ss; bool error_flag, print_flag; ss = findname(name, error_flag, print_flag, num); if (error_flag) { if (VERBOSE) { cout << name << " = " << var << ";" << endl; } } else { if ((ss == "true") || (ss == "1")) { var = true; } else if ((ss == "false") || (ss == "0")) { var = false; } else { it_error("Parser::get(bool): Improper variable string: " + name); } if (print_flag) { cout << name << " = " << var << endl; } else if (VERBOSE) { cout << name << " = " << var << ";" << endl; } } return !error_flag; } bool Parser::get_bool(const std::string &name, int num) { std::string ss; bool out = false; bool error_flag, print_flag; ss = findname(name, error_flag, print_flag, num); it_assert(!error_flag, "Parser::get_bool(): Can not find variable: " + name); if ((ss == "true") || (ss == "1")) { out = true; } else if ((ss == "false") || (ss == "0")) { out = false; } else { it_error("Parser::get_bool(): Improper variable string: " + name); } if (print_flag) { cout << "Parsing bool : " << name << " = " << out << endl; } return out; } int Parser::get_int(const std::string &name, int num) { ivec out; bool error_flag, print_flag; out = ivec(findname(name, error_flag, print_flag, num)); it_assert(!error_flag, "Parser::get_int(): Can not find variable: " + name); it_assert(out.size() == 1, "Parser::get_int(): Improper variable string: " + name); if (print_flag) { cout << "Parsing int : " << name << " = " << out(0) << endl; } return out(0); } double Parser::get_double(const std::string &name, int num) { double out; bool error_flag, print_flag; std::istringstream ss(findname(name, error_flag, print_flag, num)); ss >> out; if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing double: " << name << " = " << out << endl; } return out; } std::string Parser::get_string(const std::string &name, int num) { std::string out; bool error_flag, print_flag; out = findname(name, error_flag, print_flag, num); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing string: " << name << " = " << out << endl; } return out; } vec Parser::get_vec(const std::string &name, int num) { vec out; bool error_flag, print_flag; out = vec(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing vec : " << name << " = " << out << endl; } return out; } ivec Parser::get_ivec(const std::string &name, int num) { ivec out; bool error_flag, print_flag; out = ivec(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing ivec : " << name << " = " << out << endl; } return out; } svec Parser::get_svec(const std::string &name, int num) { svec out; bool error_flag, print_flag; out = svec(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing svec : " << name << " = " << out << endl; } return out; } bvec Parser::get_bvec(const std::string &name, int num) { bvec out; bool error_flag, print_flag; out = bvec(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing bvec : " << name << " = " << out << endl; } return out; } mat Parser::get_mat(const std::string &name, int num) { mat out; bool error_flag, print_flag; out = mat(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing mat : " << name << " = " << out << endl; } return out; } imat Parser::get_imat(const std::string &name, int num) { imat out; bool error_flag, print_flag; out = imat(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing imat : " << name << " = " << out << endl; } return out; } smat Parser::get_smat(const std::string &name, int num) { smat out; bool error_flag, print_flag; out = smat(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing smat : " << name << " = " << out << endl; } return out; } bmat Parser::get_bmat(const std::string &name, int num) { bmat out; bool error_flag, print_flag; out = bmat(findname(name, error_flag, print_flag, num)); if (error_flag) { it_error("Parser: Can not find variable: " + name); } if (print_flag) { cout << "Parsing bmat : " << name << " = " << out << endl; } return out; } std::string Parser::findname(const std::string &name, bool &error_flag, bool &print_flag, int num, bool keep_brackets) { std::string Name, Out, Line, Temp; int n, j = 0, i = 0, index = -1; bool found = false, vec_mat = false; error_flag = false; print_flag = false; if (num < 0) { num = 0; } Name = ""; // Go through all words in input string to find a match while (i < SetupStrings.size()) { Line = SetupStrings(i); i++; // Find equal sign "=", and take the left part to be the Name if (Line.find_first_of("=") != std::string::npos) { Name = Line.substr(0, Line.find_first_of("=")); } else { Name = ""; } if (Name == name) { if (found) { //cout << "Parser Warning: Duplicate Entry of variable " << name << endl; } else { found = true; index = i - 1; } } } // if we have a match if ((found) && (index + num <= SetupStrings.size())) { Line = SetupStrings(index + num); if (num != 0) { Temp = Line; } else { Temp = Line.substr(Line.find_first_of("=") + 1); } } else { error_flag = true; return ""; } //Remove [, ],",' and ending ;. Set the print_flag: n = int(Temp.size()); Out = ""; for (i = 0; i < n; i++) { switch (Temp[i]) { case '[': vec_mat = true; if (keep_brackets) { Out += Temp[i]; } if (i == (n - 1)) { print_flag = true; } break; case ']': if (keep_brackets) { Out += Temp[i]; } if (i == (n - 1)) { print_flag = true; } break; case '"': if (i == (n - 1)) { print_flag = true; } break; case '\'': if (i == (n - 1)) { print_flag = true; } break; case ';': if (i == (n - 1)) { print_flag = false; } else { Out += Temp[i]; } break; default: Out += Temp[i]; if (i == (n - 1)) { print_flag = true; } break; } } //Final parsing of vectors and matrices: if (vec_mat) { Temp = Out; Out = ""; n = int(Temp.size()); j = 0; while ((Temp[j] == ' ') || (Temp[j] == '\t') || (Temp[j] == '\n')) { j++; } //Remove spaces/tabs/newline in beginning while ((Temp[n-1] == ' ') || (Temp[n-1] == '\t') || (Temp[n-1] == '\n')) { n--; } //Remove spaces/tabs/newline at the end while (j < n) { //Read in data element: while ((j < n) && (Temp[j] != ' ') && (Temp[j] != '\t') && (Temp[j] != '\n') && (Temp[j] != ',') && (Temp[j] != ';')) { Out += Temp[j]; j++; } //Read separator: if (j < (n - 1)) { //Remove spaces before separator while ((j < n) && ((Temp[j] == ' ') || (Temp[j] == '\t') || (Temp[j] == '\n'))) { j++; } //Insert Separator: if (j < n) { if (Temp[j] == ';') { Out += ';'; j++; } else if (Temp[j] == ',') { Out += ' '; j++; } else if (Temp[j] == '+') { Out += ' '; Out += Temp[j]; j++; } else if (Temp[j] == '-') { Out += ' '; Out += Temp[j]; j++; } else { Out += ' '; } } //Remove spaces after separator: while ((j < n) && ((Temp[j] == ' ') || (Temp[j] == '\t') || (Temp[j] == '\n'))) { j++; } } } } if (!VERBOSE) print_flag = false; return Out; } } // namespace itpp itpp-4.3.1/itpp/base/parser.h000066400000000000000000000172521216575753400160540ustar00rootroot00000000000000/*! * \file * \brief Definition of an argument parser class * \author Thomas Eriksson, Pal Frenger and Johan Bergman * * Thanks to Svante Signell for valuable input * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PARSER_H #define PARSER_H // #define MAX_STR_LEN 4096 #include #include #include #include #include namespace itpp { //! \cond #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB)) //MSVC explicitely instantiate required template while building the shared library template class ITPP_EXPORT Array; #endif //! \endcond /*! \addtogroup parser \brief Argument Parser \author Thomas Eriksson and Pal Frenger (Thanks to Svante Signell for valuable input), modifications by Johan Bergman This class parses strings to variables. The syntax is compatible with Matlab and Octave. It can be used in several different ways. The following test program and test data file gives several examples:
    • Use the Parser class on a parameter file
    • Use the Parser class on the command line input
    • Use the Parser class on a char pointer (usually the command line input)
    • Use the Parser class on a parameter file and a char pointer
    • Use the Parser class on an Array of strings
    • Use the Parser::get() method on a parameter file
    • Use the Parser::exist() method to check if variables exist
    The test program looks as follows: \include parser_test.cpp The data file \c parser_test_data.txt looks as follows: \include parser_test_data.txt Beside the type-specific get methods, like get_int(), there is a templated get method called get(), that can handle all variable types that have an istream operator defined, e.g. Arrays. The get() method takes the variable value as an input/output parameter. If the variable name cannot be found, the old value is kept. Here is an example: \code // Declare and initialize a variable Array var; set_array(var, "{[1] [2 3] [4 5 6]}"); // Let the Parser p get the variable named my_var_name bool my_var_name_was_found = p.get(var, "my_var_name"); \endcode In the above example, if \c my_var_name was not found, \c var keeps its old value {[1] [2 3] [4 5 6]}. In non-silent mode, the get() method echoes the variable values to the standard output in Matlab/Octave m-file style. */ /*! \ingroup parser \brief Argument Parser Class \author Thomas Eriksson and Pal Frenger (Thanks to Svante Signell for valuable input) This class parses strings to variables. The syntax is compatible with Matlab and Octave. It can be used in several different ways. See the Detailed Description in the \ref parser module. */ class ITPP_EXPORT Parser { public: //! Default Constructor Parser(); //! Constructor. Sets input file name. Parser(const std::string &filename); //! Constructor. Uses argc and argv (command line arguments) Parser(int argc, char *argv[]); //! Constructor. Sets input file name and uses argc and argv (command line arguments) Parser(const std::string &filename, int argc, char *argv[]); //! Constructor. Sets and Array of strings Parser(const Array &setup); //! Initialization function. Sets input file name. void init(const std::string &filename); //! Initialization function. Uses argc and argv (command line arguments) void init(int argc, char *argv[]); //! Initialization function. Sets input file name and uses argc and argv (command line arguments) void init(const std::string &filename, int argc, char *argv[]); //! Initialization function. Sets and Array of strings void init(const Array &setup); //! Sets silent mode if true, or verbose mode if false void set_silentmode(bool v = true); //! Check is \a name exists in the file. Returns \c true if the \a name is found and \c false otherwise. bool exist(const std::string &name); //! Get variable value if \a name can be found (and return true), otherwise keep old value (and return false) template bool get(T &var, const std::string &name, int num = -1); //! Interpret variable \a name as a bool bool get_bool(const std::string &name, int num = -1); //! Interpret variable \a name as an integer int get_int(const std::string &name, int num = -1); //! Interpret variable \a name as a double double get_double(const std::string &name, int num = -1); //! Interpret variable \a name as a string std::string get_string(const std::string &name, int num = -1); //! Interpret variable \a name as a vec vec get_vec(const std::string &name, int num = -1); //! Interpret variable \a name as a ivec ivec get_ivec(const std::string &name, int num = -1); //! Interpret variable \a name as a svec svec get_svec(const std::string &name, int num = -1); //! Interpret variable \a name as a bvec bvec get_bvec(const std::string &name, int num = -1); //! Interpret variable \a name as a mat mat get_mat(const std::string &name, int num = -1); //! Interpret variable \a name as a imat imat get_imat(const std::string &name, int num = -1); //! Interpret variable \a name as a smat smat get_smat(const std::string &name, int num = -1); //! Interpret variable \a name as a bmat bmat get_bmat(const std::string &name, int num = -1); protected: private: //! Find the string \c name std::string findname(const std::string &name, bool &error_flag, bool &print_flag, int num = 0, bool keep_brackets = false); void pre_parsing(void); Array SetupStrings; bool VERBOSE; }; // ----------------------- Implementation starts here ----------------------- template bool Parser::get(T &var, const std::string &name, int num) { bool error_flag, print_flag; std::string str = findname(name, error_flag, print_flag, num, true); std::istringstream buffer(str); if (error_flag) { if (VERBOSE) { std::cout << name << " = " << var << ";" << std::endl; } } else { buffer >> var; if (print_flag) { std::cout << name << " = " << var << std::endl; } else if (VERBOSE) { std::cout << name << " = " << var << ";" << std::endl; } } return !error_flag; } //! Specialization or \c get() for std::string template<> ITPP_EXPORT bool Parser::get(std::string &var, const std::string &name, int num); //! Specialization of \c get() for int template<> ITPP_EXPORT bool Parser::get(int &var, const std::string &name, int num); //! Specialization of \c get() for bool template<> ITPP_EXPORT bool Parser::get(bool &var, const std::string &name, int num); } // namespace itpp #endif // #ifndef PARSER_H itpp-4.3.1/itpp/base/random.cpp000066400000000000000000000600651216575753400163730ustar00rootroot00000000000000/*! * \file * \brief Implementation of classes for random number generators * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { namespace random_details { //Thread-local context for thread-safe RNGs static ActiveDSFMT::Context thread_local_context; #pragma omp threadprivate(thread_local_context) //Thread-local context initialization flag static bool is_thread_local_context_initialized = false; #pragma omp threadprivate(is_thread_local_context_initialized) ActiveDSFMT::Context& lc_get() { return thread_local_context; } bool lc_is_initialized() { return is_thread_local_context_initialized; } void lc_mark_initialized() { is_thread_local_context_initialized = true; } /*! * \brief Get an unsigned int from time variables t and c. * * Better than uint(x) in case x is floating point in [0,1] * Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) */ static unsigned int hash_time_to_seed(time_t t, clock_t c) { static unsigned int differ = 0; // guarantee time-based seeds will change unsigned int h1 = 0; unsigned char *p = (unsigned char *) &t; for(size_t i = 0; i < sizeof(t); ++i) { h1 *= std::numeric_limits::max() + 2U; h1 += p[i]; } unsigned int h2 = 0; p = (unsigned char *) &c; for(size_t j = 0; j < sizeof(c); ++j) { h2 *= std::numeric_limits::max() + 2U; h2 += p[j]; } return (h1 + differ++) ^ h2; } // ---------------------------------------------------------------------- // ActiveDSFMT (DSFMT_19937_RNG) // ---------------------------------------------------------------------- template <> const bool ActiveDSFMT::bigendian = is_bigendian(); #if defined(__SSE2__) template <> const __m128i ActiveDSFMT::sse2_param_mask = _mm_set_epi32(ActiveDSFMT::MSK32_3, ActiveDSFMT::MSK32_4, ActiveDSFMT::MSK32_1, ActiveDSFMT::MSK32_2); #endif // __SSE2__ } /* *Global Seed Provider class definition. * * Provides unique seeds for thread-safe generators running in each thread. */ class GlobalSeedProvider { static const unsigned int default_first_seed = 4257U; typedef random_details::ActiveDSFMT DSFMT; public: //constructor GlobalSeedProvider(): _dsfmt(_c), _first_seed_given(false) { _dsfmt.init_gen_rand(default_first_seed); } //set new seed void set_seed(unsigned int s) {_dsfmt.init_gen_rand(s);} //get preset seed unsigned int get_seed() {return _c.last_seed;} //reset provider state to previously set one void reset() { if(_first_seed_given) _dsfmt.init_gen_rand(get_seed());} //set previously saved state from ivec void set_state(const ivec& st) { int size = (DSFMT::N + 1) * 4; it_assert(st.size() == size + 1, "GlobalSeedProvider::state(): " "Invalid state initialization vector"); uint32_t *psfmt = &_c.status[0].u32[0]; for(int i = 0; i < size; ++i) { psfmt[i] = static_cast(st(i)); } _c.idx = st(size); _first_seed_given = true; } //get current provider state ivec get_state() { int size = (DSFMT::N + 1) * 4; uint32_t *psfmt = &_c.status[0].u32[0]; ivec state(size + 1); // size + 1 to save idx variable in the same vec for(int i = 0; i < size; ++i) { state(i) = static_cast(psfmt[i]); } state(size) = _c.idx; return state; } //randomize current provider state with system time void randomize() {_dsfmt.init_gen_rand(random_details::hash_time_to_seed(time(0), clock())); _first_seed_given = true;} //generate new seed for random number generators unsigned int generate() { if(_first_seed_given) return _dsfmt.genrand_uint32(); else { //return default seed on first request. //it is done in order not to breake the old-style itpp tests. //Some tests rely on the default state equal to 4257U _first_seed_given = true; return default_first_seed; } } private: // DSFMT _dsfmt; // DSFMT::Context _c; // bool _first_seed_given; }; //Global seed provider instance GlobalSeedProvider& global_seed_provider() { static GlobalSeedProvider global_seed_provider_instance; return global_seed_provider_instance; } void GlobalRNG_reset(unsigned int seed) { #pragma omp critical { global_seed_provider().set_seed(seed); } } void GlobalRNG_reset() { #pragma omp critical { global_seed_provider().reset(); } } unsigned int GlobalRNG_get_local_seed() { unsigned int s; #pragma omp critical { s = global_seed_provider().generate(); } return s; } void GlobalRNG_randomize() { #pragma omp critical { global_seed_provider().randomize(); } } void GlobalRNG_get_state(ivec &state) { #pragma omp critical { state = global_seed_provider().get_state(); } } void GlobalRNG_set_state(const ivec &state) { #pragma omp critical { global_seed_provider().set_state(state); } } void RNG_reset(unsigned int seed) { random_details::ActiveDSFMT dsfmt(random_details::lc_get()); dsfmt.init_gen_rand(seed); random_details::lc_mark_initialized(); } void RNG_reset() { random_details::ActiveDSFMT dsfmt(random_details::lc_get()); if(random_details::lc_is_initialized()) { //already initialized. Reinit with last set seed; dsfmt.init_gen_rand(random_details::lc_get().last_seed); } else { //query global seed provider for new seed and init with it dsfmt.init_gen_rand(GlobalRNG_get_local_seed()); random_details::lc_mark_initialized(); } } void RNG_randomize() { random_details::ActiveDSFMT dsfmt(random_details::lc_get()); dsfmt.init_gen_rand(random_details::hash_time_to_seed(time(0), clock())); random_details::lc_mark_initialized(); } void RNG_get_state(ivec &state) { int size = (random_details::ActiveDSFMT::N + 1) * 4; uint32_t *psfmt = &random_details::lc_get().status[0].u32[0]; state.set_size(size + 1); // size + 1 to save idx variable in the same vec for(int i = 0; i < size; ++i) { state(i) = static_cast(psfmt[i]); } state(size) = random_details::lc_get().idx; } void RNG_set_state(const ivec &state) { int size = (random_details::ActiveDSFMT::N + 1) * 4; it_assert(state.size() == size + 1, "RNG_set_state: " "Invalid state initialization vector"); uint32_t *psfmt = &random_details::lc_get().status[0].u32[0]; for(int i = 0; i < size; ++i) { psfmt[i] = static_cast(state(i)); } random_details::lc_get().idx = state(size); } /////////////////////////////////////////////// // I_Uniform_RNG /////////////////////////////////////////////// I_Uniform_RNG::I_Uniform_RNG(int min, int max) { setup(min, max); } void I_Uniform_RNG::setup(int min, int max) { if(min <= max) { lo = min; hi = max; } else { lo = max; hi = min; } } void I_Uniform_RNG::get_setup(int &min, int &max) const { min = lo; max = hi; } ivec I_Uniform_RNG::operator()(int n) { ivec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } imat I_Uniform_RNG::operator()(int h, int w) { imat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Uniform_RNG /////////////////////////////////////////////// Uniform_RNG::Uniform_RNG(double min, double max) { setup(min, max); } void Uniform_RNG::setup(double min, double max) { if(min <= max) { lo_bound = min; hi_bound = max; } else { lo_bound = max; hi_bound = min; } } void Uniform_RNG::get_setup(double &min, double &max) const { min = lo_bound; max = hi_bound; } /////////////////////////////////////////////// // Exp_RNG /////////////////////////////////////////////// Exponential_RNG::Exponential_RNG(double lambda) { setup(lambda); } vec Exponential_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat Exponential_RNG::operator()(int h, int w) { mat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Gamma_RNG /////////////////////////////////////////////// void Gamma_RNG::init_state() { const static double sqrt32 = 5.656854; const static double q1 = 0.04166669; const static double q2 = 0.02083148; const static double q3 = 0.00801191; const static double q4 = 0.00144121; const static double q5 = -7.388e-5; const static double q6 = 2.4511e-4; const static double q7 = 2.424e-4; double r = 1.0 / alpha; _scale = 1.0 / beta; it_error_if(!std::isfinite(alpha) || !std::isfinite(_scale) || (alpha < 0.0) || (_scale <= 0.0), "Gamma_RNG::init_state() - wrong parameters"); _s2 = alpha - 0.5; _s = std::sqrt(_s2); _d = sqrt32 - _s * 12.0; _q0 = ((((((q7 * r + q6) * r + q5) * r + q4) * r + q3) * r + q2) * r + q1) * r; /* Approximation depending on size of parameter alpha */ /* The constants in the expressions for _b, _si and _c */ /* were established by numerical experiments */ if(alpha <= 3.686) { _b = 0.463 + _s + 0.178 * _s2; _si = 1.235; _c = 0.195 / _s - 0.079 + 0.16 * _s; } else if(alpha <= 13.022) { _b = 1.654 + 0.0076 * _s2; _si = 1.68 / _s + 0.275; _c = 0.062 / _s + 0.024; } else { _b = 1.77; _si = 0.75; _c = 0.1515 / _s; } } vec Gamma_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat Gamma_RNG::operator()(int r, int c) { mat mm(r, c); for(int i = 0; i < r * c; i++) mm(i) = sample(); return mm; } double Gamma_RNG::sample() { // A copy of rgamma code from the R package, adapted to IT++ by Vasek // Smidl /* Constants : */ const static double exp_m1 = 0.36787944117144232159;/* exp(-1) = 1/e */ const static double a1 = 0.3333333; const static double a2 = -0.250003; const static double a3 = 0.2000062; const static double a4 = -0.1662921; const static double a5 = 0.1423657; const static double a6 = -0.1367177; const static double a7 = 0.1233795; double e, p, q, t, u, v, w, x, ret_val; double a = alpha; double scale = _scale; if(a < 1.) { /* GS algorithm for parameters a < 1 */ if(a == 0) return 0.; e = 1.0 + exp_m1 * a; for(;;) { //VS repeat p = e * RNG.genrand_open_open(); if(p >= 1.0) { x = -std::log((e - p) / a); if(-std::log(RNG.genrand_open_close()) >= (1.0 - a) * std::log(x)) break; } else { x = std::exp(std::log(p) / a); if(-std::log(RNG.genrand_open_close()) >= x) break; } } return scale * x; } /* --- a >= 1 : GD algorithm --- */ /* Step 1: t = standard normal deviate, x = (s,1/2) -normal deviate. */ /* immediate acceptance (i) */ t = NRNG.sample(); x = _s + 0.5 * t; ret_val = x * x; if(t >= 0.0) return scale * ret_val; /* Step 2: u = 0,1 - uniform sample. squeeze acceptance (s) */ u = RNG.genrand_close_open(); if((_d * u) <= (t * t * t)) return scale * ret_val; /* Step 3: no quotient test if x not positive */ if(x > 0.0) { /* Step 4: calculation of v and quotient q */ v = t / (_s + _s); if(std::fabs(v) <= 0.25) q = _q0 + 0.5 * t * t * ((((((a7 * v + a6) * v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; else q = _q0 - _s * t + 0.25 * t * t + (_s2 + _s2) * log(1.0 + v); /* Step 5: quotient acceptance (q) */ if(log(1.0 - u) <= q) return scale * ret_val; } for(;;) { //VS repeat /* Step 6: e = standard exponential deviate * u = 0,1 -uniform deviate * t = (b,si)-double exponential (laplace) sample */ e = -std::log(RNG.genrand_open_close()); //see Exponential_RNG u = RNG.genrand_open_close(); u = u + u - 1.0; if(u < 0.0) t = _b - _si * e; else t = _b + _si * e; /* Step 7: rejection if t < tau(1) = -0.71874483771719 */ if(t >= -0.71874483771719) { /* Step 8: calculation of v and quotient q */ v = t / (_s + _s); if(std::fabs(v) <= 0.25) q = _q0 + 0.5 * t * t * ((((((a7 * v + a6) * v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; else q = _q0 - _s * t + 0.25 * t * t + (_s2 + _s2) * log(1.0 + v); /* Step 9: hat acceptance (h) */ /* (if q not positive go to step 6) */ if(q > 0.0) { // Try to use w = expm1(q); (Not supported on w32) w = expm1(q); /* ^^^^^ original code had approximation with rel.err < 2e-7 */ /* if t is rejected sample again at step 6 */ if((_c * std::fabs(u)) <= (w * std::exp(e - 0.5 * t * t))) break; } } } /* repeat .. until `t' is accepted */ x = _s + 0.5 * t; return scale * x * x; } /////////////////////////////////////////////// // Normal_RNG /////////////////////////////////////////////// void Normal_RNG::get_setup(double &meanval, double &variance) const { meanval = mean; variance = sigma * sigma; } // (Ziggurat) tabulated values for the heigt of the Ziggurat levels const double Normal_RNG::ytab[128] = { 1, 0.963598623011, 0.936280813353, 0.913041104253, 0.892278506696, 0.873239356919, 0.855496407634, 0.838778928349, 0.822902083699, 0.807732738234, 0.793171045519, 0.779139726505, 0.765577436082, 0.752434456248, 0.739669787677, 0.727249120285, 0.715143377413, 0.703327646455, 0.691780377035, 0.68048276891, 0.669418297233, 0.65857233912, 0.647931876189, 0.637485254896, 0.62722199145, 0.617132611532, 0.607208517467, 0.597441877296, 0.587825531465, 0.578352913803, 0.569017984198, 0.559815170911, 0.550739320877, 0.541785656682, 0.532949739145, 0.524227434628, 0.515614886373, 0.507108489253, 0.498704867478, 0.490400854812, 0.482193476986, 0.47407993601, 0.466057596125, 0.458123971214, 0.450276713467, 0.442513603171, 0.434832539473, 0.427231532022, 0.419708693379, 0.41226223212, 0.404890446548, 0.397591718955, 0.390364510382, 0.383207355816, 0.376118859788, 0.369097692334, 0.362142585282, 0.355252328834, 0.348425768415, 0.341661801776, 0.334959376311, 0.328317486588, 0.321735172063, 0.31521151497, 0.308745638367, 0.302336704338, 0.29598391232, 0.289686497571, 0.283443729739, 0.27725491156, 0.271119377649, 0.265036493387, 0.259005653912, 0.253026283183, 0.247097833139, 0.241219782932, 0.235391638239, 0.229612930649, 0.223883217122, 0.218202079518, 0.212569124201, 0.206983981709, 0.201446306496, 0.195955776745, 0.190512094256, 0.185114984406, 0.179764196185, 0.174459502324, 0.169200699492, 0.1639876086, 0.158820075195, 0.153697969964, 0.148621189348, 0.143589656295, 0.138603321143, 0.133662162669, 0.128766189309, 0.123915440582, 0.119109988745, 0.114349940703, 0.10963544023, 0.104966670533, 0.100343857232, 0.0957672718266, 0.0912372357329, 0.0867541250127, 0.082318375932, 0.0779304915295, 0.0735910494266, 0.0693007111742, 0.065060233529, 0.0608704821745, 0.056732448584, 0.05264727098, 0.0486162607163, 0.0446409359769, 0.0407230655415, 0.0368647267386, 0.0330683839378, 0.0293369977411, 0.0256741818288, 0.0220844372634, 0.0185735200577, 0.0151490552854, 0.0118216532614, 0.00860719483079, 0.00553245272614, 0.00265435214565 }; /* * (Ziggurat) tabulated values for 2^24 times x[i]/x[i+1], used to accept * for U*x[i+1]<=x[i] without any floating point operations */ const unsigned int Normal_RNG::ktab[128] = { 0, 12590644, 14272653, 14988939, 15384584, 15635009, 15807561, 15933577, 16029594, 16105155, 16166147, 16216399, 16258508, 16294295, 16325078, 16351831, 16375291, 16396026, 16414479, 16431002, 16445880, 16459343, 16471578, 16482744, 16492970, 16502368, 16511031, 16519039, 16526459, 16533352, 16539769, 16545755, 16551348, 16556584, 16561493, 16566101, 16570433, 16574511, 16578353, 16581977, 16585398, 16588629, 16591685, 16594575, 16597311, 16599901, 16602354, 16604679, 16606881, 16608968, 16610945, 16612818, 16614592, 16616272, 16617861, 16619363, 16620782, 16622121, 16623383, 16624570, 16625685, 16626730, 16627708, 16628619, 16629465, 16630248, 16630969, 16631628, 16632228, 16632768, 16633248, 16633671, 16634034, 16634340, 16634586, 16634774, 16634903, 16634972, 16634980, 16634926, 16634810, 16634628, 16634381, 16634066, 16633680, 16633222, 16632688, 16632075, 16631380, 16630598, 16629726, 16628757, 16627686, 16626507, 16625212, 16623794, 16622243, 16620548, 16618698, 16616679, 16614476, 16612071, 16609444, 16606571, 16603425, 16599973, 16596178, 16591995, 16587369, 16582237, 16576520, 16570120, 16562917, 16554758, 16545450, 16534739, 16522287, 16507638, 16490152, 16468907, 16442518, 16408804, 16364095, 16301683, 16207738, 16047994, 15704248, 15472926 }; // (Ziggurat) tabulated values of 2^{-24}*x[i] const double Normal_RNG::wtab[128] = { 1.62318314817e-08, 2.16291505214e-08, 2.54246305087e-08, 2.84579525938e-08, 3.10340022482e-08, 3.33011726243e-08, 3.53439060345e-08, 3.72152672658e-08, 3.8950989572e-08, 4.05763964764e-08, 4.21101548915e-08, 4.35664624904e-08, 4.49563968336e-08, 4.62887864029e-08, 4.75707945735e-08, 4.88083237257e-08, 5.00063025384e-08, 5.11688950428e-08, 5.22996558616e-08, 5.34016475624e-08, 5.44775307871e-08, 5.55296344581e-08, 5.65600111659e-08, 5.75704813695e-08, 5.85626690412e-08, 5.95380306862e-08, 6.04978791776e-08, 6.14434034901e-08, 6.23756851626e-08, 6.32957121259e-08, 6.42043903937e-08, 6.51025540077e-08, 6.59909735447e-08, 6.68703634341e-08, 6.77413882848e-08, 6.8604668381e-08, 6.94607844804e-08, 7.03102820203e-08, 7.11536748229e-08, 7.1991448372e-08, 7.2824062723e-08, 7.36519550992e-08, 7.44755422158e-08, 7.52952223703e-08, 7.61113773308e-08, 7.69243740467e-08, 7.77345662086e-08, 7.85422956743e-08, 7.93478937793e-08, 8.01516825471e-08, 8.09539758128e-08, 8.17550802699e-08, 8.25552964535e-08, 8.33549196661e-08, 8.41542408569e-08, 8.49535474601e-08, 8.57531242006e-08, 8.65532538723e-08, 8.73542180955e-08, 8.8156298059e-08, 8.89597752521e-08, 8.97649321908e-08, 9.05720531451e-08, 9.138142487e-08, 9.21933373471e-08, 9.30080845407e-08, 9.38259651738e-08, 9.46472835298e-08, 9.54723502847e-08, 9.63014833769e-08, 9.71350089201e-08, 9.79732621669e-08, 9.88165885297e-08, 9.96653446693e-08, 1.00519899658e-07, 1.0138063623e-07, 1.02247952126e-07, 1.03122261554e-07, 1.04003996769e-07, 1.04893609795e-07, 1.05791574313e-07, 1.06698387725e-07, 1.07614573423e-07, 1.08540683296e-07, 1.09477300508e-07, 1.1042504257e-07, 1.11384564771e-07, 1.12356564007e-07, 1.13341783071e-07, 1.14341015475e-07, 1.15355110887e-07, 1.16384981291e-07, 1.17431607977e-07, 1.18496049514e-07, 1.19579450872e-07, 1.20683053909e-07, 1.21808209468e-07, 1.2295639141e-07, 1.24129212952e-07, 1.25328445797e-07, 1.26556042658e-07, 1.27814163916e-07, 1.29105209375e-07, 1.30431856341e-07, 1.31797105598e-07, 1.3320433736e-07, 1.34657379914e-07, 1.36160594606e-07, 1.37718982103e-07, 1.39338316679e-07, 1.41025317971e-07, 1.42787873535e-07, 1.44635331499e-07, 1.4657889173e-07, 1.48632138436e-07, 1.50811780719e-07, 1.53138707402e-07, 1.55639532047e-07, 1.58348931426e-07, 1.61313325908e-07, 1.64596952856e-07, 1.68292495203e-07, 1.72541128694e-07, 1.77574279496e-07, 1.83813550477e-07, 1.92166040885e-07, 2.05295471952e-07, 2.22600839893e-07 }; // (Ziggurat) position of right-most step const double Normal_RNG::PARAM_R = 3.44428647676; // Get a Normal distributed (0,1) sample double Normal_RNG::sample() { uint32_t u, sign, i, j; double x, y; while(true) { u = RNG.genrand_uint32(); sign = u & 0x80; // 1 bit for the sign i = u & 0x7f; // 7 bits to choose the step j = u >> 8; // 24 bits for the x-value x = j * wtab[i]; if(j < ktab[i]) break; if(i < 127) { y = ytab[i + 1] + (ytab[i] - ytab[i + 1]) * RNG.genrand_close_open(); } else { x = PARAM_R - std::log(1.0 - RNG.genrand_close_open()) / PARAM_R; y = std::exp(-PARAM_R * (x - 0.5 * PARAM_R)) * RNG.genrand_close_open(); } if(y < std::exp(-0.5 * x * x)) break; } return sign ? x : -x; } /////////////////////////////////////////////// // Laplace_RNG /////////////////////////////////////////////// Laplace_RNG::Laplace_RNG(double meanval, double variance) { setup(meanval, variance); } void Laplace_RNG::setup(double meanval, double variance) { mean = meanval; var = variance; sqrt_12var = std::sqrt(variance / 2.0); } void Laplace_RNG::get_setup(double &meanval, double &variance) const { meanval = mean; variance = var; } vec Laplace_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat Laplace_RNG::operator()(int h, int w) { mat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // AR1_Normal_RNG /////////////////////////////////////////////// AR1_Normal_RNG::AR1_Normal_RNG(double meanval, double variance, double rho) { setup(meanval, variance, rho); } void AR1_Normal_RNG::setup(double meanval, double variance, double rho) { mean = meanval; var = variance; r = rho; factr = -2.0 * var * (1.0 - rho * rho); mem = 0.0; odd = true; } void AR1_Normal_RNG::get_setup(double &meanval, double &variance, double &rho) const { meanval = mean; variance = var; rho = r; } vec AR1_Normal_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat AR1_Normal_RNG::operator()(int h, int w) { mat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } void AR1_Normal_RNG::reset() { mem = 0.0; } /////////////////////////////////////////////// // Weibull_RNG /////////////////////////////////////////////// Weibull_RNG::Weibull_RNG(double lambda, double beta) { setup(lambda, beta); } void Weibull_RNG::setup(double lambda, double beta) { l = lambda; b = beta; mean = tgamma(1.0 + 1.0 / b) / l; var = tgamma(1.0 + 2.0 / b) / (l * l) - mean; } vec Weibull_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat Weibull_RNG::operator()(int h, int w) { mat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Rayleigh_RNG /////////////////////////////////////////////// Rayleigh_RNG::Rayleigh_RNG(double sigma) { setup(sigma); } vec Rayleigh_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat Rayleigh_RNG::operator()(int h, int w) { mat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Rice_RNG /////////////////////////////////////////////// Rice_RNG::Rice_RNG(double lambda, double beta) { setup(lambda, beta); } vec Rice_RNG::operator()(int n) { vec vv(n); for(int i = 0; i < n; i++) vv(i) = sample(); return vv; } mat Rice_RNG::operator()(int h, int w) { mat mm(h, w); int i, j; for(i = 0; i < h; i++) for(j = 0; j < w; j++) mm(i, j) = sample(); return mm; } } // namespace itpp itpp-4.3.1/itpp/base/random.h000066400000000000000000000671631216575753400160460ustar00rootroot00000000000000/*! * \file * \brief Definition of classes for random number generators * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef RANDOM_H #define RANDOM_H #include #include #include namespace itpp { /*! \addtogroup randgen Set of functions to work with global seed provider: \code void GlobalRNG_reset(unsigned int seed); void GlobalRNG_reset(); unsigned int GlobalRNG_get_local_seed(); void GlobalRNG_randomize(); void GlobalRNG_get_state(ivec &state); void GlobalRNG_set_state(const ivec &state); \endcode Global seed provider generate default seeds to initialize per-thread generators of pseudo-random numbers. Functions implement mutually exclusive access to the global seed provider instance. Be carefull, Mutual exclusion serializes access to the global seed provider context and protects its integrity. It does not guarantee the expected results if global seed provider is accessed simultaneously from several threads. For example, \code ivec st_before,st_after; GlobalRNG_get_state(st_before); GlobalRNG_set_state(st_before); GlobalRNG_get_state(st_after); assert(st_before==st_after); \endcode last assert can fail in multithreaded environment. Be aware, Global seed provider generates seeds to initialize non-initialized per-thread RNG contexts. Global seed provider is just a random numbers generator starting with default seed equal to 4257U. When RNGs are created in some thread, global seed provider is queried for the new seed to initialize random number generation in the current thread. The first seed returned by the global seed provider is also 4257U by default. Other seeds are taken from the rng output directly. It is implemented this way because some ITPP tests implicitly rely on this value. Global seed provider internals are defined in random.cpp and can be changed easily if such a behaviour is not desirable. Global initialization can be overriden by the explicit call of the local context initialization function. Global seed provider changes will not affect already initialized contexts in running or parked threads, since global seeds are used during the local context initialization only. Local contexts get initialized upon creation of first RandomGenerator object in each thread. RNG_reset() without arguments can also query a global seed if local context is not initialized when the function is called. For example, if you want the main thread context to be affected by global settings, GlobalRNG_reset(seed) shall be called BEFORE the construction of first RandomGenerator object. The best place to do it is the very beginning of your main() function. If you create itpp library objects, encapsulating RNGs, statically, the main thread context will not be affected by any call to GlobalRNG_reset(s)/GlobalRNG_set_state(s). If you still want to have main-thread state be derived from the global context, you should do the following trick at the beginning of main(): \code unsigned int my_global_seed = 0xAAAAAAAA; GlobalRNG_reset(my_global_seed); unsigned int s = GlobalRNG_get_local_seed(); //query new local seed RNG_reset(s); //set it maually for the main thread //you can call your main-thread RNGs here \endcode @{ */ //! Set the internal seed of the Global Seed Provider ITPP_EXPORT void GlobalRNG_reset(unsigned int seed); //! Reset the internal seed of the Global Seed Provider to the previously set value ITPP_EXPORT void GlobalRNG_reset(); //! Get new seed to initialize thread-local generators ITPP_EXPORT unsigned int GlobalRNG_get_local_seed(); //! Set a random seed for the Global Seed Provider seed ITPP_EXPORT void GlobalRNG_randomize(); //! Save current full state of global seed provider in memory ITPP_EXPORT void GlobalRNG_get_state(ivec &state); //! Resume the global seed provider state saved in memory ITPP_EXPORT void GlobalRNG_set_state(const ivec &state); //!@} /*! \addtogroup randgen Local (per-thread) RNG context management. \code void RNG_reset(unsigned int seed); void RNG_reset(); void RNG_get_state(ivec &state); void RNG_set_state(const ivec &state); \endcode This set of functions allow to override seed value set from global seed provider and use custom seeds/initialization vectors for each thread (including main thread). @{ */ //! Set the seed for all Random Number Generators in the current thread ITPP_EXPORT void RNG_reset(unsigned int seed); /*! \brief Reset the seed to the previously set value for all Random Number Generators in the current thread. Seed will be queried from the global seed provider if Random Number generation context is not initialized */ ITPP_EXPORT void RNG_reset(); //! Set a random seed for all Random Number Generators in the current thread ITPP_EXPORT void RNG_randomize(); //! Save Random Number generation context used in the current thread ITPP_EXPORT void RNG_get_state(ivec &state); //! Resume Random Number generation in the current thread with previously stored context ITPP_EXPORT void RNG_set_state(const ivec &state); //!@} /*! *\ingroup randgen *\brief Base class for random (stochastic) sources. * * Random_Generator provides thread-safe generation of pseudo-random numbers * * \sa DSFMT */ class ITPP_EXPORT Random_Generator { typedef random_details::ActiveDSFMT DSFMT; public: //! Default constructor Random_Generator(): _dsfmt(random_details::lc_get()) { if(!random_details::lc_is_initialized()) { _dsfmt.init_gen_rand(GlobalRNG_get_local_seed()); random_details::lc_mark_initialized(); } } //Constructor using a certain seed - do not want to provide it. Use free-standing functions to change per-thread local seed //Random_Generator(unsigned int seed) { init_gen_rand(seed); random_details::lc_mark_initialized();} //provide wrappers for DSFMT algorithm functions //Set the seed to a semi-random value (based on hashed time and clock) - do not want to provide it. Use free-standing functions to change per-thread local seed //void randomize(){RNG_randomize();} //Reset the generator with the same seed as used last time - do not want to provide it. Use free-standing functions to change per-thread local seed //void reset() {RNG_reset();} //Initialise the generator with a new seed (\sa init_gen_rand()) - do not want to provide it. Use free-standing functions to change per-thread local seed //void reset(unsigned int seed) { RNG_reset(seed); } //Resume the state of the generator from a previously saved ivec - do not want to provide it. Use free-standing functions to change per-thread local seed //void set_state(const ivec &state) {RNG_set_state(state);} //Return current state of generator in the form of ivec - do not want to provide it. Use free-standing functions to change per-thread local seed //ivec get_state() const {ivec ret; RNG_get_state(ret); return ret; } //! Return a uniformly distributed (0,1) value. double random_01() { return genrand_open_open(); } //! Return a uniformly distributed [0,1) value. double random_01_lclosed() { return genrand_close_open(); } //! Return a uniformly distributed (0,1] value. double random_01_rclosed() { return genrand_open_close(); } //! Return a uniformly distributed [0, UINT_MAX) value. uint32_t random_int() { return genrand_uint32(); } //! Generate uniform [0, UINT_MAX) integer pseudorandom number. uint32_t genrand_uint32() { return _dsfmt.genrand_uint32(); } /*! * \brief Generate uniform [1, 2) double pseudorandom number. * * This function generates and returns double precision pseudorandom * number which distributes uniformly in the range [1, 2). This is * the primitive and faster than generating numbers in other ranges. * \c init_gen_rand() must be called before this function. * \return double precision floating point pseudorandom number */ double genrand_close1_open2() { return _dsfmt.genrand_close1_open2(); } /*! * \brief Generate uniform [0, 1) double pseudorandom number. * * This function generates and returns double precision pseudorandom * number which distributes uniformly in the range [0, 1). * \c init_gen_rand() must be called before this function. * \return double precision floating point pseudorandom number */ double genrand_close_open() { return genrand_close1_open2() - 1.0; } /*! * \brief Generate uniform (0, 1] double pseudorandom number. * * This function generates and returns double precision pseudorandom * number which distributes uniformly in the range (0, 1]. * \c init_gen_rand() must be called before this function. * \return double precision floating point pseudorandom number */ double genrand_open_close() { return 2.0 - genrand_close1_open2(); } /*! * \brief Generate uniform (0, 1) double pseudorandom number. * * This function generates and returns double precision pseudorandom * number which distributes uniformly in the range (0, 1). * \c init_gen_rand() must be called before this function. * \return double precision floating point pseudorandom number */ double genrand_open_open() { return _dsfmt.genrand_open_open();} private: DSFMT _dsfmt; }; /*! \brief Bernoulli distribution \ingroup randgen */ class ITPP_EXPORT Bernoulli_RNG { public: //! Binary source with probability prob for a 1 Bernoulli_RNG(double prob) { setup(prob); } //! Binary source with probability prob for a 1 Bernoulli_RNG() { p = 0.5; } //! set the probability void setup(double prob) { it_assert(prob >= 0.0 && prob <= 1.0, "The Bernoulli source probability " "must be between 0 and 1"); p = prob; } //! return the probability double get_setup() const { return p; } //! Get one sample. bin operator()() { return sample(); } //! Get a sample vector. bvec operator()(int n) { bvec temp(n); sample_vector(n, temp); return temp; } //! Get a sample matrix. bmat operator()(int h, int w) { bmat temp(h, w); sample_matrix(h, w, temp); return temp; } //! Get a sample bin sample() { return RNG.genrand_close_open() < p ? bin(1) : bin(0); } //! Get a sample vector. void sample_vector(int size, bvec &out) { out.set_size(size, false); for(int i = 0; i < size; i++) out(i) = sample(); } //! Get a sample matrix. void sample_matrix(int rows, int cols, bmat &out) { out.set_size(rows, cols, false); for(int i = 0; i < rows * cols; i++) out(i) = sample(); } protected: private: //! double p; //! Random_Generator RNG; }; /*! \brief Integer uniform distribution \ingroup randgen Example: Generation of random uniformly distributed integers in the interval [0,10]. \code #include "itpp/sigproc.h" int main() { I_Uniform_RNG gen(0, 10); cout << gen() << endl; // prints a random integer cout << gen(10) << endl; // prints 10 random integers } \endcode */ class ITPP_EXPORT I_Uniform_RNG { public: //! constructor. Sets min and max values. I_Uniform_RNG(int min = 0, int max = 1); //! set min and max values void setup(int min, int max); //! get the parameters void get_setup(int &min, int &max) const; //! Get one sample. int operator()() { return sample(); } //! Get a sample vector. ivec operator()(int n); //! Get a sample matrix. imat operator()(int h, int w); //! Return a single value from this random generator int sample() { return floor_i(RNG.genrand_close_open() * (hi - lo + 1)) + lo; } private: //! int lo; //! int hi; //! Random_Generator RNG; }; /*! \brief Uniform distribution \ingroup randgen */ class ITPP_EXPORT Uniform_RNG { public: //! Constructor. Set min, max and seed. Uniform_RNG(double min = 0, double max = 1.0); //! set min and max void setup(double min, double max); //! get parameters void get_setup(double &min, double &max) const; //! Get one sample. double operator()() { return (sample() * (hi_bound - lo_bound) + lo_bound); } //! Get a sample vector. vec operator()(int n) { vec temp(n); sample_vector(n, temp); temp *= hi_bound - lo_bound; temp += lo_bound; return temp; } //! Get a sample matrix. mat operator()(int h, int w) { mat temp(h, w); sample_matrix(h, w, temp); temp *= hi_bound - lo_bound; temp += lo_bound; return temp; } //! Get a Uniformly distributed [0,1) sample double sample() { return RNG.genrand_close_open(); } //! Get a Uniformly distributed [0,1) vector void sample_vector(int size, vec &out) { out.set_size(size, false); for(int i = 0; i < size; i++) out(i) = sample(); } //! Get a Uniformly distributed [0,1) matrix void sample_matrix(int rows, int cols, mat &out) { out.set_size(rows, cols, false); for(int i = 0; i < rows * cols; i++) out(i) = sample(); } protected: private: //! double lo_bound, hi_bound; //! Random_Generator RNG; }; /*! \brief Exponential distribution \ingroup randgen */ class ITPP_EXPORT Exponential_RNG { public: //! constructor. Set lambda. Exponential_RNG(double lambda = 1.0); //! Set lambda void setup(double lambda) { l = lambda; } //! get lambda double get_setup() const; //! Get one sample. double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); private: double sample() { return (-std::log(RNG.genrand_open_close()) / l); } double l; Random_Generator RNG; }; /*! * \brief Normal distribution * \ingroup randgen * * Normal (Gaussian) random variables, using a simplified Ziggurat method. * * For details see the following arcticle: George Marsaglia, Wai Wan * Tsang, "The Ziggurat Method for Generating Random Variables", Journal * of Statistical Software, vol. 5 (2000), no. 8 * * This implementation is based on the generator written by Jochen Voss * found at http://seehuhn.de/comp/ziggurat/, which is also included in * the GSL library (randlist/gauss.c). */ class ITPP_EXPORT Normal_RNG { public: //! Constructor. Set mean and variance. Normal_RNG(double meanval, double variance): mean(meanval), sigma(std::sqrt(variance)) {} //! Constructor. Set mean and variance. Normal_RNG(): mean(0.0), sigma(1.0) {} //! Set mean, and variance void setup(double meanval, double variance) { mean = meanval; sigma = std::sqrt(variance); } //! Get mean and variance void get_setup(double &meanval, double &variance) const; //! Get one sample. double operator()() { return (sigma * sample() + mean); } //! Get a sample vector. vec operator()(int n) { vec temp(n); sample_vector(n, temp); temp *= sigma; temp += mean; return temp; } //! Get a sample matrix. mat operator()(int h, int w) { mat temp(h, w); sample_matrix(h, w, temp); temp *= sigma; temp += mean; return temp; } //! Get a Normal distributed (0,1) sample double sample(); //! Get a Normal distributed (0,1) vector void sample_vector(int size, vec &out) { out.set_size(size, false); for(int i = 0; i < size; i++) out(i) = sample(); } //! Get a Normal distributed (0,1) matrix void sample_matrix(int rows, int cols, mat &out) { out.set_size(rows, cols, false); for(int i = 0; i < rows * cols; i++) out(i) = sample(); } private: double mean, sigma; static const double ytab[128]; static const unsigned int ktab[128]; static const double wtab[128]; static const double PARAM_R; Random_Generator RNG; }; /*! * \brief Gamma distribution * \ingroup randgen * * Generate samples from Gamma(alpha,beta) density, according to the * following equation: * \f[ x \sim \Gamma(\alpha,\beta) = * \frac{\beta^\alpha}{\Gamma(\alpha)}x^{\alpha-1} \exp(-\beta x) \f] * * For \f$\alpha=1\f$ the Gamma distribution is equivalent to the * Exponential distribution. * * \note The implementation of the sample() function was adapted from the * R statistical language. * \author Vasek Smidl */ class ITPP_EXPORT Gamma_RNG { public: //! Constructor, which sets alpha (a) and beta (b) Gamma_RNG(double a = 1.0, double b = 1.0): alpha(a), beta(b) {init_state();} //! Set alpha and beta void setup(double a, double b) { alpha = a; beta = b; } //! Get one sample double operator()() { return sample(); } //! Get a sample vector vec operator()(int n); //! Get a sample matrix mat operator()(int r, int c); //! Get a sample double sample(); private: //! Initializer of state variables void init_state(); //! shape parameter of Gamma distribution double alpha; //! inverse scale parameter of Gamma distribution double beta; Random_Generator RNG; Normal_RNG NRNG; /* State variables - used in Gamma_Rng::sample()*/ double _s, _s2, _d, _scale; double _q0, _b, _si, _c; }; /*! \brief Laplacian distribution \ingroup randgen */ class ITPP_EXPORT Laplace_RNG { public: //! Constructor. Set mean and variance. Laplace_RNG(double meanval = 0.0, double variance = 1.0); //! Set mean and variance void setup(double meanval, double variance); //! Get mean and variance void get_setup(double &meanval, double &variance) const; //! Get one sample. double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); //! Returns a single sample double sample() { double u = RNG.genrand_open_open(); double l = sqrt_12var; if(u < 0.5) l *= std::log(2.0 * u); else l *= -std::log(2.0 * (1 - u)); return (l + mean); } private: double mean, var, sqrt_12var; Random_Generator RNG; }; /*! \brief A Complex Normal Source \ingroup randgen */ class ITPP_EXPORT Complex_Normal_RNG { public: //! Constructor. Set mean and variance. Complex_Normal_RNG(std::complex mean, double variance): norm_factor(1.0 / std::sqrt(2.0)) { setup(mean, variance); } //! Default constructor Complex_Normal_RNG(): m_re(0.0), m_im(0.0), sigma(1.0), norm_factor(1.0 / std::sqrt(2.0)) {} //! Set mean and variance void setup(std::complex mean, double variance) { m_re = mean.real(); m_im = mean.imag(); sigma = std::sqrt(variance); } //! Get mean and variance void get_setup(std::complex &mean, double &variance) { mean = std::complex(m_re, m_im); variance = sigma * sigma; } //! Get one sample. std::complex operator()() { return sigma * sample() + std::complex(m_re, m_im); } //! Get a sample vector. cvec operator()(int n) { cvec temp(n); sample_vector(n, temp); temp *= sigma; temp += std::complex(m_re, m_im); return temp; } //! Get a sample matrix. cmat operator()(int h, int w) { cmat temp(h, w); sample_matrix(h, w, temp); temp *= sigma; temp += std::complex(m_re, m_im); return temp; } //! Get a Complex Normal (0,1) distributed sample std::complex sample() { double a = nRNG.sample() * norm_factor; double b = nRNG.sample() * norm_factor; return std::complex(a, b); } //! Get a Complex Normal (0,1) distributed vector void sample_vector(int size, cvec &out) { out.set_size(size, false); for(int i = 0; i < size; i++) out(i) = sample(); } //! Get a Complex Normal (0,1) distributed matrix void sample_matrix(int rows, int cols, cmat &out) { out.set_size(rows, cols, false); for(int i = 0; i < rows * cols; i++) out(i) = sample(); } //! Dummy assignment operator - MSVC++ warning C4512 Complex_Normal_RNG & operator=(const Complex_Normal_RNG&) { return *this; } private: double m_re; double m_im; double sigma; const double norm_factor; Normal_RNG nRNG; }; /*! \brief Filtered normal distribution \ingroup randgen */ class ITPP_EXPORT AR1_Normal_RNG { public: //! Constructor. Set mean, variance, and correlation. AR1_Normal_RNG(double meanval = 0.0, double variance = 1.0, double rho = 0.0); //! Set mean, variance, and correlation void setup(double meanval, double variance, double rho); //! Get mean, variance and correlation void get_setup(double &meanval, double &variance, double &rho) const; //! Set memory contents to zero void reset(); //! Get a single random sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); private: double sample() { mem *= r; if(odd) { r1 = m_2pi * RNG.genrand_open_close(); r2 = std::sqrt(factr * std::log(RNG.genrand_open_close())); mem += r2 * std::cos(r1); } else { mem += r2 * std::sin(r1); } odd = !odd; return (mem + mean); } double mem, r, factr, mean, var, r1, r2; bool odd; Random_Generator RNG; }; /*! \brief Gauss_RNG is the same as Normal Source \ingroup randgen */ typedef Normal_RNG Gauss_RNG; /*! \brief AR1_Gauss_RNG is the same as AR1_Normal_RNG \ingroup randgen */ typedef AR1_Normal_RNG AR1_Gauss_RNG; /*! \brief Weibull distribution \ingroup randgen */ class ITPP_EXPORT Weibull_RNG { public: //! Constructor. Set lambda and beta. Weibull_RNG(double lambda = 1.0, double beta = 1.0); //! Set lambda, and beta void setup(double lambda, double beta); //! Get lambda and beta void get_setup(double &lambda, double &beta) { lambda = l; beta = b; } //! Get one sample. double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); private: double sample() { return (std::pow(-std::log(RNG.genrand_open_close()), 1.0 / b) / l); } double l, b; double mean, var; Random_Generator RNG; }; /*! \brief Rayleigh distribution \ingroup randgen */ class ITPP_EXPORT Rayleigh_RNG { public: //! Constructor. Set sigma. Rayleigh_RNG(double sigma = 1.0); //! Set sigma void setup(double sigma) { sig = sigma; } //! Get sigma double get_setup() { return sig; } //! Get one sample. double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); private: double sample() { double s1 = nRNG.sample(); double s2 = nRNG.sample(); // s1 and s2 are N(0,1) and independent return (sig * std::sqrt(s1 * s1 + s2 * s2)); } double sig; Normal_RNG nRNG; }; /*! \brief Rice distribution \ingroup randgen */ class ITPP_EXPORT Rice_RNG { public: //! Constructor. Set sigma, and v (if v = 0, Rice -> Rayleigh). Rice_RNG(double sigma = 1.0, double v = 1.0); //! Set sigma, and v (if v = 0, Rice -> Rayleigh). void setup(double sigma, double v) { sig = sigma; s = v; } //! Get parameters void get_setup(double &sigma, double &v) { sigma = sig; v = s; } //! Get one sample double operator()() { return sample(); } //! Get a sample vector vec operator()(int n); //! Get a sample matrix mat operator()(int h, int w); private: double sample() { double s1 = nRNG.sample() + s; double s2 = nRNG.sample(); // s1 and s2 are N(0,1) and independent return (sig * std::sqrt(s1 * s1 + s2 * s2)); } double sig, s; Normal_RNG nRNG; }; //! \addtogroup randgen //!@{ //! Generates a random bit (equally likely 0s and 1s) inline bin randb(void) { Bernoulli_RNG src; return src.sample(); } //! Generates a random bit vector (equally likely 0s and 1s) inline void randb(int size, bvec &out) { Bernoulli_RNG src; src.sample_vector(size, out); } //! Generates a random bit vector (equally likely 0s and 1s) inline bvec randb(int size) { bvec temp; randb(size, temp); return temp; } //! Generates a random bit matrix (equally likely 0s and 1s) inline void randb(int rows, int cols, bmat &out) { Bernoulli_RNG src; src.sample_matrix(rows, cols, out); } //! Generates a random bit matrix (equally likely 0s and 1s) inline bmat randb(int rows, int cols) { bmat temp; randb(rows, cols, temp); return temp; } //! Generates a random uniform (0,1) number inline double randu(void) { Uniform_RNG src; return src.sample(); } //! Generates a random uniform (0,1) vector inline void randu(int size, vec &out) { Uniform_RNG src; src.sample_vector(size, out); } //! Generates a random uniform (0,1) vector inline vec randu(int size) { vec temp; randu(size, temp); return temp; } //! Generates a random uniform (0,1) matrix inline void randu(int rows, int cols, mat &out) { Uniform_RNG src; src.sample_matrix(rows, cols, out); } //! Generates a random uniform (0,1) matrix inline mat randu(int rows, int cols) { mat temp; randu(rows, cols, temp); return temp; } //! Generates a random integer in the interval [low,high] inline int randi(int low, int high) { I_Uniform_RNG src; src.setup(low, high); return src(); } //! Generates a random ivec with elements in the interval [low,high] inline ivec randi(int size, int low, int high) { I_Uniform_RNG src; src.setup(low, high); return src(size); } //! Generates a random imat with elements in the interval [low,high] inline imat randi(int rows, int cols, int low, int high) { I_Uniform_RNG src; src.setup(low, high); return src(rows, cols); } //! Generates a random Rayleigh vector inline vec randray(int size, double sigma = 1.0) { Rayleigh_RNG src; src.setup(sigma); return src(size); } //! Generates a random Rice vector (See J.G. Poakis, "Digital Communications, 3rd ed." p.47) inline vec randrice(int size, double sigma = 1.0, double s = 1.0) { Rice_RNG src; src.setup(sigma, s); return src(size); } //! Generates a random complex Gaussian vector inline vec randexp(int size, double lambda = 1.0) { Exponential_RNG src; src.setup(lambda); return src(size); } //! Generates a random Gaussian (0,1) variable inline double randn(void) { Normal_RNG src; return src.sample(); } //! Generates a random Gaussian (0,1) vector inline void randn(int size, vec &out) { Normal_RNG src; src.sample_vector(size, out); } //! Generates a random Gaussian (0,1) vector inline vec randn(int size) { vec temp; randn(size, temp); return temp; } //! Generates a random Gaussian (0,1) matrix inline void randn(int rows, int cols, mat &out) { Normal_RNG src; src.sample_matrix(rows, cols, out); } //! Generates a random Gaussian (0,1) matrix inline mat randn(int rows, int cols) { mat temp; randn(rows, cols, temp); return temp; } /*! \brief Generates a random complex Gaussian (0,1) variable The real and imaginary parts are independent and have variances equal to 0.5 */ inline std::complex randn_c(void) { Complex_Normal_RNG src; return src.sample(); } //! Generates a random complex Gaussian (0,1) vector inline void randn_c(int size, cvec &out) { Complex_Normal_RNG src; src.sample_vector(size, out); } //! Generates a random complex Gaussian (0,1) vector inline cvec randn_c(int size) { cvec temp; randn_c(size, temp); return temp; } //! Generates a random complex Gaussian (0,1) matrix inline void randn_c(int rows, int cols, cmat &out) { Complex_Normal_RNG src; src.sample_matrix(rows, cols, out); } //! Generates a random complex Gaussian (0,1) matrix inline cmat randn_c(int rows, int cols) { cmat temp; randn_c(rows, cols, temp); return temp; } //!@} } // namespace itpp #endif // #ifndef RANDOM_H itpp-4.3.1/itpp/base/random_dsfmt.h000066400000000000000000000323471216575753400172370ustar00rootroot00000000000000/*! * \file * \brief C++ implementation of dSFMT random number generator * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef RANDOM_DSFMT_H #define RANDOM_DSFMT_H #include #include #include // required for memset() #include #include #include #if defined(__SSE2__) # include #endif namespace itpp { namespace random_details { /*! * \ingroup randgen * \brief C++ implementation of dSFMT random number generator. * * The DSFMT class implements parts of the Double precision SIMD-oriented * Fast Mersenne Twister (dSFM) random number generator. DSFMT directly * generates double precision floating point random numbers, which have the * IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std * 754-1985) format. DSFMT does not support integer outputs. * * Visit http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html for * more details on the original dSFMT implementation. * * Here is a copy of the LICENSE.txt file from the dSFMT-src-2.0.tar.gz * package, on which C++ DSFMT implementation is based: * \verbatim * Copyright (c) 2007, 2008 Mutsuo Saito, Makoto Matsumoto and Hiroshima * University. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the Hiroshima University nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * \endverbatim */ template < int MEXP, int POS1, int SL1, uint64_t MSK1, uint64_t MSK2, uint64_t FIX1_V, uint64_t FIX2_V, uint64_t PCV1_V, uint64_t PCV2_V > class ITPP_EXPORT DSFMT { public: //make usefull constants available in typedefed definitions static const int N = (MEXP - 128) / 104 + 1; static const uint64_t FIX1 = FIX1_V; static const uint64_t FIX2 = FIX2_V; static const uint64_t PCV1 = PCV1_V; static const uint64_t PCV2 = PCV2_V; #if defined(__SSE2__) static const uint32_t MSK32_1 = static_cast((MSK1 >> 32) & (0xffffffffULL)); static const uint32_t MSK32_2 = static_cast(MSK1 & (0xffffffffULL)); static const uint32_t MSK32_3 = static_cast((MSK2 >> 32) & (0xffffffffULL)); static const uint32_t MSK32_4 = static_cast(MSK2 & (0xffffffffULL)); #endif /*! \brief DSFMT context structure. Shall be a POD type since we want to allocate it in thread-local storage gcc and msvc may have problems with non-POD types and threadprivate pragma */ struct Context { //! \brief Data structure to hold 128-bit values union W128_T { #if defined(__SSE2__) __m128i si; __m128d sd; #endif // __SSE2__ uint64_t u[2]; uint32_t u32[4]; double d[2]; }; //! 128-bit data type typedef union W128_T w128_t; //! 128-bit internal state array w128_t status[N + 1]; //! State array indexing int idx; //! Last known seed used to initialize context unsigned int last_seed; }; public: //! Constructor using a certain context DSFMT(Context& c): _context(c) {} /*! * \brief Initialise the generator with a new seed. * * This function initializes the internal state array with a 32-bit * integer seed. * \param seed a 32-bit integer used as the seed. */ void init_gen_rand(unsigned int seed) { uint32_t *psfmt = &_context.status[0].u32[0]; psfmt[idxof(0)] = seed; for(int i = 1; i < (N + 1) * 4; i++) { psfmt[idxof(i)] = 1812433253UL * (psfmt[idxof(i - 1)] ^ (psfmt[idxof(i - 1)] >> 30)) + i; } initial_mask(); period_certification(); _context.idx = Nx2; _context.last_seed = seed; } //! Generate uniform [0, UINT_MAX) integer pseudorandom number. uint32_t genrand_uint32() { uint64_t *psfmt64 = &_context.status[0].u[0]; if(_context.idx >= Nx2) { dsfmt_gen_rand_all(); _context.idx = 0; } return (uint32_t)(psfmt64[_context.idx++] & 0xffffffffU); } /*! * \brief Generate uniform [1, 2) double pseudorandom number. * * This function generates and returns double precision pseudorandom * number which distributes uniformly in the range [1, 2). This is * the primitive and faster than generating numbers in other ranges. * \c init_gen_rand() must be called before this function. * \return double precision floating point pseudorandom number */ double genrand_close1_open2() { double *psfmt64 = &_context.status[0].d[0]; if(_context.idx >= Nx2) { dsfmt_gen_rand_all(); _context.idx = 0; } return psfmt64[_context.idx++]; } /*! * \brief Generate uniform (0, 1) double pseudorandom number. * * This function generates and returns double precision pseudorandom * number which distributes uniformly in the range (0, 1). * \c init_gen_rand() must be called before this function. * \return double precision floating point pseudorandom number */ double genrand_open_open() { double *dsfmt64 = &_context.status[0].d[0]; union { double d; uint64_t u; } r; if(_context.idx >= Nx2) { dsfmt_gen_rand_all(); _context.idx = 0; } r.d = dsfmt64[_context.idx++]; r.u |= 1; return r.d - 1.0; } private: static const int Nx2 = N * 2; static const unsigned int SR = 12U; //! Endianness flag static const bool bigendian; #if defined(__SSE2__) //! Mask data for sse2 static const __m128i sse2_param_mask; #endif // __SSE2__ //! Computations context Context& _context; /*! * This function simulate a 32-bit array index overlapped to 64-bit * array of LITTLE ENDIAN in BIG ENDIAN machine. */ static int idxof(int i) { return (bigendian ? (i ^ 1) : i); } /*! * This function initializes the internal state array to fit the IEEE * 754 format. */ void initial_mask() { const uint64_t LOW_MASK = 0x000fffffffffffffULL; const uint64_t HIGH_CONST = 0x3ff0000000000000ULL; uint64_t *psfmt = &_context.status[0].u[0]; for(int i = 0; i < Nx2; i++) { psfmt[i] = (psfmt[i] & LOW_MASK) | HIGH_CONST; } } //! This function certificate the period of 2^{MEXP}-1. void period_certification() { uint64_t pcv[2] = {PCV1, PCV2}; uint64_t tmp[2]; uint64_t inner; tmp[0] = (_context.status[N].u[0] ^ FIX1); tmp[1] = (_context.status[N].u[1] ^ FIX2); inner = tmp[0] & pcv[0]; inner ^= tmp[1] & pcv[1]; for(int i = 32; i > 0; i >>= 1) { inner ^= inner >> i; } inner &= 1; /* check OK */ if(inner == 1) { return; } /* check NG, and modification */ #if (PCV2 & 1) == 1 _context.status[N].u[1] ^= 1; #else uint64_t work; for(int i = 1; i >= 0; i--) { work = 1; for(int j = 0; j < 64; j++) { if((work & pcv[i]) != 0) { _context.status[N].u[i] ^= work; return; } work = work << 1; } } #endif // (PCV2 & 1) == 1 return; } /*! * This function represents the recursion formula. * \param r output 128-bit * \param a a 128-bit part of the internal state array * \param b a 128-bit part of the internal state array * \param lung a 128-bit part of the internal state array (I/O) */ static void do_recursion(typename Context::w128_t *r, typename Context::w128_t *a, typename Context::w128_t *b, typename Context::w128_t *lung) { #if defined(__SSE2__) const unsigned int SSE2_SHUFF = 0x1bU; __m128i x = a->si; __m128i z = _mm_slli_epi64(x, SL1); __m128i y = _mm_shuffle_epi32(lung->si, SSE2_SHUFF); z = _mm_xor_si128(z, b->si); y = _mm_xor_si128(y, z); __m128i v = _mm_srli_epi64(y, SR); __m128i w = _mm_and_si128(y, sse2_param_mask); v = _mm_xor_si128(v, x); v = _mm_xor_si128(v, w); r->si = v; lung->si = y; #else // standard C++ uint64_t t0 = a->u[0]; uint64_t t1 = a->u[1]; uint64_t L0 = lung->u[0]; uint64_t L1 = lung->u[1]; lung->u[0] = (t0 << SL1) ^ (L1 >> 32) ^ (L1 << 32) ^ b->u[0]; lung->u[1] = (t1 << SL1) ^ (L0 >> 32) ^ (L0 << 32) ^ b->u[1]; r->u[0] = (lung->u[0] >> SR) ^ (lung->u[0] & MSK1) ^ t0; r->u[1] = (lung->u[1] >> SR) ^ (lung->u[1] & MSK2) ^ t1; #endif // __SSE2__ } /*! * This function fills the internal state array with double precision * floating point pseudorandom numbers of the IEEE 754 format. */ void dsfmt_gen_rand_all() { int i; typename Context::w128_t *status = _context.status; typename Context::w128_t lung = status[N]; do_recursion(&status[0], &status[0], &status[POS1], &lung); for(i = 1; i < N - POS1; i++) { do_recursion(&status[i], &status[i], &status[i + POS1], &lung); } for(; i < N; i++) { do_recursion(&status[i], &status[i], &status[i + POS1 - N], &lung); } status[N] = lung; } }; // ---------------------------------------------------------------------- // typedefs of different RNG // ---------------------------------------------------------------------- typedef DSFMT < 521, 3, 25, 0x000fbfefff77efffULL, 0x000ffeebfbdfbfdfULL, 0xcfb393d661638469ULL, 0xc166867883ae2adbULL, 0xccaa588000000000ULL, 0x0000000000000001ULL > DSFMT_521_RNG; typedef DSFMT < 1279, 9, 19, 0x000efff7ffddffeeULL, 0x000fbffffff77fffULL, 0xb66627623d1a31beULL, 0x04b6c51147b6109bULL, 0x7049f2da382a6aebULL, 0xde4ca84a40000001ULL > DSFMT_1279_RNG; typedef DSFMT < 2203, 7, 19, 0x000fdffff5edbfffULL, 0x000f77fffffffbfeULL, 0xb14e907a39338485ULL, 0xf98f0735c637ef90ULL, 0x8000000000000000ULL, 0x0000000000000001ULL > DSFMT_2203_RNG; typedef DSFMT < 4253, 19, 19, 0x0007b7fffef5feffULL, 0x000ffdffeffefbfcULL, 0x80901b5fd7a11c65ULL, 0x5a63ff0e7cb0ba74ULL, 0x1ad277be12000000ULL, 0x0000000000000001ULL > DSFMT_4253_RNG; typedef DSFMT < 11213, 37, 19, 0x000ffffffdf7fffdULL, 0x000dfffffff6bfffULL, 0xd0ef7b7c75b06793ULL, 0x9c50ff4caae0a641ULL, 0x8234c51207c80000ULL, 0x0000000000000001ULL > DSFMT_11213_RNG; typedef DSFMT < 19937, 117, 19, 0x000ffafffffffb3fULL, 0x000ffdfffc90fffdULL, 0x90014964b32f4329ULL, 0x3b8d12ac548a7c7aULL, 0x3d84e1ac0dc82880ULL, 0x0000000000000001ULL > DSFMT_19937_RNG; /*! * \ingroup randgen * \brief Active Generator for random (stochastic) sources. * * ActiveDSFMT is a typedef of DSFMT class specialization using 19937 * generation period. Library shall be recompiled if switched to other * available algorithm. * * \sa DSFMT */ typedef DSFMT_19937_RNG ActiveDSFMT; /*! \addtogroup randgen Some functions to deal with thread-local RNG generation context: \code ActiveDSFMT::Context& lc_get(); bool lc_is_initialized(); void lc_mark_initialized(); \endcode @{ */ //! Function to access thread-local context for random numbers generation ITPP_EXPORT ActiveDSFMT::Context& lc_get(); //! Function to check if thread-local context is initialized ITPP_EXPORT bool lc_is_initialized(); //! Function to mark thread-local context as initialized ITPP_EXPORT void lc_mark_initialized(); //!@} } } // namespace itpp #endif // #ifndef RANDOM_DSFMT_H itpp-4.3.1/itpp/base/smat.cpp000066400000000000000000000070001216575753400160450ustar00rootroot00000000000000/*! * \file * \brief Sparse Matrix Class implementation * \author Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include //! \cond namespace itpp { // --------------------------------------------------------------------- // Instantiations // --------------------------------------------------------------------- template class ITPP_EXPORT Sparse_Mat; template class ITPP_EXPORT Sparse_Mat; template class ITPP_EXPORT Sparse_Mat >; template ITPP_EXPORT sparse_imat operator+(const sparse_imat &, const sparse_imat &); template ITPP_EXPORT sparse_mat operator+(const sparse_mat &, const sparse_mat &); template ITPP_EXPORT sparse_cmat operator+(const sparse_cmat &, const sparse_cmat &); template ITPP_EXPORT sparse_imat operator*(const sparse_imat &, const sparse_imat &); template ITPP_EXPORT sparse_mat operator*(const sparse_mat &, const sparse_mat &); template ITPP_EXPORT sparse_cmat operator*(const sparse_cmat &, const sparse_cmat &); template ITPP_EXPORT ivec operator*(const ivec &, const sparse_imat &); template ITPP_EXPORT vec operator*(const vec &, const sparse_mat &); template ITPP_EXPORT cvec operator*(const cvec &, const sparse_cmat &); template ITPP_EXPORT ivec operator*(const sparse_imat &, const ivec &); template ITPP_EXPORT vec operator*(const sparse_mat &, const vec &); template ITPP_EXPORT cvec operator*(const sparse_cmat &, const cvec &); template ITPP_EXPORT imat trans_mult(const sparse_imat &); template ITPP_EXPORT mat trans_mult(const sparse_mat &); template ITPP_EXPORT cmat trans_mult(const sparse_cmat &); template ITPP_EXPORT sparse_imat trans_mult_s(const sparse_imat &); template ITPP_EXPORT sparse_mat trans_mult_s(const sparse_mat &); template ITPP_EXPORT sparse_cmat trans_mult_s(const sparse_cmat &); template ITPP_EXPORT sparse_imat trans_mult(const sparse_imat &, const sparse_imat &); template ITPP_EXPORT sparse_mat trans_mult(const sparse_mat &, const sparse_mat &); template ITPP_EXPORT sparse_cmat trans_mult(const sparse_cmat &, const sparse_cmat &); template ITPP_EXPORT ivec trans_mult(const sparse_imat &, const ivec &); template ITPP_EXPORT vec trans_mult(const sparse_mat &, const vec &); template ITPP_EXPORT cvec trans_mult(const sparse_cmat &, const cvec &); template ITPP_EXPORT sparse_imat mult_trans(const sparse_imat &, const sparse_imat &); template ITPP_EXPORT sparse_mat mult_trans(const sparse_mat &, const sparse_mat &); template ITPP_EXPORT sparse_cmat mult_trans(const sparse_cmat &, const sparse_cmat &); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/smat.h000066400000000000000000000733121216575753400155230ustar00rootroot00000000000000/*! * \file * \brief Sparse Matrix Class Definitions * \author Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SMAT_H #define SMAT_H #include #include namespace itpp { // Declaration of class Vec template class Vec; // Declaration of class Mat template class Mat; // Declaration of class Sparse_Vec template class Sparse_Vec; // Declaration of class Sparse_Mat template class Sparse_Mat; // ------------------------ Sparse_Mat Friends ------------------------------------- //! m1+m2 where m1 and m2 are sparse matrices template Sparse_Mat operator+(const Sparse_Mat &m1, const Sparse_Mat &m2); //! c*m where c is a scalar and m is a sparse matrix template Sparse_Mat operator*(const T &c, const Sparse_Mat &m); //! m1*m2 where m1 and m2 are sparse matrices template Sparse_Mat operator*(const Sparse_Mat &m1, const Sparse_Mat &m2); //! m*v where m is a sparse matrix and v is a sparse vector template Sparse_Vec operator*(const Sparse_Mat &m, const Sparse_Vec &v); //! m*v where m is a sparse matrix and v is a full column vector template Vec operator*(const Sparse_Mat &m, const Vec &v); //! v'*m where m is a sparse matrix and v is a full column vector template Vec operator*(const Vec &v, const Sparse_Mat &m); //! m'*m where m is a sparse matrix template Mat trans_mult(const Sparse_Mat &m); //! m'*m where m is a sparse matrix template Sparse_Mat trans_mult_s(const Sparse_Mat &m); //! m1'*m2 where m1 and m2 are sparse matrices template Sparse_Mat trans_mult(const Sparse_Mat &m1, const Sparse_Mat &m2); //! m'*v where m is a sparse matrix and v is a full column vector template Vec trans_mult(const Sparse_Mat &m, const Vec &v); //! m1*m2' where m1 and m2 are sparse matrices template Sparse_Mat mult_trans(const Sparse_Mat &m1, const Sparse_Mat &m2); /*! \brief Templated Sparse Matrix Class \author Tony Ottosson and Tobias Ringstrom A sparse matrix is a matrix where most elements are zero. The maximum number of non-zero elements in each column is a parameter to the constructor. The implementation is based on representing all columns as sparse vectors. Thus, column access generally is much faster than row access. The elements in each vector are stored in random order, i.e. they are not sorted. */ template class Sparse_Mat { public: //! Default constructor Sparse_Mat(); /*! \brief Initiate an empty sparse matrix A Sparse_Mat consists of colums that have the type Sparse_Vec. The maximum number of non-zero elements is each column is denoted \c row_data_init. \param rows Number of rows in the matrix \param cols Number of columns in the matrix \param row_data_init The maximum number of non-zero elements in each column (default value is 200) */ Sparse_Mat(int rows, int cols, int row_data_init = 200); //! Initiate a new sparse matrix. The elements of \c m are copied into the new sparse matrix Sparse_Mat(const Sparse_Mat &m); //! Initiate a new sparse matrix from a dense matrix. The elements of \c m are copied into the new sparse matrix Sparse_Mat(const Mat &m); /*! \brief Initiate a new sparse matrix from a dense matrix. Elements of \c m larger than \c epsilon are copied into the new sparse matrix. \note If the type T is double complex, then the elements of \c m larger than \c abs(epsilon) are copied into the new sparse matrix. */ Sparse_Mat(const Mat &m, T epsilon); //! Destructor ~Sparse_Mat(); /*! \brief Set the size of the sparse matrix A Sparse_Mat consists of colums that have the type Sparse_Vec. The maximum number of non-zero elements is each column is denoted \c row_data_init, with default value =-1 indicating that the number of data elements is not changed. \param rows Number of rows in the matrix \param cols Number of columns in the matrix \param row_data_init The maximum number of non-zero elements in each column (default value -1 \c => allocated size for the data is not changed) */ void set_size(int rows, int cols, int row_data_init = -1); //! Returns the number of rows of the sparse matrix int rows() const { return n_rows; } //! Returns the number of columns of the sparse matrix int cols() const { return n_cols; } //! The number of non-zero elements in the sparse matrix int nnz(); //! Returns the density of the sparse matrix: (number of non-zero elements)/(total number of elements) double density(); //! Set the maximum number of non-zero elements in each column equal to the actual number of non-zero elements in each column void compact(); //! Returns a full, dense matrix in \c m void full(Mat &m) const; //! Returns a full, dense matrix Mat full() const; //! Returns element of row \c r and column \c c T operator()(int r, int c) const; //! Set element (\c r, \c c ) equal to \c v void set(int r, int c, T v); //! Set a new element with index (\c r, \c c ) equal to \c v void set_new(int r, int c, T v); //! Add the element in row \c r and column \c c with \c v void add_elem(const int r, const int c, const T v); //! Set the sparse matrix to the all zero matrix (removes all non-zero elements) void zeros(); //! Set the element in row \c r and column \c c to zero (i.e. clear that element if it contains a non-zero value) void zero_elem(const int r, const int c); //! Clear all non-zero elements of the sparse matrix void clear(); //! Clear the element in row \c r and column \c c (if it contains a non-zero value) void clear_elem(const int r, const int c); //! Set submatrix defined by rows r1,r2 and columns c1,c2 to matrix m void set_submatrix(int r1, int r2, int c1, int c2, const Mat &m); //! Set submatrix defined by upper-left element (\c r,\c c) and the size of matrix \c m to \c m void set_submatrix(int r, int c, const Mat& m); //! Returns the sub-matrix from rows \c r1 to \c r2 and columns \c c1 to \c c2 Sparse_Mat get_submatrix(int r1, int r2, int c1, int c2) const; //! Returns the sub-matrix from columns \c c1 to \c c2 (all rows) Sparse_Mat get_submatrix_cols(int c1, int c2) const; //! Returns column \c c of the Sparse_Mat in the Sparse_Vec \c v void get_col(int c, Sparse_Vec &v) const; //! Returns column \c c of the Sparse_Mat Sparse_Vec get_col(int c) const; //! Set column \c c of the Sparse_Mat void set_col(int c, const Sparse_Vec &v); /*! Transpose the sparse matrix, return the result in \c m Note: this function can be slow for large matrices. */ void transpose(Sparse_Mat &m) const; /*! Returns the transpose of the sparse matrix Note: this function can be slow for large matrices. */ Sparse_Mat transpose() const; /*! Returns the transpose of the sparse matrix Note: this function can be slow for large matrices. */ // Sparse_Mat T() const { return this->transpose(); }; //! Assign sparse matrix the value and dimensions of the sparse matrix \c m void operator=(const Sparse_Mat &m); //! Assign sparse matrix the value and dimensions of the dense matrix \c m void operator=(const Mat &m); //! Returns the sign inverse of all elements in the sparse matrix Sparse_Mat operator-() const; //! Compare two sparse matricies. False if wrong sizes or different values bool operator==(const Sparse_Mat &m) const; //! Add sparse matrix \c v to all non-zero elements of the sparse matrix void operator+=(const Sparse_Mat &v); //! Add matrix \c v to all non-zero elements of the sparse matrix void operator+=(const Mat &v); //! Subtract sparse matrix \c v from all non-zero elements of the sparse matrix void operator-=(const Sparse_Mat &v); //! Subtract matrix \c v from all non-zero elements of the sparse matrix void operator-=(const Mat &v); //! Multiply all non-zero elements of the sparse matrix with the scalar \c v void operator*=(const T &v); //! Divide all non-zero elements of the sparse matrix with the scalar \c v void operator/=(const T &v); //! Addition m1+m2 where m1 and m2 are sparse matrices friend Sparse_Mat operator+<>(const Sparse_Mat &m1, const Sparse_Mat &m2); //! Multiplication c*m where c is a scalar and m is a sparse matrix friend Sparse_Mat operator*<>(const T &c, const Sparse_Mat &m); //! Multiplication m1*m2 where m1 and m2 are sparse matrices friend Sparse_Mat operator*<>(const Sparse_Mat &m1, const Sparse_Mat &m2); //! Multiplication m*v where m is a sparse matrix and v is a sparse vector friend Sparse_Vec operator*<>(const Sparse_Mat &m, const Sparse_Vec &v); //! Multiplication m*v where m is a sparse matrix and v is a full column vector friend Vec operator*<>(const Sparse_Mat &m, const Vec &v); //! Multiplication v'*m where m is a sparse matrix and v is a full column vector friend Vec operator*<>(const Vec &v, const Sparse_Mat &m); //! Multiplication m'*m where m is a sparse matrix. Returns a full, dense matrix friend Mat trans_mult <>(const Sparse_Mat &m); //! Multiplication m'*m where m is a sparse matrix, Returns a sparse matrix friend Sparse_Mat trans_mult_s <>(const Sparse_Mat &m); //! Multiplication m1'*m2 where m1 and m2 are sparse matrices friend Sparse_Mat trans_mult <>(const Sparse_Mat &m1, const Sparse_Mat &m2); //! Multiplication m'*v where m is a sparse matrix and v is a full column vector friend Vec trans_mult <>(const Sparse_Mat &m, const Vec &v); //! Multiplication m1*m2' where m1 and m2 are sparse matrices friend Sparse_Mat mult_trans <>(const Sparse_Mat &m1, const Sparse_Mat &m2); private: void init(); void alloc_empty(); void alloc(int row_data_size = 200); void free(); int n_rows, n_cols; Sparse_Vec *col; }; /*! \relates Sparse_Mat \brief Sparse integer matrix */ typedef Sparse_Mat sparse_imat; /*! \relates Sparse_Mat \brief Sparse double matrix */ typedef Sparse_Mat sparse_mat; /*! \relates Sparse_Mat \brief Sparse complex matrix */ typedef Sparse_Mat > sparse_cmat; //---------------------- Implementation starts here -------------------------------- template void Sparse_Mat::init() { n_rows = 0; n_cols = 0; col = 0; } template void Sparse_Mat::alloc_empty() { if (n_cols == 0) col = 0; else col = new Sparse_Vec[n_cols]; } template void Sparse_Mat::alloc(int row_data_init) { if (n_cols == 0) col = 0; else col = new Sparse_Vec[n_cols]; for (int c = 0; c < n_cols; c++) col[c].set_size(n_rows, row_data_init); } template void Sparse_Mat::free() { delete [] col; col = 0; } template Sparse_Mat::Sparse_Mat() { init(); } template Sparse_Mat::Sparse_Mat(int rows, int cols, int row_data_init) { init(); n_rows = rows; n_cols = cols; alloc(row_data_init); } template Sparse_Mat::Sparse_Mat(const Sparse_Mat &m) { init(); n_rows = m.n_rows; n_cols = m.n_cols; alloc_empty(); for (int c = 0; c < n_cols; c++) col[c] = m.col[c]; } template Sparse_Mat::Sparse_Mat(const Mat &m) { init(); n_rows = m.rows(); n_cols = m.cols(); alloc(); for (int c = 0; c < n_cols; c++) { for (int r = 0; r < n_rows; r++) { //if (abs(m(r,c)) != T(0)) if (m(r, c) != T(0)) col[c].set_new(r, m(r, c)); } col[c].compact(); } } template Sparse_Mat::Sparse_Mat(const Mat &m, T epsilon) { init(); n_rows = m.rows(); n_cols = m.cols(); alloc(); for (int c = 0; c < n_cols; c++) { for (int r = 0; r < n_rows; r++) { if (std::abs(m(r, c)) > std::abs(epsilon)) col[c].set_new(r, m(r, c)); } col[c].compact(); } } template Sparse_Mat::~Sparse_Mat() { free(); } template void Sparse_Mat::set_size(int rows, int cols, int row_data_init) { n_rows = rows; //Allocate new memory for data if the number of columns has changed or if row_data_init != -1 if (cols != n_cols || row_data_init != -1) { n_cols = cols; free(); alloc(row_data_init); } } template int Sparse_Mat::nnz() { int n = 0; for (int c = 0; c < n_cols; c++) n += col[c].nnz(); return n; } template double Sparse_Mat::density() { //return static_cast(nnz())/(n_rows*n_cols); return double(nnz()) / (n_rows*n_cols); } template void Sparse_Mat::compact() { for (int c = 0; c < n_cols; c++) col[c].compact(); } template void Sparse_Mat::full(Mat &m) const { m.set_size(n_rows, n_cols); m = T(0); for (int c = 0; c < n_cols; c++) { for (int p = 0; p < col[c].nnz(); p++) m(col[c].get_nz_index(p), c) = col[c].get_nz_data(p); } } template Mat Sparse_Mat::full() const { Mat r(n_rows, n_cols); full(r); return r; } template T Sparse_Mat::operator()(int r, int c) const { it_assert_debug(r >= 0 && r= 0 && c < n_cols, "Incorrect input indexes given"); return col[c](r); } template void Sparse_Mat::set(int r, int c, T v) { it_assert_debug(r >= 0 && r= 0 && c < n_cols, "Incorrect input indexes given"); col[c].set(r, v); } template void Sparse_Mat::set_new(int r, int c, T v) { it_assert_debug(r >= 0 && r= 0 && c < n_cols, "Incorrect input indexes given"); col[c].set_new(r, v); } template void Sparse_Mat::add_elem(int r, int c, T v) { it_assert_debug(r >= 0 && r= 0 && c < n_cols, "Incorrect input indexes given"); col[c].add_elem(r, v); } template void Sparse_Mat::zeros() { for (int c = 0; c < n_cols; c++) col[c].zeros(); } template void Sparse_Mat::zero_elem(const int r, const int c) { it_assert_debug(r >= 0 && r= 0 && c < n_cols, "Incorrect input indexes given"); col[c].zero_elem(r); } template void Sparse_Mat::clear() { for (int c = 0; c < n_cols; c++) col[c].clear(); } template void Sparse_Mat::clear_elem(const int r, const int c) { it_assert_debug(r >= 0 && r= 0 && c < n_cols, "Incorrect input indexes given"); col[c].clear_elem(r); } template void Sparse_Mat::set_submatrix(int r1, int r2, int c1, int c2, const Mat& m) { if (r1 == -1) r1 = n_rows - 1; if (r2 == -1) r2 = n_rows - 1; if (c1 == -1) c1 = n_cols - 1; if (c2 == -1) c2 = n_cols - 1; it_assert_debug(r1 >= 0 && r2 >= 0 && r1 < n_rows && r2 < n_rows && c1 >= 0 && c2 >= 0 && c1 < n_cols && c2 < n_cols, "Sparse_Mat::set_submatrix(): index out of range"); it_assert_debug(r2 >= r1 && c2 >= c1, "Sparse_Mat::set_submatrix: r2::set_submatrix(): sizes don't match"); for (int i = 0 ; i < m.rows() ; i++) { for (int j = 0 ; j < m.cols() ; j++) { set(r1 + i, c1 + j, m(i, j)); } } } template void Sparse_Mat::set_submatrix(int r, int c, const Mat& m) { it_assert_debug(r >= 0 && r + m.rows() <= n_rows && c >= 0 && c + m.cols() <= n_cols, "Sparse_Mat::set_submatrix(): index out of range"); for (int i = 0 ; i < m.rows() ; i++) { for (int j = 0 ; j < m.cols() ; j++) { set(r + i, c + j, m(i, j)); } } } template Sparse_Mat Sparse_Mat::get_submatrix(int r1, int r2, int c1, int c2) const { it_assert_debug(r1 <= r2 && r1 >= 0 && r1 < n_rows && c1 <= c2 && c1 >= 0 && c1 < n_cols, "Sparse_Mat::get_submatrix(): illegal input variables"); Sparse_Mat r(r2 - r1 + 1, c2 - c1 + 1); for (int c = c1; c <= c2; c++) r.col[c-c1] = col[c].get_subvector(r1, r2); r.compact(); return r; } template Sparse_Mat Sparse_Mat::get_submatrix_cols(int c1, int c2) const { it_assert_debug(c1 <= c2 && c1 >= 0 && c1 < n_cols, "Sparse_Mat::get_submatrix_cols()"); Sparse_Mat r(n_rows, c2 - c1 + 1, 0); for (int c = c1; c <= c2; c++) r.col[c-c1] = col[c]; r.compact(); return r; } template void Sparse_Mat::get_col(int c, Sparse_Vec &v) const { it_assert(c >= 0 && c < n_cols, "Sparse_Mat::get_col()"); v = col[c]; } template Sparse_Vec Sparse_Mat::get_col(int c) const { it_assert(c >= 0 && c < n_cols, "Sparse_Mat::get_col()"); return col[c]; } template void Sparse_Mat::set_col(int c, const Sparse_Vec &v) { it_assert(c >= 0 && c < n_cols, "Sparse_Mat::set_col()"); col[c] = v; } template void Sparse_Mat::transpose(Sparse_Mat &m) const { m.set_size(n_cols, n_rows); for (int c = 0; c < n_cols; c++) { for (int p = 0; p < col[c].nnz(); p++) m.col[col[c].get_nz_index(p)].set_new(c, col[c].get_nz_data(p)); } } template Sparse_Mat Sparse_Mat::transpose() const { Sparse_Mat m; transpose(m); return m; } template void Sparse_Mat::operator=(const Sparse_Mat &m) { free(); n_rows = m.n_rows; n_cols = m.n_cols; alloc_empty(); for (int c = 0; c < n_cols; c++) col[c] = m.col[c]; } template void Sparse_Mat::operator=(const Mat &m) { free(); n_rows = m.rows(); n_cols = m.cols(); alloc(); for (int c = 0; c < n_cols; c++) { for (int r = 0; r < n_rows; r++) { if (m(r, c) != T(0)) col[c].set_new(r, m(r, c)); } col[c].compact(); } } template Sparse_Mat Sparse_Mat::operator-() const { Sparse_Mat r(n_rows, n_cols, 0); for (int c = 0; c < n_cols; c++) { r.col[c].resize_data(col[c].nnz()); for (int p = 0; p < col[c].nnz(); p++) r.col[c].set_new(col[c].get_nz_index(p), -col[c].get_nz_data(p)); } return r; } template bool Sparse_Mat::operator==(const Sparse_Mat &m) const { if (n_rows != m.n_rows || n_cols != m.n_cols) return false; for (int c = 0; c < n_cols; c++) { if (!(col[c] == m.col[c])) return false; } // If they passed all tests, they must be equal return true; } template void Sparse_Mat::operator+=(const Sparse_Mat &m) { it_assert_debug(m.rows() == n_rows && m.cols() == n_cols, "Addition of unequal sized matrices is not allowed"); Sparse_Vec v; for (int c = 0; c < n_cols; c++) { m.get_col(c, v); col[c] += v; } } template void Sparse_Mat::operator+=(const Mat &m) { it_assert_debug(m.rows() == n_rows && m.cols() == n_cols, "Addition of unequal sized matrices is not allowed"); for (int c = 0; c < n_cols; c++) col[c] += (m.get_col(c)); } template void Sparse_Mat::operator-=(const Sparse_Mat &m) { it_assert_debug(m.rows() == n_rows && m.cols() == n_cols, "Subtraction of unequal sized matrices is not allowed"); Sparse_Vec v; for (int c = 0; c < n_cols; c++) { m.get_col(c, v); col[c] -= v; } } template void Sparse_Mat::operator-=(const Mat &m) { it_assert_debug(m.rows() == n_rows && m.cols() == n_cols, "Subtraction of unequal sized matrices is not allowed"); for (int c = 0; c < n_cols; c++) col[c] -= (m.get_col(c)); } template void Sparse_Mat::operator*=(const T &m) { for (int c = 0; c < n_cols; c++) col[c] *= m; } template void Sparse_Mat::operator/=(const T &m) { for (int c = 0; c < n_cols; c++) col[c] /= m; } template Sparse_Mat operator+(const Sparse_Mat &m1, const Sparse_Mat &m2) { it_assert_debug(m1.n_cols == m2.n_cols && m1.n_rows == m2.n_rows , "Sparse_Mat + Sparse_Mat"); Sparse_Mat m(m1.n_rows, m1.n_cols, 0); for (int c = 0; c < m.n_cols; c++) m.col[c] = m1.col[c] + m2.col[c]; return m; } // This function added by EGL, May'05 template Sparse_Mat operator*(const T &c, const Sparse_Mat &m) { int i, j; Sparse_Mat ret(m.n_rows, m.n_cols); for (j = 0; j < m.n_cols; j++) { for (i = 0; i < m.col[j].nnz(); i++) { T x = c * m.col[j].get_nz_data(i); int k = m.col[j].get_nz_index(i); ret.set_new(k, j, x); } } return ret; } template Sparse_Mat operator*(const Sparse_Mat &m1, const Sparse_Mat &m2) { it_assert_debug(m1.n_cols == m2.n_rows, "Sparse_Mat * Sparse_Mat"); Sparse_Mat ret(m1.n_rows, m2.n_cols); for (int c = 0; c < m2.n_cols; c++) { Sparse_Vec &m2colc = m2.col[c]; for (int p2 = 0; p2 < m2colc.nnz(); p2++) { Sparse_Vec &mcol = m1.col[m2colc.get_nz_index(p2)]; T x = m2colc.get_nz_data(p2); for (int p1 = 0; p1 < mcol.nnz(); p1++) { int r = mcol.get_nz_index(p1); T inc = mcol.get_nz_data(p1) * x; ret.col[c].add_elem(r, inc); } } } // old code /* for (int c=0; c &mcol = m1.col[m2.col[c].get_nz_index(p2)]; */ /* for (int p1=0; p1 */ /* Sparse_Mat operator*(const Sparse_Mat &m1, const Sparse_Mat &m2) */ /* { */ /* it_assert_debug(m1.n_cols == m2.n_rows, "Sparse_Mat * Sparse_Mat"); */ /* Sparse_Mat ret(m1.n_rows, m2.n_cols); */ /* ivec occupied_by(ret.n_rows), pos(ret.n_rows); */ /* for (int rp=0; rp &m2col = m2.col[c]; */ /* for (int p2=0; p2 &m1col = m1.col[m2col.get_nz_index(p2)]; */ /* for (int p1=0; p1 Sparse_Vec operator*(const Sparse_Mat &m, const Sparse_Vec &v) { it_assert_debug(m.n_cols == v.size(), "Sparse_Mat * Sparse_Vec"); Sparse_Vec ret(m.n_rows); /* The two lines below added because the input parameter "v" is declared const, but the some functions (e.g., nnz()) change the vector... Is there a better workaround? */ Sparse_Vec vv = v; for (int p2 = 0; p2 < vv.nnz(); p2++) { Sparse_Vec &mcol = m.col[vv.get_nz_index(p2)]; T x = vv.get_nz_data(p2); for (int p1 = 0; p1 < mcol.nnz(); p1++) { int r = mcol.get_nz_index(p1); T inc = mcol.get_nz_data(p1) * x; ret.add_elem(r, inc); } } ret.compact(); return ret; } template Vec operator*(const Sparse_Mat &m, const Vec &v) { it_assert_debug(m.n_cols == v.size(), "Sparse_Mat * Vec"); Vec r(m.n_rows); r.clear(); for (int c = 0; c < m.n_cols; c++) { for (int p = 0; p < m.col[c].nnz(); p++) r(m.col[c].get_nz_index(p)) += m.col[c].get_nz_data(p) * v(c); } return r; } template Vec operator*(const Vec &v, const Sparse_Mat &m) { it_assert_debug(v.size() == m.n_rows, "Vec * Sparse_Mat"); Vec r(m.n_cols); r.clear(); for (int c = 0; c < m.n_cols; c++) r[c] = v * m.col[c]; return r; } template Mat trans_mult(const Sparse_Mat &m) { Mat ret(m.n_cols, m.n_cols); Vec col; for (int c = 0; c < ret.cols(); c++) { m.col[c].full(col); for (int r = 0; r < c; r++) { T tmp = m.col[r] * col; ret(r, c) = tmp; ret(c, r) = tmp; } ret(c, c) = m.col[c].sqr(); } return ret; } template Sparse_Mat trans_mult_s(const Sparse_Mat &m) { Sparse_Mat ret(m.n_cols, m.n_cols); Vec col; T tmp; for (int c = 0; c < ret.n_cols; c++) { m.col[c].full(col); for (int r = 0; r < c; r++) { tmp = m.col[r] * col; if (tmp != T(0)) { ret.col[c].set_new(r, tmp); ret.col[r].set_new(c, tmp); } } tmp = m.col[c].sqr(); if (tmp != T(0)) ret.col[c].set_new(c, tmp); } return ret; } template Sparse_Mat trans_mult(const Sparse_Mat &m1, const Sparse_Mat &m2) { it_assert_debug(m1.n_rows == m2.n_rows, "trans_mult()"); Sparse_Mat ret(m1.n_cols, m2.n_cols); Vec col; for (int c = 0; c < ret.n_cols; c++) { m2.col[c].full(col); for (int r = 0; r < ret.n_rows; r++) ret.col[c].set_new(r, m1.col[r] * col); } return ret; } template Vec trans_mult(const Sparse_Mat &m, const Vec &v) { Vec r(m.n_cols); for (int c = 0; c < m.n_cols; c++) r(c) = m.col[c] * v; return r; } template Sparse_Mat mult_trans(const Sparse_Mat &m1, const Sparse_Mat &m2) { return trans_mult(m1.transpose(), m2.transpose()); } //! Convert a dense matrix \c m into its sparse representation template inline Sparse_Mat sparse(const Mat &m, T epsilon) { Sparse_Mat s(m, epsilon); return s; } //! Convert a sparse matrix \c s into its dense representation template inline Mat full(const Sparse_Mat &s) { Mat m; s.full(m); return m; } //! Transpose a sparse matrix \c s template inline Sparse_Mat transpose(const Sparse_Mat &s) { Sparse_Mat m; s.transpose(m); return m; } //! \cond // --------------------------------------------------------------------- // Instantiations // --------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sparse_Mat; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sparse_Mat; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sparse_Mat >; ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_imat operator+(const sparse_imat &, const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_mat operator+(const sparse_mat &, const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cmat operator+(const sparse_cmat &, const sparse_cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_imat operator*(const sparse_imat &, const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_mat operator*(const sparse_mat &, const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cmat operator*(const sparse_cmat &, const sparse_cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator*(const ivec &, const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator*(const vec &, const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator*(const cvec &, const sparse_cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator*(const sparse_imat &, const ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator*(const sparse_mat &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator*(const sparse_cmat &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat trans_mult(const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat trans_mult(const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat trans_mult(const sparse_cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_imat trans_mult_s(const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_mat trans_mult_s(const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cmat trans_mult_s(const sparse_cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_imat trans_mult(const sparse_imat &, const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_mat trans_mult(const sparse_mat &, const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cmat trans_mult(const sparse_cmat &, const sparse_cmat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec trans_mult(const sparse_imat &, const ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec trans_mult(const sparse_mat &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec trans_mult(const sparse_cmat &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_imat mult_trans(const sparse_imat &, const sparse_imat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_mat mult_trans(const sparse_mat &, const sparse_mat &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cmat mult_trans(const sparse_cmat &, const sparse_cmat &); //! \endcond } // namespace itpp #endif // #ifndef SMAT_H itpp-4.3.1/itpp/base/sort.h000066400000000000000000000374541216575753400155550ustar00rootroot00000000000000/*! * \file * \brief Sorting functions * \author Tony Ottosson, Mark Dobossy and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SORT_H #define SORT_H #include #include #include namespace itpp { /*! * \brief Sorting algorithms that can be used in a \a Sort class * * - Introsort (the default and the fastest method in most cases) * - Quicksort * - Heapsort * - Insertion Sort (suitable for very short vectors) */ enum SORTING_METHOD { INTROSORT = 0, QUICKSORT = 1, HEAPSORT = 2, INSERTSORT = 3 }; /*! * \brief Class for sorting of vectors * * A class which takes a vector, and sorts its values descending. There * are two types of sort: a normal sort (accessed via the Sort::sort() * function) which sorts the vector passed in the argument, and an index * sort (accessed via the Sort::sort_index() function) which leaves the * passed vector intact, but returns an index vector describing the sorted * order. * * The Sort class has four sorting methods implemented: * - Introsort [1,2]: It is a sorting algorithm developed by David Musser. * I starts as a quicksort, but switches to a heapsort in cases where * the recursion becomes too deep. Additionally, when sub vectors become * smaller than 16 elements, it switches to an insertion sort. Introsort * has a worst-case of \f$\Theta(n\log n)\f$ comparisons, bu has the * efficiency of the quick sort algorithm in cases where the data is * well conditioned for quicksort. * - Quicksort [3]: It is a comparison sorting algorithm that has an * average complexity of \f$\Theta(n\log n)\f$ comparisons. For most * data sets, the quicksort will be significantly more efficient than * this average. However for data sets not well suited to it, quicksort * may require as many as \f$\Theta(n^2)\f$ comparisons. Example of such * ill-suited data sets are those which are nearly in order, and data * sets with multiple elements of the same value. * - Heapsort [4]: It is a comparison sorting algorithm. While it is * usually seen to be slower than quicksort routines, its worst-case * requires only \f$\Theta(n\log n)\f$ comparisons. This makes it an * ideal quicksort replacement for data sets that that are * ill-conditioned for quicksorting. * - Insertion sort [5]: An insertion sort is a simple comparison sort, * which is widely considered to be one of the most efficient algorithms * for very small data sets (10-20 elements). * http://en.wikipedia.org/wiki/Insertion_sort * * References: * - [1] http://en.wikipedia.org/wiki/Introsort * - [2] http://www.cs.rpi.edu/~musser/gp/introsort.ps * - [3] http://en.wikipedia.org/wiki/Quicksort * - [4] http://en.wikipedia.org/wiki/Heapsort * - [5] http://en.wikipedia.org/wiki/Insertion_sort * * \author Tony Ottosson (Quicksort), Mark Dobossy (Introsort, Heapsort * and Insertion Sort) and Adam Piatyszek (Sort class design, code * clean-up) */ template class Sort { public: //! Constructor that sets Intro Sort method by default Sort(SORTING_METHOD method = INTROSORT): sort_method(method) {} //! Set sorting method void set_method(SORTING_METHOD method) { sort_method = method; } //! Get current sorting method SORTING_METHOD get_method() const { return sort_method; } /*! * \brief Sorting function of a subset of a vector \a data * * \param low Start index of a subvector to be sorted * \param high End index of a subvector to be sorted * \param data Data vector, in which a part of it is to be sorted */ void sort(int low, int high, Vec &data); /*! * \brief Sorting function that returns a sorted index vector * * \param low Start index of a subvector to be sorted * \param high End index of a subvector to be sorted * \param data Data vector, in which a part of it is to be sorted */ ivec sort_index(int low, int high, const Vec &data); /*! * \brief Introsort function of a subset of a vector \c data * * \param low Start index of a subvector to be sorted * \param high End index of a subvector to be sorted * \param max_depth Maximum recursion depth before switching to heap sort * recommended value: log2 of the length of the data vector * \param data Data vector, in which a part of it is to be sorted * * \note An introsort is not a stable sort (i.e. it may not maintain * the relative order of elements with equal value.) * \note This function uses recurrence. */ void intro_sort(int low, int high, int max_depth, Vec &data); /*! * \brief Introsort function, which returns a sorted index vector * * \param low Start index of a subvector to be sorted * \param high End index of a subvector to be sorted * \param max_depth Maximum recursion depth before switching to heap sort * recommended value: log2 of the length of the data vector * \param data Data vector, in which a part of it is to be sorted * * \note An Introsort is not a stable sort (i.e. it may not maintain * the relative order of elements with equal value.) * \note This function uses recurrence. */ ivec intro_sort_index(int low, int high, int max_depth, const Vec &data); private: SORTING_METHOD sort_method; void IntroSort(int low, int high, int max_depth, T data[]); void IntroSort_Index(int low, int high, int max_depth, int indexlist[], const T data[]); void QuickSort(int low, int high, T data[]); void QuickSort_Index(int low, int high, int indexlist[], const T data[]); void HeapSort(int low, int high, T data[]); void HeapSort_Index(int low, int high, int indexlist[], const T data[]); void InsertSort(int low, int high, T data[]); void InsertSort_Index(int low, int high, int indexlist[], const T data[]); }; /*! * \relates Vec * \brief Sort the \a data vector in increasing order * * \param data Vector to be sorted * \param method Sorting method: INTROSORT (default), QUICKSORT, HEAPSORT * or INSERTSORT */ template void sort(Vec &data, SORTING_METHOD method = INTROSORT) { Sort s(method); s.sort(0, data.size() - 1, data); } /*! * \relates Vec * \brief Return an index vector corresponding to a sorted vector \a data * in increasing order * * \param data Vector for which to return a sorted index vector * \param method Sorting method: INTROSORT (default), QUICKSORT, HEAPSORT * or INSERTSORT */ template ivec sort_index(const Vec &data, SORTING_METHOD method = INTROSORT) { Sort s(method); return s.sort_index(0, data.size() - 1, data); } // ---------------------------------------------------------------------- // Public functions for various sorting methods // ---------------------------------------------------------------------- template void Sort::sort(int low, int high, Vec &data) { int N = data.size(); // Nothing to sort if data vector has only one or zero elements if (N < 2) return; it_assert((low >= 0) && (high > low) && (high < N), "Sort::sort(): " "low or high out of bounds"); switch (sort_method) { case INTROSORT: IntroSort(low, high, levels2bits(N), data._data()); break; case QUICKSORT: QuickSort(low, high, data._data()); break; case HEAPSORT: HeapSort(low, high, data._data()); break; case INSERTSORT: InsertSort(low, high, data._data()); break; default: it_error("Sort::sort(): Unknown sorting method"); } } template ivec Sort::sort_index(int low, int high, const Vec &data) { int N = data.size(); // Nothing to sort if data vector has only one or zero elements if (N == 1) return ivec("0"); else if (N == 0) return ivec(); it_assert((low >= 0) && (high > low) && (high < N), "Sort::sort(): " "low or high out of bounds"); ivec indexlist(N); for (int i = 0; i < N; ++i) { indexlist(i) = i; } switch (sort_method) { case INTROSORT: IntroSort_Index(low, high, levels2bits(N), indexlist._data(), data._data()); break; case QUICKSORT: QuickSort_Index(low, high, indexlist._data(), data._data()); break; case HEAPSORT: HeapSort_Index(low, high, indexlist._data(), data._data()); break; case INSERTSORT: InsertSort_Index(low, high, indexlist._data(), data._data()); break; default: it_error("Sort::sort_index(): Unknown sorting method"); } return indexlist; } // INTRO SORT template void Sort::intro_sort(int low, int high, int max_depth, Vec &data) { it_assert((low >= 0) && (high > low) && (high < data.size()), "Sort::sort(): low or high out of bounds"); IntroSort(low, high, max_depth, data._data()); } // INTRO SORT INDEX template ivec Sort::intro_sort_index(int low, int high, int max_depth, const Vec &data) { int N = data.size(); it_assert((low >= 0) && (high > low) && (high < N), "Sort::sort(): low or high out of bounds"); ivec indexlist(N); for (int i = 0; i < N; ++i) { indexlist(i) = i; } IntroSort_Index(low, high, max_depth, indexlist._data(), data._data()); return indexlist; } // ---------------------------------------------------------------------- // Private functions for sorting methods // ---------------------------------------------------------------------- template void Sort::IntroSort(int low, int high, int max_depth, T data[]) { if (high - low > 16) { max_depth--; if (max_depth == 0) { HeapSort(low, high, data); return; } if (high > low) { T a = data[low]; int plow = low; int phigh = high; T test = data[phigh]; while (plow < phigh) { if (test < a) { data[plow] = test; plow++; test = data[plow]; } else { data[phigh] = test; phigh--; test = data[phigh]; } } data[plow] = a; IntroSort(low, plow - 1, max_depth, data); IntroSort(plow + 1, high, max_depth, data); return; } } else { InsertSort(low, high, data); return; } } template void Sort::IntroSort_Index(int low, int high, int max_depth, int indexlist[], const T data[]) { if (high - low > 16) { max_depth--; if (max_depth == 0) { HeapSort_Index(low, high, indexlist, data); return; } if (high > low) { int aindex = indexlist[low]; T a = data[aindex]; int plow = low; int phigh = high; int testindex = indexlist[phigh]; T test = data[testindex]; while (plow < phigh) { if (test < a) { indexlist[plow] = testindex; plow++; testindex = indexlist[plow]; test = data[testindex]; } else { indexlist[phigh] = testindex; phigh--; testindex = indexlist[phigh]; test = data[testindex]; } } indexlist[plow] = aindex; IntroSort_Index(low, plow - 1, max_depth, indexlist, data); IntroSort_Index(plow + 1, high, max_depth, indexlist, data); } } else { InsertSort_Index(low, high, indexlist, data); return; } } template void Sort::QuickSort(int low, int high, T data[]) { if (high > low) { T a = data[low]; int plow = low; int phigh = high; T test = data[phigh]; while (plow < phigh) { if (test < a) { data[plow] = test; plow++; test = data[plow]; } else { data[phigh] = test; phigh--; test = data[phigh]; } } data[plow] = a; QuickSort(low, plow - 1, data); QuickSort(plow + 1, high, data); } } template void Sort::QuickSort_Index(int low, int high, int indexlist[], const T data[]) { if (high > low) { int aindex = indexlist[low]; T a = data[aindex]; int plow = low; int phigh = high; int testindex = indexlist[phigh]; T test = data[testindex]; while (plow < phigh) { if (test < a) { indexlist[plow] = testindex; plow++; testindex = indexlist[plow]; test = data[testindex]; } else { indexlist[phigh] = testindex; phigh--; testindex = indexlist[phigh]; test = data[testindex]; } } indexlist[plow] = aindex; QuickSort_Index(low, plow - 1, indexlist, data); QuickSort_Index(plow + 1, high, indexlist, data); } } template void Sort::HeapSort(int low, int high, T data[]) { int size = (high + 1) - low; int i = size / 2; T temp; while (1) { if (i > 0) temp = data[--i + low]; else { if (size-- == 0) break; temp = data[size + low]; data[size + low] = data[low]; } int parent = i; int child = i * 2 + 1; while (child < size) { if (child + 1 < size && data[child + 1 + low] > data[child + low]) child++; if (data[child + low] > temp) { data[parent + low] = data[child + low]; parent = child; child = parent * 2 + 1; } else break; } data[parent + low] = temp; } } template void Sort::HeapSort_Index(int low, int high, int indexlist[], const T data[]) { int size = (high + 1) - low; int i = size / 2; while (1) { T tempValue; int tempIndex; if (i > 0) { i--; tempValue = data[indexlist[i + low]]; tempIndex = indexlist[i + low]; } else { if (size-- == 0) break; tempValue = data[indexlist[size + low]]; tempIndex = indexlist[size + low]; indexlist[size+low] = indexlist[low]; } int parent = i; int child = i * 2 + 1; while (child < size) { if ((child + 1 < size) && data[indexlist[child + 1 + low]] > data[indexlist[child + low]]) child++; if (data[indexlist[child + low]] > tempValue) { indexlist[parent + low] = indexlist[child + low]; parent = child; child = parent * 2 + 1; } else break; } indexlist[parent + low] = tempIndex; } } template void Sort::InsertSort(int low, int high, T data[]) { for (int i = low + 1; i <= high; i++) { T value = data[i]; int j; for (j = i - 1; j >= low && data[j] > value; j--) { data[j + 1] = data[j]; } data[j + 1] = value; } } template void Sort::InsertSort_Index(int low, int high, int indexlist[], const T data[]) { for (int i = low + 1; i <= high; i++) { T value = data[indexlist[i]]; int tempIndex = indexlist[i]; int j; for (j = i - 1; j >= low && data[indexlist[j]] > value; j--) { indexlist[j + 1] = indexlist[j]; } indexlist[j + 1] = tempIndex; } } } // namespace itpp #endif // #ifndef SORT_H itpp-4.3.1/itpp/base/sources.mk000066400000000000000000000036421216575753400164210ustar00rootroot00000000000000noinst_h_base_sources = \ $(top_srcdir)/itpp/base/blas.h \ $(top_srcdir)/itpp/base/itcompat.h h_base_sources = \ $(top_srcdir)/itpp/base/array.h \ $(top_srcdir)/itpp/base/bessel.h \ $(top_srcdir)/itpp/base/binary.h \ $(top_srcdir)/itpp/base/binfile.h \ $(top_srcdir)/itpp/base/circular_buffer.h \ $(top_srcdir)/itpp/base/converters.h \ $(top_srcdir)/itpp/base/copy_vector.h \ $(top_srcdir)/itpp/base/factory.h \ $(top_srcdir)/itpp/base/fastmath.h \ $(top_srcdir)/itpp/base/gf2mat.h \ $(top_srcdir)/itpp/base/help_functions.h \ $(top_srcdir)/itpp/base/itassert.h \ $(top_srcdir)/itpp/base/itfile.h \ $(top_srcdir)/itpp/base/ittypes.h \ $(top_srcdir)/itpp/base/matfunc.h \ $(top_srcdir)/itpp/base/mat.h \ $(top_srcdir)/itpp/base/operators.h \ $(top_srcdir)/itpp/base/parser.h \ $(top_srcdir)/itpp/base/random.h \ $(top_srcdir)/itpp/base/random_dsfmt.h \ $(top_srcdir)/itpp/base/smat.h \ $(top_srcdir)/itpp/base/sort.h \ $(top_srcdir)/itpp/base/specmat.h \ $(top_srcdir)/itpp/base/stack.h \ $(top_srcdir)/itpp/base/svec.h \ $(top_srcdir)/itpp/base/timing.h \ $(top_srcdir)/itpp/base/vec.h cpp_base_sources = \ $(top_srcdir)/itpp/base/bessel.cpp \ $(top_srcdir)/itpp/base/binary.cpp \ $(top_srcdir)/itpp/base/binfile.cpp \ $(top_srcdir)/itpp/base/converters.cpp \ $(top_srcdir)/itpp/base/copy_vector.cpp \ $(top_srcdir)/itpp/base/fastmath.cpp \ $(top_srcdir)/itpp/base/gf2mat.cpp \ $(top_srcdir)/itpp/base/help_functions.cpp \ $(top_srcdir)/itpp/base/itassert.cpp \ $(top_srcdir)/itpp/base/itcompat.cpp \ $(top_srcdir)/itpp/base/itfile.cpp \ $(top_srcdir)/itpp/base/mat.cpp \ $(top_srcdir)/itpp/base/matfunc.cpp \ $(top_srcdir)/itpp/base/operators.cpp \ $(top_srcdir)/itpp/base/parser.cpp \ $(top_srcdir)/itpp/base/random.cpp \ $(top_srcdir)/itpp/base/smat.cpp \ $(top_srcdir)/itpp/base/specmat.cpp \ $(top_srcdir)/itpp/base/svec.cpp \ $(top_srcdir)/itpp/base/timing.cpp \ $(top_srcdir)/itpp/base/vec.cpp itpp-4.3.1/itpp/base/specmat.cpp000066400000000000000000000221051216575753400165400ustar00rootroot00000000000000/*! * \file * \brief Implementation of special vectors and matrices * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger, Adam Piatyszek * and Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include namespace itpp { ivec find(const bvec &invector) { it_assert(invector.size() > 0, "find(): vector cannot be empty"); ivec temp(invector.size()); int pos = 0; for (int i = 0;i < invector.size();i++) { if (invector(i) == bin(1)) { temp(pos) = i; pos++; } } temp.set_size(pos, true); return temp; } //! \cond #define CREATE_SET_FUNS(typef,typem,name,value) \ typef name(int size) \ { \ typef t(size); \ t = value; \ return t; \ } \ \ typem name(int rows, int cols) \ { \ typem t(rows, cols); \ t = value; \ return t; \ } #define CREATE_EYE_FUN(type,name,zero,one) \ type name(int size) { \ type t(size,size); \ t = zero; \ for (int i=0; i(1.0)) CREATE_SET_FUNS(vec, mat, zeros, 0.0) CREATE_SET_FUNS(bvec, bmat, zeros_b, bin(0)) CREATE_SET_FUNS(ivec, imat, zeros_i, 0) CREATE_SET_FUNS(cvec, cmat, zeros_c, std::complex(0.0)) CREATE_EYE_FUN(mat, eye, 0.0, 1.0) CREATE_EYE_FUN(bmat, eye_b, bin(0), bin(1)) CREATE_EYE_FUN(imat, eye_i, 0, 1) CREATE_EYE_FUN(cmat, eye_c, std::complex(0.0), std::complex(1.0)) //! \endcond vec impulse(int size) { vec t(size); t.clear(); t[0] = 1.0; return t; } vec linspace(double from, double to, int points) { if (points < 2) { // This is the "Matlab definition" of linspace vec output(1); output(0) = to; return output; } else { vec output(points); double step = (to - from) / double(points - 1); int i; for (i = 0; i < (points-1); i++) output(i) = from + i * step; output(i) = to; return output; } } vec zigzag_space(double t0, double t1, int K) { it_assert(K > 0, "zigzag_space:() K must be positive"); ivec N = "0 1"; int n = 2; for (int k = 0; k < K; k++) { ivec Nn = 2 * N; for (int i = 1; i < length(Nn); i += 2) { Nn = concat(Nn, i); n++; } N = Nn; } vec T0 = linspace(t0, t1, n); vec Tt = zeros(n); for (int i = 0; i < n; i++) { Tt(i) = T0(N(i)); } return Tt; } // Construct a Hadamard-imat of size "size" imat hadamard(int size) { it_assert(size > 0, "hadamard(): size is not a power of 2"); int logsize = ceil_i(::log2(static_cast(size))); it_assert(pow2i(logsize) == size, "hadamard(): size is not a power of 2"); imat H(size, size); H(0, 0) = 1; for (int i = 0; i < logsize; ++i) { int pow2 = 1 << i; for (int k = 0; k < pow2; ++k) { for (int l = 0; l < pow2; ++l) { H(k, l) = H(k, l); H(k + pow2, l) = H(k, l); H(k, l + pow2) = H(k, l); H(k + pow2, l + pow2) = (-1) * H(k, l); } } } return H; } imat jacobsthal(int p) { int quadratic_residue; imat out(p, p); int i, j; out = -1; // start with all elements equal to "-1" // Generate a complete list of quadratic residues for (i = 0; i < (p - 1) / 2; i++) { quadratic_residue = ((i + 1) * (i + 1)) % p; // set this element in all rows (col-row) = quadratic_residue for (j = 0; j < p; j++) { out(j, (j + quadratic_residue) % p) = 1; } } // set diagonal elements to zero for (i = 0; i < p; i++) { out(i, i) = 0; } return out; } imat conference(int n) { it_assert_debug(n % 4 == 2, "conference(int n); wrong size"); int pm = n - 1; // p must be odd prime, not checked imat out(n, n); out.set_submatrix(1, 1, jacobsthal(pm)); out.set_submatrix(0, 0, 1, n - 1, 1); out.set_submatrix(1, n - 1, 0, 0, 1); out(0, 0) = 0; return out; } const cmat toeplitz(const cvec &c) { int s = c.size(); cmat output(s, s); cvec c_conj = conj(c); for (int i = 1; i < s; ++i) { for (int j = 0; j < s - i; ++j) { output(i + j, j) = c_conj(i); } } // start from j = 0 here, because the main diagonal is not conjugated for (int j = 0; j < s; ++j) { for (int i = 0; i < s - j; ++i) { output(i, i + j) = c(j); } } return output; } mat rotation_matrix(int dim, int plane1, int plane2, double angle) { mat m; double c = std::cos(angle), s = std::sin(angle); it_assert(plane1 >= 0 && plane2 >= 0 && plane1 < dim && plane2 < dim && plane1 != plane2, "Invalid arguments to rotation_matrix()"); m.set_size(dim, dim, false); m = 0.0; for (int i = 0; i < dim; i++) m(i, i) = 1.0; m(plane1, plane1) = c; m(plane1, plane2) = -s; m(plane2, plane1) = s; m(plane2, plane2) = c; return m; } void house(const vec &x, vec &v, double &beta) { double sigma, mu; int n = x.size(); v = x; if (n == 1) { v(0) = 1.0; beta = 0.0; return; } sigma = sum(sqr(x(1, n - 1))); v(0) = 1.0; if (sigma == 0.0) beta = 0.0; else { mu = std::sqrt(sqr(x(0)) + sigma); if (x(0) <= 0.0) v(0) = x(0) - mu; else v(0) = -sigma / (x(0) + mu); beta = 2 * sqr(v(0)) / (sigma + sqr(v(0))); v /= v(0); } } void givens(double a, double b, double &c, double &s) { double t; if (b == 0) { c = 1.0; s = 0.0; } else { if (fabs(b) > fabs(a)) { t = -a / b; s = -1.0 / std::sqrt(1 + t * t); c = s * t; } else { t = -b / a; c = 1.0 / std::sqrt(1 + t * t); s = c * t; } } } void givens(double a, double b, mat &m) { double t, c, s; m.set_size(2, 2); if (b == 0) { m(0, 0) = 1.0; m(1, 1) = 1.0; m(1, 0) = 0.0; m(0, 1) = 0.0; } else { if (fabs(b) > fabs(a)) { t = -a / b; s = -1.0 / std::sqrt(1 + t * t); c = s * t; } else { t = -b / a; c = 1.0 / std::sqrt(1 + t * t); s = c * t; } m(0, 0) = c; m(1, 1) = c; m(0, 1) = s; m(1, 0) = -s; } } mat givens(double a, double b) { mat m(2, 2); givens(a, b, m); return m; } void givens_t(double a, double b, mat &m) { double t, c, s; m.set_size(2, 2); if (b == 0) { m(0, 0) = 1.0; m(1, 1) = 1.0; m(1, 0) = 0.0; m(0, 1) = 0.0; } else { if (fabs(b) > fabs(a)) { t = -a / b; s = -1.0 / std::sqrt(1 + t * t); c = s * t; } else { t = -b / a; c = 1.0 / std::sqrt(1 + t * t); s = c * t; } m(0, 0) = c; m(1, 1) = c; m(0, 1) = -s; m(1, 0) = s; } } mat givens_t(double a, double b) { mat m(2, 2); givens_t(a, b, m); return m; } //! Template instantiation of eye template void eye(int, mat &); //! Template instantiation of eye template void eye(int, bmat &); //! Template instantiation of eye template void eye(int, imat &); //! Template instantiation of eye template void eye(int, cmat &); //! Template instantiation of linspace_fixed_step template vec linspace_fixed_step(double, double, double); //! Template instantiation of linspace_fixed_step template ivec linspace_fixed_step(int, int, int); //! Template instantiation of linspace_fixed_step template svec linspace_fixed_step(short int, short int, short int); } // namespace itpp itpp-4.3.1/itpp/base/specmat.h000066400000000000000000000270641216575753400162160ustar00rootroot00000000000000/*! * \file * \brief Definitions of special vectors and matrices * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger, Adam Piatyszek * and Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SPECMAT_H #define SPECMAT_H #include #include #include #include namespace itpp { /*! \brief Return a integer vector with indicies where bvec == 1 \ingroup miscfunc */ ITPP_EXPORT ivec find(const bvec &invector); /*! \addtogroup specmat */ //!\addtogroup specmat //!@{ //! A float vector of ones ITPP_EXPORT vec ones(int size); //! A Binary vector of ones ITPP_EXPORT bvec ones_b(int size); //! A Int vector of ones ITPP_EXPORT ivec ones_i(int size); //! A float Complex vector of ones ITPP_EXPORT cvec ones_c(int size); //! A float (rows,cols)-matrix of ones ITPP_EXPORT mat ones(int rows, int cols); //! A Binary (rows,cols)-matrix of ones ITPP_EXPORT bmat ones_b(int rows, int cols); //! A Int (rows,cols)-matrix of ones ITPP_EXPORT imat ones_i(int rows, int cols); //! A Double Complex (rows,cols)-matrix of ones ITPP_EXPORT cmat ones_c(int rows, int cols); //! A Double vector of zeros ITPP_EXPORT vec zeros(int size); //! A Binary vector of zeros ITPP_EXPORT bvec zeros_b(int size); //! A Int vector of zeros ITPP_EXPORT ivec zeros_i(int size); //! A Double Complex vector of zeros ITPP_EXPORT cvec zeros_c(int size); //! A Double (rows,cols)-matrix of zeros ITPP_EXPORT mat zeros(int rows, int cols); //! A Binary (rows,cols)-matrix of zeros ITPP_EXPORT bmat zeros_b(int rows, int cols); //! A Int (rows,cols)-matrix of zeros ITPP_EXPORT imat zeros_i(int rows, int cols); //! A Double Complex (rows,cols)-matrix of zeros ITPP_EXPORT cmat zeros_c(int rows, int cols); //! A Double (size,size) unit matrix ITPP_EXPORT mat eye(int size); //! A Binary (size,size) unit matrix ITPP_EXPORT bmat eye_b(int size); //! A Int (size,size) unit matrix ITPP_EXPORT imat eye_i(int size); //! A Double Complex (size,size) unit matrix ITPP_EXPORT cmat eye_c(int size); //! A non-copying version of the eye function. template void eye(int size, Mat &m) { m.set_size(size, size, false); m = T(0); for (int i = size - 1; i >= 0; i--) m(i, i) = T(1); } //! Impulse vector ITPP_EXPORT vec impulse(int size); //! linspace (works in the same way as the MATLAB version) ITPP_EXPORT vec linspace(double from, double to, int length = 100); //! linspace_fixed_step (works in the same way as "from:step:to" in MATLAB) template Vec linspace_fixed_step(T from, T to, T step = 1) { int points = 0; if (0 != step) { points = itpp::floor_i(double(to-from)/step)+1; } if (0 >= points) { return Vec(0); } Vec output(points); output(0) = from; for (int n = 1; n < points; ++n) { output(n) = output(n-1)+step; } return output; } /*! \brief Zig-zag space function (variation on linspace) This function is a variation on linspace(). It traverses the points in different order. For example \code zigzag_space(-5,5,3) \endcode gives the vector \code [-5 5 0 -2.5 2.5 -3.75 -1.25 1.25 3.75] \endcode and \code zigzag_space(-5,5,4) \endcode gives the vector \code [-5 5 0 -2.5 2.5 -3.75 -1.25 1.25 3.75 -4.375 -3.125 -1.875 -0.625 0.625 1.875 3.125 4.375] \endcode and so on. I.e. the function samples the interval [t0,t1] with finer and finer density and with points uniformly distributed over the interval, rather than from left to right (as does linspace). The result is a vector of length 1+2^K. */ ITPP_EXPORT vec zigzag_space(double t0, double t1, int K = 5); /*! * \brief Hadamard matrix * * This function constructs a \a size by \a size Hadammard matrix, where * \a size is a power of 2. */ ITPP_EXPORT imat hadamard(int size); /*! \brief Jacobsthal matrix. Constructs an p by p matrix Q where p is a prime (not checked). The elements in Q {qij} is given by qij=X(j-i), where X(x) is the Legendre symbol given as:
    • X(x)=0 if x is a multiple of p,
    • X(x)=1 if x is a quadratic residue modulo p,
    • X(x)=-1 if x is a quadratic nonresidue modulo p.
    See Wicker "Error Control Systems for digital communication and storage", p. 134 for more information on these topics. Do not check that p is a prime. */ ITPP_EXPORT imat jacobsthal(int p); /*! \brief Conference matrix. Constructs an n by n matrix C, where n=p^m+1=2 (mod 4) and p is a odd prime (not checked). This code only work with m=1, that is n=p+1 and p odd prime. The valid sizes of n is then n=6, 14, 18, 30, 38, ... (and not 10, 26, ...). C has the property that C*C'=(n-1)I, that is it has orthogonal rows and columns in the same way as Hadamard matricies. However, one element in each row (on the diagonal) is zeros. The others are {-1,+1}. For more details see pp. 55-58 in MacWilliams & Sloane "The theory of error correcting codes", North-Holland, 1977. */ ITPP_EXPORT imat conference(int n); /*! * \brief Generate Toeplitz matrix from two vectors \c c and \c r. * * Returns the Toeplitz matrix constructed given the first column C, and * (optionally) the first row R. If the first element of C is not the same * as the first element of R, the first element of C is used. If the second * argument is omitted, the first row is taken to be the same as the first * column and a symmetric (Hermitian) Toeplitz matrix is created. * * An example square Toeplitz matrix has the form: * \verbatim * c(0) r(1) r(2) ... r(n) * c(1) c(0) r(1) r(n-1) * c(2) c(1) c(0) r(n-2) * . . * . . * . . * * c(n) c(n-1) c(n-2) ... c(0) * \endverbatim * * \author Adam Piatyszek */ template const Mat toeplitz(const Vec &c, const Vec &r) { int n_rows = c.size(); int n_cols = r.size(); Mat output(n_rows, n_cols); for (int i = 0; i < n_rows; ++i) { int j_limit = std::min(n_cols, n_rows - i); for (int j = 0; j < j_limit; ++j) { output(i + j, j) = c(i); } } for (int j = 1; j < n_cols; ++j) { int i_limit = std::min(n_rows, n_cols - j); for (int i = 0; i < i_limit; ++i) { output(i, i + j) = r(j); } } return output; } //! Generate symmetric Toeplitz matrix from vector \c c. template const Mat toeplitz(const Vec &c) { int s = c.size(); Mat output(s, s); for (int i = 0; i < s; ++i) { for (int j = 0; j < s - i; ++j) { output(i + j, j) = c(i); } } for (int j = 1; j < s; ++j) { for (int i = 0; i < s - j; ++i) { output(i, i + j) = c(j); } } return output; } //! Generate symmetric Toeplitz matrix from vector \c c (complex valued) ITPP_EXPORT const cmat toeplitz(const cvec &c); //!@} /*! \brief Create a rotation matrix that rotates the given plane \c angle radians. Note that the order of the planes are important! \ingroup miscfunc */ ITPP_EXPORT mat rotation_matrix(int dim, int plane1, int plane2, double angle); /*! \brief Calcualte the Householder vector \ingroup miscfunc */ ITPP_EXPORT void house(const vec &x, vec &v, double &beta); /*! \brief Calculate the Givens rotation values \ingroup miscfunc */ ITPP_EXPORT void givens(double a, double b, double &c, double &s); /*! \brief Calculate the Givens rotation matrix \ingroup miscfunc */ ITPP_EXPORT void givens(double a, double b, mat &m); /*! \brief Calculate the Givens rotation matrix \ingroup miscfunc */ ITPP_EXPORT mat givens(double a, double b); /*! \brief Calculate the transposed Givens rotation matrix \ingroup miscfunc */ ITPP_EXPORT void givens_t(double a, double b, mat &m); /*! \brief Calculate the transposed Givens rotation matrix \ingroup miscfunc */ ITPP_EXPORT mat givens_t(double a, double b); /*! \relates Vec \brief Vector of length 1 */ template Vec vec_1(T v0) { Vec v(1); v(0) = v0; return v; } /*! \relates Vec \brief Vector of length 2 */ template Vec vec_2(T v0, T v1) { Vec v(2); v(0) = v0; v(1) = v1; return v; } /*! \relates Vec \brief Vector of length 3 */ template Vec vec_3(T v0, T v1, T v2) { Vec v(3); v(0) = v0; v(1) = v1; v(2) = v2; return v; } /*! \relates Mat \brief Matrix of size 1 by 1 */ template Mat mat_1x1(T m00) { Mat m(1, 1); m(0, 0) = m00; return m; } /*! \relates Mat \brief Matrix of size 1 by 2 */ template Mat mat_1x2(T m00, T m01) { Mat m(1, 2); m(0, 0) = m00; m(0, 1) = m01; return m; } /*! \relates Mat \brief Matrix of size 2 by 1 */ template Mat mat_2x1(T m00, T m10) { Mat m(2, 1); m(0, 0) = m00; m(1, 0) = m10; return m; } /*! \relates Mat \brief Matrix of size 2 by 2 */ template Mat mat_2x2(T m00, T m01, T m10, T m11) { Mat m(2, 2); m(0, 0) = m00; m(0, 1) = m01; m(1, 0) = m10; m(1, 1) = m11; return m; } /*! \relates Mat \brief Matrix of size 1 by 3 */ template Mat mat_1x3(T m00, T m01, T m02) { Mat m(1, 3); m(0, 0) = m00; m(0, 1) = m01; m(0, 2) = m02; return m; } /*! \relates Mat \brief Matrix of size 3 by 1 */ template Mat mat_3x1(T m00, T m10, T m20) { Mat m(3, 1); m(0, 0) = m00; m(1, 0) = m10; m(2, 0) = m20; return m; } /*! \relates Mat \brief Matrix of size 2 by 3 */ template Mat mat_2x3(T m00, T m01, T m02, T m10, T m11, T m12) { Mat m(2, 3); m(0, 0) = m00; m(0, 1) = m01; m(0, 2) = m02; m(1, 0) = m10; m(1, 1) = m11; m(1, 2) = m12; return m; } /*! \relates Mat \brief Matrix of size 3 by 2 */ template Mat mat_3x2(T m00, T m01, T m10, T m11, T m20, T m21) { Mat m(3, 2); m(0, 0) = m00; m(0, 1) = m01; m(1, 0) = m10; m(1, 1) = m11; m(2, 0) = m20; m(2, 1) = m21; return m; } /*! \relates Mat \brief Matrix of size 3 by 3 */ template Mat mat_3x3(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22) { Mat m(3, 3); m(0, 0) = m00; m(0, 1) = m01; m(0, 2) = m02; m(1, 0) = m10; m(1, 1) = m11; m(1, 2) = m12; m(2, 0) = m20; m(2, 1) = m21; m(2, 2) = m22; return m; } } //namespace itpp #endif // #ifndef SPECMAT_H itpp-4.3.1/itpp/base/stack.h000066400000000000000000000110431216575753400156550ustar00rootroot00000000000000/*! * \file * \brief Stack class (container) * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This file is not separated into a .h and a .cpp file. The reason is * to avoid problems with template initializations of this class. * An \c Stack can contain any type and it is not possible to * initialize and pre-compile all types that might be put into an * \c Stack. */ #ifndef STACK_H #define STACK_H #include namespace itpp { /*! \brief General stack class This class is a general stack class for arbitrary types. For rarely used types you will need to instantiate the class by \code template class Stack; \endcode The following example shows how to define a Stack of vectors: \code vec a = randn(10); vec b = randn(20); Stack my_stack(10); my_stack.push(a); my_stack.push(b); cout << my_stack.pop() << " " << my_stack.pop() << endl ; \endcode */ template class Stack { public: //! Default constructor Stack(); //! Create a Stack of size \c n Stack(int n); //! Create a copy of \c s Stack(const Stack &s); //! Default destructor virtual ~Stack(); //! Pop the topmost element of the stack T pop(); //! Peek at the topmost element of the stack, without removing it T peek() const; //! Push an element at top of stack void push(T v); //! Empty the stack void clear(); //! Assignment operator void operator=(const Stack &s); //! Returns the maximum number of data elements the stack can store int size() const { return ndata; } //! Returns the number of data elements currently in the stack int no_elements() const { return valptr; } //! Resizing a Stack. void set_size(int n, bool copy = false); private: int valptr; int ndata; T *data; private: void alloc(int n); void free(); }; // --------------------------- Implementation starts here ---------------------------------- template Stack::Stack() { data = 0; ndata = 0; valptr = 0; } template Stack::Stack(int n) { alloc(n); valptr = 0; } template Stack::Stack(const Stack &s) { data = NULL; ndata = 0; valptr = s.valptr; alloc(s.ndata); for (int i = 0; i < s.ndata; i++) data[i] = s.data[i]; } template Stack::~Stack() { free(); } template T Stack::pop() { it_error_if(valptr == 0, "Stack::pop: Empty stack"); valptr--; return data[valptr]; } template T Stack::peek() const { it_error_if(valptr == 0, "Stack::peek: Empty stack"); return data[valptr-1]; } template void Stack::push(T v) { it_error_if(valptr >= ndata, "Stack::push: Full stack"); data[valptr] = v; valptr++; } template void Stack::clear() { valptr = 0; } template void Stack::alloc(int n) { if (n == 0) { data = NULL; ndata = 0; } else { data = new T[n]; it_assert_debug(data != 0, "Out of memory in Stack::alloc"); } ndata = n; } template void Stack::free() { delete [] data; data = 0; ndata = 0; } template void Stack::operator=(const Stack &s) { set_size(s.ndata); for (int i = 0; i < ndata; i++) data[i] = s.data[i]; valptr = 0; } template void Stack::set_size(int sz, bool copy) { int i, min; T *tmp; if (ndata == sz) return; if (copy) { tmp = data; min = ndata < sz ? ndata : sz; alloc(sz); for (i = 0; i < min; i++) data[i] = tmp[i]; delete [] tmp; } else { free(); alloc(sz); } ndata = sz; } } // namespace itpp #endif // #ifndef STACK_H itpp-4.3.1/itpp/base/svec.cpp000066400000000000000000000071251216575753400160510ustar00rootroot00000000000000/*! * \file * \brief Sparse Vector Class implementation * \author Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include //! \cond namespace itpp { // --------------------------------------------------------------------- // Instantiations // --------------------------------------------------------------------- template class ITPP_EXPORT Sparse_Vec; template class ITPP_EXPORT Sparse_Vec; template class ITPP_EXPORT Sparse_Vec >; template ITPP_EXPORT sparse_ivec operator+(const sparse_ivec &, const sparse_ivec &); template ITPP_EXPORT sparse_vec operator+(const sparse_vec &, const sparse_vec &); template ITPP_EXPORT sparse_cvec operator+(const sparse_cvec &, const sparse_cvec &); template ITPP_EXPORT int operator*(const sparse_ivec &, const sparse_ivec &); template ITPP_EXPORT double operator*(const sparse_vec &, const sparse_vec &); template ITPP_EXPORT std::complex operator*(const sparse_cvec &, const sparse_cvec &); template ITPP_EXPORT int operator*(const sparse_ivec &, const ivec &); template ITPP_EXPORT double operator*(const sparse_vec &, const vec &); template ITPP_EXPORT std::complex operator*(const sparse_cvec &, const cvec &); template ITPP_EXPORT int operator*(const ivec &, const sparse_ivec &); template ITPP_EXPORT double operator*(const vec &, const sparse_vec &); template ITPP_EXPORT std::complex operator*(const cvec &, const sparse_cvec &); template ITPP_EXPORT sparse_ivec elem_mult(const sparse_ivec &, const sparse_ivec &); template ITPP_EXPORT sparse_vec elem_mult(const sparse_vec &, const sparse_vec &); template ITPP_EXPORT sparse_cvec elem_mult(const sparse_cvec &, const sparse_cvec &); template ITPP_EXPORT ivec elem_mult(const sparse_ivec &, const ivec &); template ITPP_EXPORT vec elem_mult(const sparse_vec &, const vec &); template ITPP_EXPORT cvec elem_mult(const sparse_cvec &, const cvec &); template ITPP_EXPORT sparse_ivec elem_mult_s(const sparse_ivec &, const ivec &); template ITPP_EXPORT sparse_vec elem_mult_s(const sparse_vec &, const vec &); template ITPP_EXPORT sparse_cvec elem_mult_s(const sparse_cvec &, const cvec &); template ITPP_EXPORT ivec elem_mult(const ivec &, const sparse_ivec &); template ITPP_EXPORT vec elem_mult(const vec &, const sparse_vec &); template ITPP_EXPORT cvec elem_mult(const cvec &, const sparse_cvec &); template ITPP_EXPORT sparse_ivec elem_mult_s(const ivec &, const sparse_ivec &); template ITPP_EXPORT sparse_vec elem_mult_s(const vec &, const sparse_vec &); template ITPP_EXPORT sparse_cvec elem_mult_s(const cvec &, const sparse_cvec &); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/svec.h000066400000000000000000001017051216575753400155150ustar00rootroot00000000000000/*! * \file * \brief Sparse Vector Class definitions * \author Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SVEC_H #define SVEC_H #include #include #include #include namespace itpp { // Declaration of class Vec template class Vec; // Declaration of class Sparse_Vec template class Sparse_Vec; // ----------------------- Sparse_Vec Friends ------------------------------- //! v1+v2 where v1 and v2 are sparse vector template Sparse_Vec operator+(const Sparse_Vec &v1, const Sparse_Vec &v2); //! v1*v2 where v1 and v2 are sparse vectors template T operator*(const Sparse_Vec &v1, const Sparse_Vec &v2); //! v1*v2 where v1 is a sparse vector and v2 is a dense vector template T operator*(const Sparse_Vec &v1, const Vec &v2); //! v1*v2 where v1 is a dense vector and v2 is a sparse vector template T operator*(const Vec &v1, const Sparse_Vec &v2); //! Elementwise multiplication of two sparse vectors returning a sparse vector template Sparse_Vec elem_mult(const Sparse_Vec &v1, const Sparse_Vec &v2); //! Elementwise multiplication of a sparse vector and a dense vector returning a dense vector template Vec elem_mult(const Sparse_Vec &v1, const Vec &v2); //! Elementwise multiplication of a sparse vector and a dense vector returning a sparse vector template Sparse_Vec elem_mult_s(const Sparse_Vec &v1, const Vec &v2); //! Elementwise multiplication of a dense vector and a sparse vector returning a dense vector template Vec elem_mult(const Vec &v1, const Sparse_Vec &v2); //! Elementwise multiplication of a dense vector and a sparse vector returning a sparse vector template Sparse_Vec elem_mult_s(const Vec &v1, const Sparse_Vec &v2); namespace details { //this template selects appropriate type for Eps value used to remove small elements from //sparse containers template struct Sparse_Eps_Type_Selector; template <> struct Sparse_Eps_Type_Selector {typedef double eps_type;}; template <> struct Sparse_Eps_Type_Selector > {typedef double eps_type;}; template <> struct Sparse_Eps_Type_Selector {typedef int eps_type;}; template <> struct Sparse_Eps_Type_Selector {typedef short eps_type;}; template <> struct Sparse_Eps_Type_Selector {typedef int eps_type;}; } /*! \brief Templated sparse vector class \author Tony Ottosson and Tobias Ringstrom A sparse vector is a vector where most elements are zero. The maximum number of none-zero elements is a parameter to the constructor. The elements are stored in random order, i.e. they are not sorted. */ template class Sparse_Vec { public: //! Default constructor Sparse_Vec(); /*! \brief Initiate an empty sparse vector \param sz Size of the sparse vector (i.e. maximum index is (\c sz - 1)) \param data_init Maximum number of non-zero elements in the sparse vector (default value 200) */ Sparse_Vec(int sz, int data_init = 200); /*! \brief Initiate a new sparse vector. \param v The elements of \c v are copied into the new sparse vector */ Sparse_Vec(const Sparse_Vec &v); /*! \brief Initiate a new sparse vector from a dense vector. \param v The elements of \c v are copied into the new sparse vector */ Sparse_Vec(const Vec &v); /*! \brief Initiate a new sparse vector from a dense vector. Elements of \c v larger than \c epsilon are copied into the new sparse vector. \note If the type T is complex, then the elements of \c v larger than \c abs(epsilon) are copied into the new sparse vector. */ Sparse_Vec(const Vec &v, T epsilon); //! Destructor ~Sparse_Vec(); /*! \brief Set the size \c sz of the sparse vector. Default value \c data_init=-1 \c => allocated size for the data is not changed. \param sz Size of the sparse vector (i.e. maximum index is (\c sz - 1)) \param data_init Maximum number of non-zero elements in the sparse vector (default value -1 \c => allocated size for the data is not changed) */ void set_size(int sz, int data_init = -1); //! Returns the size of the sparse vector int size() const { return v_size; } //! Number of non-zero elements in the sparse vector inline int nnz() { if (check_small_elems_flag) { remove_small_elements(); } return used_size; } //! Returns the density of the sparse vector: (number of non-zero elements)/(size of the vector) double density(); //! Set that all elements smaller than \a epsilon should be set to zero. void set_small_element(const T& epsilon); /*! Removes all elements that are smaller than \a epsilon from the non-zero elements. \note The small element \a epsilon can be set by the member function set_small_element. If no small value is set, the default value is always \c epsilon=0. */ void remove_small_elements(); /*! \brief Set the maximum number of non-zero elements to \c new_size \param new_size The new maximum number of non-zero elements. */ void resize_data(int new_size); //! Set the maximum number of non-zero elements equal to the actual number of non-zero elements void compact(); //! Returns a full, dense vector in \c v void full(Vec &v) const; //! Returns a full, dense vector Vec full() const; //! Returns the element with index \c i T operator()(int i) const; //! Set element \c i equal to \c v void set(int i, T v); //! Set the elements of the sparse vector with indices \c index_vec to the values in \c v void set(const ivec &index_vec, const Vec &v); //! Set a new element with index \c i equal to \c v void set_new(int i, T v); //! Set new elements with indices \c index_vec equal to the values in \c v (no check whether the same index is used several times) void set_new(const ivec &index_vec, const Vec &v); //! Add element \c i with \c v void add_elem(const int i, const T v); //! Add \c v to the elements specified by \c index_vec with \c v void add(const ivec &index_vec, const Vec &v); //! Set the sparse vector to the all zero vector (removes all non-zero elements) void zeros(); //! Set the i-th element to zero (i.e. clear that element if it contains a non-zero value) void zero_elem(const int i); //! Clear all non-zero elements of the sparse vector void clear(); //! Clear the i-th element (if it contains a non-zero value) void clear_elem(const int i); /*! \brief Extract the reference to the p-th non-zero data element */ inline void get_nz_data(int p, T& data_out) { if (check_small_elems_flag) { remove_small_elements(); } data_out = data[p]; } //! Returns the p-th non-zero data element inline T get_nz_data(int p) { if (check_small_elems_flag) { remove_small_elements(); } return data[p]; } //! Returns the vector index of the p-th non-zero element inline int get_nz_index(int p) { if (check_small_elems_flag) { remove_small_elements(); } return index[p]; } //! Returns the p-th non-zero value in \c dat and the corresponding vector index in \c idx inline void get_nz(int p, int &idx, T &dat) { if (check_small_elems_flag) { remove_small_elements(); } idx = index[p]; dat = data[p]; } //! Return the indices of non-zero values ivec get_nz_indices(); //! Return sparse subvector from index \c i1 to index \c i2 Sparse_Vec get_subvector(int i1, int i2) const; //! Returns the sum of all values squared T sqr() const; //! Assign sparse vector the value and length of the sparse vector \c v void operator=(const Sparse_Vec &v); //! Assign sparse vector the value and length of the dense vector \c v void operator=(const Vec &v); //! Returns the sign inverse of all elements in the sparse vector Sparse_Vec operator-() const; //! Compare two sparse vectors. False if wrong sizes or different values bool operator==(const Sparse_Vec &v); //! Add sparse vector \c v to all non-zero elements of the sparse vector void operator+=(const Sparse_Vec &v); //! Add vector \c v to all non-zero elements of the sparse vector void operator+=(const Vec &v); //! Subtract sparse vector \c v from all non-zero elements of the sparse vector void operator-=(const Sparse_Vec &v); //! Subtract vector \c v from all non-zero elements of the sparse vector void operator-=(const Vec &v); //! Multiply the scalar \c v to all non-zero elements of the sparse vector void operator*=(const T &v); //! Divide all non-zero elements of the sparse vector with the scalar \c v void operator/=(const T &v); //! Addition v1+v2 where v1 and v2 are sparse vector friend Sparse_Vec operator+<>(const Sparse_Vec &v1, const Sparse_Vec &v2); //! Scalar product v1*v2 where v1 and v2 are sparse vectors friend T operator*<>(const Sparse_Vec &v1, const Sparse_Vec &v2); //! Scalar product v1*v2 where v1 is a sparse vector and v2 is a dense vector friend T operator*<>(const Sparse_Vec &v1, const Vec &v2); //! Scalar product v1*v2 where v1 is a dense vector and v2 is a sparse vector friend T operator*<>(const Vec &v1, const Sparse_Vec &v2); //! Element wise multiplication of two sparse vectors friend Sparse_Vec elem_mult <>(const Sparse_Vec &v1, const Sparse_Vec &v2); //! Element wise multiplication of a sparse vector and a dense vector friend Vec elem_mult <>(const Sparse_Vec &v1, const Vec &v2); //! Element wise multiplication of a sparse vector and a dense vector returning a sparse vector friend Sparse_Vec elem_mult_s <>(const Sparse_Vec &v1, const Vec &v2); //! Element wise multiplication of a a dense vector and a sparse vector friend Vec elem_mult <>(const Vec &v1, const Sparse_Vec &v2); //! Element wise multiplication of a a dense vector and a sparse vector returning a sparse vector friend Sparse_Vec elem_mult_s <>(const Vec &v1, const Sparse_Vec &v2); private: void init(); void alloc(); void free(); int v_size, used_size, data_size; T *data; int *index; typename details::Sparse_Eps_Type_Selector::eps_type eps; bool check_small_elems_flag; }; /*! \relates Sparse_Vec \brief Type definition of an integer sparse vector */ typedef Sparse_Vec sparse_ivec; /*! \relates Sparse_Vec \brief Type definition of a double sparse vector */ typedef Sparse_Vec sparse_vec; /*! \relates Sparse_Vec \brief Type definition of a complex sparse vector */ typedef Sparse_Vec > sparse_cvec; // ----------------------- Implementation starts here -------------------------------- template void Sparse_Vec::init() { v_size = 0; used_size = 0; data_size = 0; data = 0; index = 0; eps = 0; check_small_elems_flag = true; } template void Sparse_Vec::alloc() { if (data_size != 0) { data = new T[data_size]; index = new int[data_size]; } } template void Sparse_Vec::free() { delete [] data; data = 0; delete [] index; index = 0; } template Sparse_Vec::Sparse_Vec() { init(); } template Sparse_Vec::Sparse_Vec(int sz, int data_init) { init(); v_size = sz; used_size = 0; data_size = data_init; alloc(); } template Sparse_Vec::Sparse_Vec(const Sparse_Vec &v) { init(); v_size = v.v_size; used_size = v.used_size; data_size = v.data_size; eps = v.eps; check_small_elems_flag = v.check_small_elems_flag; alloc(); for (int i = 0; i < used_size; i++) { data[i] = v.data[i]; index[i] = v.index[i]; } } template Sparse_Vec::Sparse_Vec(const Vec &v) { init(); v_size = v.size(); used_size = 0; data_size = std::min(v.size(), 10000); alloc(); for (int i = 0; i < v_size; i++) { if (v(i) != T(0)) { if (used_size == data_size) resize_data(data_size*2); data[used_size] = v(i); index[used_size] = i; used_size++; } } compact(); } template Sparse_Vec::Sparse_Vec(const Vec &v, T epsilon) { init(); v_size = v.size(); used_size = 0; data_size = std::min(v.size(), 10000); eps = std::abs(epsilon); alloc(); for (int i = 0; i < v_size; i++) { if (std::abs(v(i)) > eps) { if (used_size == data_size) resize_data(data_size*2); data[used_size] = v(i); index[used_size] = i; used_size++; } } compact(); } template Sparse_Vec::~Sparse_Vec() { free(); } template void Sparse_Vec::set_size(int new_size, int data_init) { v_size = new_size; used_size = 0; if (data_init != -1) { free(); data_size = data_init; alloc(); } } template double Sparse_Vec::density() { if (check_small_elems_flag) { remove_small_elements(); } //return static_cast(used_size) / v_size; return double(used_size) / v_size; } template void Sparse_Vec::set_small_element(const T& epsilon) { eps = std::abs(epsilon); remove_small_elements(); } template void Sparse_Vec::remove_small_elements() { int i; int nrof_removed_elements = 0; //Remove small elements for (i = 0;i < used_size;i++) { if (std::abs(data[i]) <= eps) { nrof_removed_elements++; } else if (nrof_removed_elements > 0) { data[i-nrof_removed_elements] = data[i]; index[i-nrof_removed_elements] = index[i]; } } //Set new size after small elements have been removed used_size -= nrof_removed_elements; //Set the flag to indicate that all small elements have been removed check_small_elems_flag = false; } template void Sparse_Vec::resize_data(int new_size) { it_assert(new_size >= used_size, "Sparse_Vec::resize_data(int new_size): New size is to small"); if (new_size != data_size) { if (new_size == 0) free(); else { T *tmp_data = data; int *tmp_pos = index; data_size = new_size; alloc(); for (int p = 0; p < used_size; p++) { data[p] = tmp_data[p]; index[p] = tmp_pos[p]; } delete [] tmp_data; delete [] tmp_pos; } } } template void Sparse_Vec::compact() { if (check_small_elems_flag) { remove_small_elements(); } resize_data(used_size); } template void Sparse_Vec::full(Vec &v) const { v.set_size(v_size); v = T(0); for (int p = 0; p < used_size; p++) v(index[p]) = data[p]; } template Vec Sparse_Vec::full() const { Vec r(v_size); full(r); return r; } // This is slow. Implement a better search template T Sparse_Vec::operator()(int i) const { it_assert_debug(i >= 0 && i < v_size, "The index of the element is out of range"); bool found = false; int p; for (p = 0; p < used_size; p++) { if (index[p] == i) { found = true; break; } } return found ? data[p] : T(0); } template void Sparse_Vec::set(int i, T v) { it_assert_debug(i >= 0 && i < v_size, "The index of the element is out of range"); bool found = false; bool larger_than_eps; int p; for (p = 0; p < used_size; p++) { if (index[p] == i) { found = true; break; } } larger_than_eps = (std::abs(v) > eps); if (found && larger_than_eps) data[p] = v; else if (larger_than_eps) { if (used_size == data_size) resize_data(data_size*2 + 100); data[used_size] = v; index[used_size] = i; used_size++; } //Check if the stored element is smaller than eps. In that case it should be removed. if (std::abs(v) <= eps) { remove_small_elements(); } } template void Sparse_Vec::set_new(int i, T v) { it_assert_debug(v_size > i, "The index of the element exceeds the size of the sparse vector"); //Check that the new element is larger than eps! if (std::abs(v) > eps) { if (used_size == data_size) resize_data(data_size*2 + 100); data[used_size] = v; index[used_size] = i; used_size++; } } template void Sparse_Vec::add_elem(const int i, const T v) { bool found = false; int p; it_assert_debug(v_size > i, "The index of the element exceeds the size of the sparse vector"); for (p = 0; p < used_size; p++) { if (index[p] == i) { found = true; break; } } if (found) data[p] += v; else { if (used_size == data_size) resize_data(data_size*2 + 100); data[used_size] = v; index[used_size] = i; used_size++; } check_small_elems_flag = true; } template void Sparse_Vec::add(const ivec& index_vec, const Vec& v) { bool found = false; int i, p, q; int nrof_nz = v.size(); it_assert_debug(v_size > max(index_vec), "The indices exceeds the size of the sparse vector"); //Elements are added if they have identical indices for (q = 0; q < nrof_nz; q++) { i = index_vec(q); for (p = 0; p < used_size; p++) { if (index[p] == i) { found = true; break; } } if (found) data[p] += v(q); else { if (used_size == data_size) resize_data(data_size*2 + 100); data[used_size] = v(q); index[used_size] = i; used_size++; } found = false; } check_small_elems_flag = true; } template void Sparse_Vec::zeros() { used_size = 0; check_small_elems_flag = false; } template void Sparse_Vec::zero_elem(const int i) { bool found = false; int p; it_assert_debug(v_size > i, "The index of the element exceeds the size of the sparse vector"); for (p = 0; p < used_size; p++) { if (index[p] == i) { found = true; break; } } if (found) { data[p] = data[used_size-1]; index[p] = index[used_size-1]; used_size--; } } template void Sparse_Vec::clear() { used_size = 0; check_small_elems_flag = false; } template void Sparse_Vec::clear_elem(const int i) { bool found = false; int p; it_assert_debug(v_size > i, "The index of the element exceeds the size of the sparse vector"); for (p = 0; p < used_size; p++) { if (index[p] == i) { found = true; break; } } if (found) { data[p] = data[used_size-1]; index[p] = index[used_size-1]; used_size--; } } template void Sparse_Vec::set(const ivec& index_vec, const Vec& v) { it_assert_debug(v_size > max(index_vec), "The indices exceeds the size of the sparse vector"); //Clear all old non-zero elements clear(); //Add the new non-zero elements add(index_vec, v); } template void Sparse_Vec::set_new(const ivec& index_vec, const Vec& v) { int q; int nrof_nz = v.size(); it_assert_debug(v_size > max(index_vec), "The indices exceeds the size of the sparse vector"); //Clear all old non-zero elements clear(); for (q = 0; q < nrof_nz; q++) { if (std::abs(v[q]) > eps) { if (used_size == data_size) resize_data(data_size*2 + 100); data[used_size] = v(q); index[used_size] = index_vec(q); used_size++; } } } template ivec Sparse_Vec::get_nz_indices() { int n = nnz(); ivec r(n); for (int i = 0; i < n; i++) { r(i) = get_nz_index(i); } return r; } template Sparse_Vec Sparse_Vec::get_subvector(int i1, int i2) const { it_assert_debug(v_size > i1 && v_size > i2 && i1 <= i2 && i1 >= 0, "The index of the element exceeds the size of the sparse vector"); Sparse_Vec r(i2 - i1 + 1); for (int p = 0; p < used_size; p++) { if (index[p] >= i1 && index[p] <= i2) { if (r.used_size == r.data_size) r.resize_data(r.data_size*2 + 100); r.data[r.used_size] = data[p]; r.index[r.used_size] = index[p] - i1; r.used_size++; } } r.eps = eps; r.check_small_elems_flag = check_small_elems_flag; r.compact(); return r; } template T Sparse_Vec::sqr() const { T sum(0); for (int p = 0; p < used_size; p++) sum += data[p] * data[p]; return sum; } template void Sparse_Vec::operator=(const Sparse_Vec &v) { free(); v_size = v.v_size; used_size = v.used_size; data_size = v.data_size; eps = v.eps; check_small_elems_flag = v.check_small_elems_flag; alloc(); for (int i = 0; i < used_size; i++) { data[i] = v.data[i]; index[i] = v.index[i]; } } template void Sparse_Vec::operator=(const Vec &v) { free(); v_size = v.size(); used_size = 0; data_size = std::min(v.size(), 10000); eps = std::abs(T(0)); check_small_elems_flag = false; alloc(); for (int i = 0; i < v_size; i++) { if (v(i) != T(0)) { if (used_size == data_size) resize_data(data_size*2); data[used_size] = v(i); index[used_size] = i; used_size++; } } compact(); } template Sparse_Vec Sparse_Vec::operator-() const { Sparse_Vec r(v_size, used_size); for (int p = 0; p < used_size; p++) { r.data[p] = -data[p]; r.index[p] = index[p]; } r.used_size = used_size; return r; } template bool Sparse_Vec::operator==(const Sparse_Vec &v) { int p, q; bool found = false; //Remove small elements before comparing the two sparse_vectors if (check_small_elems_flag) remove_small_elements(); if (v_size != v.v_size) { //Return false if vector sizes are unequal return false; } else { for (p = 0;p < used_size;p++) { for (q = 0;q < v.used_size;q++) { if (index[p] == v.index[q]) { found = true; break; } } if (found == false) //Return false if non-zero element not found, or if elements are unequal return false; else if (data[p] != v.data[q]) //Return false if non-zero element not found, or if elements are unequal return false; else //Check next non-zero element found = false; } } /*Special handling if sizes do not match. Required since v may need to do remove_small_elements() for true comparison*/ if (used_size != v.used_size) { if (used_size > v.used_size) { //Return false if number of non-zero elements is less in v return false; } else { //Ensure that the remaining non-zero elements in v are smaller than v.eps int nrof_small_elems = 0; for (q = 0;q < v.used_size;q++) { if (std::abs(v.data[q]) <= v.eps) nrof_small_elems++; } if (v.used_size - nrof_small_elems != used_size) //Return false if the number of "true" non-zero elements are unequal return false; } } //All elements checks => return true return true; } template void Sparse_Vec::operator+=(const Sparse_Vec &v) { int i, p; T tmp_data; int nrof_nz_v = v.used_size; it_assert_debug(v_size == v.size(), "Attempted addition of unequal sized sparse vectors"); for (p = 0; p < nrof_nz_v; p++) { i = v.index[p]; tmp_data = v.data[p]; //get_nz(p,i,tmp_data); add_elem(i, tmp_data); } check_small_elems_flag = true; } template void Sparse_Vec::operator+=(const Vec &v) { int i; it_assert_debug(v_size == v.size(), "Attempted addition of unequal sized sparse vectors"); for (i = 0; i < v.size(); i++) if (v(i) != T(0)) add_elem(i, v(i)); check_small_elems_flag = true; } template void Sparse_Vec::operator-=(const Sparse_Vec &v) { int i, p; T tmp_data; int nrof_nz_v = v.used_size; it_assert_debug(v_size == v.size(), "Attempted subtraction of unequal sized sparse vectors"); for (p = 0; p < nrof_nz_v; p++) { i = v.index[p]; tmp_data = v.data[p]; //v.get_nz(p,i,tmp_data); add_elem(i, -tmp_data); } check_small_elems_flag = true; } template void Sparse_Vec::operator-=(const Vec &v) { int i; it_assert_debug(v_size == v.size(), "Attempted subtraction of unequal sized sparse vectors"); for (i = 0; i < v.size(); i++) if (v(i) != T(0)) add_elem(i, -v(i)); check_small_elems_flag = true; } template void Sparse_Vec::operator*=(const T &v) { int p; for (p = 0; p < used_size; p++) { data[p] *= v; } check_small_elems_flag = true; } template void Sparse_Vec::operator/=(const T &v) { int p; for (p = 0; p < used_size; p++) { data[p] /= v; } if (eps > 0) { check_small_elems_flag = true; } } template T operator*(const Sparse_Vec &v1, const Sparse_Vec &v2) { it_assert_debug(v1.v_size == v2.v_size, "Sparse_Vec * Sparse_Vec"); T sum(0); Vec v1f(v1.v_size); v1.full(v1f); for (int p = 0; p < v2.used_size; p++) { if (v1f[v2.index[p]] != T(0)) sum += v1f[v2.index[p]] * v2.data[p]; } return sum; } template T operator*(const Sparse_Vec &v1, const Vec &v2) { it_assert_debug(v1.size() == v2.size(), "Multiplication of unequal sized vectors attempted"); T sum(0); for (int p1 = 0; p1 < v1.used_size; p1++) sum += v1.data[p1] * v2[v1.index[p1]]; return sum; } template T operator*(const Vec &v1, const Sparse_Vec &v2) { it_assert_debug(v1.size() == v2.size(), "Multiplication of unequal sized vectors attempted"); T sum(0); for (int p2 = 0; p2 < v2.used_size; p2++) sum += v1[v2.index[p2]] * v2.data[p2]; return sum; } template Sparse_Vec elem_mult(const Sparse_Vec &v1, const Sparse_Vec &v2) { it_assert_debug(v1.v_size == v2.v_size, "elem_mult(Sparse_Vec, Sparse_Vec)"); Sparse_Vec r(v1.v_size); ivec pos(v1.v_size); pos = -1; for (int p1 = 0; p1 < v1.used_size; p1++) pos[v1.index[p1]] = p1; for (int p2 = 0; p2 < v2.used_size; p2++) { if (pos[v2.index[p2]] != -1) { if (r.used_size == r.data_size) r.resize_data(r.used_size*2 + 100); r.data[r.used_size] = v1.data[pos[v2.index[p2]]] * v2.data[p2]; r.index[r.used_size] = v2.index[p2]; r.used_size++; } } r.compact(); return r; } template Vec elem_mult(const Sparse_Vec &v1, const Vec &v2) { it_assert_debug(v1.v_size == v2.size(), "elem_mult(Sparse_Vec, Vec)"); Vec r(v1.v_size); r = T(0); for (int p1 = 0; p1 < v1.used_size; p1++) r[v1.index[p1]] = v1.data[p1] * v2[v1.index[p1]]; return r; } template Sparse_Vec elem_mult_s(const Sparse_Vec &v1, const Vec &v2) { it_assert_debug(v1.v_size == v2.size(), "elem_mult(Sparse_Vec, Vec)"); Sparse_Vec r(v1.v_size); for (int p1 = 0; p1 < v1.used_size; p1++) { if (v2[v1.index[p1]] != T(0)) { if (r.used_size == r.data_size) r.resize_data(r.used_size*2 + 100); r.data[r.used_size] = v1.data[p1] * v2[v1.index[p1]]; r.index[r.used_size] = v1.index[p1]; r.used_size++; } } r.compact(); return r; } template Vec elem_mult(const Vec &v1, const Sparse_Vec &v2) { it_assert_debug(v1.size() == v2.v_size, "elem_mult(Vec, Sparse_Vec)"); Vec r(v2.v_size); r = T(0); for (int p2 = 0; p2 < v2.used_size; p2++) r[v2.index[p2]] = v1[v2.index[p2]] * v2.data[p2]; return r; } template Sparse_Vec elem_mult_s(const Vec &v1, const Sparse_Vec &v2) { it_assert_debug(v1.size() == v2.v_size, "elem_mult(Vec, Sparse_Vec)"); Sparse_Vec r(v2.v_size); for (int p2 = 0; p2 < v2.used_size; p2++) { if (v1[v2.index[p2]] != T(0)) { if (r.used_size == r.data_size) r.resize_data(r.used_size*2 + 100); r.data[r.used_size] = v1[v2.index[p2]] * v2.data[p2]; r.index[r.used_size] = v2.index[p2]; r.used_size++; } } r.compact(); return r; } template Sparse_Vec operator+(const Sparse_Vec &v1, const Sparse_Vec &v2) { it_assert_debug(v1.v_size == v2.v_size, "Sparse_Vec + Sparse_Vec"); Sparse_Vec r(v1); ivec pos(v1.v_size); pos = -1; for (int p1 = 0; p1 < v1.used_size; p1++) pos[v1.index[p1]] = p1; for (int p2 = 0; p2 < v2.used_size; p2++) { if (pos[v2.index[p2]] == -1) {// A new entry if (r.used_size == r.data_size) r.resize_data(r.used_size*2 + 100); r.data[r.used_size] = v2.data[p2]; r.index[r.used_size] = v2.index[p2]; r.used_size++; } else r.data[pos[v2.index[p2]]] += v2.data[p2]; } r.check_small_elems_flag = true; // added dec 7, 2006 r.compact(); return r; } //! Convert a dense vector \c v into its sparse representation template inline Sparse_Vec sparse(const Vec &v) { Sparse_Vec s(v); return s; } //! Convert a dense vector \c v into its sparse representation template inline Sparse_Vec sparse(const Vec &v, T epsilon) { Sparse_Vec s(v, epsilon); return s; } //! Convert a sparse vector \c s into its dense representation template inline Vec full(const Sparse_Vec &s) { Vec v; s.full(v); return v; } //! \cond // --------------------------------------------------------------------- // Instantiations // --------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sparse_Vec; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sparse_Vec; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sparse_Vec >; ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_ivec operator+(const sparse_ivec &, const sparse_ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_vec operator+(const sparse_vec &, const sparse_vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cvec operator+(const sparse_cvec &, const sparse_cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int operator*(const sparse_ivec &, const sparse_ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double operator*(const sparse_vec &, const sparse_vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex operator*(const sparse_cvec &, const sparse_cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int operator*(const sparse_ivec &, const ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double operator*(const sparse_vec &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex operator*(const sparse_cvec &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int operator*(const ivec &, const sparse_ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double operator*(const vec &, const sparse_vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex operator*(const cvec &, const sparse_cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_ivec elem_mult(const sparse_ivec &, const sparse_ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_vec elem_mult(const sparse_vec &, const sparse_vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cvec elem_mult(const sparse_cvec &, const sparse_cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_mult(const sparse_ivec &, const ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_mult(const sparse_vec &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_mult(const sparse_cvec &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_ivec elem_mult_s(const sparse_ivec &, const ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_vec elem_mult_s(const sparse_vec &, const vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cvec elem_mult_s(const sparse_cvec &, const cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_mult(const ivec &, const sparse_ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_mult(const vec &, const sparse_vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_mult(const cvec &, const sparse_cvec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_ivec elem_mult_s(const ivec &, const sparse_ivec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_vec elem_mult_s(const vec &, const sparse_vec &); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT sparse_cvec elem_mult_s(const cvec &, const sparse_cvec &); //! \endcond } // namespace itpp #endif // #ifndef SVEC_H itpp-4.3.1/itpp/base/timing.cpp000066400000000000000000000075131216575753400164010ustar00rootroot00000000000000/*! * \file * \brief Implementation of Timing classes * \author Thomas Eriksson, Tony Ottosson, Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include #include #include #if defined(_WIN32) && !defined(__CYGWIN__) #include int gettimeofday(struct timeval* p, void*) { union { long long ns100; /* time since 1 Jan 1601 in 100ns units */ FILETIME ft; } _now; GetSystemTimeAsFileTime(&(_now.ft)); p->tv_usec = (long)((_now.ns100 / 10LL) % 1000000LL); /* time since 1 Jan 1970 */ p->tv_sec = (long)((_now.ns100 - 116444736000000000LL) / 10000000LL); return 0; } #endif namespace itpp { //! Global object for tic and toc functions Real_Timer __tic_toc_timer; //---------------------------------------------------------------------------- // class Timer //---------------------------------------------------------------------------- Timer::Timer() { reset(); } void Timer::start(void) { if (!running) { start_time = get_current_time(); running = true; } } double Timer::stop(void) { if (running) { stop_time = get_current_time(); elapsed_time += stop_time - start_time; running = false; } return elapsed_time; } void Timer::reset(double t) { elapsed_time = t; start_time = 0; stop_time = 0; running = false; } double Timer::get_time() const { return running ? elapsed_time + get_current_time() - start_time : elapsed_time; } void Timer::tic(void) { reset(); start(); } double Timer::toc(void) { return get_time() ; } void Timer::toc_print(void) { std::cout << "Elapsed time = " << get_time() << " seconds" << std::endl; } //---------------------------------------------------------------------------- // class CPU_Timer //---------------------------------------------------------------------------- double CPU_Timer::get_current_time() const { return static_cast(clock()) / CLOCKS_PER_SEC; } //---------------------------------------------------------------------------- // class Real_Timer //---------------------------------------------------------------------------- double Real_Timer::get_current_time() const { struct timeval t; gettimeofday(&t, 0); return t.tv_sec + t.tv_usec * 1.0e-6; } void tic() { __tic_toc_timer.tic(); } double toc() { return __tic_toc_timer.toc(); } void toc_print() { __tic_toc_timer.toc_print(); } void pause(double t) { if (t == -1) { std::cout << "(Press enter to continue)" << std::endl; getchar(); } else { Real_Timer T; T.start(); while (T.get_time() < t); } } } // namespace itpp itpp-4.3.1/itpp/base/timing.h000066400000000000000000000111311216575753400160350ustar00rootroot00000000000000/*! * \file * \brief Definitions of Timing classes * \author Thomas Eriksson, Tony Ottosson and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef TIMING_H #define TIMING_H #include namespace itpp { /*! \addtogroup timers */ /*! \brief A virtual base class for timers. \ingroup timers */ class ITPP_EXPORT Timer { public: //! Create a new timer. Sets the time to zero. Timer(); //! Virtual destructor virtual ~Timer() { } //! Start the timer. This does not set the time to zero. void start(void); //! Stop the timer. Returns the elapsed time in seconds. double stop(void); //! Sets the time to time t, which is zero by default. Stops the timer if it is running. void reset(double t = 0.0); //! Resets the timer and starts it. void tic(void); //! Returns the elapsed time since last tic() double toc(void); //! Prints the elapsed time since last tic() void toc_print(void); //! Returns the elapsed time. double get_time() const; protected: //! Vitrual function that returns teh current time virtual double get_current_time() const = 0; //! The start time of the timer double start_time; //! The stop time of the timer double stop_time; //! The ellapsed time from start to stop double elapsed_time; //! A bool that indicates if the timer is running or not bool running; }; /*! \brief A CPU time timer class \ingroup timers Measures the time spent by the CPU on the current process. If two processes are running concurrently, one real seconds equal 5 CPU seconds per process. The resolution is not very good (in the order of 0.01 seconds). Usage: Define a time object: \code CPU_Timer timer; \endcode Actions: Reset: \code timer.reset(); \endcode Start: \code timer.start(); \endcode Stop: \code timer.stop(); \endcode Get time: \code elapsedtime = timer.get_time(); \endcode It is possible to get elapsed time without stopping the timer. Observe that it is also possible to use the macros "time.tic();" to reset and start clock and "time.toc();" stop and print the elapsed time. \warning May give an negative answer if the measured time is too long. */ class ITPP_EXPORT CPU_Timer : public Timer { public: //! Create a new timer. Sets the time to zero. CPU_Timer() { } protected: //! double get_current_time() const; }; /*! \brief A real time timer class \ingroup timers Measures real time. Usage: Define a time object: \code Real_Timer timer; \endcode Actions: Reset: \code timer.reset(); \endcode Start: \code timer.start(); \endcode Stop: \code timer.stop(); \endcode Get time: \code elapsedtime = timer.get_time(); \endcode It is possible to get elapsed time without stopping the timer. Observe that it is also possible to use the macros "time.tic();" to reset and start clock and "time.toc_print();" to print the elapsed time. \warning May give an negative answer if the measured time is too long. */ class ITPP_EXPORT Real_Timer : public Timer { public: //! Create a new timer. Sets the time to zero. Real_Timer() { } protected: //! double get_current_time() const; }; /*! \brief Reset and start timer \ingroup timers */ ITPP_EXPORT void tic(); /*! \brief Returns the elapsed time since last tic() \ingroup timers */ ITPP_EXPORT double toc(); /*! \brief Prints the elapsed time since last tic() \ingroup timers */ ITPP_EXPORT void toc_print(); /*! \brief pause \ingroup timers \code pause(n); \endcode Pauses for n seconds before continuing \code pause(); \endcode Pauses until a key is pressed */ ITPP_EXPORT void pause(double t = -1); } // namespace itpp #endif // #ifndef TIMING_H itpp-4.3.1/itpp/base/vec.cpp000066400000000000000000000607361216575753400156750ustar00rootroot00000000000000/*! * \file * \brief Templated Vector Class Implementation * \author Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined (HAVE_BLAS) # include #endif #include #include #include #include //! \cond namespace itpp { template<> int Vec::parse_token(const std::string &s) const { int out; std::istringstream buffer(s); if (s.find('x', 1) != std::string::npos) { buffer >> std::hex >> out; } else if (((s[0] == '0') || (((s[0] == '-') || (s[0] == '+')) && (s[1] == '0'))) && (s.find('8', 1) == std::string::npos) && (s.find('9', 1) == std::string::npos)) { buffer >> std::oct >> out; } else { buffer >> std::dec >> out; } return out; } template<> double Vec::parse_token(const std::string &s) const { double out; if ((s == "NaN") || (s == "nan") || (s == "NAN")) { if (std::numeric_limits::has_quiet_NaN) out = std::numeric_limits::quiet_NaN(); else if (std::numeric_limits::has_signaling_NaN) out = std::numeric_limits::signaling_NaN(); else it_error("Vec::set(): NaN not supported"); } else if ((s =="-Inf") || (s =="-inf") || (s =="-INF")) { out = -std::numeric_limits::infinity(); } else if ((s =="Inf") || (s =="inf") || (s =="INF") || (s =="+Inf") || (s =="+inf") || (s =="+INF")) { out = std::numeric_limits::infinity(); } else { std::istringstream buffer(s); buffer >> out; it_assert(!buffer.fail(), "Vec::set(): Stream operation failed " "(buffer >> out)"); } return out; } template<> void Vec::set(const std::string &str) { bool abc_format; std::vector tokens = tokenize(str, abc_format); it_assert(!abc_format, "Vec::set(): \"a:b:c\" format string not " "supported for binary vectors"); set_size(int(tokens.size())); for (std::vector::size_type i = 0; i < tokens.size(); ++i) { std::istringstream buffer(tokens[i]); buffer >> data[i]; it_assert(!buffer.fail(), "Vec::set(): Stream operation failed " "(buffer >> data)"); } } template<> void Vec::set(const std::string &str) { // parser for "short int" is the same as for "int", so reuse it here ivec iv(str); this->operator=(to_svec(iv)); } template<> void Vec::set(const std::string &str) { bool abc_format; std::vector tokens = tokenize(str, abc_format); // no "a:b:c" tokens, so the size of output vector is known if (!abc_format) { set_size(int(tokens.size())); for (std::vector::size_type i = 0; i < tokens.size(); ++i) data[i] = parse_token(tokens[i]); } else { int pos = 0; set_size((tokens.size() > 20) ? int(tokens.size()) : 20); for (std::vector::size_type i = 0; i < tokens.size(); ++i) { // check if the current token is in "a:b[:c]" format if (tokens[i].find(':', 1) == std::string::npos) { if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = parse_token(tokens[i]); } else { int a, b, c; parse_abc_token(tokens[i], a, b, c); if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = a; if ((b > 0) && (c >= a)) { while ((data[pos-1] + b) <= c) { if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = data[pos-2] + b; } } else if ((b < 0) && (c <= a)) { while ((data[pos-1] + b) >= c) { if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = data[pos-2] + b; } } else if (b == 0 && c == a) { break; } else { it_error("Vec::set(): Improper data string (a:b:c)"); } } } set_size(pos, true); } // if (!abc_format) } template<> void Vec::set(const std::string &str) { bool abc_format; std::vector tokens = tokenize(str, abc_format); // no "a:b:c" tokens, so the size of output vector is known if (!abc_format) { set_size(int(tokens.size())); for (std::vector::size_type i = 0; i < tokens.size(); ++i) data[i] = parse_token(tokens[i]); } else { int pos = 0; set_size((tokens.size() > 20) ? int(tokens.size()) : 20); for (std::vector::size_type i = 0; i < tokens.size(); ++i) { // check if the current token is in "a:b[:c]" format if (tokens[i].find(':', 1) == std::string::npos) { if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = parse_token(tokens[i]); } else { double a, b, c; parse_abc_token(tokens[i], a, b, c); if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = a; // Adding this margin fixes precision problems in e.g. "0:0.2:3", // where the last value was 2.8 instead of 3. double eps_margin = std::fabs((c - a) / b) * eps; if ((b > 0) && (c >= a)) { while ((data[pos-1] + b) <= (c + eps_margin)) { if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = data[pos-2] + b; } } else if ((b < 0) && (c <= a)) { while ((data[pos-1] + b) >= (c - eps_margin)) { if (++pos > datasize) { set_size(2 * datasize, true); } data[pos-1] = data[pos-2] + b; } } else if (b == 0 && c == a) { break; } else { it_error("Vec::set(): Improper data string (a:b:c)"); } } } set_size(pos, true); } // if (!abc_format) } template<> void Vec >::set(const std::string &str) { bool abc_format; std::vector tokens = tokenize(str, abc_format); it_assert(!abc_format, "Vec::set(): \"a:b:c\" format string not " "supported for binary vectors"); set_size(int(tokens.size())); for (std::vector::size_type i = 0; i < tokens.size(); ++i) { std::istringstream buffer(tokens[i]); buffer >> data[i]; it_assert(!buffer.fail(), "Vec::set(): Stream operation failed " "(buffer >> data)"); } } #if defined(HAVE_BLAS) template<> double dot(const vec &v1, const vec &v2) { it_assert_debug(v1.length() == v2.length(), "vec::dot(): Wrong sizes"); int incr = 1; int v1_l = v1.length(); return blas::ddot_(&v1_l, v1._data(), &incr, v2._data(), &incr); } #else template<> double dot(const vec &v1, const vec &v2) { it_assert_debug(v1.length() == v2.length(), "vec::dot(): Wrong sizes"); double r = 0.0; for (int i = 0; i < v1.length(); ++i) r += v1._data()[i] * v2._data()[i]; return r; } #endif // HAVE_BLAS #if defined(HAVE_BLAS) template<> mat outer_product(const vec &v1, const vec &v2, bool) { it_assert_debug((v1.length() > 0) && (v2.length() > 0), "Vec::outer_product:: Input vector of zero size"); int v1_l = v1.length(); int v2_l = v2.length(); mat out(v1_l, v2_l); out.zeros(); double alpha = 1.0; int incr = 1; blas::dger_(&v1_l, &v2_l, &alpha, v1._data(), &incr, v2._data(), &incr, out._data(), &v1_l); return out; } template<> cmat outer_product(const cvec &v1, const cvec &v2, bool hermitian) { it_assert_debug((v1.length() > 0) && (v2.length() > 0), "Vec::outer_product:: Input vector of zero size"); int v1_l = v1.length(); int v2_l = v2.length(); cmat out(v1_l, v2_l); out.zeros(); std::complex alpha(1.0); int incr = 1; if (hermitian) { blas::zgerc_(&v1_l, &v2_l, &alpha, v1._data(), &incr, v2._data(), &incr, out._data(), &v1_l); } else { blas::zgeru_(&v1_l, &v2_l, &alpha, v1._data(), &incr, v2._data(), &incr, out._data(), &v1_l); } return out; } #else template<> mat outer_product(const vec &v1, const vec &v2, bool) { it_assert_debug((v1.length() > 0) && (v2.length() > 0), "Vec::outer_product:: Input vector of zero size"); int v1_l = v1.length(); int v2_l = v2.length(); mat out(v1_l, v2_l); for (int i = 0; i < v1_l; ++i) { for (int j = 0; j < v2_l; ++j) { out(i, j) = v1._data()[i] * v2._data()[j]; } } return out; } template<> cmat outer_product(const cvec &v1, const cvec &v2, bool hermitian) { it_assert_debug((v1.length() > 0) && (v2.length() > 0), "Vec::outer_product:: Input vector of zero size"); int v1_l = v1.length(); int v2_l = v2.length(); cmat out(v1_l, v2_l); if (hermitian) { for (int i = 0; i < v1_l; ++i) { for (int j = 0; j < v2_l; ++j) { out(i, j) = v1._data()[i] * conj(v2._data()[j]); } } } else { for (int i = 0; i < v1_l; ++i) { for (int j = 0; j < v2_l; ++j) { out(i, j) = v1._data()[i] * v2._data()[j]; } } } return out; } #endif // HAVE_BLAS template<> bvec Vec >::operator<=(std::complex) const { it_error("operator<=: not implemented for complex"); bvec temp; return temp; } template<> bvec Vec >::operator>(std::complex) const { it_error("operator>: not implemented for complex"); bvec temp; return temp; } template<> bvec Vec >::operator<(std::complex) const { it_error("operator<: not implemented for complex"); bvec temp; return temp; } template<> bvec Vec >::operator>=(std::complex) const { it_error("operator>=: not implemented for complex"); bvec temp; return temp; } template<> Mat > Vec >::hermitian_transpose() const { Mat > temp(1, datasize); for (int i = 0; i < datasize; i++) temp(i) = std::conj(data[i]); return temp; } //--------------------------------------------------------------------- // Instantiations //--------------------------------------------------------------------- template class ITPP_EXPORT Vec; template class ITPP_EXPORT Vec; template class ITPP_EXPORT Vec; template class ITPP_EXPORT Vec >; template class ITPP_EXPORT Vec; // addition operator template ITPP_EXPORT vec operator+(const vec &v1, const vec &v2); template ITPP_EXPORT cvec operator+(const cvec &v1, const cvec &v2); template ITPP_EXPORT ivec operator+(const ivec &v1, const ivec &v2); template ITPP_EXPORT svec operator+(const svec &v1, const svec &v2); template ITPP_EXPORT bvec operator+(const bvec &v1, const bvec &v2); template ITPP_EXPORT vec operator+(const vec &v1, double t); template ITPP_EXPORT cvec operator+(const cvec &v1, std::complex t); template ITPP_EXPORT ivec operator+(const ivec &v1, int t); template ITPP_EXPORT svec operator+(const svec &v1, short t); template ITPP_EXPORT bvec operator+(const bvec &v1, bin t); template ITPP_EXPORT vec operator+(double t, const vec &v1); template ITPP_EXPORT cvec operator+(std::complex t, const cvec &v1); template ITPP_EXPORT ivec operator+(int t, const ivec &v1); template ITPP_EXPORT svec operator+(short t, const svec &v1); template ITPP_EXPORT bvec operator+(bin t, const bvec &v1); // subraction operator template ITPP_EXPORT vec operator-(const vec &v1, const vec &v2); template ITPP_EXPORT cvec operator-(const cvec &v1, const cvec &v2); template ITPP_EXPORT ivec operator-(const ivec &v1, const ivec &v2); template ITPP_EXPORT svec operator-(const svec &v1, const svec &v2); template ITPP_EXPORT bvec operator-(const bvec &v1, const bvec &v2); template ITPP_EXPORT vec operator-(const vec &v, double t); template ITPP_EXPORT cvec operator-(const cvec &v, std::complex t); template ITPP_EXPORT ivec operator-(const ivec &v, int t); template ITPP_EXPORT svec operator-(const svec &v, short t); template ITPP_EXPORT bvec operator-(const bvec &v, bin t); template ITPP_EXPORT vec operator-(double t, const vec &v); template ITPP_EXPORT cvec operator-(std::complex t, const cvec &v); template ITPP_EXPORT ivec operator-(int t, const ivec &v); template ITPP_EXPORT svec operator-(short t, const svec &v); template ITPP_EXPORT bvec operator-(bin t, const bvec &v); // unary minus template ITPP_EXPORT vec operator-(const vec &v); template ITPP_EXPORT cvec operator-(const cvec &v); template ITPP_EXPORT ivec operator-(const ivec &v); template ITPP_EXPORT svec operator-(const svec &v); template ITPP_EXPORT bvec operator-(const bvec &v); // multiplication operator template ITPP_EXPORT std::complex dot(const cvec &v1, const cvec &v2); template ITPP_EXPORT int dot(const ivec &v1, const ivec &v2); template ITPP_EXPORT short dot(const svec &v1, const svec &v2); template ITPP_EXPORT bin dot(const bvec &v1, const bvec &v2); template ITPP_EXPORT double operator*(const vec &v1, const vec &v2); template ITPP_EXPORT std::complex operator*(const cvec &v1, const cvec &v2); template ITPP_EXPORT int operator*(const ivec &v1, const ivec &v2); template ITPP_EXPORT short operator*(const svec &v1, const svec &v2); template ITPP_EXPORT bin operator*(const bvec &v1, const bvec &v2); template ITPP_EXPORT imat outer_product(const ivec &v1, const ivec &v2, bool hermitian); template ITPP_EXPORT smat outer_product(const svec &v1, const svec &v2, bool hermitian); template ITPP_EXPORT bmat outer_product(const bvec &v1, const bvec &v2, bool hermitian); template ITPP_EXPORT vec operator*(const vec &v, double t); template ITPP_EXPORT cvec operator*(const cvec &v, std::complex t); template ITPP_EXPORT ivec operator*(const ivec &v, int t); template ITPP_EXPORT svec operator*(const svec &v, short t); template ITPP_EXPORT bvec operator*(const bvec &v, bin t); template ITPP_EXPORT vec operator*(double t, const vec &v); template ITPP_EXPORT cvec operator*(std::complex t, const cvec &v); template ITPP_EXPORT ivec operator*(int t, const ivec &v); template ITPP_EXPORT svec operator*(short t, const svec &v); template ITPP_EXPORT bvec operator*(bin t, const bvec &v); // elementwise multiplication template ITPP_EXPORT vec elem_mult(const vec &a, const vec &b); template ITPP_EXPORT cvec elem_mult(const cvec &a, const cvec &b); template ITPP_EXPORT ivec elem_mult(const ivec &a, const ivec &b); template ITPP_EXPORT svec elem_mult(const svec &a, const svec &b); template ITPP_EXPORT bvec elem_mult(const bvec &a, const bvec &b); template ITPP_EXPORT void elem_mult_out(const vec &a, const vec &b, vec &out); template ITPP_EXPORT void elem_mult_out(const cvec &a, const cvec &b, cvec &out); template ITPP_EXPORT void elem_mult_out(const ivec &a, const ivec &b, ivec &out); template ITPP_EXPORT void elem_mult_out(const svec &a, const svec &b, svec &out); template ITPP_EXPORT void elem_mult_out(const bvec &a, const bvec &b, bvec &out); template ITPP_EXPORT vec elem_mult(const vec &a, const vec &b, const vec &c); template ITPP_EXPORT cvec elem_mult(const cvec &a, const cvec &b, const cvec &c); template ITPP_EXPORT ivec elem_mult(const ivec &a, const ivec &b, const ivec &c); template ITPP_EXPORT svec elem_mult(const svec &a, const svec &b, const svec &c); template ITPP_EXPORT bvec elem_mult(const bvec &a, const bvec &b, const bvec &c); template ITPP_EXPORT void elem_mult_out(const vec &a, const vec &b, const vec &c, vec &out); template ITPP_EXPORT void elem_mult_out(const cvec &a, const cvec &b, const cvec &c, cvec &out); template ITPP_EXPORT void elem_mult_out(const ivec &a, const ivec &b, const ivec &c, ivec &out); template ITPP_EXPORT void elem_mult_out(const svec &a, const svec &b, const svec &c, svec &out); template ITPP_EXPORT void elem_mult_out(const bvec &a, const bvec &b, const bvec &c, bvec &out); template ITPP_EXPORT vec elem_mult(const vec &a, const vec &b, const vec &c, const vec &d); template ITPP_EXPORT cvec elem_mult(const cvec &a, const cvec &b, const cvec &c, const cvec &d); template ITPP_EXPORT ivec elem_mult(const ivec &a, const ivec &b, const ivec &c, const ivec &d); template ITPP_EXPORT svec elem_mult(const svec &a, const svec &b, const svec &c, const svec &d); template ITPP_EXPORT bvec elem_mult(const bvec &a, const bvec &b, const bvec &c, const bvec &d); template ITPP_EXPORT void elem_mult_out(const vec &a, const vec &b, const vec &c, const vec &d, vec &out); template ITPP_EXPORT void elem_mult_out(const cvec &a, const cvec &b, const cvec &c, const cvec &d, cvec &out); template ITPP_EXPORT void elem_mult_out(const ivec &a, const ivec &b, const ivec &c, const ivec &d, ivec &out); template ITPP_EXPORT void elem_mult_out(const svec &a, const svec &b, const svec &c, const svec &d, svec &out); template ITPP_EXPORT void elem_mult_out(const bvec &a, const bvec &b, const bvec &c, const bvec &d, bvec &out); // in-place elementwise multiplication template ITPP_EXPORT void elem_mult_inplace(const vec &a, vec &b); template ITPP_EXPORT void elem_mult_inplace(const cvec &a, cvec &b); template ITPP_EXPORT void elem_mult_inplace(const ivec &a, ivec &b); template ITPP_EXPORT void elem_mult_inplace(const svec &a, svec &b); template ITPP_EXPORT void elem_mult_inplace(const bvec &a, bvec &b); // elementwise multiplication followed by summation template ITPP_EXPORT double elem_mult_sum(const vec &a, const vec &b); template ITPP_EXPORT std::complex elem_mult_sum(const cvec &a, const cvec &b); template ITPP_EXPORT int elem_mult_sum(const ivec &a, const ivec &b); template ITPP_EXPORT short elem_mult_sum(const svec &a, const svec &b); template ITPP_EXPORT bin elem_mult_sum(const bvec &a, const bvec &b); // division operator template ITPP_EXPORT vec operator/(const vec &v, double t); template ITPP_EXPORT cvec operator/(const cvec &v, std::complex t); template ITPP_EXPORT ivec operator/(const ivec &v, int t); template ITPP_EXPORT svec operator/(const svec &v, short t); template ITPP_EXPORT bvec operator/(const bvec &v, bin t); template ITPP_EXPORT vec operator/(double t, const vec &v); template ITPP_EXPORT cvec operator/(std::complex t, const cvec &v); template ITPP_EXPORT ivec operator/(int t, const ivec &v); template ITPP_EXPORT svec operator/(short t, const svec &v); template ITPP_EXPORT bvec operator/(bin t, const bvec &v); // elementwise division operator template ITPP_EXPORT vec elem_div(const vec &a, const vec &b); template ITPP_EXPORT cvec elem_div(const cvec &a, const cvec &b); template ITPP_EXPORT ivec elem_div(const ivec &a, const ivec &b); template ITPP_EXPORT svec elem_div(const svec &a, const svec &b); template ITPP_EXPORT bvec elem_div(const bvec &a, const bvec &b); template ITPP_EXPORT vec elem_div(double t, const vec &v); template ITPP_EXPORT cvec elem_div(std::complex t, const cvec &v); template ITPP_EXPORT ivec elem_div(int t, const ivec &v); template ITPP_EXPORT svec elem_div(short t, const svec &v); template ITPP_EXPORT bvec elem_div(bin t, const bvec &v); template ITPP_EXPORT void elem_div_out(const vec &a, const vec &b, vec &out); template ITPP_EXPORT void elem_div_out(const cvec &a, const cvec &b, cvec &out); template ITPP_EXPORT void elem_div_out(const ivec &a, const ivec &b, ivec &out); template ITPP_EXPORT void elem_div_out(const svec &a, const svec &b, svec &out); template ITPP_EXPORT void elem_div_out(const bvec &a, const bvec &b, bvec &out); // elementwise division followed by summation template ITPP_EXPORT double elem_div_sum(const vec &a, const vec &b); template ITPP_EXPORT std::complex elem_div_sum(const cvec &a, const cvec &b); template ITPP_EXPORT int elem_div_sum(const ivec &a, const ivec &b); template ITPP_EXPORT short elem_div_sum(const svec &a, const svec &b); template ITPP_EXPORT bin elem_div_sum(const bvec &a, const bvec &b); // concat operator template ITPP_EXPORT vec concat(const vec &v, double a); template ITPP_EXPORT cvec concat(const cvec &v, std::complex a); template ITPP_EXPORT ivec concat(const ivec &v, int a); template ITPP_EXPORT svec concat(const svec &v, short a); template ITPP_EXPORT bvec concat(const bvec &v, bin a); template ITPP_EXPORT vec concat(double a, const vec &v); template ITPP_EXPORT cvec concat(std::complex a, const cvec &v); template ITPP_EXPORT ivec concat(int a, const ivec &v); template ITPP_EXPORT svec concat(short a, const svec &v); template ITPP_EXPORT bvec concat(bin a, const bvec &v); template ITPP_EXPORT vec concat(const vec &v1, const vec &v2); template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2); template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2); template ITPP_EXPORT svec concat(const svec &v1, const svec &v2); template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2); template ITPP_EXPORT vec concat(const vec &v1, const vec &v2, const vec &v3); template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2, const cvec &v3); template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2, const ivec &v3); template ITPP_EXPORT svec concat(const svec &v1, const svec &v2, const svec &v3); template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2, const bvec &v3); template ITPP_EXPORT vec concat(const vec &v1, const vec &v2, const vec &v3, const vec &v4); template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2, const cvec &v3, const cvec &v4); template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2, const ivec &v3, const ivec &v4); template ITPP_EXPORT svec concat(const svec &v1, const svec &v2, const svec &v3, const svec &v4); template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2, const bvec &v3, const bvec &v4); template ITPP_EXPORT vec concat(const vec &v1, const vec &v2, const vec &v3, const vec &v4, const vec &v5); template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2, const cvec &v3, const cvec &v4, const cvec &v5); template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2, const ivec &v3, const ivec &v4, const ivec &v5); template ITPP_EXPORT svec concat(const svec &v1, const svec &v2, const svec &v3, const svec &v4, const svec &v5); template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2, const bvec &v3, const bvec &v4, const bvec &v5); // I/O streams template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const vec &vect); template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const cvec &vect); template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const svec &vect); template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const ivec &vect); template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const bvec &vect); template ITPP_EXPORT std::istream &operator>>(std::istream& is, vec &vect); template ITPP_EXPORT std::istream &operator>>(std::istream& is, cvec &vect); template ITPP_EXPORT std::istream &operator>>(std::istream& is, svec &vect); template ITPP_EXPORT std::istream &operator>>(std::istream& is, ivec &vect); template ITPP_EXPORT std::istream &operator>>(std::istream& is, bvec &vect); } // namespace itpp //! \endcond itpp-4.3.1/itpp/base/vec.h000066400000000000000000002162231216575753400153340ustar00rootroot00000000000000/*! * \file * \brief Templated Vector Class Definitions * \author Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef VEC_H #define VEC_H #include #include #include #include #include #include namespace itpp { // Declaration of Vec template class Vec; // Declaration of Mat template class Mat; // Declaration of bin class bin; //----------------------------------------------------------------------------------- // Declaration of Vec Friends //----------------------------------------------------------------------------------- //! Addition of two vectors template Vec operator+(const Vec &v1, const Vec &v2); //! Addition of a vector and a scalar template Vec operator+(const Vec &v, Num_T t); //! Addition of a scalar and a vector template Vec operator+(Num_T t, const Vec &v); //! Subtraction of a vector from a vector template Vec operator-(const Vec &v1, const Vec &v2); //! Subtraction of a scalar from a vector template Vec operator-(const Vec &v, Num_T t); //! Subtraction of vector from scalar. Results in a vector template Vec operator-(Num_T t, const Vec &v); //! Negation of vector template Vec operator-(const Vec &v); //! Inner (dot) product of two vectors v1 and v2 template Num_T dot(const Vec &v1, const Vec &v2); //! Inner (dot) product of two vectors v1 and v2 template Num_T operator*(const Vec &v1, const Vec &v2); /*! * \brief Outer product of two vectors v1 and v2 * * When \a v1 and \a v2 are complex vectors (cvec), the third boolean * argument \a hermitian can be set to \a true to conjugate \a v2 * (Matlab's v1 * v2' operation). This parameter is ignored for types * other then cvec. */ template Mat outer_product(const Vec &v1, const Vec &v2, bool hermitian = false); //! Multiplication of a vector and a scalar template Vec operator*(const Vec &v, Num_T t); //! Multiplication of a scalar and a vector. Results in a vector template Vec operator*(Num_T t, const Vec &v); //! Element-wise multiplication of two vectors template Vec elem_mult(const Vec &a, const Vec &b); //! Element-wise multiplication of three vectors template Vec elem_mult(const Vec &a, const Vec &b, const Vec &c); //! Element-wise multiplication of four vectors template Vec elem_mult(const Vec &a, const Vec &b, const Vec &c, const Vec &d); //! Element-wise multiplication of two vectors, storing the result in vector \c out template void elem_mult_out(const Vec &a, const Vec &b, Vec &out); //! Element-wise multiplication of three vectors, storing the result in vector \c out template void elem_mult_out(const Vec &a, const Vec &b, const Vec &c, Vec &out); //! Element-wise multiplication of four vectors, storing the result in vector \c out template void elem_mult_out(const Vec &a, const Vec &b, const Vec &c, const Vec &d, Vec &out); //! In-place element-wise multiplication of two vectors. Faster version of b = elem_mult(a,b). template void elem_mult_inplace(const Vec &a, Vec &b); //! Element-wise multiplication of two vectors, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b)). template Num_T elem_mult_sum(const Vec &a, const Vec &b); //! Division of all elements in \c v with \c t template Vec operator/(const Vec &v, Num_T t); //! Division of \c t with all elements in \c v template Vec operator/(Num_T t, const Vec &v); //! Elementwise division of two vectors template Vec elem_div(const Vec &a, const Vec &b); //! This function is deprecated. Please use operator/(Num_T, const Vec Vec elem_div(Num_T t, const Vec &v); //! Elementwise division of two vectors, storing the result in vector \c out template void elem_div_out(const Vec &a, const Vec &b, Vec &out); //! Elementwise division of two vectors, followed by summation of the resultant elements. Fast version of sum(elem_div(a,b)) template Num_T elem_div_sum(const Vec &a, const Vec &b); //! Append element \c a to the end of the vector \c v template Vec concat(const Vec &v, Num_T a); //! Concat element \c a to the beginning of the vector \c v template Vec concat(Num_T a, const Vec &v); //! Concat vectors \c v1 and \c v2 template Vec concat(const Vec &v1, const Vec &v2); //! Concat vectors \c v1, \c v2 and \c v3 template Vec concat(const Vec &v1, const Vec &v2, const Vec &v3); //! Concat vectors \c v1, \c v2, \c v3 and \c v4 template Vec concat(const Vec &v1, const Vec &v2, const Vec &v3, const Vec &v4); //! Concat vectors \c v1, \c v2 \c v3, \c v4 and \c v5 template Vec concat(const Vec &v1, const Vec &v2, const Vec &v3, const Vec &v4, const Vec &v5); //----------------------------------------------------------------------------------- // Declaration of Vec //----------------------------------------------------------------------------------- /*! \ingroup arr_vec_mat \brief Vector Class (Templated) \author Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson Vectors can be of arbitrary types, but conversions and functions are prepared for \c bin, \c short, \c int, \c double, and \c complex vectors and these are predefined as: \c bvec, \c svec, \c ivec, \c vec, and \c cvec. \c double and \c complex are \c double and \c complex respectively. Examples: Vector Constructors: When constructing a vector without a length (memory) use \code vec temp; \endcode For construction of a vector of a given length use \code vec temp(length); \endcode It is also possible to assign the constructed vector the value and size of another vector by \code vec temp(invector); \endcode If you have explicit values you would like to assign to the vector it is possible to do this using strings as: \code vec a("0 0.7 5 9.3"); // that is a = [0, 0.7, 5, 9.3] vec a="0 0.7 5 9.3"; // the constructor is called implicitly ivec b="0:5"; // that is, b = [0, 1, 2, 3, 4, 5] vec c="3:2.5:13"; // that is, c = [3, 5.5, 8, 10.5, 13] \endcode It is also possible to change length by \code temp.set_size(new_length, false); \endcode where \c false is used to indicate that the old values in \c temp are not copied. If you would like to preserve the values, use \c true. There are a number of methods to access parts of a vector. Examples are \code a(5); // Element number 5 a(5,9); // Elements 5, 6, 7, 8, and 9 a.left(10); // The 10 leftmost elements (the first) a.right(10); // The 10 rightmost elements (the last) a.mid(5, 7); // 7 elements starting from element 5 \endcode It is also possible to modify parts of a vector, as in e.g. \code a.del(5); // deletes element number 5 a.ins(3.4, 9); // inserts the element 3.4 at position 9 a.set_subvector(12, b); // replaces elements from 12 with the vector b \endcode It is, of course, also possible to perform common linear algebra operations, such as addition, subtraction, and scalar product (*). Observe though, that vectors are assumed to be column-vectors in operations with matrices. Most elementary functions such as sin(), cosh(), log(), abs(), ..., are also available as operations on the individual elements of the vectors. Please see the individual functions for more details. By default, the Vec elements are created using the default constructor for the element type. This can be changed by specifying a suitable Factory in the Vec constructor call; see Detailed Description for Factory. */ template class Vec { public: //! The type of the vector values typedef Num_T value_type; //! Default constructor. An element factory \c f can be specified. explicit Vec(const Factory &f = DEFAULT_FACTORY); //! Constructor with size parameter. An element factory \c f can be specified. explicit Vec(int size, const Factory &f = DEFAULT_FACTORY); //! Copy constructor Vec(const Vec &v); //! Copy constructor, which takes an element factory \c f as an additional argument. Vec(const Vec &v, const Factory &f); //! Constructor taking a char string as input. An element factory \c f can be specified. Vec(const char *str, const Factory &f = DEFAULT_FACTORY); //! Constructor taking a string as input. An element factory \c f can be specified. Vec(const std::string &str, const Factory &f = DEFAULT_FACTORY); //! Constructor taking a C-array as input. Copies all data. An element factory \c f can be specified. Vec(const Num_T *c_array, int size, const Factory &f = DEFAULT_FACTORY); //! Destructor ~Vec(); //! The size of the vector int length() const { return datasize; } //! The size of the vector int size() const { return datasize; } //! Set length of vector. if copy = true then keeping the old values void set_size(int size, bool copy = false); //! Set length of vector. if copy = true then keeping the old values void set_length(int size, bool copy = false) { set_size(size, copy); } //! Set the vector to the all zero vector void zeros(); //! Set the vector to the all zero vector void clear() { zeros(); } //! Set the vector to the all one vector void ones(); //! Set the vector equal to the values in the \c str string void set(const char *str); //! Set the vector equal to the values in the \c str string void set(const std::string &str); //! C-style index operator. First element is 0. const Num_T &operator[](int i) const; //! Index operator. First element is 0. const Num_T &operator()(int i) const; //! C-style index operator. First element is 0. Num_T &operator[](int i); //! Index operator. First element is 0. Num_T &operator()(int i); //! Sub-vector with elements from \c i1 to \c i2. Index -1 indicates the last element. Vec operator()(int i1, int i2) const; //! Sub-vector with elements given by the list of indices \c indexlist Vec operator()(const Vec &indexlist) const; //! Sub-vector with elements with indexes where \c binlist is \c 1 Vec operator()(const Vec &binlist) const; //! Accessor-style method. First element is 0. const Num_T &get(int i) const; //! Get the elements from \c i1 to \c i2. Index -1 indicates the last element. Vec get(int i1, int i2) const; //! Get the elements given by the list of indices \c indexlist Vec get(const Vec &indexlist) const; //! Get the elements with indexes where \c binlist is \c 1 Vec get(const Vec &binlist) const; //! Modifier-style method. First element is 0. void set(int i, Num_T t); //! Matrix transpose. Converts to a matrix with the vector in the first row Mat transpose() const; //! Matrix transpose. Converts to a matrix with the vector in the first row Mat T() const { return this->transpose(); } //! Hermitian matrix transpose. Converts to a matrix with the conjugate of the vector in the first row Mat hermitian_transpose() const; //! Hermitian matrix transpose. Converts to a matrix with the conjugate of the vector in the first row Mat H() const { return this->hermitian_transpose(); } //! Addition of vector Vec& operator+=(const Vec &v); //! Addition of scalar Vec& operator+=(Num_T t); //! Addition of two vectors friend Vec operator+<>(const Vec &v1, const Vec &v2); //! Addition of a vector and a scalar friend Vec operator+<>(const Vec &v, Num_T t); //! Addition of a scalar and a vector friend Vec operator+<>(Num_T t, const Vec &v); //! Subtraction of vector Vec& operator-=(const Vec &v); //! Subtraction of scalar Vec& operator-=(Num_T t); //! Subtraction of \c v2 from \c v1 friend Vec operator-<>(const Vec &v1, const Vec &v2); //! Subtraction of scalar from vector friend Vec operator-<>(const Vec &v, Num_T t); //! Subtraction of vector from scalar friend Vec operator-<>(Num_T t, const Vec &v); //! Negation of vector friend Vec operator-<>(const Vec &v); //! Multiply with a scalar Vec& operator*=(Num_T t); //! Elementwise multiplication of vector and scalar friend Vec operator*<>(const Vec &v, Num_T t); //! Elementwise multiplication of vector and scalar friend Vec operator*<>(Num_T t, const Vec &v); //! Elementwise multiplication friend Vec elem_mult<>(const Vec &a, const Vec &b); //! Elementwise multiplication of three vectors friend Vec elem_mult<>(const Vec &a, const Vec &b, const Vec &c); //! Elementwise multiplication of four vectors friend Vec elem_mult<>(const Vec &a, const Vec &b, const Vec &c, const Vec &d); //! Elementwise multiplication, storing the result in vector \c out friend void elem_mult_out<>(const Vec &a, const Vec &b, Vec &out); //! Elementwise multiplication of three vectors, storing the result in vector \c out friend void elem_mult_out<>(const Vec &a, const Vec &b, const Vec &c, Vec &out); //! Elementwise multiplication of four vectors, storing the result in vector \c out friend void elem_mult_out<>(const Vec &a, const Vec &b, const Vec &c, const Vec &d, Vec &out); //! In-place element-wise multiplication of two vectors. Fast version of b = elem_mult(a,b). friend void elem_mult_inplace<>(const Vec &a, Vec &b); //! Element-wise multiplication of two vectors, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b)) friend Num_T elem_mult_sum<>(const Vec &a, const Vec &b); //! Elementwise division Vec& operator/=(Num_T t); //! Elementwise division Vec& operator/=(const Vec &v); //! Elementwise division friend Vec operator/<>(const Vec &v, Num_T t); //! Elementwise division friend Vec operator/<>(Num_T t, const Vec &v); //! Elementwise division friend Vec elem_div<>(const Vec &v1, const Vec &v2); //! This function is deprecated. Please use operator/(Num_T, const Vec &) instead. friend Vec elem_div<>(Num_T t, const Vec &v); //! Elementwise division friend void elem_div_out<>(const Vec &v1, const Vec &v2, Vec &out); //! Elementwise division, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b)) friend Num_T elem_div_sum<>(const Vec &a, const Vec &b); //! Get the right \c nr elements from the vector Vec right(int nr) const; //! Get the left \c nr elements from the vector Vec left(int nr) const; //! Get the middle part of vector from \c start including \c nr elements Vec mid(int start, int nr) const; /*! * \brief Split the vector into two parts at element \c pos. * * Return the first part containing elements 0 to \c pos-1, and keep the * second part containing the remaining elements starting from \c pos * (empty vector if \c pos is equal to the length of the vector). */ Vec split(int pos); //! Shift in element \c t at position 0 \c n times void shift_right(Num_T t, int n = 1); //! Shift in vector \c v at position 0 void shift_right(const Vec &v); //! Shift out the \c n left elements and at the same time shift in the element \c t at last position \c n times void shift_left(Num_T t, int n = 1); //! Shift in vector \c v at last positions void shift_left(const Vec &v); //! Append element \c t to the end of the vector \c v friend Vec concat<>(const Vec &v, Num_T t); //! Insert element \c t at the beginning of the vector \c v friend Vec concat<>(Num_T t, const Vec &v); //! Concatenate vectors \c v1 and \c v2 friend Vec concat<>(const Vec &v1, const Vec &v2); //! Concatenate vectors \c v1, \c v2 and \c v3 friend Vec concat<>(const Vec &v1, const Vec &v2, const Vec &v3); //! Concatenate vectors \c v1, \c v2, \c v3 and \c v4 friend Vec concat<>(const Vec &v1, const Vec &v2, const Vec &v3, const Vec &v4); //! Concatenate vectors \c v1, \c v2, \c v3, \c v4 and \c v5 friend Vec concat<>(const Vec &v1, const Vec &v2, const Vec &v3, const Vec &v4, const Vec &v5); //! This function is deprecated. Please use set_subvector(i, v) instead. void set_subvector(int i1, int i2, const Vec &v); //! Set subvector to elements of vector \c v starting from element \c i void set_subvector(int i, const Vec &v); //! Set subvector defined by indices \c i1 and \c i2 to \c t void set_subvector(int i1, int i2, Num_T t); //! An alias function of set_subvector(i, &v) void replace_mid(int i, const Vec &v); //! Delete element number \c i void del(int i); //! Delete elements from \c i1 to \c i2 void del(int i1, int i2); //! Insert element \c t before element with index \c i (0 <= i <= datasize) void ins(int i, Num_T t); //! Insert vector \c v before element with index \c i (0 <= i <= datasize) void ins(int i, const Vec &v); //! Assign all elements in vector to \c t Vec& operator=(Num_T t); //! Assign vector the value and length of \c v Vec& operator=(const Vec &v); //! Assign vector equal to the 1-dimensional matrix \c m Vec& operator=(const Mat &m); //! Assign vector the values in the string \c str Vec& operator=(const char *str); //! Assign vector the values in the string \c str Vec& operator=(const std::string &str); //! Elementwise equal to the scalar \c t Vec operator==(Num_T t) const; //! Elementwise not-equal to the scalar \c t Vec operator!=(Num_T t) const; //! Elementwise less than the scalar \c t Vec operator<(Num_T t) const; //! Elementwise less than and equal to the scalar \c t Vec operator<=(Num_T t) const; //! Elementwise greater than the scalar \c t Vec operator>(Num_T t) const; //! Elementwise greater than and equal to the scalar \c t Vec operator>=(Num_T t) const; //! Compare with vector \c v. Return false if sizes or values differ. bool operator==(const Vec &v) const; //! Compare with vector \c v. Return true if sizes or values differ. bool operator!=(const Vec &v) const; //! Index operator without boundary check. Not recommended for use. Num_T &_elem(int i) { return data[i]; } //! Index operator without boundary check. Not recommended for use. const Num_T &_elem(int i) const { return data[i]; } //! Get the pointer to the internal structure. Not recommended for use. Num_T *_data() { return data; } //! Get the pointer to the internal structure. Not recommended for use. const Num_T *_data() const { return data; } protected: //! Allocate storage for a vector of length \c size. void alloc(int size); //! Free the storage space allocated by the vector void free(); //! The current number of elements in the vector int datasize; //! A pointer to the data area Num_T *data; //! Element factory (set to DEFAULT_FACTORY to use Num_T default constructors only) const Factory &factory; private: // Clean up and tokenize input initialisation string std::vector tokenize(const std::string &str, bool &abc_format) const; // Parse double and integer values from string tokens Num_T parse_token(const std::string &s) const; // Parse \c a, \c b and \c c values from "a:b:c" format void parse_abc_token(const std::string &s, Num_T &a, Num_T &b, Num_T &c) const; //! Check whether index \c i is in the allowed range bool in_range(int i) const { return ((i < datasize) && (i >= 0)); } }; //----------------------------------------------------------------------------------- // Type definitions of vec, cvec, ivec, svec, and bvec //----------------------------------------------------------------------------------- /*! \relates Vec \brief Definition of double vector type */ typedef Vec vec; /*! \relates Vec \brief Definition of complex vector type */ typedef Vec > cvec; /*! \relates Vec \brief Definition of integer vector type */ typedef Vec ivec; /*! \relates Vec \brief Definition of short vector type */ typedef Vec svec; /*! \relates Vec \brief Definition of binary vector type */ typedef Vec bvec; } //namespace itpp #include namespace itpp { //----------------------------------------------------------------------------------- // Declaration of input and output streams for Vec //----------------------------------------------------------------------------------- /*! \relates Vec \brief Stream output of vector */ template std::ostream &operator<<(std::ostream &os, const Vec &v); /*! \relates Vec \brief Stream input of vector The input can be on the form "1 2 3" or "[1 2 3]", i.e. with or without brackets. The first form is compatible with the set method, while the second form is compatible with the ostream operator. The elements can be separated by blank space or commas. "[]" means an empty vector. "1:4" means "1 2 3 4". "1:3:10" means every third integer from 1 to 10, i.e. "1 4 7 10". */ template std::istream &operator>>(std::istream &is, Vec &v); //----------------------------------------------------------------------------------- // Implementation of templated Vec members and friends //----------------------------------------------------------------------------------- template inline void Vec::alloc(int size) { if (size > 0) { create_elements(data, size, factory); datasize = size; } else { data = 0; datasize = 0; } } template inline void Vec::free() { destroy_elements(data, datasize); datasize = 0; } template inline Vec::Vec(const Factory &f) : datasize(0), data(0), factory(f) {} template inline Vec::Vec(int size, const Factory &f) : datasize(0), data(0), factory(f) { it_assert_debug(size >= 0, "Negative size in Vec::Vec(int)"); alloc(size); } template inline Vec::Vec(const Vec &v) : datasize(0), data(0), factory(v.factory) { alloc(v.datasize); copy_vector(datasize, v.data, data); } template inline Vec::Vec(const Vec &v, const Factory &f) : datasize(0), data(0), factory(f) { alloc(v.datasize); copy_vector(datasize, v.data, data); } template inline Vec::Vec(const char *str, const Factory &f) : datasize(0), data(0), factory(f) { set(std::string(str)); } template inline Vec::Vec(const std::string &str, const Factory &f) : datasize(0), data(0), factory(f) { set(str); } template inline Vec::Vec(const Num_T *c_array, int size, const Factory &f) : datasize(0), data(0), factory(f) { alloc(size); copy_vector(size, c_array, data); } template inline Vec::~Vec() { free(); } template void Vec::set_size(int size, bool copy) { it_assert_debug(size >= 0, "Vec::set_size(): New size must not be negative"); if (datasize == size) return; if (copy) { // create a temporary pointer to the allocated data Num_T* tmp = data; // store the current number of elements int old_datasize = datasize; // check how many elements we need to copy int min = datasize < size ? datasize : size; // allocate new memory alloc(size); // copy old elements into a new memory region copy_vector(min, tmp, data); // initialize the rest of resized vector for (int i = min; i < size; ++i) data[i] = Num_T(0); // delete old elements destroy_elements(tmp, old_datasize); } else { free(); alloc(size); } } template inline const Num_T& Vec::operator[](int i) const { it_assert_debug(in_range(i), "Vec<>::operator[]: Index out of range"); return data[i]; } template inline const Num_T& Vec::operator()(int i) const { return (*this)[i]; } template inline Num_T& Vec::operator[](int i) { it_assert_debug(in_range(i), "Vec<>::operator[]: Index out of range"); return data[i]; } template inline Num_T& Vec::operator()(int i) { return (*this)[i]; } template inline Vec Vec::operator()(int i1, int i2) const { if (i1 == -1) i1 = datasize - 1; if (i2 == -1) i2 = datasize - 1; it_assert_debug((i1 >= 0) && (i1 <= i2) && (i2 < datasize), "Vec<>::operator()(i1, i2): Indexing out of range"); Vec s(i2 - i1 + 1); copy_vector(s.datasize, data + i1, s.data); return s; } template Vec Vec::operator()(const Vec &indexlist) const { int size = indexlist.size(); Vec temp(size); for (int i = 0; i < size; ++i) { it_assert_debug(in_range(indexlist(i)), "Vec<>::operator()(ivec &): " "Index i=" << i << " out of range"); temp(i) = data[indexlist(i)]; } return temp; } template Vec Vec::operator()(const Vec &binlist) const { int size = binlist.size(); it_assert_debug(datasize == size, "Vec<>::operator()(bvec &): " "Wrong size of binlist vector"); Vec temp(size); int j = 0; for (int i = 0; i < size; ++i) if (binlist(i) == bin(1)) temp(j++) = data[i]; temp.set_size(j, true); return temp; } template inline const Num_T& Vec::get(int i) const { return (*this)[i]; } template inline Vec Vec::get(int i1, int i2) const { return (*this)(i1, i2); } template inline Vec Vec::get(const Vec &indexlist) const { return (*this)(indexlist); } template inline Vec Vec::get(const Vec &binlist) const { return (*this)(binlist); } template inline void Vec::zeros() { for (int i = 0; i < datasize; i++) data[i] = Num_T(0); } template inline void Vec::ones() { for (int i = 0; i < datasize; i++) data[i] = Num_T(1); } template inline void Vec::set(int i, Num_T t) { it_assert_debug(in_range(i), "Vec<>::set(i, t): Index out of range"); data[i] = t; } template inline void Vec::set(const std::string &str) { it_error("Vec::set(): Only `double', `complex', `int', " "`short int' and `bin' types supported"); } template inline void Vec::set(const char *str) { set(std::string(str)); } //! \cond template<> ITPP_EXPORT void Vec::set(const std::string &str); template<> ITPP_EXPORT void Vec >::set(const std::string &str); template<> ITPP_EXPORT void Vec::set(const std::string &str); template<> ITPP_EXPORT void Vec::set(const std::string &str); template<> ITPP_EXPORT void Vec::set(const std::string &str); //! \endcond template Mat Vec::transpose() const { Mat temp(1, datasize); copy_vector(datasize, data, temp._data()); return temp; } template Mat Vec::hermitian_transpose() const { Mat temp(1, datasize); copy_vector(datasize, data, temp._data()); return temp; } //! \cond template<> ITPP_EXPORT Mat > Vec >::hermitian_transpose() const; //! \endcond template Vec& Vec::operator+=(const Vec &v) { if (datasize == 0) { // if not assigned a size. if (this != &v) { // check for self addition alloc(v.datasize); copy_vector(datasize, v.data, data); } } else { it_assert_debug(datasize == v.datasize, "Vec::operator+=: Wrong sizes"); for (int i = 0; i < datasize; i++) data[i] += v.data[i]; } return *this; } template inline Vec& Vec::operator+=(Num_T t) { for (int i = 0;i < datasize;i++) data[i] += t; return *this; } template Vec operator+(const Vec &v1, const Vec &v2) { int i; Vec r(v1.datasize); it_assert_debug(v1.datasize == v2.datasize, "Vec::operator+: wrong sizes"); for (i = 0; i < v1.datasize; i++) r.data[i] = v1.data[i] + v2.data[i]; return r; } template Vec operator+(const Vec &v, Num_T t) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = v.data[i] + t; return r; } template Vec operator+(Num_T t, const Vec &v) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = t + v.data[i]; return r; } template Vec& Vec::operator-=(const Vec &v) { if (datasize == 0) { // if not assigned a size. if (this != &v) { // check for self decrementation alloc(v.datasize); for (int i = 0; i < v.datasize; i++) data[i] = -v.data[i]; } } else { it_assert_debug(datasize == v.datasize, "Vec::operator-=: Wrong sizes"); for (int i = 0; i < datasize; i++) data[i] -= v.data[i]; } return *this; } template inline Vec& Vec::operator-=(Num_T t) { for (int i = 0;i < datasize;i++) data[i] -= t; return *this; } template Vec operator-(const Vec &v1, const Vec &v2) { int i; Vec r(v1.datasize); it_assert_debug(v1.datasize == v2.datasize, "Vec::operator-: wrong sizes"); for (i = 0; i < v1.datasize; i++) r.data[i] = v1.data[i] - v2.data[i]; return r; } template Vec operator-(const Vec &v, Num_T t) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = v.data[i] - t; return r; } template Vec operator-(Num_T t, const Vec &v) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = t - v.data[i]; return r; } template Vec operator-(const Vec &v) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = -v.data[i]; return r; } template inline Vec& Vec::operator*=(Num_T t) { scal_vector(datasize, t, data); return *this; } template inline Num_T operator*(const Vec &v1, const Vec &v2) { return dot(v1, v2); } template Num_T dot(const Vec &v1, const Vec &v2) { it_assert_debug(v1.length() == v2.length(), "Vec::dot(): Wrong sizes"); Num_T r = Num_T(0); for (int i = 0; i < v1.length(); ++i) r += v1._data()[i] * v2._data()[i]; return r; } //! \cond template<> ITPP_EXPORT double dot(const vec &v1, const vec &v2); //! \endcond template Mat outer_product(const Vec &v1, const Vec &v2, bool) { it_assert_debug((v1.length() > 0) && (v2.length() > 0), "Vec::outer_product:: Input vector of zero size"); Mat r(v1.length(), v2.length()); for (int i = 0; i < v1.length(); ++i) { for (int j = 0; j < v2.length(); ++j) { r(i, j) = v1._data()[i] * v2._data()[j]; } } return r; } //! \cond template<> ITPP_EXPORT mat outer_product(const vec &v1, const vec &v2, bool); template<> ITPP_EXPORT cmat outer_product(const cvec &v1, const cvec &v2, bool hermitian); //! \endcond template Vec operator*(const Vec &v, Num_T t) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = v.data[i] * t; return r; } template inline Vec operator*(Num_T t, const Vec &v) { return operator*(v, t); } template inline Vec elem_mult(const Vec &a, const Vec &b) { Vec out; elem_mult_out(a, b, out); return out; } template inline Vec elem_mult(const Vec &a, const Vec &b, const Vec &c) { Vec out; elem_mult_out(a, b, c, out); return out; } template inline Vec elem_mult(const Vec &a, const Vec &b, const Vec &c, const Vec &d) { Vec out; elem_mult_out(a, b, c, d, out); return out; } template void elem_mult_out(const Vec &a, const Vec &b, Vec &out) { it_assert_debug(a.datasize == b.datasize, "Vec<>::elem_mult_out(): Wrong sizes"); out.set_size(a.datasize); for (int i = 0; i < a.datasize; i++) out.data[i] = a.data[i] * b.data[i]; } template void elem_mult_out(const Vec &a, const Vec &b, const Vec &c, Vec &out) { it_assert_debug((a.datasize == b.datasize) && (a.datasize == c.datasize), "Vec<>::elem_mult_out(): Wrong sizes"); out.set_size(a.datasize); for (int i = 0; i < a.datasize; i++) out.data[i] = a.data[i] * b.data[i] * c.data[i]; } template void elem_mult_out(const Vec &a, const Vec &b, const Vec &c, const Vec &d, Vec &out) { it_assert_debug((a.datasize == b.datasize) && (a.datasize == c.datasize) && (a.datasize == d.datasize), "Vec<>::elem_mult_out(): Wrong sizes"); out.set_size(a.datasize); for (int i = 0; i < a.datasize; i++) out.data[i] = a.data[i] * b.data[i] * c.data[i] * d.data[i]; } template #ifndef _MSC_VER inline #endif void elem_mult_inplace(const Vec &a, Vec &b) { it_assert_debug(a.datasize == b.datasize, "Vec<>::elem_mult_inplace(): Wrong sizes"); for (int i = 0; i < a.datasize; i++) b.data[i] *= a.data[i]; } template inline Num_T elem_mult_sum(const Vec &a, const Vec &b) { it_assert_debug(a.datasize == b.datasize, "Vec<>::elem_mult_sum(): Wrong sizes"); Num_T acc = 0; for (int i = 0; i < a.datasize; i++) acc += a.data[i] * b.data[i]; return acc; } template Vec operator/(const Vec &v, Num_T t) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = v.data[i] / t; return r; } template Vec operator/(Num_T t, const Vec &v) { int i; Vec r(v.datasize); for (i = 0; i < v.datasize; i++) r.data[i] = t / v.data[i]; return r; } template Vec elem_div(Num_T t, const Vec &v) { it_warning("Vec<>::elem_div(Num_T, const Vec &): This function is " "deprecated and might be removed from future IT++ releases. " "Please use Vec<>::operator/(Num_T, const Vec &) " "instead."); return operator/(t, v); } template inline Vec& Vec::operator/=(Num_T t) { for (int i = 0; i < datasize; ++i) { data[i] /= t; } return *this; } template inline Vec& Vec::operator/=(const Vec &v) { it_assert_debug(datasize == v.datasize, "Vec::operator/=(): wrong sizes"); for (int i = 0; i < datasize; ++i) { data[i] /= v.data[i]; } return *this; } template inline Vec elem_div(const Vec &a, const Vec &b) { Vec out; elem_div_out(a, b, out); return out; } template void elem_div_out(const Vec &a, const Vec &b, Vec &out) { it_assert_debug(a.datasize == b.datasize, "Vecelem_div_out: wrong sizes"); out.set_size(a.size()); for (int i = 0; i < a.datasize; i++) out.data[i] = a.data[i] / b.data[i]; } template inline Num_T elem_div_sum(const Vec &a, const Vec &b) { it_assert_debug(a.datasize == b.datasize, "Vec::elem_div_sum: wrong sizes"); Num_T acc = 0; for (int i = 0; i < a.datasize; i++) acc += a.data[i] / b.data[i]; return acc; } template Vec Vec::right(int nr) const { it_assert_debug(nr <= datasize, "Vec::right(): index out of range"); Vec temp(nr); if (nr > 0) { copy_vector(nr, &data[datasize-nr], temp.data); } return temp; } template Vec Vec::left(int nr) const { it_assert_debug(nr <= datasize, "Vec::left(): index out of range"); Vec temp(nr); if (nr > 0) { copy_vector(nr, data, temp.data); } return temp; } template Vec Vec::mid(int start, int nr) const { it_assert_debug((start >= 0) && ((start + nr) <= datasize), "Vec::mid(): indexing out of range"); Vec temp(nr); if (nr > 0) { copy_vector(nr, &data[start], temp.data); } return temp; } template Vec Vec::split(int pos) { it_assert_debug((pos >= 0) && (pos <= datasize), "Vec<>::split(): Index out of range"); Vec temp1(pos); if (pos > 0) { copy_vector(pos, data, temp1.data); if (pos < datasize) { Vec temp2(datasize - pos); copy_vector(datasize - pos, &data[pos], temp2.data); (*this) = temp2; } else { set_size(0); } } return temp1; } template void Vec::shift_right(Num_T t, int n) { int i = datasize; it_assert_debug(n >= 0, "Vec::shift_right: index out of range"); while (--i >= n) data[i] = data[i-n]; while (i >= 0) data[i--] = t; } template void Vec::shift_right(const Vec &v) { for (int i = datasize - 1; i >= v.datasize; i--) data[i] = data[i-v.datasize]; for (int i = 0; i < v.datasize; i++) data[i] = v[i]; } template void Vec::shift_left(Num_T t, int n) { int i; it_assert_debug(n >= 0, "Vec::shift_left: index out of range"); for (i = 0; i < datasize - n; i++) data[i] = data[i+n]; while (i < datasize) data[i++] = t; } template void Vec::shift_left(const Vec &v) { for (int i = 0; i < datasize - v.datasize; i++) data[i] = data[i+v.datasize]; for (int i = datasize - v.datasize; i < datasize; i++) data[i] = v[i-datasize+v.datasize]; } template Vec concat(const Vec &v, Num_T t) { int size = v.size(); Vec temp(size + 1); copy_vector(size, v.data, temp.data); temp(size) = t; return temp; } template Vec concat(Num_T t, const Vec &v) { int size = v.size(); Vec temp(size + 1); temp(0) = t; copy_vector(size, v.data, &temp.data[1]); return temp; } template Vec concat(const Vec &v1, const Vec &v2) { int size1 = v1.size(); int size2 = v2.size(); Vec temp(size1 + size2); copy_vector(size1, v1.data, temp.data); copy_vector(size2, v2.data, &temp.data[size1]); return temp; } template Vec concat(const Vec &v1, const Vec &v2, const Vec &v3) { int size1 = v1.size(); int size2 = v2.size(); int size3 = v3.size(); Vec temp(size1 + size2 + size3); copy_vector(size1, v1.data, temp.data); copy_vector(size2, v2.data, &temp.data[size1]); copy_vector(size3, v3.data, &temp.data[size1+size2]); return temp; } template Vec concat(const Vec &v1, const Vec &v2, const Vec &v3, const Vec &v4) { int size1 = v1.size(); int size2 = v2.size(); int size3 = v3.size(); int size4 = v4.size(); Vec temp(size1 + size2 + size3 + size4); copy_vector(size1, v1.data, temp.data); copy_vector(size2, v2.data, &temp.data[size1]); copy_vector(size3, v3.data, &temp.data[size1+size2]); copy_vector(size4, v4.data, &temp.data[size1+size2+size3]); return temp; } template Vec concat(const Vec &v1, const Vec &v2, const Vec &v3, const Vec &v4, const Vec &v5) { int size1 = v1.size(); int size2 = v2.size(); int size3 = v3.size(); int size4 = v4.size(); int size5 = v5.size(); Vec temp(size1 + size2 + size3 + size4 + size5); copy_vector(size1, v1.data, temp.data); copy_vector(size2, v2.data, &temp.data[size1]); copy_vector(size3, v3.data, &temp.data[size1+size2]); copy_vector(size4, v4.data, &temp.data[size1+size2+size3]); copy_vector(size5, v5.data, &temp.data[size1+size2+size3+size4]); return temp; } template void Vec::set_subvector(int i1, int, const Vec &v) { it_warning("Vec<>::set_subvector(int, int, const Vec<> &): This function " "is deprecated and might be removed from future IT++ releases. " "Please use Vec<>::set_subvector(int, const Vec<> &) instead."); set_subvector(i1, v); } template inline void Vec:: set_subvector(int i, const Vec &v) { it_assert_debug((i >= 0) && (i + v.datasize <= datasize), "Vec<>::set_subvector(int, const Vec<> &): " "Index out of range or too long input vector"); copy_vector(v.datasize, v.data, data + i); } template inline void Vec::set_subvector(int i1, int i2, Num_T t) { if (i1 == -1) i1 = datasize - 1; if (i2 == -1) i2 = datasize - 1; it_assert_debug((i1 >= 0) && (i1 <= i2) && (i2 < datasize), "Vec<>::set_subvector(int, int, Num_T): Indexing out " "of range"); for (int i = i1; i <= i2; i++) data[i] = t; } template inline void Vec::replace_mid(int i, const Vec &v) { set_subvector(i, v); } template void Vec::del(int index) { it_assert_debug(in_range(index), "Vec<>::del(int): Index out of range"); Vec temp(*this); set_size(datasize - 1, false); copy_vector(index, temp.data, data); copy_vector(datasize - index, &temp.data[index+1], &data[index]); } template void Vec::del(int i1, int i2) { if (i1 == -1) i1 = datasize - 1; if (i2 == -1) i2 = datasize - 1; it_assert_debug((i1 >= 0) && (i1 <= i2) && (i2 < datasize), "Vec<>::del(int, int): Indexing out of range"); Vec temp(*this); int new_size = datasize - (i2 - i1 + 1); set_size(new_size, false); copy_vector(i1, temp.data, data); copy_vector(datasize - i1, &temp.data[i2+1], &data[i1]); } template void Vec::ins(int index, const Num_T t) { it_assert_debug((index >= 0) && (index <= datasize), "Vec<>::ins(): Index out of range"); Vec Temp(*this); set_size(datasize + 1, false); copy_vector(index, Temp.data, data); data[index] = t; copy_vector(Temp.datasize - index, Temp.data + index, data + index + 1); } template void Vec::ins(int index, const Vec &v) { it_assert_debug((index >= 0) && (index <= datasize), "Vec<>::ins(): Index out of range"); Vec Temp(*this); set_size(datasize + v.length(), false); copy_vector(index, Temp.data, data); copy_vector(v.size(), v.data, &data[index]); copy_vector(Temp.datasize - index, Temp.data + index, data + index + v.size()); } template inline Vec& Vec::operator=(Num_T t) { for (int i = 0;i < datasize;i++) data[i] = t; return *this; } template inline Vec& Vec::operator=(const Vec &v) { if (this != &v) { set_size(v.datasize, false); copy_vector(datasize, v.data, data); } return *this; } template Vec& Vec::operator=(const Mat &m) { if (m.cols() == 1) { set_size(m.rows(), false); copy_vector(m.rows(), m._data(), data); } else if (m.rows() == 1) { set_size(m.cols(), false); copy_vector(m.cols(), m._data(), m.rows(), data, 1); } else it_error("Vec<>::operator=(Mat &): Wrong size of input matrix"); return *this; } template inline Vec& Vec::operator=(const char *str) { set(std::string(str)); return *this; } template inline Vec& Vec::operator=(const std::string &str) { set(str); return *this; } template bvec Vec::operator==(Num_T t) const { it_assert_debug(datasize > 0, "Vec<>::operator==(): Wrong size"); bvec temp(datasize); for (int i = 0; i < datasize; i++) temp(i) = (data[i] == t); return temp; } template bvec Vec::operator!=(Num_T t) const { it_assert_debug(datasize > 0, "Vec<>::operator!=(): Wrong size"); bvec temp(datasize); for (int i = 0; i < datasize; i++) temp(i) = (data[i] != t); return temp; } //! \cond template<> bvec Vec >::operator<(std::complex) const; //! \endcond template bvec Vec::operator<(Num_T t) const { it_assert_debug(datasize > 0, "Vec<>::operator<(): Wrong size"); bvec temp(datasize); for (int i = 0; i < datasize; i++) temp(i) = (data[i] < t); return temp; } template bvec Vec::operator<=(Num_T t) const { it_assert_debug(datasize > 0, "Vec<>::operator<=(): Wrong size"); bvec temp(datasize); for (int i = 0; i < datasize; i++) temp(i) = (data[i] <= t); return temp; } //! \cond template<> ITPP_EXPORT bvec Vec >::operator<=(std::complex) const; //! \endcond template bvec Vec::operator>(Num_T t) const { it_assert_debug(datasize > 0, "Vec<>::operator>(): Wrong size"); bvec temp(datasize); for (int i = 0; i < datasize; i++) temp(i) = (data[i] > t); return temp; } //! \cond template<> ITPP_EXPORT bvec Vec >::operator>(std::complex) const; //! \endcond template bvec Vec::operator>=(Num_T t) const { it_assert_debug(datasize > 0, "Vec<>::operator>=(): Wrong size"); bvec temp(datasize); for (int i = 0; i < datasize; i++) temp(i) = (data[i] >= t); return temp; } //! \cond template<> ITPP_EXPORT bvec Vec >::operator>=(std::complex) const; //! \endcond template bool Vec::operator==(const Vec &invector) const { // OBS ! if wrong size, return false if (datasize != invector.datasize) return false; for (int i = 0;i < datasize;i++) { if (data[i] != invector.data[i]) return false; } return true; } template bool Vec::operator!=(const Vec &invector) const { if (datasize != invector.datasize) return true; for (int i = 0;i < datasize;i++) { if (data[i] != invector.data[i]) return true; } return false; } //! Output stream operator of a vector \c v template std::ostream &operator<<(std::ostream &os, const Vec &v) { int i, sz = v.length(); os << "[" ; for (i = 0; i < sz; i++) { os << v(i) ; if (i < sz - 1) os << " "; } os << "]" ; return os; } //! Input stream operator to read a vector template std::istream &operator>>(std::istream &is, Vec &v) { std::ostringstream buffer; bool started = false; bool finished = false; bool brackets = false; char c = 0; while (!finished) { if (is.eof()) { finished = true; } else { is.get(c); if (is.eof() || (c == '\n')) { if (brackets) { // Right bracket missing is.setstate(std::ios_base::failbit); finished = true; } else if (!((c == '\n') && !started)) { finished = true; } } else if ((c == ' ') || (c == '\t')) { if (started) { buffer << ' '; } } else if (c == '[') { if (started) { // Unexpected left bracket is.setstate(std::ios_base::failbit); finished = true; } else { started = true; brackets = true; } } else if (c == ']') { if (!started || !brackets) { // Unexpected right bracket is.setstate(std::ios_base::failbit); finished = true; } else { finished = true; } while (!is.eof() && (((c = static_cast(is.peek())) == ' ') || (c == '\t'))) { is.get(); } if (!is.eof() && (c == '\n')) { is.get(); } } else { started = true; buffer << c; } } } if (!started) { v.set_size(0, false); } else { v.set(buffer.str()); } return is; } //! \cond // ---------------------------------------------------------------------- // Private functions // ---------------------------------------------------------------------- template void Vec::parse_abc_token(const std::string &s, Num_T &a, Num_T &b, Num_T &c) const { std::string::size_type beg = 0; std::string::size_type end = s.find(':', 0); a = parse_token(s.substr(beg, end-beg)); beg = end + 1; end = s.find(':', beg); if (end != std::string::npos) { b = parse_token(s.substr(beg, end-beg)); c = parse_token(s.substr(end+1, s.size()-end)); } else { b = Num_T(1); c = parse_token(s.substr(beg, end-beg-1)); } } template Num_T Vec::parse_token(const std::string &s) const { it_error("Vec::parse_token(): Only `double' and `int' types are supported"); return 0; } //! \cond template<> ITPP_EXPORT double Vec::parse_token(const std::string &s) const; template<> ITPP_EXPORT int Vec::parse_token(const std::string &s) const; //! \endcond template std::vector Vec::tokenize(const std::string &str_in, bool &abc_format) const { std::vector vs; // vector for storing parsed tokens std::string s; // currently processed token string bool start = true; bool space = false; bool colon = false; bool comma = false; bool lparen = false; abc_format = false; for (std::string::size_type i = 0; i < str_in.size(); ++i) { char c = str_in[i]; switch (c) { case ' ': case '\t': space = true; // set flag for whitespaces break; case ',': if (lparen) comma = true; // set flag for comma in "(re,im)" format else space = true; // otherwise treat comma as separator break; case ')': s.push_back('i'); // replace right paren in "(re,im)" with 'i' break; case ':': colon = true; // set flag for "a:b[:c]" format string space = false; // reset flag for whitespaces abc_format = true; // set external flag for "a:b[:c]" format s.push_back(c); break; case '(': lparen = true; // set flag for complex "(re,im)" format break; default: if (colon) { // reset colon and space flags colon = false; // to get rid of whitespaces around ":" space = false; } else if (lparen && comma) { // support for "(re,im)" format lparen = false; comma = false; space = false; if ((c != '-') && (c != '+')) // if needed s.push_back('+'); // insert '+' between "re" and "im" } else if (space) { // new token detected space = false; if (!start) { // if not at the beginning of the string vs.push_back(s); // store already parsed token s.clear(); // and start parsing the next token } } s.push_back(c); // append next character to the current token start = false; // reset the "beginning of the string" flag break; } } if (!s.empty()) // if the final token is not an empty string vs.push_back(s); // store it in the output vector return vs; } // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Vec; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Vec; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Vec; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Vec >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Vec; // addition operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator+(const vec &v1, const vec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator+(const cvec &v1, const cvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator+(const ivec &v1, const ivec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator+(const svec &v1, const svec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator+(const bvec &v1, const bvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator+(const vec &v1, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator+(const cvec &v1, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator+(const ivec &v1, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator+(const svec &v1, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator+(const bvec &v1, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator+(double t, const vec &v1); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator+(std::complex t, const cvec &v1); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator+(int t, const ivec &v1); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator+(short t, const svec &v1); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator+(bin t, const bvec &v1); // subtraction operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator-(const vec &v1, const vec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator-(const cvec &v1, const cvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator-(const ivec &v1, const ivec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator-(const svec &v1, const svec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator-(const bvec &v1, const bvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator-(const vec &v, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator-(const cvec &v, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator-(const ivec &v, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator-(const svec &v, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator-(const bvec &v, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator-(double t, const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator-(std::complex t, const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator-(int t, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator-(short t, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator-(bin t, const bvec &v); // unary minus ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator-(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator-(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator-(const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator-(const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator-(const bvec &v); // multiplication operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex dot(const cvec &v1, const cvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int dot(const ivec &v1, const ivec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short dot(const svec &v1, const svec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin dot(const bvec &v1, const bvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double operator*(const vec &v1, const vec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex operator*(const cvec &v1, const cvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int operator*(const ivec &v1, const ivec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short operator*(const svec &v1, const svec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin operator*(const bvec &v1, const bvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat outer_product(const ivec &v1, const ivec &v2, bool hermitian); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat outer_product(const svec &v1, const svec &v2, bool hermitian); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat outer_product(const bvec &v1, const bvec &v2, bool hermitian); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator*(const vec &v, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator*(const cvec &v, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator*(const ivec &v, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator*(const svec &v, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator*(const bvec &v, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator*(double t, const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator*(std::complex t, const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator*(int t, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator*(short t, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator*(bin t, const bvec &v); // elementwise multiplication ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_mult(const vec &a, const vec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_mult(const cvec &a, const cvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_mult(const ivec &a, const ivec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec elem_mult(const svec &a, const svec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec elem_mult(const bvec &a, const bvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const vec &a, const vec &b, vec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const cvec &a, const cvec &b, cvec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const ivec &a, const ivec &b, ivec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const svec &a, const svec &b, svec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const bvec &a, const bvec &b, bvec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_mult(const vec &a, const vec &b, const vec &c); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_mult(const cvec &a, const cvec &b, const cvec &c); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_mult(const ivec &a, const ivec &b, const ivec &c); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec elem_mult(const svec &a, const svec &b, const svec &c); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec elem_mult(const bvec &a, const bvec &b, const bvec &c); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const vec &a, const vec &b, const vec &c, vec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const cvec &a, const cvec &b, const cvec &c, cvec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const ivec &a, const ivec &b, const ivec &c, ivec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const svec &a, const svec &b, const svec &c, svec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const bvec &a, const bvec &b, const bvec &c, bvec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_mult(const vec &a, const vec &b, const vec &c, const vec &d); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_mult(const cvec &a, const cvec &b, const cvec &c, const cvec &d); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_mult(const ivec &a, const ivec &b, const ivec &c, const ivec &d); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec elem_mult(const svec &a, const svec &b, const svec &c, const svec &d); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec elem_mult(const bvec &a, const bvec &b, const bvec &c, const bvec &d); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const vec &a, const vec &b, const vec &c, const vec &d, vec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const cvec &a, const cvec &b, const cvec &c, const cvec &d, cvec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const ivec &a, const ivec &b, const ivec &c, const ivec &d, ivec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const svec &a, const svec &b, const svec &c, const svec &d, svec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_out(const bvec &a, const bvec &b, const bvec &c, const bvec &d, bvec &out); // in-place elementwise multiplication ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const vec &a, vec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const cvec &a, cvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const ivec &a, ivec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const svec &a, svec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_mult_inplace(const bvec &a, bvec &b); // elementwise multiplication followed by summation ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double elem_mult_sum(const vec &a, const vec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex elem_mult_sum(const cvec &a, const cvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int elem_mult_sum(const ivec &a, const ivec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short elem_mult_sum(const svec &a, const svec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin elem_mult_sum(const bvec &a, const bvec &b); // division operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator/(const vec &v, double t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator/(const cvec &v, std::complex t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator/(const ivec &v, int t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator/(const svec &v, short t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator/(const bvec &v, bin t); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec operator/(double t, const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec operator/(std::complex t, const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec operator/(int t, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec operator/(short t, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec operator/(bin t, const bvec &v); // elementwise division operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_div(const vec &a, const vec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_div(const cvec &a, const cvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_div(const ivec &a, const ivec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec elem_div(const svec &a, const svec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec elem_div(const bvec &a, const bvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec elem_div(double t, const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec elem_div(std::complex t, const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec elem_div(int t, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec elem_div(short t, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec elem_div(bin t, const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const vec &a, const vec &b, vec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const cvec &a, const cvec &b, cvec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const ivec &a, const ivec &b, ivec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const svec &a, const svec &b, svec &out); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void elem_div_out(const bvec &a, const bvec &b, bvec &out); // elementwise division followed by summation ITPP_EXPORT_TEMPLATE template ITPP_EXPORT double elem_div_sum(const vec &a, const vec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::complex elem_div_sum(const cvec &a, const cvec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT int elem_div_sum(const ivec &a, const ivec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT short elem_div_sum(const svec &a, const svec &b); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bin elem_div_sum(const bvec &a, const bvec &b); // concat operator ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec concat(const vec &v, double a); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec concat(const cvec &v, std::complex a); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec concat(const ivec &v, int a); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec concat(const svec &v, short a); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec concat(const bvec &v, bin a); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec concat(double a, const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec concat(std::complex a, const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec concat(int a, const ivec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec concat(short a, const svec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec concat(bin a, const bvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec concat(const vec &v1, const vec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec concat(const svec &v1, const svec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec concat(const vec &v1, const vec &v2, const vec &v3); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2, const cvec &v3); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2, const ivec &v3); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec concat(const svec &v1, const svec &v2, const svec &v3); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2, const bvec &v3); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec concat(const vec &v1, const vec &v2, const vec &v3, const vec &v4); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2, const cvec &v3, const cvec &v4); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2, const ivec &v3, const ivec &v4); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec concat(const svec &v1, const svec &v2, const svec &v3, const svec &v4); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2, const bvec &v3, const bvec &v4); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec concat(const vec &v1, const vec &v2, const vec &v3, const vec &v4, const vec &v5); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec concat(const cvec &v1, const cvec &v2, const cvec &v3, const cvec &v4, const cvec &v5); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec concat(const ivec &v1, const ivec &v2, const ivec &v3, const ivec &v4, const ivec &v5); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec concat(const svec &v1, const svec &v2, const svec &v3, const svec &v4, const svec &v5); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec concat(const bvec &v1, const bvec &v2, const bvec &v3, const bvec &v4, const bvec &v5); // I/O streams ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const vec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const cvec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const svec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const ivec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::ostream &operator<<(std::ostream& os, const bvec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream& is, vec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream& is, cvec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream& is, svec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream& is, ivec &vect); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT std::istream &operator>>(std::istream& is, bvec &vect); //! \endcond } // namespace itpp #endif // #ifndef VEC_H itpp-4.3.1/itpp/comm/000077500000000000000000000000001216575753400144215ustar00rootroot00000000000000itpp-4.3.1/itpp/comm/Makefile.am000066400000000000000000000007121216575753400164550ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libcomm.la if ENABLE_DEBUG noinst_LTLIBRARIES += libcomm_debug.la endif libcomm_la_SOURCES = $(h_comm_sources) $(cpp_comm_sources) libcomm_la_CXXFLAGS = $(CXXFLAGS_OPT) libcomm_debug_la_SOURCES = $(h_comm_sources) $(cpp_comm_sources) libcomm_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/comm pkginclude_HEADERS = $(h_comm_sources) itpp-4.3.1/itpp/comm/Makefile.in000066400000000000000000002724331216575753400165010ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libcomm_debug.la subdir = itpp/comm ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcomm_la_LIBADD = am__objects_1 = am__objects_2 = libcomm_la-bch.lo libcomm_la-channel.lo \ libcomm_la-commfunc.lo libcomm_la-convcode.lo \ libcomm_la-crc.lo libcomm_la-egolay.lo \ libcomm_la-error_counters.lo libcomm_la-exit.lo \ libcomm_la-galois.lo libcomm_la-hammcode.lo \ libcomm_la-interleave.lo libcomm_la-ldpc.lo libcomm_la-llr.lo \ libcomm_la-modulator.lo libcomm_la-modulator_nd.lo \ libcomm_la-ofdm.lo libcomm_la-pulse_shape.lo \ libcomm_la-punct_convcode.lo libcomm_la-rec_syst_conv_code.lo \ libcomm_la-reedsolomon.lo libcomm_la-sequence.lo \ libcomm_la-siso_dem.lo libcomm_la-siso_eq.lo \ libcomm_la-siso_mud.lo libcomm_la-siso_nsc.lo \ libcomm_la-siso_rsc.lo libcomm_la-spread.lo libcomm_la-stc.lo \ libcomm_la-turbo.lo am_libcomm_la_OBJECTS = $(am__objects_1) $(am__objects_2) libcomm_la_OBJECTS = $(am_libcomm_la_OBJECTS) libcomm_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libcomm_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libcomm_debug_la_LIBADD = am__objects_3 = libcomm_debug_la-bch.lo libcomm_debug_la-channel.lo \ libcomm_debug_la-commfunc.lo libcomm_debug_la-convcode.lo \ libcomm_debug_la-crc.lo libcomm_debug_la-egolay.lo \ libcomm_debug_la-error_counters.lo libcomm_debug_la-exit.lo \ libcomm_debug_la-galois.lo libcomm_debug_la-hammcode.lo \ libcomm_debug_la-interleave.lo libcomm_debug_la-ldpc.lo \ libcomm_debug_la-llr.lo libcomm_debug_la-modulator.lo \ libcomm_debug_la-modulator_nd.lo libcomm_debug_la-ofdm.lo \ libcomm_debug_la-pulse_shape.lo \ libcomm_debug_la-punct_convcode.lo \ libcomm_debug_la-rec_syst_conv_code.lo \ libcomm_debug_la-reedsolomon.lo libcomm_debug_la-sequence.lo \ libcomm_debug_la-siso_dem.lo libcomm_debug_la-siso_eq.lo \ libcomm_debug_la-siso_mud.lo libcomm_debug_la-siso_nsc.lo \ libcomm_debug_la-siso_rsc.lo libcomm_debug_la-spread.lo \ libcomm_debug_la-stc.lo libcomm_debug_la-turbo.lo am_libcomm_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libcomm_debug_la_OBJECTS = $(am_libcomm_debug_la_OBJECTS) libcomm_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libcomm_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcomm_la_SOURCES) $(libcomm_debug_la_SOURCES) DIST_SOURCES = $(libcomm_la_SOURCES) $(libcomm_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/comm ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_comm_sources = \ $(top_srcdir)/itpp/comm/bch.h \ $(top_srcdir)/itpp/comm/channel_code.h \ $(top_srcdir)/itpp/comm/channel.h \ $(top_srcdir)/itpp/comm/commfunc.h \ $(top_srcdir)/itpp/comm/convcode.h \ $(top_srcdir)/itpp/comm/crc.h \ $(top_srcdir)/itpp/comm/egolay.h \ $(top_srcdir)/itpp/comm/error_counters.h \ $(top_srcdir)/itpp/comm/exit.h \ $(top_srcdir)/itpp/comm/galois.h \ $(top_srcdir)/itpp/comm/hammcode.h \ $(top_srcdir)/itpp/comm/interleave.h \ $(top_srcdir)/itpp/comm/ldpc.h \ $(top_srcdir)/itpp/comm/llr.h \ $(top_srcdir)/itpp/comm/modulator.h \ $(top_srcdir)/itpp/comm/modulator_nd.h \ $(top_srcdir)/itpp/comm/ofdm.h \ $(top_srcdir)/itpp/comm/pulse_shape.h \ $(top_srcdir)/itpp/comm/punct_convcode.h \ $(top_srcdir)/itpp/comm/rec_syst_conv_code.h \ $(top_srcdir)/itpp/comm/reedsolomon.h \ $(top_srcdir)/itpp/comm/sequence.h \ $(top_srcdir)/itpp/comm/siso.h \ $(top_srcdir)/itpp/comm/spread.h \ $(top_srcdir)/itpp/comm/stc.h \ $(top_srcdir)/itpp/comm/turbo.h cpp_comm_sources = \ $(top_srcdir)/itpp/comm/bch.cpp \ $(top_srcdir)/itpp/comm/channel.cpp \ $(top_srcdir)/itpp/comm/commfunc.cpp \ $(top_srcdir)/itpp/comm/convcode.cpp \ $(top_srcdir)/itpp/comm/crc.cpp \ $(top_srcdir)/itpp/comm/egolay.cpp \ $(top_srcdir)/itpp/comm/error_counters.cpp \ $(top_srcdir)/itpp/comm/exit.cpp \ $(top_srcdir)/itpp/comm/galois.cpp \ $(top_srcdir)/itpp/comm/hammcode.cpp \ $(top_srcdir)/itpp/comm/interleave.cpp \ $(top_srcdir)/itpp/comm/ldpc.cpp \ $(top_srcdir)/itpp/comm/llr.cpp \ $(top_srcdir)/itpp/comm/modulator.cpp \ $(top_srcdir)/itpp/comm/modulator_nd.cpp \ $(top_srcdir)/itpp/comm/ofdm.cpp \ $(top_srcdir)/itpp/comm/pulse_shape.cpp \ $(top_srcdir)/itpp/comm/punct_convcode.cpp \ $(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp \ $(top_srcdir)/itpp/comm/reedsolomon.cpp \ $(top_srcdir)/itpp/comm/sequence.cpp \ $(top_srcdir)/itpp/comm/siso_dem.cpp \ $(top_srcdir)/itpp/comm/siso_eq.cpp \ $(top_srcdir)/itpp/comm/siso_mud.cpp \ $(top_srcdir)/itpp/comm/siso_nsc.cpp \ $(top_srcdir)/itpp/comm/siso_rsc.cpp \ $(top_srcdir)/itpp/comm/spread.cpp \ $(top_srcdir)/itpp/comm/stc.cpp \ $(top_srcdir)/itpp/comm/turbo.cpp noinst_LTLIBRARIES = libcomm.la $(am__append_1) libcomm_la_SOURCES = $(h_comm_sources) $(cpp_comm_sources) libcomm_la_CXXFLAGS = $(CXXFLAGS_OPT) libcomm_debug_la_SOURCES = $(h_comm_sources) $(cpp_comm_sources) libcomm_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_comm_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/comm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/comm/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcomm.la: $(libcomm_la_OBJECTS) $(libcomm_la_DEPENDENCIES) $(libcomm_la_LINK) $(libcomm_la_OBJECTS) $(libcomm_la_LIBADD) $(LIBS) libcomm_debug.la: $(libcomm_debug_la_OBJECTS) $(libcomm_debug_la_DEPENDENCIES) $(libcomm_debug_la_LINK) $(am_libcomm_debug_la_rpath) $(libcomm_debug_la_OBJECTS) $(libcomm_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-bch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-channel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-commfunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-convcode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-crc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-egolay.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-error_counters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-exit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-galois.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-hammcode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-interleave.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-ldpc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-llr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-modulator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-modulator_nd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-ofdm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-pulse_shape.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-punct_convcode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-rec_syst_conv_code.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-reedsolomon.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-sequence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-siso_dem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-siso_eq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-siso_mud.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-siso_nsc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-siso_rsc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-spread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-stc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_debug_la-turbo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-bch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-channel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-commfunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-convcode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-crc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-egolay.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-error_counters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-exit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-galois.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-hammcode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-interleave.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-ldpc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-llr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-modulator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-modulator_nd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-ofdm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-pulse_shape.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-punct_convcode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-rec_syst_conv_code.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-reedsolomon.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-sequence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-siso_dem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-siso_eq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-siso_mud.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-siso_nsc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-siso_rsc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-spread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-stc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcomm_la-turbo.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libcomm_la-bch.lo: $(top_srcdir)/itpp/comm/bch.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-bch.lo -MD -MP -MF $(DEPDIR)/libcomm_la-bch.Tpo -c -o libcomm_la-bch.lo `test -f '$(top_srcdir)/itpp/comm/bch.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/bch.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-bch.Tpo $(DEPDIR)/libcomm_la-bch.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/bch.cpp' object='libcomm_la-bch.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-bch.lo `test -f '$(top_srcdir)/itpp/comm/bch.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/bch.cpp libcomm_la-channel.lo: $(top_srcdir)/itpp/comm/channel.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-channel.lo -MD -MP -MF $(DEPDIR)/libcomm_la-channel.Tpo -c -o libcomm_la-channel.lo `test -f '$(top_srcdir)/itpp/comm/channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/channel.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-channel.Tpo $(DEPDIR)/libcomm_la-channel.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/channel.cpp' object='libcomm_la-channel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-channel.lo `test -f '$(top_srcdir)/itpp/comm/channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/channel.cpp libcomm_la-commfunc.lo: $(top_srcdir)/itpp/comm/commfunc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-commfunc.lo -MD -MP -MF $(DEPDIR)/libcomm_la-commfunc.Tpo -c -o libcomm_la-commfunc.lo `test -f '$(top_srcdir)/itpp/comm/commfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/commfunc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-commfunc.Tpo $(DEPDIR)/libcomm_la-commfunc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/commfunc.cpp' object='libcomm_la-commfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-commfunc.lo `test -f '$(top_srcdir)/itpp/comm/commfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/commfunc.cpp libcomm_la-convcode.lo: $(top_srcdir)/itpp/comm/convcode.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-convcode.lo -MD -MP -MF $(DEPDIR)/libcomm_la-convcode.Tpo -c -o libcomm_la-convcode.lo `test -f '$(top_srcdir)/itpp/comm/convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/convcode.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-convcode.Tpo $(DEPDIR)/libcomm_la-convcode.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/convcode.cpp' object='libcomm_la-convcode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-convcode.lo `test -f '$(top_srcdir)/itpp/comm/convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/convcode.cpp libcomm_la-crc.lo: $(top_srcdir)/itpp/comm/crc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-crc.lo -MD -MP -MF $(DEPDIR)/libcomm_la-crc.Tpo -c -o libcomm_la-crc.lo `test -f '$(top_srcdir)/itpp/comm/crc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/crc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-crc.Tpo $(DEPDIR)/libcomm_la-crc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/crc.cpp' object='libcomm_la-crc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-crc.lo `test -f '$(top_srcdir)/itpp/comm/crc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/crc.cpp libcomm_la-egolay.lo: $(top_srcdir)/itpp/comm/egolay.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-egolay.lo -MD -MP -MF $(DEPDIR)/libcomm_la-egolay.Tpo -c -o libcomm_la-egolay.lo `test -f '$(top_srcdir)/itpp/comm/egolay.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/egolay.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-egolay.Tpo $(DEPDIR)/libcomm_la-egolay.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/egolay.cpp' object='libcomm_la-egolay.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-egolay.lo `test -f '$(top_srcdir)/itpp/comm/egolay.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/egolay.cpp libcomm_la-error_counters.lo: $(top_srcdir)/itpp/comm/error_counters.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-error_counters.lo -MD -MP -MF $(DEPDIR)/libcomm_la-error_counters.Tpo -c -o libcomm_la-error_counters.lo `test -f '$(top_srcdir)/itpp/comm/error_counters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/error_counters.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-error_counters.Tpo $(DEPDIR)/libcomm_la-error_counters.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/error_counters.cpp' object='libcomm_la-error_counters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-error_counters.lo `test -f '$(top_srcdir)/itpp/comm/error_counters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/error_counters.cpp libcomm_la-exit.lo: $(top_srcdir)/itpp/comm/exit.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-exit.lo -MD -MP -MF $(DEPDIR)/libcomm_la-exit.Tpo -c -o libcomm_la-exit.lo `test -f '$(top_srcdir)/itpp/comm/exit.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/exit.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-exit.Tpo $(DEPDIR)/libcomm_la-exit.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/exit.cpp' object='libcomm_la-exit.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-exit.lo `test -f '$(top_srcdir)/itpp/comm/exit.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/exit.cpp libcomm_la-galois.lo: $(top_srcdir)/itpp/comm/galois.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-galois.lo -MD -MP -MF $(DEPDIR)/libcomm_la-galois.Tpo -c -o libcomm_la-galois.lo `test -f '$(top_srcdir)/itpp/comm/galois.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/galois.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-galois.Tpo $(DEPDIR)/libcomm_la-galois.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/galois.cpp' object='libcomm_la-galois.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-galois.lo `test -f '$(top_srcdir)/itpp/comm/galois.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/galois.cpp libcomm_la-hammcode.lo: $(top_srcdir)/itpp/comm/hammcode.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-hammcode.lo -MD -MP -MF $(DEPDIR)/libcomm_la-hammcode.Tpo -c -o libcomm_la-hammcode.lo `test -f '$(top_srcdir)/itpp/comm/hammcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/hammcode.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-hammcode.Tpo $(DEPDIR)/libcomm_la-hammcode.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/hammcode.cpp' object='libcomm_la-hammcode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-hammcode.lo `test -f '$(top_srcdir)/itpp/comm/hammcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/hammcode.cpp libcomm_la-interleave.lo: $(top_srcdir)/itpp/comm/interleave.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-interleave.lo -MD -MP -MF $(DEPDIR)/libcomm_la-interleave.Tpo -c -o libcomm_la-interleave.lo `test -f '$(top_srcdir)/itpp/comm/interleave.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/interleave.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-interleave.Tpo $(DEPDIR)/libcomm_la-interleave.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/interleave.cpp' object='libcomm_la-interleave.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-interleave.lo `test -f '$(top_srcdir)/itpp/comm/interleave.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/interleave.cpp libcomm_la-ldpc.lo: $(top_srcdir)/itpp/comm/ldpc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-ldpc.lo -MD -MP -MF $(DEPDIR)/libcomm_la-ldpc.Tpo -c -o libcomm_la-ldpc.lo `test -f '$(top_srcdir)/itpp/comm/ldpc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ldpc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-ldpc.Tpo $(DEPDIR)/libcomm_la-ldpc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/ldpc.cpp' object='libcomm_la-ldpc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-ldpc.lo `test -f '$(top_srcdir)/itpp/comm/ldpc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ldpc.cpp libcomm_la-llr.lo: $(top_srcdir)/itpp/comm/llr.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-llr.lo -MD -MP -MF $(DEPDIR)/libcomm_la-llr.Tpo -c -o libcomm_la-llr.lo `test -f '$(top_srcdir)/itpp/comm/llr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/llr.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-llr.Tpo $(DEPDIR)/libcomm_la-llr.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/llr.cpp' object='libcomm_la-llr.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-llr.lo `test -f '$(top_srcdir)/itpp/comm/llr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/llr.cpp libcomm_la-modulator.lo: $(top_srcdir)/itpp/comm/modulator.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-modulator.lo -MD -MP -MF $(DEPDIR)/libcomm_la-modulator.Tpo -c -o libcomm_la-modulator.lo `test -f '$(top_srcdir)/itpp/comm/modulator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-modulator.Tpo $(DEPDIR)/libcomm_la-modulator.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/modulator.cpp' object='libcomm_la-modulator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-modulator.lo `test -f '$(top_srcdir)/itpp/comm/modulator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator.cpp libcomm_la-modulator_nd.lo: $(top_srcdir)/itpp/comm/modulator_nd.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-modulator_nd.lo -MD -MP -MF $(DEPDIR)/libcomm_la-modulator_nd.Tpo -c -o libcomm_la-modulator_nd.lo `test -f '$(top_srcdir)/itpp/comm/modulator_nd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator_nd.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-modulator_nd.Tpo $(DEPDIR)/libcomm_la-modulator_nd.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/modulator_nd.cpp' object='libcomm_la-modulator_nd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-modulator_nd.lo `test -f '$(top_srcdir)/itpp/comm/modulator_nd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator_nd.cpp libcomm_la-ofdm.lo: $(top_srcdir)/itpp/comm/ofdm.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-ofdm.lo -MD -MP -MF $(DEPDIR)/libcomm_la-ofdm.Tpo -c -o libcomm_la-ofdm.lo `test -f '$(top_srcdir)/itpp/comm/ofdm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ofdm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-ofdm.Tpo $(DEPDIR)/libcomm_la-ofdm.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/ofdm.cpp' object='libcomm_la-ofdm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-ofdm.lo `test -f '$(top_srcdir)/itpp/comm/ofdm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ofdm.cpp libcomm_la-pulse_shape.lo: $(top_srcdir)/itpp/comm/pulse_shape.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-pulse_shape.lo -MD -MP -MF $(DEPDIR)/libcomm_la-pulse_shape.Tpo -c -o libcomm_la-pulse_shape.lo `test -f '$(top_srcdir)/itpp/comm/pulse_shape.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/pulse_shape.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-pulse_shape.Tpo $(DEPDIR)/libcomm_la-pulse_shape.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/pulse_shape.cpp' object='libcomm_la-pulse_shape.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-pulse_shape.lo `test -f '$(top_srcdir)/itpp/comm/pulse_shape.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/pulse_shape.cpp libcomm_la-punct_convcode.lo: $(top_srcdir)/itpp/comm/punct_convcode.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-punct_convcode.lo -MD -MP -MF $(DEPDIR)/libcomm_la-punct_convcode.Tpo -c -o libcomm_la-punct_convcode.lo `test -f '$(top_srcdir)/itpp/comm/punct_convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/punct_convcode.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-punct_convcode.Tpo $(DEPDIR)/libcomm_la-punct_convcode.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/punct_convcode.cpp' object='libcomm_la-punct_convcode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-punct_convcode.lo `test -f '$(top_srcdir)/itpp/comm/punct_convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/punct_convcode.cpp libcomm_la-rec_syst_conv_code.lo: $(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-rec_syst_conv_code.lo -MD -MP -MF $(DEPDIR)/libcomm_la-rec_syst_conv_code.Tpo -c -o libcomm_la-rec_syst_conv_code.lo `test -f '$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-rec_syst_conv_code.Tpo $(DEPDIR)/libcomm_la-rec_syst_conv_code.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp' object='libcomm_la-rec_syst_conv_code.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-rec_syst_conv_code.lo `test -f '$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp libcomm_la-reedsolomon.lo: $(top_srcdir)/itpp/comm/reedsolomon.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-reedsolomon.lo -MD -MP -MF $(DEPDIR)/libcomm_la-reedsolomon.Tpo -c -o libcomm_la-reedsolomon.lo `test -f '$(top_srcdir)/itpp/comm/reedsolomon.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/reedsolomon.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-reedsolomon.Tpo $(DEPDIR)/libcomm_la-reedsolomon.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/reedsolomon.cpp' object='libcomm_la-reedsolomon.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-reedsolomon.lo `test -f '$(top_srcdir)/itpp/comm/reedsolomon.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/reedsolomon.cpp libcomm_la-sequence.lo: $(top_srcdir)/itpp/comm/sequence.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-sequence.lo -MD -MP -MF $(DEPDIR)/libcomm_la-sequence.Tpo -c -o libcomm_la-sequence.lo `test -f '$(top_srcdir)/itpp/comm/sequence.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/sequence.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-sequence.Tpo $(DEPDIR)/libcomm_la-sequence.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/sequence.cpp' object='libcomm_la-sequence.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-sequence.lo `test -f '$(top_srcdir)/itpp/comm/sequence.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/sequence.cpp libcomm_la-siso_dem.lo: $(top_srcdir)/itpp/comm/siso_dem.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-siso_dem.lo -MD -MP -MF $(DEPDIR)/libcomm_la-siso_dem.Tpo -c -o libcomm_la-siso_dem.lo `test -f '$(top_srcdir)/itpp/comm/siso_dem.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_dem.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-siso_dem.Tpo $(DEPDIR)/libcomm_la-siso_dem.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_dem.cpp' object='libcomm_la-siso_dem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-siso_dem.lo `test -f '$(top_srcdir)/itpp/comm/siso_dem.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_dem.cpp libcomm_la-siso_eq.lo: $(top_srcdir)/itpp/comm/siso_eq.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-siso_eq.lo -MD -MP -MF $(DEPDIR)/libcomm_la-siso_eq.Tpo -c -o libcomm_la-siso_eq.lo `test -f '$(top_srcdir)/itpp/comm/siso_eq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_eq.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-siso_eq.Tpo $(DEPDIR)/libcomm_la-siso_eq.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_eq.cpp' object='libcomm_la-siso_eq.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-siso_eq.lo `test -f '$(top_srcdir)/itpp/comm/siso_eq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_eq.cpp libcomm_la-siso_mud.lo: $(top_srcdir)/itpp/comm/siso_mud.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-siso_mud.lo -MD -MP -MF $(DEPDIR)/libcomm_la-siso_mud.Tpo -c -o libcomm_la-siso_mud.lo `test -f '$(top_srcdir)/itpp/comm/siso_mud.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_mud.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-siso_mud.Tpo $(DEPDIR)/libcomm_la-siso_mud.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_mud.cpp' object='libcomm_la-siso_mud.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-siso_mud.lo `test -f '$(top_srcdir)/itpp/comm/siso_mud.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_mud.cpp libcomm_la-siso_nsc.lo: $(top_srcdir)/itpp/comm/siso_nsc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-siso_nsc.lo -MD -MP -MF $(DEPDIR)/libcomm_la-siso_nsc.Tpo -c -o libcomm_la-siso_nsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_nsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_nsc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-siso_nsc.Tpo $(DEPDIR)/libcomm_la-siso_nsc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_nsc.cpp' object='libcomm_la-siso_nsc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-siso_nsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_nsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_nsc.cpp libcomm_la-siso_rsc.lo: $(top_srcdir)/itpp/comm/siso_rsc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-siso_rsc.lo -MD -MP -MF $(DEPDIR)/libcomm_la-siso_rsc.Tpo -c -o libcomm_la-siso_rsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_rsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_rsc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-siso_rsc.Tpo $(DEPDIR)/libcomm_la-siso_rsc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_rsc.cpp' object='libcomm_la-siso_rsc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-siso_rsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_rsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_rsc.cpp libcomm_la-spread.lo: $(top_srcdir)/itpp/comm/spread.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-spread.lo -MD -MP -MF $(DEPDIR)/libcomm_la-spread.Tpo -c -o libcomm_la-spread.lo `test -f '$(top_srcdir)/itpp/comm/spread.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/spread.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-spread.Tpo $(DEPDIR)/libcomm_la-spread.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/spread.cpp' object='libcomm_la-spread.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-spread.lo `test -f '$(top_srcdir)/itpp/comm/spread.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/spread.cpp libcomm_la-stc.lo: $(top_srcdir)/itpp/comm/stc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-stc.lo -MD -MP -MF $(DEPDIR)/libcomm_la-stc.Tpo -c -o libcomm_la-stc.lo `test -f '$(top_srcdir)/itpp/comm/stc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/stc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-stc.Tpo $(DEPDIR)/libcomm_la-stc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/stc.cpp' object='libcomm_la-stc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-stc.lo `test -f '$(top_srcdir)/itpp/comm/stc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/stc.cpp libcomm_la-turbo.lo: $(top_srcdir)/itpp/comm/turbo.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_la-turbo.lo -MD -MP -MF $(DEPDIR)/libcomm_la-turbo.Tpo -c -o libcomm_la-turbo.lo `test -f '$(top_srcdir)/itpp/comm/turbo.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/turbo.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_la-turbo.Tpo $(DEPDIR)/libcomm_la-turbo.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/turbo.cpp' object='libcomm_la-turbo.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_la-turbo.lo `test -f '$(top_srcdir)/itpp/comm/turbo.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/turbo.cpp libcomm_debug_la-bch.lo: $(top_srcdir)/itpp/comm/bch.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-bch.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-bch.Tpo -c -o libcomm_debug_la-bch.lo `test -f '$(top_srcdir)/itpp/comm/bch.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/bch.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-bch.Tpo $(DEPDIR)/libcomm_debug_la-bch.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/bch.cpp' object='libcomm_debug_la-bch.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-bch.lo `test -f '$(top_srcdir)/itpp/comm/bch.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/bch.cpp libcomm_debug_la-channel.lo: $(top_srcdir)/itpp/comm/channel.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-channel.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-channel.Tpo -c -o libcomm_debug_la-channel.lo `test -f '$(top_srcdir)/itpp/comm/channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/channel.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-channel.Tpo $(DEPDIR)/libcomm_debug_la-channel.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/channel.cpp' object='libcomm_debug_la-channel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-channel.lo `test -f '$(top_srcdir)/itpp/comm/channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/channel.cpp libcomm_debug_la-commfunc.lo: $(top_srcdir)/itpp/comm/commfunc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-commfunc.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-commfunc.Tpo -c -o libcomm_debug_la-commfunc.lo `test -f '$(top_srcdir)/itpp/comm/commfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/commfunc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-commfunc.Tpo $(DEPDIR)/libcomm_debug_la-commfunc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/commfunc.cpp' object='libcomm_debug_la-commfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-commfunc.lo `test -f '$(top_srcdir)/itpp/comm/commfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/commfunc.cpp libcomm_debug_la-convcode.lo: $(top_srcdir)/itpp/comm/convcode.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-convcode.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-convcode.Tpo -c -o libcomm_debug_la-convcode.lo `test -f '$(top_srcdir)/itpp/comm/convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/convcode.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-convcode.Tpo $(DEPDIR)/libcomm_debug_la-convcode.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/convcode.cpp' object='libcomm_debug_la-convcode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-convcode.lo `test -f '$(top_srcdir)/itpp/comm/convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/convcode.cpp libcomm_debug_la-crc.lo: $(top_srcdir)/itpp/comm/crc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-crc.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-crc.Tpo -c -o libcomm_debug_la-crc.lo `test -f '$(top_srcdir)/itpp/comm/crc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/crc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-crc.Tpo $(DEPDIR)/libcomm_debug_la-crc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/crc.cpp' object='libcomm_debug_la-crc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-crc.lo `test -f '$(top_srcdir)/itpp/comm/crc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/crc.cpp libcomm_debug_la-egolay.lo: $(top_srcdir)/itpp/comm/egolay.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-egolay.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-egolay.Tpo -c -o libcomm_debug_la-egolay.lo `test -f '$(top_srcdir)/itpp/comm/egolay.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/egolay.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-egolay.Tpo $(DEPDIR)/libcomm_debug_la-egolay.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/egolay.cpp' object='libcomm_debug_la-egolay.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-egolay.lo `test -f '$(top_srcdir)/itpp/comm/egolay.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/egolay.cpp libcomm_debug_la-error_counters.lo: $(top_srcdir)/itpp/comm/error_counters.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-error_counters.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-error_counters.Tpo -c -o libcomm_debug_la-error_counters.lo `test -f '$(top_srcdir)/itpp/comm/error_counters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/error_counters.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-error_counters.Tpo $(DEPDIR)/libcomm_debug_la-error_counters.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/error_counters.cpp' object='libcomm_debug_la-error_counters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-error_counters.lo `test -f '$(top_srcdir)/itpp/comm/error_counters.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/error_counters.cpp libcomm_debug_la-exit.lo: $(top_srcdir)/itpp/comm/exit.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-exit.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-exit.Tpo -c -o libcomm_debug_la-exit.lo `test -f '$(top_srcdir)/itpp/comm/exit.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/exit.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-exit.Tpo $(DEPDIR)/libcomm_debug_la-exit.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/exit.cpp' object='libcomm_debug_la-exit.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-exit.lo `test -f '$(top_srcdir)/itpp/comm/exit.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/exit.cpp libcomm_debug_la-galois.lo: $(top_srcdir)/itpp/comm/galois.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-galois.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-galois.Tpo -c -o libcomm_debug_la-galois.lo `test -f '$(top_srcdir)/itpp/comm/galois.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/galois.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-galois.Tpo $(DEPDIR)/libcomm_debug_la-galois.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/galois.cpp' object='libcomm_debug_la-galois.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-galois.lo `test -f '$(top_srcdir)/itpp/comm/galois.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/galois.cpp libcomm_debug_la-hammcode.lo: $(top_srcdir)/itpp/comm/hammcode.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-hammcode.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-hammcode.Tpo -c -o libcomm_debug_la-hammcode.lo `test -f '$(top_srcdir)/itpp/comm/hammcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/hammcode.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-hammcode.Tpo $(DEPDIR)/libcomm_debug_la-hammcode.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/hammcode.cpp' object='libcomm_debug_la-hammcode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-hammcode.lo `test -f '$(top_srcdir)/itpp/comm/hammcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/hammcode.cpp libcomm_debug_la-interleave.lo: $(top_srcdir)/itpp/comm/interleave.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-interleave.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-interleave.Tpo -c -o libcomm_debug_la-interleave.lo `test -f '$(top_srcdir)/itpp/comm/interleave.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/interleave.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-interleave.Tpo $(DEPDIR)/libcomm_debug_la-interleave.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/interleave.cpp' object='libcomm_debug_la-interleave.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-interleave.lo `test -f '$(top_srcdir)/itpp/comm/interleave.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/interleave.cpp libcomm_debug_la-ldpc.lo: $(top_srcdir)/itpp/comm/ldpc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-ldpc.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-ldpc.Tpo -c -o libcomm_debug_la-ldpc.lo `test -f '$(top_srcdir)/itpp/comm/ldpc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ldpc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-ldpc.Tpo $(DEPDIR)/libcomm_debug_la-ldpc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/ldpc.cpp' object='libcomm_debug_la-ldpc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-ldpc.lo `test -f '$(top_srcdir)/itpp/comm/ldpc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ldpc.cpp libcomm_debug_la-llr.lo: $(top_srcdir)/itpp/comm/llr.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-llr.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-llr.Tpo -c -o libcomm_debug_la-llr.lo `test -f '$(top_srcdir)/itpp/comm/llr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/llr.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-llr.Tpo $(DEPDIR)/libcomm_debug_la-llr.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/llr.cpp' object='libcomm_debug_la-llr.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-llr.lo `test -f '$(top_srcdir)/itpp/comm/llr.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/llr.cpp libcomm_debug_la-modulator.lo: $(top_srcdir)/itpp/comm/modulator.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-modulator.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-modulator.Tpo -c -o libcomm_debug_la-modulator.lo `test -f '$(top_srcdir)/itpp/comm/modulator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-modulator.Tpo $(DEPDIR)/libcomm_debug_la-modulator.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/modulator.cpp' object='libcomm_debug_la-modulator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-modulator.lo `test -f '$(top_srcdir)/itpp/comm/modulator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator.cpp libcomm_debug_la-modulator_nd.lo: $(top_srcdir)/itpp/comm/modulator_nd.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-modulator_nd.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-modulator_nd.Tpo -c -o libcomm_debug_la-modulator_nd.lo `test -f '$(top_srcdir)/itpp/comm/modulator_nd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator_nd.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-modulator_nd.Tpo $(DEPDIR)/libcomm_debug_la-modulator_nd.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/modulator_nd.cpp' object='libcomm_debug_la-modulator_nd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-modulator_nd.lo `test -f '$(top_srcdir)/itpp/comm/modulator_nd.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/modulator_nd.cpp libcomm_debug_la-ofdm.lo: $(top_srcdir)/itpp/comm/ofdm.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-ofdm.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-ofdm.Tpo -c -o libcomm_debug_la-ofdm.lo `test -f '$(top_srcdir)/itpp/comm/ofdm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ofdm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-ofdm.Tpo $(DEPDIR)/libcomm_debug_la-ofdm.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/ofdm.cpp' object='libcomm_debug_la-ofdm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-ofdm.lo `test -f '$(top_srcdir)/itpp/comm/ofdm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/ofdm.cpp libcomm_debug_la-pulse_shape.lo: $(top_srcdir)/itpp/comm/pulse_shape.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-pulse_shape.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-pulse_shape.Tpo -c -o libcomm_debug_la-pulse_shape.lo `test -f '$(top_srcdir)/itpp/comm/pulse_shape.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/pulse_shape.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-pulse_shape.Tpo $(DEPDIR)/libcomm_debug_la-pulse_shape.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/pulse_shape.cpp' object='libcomm_debug_la-pulse_shape.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-pulse_shape.lo `test -f '$(top_srcdir)/itpp/comm/pulse_shape.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/pulse_shape.cpp libcomm_debug_la-punct_convcode.lo: $(top_srcdir)/itpp/comm/punct_convcode.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-punct_convcode.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-punct_convcode.Tpo -c -o libcomm_debug_la-punct_convcode.lo `test -f '$(top_srcdir)/itpp/comm/punct_convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/punct_convcode.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-punct_convcode.Tpo $(DEPDIR)/libcomm_debug_la-punct_convcode.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/punct_convcode.cpp' object='libcomm_debug_la-punct_convcode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-punct_convcode.lo `test -f '$(top_srcdir)/itpp/comm/punct_convcode.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/punct_convcode.cpp libcomm_debug_la-rec_syst_conv_code.lo: $(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-rec_syst_conv_code.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-rec_syst_conv_code.Tpo -c -o libcomm_debug_la-rec_syst_conv_code.lo `test -f '$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-rec_syst_conv_code.Tpo $(DEPDIR)/libcomm_debug_la-rec_syst_conv_code.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp' object='libcomm_debug_la-rec_syst_conv_code.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-rec_syst_conv_code.lo `test -f '$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp libcomm_debug_la-reedsolomon.lo: $(top_srcdir)/itpp/comm/reedsolomon.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-reedsolomon.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-reedsolomon.Tpo -c -o libcomm_debug_la-reedsolomon.lo `test -f '$(top_srcdir)/itpp/comm/reedsolomon.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/reedsolomon.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-reedsolomon.Tpo $(DEPDIR)/libcomm_debug_la-reedsolomon.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/reedsolomon.cpp' object='libcomm_debug_la-reedsolomon.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-reedsolomon.lo `test -f '$(top_srcdir)/itpp/comm/reedsolomon.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/reedsolomon.cpp libcomm_debug_la-sequence.lo: $(top_srcdir)/itpp/comm/sequence.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-sequence.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-sequence.Tpo -c -o libcomm_debug_la-sequence.lo `test -f '$(top_srcdir)/itpp/comm/sequence.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/sequence.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-sequence.Tpo $(DEPDIR)/libcomm_debug_la-sequence.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/sequence.cpp' object='libcomm_debug_la-sequence.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-sequence.lo `test -f '$(top_srcdir)/itpp/comm/sequence.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/sequence.cpp libcomm_debug_la-siso_dem.lo: $(top_srcdir)/itpp/comm/siso_dem.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-siso_dem.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-siso_dem.Tpo -c -o libcomm_debug_la-siso_dem.lo `test -f '$(top_srcdir)/itpp/comm/siso_dem.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_dem.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-siso_dem.Tpo $(DEPDIR)/libcomm_debug_la-siso_dem.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_dem.cpp' object='libcomm_debug_la-siso_dem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-siso_dem.lo `test -f '$(top_srcdir)/itpp/comm/siso_dem.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_dem.cpp libcomm_debug_la-siso_eq.lo: $(top_srcdir)/itpp/comm/siso_eq.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-siso_eq.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-siso_eq.Tpo -c -o libcomm_debug_la-siso_eq.lo `test -f '$(top_srcdir)/itpp/comm/siso_eq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_eq.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-siso_eq.Tpo $(DEPDIR)/libcomm_debug_la-siso_eq.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_eq.cpp' object='libcomm_debug_la-siso_eq.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-siso_eq.lo `test -f '$(top_srcdir)/itpp/comm/siso_eq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_eq.cpp libcomm_debug_la-siso_mud.lo: $(top_srcdir)/itpp/comm/siso_mud.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-siso_mud.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-siso_mud.Tpo -c -o libcomm_debug_la-siso_mud.lo `test -f '$(top_srcdir)/itpp/comm/siso_mud.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_mud.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-siso_mud.Tpo $(DEPDIR)/libcomm_debug_la-siso_mud.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_mud.cpp' object='libcomm_debug_la-siso_mud.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-siso_mud.lo `test -f '$(top_srcdir)/itpp/comm/siso_mud.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_mud.cpp libcomm_debug_la-siso_nsc.lo: $(top_srcdir)/itpp/comm/siso_nsc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-siso_nsc.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-siso_nsc.Tpo -c -o libcomm_debug_la-siso_nsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_nsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_nsc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-siso_nsc.Tpo $(DEPDIR)/libcomm_debug_la-siso_nsc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_nsc.cpp' object='libcomm_debug_la-siso_nsc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-siso_nsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_nsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_nsc.cpp libcomm_debug_la-siso_rsc.lo: $(top_srcdir)/itpp/comm/siso_rsc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-siso_rsc.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-siso_rsc.Tpo -c -o libcomm_debug_la-siso_rsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_rsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_rsc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-siso_rsc.Tpo $(DEPDIR)/libcomm_debug_la-siso_rsc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/siso_rsc.cpp' object='libcomm_debug_la-siso_rsc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-siso_rsc.lo `test -f '$(top_srcdir)/itpp/comm/siso_rsc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/siso_rsc.cpp libcomm_debug_la-spread.lo: $(top_srcdir)/itpp/comm/spread.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-spread.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-spread.Tpo -c -o libcomm_debug_la-spread.lo `test -f '$(top_srcdir)/itpp/comm/spread.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/spread.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-spread.Tpo $(DEPDIR)/libcomm_debug_la-spread.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/spread.cpp' object='libcomm_debug_la-spread.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-spread.lo `test -f '$(top_srcdir)/itpp/comm/spread.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/spread.cpp libcomm_debug_la-stc.lo: $(top_srcdir)/itpp/comm/stc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-stc.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-stc.Tpo -c -o libcomm_debug_la-stc.lo `test -f '$(top_srcdir)/itpp/comm/stc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/stc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-stc.Tpo $(DEPDIR)/libcomm_debug_la-stc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/stc.cpp' object='libcomm_debug_la-stc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-stc.lo `test -f '$(top_srcdir)/itpp/comm/stc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/stc.cpp libcomm_debug_la-turbo.lo: $(top_srcdir)/itpp/comm/turbo.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libcomm_debug_la-turbo.lo -MD -MP -MF $(DEPDIR)/libcomm_debug_la-turbo.Tpo -c -o libcomm_debug_la-turbo.lo `test -f '$(top_srcdir)/itpp/comm/turbo.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/turbo.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcomm_debug_la-turbo.Tpo $(DEPDIR)/libcomm_debug_la-turbo.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/comm/turbo.cpp' object='libcomm_debug_la-turbo.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcomm_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libcomm_debug_la-turbo.lo `test -f '$(top_srcdir)/itpp/comm/turbo.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/comm/turbo.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/comm/bch.cpp000066400000000000000000000262711216575753400156710ustar00rootroot00000000000000/*! * \file * \brief Implementation of a BCH encoder/decoder class * \author Pal Frenger, Steve Peters, Adam Piatyszek and Stephan Ludwig * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { //---------------------- BCH ----------------------------------- BCH::BCH(int in_n, int in_k, int in_t, const ivec &genpolynom, bool sys) : n(in_n), k(in_k), t(in_t), systematic(sys) { //fix the generator polynomial g(x). ivec exponents = zeros_i(n - k + 1); bvec temp = oct2bin(genpolynom, 0); for (int i = 0; i < temp.length(); i++) { exponents(i) = static_cast(temp(temp.length() - i - 1)) - 1; } g.set(n + 1, exponents); } BCH::BCH(int in_n, int in_t, bool sys) : n(in_n), t(in_t), systematic(sys) { // step 1: determine cyclotomic cosets // although we use elements in GF(n+1), we do not use GFX class, but ivec, // since we have to multiply by 2 and need the exponents in clear notation int m_tmp = int2bits(n); int two_pow_m = 1 << m_tmp; it_assert(two_pow_m == n + 1, "BCH::BCH(): (in_n + 1) is not a power of 2"); it_assert((t > 0) && (2 * t < n), "BCH::BCH(): in_t must be positive and smaller than n/2"); Array cyclo_sets(2 * t + 1); // unfortunately it is not obvious how many cyclotomic cosets exist (?) // a bad guess is n/2, which can be a whole lot... // but we only need 2*t + 1 at maximum for step 2. // (since all elements are sorted ascending [cp. comment at 2.], the last // coset we need is the one with coset leader 2t. + coset {0}) // start with {0} as first set int curr_coset_idx = 0; cyclo_sets(curr_coset_idx) = zeros_i(1); int cycl_element = 1; do { bool found = false; // find next element, which is not in a previous coset do { int i = 0; // we do not have to search the first coset, since this is always {0} found = false; while ((!found) && (i <= curr_coset_idx)) { int j = 0; while ((!found) && (j < cyclo_sets(i).length())) { if (cycl_element == cyclo_sets(i)(j)) { found = true; } j++; } i++; } cycl_element++; } while ((found) && (cycl_element <= 2 * t)); if (!found) { // found one cyclo_sets(++curr_coset_idx).set_size(m_tmp); // a first guess (we delete afterwards back to correct length): // there should be no more than m elements in one coset int element_index = 0; cyclo_sets(curr_coset_idx)(element_index) = cycl_element - 1; // multiply by two (mod 2^m - 1) as long as new elements are created while ((((cyclo_sets(curr_coset_idx)(element_index) * 2) % n) != cyclo_sets(curr_coset_idx)(0)) && (element_index < m_tmp - 1)) { element_index++; cyclo_sets(curr_coset_idx)(element_index) = (cyclo_sets(curr_coset_idx)(element_index - 1) * 2) % n; } // delete unused digits if (element_index + 1 < m_tmp - 1) { cyclo_sets(curr_coset_idx).del(element_index + 1, m_tmp - 1); } } } while ((cycl_element <= 2 * t) && (curr_coset_idx <= 2 * t)); // step 2: find all cosets that contain all the powers (1..2t) of alpha // this is pretty easy, since the cosets are in ascending order // (if regarding the first (=primitive) element for ordering) - // all due to the method, they have been constructed // Since we only calculated all cosets up to 2t, this is even trivial // => we take all curr_coset_idx Cosets // maximum index of cosets to be considered int max_coset_index = curr_coset_idx; // step 3: multiply the minimal polynomials corresponding to this sets // of powers g.set(two_pow_m, ivec("0")); // = alpha^0 = 1 ivec min_poly_exp(2); min_poly_exp(1) = 0; // product of (x-alpha^cycl_element) for (int i = 1; i <= max_coset_index; i++) { for (int j = 0; j < cyclo_sets(i).length(); j++) { min_poly_exp(0) = cyclo_sets(i)(j); g *= GFX(two_pow_m, min_poly_exp); } } // finally determine k k = n - g.get_true_degree(); } void BCH::encode(const bvec &uncoded_bits, bvec &coded_bits) { int i, j, degree; int iterations = floor_i(static_cast(uncoded_bits.length()) / k); GFX m(n + 1, k); GFX c(n + 1, n); GFX r(n + 1, n - k); GFX uncoded_shifted(n + 1, n); coded_bits.set_size(iterations * n, false); bvec mbit(k), cbit(n); if (systematic) for (i = 0; i < n - k; i++) uncoded_shifted[i] = GF(n + 1, -1); for (i = 0; i < iterations; i++) { //Fix the message polynom m(x). mbit = uncoded_bits.mid(i * k, k); for (j = 0; j < k; j++) { degree = static_cast(mbit(k - j - 1)) - 1; // all bits should be mapped first bit <-> highest degree, // e.g. 1100 <-> m(x)=x^3 + x^2, but GFX indexes identically // with exponent m[0] <-> coefficient of x^0 m[j] = GF(n + 1, degree); if (systematic) { uncoded_shifted[j + n - k] = m[j]; } } //Fix the outputbits cbit. if (systematic) { r = modgfx(uncoded_shifted, g); c = uncoded_shifted - r; // uncoded_shifted has coefficients from x^(n-k)..x^(n-1) // and r has coefficients from x^0..x^(n-k-1). // Thus, this sum perfectly fills c. } else { c = g * m; } for (j = 0; j < n; j++) { if (c[j] == GF(n + 1, 0)) { cbit(n - j - 1) = 1; // again reverse mapping like mbit(.) } else { cbit(n - j - 1) = 0; } } coded_bits.replace_mid(i * n, cbit); } } bvec BCH::encode(const bvec &uncoded_bits) { bvec coded_bits; encode(uncoded_bits, coded_bits); return coded_bits; } bool BCH::decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid) { bool decoderfailure, no_dec_failure; int j, i, degree, kk, foundzeros; ivec errorpos; int iterations = floor_i(static_cast(coded_bits.length()) / n); bvec rbin(n), mbin(k); decoded_message.set_size(iterations * k, false); cw_isvalid.set_length(iterations); GFX r(n + 1, n - 1), c(n + 1, n - 1), m(n + 1, k - 1), S(n + 1, 2 * t), Lambda(n + 1), OldLambda(n + 1), T(n + 1), Omega(n + 1), One(n + 1, (char*) "0"); GF delta(n + 1); no_dec_failure = true; for (i = 0; i < iterations; i++) { decoderfailure = false; //Fix the received polynomial r(x) rbin = coded_bits.mid(i * n, n); for (j = 0; j < n; j++) { degree = static_cast(rbin(n - j - 1)) - 1; // reverse mapping, see encode(.) r[j] = GF(n + 1, degree); } //Fix the syndrome polynomial S(x). S.clear(); for (j = 1; j <= 2 * t; j++) { S[j] = r(GF(n + 1, j)); } if (S.get_true_degree() >= 1) { //Errors in the received word //Iterate to find Lambda(x). kk = 0; Lambda = GFX(n + 1, (char*) "0"); T = GFX(n + 1, (char*) "0"); while (kk < t) { Omega = Lambda * (S + One); delta = Omega[2 * kk + 1]; OldLambda = Lambda; Lambda = OldLambda + delta * (GFX(n + 1, (char*) "-1 0") * T); if ((delta == GF(n + 1, -1)) || (OldLambda.get_true_degree() > kk)) { T = GFX(n + 1, (char*) "-1 -1 0") * T; } else { T = (GFX(n + 1, (char*) "-1 0") * OldLambda) / delta; } kk = kk + 1; } //Find the zeros to Lambda(x). errorpos.set_size(Lambda.get_true_degree()); foundzeros = 0; for (j = 0; j <= n - 1; j++) { if (Lambda(GF(n + 1, j)) == GF(n + 1, -1)) { errorpos(foundzeros) = (n - j) % n; foundzeros += 1; if (foundzeros >= Lambda.get_true_degree()) { break; } } } if (foundzeros != Lambda.get_true_degree()) { decoderfailure = true; } else { //Correct the codeword. for (j = 0; j < foundzeros; j++) { rbin(n - errorpos(j) - 1) += 1; // again, reverse mapping } //Reconstruct the corrected codeword. for (j = 0; j < n; j++) { degree = static_cast(rbin(n - j - 1)) - 1; c[j] = GF(n + 1, degree); } //Code word validation. S.clear(); for (j = 1; j <= 2 * t; j++) { S[j] = c(GF(n + 1, j)); } if (S.get_true_degree() <= 0) { //c(x) is a valid codeword. decoderfailure = false; } else { decoderfailure = true; } } } else { c = r; decoderfailure = false; } //Construct the message bit vector. if (decoderfailure == false) { //c(x) is a valid codeword. if (c.get_true_degree() > 1) { if (systematic) { for (j = 0; j < k; j++) m[j] = c[n - k + j]; } else { m = divgfx(c, g); } mbin.clear(); for (j = 0; j <= m.get_true_degree(); j++) { if (m[j] == GF(n + 1, 0)) { mbin(k - j - 1) = 1; } } } else { //The zero word was transmitted mbin = zeros_b(k); m = GFX(n + 1, (char*) "-1"); } } else { //Decoder failure. // for a systematic code it is better to extract the undecoded message // from the received code word, i.e. obtaining a bit error // prob. p_b << 1/2, than setting all-zero (p_b = 1/2) if (systematic) { mbin = coded_bits.mid(i * n, k); } else { mbin = zeros_b(k); } no_dec_failure = false; } decoded_message.replace_mid(i * k, mbin); cw_isvalid(i) = (!decoderfailure); } return no_dec_failure; } void BCH::decode(const bvec &coded_bits, bvec &decoded_bits) { bvec cw_isvalid; if (!decode(coded_bits, decoded_bits, cw_isvalid)) { for (int i = 0; i < cw_isvalid.length(); i++) { if (!cw_isvalid(i)) { decoded_bits.replace_mid(i * k, zeros_b(k)); } } } } bvec BCH::decode(const bvec &coded_bits) { bvec decoded_bits; decode(coded_bits, decoded_bits); return decoded_bits; } // --- Soft-decision decoding is not implemented --- void BCH::decode(const vec &, bvec &) { it_error("BCH::decode(): Soft-decision decoding is not implemented"); } bvec BCH::decode(const vec &) { it_error("BCH::decode(): Soft-decision decoding is not implemented"); return bvec(); } } // namespace itpp itpp-4.3.1/itpp/comm/bch.h000066400000000000000000000111431216575753400153260ustar00rootroot00000000000000/*! * \file * \brief Definition of a BCH encoder/decoder class * \author Pal Frenger, Steve Peters, Adam Piatyszek and Stephan Ludwig * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef BCH_H #define BCH_H #include #include #include namespace itpp { /*! \addtogroup fec */ //---------------------- BCH -------------------------------------- /*! \ingroup fec \brief Class for binary, narrow-sense BCH codes. The notation used is found in S. B. Wicker, "Error control systems for digital communication and storage", Appendix E, Prentice-Hall, 1995. Example: \code BCH bch(31,21,2,ivec("3 5 5 1")) \endcode uses the generator polynomial \f$g(x) = x^{10} + x^9 + x^8 + x^6 + x^5 + x^3 + 1\f$, and is capable of correcting 2 errors with \a n = 31 and \a k = 21. */ class ITPP_EXPORT BCH : public Channel_Code { public: /*! * \brief Initialize a (n,k)-code that can correct t errors * * \note Do not call this constructor with e.g. BCH bch(31, 21, 2, "3 5 5 1") * but with BCH bch(31, 21, 2, ivec("3 5 5 1")) instead. Otherwise the * complier will complain. */ BCH(int in_n, int in_k, int in_t, const ivec &genpolynom, bool sys = false); /*! * \brief Initialize a (n,k)-code that can correct t errors * \author Stephan Ludwig * * The generator polynomial is automatically generated from the (n, t) * parameters of the BCH code. The constructor generates the generator * polynomial (and determines k) according to the method described in: * * [Wic95] S. B. Wicker, "Error control systems for digital communication * and storage", Prentice-Hall, 1995 */ BCH(int in_n, int in_t, bool sys = false); //! Destructor virtual ~BCH() { } //! Encode a bvec of indata virtual void encode(const bvec &uncoded_bits, bvec &coded_bits); //! Encode a bvec of indata virtual bvec encode(const bvec &uncoded_bits); /*! * \brief Decode the BCH code bits. Return false if there has been any decoding failure. * * The \c coded_bits are block-wise decoded into \c decoded_message messages. If * there has been any decoding failure, the function will return \c false. * If this happened in the n-th block, then \c cw_isvalid(n) will be set * to \c false (zero-indexed). In case of a systematic code the systematic bits will be * extracted and presented in the corresponding block of \c decoded_message. * This is better than just presenting zeros, which is done in case of a * decoding failure of non-systematic codes. */ virtual bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid); //! Decode a bvec of coded data. This function is kept for backward compatibility. Better use \code bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid) \endcode. virtual void decode(const bvec &coded_bits, bvec &decoded_bits); //! Decode a bvec of coded data. This function is kept for backward compatibility. Better use \code bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)\endcode. virtual bvec decode(const bvec &coded_bits); // Soft-decision decoding is not implemented virtual void decode(const vec &received_signal, bvec &output); virtual bvec decode(const vec &received_signal); //! Get the code rate virtual double get_rate() const { return static_cast(k) / n; } //! Get cardinality of code k virtual int get_k() const { return k; } //! Dummy assignment operator - MSVC++ warning C4512 BCH & operator= (const BCH &) { return *this; } private: int n, k, t; GFX g; const bool systematic; }; } // namespace itpp #endif // #ifndef BCH_H itpp-4.3.1/itpp/comm/channel.cpp000066400000000000000000001415641216575753400165500ustar00rootroot00000000000000/*! * \file * \brief Communication Channels' classes - source file * \author Tony Ottosson, Pal Frenger, Adam Piatyszek and Zbigniew Dlugaszewski * * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #include #include #include namespace itpp { // -------------------------------------------------------------------------- // Fading_Generator class // -------------------------------------------------------------------------- Fading_Generator::Fading_Generator() : init_flag(false) { // no default LOS component set_LOS_power(0.0); } void Fading_Generator::set_LOS_power(double relative_power) { it_assert(relative_power >= 0.0, "Fading_Generator::set_LOS_power(): Relative_power can not be negative"); los_power = relative_power; los_diffuse = std::sqrt(1.0 / (1.0 + los_power)); los_direct = los_diffuse * std::sqrt(los_power); } void Fading_Generator::set_LOS_doppler(double) { it_warning("Fading_Generator::set_LOS_doppler(): This function has no effect on this kind of generator"); } void Fading_Generator::set_time_offset(int) { it_warning("Fading_Generator::set_time_offset(): This function has no effect on this kind of generator"); } void Fading_Generator::set_norm_doppler(double) { it_warning("Fading_Generator::set_norm_doppler(): This function has no effect on this kind of generator"); } void Fading_Generator::set_filter_length(int) { it_warning("Fading_Generator::set_filter_length(): This function has no effect on this kind of generator"); } void Fading_Generator::set_doppler_spectrum(DOPPLER_SPECTRUM) { it_warning("Fading_Generator::set_doppler_spectrum(): This function has no effect on this kind of generator"); } void Fading_Generator::set_no_frequencies(int) { it_warning("Fading_Generator::set_no_frequencies(): This function has no effect on this kind of generator"); } void Fading_Generator::set_rice_method(RICE_METHOD) { it_warning("Fading_Generator::set_rice_method(): This function has no effect on this kind of generator"); } double Fading_Generator::get_LOS_doppler() const { it_warning("Fading_Generator::get_LOS_doppler(): This function has no effect on this kind of generator"); return 0; } double Fading_Generator::get_time_offset() const { it_warning("Fading_Generator::get_time_offset(): This function has no effect on this kind of generator"); return 0; } int Fading_Generator::get_filter_length() const { it_warning("Fading_Generator::get_filter_length(): This function has no effect on this kind of generator"); return 0; } double Fading_Generator::get_norm_doppler() const { it_warning("Fading_Generator::get_norm_doppler(): This function has no effect on this kind of generator"); return 0; } DOPPLER_SPECTRUM Fading_Generator::get_doppler_spectrum() const { it_warning("Fading_Generator::get_doppler_spectrum(): This function has no effect on this kind of generator"); return Jakes; } int Fading_Generator::get_no_frequencies() const { it_warning("Fading_Generator::get_no_frequencies(): This function has no effect on this kind of generator"); return 0; } RICE_METHOD Fading_Generator::get_rice_method() const { it_warning("Fading_Generator::get_rice_method(): This function has no effect on this kind of generator"); return MEDS; } void Fading_Generator::shift_time_offset(int) { it_warning("Fading_Generator::shift_time_offset(): This function has no effect on this kind of generator"); } cvec Fading_Generator::generate(int no_samples) { cvec output; this->generate(no_samples, output); return output; } // -------------------------------------------------------------------------- // Independent_Fading_Generator class // -------------------------------------------------------------------------- void Independent_Fading_Generator::generate(int no_samples, cvec& output) { output.set_size(no_samples, false); if (los_power > 0.0) { for (int i = 0; i < no_samples; ++i) { output(i) = los_diffuse * randn_c() + los_direct; } } else { output = randn_c(no_samples); } } // -------------------------------------------------------------------------- // Static_Fading_Generator class // -------------------------------------------------------------------------- void Static_Fading_Generator::init() { std::complex static_sample = randn_c(); if (los_power > 0.0) { static_sample *= los_diffuse; static_sample += los_direct; } static_sample_re = static_sample.real(); static_sample_im = static_sample.imag(); init_flag = true; } void Static_Fading_Generator::generate(int no_samples, cvec& output) { if (init_flag == false) init(); output.set_size(no_samples, false); output = std::complex(static_sample_re,static_sample_im); } // -------------------------------------------------------------------------- // Correlated_Fading_Generator class // -------------------------------------------------------------------------- Correlated_Fading_Generator::Correlated_Fading_Generator(double norm_doppler) : Fading_Generator(), los_dopp(0.7), time_offset(0.0) { set_norm_doppler(norm_doppler); } void Correlated_Fading_Generator::set_norm_doppler(double norm_doppler) { it_assert((norm_doppler > 0) && (norm_doppler <= 1.0), "Correlated_Fading_Generator: Normalized Doppler out of range"); n_dopp = norm_doppler; init_flag = false; } void Correlated_Fading_Generator::set_LOS_doppler(double relative_doppler) { it_assert((relative_doppler >= 0) && (relative_doppler <= 1.0), "Correlated_Fading_Generator::set_LOS_doppler(): Relative Doppler out of range"); los_dopp = relative_doppler; } void Correlated_Fading_Generator::set_time_offset(int offset) { time_offset = static_cast(offset); } void Correlated_Fading_Generator::shift_time_offset(int no_samples) { time_offset += static_cast(no_samples); } void Correlated_Fading_Generator::add_LOS(int idx, std::complex& sample) { double tmp_arg = m_2pi * los_dopp * n_dopp * (idx + time_offset); sample *= los_diffuse; sample += los_direct * std::complex(std::cos(tmp_arg), std::sin(tmp_arg)); } // -------------------------------------------------------------------------- // Rice_Fading_Generator class // -------------------------------------------------------------------------- Rice_Fading_Generator::Rice_Fading_Generator(double norm_doppler, DOPPLER_SPECTRUM spectrum, int no_freq, RICE_METHOD method) : Correlated_Fading_Generator(norm_doppler) { set_doppler_spectrum(spectrum); set_no_frequencies(no_freq); set_rice_method(method); } void Rice_Fading_Generator::set_doppler_spectrum(DOPPLER_SPECTRUM spectrum) { dopp_spectrum = spectrum; init_flag = false; } void Rice_Fading_Generator::set_no_frequencies(int no_freq) { it_assert(no_freq >= 7, "Rice_Fading_Generator::set_no_frequencies(): Too low number of Doppler frequencies"); Ni = no_freq; init_flag = false; } void Rice_Fading_Generator::set_rice_method(RICE_METHOD method) { // check if this method works for the given spectrum rice_method = method; init_flag = false; } void Rice_Fading_Generator::init() { switch (rice_method) { case MEDS: // Method of Exact Doppler Spread (MEDS) init_MEDS(); break; default: it_error("Rice_Fading_Generator::init(): Wrong Rice method for this fading generator"); }; init_flag = true; // generator ready to use } void Rice_Fading_Generator::generate(int no_samples, cvec &output) { if (init_flag == false) init(); output.set_size(no_samples, false); switch (dopp_spectrum) { case Jakes: { double tmp_re, tmp_im; if (los_power > 0.0) { // LOS component exists for (int i = 0; i < no_samples; i++) { tmp_re = sum(elem_mult(c1, cos(m_2pi * f1 * n_dopp * (i + time_offset) + th1))); tmp_im = sum(elem_mult(c2, cos(m_2pi * f2 * n_dopp * (i + time_offset) + th2))); output(i) = std::complex(tmp_re, tmp_im); add_LOS(i, output(i)); } } else { for (int i = 0; i < no_samples; i++) { tmp_re = sum(elem_mult(c1, cos(m_2pi * f1 * n_dopp * (i + time_offset) + th1))); tmp_im = sum(elem_mult(c2, cos(m_2pi * f2 * n_dopp * (i + time_offset) + th2))); output(i) = std::complex(tmp_re, tmp_im); } } break; } case GaussI: case GaussII: { double tmp; for (int i = 0; i < no_samples; i++) { tmp = m_2pi * n_dopp * (i + time_offset); output(i) = sum(elem_mult(c1, cos(f1 * tmp + th1))) * std::complex(std::cos(f01 * tmp), -std::sin(f01 * tmp)) + sum(elem_mult(c2, cos(f2 * tmp + th2))) * std::complex(std::cos(f02 * tmp), -std::sin(f02 * tmp)); } break; } } time_offset += no_samples; } void Rice_Fading_Generator::init_MEDS() { vec n; double sgm_0_2; switch (dopp_spectrum) { case Jakes: n = linspace(1, Ni, Ni); f1 = sin(pi / (2 * Ni) * (n - 0.5)); c1 = std::sqrt(1.0 / Ni) * ones(Ni); th1 = randu(Ni) * 2 * pi; n = linspace(1, Ni + 1, Ni + 1); f2 = sin(pi / (2 * (Ni + 1)) * (n - 0.5)); c2 = std::sqrt(1.0 / (Ni + 1)) * ones(Ni + 1); th2 = randu(Ni + 1) * 2 * pi; f01 = f02 = 0; break; case GaussI: n = linspace(1, Ni, Ni); sgm_0_2 = 5.0 / 6.0; c1 = std::sqrt(sgm_0_2 * 2.0 / Ni) * ones(Ni); f1 = std::sqrt(2.0) * 0.05 * erfinv((2 * n - 1) / (2 * Ni)); th1 = randu(Ni) * 2 * pi; sgm_0_2 = 1.0 / 6.0; c2 = std::sqrt(sgm_0_2 * 2.0 / Ni) * ones(Ni); f2 = std::sqrt(2.0) * 0.1 * erfinv((2 * n - 1) / (2 * Ni)); th2 = randu(Ni) * 2 * pi; f01 = 0.8; f02 = -0.4; break; case GaussII: n = linspace(1, Ni, Ni); sgm_0_2 = std::sqrt(10.0) / (std::sqrt(10.0) + 0.15); c1 = std::sqrt(sgm_0_2 * 2.0 / Ni) * ones(Ni); f1 = std::sqrt(2.0) * 0.1 * erfinv((2 * n - 1) / (2 * Ni)); th1 = randu(Ni) * 2 * pi; sgm_0_2 = 0.15 / (std::sqrt(10.0) + 0.15); c2 = std::sqrt(sgm_0_2 * 2.0 / Ni) * ones(Ni); f2 = std::sqrt(2.0) * 0.15 * erfinv((2 * n - 1) / (2 * Ni)); th2 = randu(Ni) * 2 * pi; f01 = -0.7; f02 = 0.4; break; default: it_error("Rice_Fading_Generator::init_MEDS(): Wrong spectrum method for this fading generator"); }; } // -------------------------------------------------------------------------- // FIR_Fading_Generator class methods // -------------------------------------------------------------------------- FIR_Fading_Generator::FIR_Fading_Generator(double norm_doppler, int filter_length) : Correlated_Fading_Generator(norm_doppler) { set_filter_length(filter_length); } void FIR_Fading_Generator::set_filter_length(int filter_length) { it_assert(filter_length >= 50, "FIR_Fading_Generator::set_filter_length(): Filter length should be at least 50"); fir_length = filter_length; init_flag = false; } void FIR_Fading_Generator::init() { // calculate a reasonable upsample rate so that normalized doppler is > 0.1 double norm_dopp = n_dopp; upsample_rate = 1; while (norm_dopp < 0.1) { norm_dopp *= 2; upsample_rate *= 2; } fir_filter.set_coeffs(Jakes_filter(norm_dopp, fir_length)); // fill filter with dummy data cvec dummy = fir_filter(randn_c(fir_length)); left_overs.set_size(0, false); init_flag = true; // generator ready to use } void FIR_Fading_Generator::generate(int no_samples, cvec &output) { if (init_flag == false) init(); // calculate number of samples before upsampling int no_upsamples = ceil_i(static_cast(no_samples - left_overs.size()) / upsample_rate) + 1; // should make a smarter interpolation here!!! lininterp(fir_filter(randn_c(no_upsamples)), upsample_rate, output); output = concat(left_overs, output); // add left-overs from previous filtering left_overs = output.right(output.size() - no_samples); // save left-overs for next round of filtering output.set_size(no_samples, true); if (los_power > 0.0) { // LOS component exist for (int i = 0; i < no_samples; i++) { add_LOS(i, output(i)); } } time_offset += no_samples; } vec FIR_Fading_Generator::Jakes_filter(double norm_dopp, int order) { int L = order / 2; vec x_pos(L), x_neg(L), x(2*L + 1), h(2*L + 1); for (int i = 1; i <= L; i++) { x_pos(i - 1) = besselj(0.25, m_2pi * norm_dopp * i) / std::pow(i, 0.25); // / std::sqrt(std::sqrt(static_cast(i))); } double x0 = 1.468813 * std::pow(norm_dopp, 0.25); // std::sqrt(std::sqrt(norm_dopp)); x_neg = reverse(x_pos); x = concat(concat(x_neg, x0), x_pos); h = elem_mult(hamming(2 * L + 1), x); h /= norm(h); return h; } // -------------------------------------------------------------------------- // IFFT_Fading_Generator class methods // -------------------------------------------------------------------------- void IFFT_Fading_Generator::generate(int no_samples, cvec &output) { if (init_flag == false) init(); generate_Jakes(no_samples, output); if (los_power > 0.0) { // LOS component exist for (int i = 0; i < no_samples; i++) { add_LOS(i, output(i)); } } time_offset += no_samples; } void IFFT_Fading_Generator::generate_Jakes(int no_samples, cvec &output) { int Nfft = pow2i(levels2bits(no_samples)); double df = 1.0 / Nfft; int noisesamp = ceil_i(n_dopp / df); int no_upsample = 1; while (noisesamp <= 10) { // if too few samples, increase the FFT size Nfft *= 2; no_upsample *= 2; df = 1.0 / Nfft; noisesamp = ceil_i(n_dopp / df); it_assert(no_upsample < 128, "IFFT_Fading_Generator::generate_Jakes(): Too low normalized doppler or too small blocks of data. Results in an inefficient algorithm with lots of zero-padding"); } vec Fpos = linspace(0, 0.5, Nfft / 2 + 1); vec F = concat(Fpos, reverse(-Fpos(1, Nfft / 2 - 1))); vec S = zeros(Nfft); for (int i = 0; i < F.size(); i++) { if (std::fabs(F(i)) < n_dopp) S(i) = std::sqrt(1.5 / (pi * n_dopp * std::sqrt(1 - std::pow(F(i) / n_dopp, 2)))); else if (std::fabs(F(i)) == n_dopp) S(i) = 1000000; } S /= norm(S, 2); S *= Nfft; cvec x = zeros_c(Nfft); for (int i = 0; i < noisesamp; ++i) { x(i) = S(i) * randn_c(); x(Nfft - 1 - i) = S(Nfft - 1 - i) * randn_c(); } x = ifft(x); output = x.mid(0, no_samples); } // -------------------------------------------------------------------------- // Channel_Specification class methods // -------------------------------------------------------------------------- Channel_Specification::Channel_Specification(const vec &avg_power_dB, const vec &delay_prof) { set_channel_profile(avg_power_dB, delay_prof); } Channel_Specification::Channel_Specification(const CHANNEL_PROFILE profile) { set_channel_profile(profile); } void Channel_Specification::set_channel_profile(const vec &avg_power_dB, const vec &delay_prof) { it_assert(min(delay_prof) == 0, "Channel_Specification::set_channel_profile(): Minimum relative delay must be 0"); it_assert(avg_power_dB.size() == delay_prof.size(), "Channel_Specification::set_channel_profile(): Power and delay vectors must be of equal length"); it_assert(delay_prof(0) == 0, "Channel_Specification::set_channel_profile(): First tap must be at zero delay"); for (int i = 1; i < delay_prof.size(); i++) { it_assert(delay_prof(i) > delay_prof(i - 1), "Channel_Specification::set_channel_profile(): Delays should be sorted and unique"); } N_taps = delay_prof.size(); a_prof_dB = avg_power_dB; d_prof = delay_prof; // set doppler spectrum to Jakes per default tap_doppler_spectrum.set_size(N_taps, false); tap_doppler_spectrum = Jakes; // set LOS parameters to zeros per default set_LOS(zeros(N_taps)); } void Channel_Specification::set_channel_profile(const CHANNEL_PROFILE profile) { switch (profile) { // -------------- ITU Channel models ----------------- case ITU_Vehicular_A: set_channel_profile(vec("0 -1 -9 -10 -15 -20"), vec("0 310 710 1090 1730 2510") * 1e-9); break; case ITU_Vehicular_B: set_channel_profile(vec("-2.5 0 -12.8 -10 -25.2 -16"), vec("0 300 8900 12900 17100 20000") * 1e-9); break; case ITU_Pedestrian_A: set_channel_profile(vec("0 -9.7 -19.2 -22.8"), vec("0 110 190 410") * 1e-9); break; case ITU_Pedestrian_B: set_channel_profile(vec("0 -0.9 -4.9 -8 -7.8 -23.9"), vec("0 200 800 1200 2300 3700") * 1e-9); break; // -------------- COST259 Channel models ----------------- case COST259_TUx: set_channel_profile(vec("-5.7 -7.6 -10.1 -10.2 -10.2 -11.5 -13.4 -16.3 -16.9 -17.1 -17.4 -19 -19 -19.8 -21.5 -21.6 -22.1 -22.6 -23.5 -24.3"), vec("0 217 512 514 517 674 882 1230 1287 1311 1349 1533 1535 1622 1818 1836 1884 1943 2048 2140") * 1e-9); break; case COST259_RAx: set_channel_profile(vec("-5.2 -6.4 -8.4 -9.3 -10 -13.1 -15.3 -18.5 -20.4 -22.4"), vec("0 42 101 129 149 245 312 410 469 528") * 1e-9); set_LOS(0, sqr(0.91 / 0.41), 0.7); break; case COST259_HTx: set_channel_profile(vec("-3.6 -8.9 -10.2 -11.5 -11.8 -12.7 -13.0 -16.2 -17.3 -17.7 -17.6 -22.7 -24.1 -25.8 -25.8 -26.2 -29 -29.9 -30 -30.7"), vec("0 356 441 528 546 609 625 842 916 941 15000 16172 16492 16876 16882 16978 17615 17827 17849 18016") * 1e-9); break; // -------------- COST207 Channel models ----------------- case COST207_RA: set_channel_profile(vec("0 -2 -10 -20"), vec("0 200 400 600") * 1e-9); set_LOS(0, sqr(0.91 / 0.41), 0.7); break; case COST207_RA6: set_channel_profile(vec("0 -4 -8 -12 -16 -20"), vec("0 100 200 300 400 500") * 1e-9); set_LOS(0, sqr(0.91 / 0.41), 0.7); break; case COST207_TU: set_channel_profile(vec("-3 0 -2 -6 -8 -10"), vec("0 200 600 1600 2400 5000") * 1e-9); set_doppler_spectrum(2, GaussI); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussII); set_doppler_spectrum(5, GaussII); break; case COST207_TU6alt: set_channel_profile(vec("-3 0 -2 -6 -8 -10"), vec("0 200 500 1600 2300 5000") * 1e-9); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussII); set_doppler_spectrum(5, GaussII); break; case COST207_TU12: set_channel_profile(vec("-4 -3 0 -2 -3 -5 -7 -5 -6 -9 -11 -10"), vec("0 200 400 600 800 1200 1400 1800 2400 3000 3200 5000") * 1e-9); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussI); set_doppler_spectrum(5, GaussI); set_doppler_spectrum(6, GaussI); set_doppler_spectrum(7, GaussI); set_doppler_spectrum(8, GaussII); set_doppler_spectrum(9, GaussII); set_doppler_spectrum(10, GaussII); set_doppler_spectrum(11, GaussII); break; case COST207_TU12alt: set_channel_profile(vec("-4 -3 0 -2.6 -3 -5 -7 -5 -6.5 -8.6 -11 -10"), vec("0 200 400 600 800 1200 1400 1800 2400 3000 3200 5000") * 1e-9); set_doppler_spectrum(4, GaussI); set_doppler_spectrum(5, GaussI); set_doppler_spectrum(6, GaussI); set_doppler_spectrum(7, GaussI); set_doppler_spectrum(8, GaussII); set_doppler_spectrum(9, GaussII); set_doppler_spectrum(10, GaussII); set_doppler_spectrum(11, GaussII); break; case COST207_BU: set_channel_profile(vec("-3 0 -3 -5 -2 -4"), vec("0 400 1000 1600 5000 6600") * 1e-9); set_doppler_spectrum(2, GaussI); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussII); set_doppler_spectrum(5, GaussII); break; case COST207_BU6alt: set_channel_profile(vec("-2.5 0 -3 -5 -2 -4"), vec("0 300 1000 1600 5000 6600") * 1e-9); set_doppler_spectrum(2, GaussI); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussII); set_doppler_spectrum(5, GaussII); break; case COST207_BU12: set_channel_profile(vec("-7 -3 -1 0 -2 -6 -7 -1 -2 -7 -10 -15"), vec("0 200 400 800 1600 2200 3200 5000 6000 7200 8200 10000") * 1e-9); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussI); set_doppler_spectrum(5, GaussII); set_doppler_spectrum(6, GaussII); set_doppler_spectrum(7, GaussII); set_doppler_spectrum(8, GaussII); set_doppler_spectrum(9, GaussII); set_doppler_spectrum(10, GaussII); set_doppler_spectrum(11, GaussII); break; case COST207_BU12alt: set_channel_profile(vec("-7.7 -3.4 -1.3 0 -2.3 -5.6 -7.4 -1.4 -1.6 -6.7 -9.8 -15.1"), vec("0 100 300 700 1600 2200 3100 5000 6000 7200 8100 10000") * 1e-9); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussI); set_doppler_spectrum(5, GaussII); set_doppler_spectrum(6, GaussII); set_doppler_spectrum(7, GaussII); set_doppler_spectrum(8, GaussII); set_doppler_spectrum(9, GaussII); set_doppler_spectrum(10, GaussII); set_doppler_spectrum(11, GaussII); break; case COST207_HT: set_channel_profile(vec("0 -2 -4 -7 -6 -12"), vec("0 200 400 600 15000 17200") * 1e-9); set_doppler_spectrum(4, GaussII); set_doppler_spectrum(5, GaussII); break; case COST207_HT6alt: set_channel_profile(vec("0 -1.5 -4.5 -7.5 -8 -17.7"), vec("0 100 300 500 15000 17200") * 1e-9); set_doppler_spectrum(4, GaussII); set_doppler_spectrum(5, GaussII); break; case COST207_HT12: set_channel_profile(vec("-10 -8 -6 -4 0 0 -4 -8 -9 -10 -12 -14"), vec("0 200 400 600 800 2000 2400 15000 15200 15800 17200 20000") * 1e-9); set_doppler_spectrum(3, GaussI); set_doppler_spectrum(4, GaussI); set_doppler_spectrum(5, GaussI); set_doppler_spectrum(6, GaussII); set_doppler_spectrum(7, GaussII); set_doppler_spectrum(8, GaussII); set_doppler_spectrum(9, GaussII); set_doppler_spectrum(10, GaussII); set_doppler_spectrum(11, GaussII); break; case COST207_HT12alt: set_channel_profile(vec("-10 -8 -6 -4 0 0 -4 -8 -9 -10 -12 -14"), vec("0 100 300 500 700 1000 1300 15000 15200 15700 17200 20000") * 1e-9); set_doppler_spectrum(4, GaussI); set_doppler_spectrum(5, GaussI); set_doppler_spectrum(6, GaussI); set_doppler_spectrum(7, GaussII); set_doppler_spectrum(8, GaussII); set_doppler_spectrum(9, GaussII); set_doppler_spectrum(10, GaussII); set_doppler_spectrum(11, GaussII); break; }; } void Channel_Specification::set_doppler_spectrum(DOPPLER_SPECTRUM *tap_spectrum) { for (int i = 0; i < N_taps; i++) tap_doppler_spectrum(i) = tap_spectrum[i]; } void Channel_Specification::set_doppler_spectrum(int tap_number, DOPPLER_SPECTRUM tap_spectrum) { tap_doppler_spectrum(tap_number) = tap_spectrum; } void Channel_Specification::set_LOS(int tap_number, double relative_power, double relative_doppler) { it_assert(N_taps >= 1, "Channel_Specification::set_LOS(): Cannot set LOS component if not set channel profile"); it_assert((tap_number >= 0) && (tap_number < N_taps), "Channel_Specification::set_LOS(): Tap number out of range"); it_assert((relative_doppler >= 0) && (relative_doppler <= 1.0), "Channel_Specification::set_LOS(): Normalized Doppler out of range"); it_assert(relative_power >= 0.0, "Channel_Specification::set_LOS(): Rice factor out of range"); los_power.set_size(N_taps, true); los_dopp.set_size(N_taps, true); los_power(tap_number) = relative_power; los_dopp(tap_number) = relative_doppler; } void Channel_Specification::set_LOS(const vec& relative_power, const vec& relative_doppler) { it_assert((relative_power.size() == N_taps), "Channel_Specification::set_LOS(): Improper size of input vectors"); if (relative_doppler.size() == 0) { los_power.set_size(relative_power.size()); los_dopp.set_size(relative_power.size()); for (int i = 0; i < relative_power.size(); i++) { it_assert(relative_power(i) >= 0.0, "Channel_Specification::set_LOS(): Rice factor out of range"); los_power(i) = relative_power(i); los_dopp(i) = 0.7; } } else { it_assert(relative_doppler.size() == N_taps, "Channel_Specification::set_LOS(): Improper size of input vectors"); los_power.set_size(relative_power.size()); los_dopp.set_size(relative_power.size()); for (int i = 0; i < relative_power.size(); i++) { it_assert((relative_doppler(i) >= 0) && (relative_doppler(i) <= 1.0), "Channel_Specification::set_LOS(): Normalized Doppler out of range"); it_assert(relative_power(i) >= 0.0, "Channel_Specification::set_LOS(): Rice factor out of range"); los_power(i) = relative_power(i); los_dopp(i) = relative_doppler(i); } } } void Channel_Specification::get_channel_profile(vec &avg_power_dB, vec &delay_prof) const { avg_power_dB = a_prof_dB; delay_prof = d_prof; } DOPPLER_SPECTRUM Channel_Specification::get_doppler_spectrum(int index) const { it_assert((index >= 0) && (index < N_taps), "Channel_Specification::get_doppler_spectrum(): Index of of range"); return tap_doppler_spectrum(index); } double Channel_Specification::calc_mean_excess_delay() const { vec a_prof = inv_dB(a_prof_dB); return (a_prof * d_prof / sum(a_prof)); } double Channel_Specification::calc_rms_delay_spread() const { vec a_prof = inv_dB(a_prof_dB); double a = a_prof * d_prof / sum(a_prof); double b = a_prof * sqr(d_prof) / sum(a_prof); return std::sqrt(b - a*a); } // -------------------------------------------------------------------------- // TDL_Channel class methods // -------------------------------------------------------------------------- TDL_Channel::TDL_Channel(const vec &avg_power_dB, const ivec &delay_prof): init_flag(false), n_dopp(0.0), fading_type(Independent), method(Rice_MEDS), filter_length(0), nrof_freq(16), discrete_Ts(0.0) { set_channel_profile(avg_power_dB, delay_prof); // initialize LOS parameters to all zeros set_LOS(zeros(delay_prof.size())); // initialize Doppler spectra tap_doppler_spectrum.set_size(delay_prof.size()); tap_doppler_spectrum = Jakes; } TDL_Channel::TDL_Channel(const Channel_Specification &channel_spec, double sampling_time): init_flag(false), n_dopp(0.0), fading_type(Independent), method(Rice_MEDS), filter_length(0), nrof_freq(16), discrete_Ts(sampling_time) { set_channel_profile(channel_spec, sampling_time); // set Doppler spectrum tap_doppler_spectrum = channel_spec.get_doppler_spectrum(); } TDL_Channel::~TDL_Channel() { if (fading_gen.size() > 0) { // delete all old generators for (int i = 0; i < fading_gen.size(); i++) { if (fading_gen(i) != NULL) { delete fading_gen(i); fading_gen(i) = NULL; } } } } void TDL_Channel::set_channel_profile(const vec &avg_power_dB, const ivec &delay_prof) { it_assert(min(delay_prof) == 0, "TDL_Channel::set_channel_profile(): Minimum relative delay must be 0."); it_assert(avg_power_dB.size() == delay_prof.size(), "TDL_Channel::set_channel_profile(): Power and delay vectors must be of equal length!"); it_assert(delay_prof(0) == 0, "TDL_Channel::set_channel_profile(): First tap must be at zero delay"); for (int i = 1; i < delay_prof.size(); i++) { it_assert(delay_prof(i) > delay_prof(i - 1), "TDL_Channel::set_channel_profile(): Delays should be sorted and unique"); } N_taps = delay_prof.size(); a_prof = pow(10.0, avg_power_dB / 20.0); // Convert power profile to amplitude profile a_prof /= norm(a_prof); // Normalize amplitude profile d_prof = delay_prof; // initialize Doppler spectra tap_doppler_spectrum.set_size(d_prof.size()); tap_doppler_spectrum = Jakes; // set size of Rice parameters according to the new channel profile set_LOS(zeros(N_taps)); // changes in PDP require initialisation init_flag = false; } void TDL_Channel::set_channel_profile_uniform(int no_taps) { it_assert(no_taps >= 1, "TDL_Channel::set_channel_profile_uniform(): Minimum number of taps is 1."); vec avg_power_dB = zeros(no_taps); ivec delay_prof(no_taps); for (int i = 0; i < no_taps; i++) delay_prof(i) = i; set_channel_profile(avg_power_dB, delay_prof); } void TDL_Channel::set_channel_profile_exponential(int no_taps) { it_assert(no_taps >= 1, "TDL_Channel::set_channel_profile_exponential(): Minimum number of taps is 1."); vec avg_power_dB(no_taps); ivec delay_prof(no_taps); for (int i = 0; i < no_taps; i++) { delay_prof(i) = i; // p(i*ts) = exp(-i*ts), k = 0...no_taps-1 avg_power_dB(i) = dB(std::exp(static_cast(-i))); } set_channel_profile(avg_power_dB, delay_prof); } void TDL_Channel::set_channel_profile(const Channel_Specification &channel_spec, double sampling_time) { vec avg_power_dB; vec delay_profile; // set power profile and delays channel_spec.get_channel_profile(avg_power_dB, delay_profile); discrete_Ts = sampling_time; N_taps = avg_power_dB.size(); a_prof = pow(10.0, avg_power_dB / 20.0); // Convert power profile to amplitude profile a_prof /= norm(a_prof); // Normalize amplitude profile // set size of Rice parameters according to the new channel profile set_LOS(channel_spec.get_LOS_power(), channel_spec.get_LOS_doppler()); // set Doppler spectrum tap_doppler_spectrum = channel_spec.get_doppler_spectrum(); // sets discretized delay profile discretize(delay_profile); init_flag = false; } void TDL_Channel::set_correlated_method(CORRELATED_METHOD correlated_method) { fading_type = Correlated; method = correlated_method; init_flag = false; } void TDL_Channel::set_fading_type(FADING_TYPE fading_type_in) { fading_type = fading_type_in; init_flag = false; } void TDL_Channel::set_norm_doppler(double norm_doppler) { it_assert((norm_doppler > 0) && (norm_doppler <= 1.0), "TDL_Channel::set_norm_doppler(): Normalized Doppler out of range"); n_dopp = norm_doppler; // if normalized Doppler is set, we have correlated fading fading_type = Correlated; init_flag = false; } void TDL_Channel::set_LOS(const vec& relative_power, const vec& relative_doppler) { it_assert((relative_power.size() == N_taps), "TDL_Channel::set_LOS(): Improper size of input vectors"); if (relative_doppler.size() == 0) { los_power.set_size(relative_power.size()); los_dopp.set_size(relative_power.size()); for (int i = 0; i < relative_power.size(); i++) { it_assert(relative_power(i) >= 0.0, "TDL_Channel::set_LOS(): Rice factor out of range"); los_power(i) = relative_power(i); los_dopp(i) = (relative_power(i) > 0) ? 0.7 : 0.0; } } else { it_assert(relative_doppler.size() == N_taps, "TDL_Channel::set_LOS(): Improper size of input vectors"); los_power.set_size(relative_power.size()); los_dopp.set_size(relative_power.size()); for (int i = 0; i < relative_power.size(); i++) { it_assert((relative_doppler(i) >= 0) && (relative_doppler(i) <= 1.0), "TDL_Channel::set_LOS(): Normalized Doppler out of range"); it_assert(relative_power(i) >= 0.0, "TDL_Channel::set_LOS(): Rice factor out of range"); los_power(i) = relative_power(i); los_dopp(i) = relative_doppler(i); } } } void TDL_Channel::set_LOS_power(const vec& relative_power) { it_assert(relative_power.size() == N_taps, "TDL_Channel::set_LOS_power(): Improper size of input vector"); los_power.set_size(relative_power.size()); los_dopp.set_size(relative_power.size()); for (int i = 0; i < los_power.size(); ++i) { los_power(i) = relative_power(i); los_dopp(i) = (relative_power(i) > 0) ? 0.7 : 0.0; } init_flag = false; } void TDL_Channel::set_LOS_doppler(const vec& relative_doppler) { it_assert(relative_doppler.size() == los_power.size(), "TDL_Channel::set_LOS_doppler(): Improper size of input vector"); it_assert(n_dopp > 0, "TDL_Channel::set_LOS_doppler(): Normalized Doppler needs to be non zero to set the LOS Doppler in a Correlated fading generator"); los_dopp.set_size(relative_doppler.size()); for (int i = 0; i < relative_doppler.size(); ++i) { it_assert((relative_doppler(i) >= 0) && (relative_doppler(i) <= 1.0), "TDL_Channel::set_LOS_doppler(): Normalized Doppler out of range"); los_dopp(i) = relative_doppler(i); } init_flag = false; } void TDL_Channel::set_doppler_spectrum(const DOPPLER_SPECTRUM *tap_spectrum) { it_assert(N_taps > 0, "TDL_Channel::set_doppler_spectrum(): Channel profile not defined yet"); it_assert(n_dopp > 0, "TDL_Channel::set_doppler_spectrum(): Normalized Doppler needs to be non zero to set the Doppler spectrum in the Correlated Rice MEDS fading generator"); if (method != Rice_MEDS) method = Rice_MEDS; tap_doppler_spectrum.set_size(N_taps, false); for (int i = 0; i < N_taps; i++) tap_doppler_spectrum(i) = tap_spectrum[i]; init_flag = false; } void TDL_Channel::set_doppler_spectrum(int tap_number, DOPPLER_SPECTRUM tap_spectrum) { it_assert((tap_number >= 0) && (tap_number < N_taps), "TDL_Channel::set_doppler_spectrum(): Improper tap number"); it_assert(n_dopp > 0, "TDL_Channel::set_doppler_spectrum(): Normalized Doppler needs to be non zero to set the Doppler spectrum in the Correlated Rice MEDS fading generator"); if (method != Rice_MEDS) method = Rice_MEDS; tap_doppler_spectrum.set_size(N_taps, true); tap_doppler_spectrum(tap_number) = tap_spectrum; init_flag = false; } void TDL_Channel::set_no_frequencies(int no_freq) { it_assert(n_dopp > 0, "TDL_Channel::set_no_frequencies(): Normalized Doppler needs to be non zero to set the number of frequencies in the Correlated Rice MEDS fading generator"); nrof_freq = no_freq; if (method != Rice_MEDS) method = Rice_MEDS; init_flag = false; } void TDL_Channel::set_filter_length(int fir_length) { it_assert(n_dopp > 0, "TDL_Channel::set_filter_length(): Normalized Doppler needs to be non zero to use the Correlated FIR fading generator"); filter_length = fir_length; if (method != FIR) method = FIR; init_flag = false; } void TDL_Channel::set_time_offset(int offset) { it_assert(n_dopp > 0, "TDL_Channel::set_time_offset(): Normalized Doppler needs to be non zero to set time offset in a Correlated fading generator"); if (init_flag == false) init(); for (int i = 0; i < N_taps; i++) { fading_gen(i)->set_time_offset(offset); } } void TDL_Channel::shift_time_offset(int no_samples) { it_assert(n_dopp > 0, "TDL_Channel::shift_time_offset(): Normalized Doppler needs to be non zero to shift time offset in a Correlated fading generator"); if (init_flag == false) init(); for (int i = 0; i < N_taps; i++) { fading_gen(i)->shift_time_offset(no_samples); } } void TDL_Channel::get_channel_profile(vec &avg_power_dB, ivec &delay_prof) const { avg_power_dB = 20 * log10(a_prof); delay_prof = d_prof; } vec TDL_Channel::get_avg_power_dB() const { return (20 * log10(a_prof)); } double TDL_Channel::get_time_offset() const { if (fading_gen(0) != NULL) return fading_gen(0)->get_time_offset(); else return -1.0; } double TDL_Channel::calc_mean_excess_delay() const { return (sqr(a_prof)*d_prof / sum_sqr(a_prof)); } double TDL_Channel::calc_rms_delay_spread() const { double a = (sqr(a_prof) * d_prof / sum_sqr(a_prof)); double b = (sqr(a_prof) * sqr(to_vec(d_prof)) / sum_sqr(a_prof)); return (std::sqrt(b - a*a)); } void TDL_Channel::init() { it_assert(N_taps > 0, "TDL_Channel::init(): Channel profile not defined yet"); it_assert(N_taps == los_power.size(), "TDL_Channel::init(): LOS profile does not mach the channel profile"); if (fading_gen.size() > 0) { // delete all old generators for (int i = 0; i < fading_gen.size(); i++) { if (fading_gen(i) != NULL) { delete fading_gen(i); fading_gen(i) = NULL; } } } // create all generators and set the parameters fading_gen.set_size(N_taps, false); switch (fading_type) { case Independent: for (int i = 0; i < N_taps; ++i) { fading_gen(i) = new Independent_Fading_Generator(); if (los_power(i) > 0) fading_gen(i)->set_LOS_power(los_power(i)); fading_gen(i)->init(); } break; case Static: for (int i = 0; i < N_taps; ++i) { fading_gen(i) = new Static_Fading_Generator(); if (los_power(i) > 0) fading_gen(i)->set_LOS_power(los_power(i)); fading_gen(i)->init(); } break; case Correlated: it_assert(n_dopp > 0, "TDL_Channel::init(): Correlated fading requires non zero normalized Doppler"); switch (method) { case Rice_MEDS: // The third parameter is the number of sine waveforms that create the // fading process. It is increased by 2 for each tap to make taps // uncorrelated. Minimum number of waveforms set explicitly to 16. for (int i = 0; i < N_taps; ++i) { fading_gen(i) = new Rice_Fading_Generator(n_dopp, tap_doppler_spectrum(i), nrof_freq + 2*i, MEDS); if (los_power(i) > 0) { fading_gen(i)->set_LOS_power(los_power(i)); fading_gen(i)->set_LOS_doppler(los_dopp(i)); } fading_gen(i)->init(); } break; case FIR: for (int i = 0; i < N_taps; ++i) { it_assert(tap_doppler_spectrum(i) == Jakes, "TDL_Channel::init(): FIR fading generator can be used with Jakes spectrum only"); fading_gen(i) = new FIR_Fading_Generator(n_dopp); if (los_power(i) > 0) { fading_gen(i)->set_LOS_power(los_power(i)); fading_gen(i)->set_LOS_doppler(los_dopp(i)); } if (filter_length > 0) fading_gen(i)->set_filter_length(filter_length); fading_gen(i)->init(); } break; case IFFT: for (int i = 0; i < N_taps; ++i) { it_assert(tap_doppler_spectrum(i) == Jakes, "TDL_Channel::init(): IFFT fading generator can be used with Jakes spectrum only"); fading_gen(i) = new IFFT_Fading_Generator(n_dopp); if (los_power(i) > 0) { fading_gen(i)->set_LOS_power(los_power(i)); fading_gen(i)->set_LOS_doppler(los_dopp(i)); } fading_gen(i)->init(); } break; default: it_error("TDL_Channel::init(): No such fading generation method"); } break; default: it_error("TDL_Channel::init(): No such fading type"); }; init_flag = true; } void TDL_Channel::generate(int no_samples, Array &channel_coeff) { if (init_flag == false) init(); channel_coeff.set_size(N_taps, false); for (int i = 0; i < N_taps; i++) channel_coeff(i) = a_prof(i) * fading_gen(i)->generate(no_samples); } void TDL_Channel::generate(int no_samples, cmat &channel_coeff) { if (init_flag == false) init(); channel_coeff.set_size(no_samples, N_taps, false); for (int i = 0; i < N_taps; i++) channel_coeff.set_col(i, a_prof(i) * fading_gen(i)->generate(no_samples)); } void TDL_Channel::filter_known_channel(const cvec &input, cvec &output, const Array &channel_coeff) { int maxdelay = max(d_prof); output.set_size(input.size() + maxdelay, false); output.zeros(); for (int i = 0; i < N_taps; i++) output += concat(zeros_c(d_prof(i)), elem_mult(input, channel_coeff(i)), zeros_c(maxdelay - d_prof(i))); } void TDL_Channel::filter_known_channel(const cvec &input, cvec &output, const cmat &channel_coeff) { int maxdelay = max(d_prof); output.set_size(input.size() + maxdelay, false); output.zeros(); for (int i = 0; i < N_taps; i++) output += concat(zeros_c(d_prof(i)), elem_mult(input, channel_coeff.get_col(i)), zeros_c(maxdelay - d_prof(i))); } void TDL_Channel::filter(const cvec &input, cvec &output, Array &channel_coeff) { generate(input.size(), channel_coeff); filter_known_channel(input, output, channel_coeff); } void TDL_Channel::filter(const cvec &input, cvec &output, cmat &channel_coeff) { generate(input.size(), channel_coeff); filter_known_channel(input, output, channel_coeff); } cvec TDL_Channel::filter(const cvec &input, Array &channel_coeff) { cvec output; filter(input, output, channel_coeff); return output; } cvec TDL_Channel::filter(const cvec &input, cmat &channel_coeff) { cvec output; filter(input, output, channel_coeff); return output; } void TDL_Channel::filter(const cvec &input, cvec &output) { Array channel_coeff; filter(input, output, channel_coeff); } cvec TDL_Channel::filter(const cvec &input) { cvec output; filter(input, output); return output; } void TDL_Channel::operator()(const cvec &input, cvec &output, Array &channel_coeff) { filter(input, output, channel_coeff); } void TDL_Channel::operator()(const cvec &input, cvec &output, cmat &channel_coeff) { filter(input, output, channel_coeff); } cvec TDL_Channel::operator()(const cvec &input, Array &channel_coeff) { return filter(input, channel_coeff); } cvec TDL_Channel::operator()(const cvec &input, cmat &channel_coeff) { return filter(input, channel_coeff); } cvec TDL_Channel::operator()(const cvec &input) { return filter(input); } void TDL_Channel::calc_impulse_response(const Array &channel_coeff, Array &impulse_response) { it_assert(init_flag == true, "calc_impulse_response: TDL_Channel is not initialized"); it_assert(N_taps == channel_coeff.size(), "calc_impulse_response: number of channel taps do not match"); int no_samples = channel_coeff(0).size(); it_assert(no_samples > 0, "calc_impulse_response: channel_coeff must contain samples"); impulse_response.set_size(no_samples); for (int i = 0; i < no_samples; i++) { impulse_response(i).set_size(d_prof(N_taps - 1) + 1, false); impulse_response(i).zeros(); for (int j = 0; j < N_taps; j++) impulse_response(i)(d_prof(j)) = channel_coeff(j)(i); } } void TDL_Channel::calc_frequency_response(const Array &channel_coeff, Array &frequency_response, const int fft_size) { it_assert(init_flag == true, "calc_frequency_response: TDL_Channel is not initialized"); it_assert(N_taps == channel_coeff.size(), "calc_frequency_response: number of channel taps do not match"); int no_samples = channel_coeff(0).size(); it_assert(no_samples > 0, "calc_frequency_response: channel_coeff must contain samples"); frequency_response.set_size(no_samples); it_assert(fft_size > d_prof(N_taps - 1), "calc_frequency_response: fft_size must be larger than the maximum delay in samples"); cvec impulse_response(fft_size); for (int i = 0; i < no_samples; i++) { impulse_response.zeros(); for (int j = 0; j < N_taps; j++) impulse_response(d_prof(j)) = channel_coeff(j)(i); fft(impulse_response, frequency_response(i)); } } void TDL_Channel::calc_frequency_response(const cmat &channel_coeff, cmat &frequency_response, const int fft_size) { it_assert(init_flag == true, "calc_frequency_response: TDL_Channel is not initialized"); it_assert(N_taps == channel_coeff.cols(), "calc_frequency_response: number of channel taps do not match"); int no_samples = channel_coeff.rows(); it_assert(no_samples > 0, "calc_frequency_response: channel_coeff must contain samples"); frequency_response.set_size(fft_size, no_samples, false); it_assert(fft_size > d_prof(N_taps - 1), "calc_frequency_response: fft_size must be larger than the maximum delay in samples"); cvec impulse_response(fft_size); cvec freq; for (int i = 0; i < no_samples; i++) { impulse_response.zeros(); for (int j = 0; j < N_taps; j++) impulse_response(d_prof(j)) = channel_coeff(i, j); fft(impulse_response, freq); frequency_response.set_col(i, freq); } } void TDL_Channel::discretize(const vec &delay_profile) { it_assert(N_taps > 0, "TDL_Channel::discretize(): No channel profile specified"); it_assert(delay_profile(0) == 0, "TDL_Channel::discretize(): First tap should be at zero delay"); it_assert(discrete_Ts > 0, "TDL_Channel::discretize(): Incorrect sampling time"); it_assert((a_prof.size() == N_taps) && (delay_profile.size() == N_taps) && (los_power.size() == N_taps) && (tap_doppler_spectrum.size() == N_taps), "TDL_Channel:: discretize(): Channel profile lenghts must be equal to the number of taps"); vec p_prof = sqr(a_prof); // Power profile ivec delay_prof(N_taps); vec power(N_taps); double spower; vec scattered(N_taps), direct(N_taps); vec los_doppler(N_taps); Array tap_spectrum(N_taps); delay_prof(0) = round_i(delay_profile(0) / discrete_Ts); // should be at zero delay anyway power(0) = p_prof(0); spower = p_prof(0) / (1 + los_power(0)); scattered(0) = spower; direct(0) = los_power(0) * spower; los_doppler(0) = los_dopp(0); tap_spectrum(0) = tap_doppler_spectrum(0); // taps within ((j-0.5)Ts,(j+0.5)Ts] are included in the j-th tap int j = 0, j_delay = 0; for (int i = 1; i < N_taps; i++) { if (delay_profile(i) > (j_delay + 0.5)*discrete_Ts) { // first skip empty taps while (delay_profile(i) > (j_delay + 0.5)*discrete_Ts) { j_delay++; } // create a new tap at (j+1)Ts j++; delay_prof(j) = j_delay; power(j) = p_prof(i); spower = p_prof(i) / (1 + los_power(i)); scattered(j) = spower; direct(j) = los_power(i) * spower; los_doppler(j) = los_dopp(i); tap_spectrum(j) = tap_doppler_spectrum(i); } else { // add to the previously created tap power(j) += p_prof(i); spower = p_prof(i) / (1 + los_power(i)); scattered(j) += spower; direct(j) += los_power(i) * spower; it_assert(tap_spectrum(j) == tap_doppler_spectrum(i), "TDL_Channel::discretize(): Sampling frequency too low. Can not discretize the channel with different Doppler spectra on merged taps."); it_warning("TDL_Channel::discretize(): Sampling frequency too low. Merging original tap " << i << " with new tap " << j << "."); if (los_doppler(j) != los_dopp(i)) { los_doppler(j) = 0.7; it_warning("TDL_Channel::discretize(): LOS Doppler value reset to 0.7 for tap " << j << " due to the merging process."); } } } int no_taps = j + 1; // number of taps found if (no_taps < N_taps) { delay_prof.set_size(no_taps, true); power.set_size(no_taps, true); direct.set_size(no_taps, true); scattered.set_size(no_taps, true); los_doppler.set_size(no_taps, true); tap_spectrum.set_size(no_taps, true); // write over the existing channel profile with its new version N_taps = no_taps; a_prof = sqrt(power); los_power = elem_div(direct, scattered); los_dopp = los_doppler; tap_doppler_spectrum = tap_spectrum; } // new discretized path's delays d_prof = delay_prof; // in samples } // -------------------------------------------------------------------------- // Binary Symetric Channel class methods // -------------------------------------------------------------------------- bvec BSC::operator()(const bvec &input) { int i, length = input.length(); bvec output(length); for (i = 0; i < length; i++) { if (u() <= p) { output(i) = input(i) + bin(1); } else { output(i) = input(i); } } return output; } // -------------------------------------------------------------------------- // AWGN_Channel class methods // -------------------------------------------------------------------------- cvec AWGN_Channel::operator()(const cvec &input) { int n = input.size(); cvec noise(n); rng_cn.sample_vector(n, noise); noise *= sigma; noise += input; return noise; } vec AWGN_Channel::operator()(const vec &input) { int n = input.size(); vec noise(n); rng_n.sample_vector(n, noise); noise *= sigma; noise += input; return noise; } } // namespace itpp itpp-4.3.1/itpp/comm/channel.h000066400000000000000000001275221216575753400162130ustar00rootroot00000000000000/*! * \file * \brief Communication channels' classes - header file * \author Tony Ottosson, Pal Frenger, Adam Piatyszek and Zbigniew Dlugaszewski * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CHANNEL_H #define CHANNEL_H #include #include #include #include #include #include #include /*! * \addtogroup channels * \brief Communication Channel Models * \author Tony Ottosson, Pal Frenger, Adam Piatyszek and Zbigniew Dlugaszewski * * * \section toc Table of Contents * * - \ref channel_intro * - \ref channel_doppler * - \ref channel_freq_sel * - \ref channel_los * - \ref channel_ref * * * \section channel_intro Introduction * * When simulating a communication link, a model of the channel behaviour * is usually needed. Such a model typically consist of three parts: the * propagation attenuation, the shadowing (log-normal fading) and the * multipath fading (small scale fading). In the following we will focus * on the small scale (or multipath) fading. * * Multipath fading is the process where the received signal is a sum of * many reflections, each with different propagation time, phase and * attenuation. The sum signal will vary in time if the receiver (or * transmitter) moves, or if some of the reflectors move. We usually refer * to this process as a fading process and try to model it as a stochastic * process. The most common model is the Rayleigh fading model where the * process is modeled as a sum of infinitely many (in practise it is * enough with only a few) received reflections from all angles (uniformly * distributed) around the receiver. Mathematically we write the received * signal, \f$ r(t) \f$ as * * \f[ r(t) = a(t) * s(t), \f] * * where \f$ s(t) \f$ is the transmitted signal and \f$ a(t) \f$ is the * complex channel coefficient (or fading process). If this process is * modeled as a Rayleigh fading process then \f$ a(t) \f$ is a complex * Gaussian process and the envelope \f$ \|a(t)\| \f$ is Rayleigh * distributed. * * * \section channel_doppler Doppler * * The speed by which the channel changes is decided by the speed of the * mobile (transmitter or receiver or both). This movement will cause the * channel coefficient \f$ a(t) \f$ to be correlated in time (or * equivalently in frequency). Different models of this correlation exist, * but the most common is the classical Jakes model where the correlation * function is given as * * \f[ R(\tau) = E[a^*(t) a(t+\tau)] = J_0(2 \pi f_\mathrm{max} \tau), \f] * * where \f$ f_\mathrm{max} \f$ is the maximum Doppler frequency given by * * \f[ f_\mathrm{max} = \frac{v}{\lambda} = \frac{v}{c_0} f_c. \f] * * Here \f$ c_0 \f$ is the speed of light and \f$ f_c \f$ is the carrier * frequency. Often the maximum Doppler frequency is given as the * normalized Doppler \f$ f_\mathrm{max} T_s \f$ , where \f$ T_s \f$ is * the sample duration (often the symbol time) of the simulated system. * Instead of specifying the correlation function \f$ R(\tau) \f$ one can * specify the Doppler spectrum (the Fourier transform of \f$ R(\tau) * \f$). * * * \section channel_freq_sel Frequency-selective Channels * * Since \f$ a(t) \f$ affects the transmitted signal as a constant scaling * factor at a given time, this channel model is often referred to as * flat-fading (or frequency non-selective fading). On the other hand, if * time arrivals of the reflections are very different (compared to the * sampling time), we cannot model the received signal only as a scaled * version of the transmitted signal. Instead we model the channel as * frequency-selective but time-invariant (or at least wide-sense * stationary) with the impulse response * * \f[ h(t) = \sum_{k=0}^{N_\mathrm{taps}-1} a_k \exp (-j \theta_k ) * \delta(t-\tau_k), \f] * * where \f$ N_\mathrm{taps} \f$ is the number of channel taps, \f$ a_k * \f$ is the average amplitude at delay \f$ \tau_k \f$, and \f$ \theta_k * \f$ is the channel phase of the \f$ k^{th} \f$ channel tap. * * The average power and delay profiles are defined as: * * \f[ \mathbf{a} = [a_0, a_1, \ldots, a_{N_\mathrm{taps}-1}] \f] * * and * * \f[ \mathbf{\tau} = [\tau_0, \tau_1, \ldots, \tau_{N_\mathrm{taps}-1}], * \f] * * respectively. We assume without loss of generality that \f$ \tau_0 = 0 * \f$ and \f$ \tau_0 < \tau_1 < \ldots < \tau_{N_\mathrm{taps}-1} \f$. * Now the received signal is simply a linear filtering (or convolution) * of the transmitted signal, where \f$ h(t) \f$ is the impulse response * of the filter. * * In practice, when simulating a communication link, the impulse response * \f$ h(t) \f$ is sampled with a sample period \f$ T_s \f$ that is * related to the symbol rate of the system of investigation (often 2-8 * times higher). Hence, the impulse response of the channel can now be * modeled as a time-discrete filter or tapped-delay line (TDL) where the * delays are given as \f$ \tau_k = d_k T_s \f$, and \f$ d_k \f$ are * positive integers. * * * \section channel_los Line of Sight (LOS) or Rice Fading * * If there is a line of sight (LOS) between the transmitter and receiver * the first component received (or a few first) will have a static * component that depends only on the Doppler frequency. In practice the * difference in time between the first LOS component(s) and the reflected * components is small and hence in a discretized system the first tap is * usually modeled as a LOS component and a fading component. Such a * process is usually called a Rice fading process. * * The LOS component can be expressed as: * * \f[ \rho \exp(2 \pi f_\rho t + \theta_\rho), \f] * * where \f$ \rho \f$, \f$ f_\rho \f$, and \f$ \theta_\rho \f$ are the * amplitude, Doppler frequency and phase of the LOS component, * respectively. Instead of stating the amplitude itself, the ratio of the * LOS power and total fading process power, called the Rice factor (or * relative power), is often used. The Doppler frequency is limited by the * maximum Doppler frequency \f$ f_\mathrm{max} \f$ and hence typically * the Doppler of the LOS is expressed relative to its maximum (common is * \f$ f_\rho = 0.7 f_\mathrm{max} \f$). The phase is usually assumed to * be random and can without loss of generality be set to 0 (does not * affect the statistics of the process). * * * \section channel_ref References * * - [Pat02] Matthias Patzold, Mobile fading channels, Wiley, 2002. * - [Stu01] Gordon L. Stuber, Principles of mobile communication, 2nd. * ed., Kluwer, 2001. * - [Rap96] Theodore S. Rappaport, Wireless communications: principles * and practise, Prentice Hall, 1996. * */ namespace itpp { //! \addtogroup channels //@{ //! Predefined channel profiles. Includes LOS and Doppler spectrum settings. enum CHANNEL_PROFILE { ITU_Vehicular_A, ITU_Vehicular_B, ITU_Pedestrian_A, ITU_Pedestrian_B, COST207_RA, COST207_RA6, COST207_TU, COST207_TU6alt, COST207_TU12, COST207_TU12alt, COST207_BU, COST207_BU6alt, COST207_BU12, COST207_BU12alt, COST207_HT, COST207_HT6alt, COST207_HT12, COST207_HT12alt, COST259_TUx, COST259_RAx, COST259_HTx }; //! Fading generator type: Independent (default), Static or Correlated. enum FADING_TYPE { Independent, Static, Correlated }; //! Correlated fading generation methods: Rice_MEDS (default), IFFT or FIR. enum CORRELATED_METHOD { Rice_MEDS, IFFT, FIR }; //! Rice fading generation methods: MEDS. enum RICE_METHOD { MEDS }; //! Predefined Doppler spectra enum DOPPLER_SPECTRUM { Jakes = 0, J = 0, Classic = 0, C = 0, GaussI = 1, Gauss1 = 1, GI = 1, G1 = 1, GaussII = 2, Gauss2 = 2, GII = 2, G2 = 2 }; /*! * \brief Fading generator class * \author Tony Ottosson, Adam Piatyszek and Zbigniew Dlugaszewski * * Abstract base class defining the interface of a single tap fading * generator. Besides pure interface methods it implements a common * \a set_LOS_power() method for setting up the Rice factor to be used in * fading generators, which inherit from this class. */ class ITPP_EXPORT Fading_Generator { public: //! Default constructor Fading_Generator(); //! Destructor virtual ~Fading_Generator() {} //! Set relative LOS power void set_LOS_power(double relative_power); //! Set relative Doppler of the LOS component (for correlated fading generators) virtual void set_LOS_doppler(double relative_doppler); //! Set time offset in samples (for correlated fading generators) virtual void set_time_offset(int offset); //! Set FIR filter length (for FIR fading generator) virtual void set_filter_length(int filter_length); //! Set normalized Doppler (for correlated fading generators) virtual void set_norm_doppler(double norm_doppler); //! Set Doppler spectrum (for Rice fading generator) virtual void set_doppler_spectrum(DOPPLER_SPECTRUM spectrum); //! Set number of sine frequencies (for Rice fading generator) virtual void set_no_frequencies(int no_freq); //! Set calculation method of Doppler frequencies and amplitudes (for Rice fading generator) virtual void set_rice_method(RICE_METHOD method); //! Get relative power of LOS component (Rice factor) double get_LOS_power() const { return los_power; } //! Get relative Doppler of the LOS component (for correlated fading generators) virtual double get_LOS_doppler() const; //! Get time offset in samples (for correlated fading generators) virtual double get_time_offset() const; //! Set FIR filter length (for FIR fading generator) virtual int get_filter_length() const; //! Return normalized Doppler (for correlated fading generators) virtual double get_norm_doppler() const; //! Return Doppler spectrum (for Rice fading generator) virtual DOPPLER_SPECTRUM get_doppler_spectrum() const; //! Get number of sine frequencies (for Rice fading generator) virtual int get_no_frequencies() const; //! Get calculation method of Doppler frequencies and amplitudes (for Rice fading generator) virtual RICE_METHOD get_rice_method() const; //! Shift generator time offset by a number of samples (for correlated fading generators) virtual void shift_time_offset(int no_samples); //! Initialize the generator virtual void init() = 0; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec &output) = 0; //! Generate \a no_samples values from the fading process cvec generate(int no_samples); protected: bool init_flag; //!< signals if generator is initialized or not double los_power; //!< Relative power of LOS component compared to diffuse component (K factor) double los_diffuse; //!< Diffuse component: sqrt(1 / (1 + los_power)) double los_direct; //!< Direct component: sqrt(los_power / (1 + los_power)) }; //! \cond #if (!defined(_MSC_VER) || (defined(_MSC_VER) && defined (ITPP_SHARED_LIB))) //define two input stream operators for data types involved //otherwise explicit instantiation of Array is impossible inline std::istream& operator>>(std::istream& is, Fading_Generator* &pfg) { void* p; is >> p; if(is) pfg = (Fading_Generator*)p; return is; } inline std::istream& operator>>(std::istream& is, DOPPLER_SPECTRUM& sp) { int val; is >> val; if(!is) return is; if(val > 0 && val <= G2) sp = (DOPPLER_SPECTRUM)val; else is.setstate(std::ios_base::failbit); return is; } //MSVC explicitly instantiate required template while building the shared library #ifdef _WIN32 template class ITPP_EXPORT Array; template class ITPP_EXPORT Array; #endif #endif //! \endcond /*! * \brief Independent (random) fading generator class * \author Adam Piatyszek * * This class implements the intependent fading generator, which can be * used on each tap of the TDL channel model. This generator produces a * set of independent Rayleigh or Rice distributed channel coefficients. */ class ITPP_EXPORT Independent_Fading_Generator : public Fading_Generator { public: //! Default constructor Independent_Fading_Generator() : Fading_Generator() {} //! Destructor virtual ~Independent_Fading_Generator() {} //! Initialize the generator virtual void init() { init_flag = true; } using Fading_Generator::generate; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec& output); }; /*! * \brief Static fading generator class * \author Adam Piatyszek * * This class implements the static fading generator, which can be * used on each tap of the TDL channel model. This generator produces a * set of identical (static) Rayleigh or Rice distributed channel * coefficients. */ class ITPP_EXPORT Static_Fading_Generator : public Fading_Generator { public: //! Default constructor Static_Fading_Generator() : Fading_Generator() {} //! Destructor virtual ~Static_Fading_Generator() {} //! Initialize the generator virtual void init(); using Fading_Generator::generate; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec& output); protected: //! Static Rayleigh distributed sample double static_sample_re; double static_sample_im; }; /*! * \brief Correlated (random) fading generator class * \author Adam Piatyszek * * Correlated fading generator class implements an abstract interface for * a set of generators. Parameter that define the correlated fading * process are the normalized Doppler and optionally the relative Doppler * of a LOS component. * * References: * - [Pat02] Matthias Patzold, Mobile fading channels, Wiley, 2002. */ class ITPP_EXPORT Correlated_Fading_Generator : public Fading_Generator { public: //! Default constructor Correlated_Fading_Generator(double norm_doppler); //! Destructor virtual ~Correlated_Fading_Generator() {} //! Set normalized Doppler virtual void set_norm_doppler(double norm_doppler); //! Set relative Doppler (compared to the maximum Doppler) for the LOS component virtual void set_LOS_doppler(double relative_doppler); //! Set time offset in samples virtual void set_time_offset(int offset); //! Return normalized Doppler virtual double get_norm_doppler() const { return n_dopp; } //! Get relative Doppler (compared to the maximum doppler) for the LOS component virtual double get_LOS_doppler() const { return los_dopp; } //! Get time offset in samples virtual double get_time_offset() const { return time_offset; } //! Shift generator time offset by a number of samples virtual void shift_time_offset(int no_samples); //! Initialize the generator virtual void init() = 0; using Fading_Generator::generate; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec& output) = 0; protected: double n_dopp; //!< Normalized maximum Doppler frequency double los_dopp; //!< Relative Doppler on LOS component (0.7 by default) double time_offset; //!< Time offset in samples (time state in the generator) //! add LOS component to the \a sample with index \a idx void add_LOS(int idx, std::complex& sample); }; /*! * \brief Rice type fading generator class * \author Tony Ottosson, Adam Piatyszek and Zbigniew Dlugaszewski * * A Rice generator is a generator of the form: * * \f[ \tilde \mu_i(t) = \sum_{n=1}^{N_i} c_{i,n} \cos(2\pi f_{i,n} t + * \theta_{i,n}) \f] * * Here \f$ c_{i,n} \f$, \f$ f_{i,n} \f$, and \f$ \theta_{i,n} \f$ are the * Doppler coefficients, discrete Doppler frequencies, and Doppler phases, * respectively. Rice showed that a generator of this form can perfectly * model a Gaussian process when \f$ N_i \rightarrow \infty \f$. When * generating a fading pattern we need a complex-valued generator * * \f[ \tilde \mu(t) = \tilde \mu_1(t) + j \tilde \mu_2(t) \f] * * Parameters that define the generator are the normalized Doppler and the * doppler spectrum. Possible values of the Doppler spectrum are: * - Jakes, J, Classic, C: The classical Jakes spectrum shape. * This method can be also used for modelling LOS paths, by setting the * LOS relative power (Rice factor) and LOS Doppler parameters. * - GaussI, GI, Gauss1, G1 * - GaussII, GII, Gauss2, G2 * * Furthermore also the number of sine waves, \f$ N_i \f$ and method used * to calculate the parameters \f$ c_{i,n} \f$, \f$ f_{i,n} \f$, and \f$ * \theta_{i,n} \f$ can be specified. For now the only method defined for * calculating the parameters is the Method of Exact Doppler Spread * (MEDS). See [Pat02] for more details. * * References: * - [Pat02] Matthias Patzold, Mobile fading channels, Wiley, 2002. */ class ITPP_EXPORT Rice_Fading_Generator : public Correlated_Fading_Generator { public: //! Default constructor Rice_Fading_Generator(double norm_doppler, DOPPLER_SPECTRUM spectrum = Jakes, int no_freq = 16, RICE_METHOD method = MEDS); //! Destructor virtual ~Rice_Fading_Generator() {} //! Set Doppler spectrum virtual void set_doppler_spectrum(DOPPLER_SPECTRUM spectrum); //! Set number of Doppler frequencies virtual void set_no_frequencies(int no_freq); //! Set calculation method of Doppler frequencies and amplitudes virtual void set_rice_method(RICE_METHOD method); //! Return Doppler spectrum virtual DOPPLER_SPECTRUM get_doppler_spectrum() const { return dopp_spectrum; } //! Get number of Doppler frequencies virtual int get_no_frequencies() const { return Ni; } //! Get calculation method of Doppler frequencies and amplitudes virtual RICE_METHOD get_rice_method() const { return rice_method; } //! Initialize the generator virtual void init(); using Correlated_Fading_Generator::generate; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec &output); protected: DOPPLER_SPECTRUM dopp_spectrum; //!< Doppler spectrum type (Jakes by default) //! Number of sine waves in a Gaussian process int Ni; //! Rice process generation method RICE_METHOD rice_method; /*! Doppler frequencies, amplitudes and phases * @{ */ vec f1, f2, c1, c2, th1, th2; /*! @} */ /*! Frequency shift values of the Doppler spectrum in GaussI and GaussII * @{ */ double f01, f02; /*! @} */ //! Init function for MEDS method void init_MEDS(); }; /*! * \brief FIR type Fading generator class * \author Tony Ottosson and Adam Piatyszek * * A FIR generator is a linear finite impulse response (FIR) filter * implementation of a filter method for generation of a fading process. * Parameters that define the generator are the normalized Doppler and * length of the FIR filter. The default value of filter length is 500. If * the normalized Doppler frequency is lower than 0.1 an equivalent * process of a higher normalized Doppler is generated and linearly * interpolated. * * References: * - [Stu01] Gordon L. Stuber, Principles of mobile communication, 2nd. * ed., Kluwer, 2001. * - [Rap96] Theodore S. Rappaport, Wireless communications: principles * and practise, Prentice Hall, 1996. */ class ITPP_EXPORT FIR_Fading_Generator : public Correlated_Fading_Generator { public: //! Default constructor FIR_Fading_Generator(double norm_doppler, int filter_length = 500); //! Destructor virtual ~FIR_Fading_Generator() {} //! Set FIR filter length virtual void set_filter_length(int filter_length); //! Get filter length virtual int get_filter_length() const { return fir_length; } //! Initialize the generator virtual void init(); using Correlated_Fading_Generator::generate; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec &output); protected: int fir_length; //!< Size of FIR filter int upsample_rate; //!< Upsampling rate for linear interpolation //! Filter used for fading generation MA_Filter, double, std::complex > fir_filter; cvec left_overs; //!< Left-overs from upsampling /*! * \brief Jakes spectrum filter * * Function that generates the taps in the Jakes filter. * \param order Number of taps in the filter * \param norm_dopp Normalized Doppler frequency, i.e. \f$ f_{norm} = * f_{max} T_{s} \f$, where \f$ f_{max} \f$ is the actual Doppler * frequency and \f$ T_{s} \f$ is the sampling interval. * \return A vector containing the filter taps of the Jakes filter. */ vec Jakes_filter(double norm_dopp, int order = 100); }; /*! * \brief IFFT type Fading generator class * \author Tony Ottosson and Adam Piatyszek * * A IFFT generator is a frequency domain filter implementation of filter * method for generation of a fading process. Parameters that define the * generator is the normalized Doppler. * * The method is block-based and consecutive blocks are independent * fading. The method is very efficient for large blocks. The size of the * FFT, \f$ N_\mathrm{fft} \f$, is given by the nearest higher integer * power of two that is larger than \a no_samples. For small blocks the * FFT size is increased to keep a good accuracy (at least 10 samples in * the representation of the Doppler spectrum). However, to keep the * program reasonably efficient the largest upsampling factor is 64. * Higher factors will result in a run-time error. If so, please use * another method. * * References: * - [Stu01] Gordon L. Stuber, Principles of mobile communication, 2nd. * ed., Kluwer, 2001. * - [Rap96] Theodore S. Rappaport, Wireless communications: principles * and practise, Prentice Hall, 1996. */ class ITPP_EXPORT IFFT_Fading_Generator : public Correlated_Fading_Generator { public: //! Default constructor IFFT_Fading_Generator(double norm_doppler) : Correlated_Fading_Generator(norm_doppler) {} //! Destructor virtual ~IFFT_Fading_Generator() {} //! Initialize the generator virtual void init() { init_flag = true; } using Correlated_Fading_Generator::generate; //! Generate \a no_samples values from the fading process virtual void generate(int no_samples, cvec &output); protected: //! Generator for Jakes spectrum void generate_Jakes(int no_samples, cvec &output); }; /*! * \brief General specification of a time-domain multipath channel * \author Tony Ottosson and Adam Piatyszek * * This class does NOT generate any channel values. It is only used to * specify the channel model. To generate channel coefficients use the * Tapped-Delay Line (TDL) class \a TDL_Channel. * * A time invariant (or at least wide-sense stationary) channel have an * impulse response that can be modeled as: * * \f[ h(t) = \sum_{k=0}^{N_\mathrm{taps}-1} a_k \exp (-j \theta_k) * \delta(t-\tau_k), \f] * * where \f$ N_{taps} \f$ is the number of channel taps, \f$ a_k \f$ is * the average amplitude at delay \f$ \tau_k \f$, and \f$ \theta_k \f$ is * the channel phase of the \f$ k^{th} \f$ channel tap. The average power * profile, and the delay profiles are defined as: * * \f[ \mathbf{a} = [a_0, a_1, \ldots, a_{N_\mathrm{taps}-1}] \f] * * and * * \f[ \mathbf{\tau} = [\tau_0, \tau_1, \ldots, \tau_{N_\mathrm{taps}-1}], * \f] * * respectively. We assume without loss of generality that \f$ \tau_0 = 0 * \f$ and \f$ \tau_0 < \tau_1 < \ldots < \tau_{N_\mathrm{taps}-1} \f$. * * To initialize the class the following parameters should be defined: * - \a avg_power_dB Average power profile \f$ \mathbf{a} \f$, given in dB * - \a delay_profile Delay profile \f$ \mathbf{\tau} \f$, given in seconds. * The delay profile should be sorted (increasing delay) and the first * delay has to be 0. * * Optionally one can define LOS parameters: \a relative_power and * \a relative_doppler, and additionally the kind of Doppler spectrum for * each tap. * * It is also possible to specify a predefined channel model. The * implemented ones are as follows: * - ITU Channel models: * - \a ITU_Vehicular_A, 6-tap channel * - \a ITU_Vehicular_B, 6-tap channel * - \a ITU_Pedestrian_A, 4-tap channel * - \a ITU_Pedestrian_B, 6-tap channel * - COST 207 Channel models (see [Pat02] pp. 259-266): * - \a COST207_RA, Rural area, 4-tap channel * - \a COST207_RA6, Rural area, 6-tap channel * - \a COST207_TU, Typical urban, 6-tap channel * - \a COST207_TU6alt, Typical urban, alternative 6-tap channel * - \a COST207_TU12, Typical urban, 12-tap channel * - \a COST207_TU12alt, Typical urban, alternative 12-tap channel * - \a COST207_BU, Bad urban, 6-tap channel * - \a COST207_BU6alt, Bad urban, alternative 6-tap channel * - \a COST207_BU12, Bad urban, 12-tap channel * - \a COST207_BU12alt, Bad urban, alternative 12-tap channel * - \a COST207_HT, Hilly terrain, 6-tap channel * - \a COST207_HT6alt, Hilly terrain, alternative 6-tap channel * - \a COST207_HT12, Hilly terrain, 12-tap channel * - \a COST207_HT12alt, Hilly terrain, alternative 12-tap channel * - COST 259 Channel models (see [3GPP_TR_25.943]): * - \a COST259_TUx, Typical urban, 20-tap channel * - \a COST259_RAx, Rural ara, 10-tap channel * - \a COST259_HTx, Hilly terrain, 20-tap channel * * References: * - [Pat02] Matthias Patzold, Mobile fading channels, Wiley, 2002. * - [3GPP_TR_25.943] Technical Specification Group Radio Access Networs; * Deployment aspects. Version 5.1.0 (2002-06). */ class ITPP_EXPORT Channel_Specification { public: //! Default constructor (power profile in dB, delay profile in seconds) Channel_Specification(const vec &avg_power_dB = "0", const vec &delay_prof = "0"); //! Initialize with predetermined channel profile Channel_Specification(const CHANNEL_PROFILE profile); //! Destructor virtual ~Channel_Specification() {} //! Set both average power profile in dB and power delay profile in seconds void set_channel_profile(const vec &avg_power_dB, const vec &delay_prof); //! Set channel profile to a predetermined profile void set_channel_profile(const CHANNEL_PROFILE profile); //! Set doppler spectrum for each tap in the channel profile void set_doppler_spectrum(DOPPLER_SPECTRUM *tap_spectrum); //! Set doppler spectrum for tap \a tap_number in the channel profile. void set_doppler_spectrum(int tap_number, DOPPLER_SPECTRUM tap_spectrum); //! Set LOS (Rice) components for tap \a tap_number void set_LOS(int tap_number, double relative_power, double relative_doppler = 0.7); //! Set LOS (Rice) components for all taps void set_LOS(const vec& relative_power, const vec& relative_doppler = ""); //! Get both average power profile in dB and power delay profile in seconds void get_channel_profile(vec &avg_power_dB, vec &delay_prof) const; //! Return power profile in dB vec get_avg_power_dB() const { return a_prof_dB; } //! Return delay profile in seconds vec get_delay_prof() const { return d_prof; } //! Get doppler spectrum for tap \a index Array get_doppler_spectrum() const { return tap_doppler_spectrum; } //! Get doppler spectrum for tap \a index DOPPLER_SPECTRUM get_doppler_spectrum(int index) const; //! Get relative power (Rice factor) for each tap vec get_LOS_power() const { return los_power; } //! Get relative Doppler for each tap vec get_LOS_doppler() const { return los_dopp; } //! Get relative power (Rice factor) for tap \a tap_number double get_LOS_power(int tap_number) const { return los_power(tap_number); } //! Get relative Doppler for tap \a tap_number double get_LOS_doppler(int tap_number) const { return los_dopp(tap_number); } //! Return the number of channel taps int taps() const { return N_taps; } //! Calculate mean excess delay in samples double calc_mean_excess_delay() const; //! Calculate RMS delay spread in samples double calc_rms_delay_spread() const; protected: vec a_prof_dB; //!< Power profile in dB vec d_prof; //!< Delay profile in seconds Array tap_doppler_spectrum; //!< Doppler spectrum for each tap int N_taps; //!< Number of taps vec los_power; //!< Relative power for each Rice component vec los_dopp; //!< Relative Rice Doppler for each Rice component }; /*! * \brief Tapped Delay Line (TDL) channel model * \author Tony Ottosson, Adam Piatyszek and Zbigniew Dlugaszewski * * A time invariant (or at least wide-sense stationary) channel have an * impulse response that can be modeled as: * * \f[ h(t) = \sum_{k=0}^{N_\mathrm{taps}-1} a_k \exp (-j \theta_k ) * \delta(t-\tau_k), \f] * * where \f$ N_{taps} \f$ is the number of channel taps, \f$ a_k \f$ is * the average amplitude at delay \f$ \tau_k \f$, and \f$ \theta_k \f$ is * the channel phase of the \f$ k^{th} \f$ channel tap. The average power * profile, and delay profile are defined as: * * \f[ \mathbf{a} = [a_0, a_1, \ldots, a_{N_\mathrm{taps}-1}] \f] * * and * * \f[ \mathbf{\tau} = [\tau_0, \tau_1, \ldots, \tau_{N_\mathrm{taps}-1}], * \f] * * respectively. We assume without loss of generality that \f$ \tau_0 = * 0 \f$ and \f$ \tau_0 < \tau_1 < \ldots < \tau_{N_\mathrm{taps}-1} \f$. * * To initialize the channel profile the following parameters should be * defined: * - \a avg_power_dB Average power profile \f$ \mathbf{a} \f$, given in dB * - \a delay_profile Delay profile \f$ \mathbf{\tau} \f$, given in samples. * The delay profile should be sorted (increasing delay) and the first * delay has to be 0. * * In the case of correlated channel, the correlation in time is decided * by the normalized Doppler frequency and Doppler spectrum. The * normalized Doppler frequency is calculated as \f$ f_\mathrm{max} T_s * \f$, where \f$ f_\mathrm{max} \f$ is the maximum Doppler frequency and * \f$ T_s \f$ is the sample duration. * * Two main types of generation methods exist: the filter method and Rice * method. In the filter method the correlated fading process is generated * with a filtering of the complex Gaussian process to achieve a given * Doppler spectrum (\a Jakes by default). Currently there are two filter * implementations: * - \a FIR - Finite Impulse Response (FIR) filter. Rather slow and * inaccurate. Use with care. * - \a IFFT - Blockwise filtering in the frequency-domain. Consecutive * blocks have independent fading. Very efficient method for large blocks. * * The preferred method for generating the correlated fading process is * the \a Rice method that approximate the fading process as a sum of * sinusoids. Currently there is only one implementation, the Rice Method * of Exact Doppler Spread (\a Rice_MEDS), which is also the default choice. * * To summarize, the currently supported correlated fading generation * methods are: * - \a FIR - filter FIR method * - \a IFFT - filter IFFT method * - \a Rice_MEDS - sum of sine waves MEDS method * * Beside the above described correlated methods, two additional fading * generators exists: the \a Independent_Fading_Generator and * \a Static_Fading_Generator ones. Their names are self-explanatory. The * only optional parameter of these two generators is a \a relative_power * of the LOS component. * * Example: Simulation of WCDMA * \code * #include * using namespace itpp; * * int main() { * // set sampling time at a half of chip rate (0.5 / 3.84e6) * double Ts = 130.2e-9; * // select the COST259 Rural Area model * Channel_Specification channel_spec(COST259_RAx); * // initialize with the predefined channel profile * TDL_Channel channel(channel_spec, Ts); * // set the normalized Doppler; fading type will be set to Correlated * // and Rice_MEDS method will be used (default settings) * channel.set_norm_doppler(0.01); * * cvec transmitted_signal; * // ----------------------------------------------- * // Your code here generates the transmitted signal * // ----------------------------------------------- * * // Channel coefficients are returned in the 'coeff' array of complex values * Array coeff; * cvec received_signal = channel(transmitted_signal, coeff); * } * \endcode * * References: * - [Pat02] Matthias Patzold, Mobile fading channels, Wiley, 2002. * - [Stu01] Gordon L. Stuber, Principles of mobile communication, 2nd. * ed., Kluwer, 2001. * - [Rap96] Theodore S. Rappaport, Wireless communications: principles * and practise, Prentice Hall, 1996. */ class ITPP_EXPORT TDL_Channel { public: //! Default constructor TDL_Channel(const vec &avg_power_dB = "0", const ivec &delay_prof = "0"); //! Constructor with defined Channel_Specification. Delay profile will be discretized with \a sampling_time in seconds. TDL_Channel(const Channel_Specification &channel_spec, double sampling_time); //! Destructor virtual ~TDL_Channel(); //! Set both average power profile in dB and power delay profile in samples void set_channel_profile(const vec &avg_power_dB, const ivec &delay_prof); //! Set channel profile to uniform with \a no_taps taps void set_channel_profile_uniform(int no_taps); //! Set channel profile to exponential with \a no_taps taps void set_channel_profile_exponential(int no_taps); //! Set channel profile using Channel_Specification. Delay profile will be discretized with \a sampling_time in seconds. void set_channel_profile(const Channel_Specification &channel_spec, double sampling_time); //! Set the fading generation method to \a method void set_correlated_method(CORRELATED_METHOD method); //! Set fading type to one of \a Independent, \a Static or \a Correlated void set_fading_type(FADING_TYPE fading_type); //! Set normalized Doppler rate. A \a Correlated fading type will be used. void set_norm_doppler(double norm_doppler); //! Set LOS parameters for each tap. LOS Doppler will be set to 0.7 by default. void set_LOS(const vec& relative_power, const vec& relative_doppler = ""); //! Set LOS power for each tap. LOS Doppler will be set to 0.7 by default. void set_LOS_power(const vec& relative_power); //! Set LOS doppler for each tap. A \a Correlated fading type will be used. void set_LOS_doppler(const vec& relative_doppler); //! Set doppler spectrum for each tap in the channel profile. \a Rice_MEDS method will be used. void set_doppler_spectrum(const DOPPLER_SPECTRUM *tap_spectrum); //! Set doppler spectrum of tap \a tap_number. \a Rice_MEDS method will be used. void set_doppler_spectrum(int tap_number, DOPPLER_SPECTRUM tap_spectrum); //! Set number of sine frequencies. \a Rice_MEDS method will be used. void set_no_frequencies(int no_freq); //! Set fading generators' time offset in samples. A \a Correlated fading type will be used. void set_time_offset(int offset); //! Shift fading generators' time offset. A \a Correlated fading type will be used. void shift_time_offset(int no_samples); //! Set fading generator filter length. \a FIR method will be used. void set_filter_length(int filter_length); //! Return the number of channel taps int taps() const { return N_taps; } //! Get both average power profile in dB and power delay profile in samples void get_channel_profile(vec &avg_power_dB, ivec &delay_prof) const; //! Return power profile in dB vec get_avg_power_dB() const; //! Return delay profile in samples ivec get_delay_prof() const { return d_prof; } //! Return fading generation method CORRELATED_METHOD get_correlated_method() const { return method; } //! Return fading type FADING_TYPE get_fading_type() const { return fading_type; } //! Return normalized doppler rate double get_norm_doppler() const { return n_dopp; } //! Get relative power (Rice factor) for each tap vec get_LOS_power() const { return los_power; } //! Get relative Doppler (to the maximum Doppler) for each tap vec get_LOS_doppler() const { return los_dopp; } //! Get relative power (Rice factor) for tap \a tap_number double get_LOS_power(int tap_number) const { return los_power(tap_number); } //! Get relative Doppler (to the maximum Doppler) for tap \a tap_number double get_LOS_doppler(int tap_number) const { return los_dopp(tap_number); } //! Get the minimum number of frequencies used in Rice MEDS fading generator int get_no_frequencies() const { return nrof_freq; } //! Get fading generators' time ofset double get_time_offset() const; //! Calculate mean excess delay in samples double calc_mean_excess_delay() const; //! Calculate RMS delay spread in samples double calc_rms_delay_spread() const; //! Initialize all fading generators. Automatically invoked in generate() or filter() functions. void init(); //! Generate \a no_samples values of the channel void generate(int no_samples, Array &channel_coeff); //! Generate \a no_samples values of the channel. Returns the matrix with one tap per column. void generate(int no_samples, cmat &channel_coeff); //! Filter the \a input with the known channel values \a channel_coeff (e.g. from the generate function) void filter_known_channel(const cvec &input, cvec &output, const Array &channel_coeff); //! Filter the \a input with the known channel values \a channel_coeff (e.g. from the generate function) void filter_known_channel(const cvec &input, cvec &output, const cmat &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients void filter(const cvec &input, cvec &output, Array &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients void filter(const cvec &input, cvec &output, cmat &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients cvec filter(const cvec &input, Array &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients cvec filter(const cvec &input, cmat &channel_coeff); //! Generate channel coefficients and filter the \a input. Only return the output void filter(const cvec &input, cvec &output); //! Generate channel coefficients and filter the \a input. Only return output cvec filter(const cvec &input); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients void operator()(const cvec &input, cvec &output, Array &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients void operator()(const cvec &input, cvec &output, cmat &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients cvec operator()(const cvec &input, Array &channel_coeff); //! Generate channel coefficients and filter the \a input. Return output and channel coefficients cvec operator()(const cvec &input, cmat &channel_coeff); //! Generate channel coefficients and filter the \a input. Only return output cvec operator()(const cvec &input); //! Calculate impulse-response on the supplied channel coefficients (produced by the generate() function) void calc_impulse_response(const Array &channel_coeff, Array &impulse_response); //! Calculate frequency-response on the supplied channel coefficients (produced by the generate() function) void calc_frequency_response(const Array &channel_coeff, Array &frequency_response, const int fft_size); //! Calculate frequency-response on the supplied channel coefficients (produced by the generate() function) void calc_frequency_response(const cmat &channel_coeff, cmat &frequency_response, const int fft_size); //! Return channel sampling time (used for discretization) double get_sampling_time() const { return discrete_Ts; } protected: bool init_flag; //!< Channel ready to produce data vec a_prof; //!< Average amplitude of each tap ivec d_prof; //!< Delay in samples for each tap vec los_power; //!< Relative power for each Rice component vec los_dopp; //!< Relative LOS Doppler for each Rice component int N_taps; //!< Number of taps double n_dopp; //!< Normalized Doppler of the correlated fading FADING_TYPE fading_type; //!< Fading type: Independent (default), Static or Correlated CORRELATED_METHOD method; //!< Correlated fading generation method: Rice_MEDS (default), IFFT or FIR Array tap_doppler_spectrum; //!< Doppler spectrum for each tap Array fading_gen; //!< Fading generators for each tap int filter_length; //!< Filter length of FIR fading generator int nrof_freq; //!< Number of sine frequencies in the Rice MEDS fading generator double discrete_Ts; //!< Sampling time of discretization /*! * \brief Discretize the delay profile with \a discrete_Ts (Ts). All * taps within ((i-0.5)Ts,(i+0.5)Ts] belong to the ith discrete tap. * * \param delay_profile Delay profile in seconds. */ void discretize(const vec &delay_profile); }; /*! \brief A Binary Symetric Channel with crossover probability p. Input and output are of type \a bvec with 0 and 1. Example: \code #include using namespace itpp; int main() { // Initiate the BSC with cross-over probability 0.1 BSC bsc(0.1); bvec transmitted_bits = randb(100); bvec received_bits = bsc(transmitted_bits); } \endcode */ class ITPP_EXPORT BSC { public: //! Class constructor. Sets the error probability to p BSC(double in_p = 0.0) : u(0.0, 1.0) { p = in_p; }; //! Set crossover (bit error) probability void set_prob(double in_p) { p = in_p; }; //! Get crossover (bit error) probability double get_prob() const { return p; }; //! Feed \a input through the BSC channel bvec operator()(const bvec &input); private: Uniform_RNG u; double p; }; /*! \brief Ordinary AWGN Channel for cvec or vec inputs and outputs. For real signals, the input parameter (\a noisevar) denotes the noise variance per real dimension. Therefore, it should be set to \f$N_0/2\f$, where \f$N_0\f$ is the noise power spectral density. However, in case of complex signals, the input parameter (\a noisevar) represents the noise variance per complex dimension, i.e. the sum of the variances in the real and imaginary parts, and thus is equal to \f$N_0\f$. Example: \code #include using namespace itpp; int main() { // Initiate the AWGN_Channel class double noisevar = 0.1; AWGN_Channel awgn_channel(noisevar); // Initiate a QPSK-modulator, and generate the transmitted signal QPSK qpsk; bvec transmitted_bits = randb(20); cvec transmitted_signal = qpsk.modulate_bits(transmitted_bits); // Usage of the member operator () cvec received_signal = awgn_channel(transmitted_signal); // Demodulate the bits bvec received_bits = qpsk.demodulate_bits(received_signal); } \endcode */ class ITPP_EXPORT AWGN_Channel { public: //! Class constructor. Sets the noise variance (for complex-valued channels the sum of real and imaginary parts) AWGN_Channel(double noisevar = 0.0): sigma(std::sqrt(noisevar)) {} //! Set noise variance (for complex-valued channels the sum of real and imaginary parts) void set_noise(double noisevar) { sigma = std::sqrt(noisevar); } //! Get noise variance (for complex-valued channels the sum of real and imaginary parts) double get_noise() const { return sqr(sigma); } //! Feed the complex input \a input through the complex-valued AWGN channel cvec operator()(const cvec &input); //! Feed the input \a through the real-valued AWGN channel vec operator()(const vec &input); private: Complex_Normal_RNG rng_cn; Normal_RNG rng_n; double sigma; }; //@} } // namespace itpp #endif // #ifndef CHANNEL_H itpp-4.3.1/itpp/comm/channel_code.h000066400000000000000000000067061216575753400172050ustar00rootroot00000000000000/*! * \file * \brief Channel Code class virtual interface * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CHANNEL_CODE_H #define CHANNEL_CODE_H #include #include #include namespace itpp { /*! \addtogroup fec */ //---------------------- BCH -------------------------------------- /*! \ingroup fec \brief Generic Channel Code class */ class ITPP_EXPORT Channel_Code { public: //! Default constructor Channel_Code() {} //! Destructor virtual ~Channel_Code() {} //! Encode a bvec of input virtual void encode(const bvec &uncoded_bits, bvec &coded_bits) = 0; //! Encode a bvec of input virtual bvec encode(const bvec &uncoded_bits) = 0; //! Decode a bvec of coded data. virtual void decode(const bvec &codedbits, bvec &decoded_bits) = 0; //! Decode a bvec of coded data //virtual bvec decode(const bvec &coded_bits); virtual bvec decode(const bvec &coded_bits) = 0; //! Decode a vec of received data. virtual void decode(const vec &received_signal, bvec &decoded_bits) = 0; //! Decode a vec of received data //virtual bvec decode(const vec &received_signal); virtual bvec decode(const vec &received_signal) = 0; //! Get the code rate virtual double get_rate() const = 0; }; /*! \ingroup fec \brief Dummy Channel Code class A dummy code class. Uncoded output. */ class ITPP_EXPORT Dummy_Code : public Channel_Code { public: //! Default constructor Dummy_Code() {} //! Destructor virtual ~Dummy_Code() {} //! Encode a bvec of input virtual void encode(const bvec &uncoded_bits, bvec &coded_bits) { coded_bits = uncoded_bits; } //! Encode a bvec of input virtual bvec encode(const bvec &uncoded_bits) { return uncoded_bits; } //! Decode a bvec of coded data. virtual void decode(const bvec &coded_bits, bvec &decoded_bits) { decoded_bits = coded_bits; } //! Decode a bvec of coded data. virtual bvec decode(const bvec &coded_bits) { return coded_bits; } //! Decode a vec of received data. Assumes soft input (BPSK modulated) virtual void decode(const vec &received_signal, bvec &decoded_bits) { BPSK bpsk; bpsk.demodulate_bits(received_signal, decoded_bits); } //! Decode a vec of received data. Assumes soft input (BPSK modulated) virtual bvec decode(const vec &received_signal) { bvec out; decode(received_signal, out); return out; } //! Get the code rate virtual double get_rate() const { return 1.0; } }; } // namespace itpp #endif // #ifndef CHANNEL_CODE_H itpp-4.3.1/itpp/comm/commfunc.cpp000066400000000000000000000056521216575753400167440ustar00rootroot00000000000000/*! * \file * \brief Implementation of some specific functions useful in communications * \author Tony Ottosson and Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include namespace itpp { bmat graycode(int m) { if (m == 1) { smat temp = "0;1"; return to_bmat(temp); } else { bvec temp(1 << (m - 1)); bmat bb = graycode(m - 1); bmat out(1 << m, m); out.zeros(); out.set_col(0, concat(zeros_b(1 << (m - 1)), ones_b(1 << (m - 1)))); for (int i = 0; i < m - 1; i++) { temp = bb.get_col(i); out.set_col(i + 1, concat(temp, reverse(temp))); } return out; } } int hamming_distance(const bvec &a, const bvec &b) { int i, n = 0; it_assert_debug(a.size() == b.size(), "hamming_distance()"); for (i = 0; i < a.size(); i++) if (a(i) != b(i)) n++; return n; } int weight(const bvec &a) { int i, n = 0; for (i = 0; i < a.size(); i++) if (a(i) == bin(1)) n++; return n; } vec waterfilling(const vec &alpha, double P) // added by EGL April 2007 { int n = length(alpha); it_assert(n > 0, "waterfilling(): alpha vector cannot have zero length"); it_assert(P > 0, "waterfilling(): Power constraint must be positive"); ivec ind = sort_index(alpha); // indices in increasing order it_assert(alpha(ind(0)) > 0, "waterfilling(): Gains must be positive"); // find lambda double lambda = 0.0; for (int m = 0; m < n; m++) { // try m,...,n-1 nonzero allocation double t = 0; for (int j = m; j < n; j++) { t += 1.0 / alpha(ind(j)); } t = (t + P) / (n - m); lambda = 1.0 / t; if (lambda < alpha(ind(m))) break; } vec result(n); for (int j = 0; j < n; j++) { result(j) = ((lambda < alpha(j)) ? (1.0 / lambda - 1.0 / alpha(j)) : 0.0); } return result; } } // namespace itpp itpp-4.3.1/itpp/comm/commfunc.h000066400000000000000000000047021216575753400164040ustar00rootroot00000000000000/*! * \file * \brief Definitions of some specific functions useful in communications * \author Tony Ottosson and Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef COMMFUNC_H #define COMMFUNC_H #include #include #include namespace itpp { /*! \brief Generate Gray code of blocklength m. \ingroup misccommfunc The codes are contained as binary codewords {0,1} in the rows of the returned matrix. See also the \c gray() function in \c math/scalfunc.h. */ ITPP_EXPORT bmat graycode(int m); /*! \brief Calculate the Hamming distance between \a a and \a b \ingroup misccommfunc */ ITPP_EXPORT int hamming_distance(const bvec &a, const bvec &b); /*! \brief Calculate the Hamming weight of \a a \ingroup misccommfunc */ ITPP_EXPORT int weight(const bvec &a); /*! * \brief Compute the water-filling solution * \ingroup misccommfunc * * This function computes the solution of the water-filling problem * \f[ * \max_{p_0,...,p_{n-1}} \sum_{i=0}^{n-1} \log\left(1+p_i\alpha_i\right) * \f] * subject to * \f[ * \sum_{i=0}^{n-1} p_i \le P * \f] * * \param alpha vector of \f$\alpha_0,...,\alpha_{n-1}\f$ gains (must have * strictly positive elements) * \param P power constraint * \return vector of power allocations \f$p_0,...,p_{n-1}\f$ * * The computational complexity of the method is \f$O(n^2)\f$ at most */ ITPP_EXPORT vec waterfilling(const vec& alpha, double P); } // namespace itpp #endif // #ifndef COMMFUNC_H itpp-4.3.1/itpp/comm/convcode.cpp000066400000000000000000001217621216575753400167360ustar00rootroot00000000000000/*! * \file * \brief Implementation of a binary convolutional encoder class * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { // ----------------- Protected functions ----------------------------- /* The weight of the transition from given state with the input given */ int Convolutional_Code::weight(const int state, const int input) { int i, j, temp, out, w = 0, shiftreg = state; shiftreg = shiftreg | (input << m); for (j = 0; j < n; j++) { out = 0; temp = shiftreg & gen_pol(j); for (i = 0; i < K; i++) { out ^= (temp & 1); temp = temp >> 1; } w += out; //w += weight_int_table(temp); } return w; } /* The weight (of the reverse code) of the transition from given state with the input given */ int Convolutional_Code::weight_reverse(const int state, const int input) { int i, j, temp, out, w = 0, shiftreg = state; shiftreg = shiftreg | (input << m); for (j = 0; j < n; j++) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < K; i++) { out ^= (temp & 1); temp = temp >> 1; } w += out; //w += weight_int_table(temp); } return w; } /* The weight of the two paths (input 0 or 1) from given state */ void Convolutional_Code::weight(const int state, int &w0, int &w1) { int i, j, temp, out, shiftreg = state; w0 = 0; w1 = 0; shiftreg = shiftreg | (1 << m); for (j = 0; j < n; j++) { out = 0; temp = shiftreg & gen_pol(j); for (i = 0; i < m; i++) { out ^= (temp & 1); temp = temp >> 1; } w0 += out; w1 += out ^(temp & 1); } } /* The weight (of the reverse code) of the two paths (input 0 or 1) from given state */ void Convolutional_Code::weight_reverse(const int state, int &w0, int &w1) { int i, j, temp, out, shiftreg = state; w0 = 0; w1 = 0; shiftreg = shiftreg | (1 << m); for (j = 0; j < n; j++) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < m; i++) { out ^= (temp & 1); temp = temp >> 1; } w0 += out; w1 += out ^(temp & 1); } } /* Output on transition (backwards) with input from state */ bvec Convolutional_Code::output_reverse(const int state, const int input) { int j, temp, temp_state; bvec output(n); temp_state = (state << 1) | input; for (j = 0; j < n; j++) { temp = temp_state & gen_pol(j); output(j) = xor_int_table(temp); } return output; } /* Output on transition (backwards) with input from state */ void Convolutional_Code::output_reverse(const int state, bvec &zero_output, bvec &one_output) { int j, temp, temp_state; bin one_bit; temp_state = (state << 1) | 1; for (j = 0; j < n; j++) { temp = temp_state & gen_pol(j); one_bit = temp & 1; temp = temp >> 1; one_output(j) = xor_int_table(temp) ^ one_bit; zero_output(j) = xor_int_table(temp); } } /* Output on transition (backwards) with input from state */ void Convolutional_Code::output_reverse(const int state, int &zero_output, int &one_output) { int j, temp, temp_state; bin one_bit; zero_output = 0, one_output = 0; temp_state = (state << 1) | 1; for (j = 0; j < n; j++) { temp = temp_state & gen_pol(j); one_bit = temp & 1; temp = temp >> 1; one_output = (one_output << 1) | int(xor_int_table(temp) ^ one_bit); zero_output = (zero_output << 1) | int(xor_int_table(temp)); } } /* Output on transition (backwards) with input from state */ void Convolutional_Code::calc_metric_reverse(int state, const vec &rx_codeword, double &zero_metric, double &one_metric) { int temp; bin one_bit; one_metric = zero_metric = 0; int temp_state = (state << 1) | 1; for (int j = 0; j < n; j++) { temp = temp_state & gen_pol(j); one_bit = temp & 1; temp >>= 1; one_metric += (2 * static_cast(xor_int_table(temp) ^ one_bit) - 1) * rx_codeword(j); zero_metric += (2 * static_cast(xor_int_table(temp)) - 1) * rx_codeword(j); } } // calculates metrics for all codewords (2^n of them) in natural order void Convolutional_Code::calc_metric(const vec &rx_codeword, vec &delta_metrics) { int no_outputs = pow2i(n), no_loop = pow2i(n - 1), mask = no_outputs - 1, temp; delta_metrics.set_size(no_outputs, false); if (no_outputs <= no_states) { for (int i = 0; i < no_loop; i++) { // all input possibilities delta_metrics(i) = 0; temp = i; for (int j = n - 1; j >= 0; j--) { if (temp & 1) delta_metrics(i) += rx_codeword(j); else delta_metrics(i) -= rx_codeword(j); temp >>= 1; } delta_metrics(i ^ mask) = -delta_metrics(i); // the inverse codeword } } else { double zero_metric, one_metric; int zero_output, one_output, temp_state; bin one_bit; for (int s = 0; s < no_states; s++) { // all states zero_metric = 0, one_metric = 0; zero_output = 0, one_output = 0; temp_state = (s << 1) | 1; for (int j = 0; j < n; j++) { temp = temp_state & gen_pol(j); one_bit = temp & 1; temp >>= 1; if (xor_int_table(temp)) { zero_metric += rx_codeword(j); } else { zero_metric -= rx_codeword(j); } if (static_cast(xor_int_table(temp)^one_bit)) { one_metric += rx_codeword(j); } else { one_metric -= rx_codeword(j); } one_output = (one_output << 1) | static_cast(xor_int_table(temp) ^ one_bit); zero_output = (zero_output << 1) | static_cast(xor_int_table(temp)); } delta_metrics(zero_output) = zero_metric; delta_metrics(one_output) = one_metric; } } } //! \cond // MFD codes R=1/2 int Conv_Code_MFD_2[15][2] = { {0, 0}, {0, 0}, {0, 0}, {05, 07}, {015, 017}, {023, 035}, {053, 075}, {0133, 0171}, {0247, 0371}, {0561, 0753}, {01167, 01545}, {02335, 03661}, {04335, 05723}, {010533, 017661}, {021675, 027123}, }; // MFD codes R=1/3 int Conv_Code_MFD_3[15][3] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {05, 07, 07}, {013, 015, 017}, {025, 033, 037}, {047, 053, 075}, {0133, 0145, 0175}, {0225, 0331, 0367}, {0557, 0663, 0711}, {0117, 01365, 01633}, {02353, 02671, 03175}, {04767, 05723, 06265}, {010533, 010675, 017661}, {021645, 035661, 037133}, }; // MFD codes R=1/4 int Conv_Code_MFD_4[15][4] = { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {05, 07, 07, 07}, {013, 015, 015, 017}, {025, 027, 033, 037}, {053, 067, 071, 075}, {0135, 0135, 0147, 0163}, {0235, 0275, 0313, 0357}, {0463, 0535, 0733, 0745}, {0117, 01365, 01633, 01653}, {02327, 02353, 02671, 03175}, {04767, 05723, 06265, 07455}, {011145, 012477, 015573, 016727}, {021113, 023175, 035527, 035537}, }; // MFD codes R=1/5 int Conv_Code_MFD_5[9][5] = { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {07, 07, 07, 05, 05}, {017, 017, 013, 015, 015}, {037, 027, 033, 025, 035}, {075, 071, 073, 065, 057}, {0175, 0131, 0135, 0135, 0147}, {0257, 0233, 0323, 0271, 0357}, }; // MFD codes R=1/6 int Conv_Code_MFD_6[9][6] = { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {07, 07, 07, 07, 05, 05}, {017, 017, 013, 013, 015, 015}, {037, 035, 027, 033, 025, 035}, {073, 075, 055, 065, 047, 057}, {0173, 0151, 0135, 0135, 0163, 0137}, {0253, 0375, 0331, 0235, 0313, 0357}, }; // MFD codes R=1/7 int Conv_Code_MFD_7[9][7] = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {07, 07, 07, 07, 05, 05, 05}, {017, 017, 013, 013, 013, 015, 015}, {035, 027, 025, 027, 033, 035, 037}, {053, 075, 065, 075, 047, 067, 057}, {0165, 0145, 0173, 0135, 0135, 0147, 0137}, {0275, 0253, 0375, 0331, 0235, 0313, 0357}, }; // MFD codes R=1/8 int Conv_Code_MFD_8[9][8] = { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {07, 07, 05, 05, 05, 07, 07, 07}, {017, 017, 013, 013, 013, 015, 015, 017}, {037, 033, 025, 025, 035, 033, 027, 037}, {057, 073, 051, 065, 075, 047, 067, 057}, {0153, 0111, 0165, 0173, 0135, 0135, 0147, 0137}, {0275, 0275, 0253, 0371, 0331, 0235, 0313, 0357}, }; int maxK_Conv_Code_MFD[9] = {0, 0, 14, 14, 14, 8, 8, 8, 8}; void get_MFD_gen_pol(int n, int K, ivec & gen) { gen.set_size(n); switch (n) { case 2: // Rate 1/2 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[2], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_2[K][0]; gen(1) = Conv_Code_MFD_2[K][1]; break; case 3: // Rate 1/3 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[3], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_3[K][0]; gen(1) = Conv_Code_MFD_3[K][1]; gen(2) = Conv_Code_MFD_3[K][2]; break; case 4: // Rate 1/4 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[4], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_4[K][0]; gen(1) = Conv_Code_MFD_4[K][1]; gen(2) = Conv_Code_MFD_4[K][2]; gen(3) = Conv_Code_MFD_4[K][3]; break; case 5: // Rate 1/5 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[5], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_5[K][0]; gen(1) = Conv_Code_MFD_5[K][1]; gen(2) = Conv_Code_MFD_5[K][2]; gen(3) = Conv_Code_MFD_5[K][3]; gen(4) = Conv_Code_MFD_5[K][4]; break; case 6: // Rate 1/6 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[6], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_6[K][0]; gen(1) = Conv_Code_MFD_6[K][1]; gen(2) = Conv_Code_MFD_6[K][2]; gen(3) = Conv_Code_MFD_6[K][3]; gen(4) = Conv_Code_MFD_6[K][4]; gen(5) = Conv_Code_MFD_6[K][5]; break; case 7: // Rate 1/7 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[7], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_7[K][0]; gen(1) = Conv_Code_MFD_7[K][1]; gen(2) = Conv_Code_MFD_7[K][2]; gen(3) = Conv_Code_MFD_7[K][3]; gen(4) = Conv_Code_MFD_7[K][4]; gen(5) = Conv_Code_MFD_7[K][5]; gen(6) = Conv_Code_MFD_7[K][6]; break; case 8: // Rate 1/8 it_assert(K >= 3 && K <= maxK_Conv_Code_MFD[8], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_MFD_8[K][0]; gen(1) = Conv_Code_MFD_8[K][1]; gen(2) = Conv_Code_MFD_8[K][2]; gen(3) = Conv_Code_MFD_8[K][3]; gen(4) = Conv_Code_MFD_8[K][4]; gen(5) = Conv_Code_MFD_8[K][5]; gen(6) = Conv_Code_MFD_8[K][6]; gen(7) = Conv_Code_MFD_8[K][7]; break; default: // wrong rate it_assert(false, "This convolutional code doesn't exist in the tables"); } } // ODS codes R=1/2 int Conv_Code_ODS_2[17][2] = { {0, 0}, {0, 0}, {0, 0}, {05, 07}, {015, 017}, {023, 035}, {053, 075}, {0133, 0171}, {0247, 0371}, {0561, 0753}, {01151, 01753}, {03345, 03613}, {05261, 07173}, {012767, 016461}, {027251, 037363}, {063057, 044735}, {0126723, 0152711}, }; // ODS codes R=1/3 int Conv_Code_ODS_3[14][3] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {05, 07, 07}, {013, 015, 017}, {025, 033, 037}, {047, 053, 075}, {0133, 0165, 0171}, {0225, 0331, 0367}, {0575, 0623, 0727}, {01233, 01375, 01671}, {02335, 02531, 03477}, {05745, 06471, 07553}, {013261, 015167, 017451}, }; // ODS codes R=1/4 int Conv_Code_ODS_4[12][4] = { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {05, 05, 07, 07}, {013, 015, 015, 017}, {025, 027, 033, 037}, {051, 055, 067, 077}, {0117, 0127, 0155, 0171}, {0231, 0273, 0327, 0375}, {0473, 0513, 0671, 0765}, {01173, 01325, 01467, 01751}, {02565, 02747, 03311, 03723}, }; int maxK_Conv_Code_ODS[5] = {0, 0, 16, 13, 11}; void get_ODS_gen_pol(int n, int K, ivec & gen) { gen.set_size(n); switch (n) { case 2: // Rate 1/2 it_assert(K >= 3 && K <= maxK_Conv_Code_ODS[2], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_ODS_2[K][0]; gen(1) = Conv_Code_ODS_2[K][1]; break; case 3: // Rate 1/3 it_assert(K >= 3 && K <= maxK_Conv_Code_ODS[3], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_ODS_3[K][0]; gen(1) = Conv_Code_ODS_3[K][1]; gen(2) = Conv_Code_ODS_3[K][2]; break; case 4: // Rate 1/4 it_assert(K >= 3 && K <= maxK_Conv_Code_ODS[4], "This convolutional code doesn't exist in the tables"); gen(0) = Conv_Code_ODS_4[K][0]; gen(1) = Conv_Code_ODS_4[K][1]; gen(2) = Conv_Code_ODS_4[K][2]; gen(3) = Conv_Code_ODS_4[K][3]; break; default: // wrong rate it_assert(false, "This convolutional code doesn't exist in the tables"); } } //! \endcond // --------------- Public functions ------------------------- void Convolutional_Code::set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length) { ivec gen; if (type_of_code == MFD) get_MFD_gen_pol(inverse_rate, constraint_length, gen); else if (type_of_code == ODS) get_ODS_gen_pol(inverse_rate, constraint_length, gen); else it_assert(false, "This convolutional code doesn't exist in the tables"); set_generator_polynomials(gen, constraint_length); } /* Set generator polynomials. Given in Proakis integer form */ void Convolutional_Code::set_generator_polynomials(const ivec &gen, int constraint_length) { it_error_if(constraint_length <= 0, "Convolutional_Code::set_generator_polynomials(): Constraint length out of range"); gen_pol = gen; n = gen.size(); it_error_if(n <= 0, "Convolutional_Code::set_generator_polynomials(): Invalid code rate"); // Generate table look-up of weight of integers of size K bits if (constraint_length != K) { K = constraint_length; xor_int_table.set_size(pow2i(K), false); for (int i = 0; i < pow2i(K); i++) { xor_int_table(i) = (weight_int(K, i) & 1); } } trunc_length = 5 * K; m = K - 1; no_states = pow2i(m); gen_pol_rev.set_size(n, false); rate = 1.0 / n; for (int i = 0; i < n; i++) { gen_pol_rev(i) = reverse_int(K, gen_pol(i)); } int zero_output, one_output; output_reverse_int.set_size(no_states, 2, false); for (int i = 0; i < no_states; i++) { output_reverse(i, zero_output, one_output); output_reverse_int(i, 0) = zero_output; output_reverse_int(i, 1) = one_output; } // initialise memory structures visited_state.set_size(no_states); visited_state = false; visited_state(start_state) = true; // mark start state sum_metric.set_size(no_states); sum_metric.clear(); trunc_ptr = 0; trunc_state = 0; } // Reset encoder and decoder states void Convolutional_Code::reset() { init_encoder(); visited_state = false; visited_state(start_state) = true; // mark start state sum_metric.clear(); trunc_ptr = 0; trunc_state = 0; } /* Encode a binary vector of inputs using specified method */ void Convolutional_Code::encode(const bvec &input, bvec &output) { switch (cc_method) { case Trunc: encode_trunc(input, output); break; case Tailbite: encode_tailbite(input, output); break; case Tail: default: encode_tail(input, output); break; }; } /* Encode a binary vector of inputs starting from state set by the set_state function */ void Convolutional_Code::encode_trunc(const bvec &input, bvec &output) { int temp; output.set_size(input.size() * n, false); for (int i = 0; i < input.size(); i++) { encoder_state |= static_cast(input(i)) << m; for (int j = 0; j < n; j++) { temp = encoder_state & gen_pol(j); output(i * n + j) = xor_int_table(temp); } encoder_state >>= 1; } } /* Encode a binary vector of inputs starting from zero state and also adds a tail of K-1 zeros to force the encoder into the zero state. Well suited for packet transmission. */ void Convolutional_Code::encode_tail(const bvec &input, bvec &output) { int temp; output.set_size((input.size() + m) * n, false); // always start from state 0 encoder_state = 0; for (int i = 0; i < input.size(); i++) { encoder_state |= static_cast(input(i)) << m; for (int j = 0; j < n; j++) { temp = encoder_state & gen_pol(j); output(i * n + j) = xor_int_table(temp); } encoder_state >>= 1; } // add tail of m = K-1 zeros for (int i = input.size(); i < input.size() + m; i++) { for (int j = 0; j < n; j++) { temp = encoder_state & gen_pol(j); output(i * n + j) = xor_int_table(temp); } encoder_state >>= 1; } } /* Encode a binary vector of inputs starting using tail biting */ void Convolutional_Code::encode_tailbite(const bvec &input, bvec &output) { int temp; output.set_size(input.size() * n, false); // Set the start state equal to the end state: encoder_state = 0; bvec last_bits = input.right(m); for (int i = 0; i < m; i++) { encoder_state |= static_cast(last_bits(i)) << m; encoder_state >>= 1; } for (int i = 0; i < input.size(); i++) { encoder_state |= static_cast(input(i)) << m; for (int j = 0; j < n; j++) { temp = encoder_state & gen_pol(j); output(i * n + j) = xor_int_table(temp); } encoder_state >>= 1; } } /* Encode a binary bit starting from the internal encoder state. To initialize the encoder state use set_start_state() and init_encoder() */ void Convolutional_Code::encode_bit(const bin &input, bvec &output) { int temp; output.set_size(n, false); encoder_state |= static_cast(input) << m; for (int j = 0; j < n; j++) { temp = encoder_state & gen_pol(j); output(j) = xor_int_table(temp); } encoder_state >>= 1; } // --------------- Hard-decision decoding is not implemented ----------------- void Convolutional_Code::decode(const bvec &, bvec &) { it_error("Convolutional_Code::decode(): Hard-decision decoding not implemented"); } bvec Convolutional_Code::decode(const bvec &) { it_error("Convolutional_Code::decode(): Hard-decision decoding not implemented"); return bvec(); } /* Decode a block of encoded data using specified method */ void Convolutional_Code::decode(const vec &received_signal, bvec &output) { switch (cc_method) { case Trunc: decode_trunc(received_signal, output); break; case Tailbite: decode_tailbite(received_signal, output); break; case Tail: default: decode_tail(received_signal, output); break; }; } /* Decode a block of encoded data where encode_tail has been used. Thus is assumes a decoder start state of zero and that a tail of K-1 zeros has been added. No memory truncation. */ void Convolutional_Code::decode_tail(const vec &received_signal, bvec &output) { int block_length = received_signal.size() / n; // no input symbols it_error_if(block_length - m <= 0, "Convolutional_Code::decode_tail(): Input sequence to short"); int S0, S1; vec temp_sum_metric(no_states), temp_rec(n), delta_metrics; Array temp_visited_state(no_states); double temp_metric_zero, temp_metric_one; path_memory.set_size(no_states, block_length, false); output.set_size(block_length - m, false); // no tail in the output // clear visited states visited_state = false; temp_visited_state = visited_state; visited_state(0) = true; // starts in the zero state // clear accumulated metrics sum_metric.clear(); // evolve up to m where not all states visited for (int l = 0; l < m; l++) { // all transitions including the tail temp_rec = received_signal.mid(l * n, n); // calculate all metrics for all codewords at the same time calc_metric(temp_rec, delta_metrics); for (int s = 0; s < no_states; s++) { // all states // S0 and S1 are the states that expanded end at state s previous_state(s, S0, S1); if (visited_state(S0)) { // expand trellis if state S0 is visited temp_metric_zero = sum_metric(S0) + delta_metrics(output_reverse_int(s, 0)); temp_visited_state(s) = true; } else { temp_metric_zero = std::numeric_limits::max(); } if (visited_state(S1)) { // expand trellis if state S0 is visited temp_metric_one = sum_metric(S1) + delta_metrics(output_reverse_int(s, 1)); temp_visited_state(s) = true; } else { temp_metric_one = std::numeric_limits::max(); } if (temp_metric_zero < temp_metric_one) { // path zero survives temp_sum_metric(s) = temp_metric_zero; path_memory(s, l) = 0; } else { // path one survives temp_sum_metric(s) = temp_metric_one; path_memory(s, l) = 1; } } // all states, s sum_metric = temp_sum_metric; visited_state = temp_visited_state; } // all transitions, l // evolve from m and to the end of the block for (int l = m; l < block_length; l++) { // all transitions except the tail temp_rec = received_signal.mid(l * n, n); // calculate all metrics for all codewords at the same time calc_metric(temp_rec, delta_metrics); for (int s = 0; s < no_states; s++) { // all states // S0 and S1 are the states that expanded end at state s previous_state(s, S0, S1); temp_metric_zero = sum_metric(S0) + delta_metrics(output_reverse_int(s, 0)); temp_metric_one = sum_metric(S1) + delta_metrics(output_reverse_int(s, 1)); if (temp_metric_zero < temp_metric_one) { // path zero survives temp_sum_metric(s) = temp_metric_zero; path_memory(s, l) = 0; } else { // path one survives temp_sum_metric(s) = temp_metric_one; path_memory(s, l) = 1; } } // all states, s sum_metric = temp_sum_metric; } // all transitions, l // minimum metric is the zeroth state due to the tail int min_metric_state = 0; // trace back to remove tail of zeros for (int l = block_length - 1; l > block_length - 1 - m; l--) { // previous state calculation min_metric_state = previous_state(min_metric_state, path_memory(min_metric_state, l)); } // trace back to calculate output sequence for (int l = block_length - 1 - m; l >= 0; l--) { output(l) = get_input(min_metric_state); // previous state calculation min_metric_state = previous_state(min_metric_state, path_memory(min_metric_state, l)); } } /* Decode a block of encoded data where encode_tailbite has been used. */ void Convolutional_Code::decode_tailbite(const vec &received_signal, bvec &output) { int block_length = received_signal.size() / n; // no input symbols it_error_if(block_length <= 0, "Convolutional_Code::decode_tailbite(): Input sequence to short"); int S0, S1; vec temp_sum_metric(no_states), temp_rec(n), delta_metrics; Array temp_visited_state(no_states); double temp_metric_zero, temp_metric_one; double best_metric = std::numeric_limits::max(); bvec best_output(block_length), temp_output(block_length); path_memory.set_size(no_states, block_length, false); output.set_size(block_length, false); // Try all start states ss for (int ss = 0; ss < no_states; ss++) { //Clear the visited_state vector: visited_state = false; temp_visited_state = visited_state; visited_state(ss) = true; // starts in the state s // clear accumulated metrics sum_metric.zeros(); for (int l = 0; l < block_length; l++) { // all transitions temp_rec = received_signal.mid(l * n, n); // calculate all metrics for all codewords at the same time calc_metric(temp_rec, delta_metrics); for (int s = 0; s < no_states; s++) { // all states // S0 and S1 are the states that expanded end at state s previous_state(s, S0, S1); if (visited_state(S0)) { // expand trellis if state S0 is visited temp_metric_zero = sum_metric(S0) + delta_metrics(output_reverse_int(s, 0)); temp_visited_state(s) = true; } else { temp_metric_zero = std::numeric_limits::max(); } if (visited_state(S1)) { // expand trellis if state S0 is visited temp_metric_one = sum_metric(S1) + delta_metrics(output_reverse_int(s, 1)); temp_visited_state(s) = true; } else { temp_metric_one = std::numeric_limits::max(); } if (temp_metric_zero < temp_metric_one) { // path zero survives temp_sum_metric(s) = temp_metric_zero; path_memory(s, l) = 0; } else { // path one survives temp_sum_metric(s) = temp_metric_one; path_memory(s, l) = 1; } } // all states, s sum_metric = temp_sum_metric; visited_state = temp_visited_state; } // all transitions, l // minimum metric is the ss state due to the tailbite int min_metric_state = ss; // trace back to calculate output sequence for (int l = block_length - 1; l >= 0; l--) { temp_output(l) = get_input(min_metric_state); // previous state calculation min_metric_state = previous_state(min_metric_state, path_memory(min_metric_state, l)); } if (sum_metric(ss) < best_metric) { best_metric = sum_metric(ss); best_output = temp_output; } } // all start states ss output = best_output; } /* Viterbi decoding using truncation of memory (default = 5*K) */ void Convolutional_Code::decode_trunc(const vec &received_signal, bvec &output) { int block_length = received_signal.size() / n; // no input symbols it_error_if(block_length <= 0, "Convolutional_Code::decode_trunc(): Input sequence to short"); int S0, S1; vec temp_sum_metric(no_states), temp_rec(n), delta_metrics; Array temp_visited_state(no_states); double temp_metric_zero, temp_metric_one; path_memory.set_size(no_states, trunc_length, false); output.set_size(0); // copy visited states temp_visited_state = visited_state; for (int i = 0; i < block_length; i++) { // update path memory pointer trunc_ptr = (trunc_ptr + 1) % trunc_length; temp_rec = received_signal.mid(i * n, n); // calculate all metrics for all codewords at the same time calc_metric(temp_rec, delta_metrics); for (int s = 0; s < no_states; s++) { // all states // the states that expanded end at state s previous_state(s, S0, S1); if (visited_state(S0)) { // expand trellis if state S0 is visited temp_metric_zero = sum_metric(S0) + delta_metrics(output_reverse_int(s, 0)); temp_visited_state(s) = true; } else { temp_metric_zero = std::numeric_limits::max(); } if (visited_state(S1)) { // expand trellis if state S0 is visited temp_metric_one = sum_metric(S1) + delta_metrics(output_reverse_int(s, 1)); temp_visited_state(s) = true; } else { temp_metric_one = std::numeric_limits::max(); } if (temp_metric_zero < temp_metric_one) { // path zero survives temp_sum_metric(s) = temp_metric_zero; path_memory(s, trunc_ptr) = 0; } else { // path one survives temp_sum_metric(s) = temp_metric_one; path_memory(s, trunc_ptr) = 1; } } // all states, s sum_metric = temp_sum_metric; visited_state = temp_visited_state; // find minimum metric int min_metric_state = min_index(sum_metric); // normalise accumulated metrics sum_metric -= sum_metric(min_metric_state); // check if we had enough metrics to generate output if (trunc_state >= trunc_length) { // trace back to calculate the output symbol for (int j = trunc_length; j > 0; j--) { // previous state calculation min_metric_state = previous_state(min_metric_state, path_memory(min_metric_state, (trunc_ptr + j) % trunc_length)); } output.ins(output.size(), get_input(min_metric_state)); } else { // if not increment trunc_state counter trunc_state++; } } // end for (int i = 0; i < block_length; l++) } /* Calculate the inverse sequence Assumes that encode_tail is used in the encoding process. Returns false if there is an error in the coded sequence (not a valid codeword). Do not check that the tail forces the encoder into the zeroth state. */ bool Convolutional_Code::inverse_tail(const bvec coded_sequence, bvec &input) { int state = 0, zero_state, one_state, zero_temp, one_temp, i, j; bvec zero_output(n), one_output(n); int block_length = coded_sequence.size() / n - m; // no input symbols it_error_if(block_length <= 0, "The input sequence is to short"); input.set_length(block_length, false); // not include the tail in the output for (i = 0; i < block_length; i++) { zero_state = state; one_state = state | (1 << m); for (j = 0; j < n; j++) { zero_temp = zero_state & gen_pol(j); one_temp = one_state & gen_pol(j); zero_output(j) = xor_int_table(zero_temp); one_output(j) = xor_int_table(one_temp); } if (coded_sequence.mid(i*n, n) == zero_output) { input(i) = bin(0); state = zero_state >> 1; } else if (coded_sequence.mid(i*n, n) == one_output) { input(i) = bin(1); state = one_state >> 1; } else return false; } return true; } /* Check if catastrophic. Returns true if catastrophic */ bool Convolutional_Code::catastrophic(void) { int start, S, W0, W1, S0, S1; bvec visited(1 << m); for (start = 1; start < no_states; start++) { visited.zeros(); S = start; visited(S) = 1; node1: S0 = next_state(S, 0); S1 = next_state(S, 1); weight(S, W0, W1); if (S1 < start) goto node0; if (W1 > 0) goto node0; if (visited(S1) == bin(1)) return true; S = S1; // goto node1 visited(S) = 1; goto node1; node0: if (S0 < start) continue; // goto end; if (W0 > 0) continue; // goto end; if (visited(S0) == bin(1)) return true; S = S0; visited(S) = 1; goto node1; //end: //void; } return false; } /* Calculate distance profile. If reverse = true calculate for the reverse code instead. */ void Convolutional_Code::distance_profile(ivec &dist_prof, int dmax, bool reverse) { int max_stack_size = 50000; ivec S_stack(max_stack_size), W_stack(max_stack_size), t_stack(max_stack_size); int stack_pos = -1, t, S, W, W0, w0, w1; dist_prof.set_size(K, false); dist_prof.zeros(); dist_prof += dmax; // just select a big number! if (reverse) W = weight_reverse(0, 1); else W = weight(0, 1); S = next_state(0, 1); // first state 0 and one as input, S = 1<<(m-1); t = 0; dist_prof(0) = W; node1: if (reverse) weight_reverse(S, w0, w1); else weight(S, w0, w1); if (t < m) { W0 = W + w0; if (W0 < dist_prof(m)) { // store node0 (S, W0, and t+1) stack_pos++; if (stack_pos >= max_stack_size) { max_stack_size = 2 * max_stack_size; S_stack.set_size(max_stack_size, true); W_stack.set_size(max_stack_size, true); t_stack.set_size(max_stack_size, true); } S_stack(stack_pos) = next_state(S, 0); //S>>1; W_stack(stack_pos) = W0; t_stack(stack_pos) = t + 1; } } else goto stack; W += w1; if (W > dist_prof(m)) goto stack; t++; S = next_state(S, 1); //S = (S>>1)|(1<<(m-1)); if (W < dist_prof(t)) dist_prof(t) = W; if (t == m) goto stack; goto node1; stack: if (stack_pos >= 0) { // get root node from stack S = S_stack(stack_pos); W = W_stack(stack_pos); t = t_stack(stack_pos); stack_pos--; if (W < dist_prof(t)) dist_prof(t) = W; if (t == m) goto stack; goto node1; } } /* Calculate spectrum Calculates both the weight spectrum (Ad) and the information weight spectrum (Cd) and returns it as ivec:s in the 0:th and 1:st component of spectrum, respectively. Suitable for calculating many terms in the spectra (uses an breadth first algorithm). It is assumed that the code is non-catastrophic or else it is a possibility for an eternal loop. dmax = an upper bound on the free distance no_terms = no_terms including the dmax term that should be calculated */ void Convolutional_Code::calculate_spectrum(Array &spectrum, int dmax, int no_terms) { imat Ad_states(no_states, dmax + no_terms), Cd_states(no_states, dmax + no_terms); imat Ad_temp(no_states, dmax + no_terms), Cd_temp(no_states, dmax + no_terms); ivec mindist(no_states), mindist_temp(1 << m); spectrum.set_size(2); spectrum(0).set_size(dmax + no_terms, false); spectrum(1).set_size(dmax + no_terms, false); spectrum(0).zeros(); spectrum(1).zeros(); Ad_states.zeros(); Cd_states.zeros(); mindist.zeros(); int wmax = dmax + no_terms; ivec visited_states(no_states), visited_states_temp(no_states); bool proceede; int d, w0, w1, s, s0, s1; visited_states.zeros(); // 0 = false s = next_state(0, 1); // Start in state from 0 with an one input. visited_states(s) = 1; // 1 = true. Start in state 2^(m-1). w1 = weight(0, 1); Ad_states(s, w1) = 1; Cd_states(s, w1) = 1; mindist(s) = w1; proceede = true; while (proceede) { proceede = false; Ad_temp.zeros(); Cd_temp.zeros(); mindist_temp.zeros(); visited_states_temp.zeros(); //false for (s = 1; s < no_states; s++) { if ((mindist(s) > 0) && (mindist(s) < wmax)) { proceede = true; weight(s, w0, w1); s0 = next_state(s, 0); for (d = mindist(s); d < (wmax - w0); d++) { Ad_temp(s0, d + w0) += Ad_states(s, d); Cd_temp(s0, d + w0) += Cd_states(s, d); visited_states_temp(s0) = 1; //true } s1 = next_state(s, 1); for (d = mindist(s); d < (wmax - w1); d++) { Ad_temp(s1, d + w1) += Ad_states(s, d); Cd_temp(s1, d + w1) += Cd_states(s, d) + Ad_states(s, d); visited_states_temp(s1) = 1; //true } if (mindist_temp(s0) > 0) { mindist_temp(s0) = (mindist(s) + w0) < mindist_temp(s0) ? mindist(s) + w0 : mindist_temp(s0); } else { mindist_temp(s0) = mindist(s) + w0; } if (mindist_temp(s1) > 0) { mindist_temp(s1) = (mindist(s) + w1) < mindist_temp(s1) ? mindist(s) + w1 : mindist_temp(s1); } else { mindist_temp(s1) = mindist(s) + w1; } } } Ad_states = Ad_temp; Cd_states = Cd_temp; spectrum(0) += Ad_temp.get_row(0); spectrum(1) += Cd_temp.get_row(0); visited_states = visited_states_temp; mindist = elem_mult(mindist_temp, visited_states); } } /* Cederwall's fast algorithm See IT No. 6, pp. 1146-1159, Nov. 1989 for details. Calculates both the weight spectrum (Ad) and the information weight spectrum (Cd) and returns it as ivec:s in the 0:th and 1:st component of spectrum, respectively. The FAST algorithm is good for calculating only a few terms in the spectrum. If many terms are desired, use calc_spectrum instead. The algorithm returns -1 if the code tested is worse that the input dfree and Cdfree. It returns 0 if the code MAY be catastrophic (assuming that test_catastrophic is true), and returns 1 if everything went right. \arg \c dfree the free distance of the code (or an upper bound) \arg \c no_terms including the dfree term that should be calculated \ar \c Cdfree is the best value of information weight spectrum found so far */ int Convolutional_Code::fast(Array &spectrum, const int dfree, const int no_terms, const int Cdfree, const bool test_catastrophic) { int cat_treshold = 7 * K; // just a big number, but not to big! int i; ivec dist_prof(K), dist_prof_rev(K); distance_profile(dist_prof, dfree); distance_profile(dist_prof_rev, dfree, true); // for the reverse code int dist_prof_rev0 = dist_prof_rev(0); bool reverse = false; // false = use dist_prof // is the reverse distance profile better? for (i = 0; i < K; i++) { if (dist_prof_rev(i) > dist_prof(i)) { reverse = true; dist_prof_rev0 = dist_prof(0); dist_prof = dist_prof_rev; break; } else if (dist_prof_rev(i) < dist_prof(i)) { break; } } int d = dfree + no_terms - 1; int max_stack_size = 50000; ivec S_stack(max_stack_size), W_stack(max_stack_size), b_stack(max_stack_size), c_stack(max_stack_size); int stack_pos = -1; // F1. int mf = 1, b = 1; spectrum.set_size(2); spectrum(0).set_size(dfree + no_terms, false); // ad spectrum(1).set_size(dfree + no_terms, false); // cd spectrum(0).zeros(); spectrum(1).zeros(); int S, S0, S1, W0, W1, w0, w1, c = 0; S = next_state(0, 1); //first state zero and one as input int W = d - dist_prof_rev0; F2: S0 = next_state(S, 0); S1 = next_state(S, 1); if (reverse) { weight(S, w0, w1); } else { weight_reverse(S, w0, w1); } W0 = W - w0; W1 = W - w1; if (mf < m) goto F6; //F3: if (W0 >= 0) { spectrum(0)(d - W0)++; spectrum(1)(d - W0) += b; // The code is worse than the best found. if (((d - W0) < dfree) || (((d - W0) == dfree) && (spectrum(1)(d - W0) > Cdfree))) return -1; } F4: if ((W1 < dist_prof(m - 1)) || (W < dist_prof(m))) goto F5; // select node 1 if (test_catastrophic && W == W1) { c++; if (c > cat_treshold) return 0; } else { c = 0; W = W1; } S = S1; mf = 1; b++; goto F2; F5: //if (stack_pos == -1) return n_values; if (stack_pos == -1) goto end; // get node from stack S = S_stack(stack_pos); W = W_stack(stack_pos); b = b_stack(stack_pos); c = c_stack(stack_pos); stack_pos--; mf = 1; goto F2; F6: if (W0 < dist_prof(m - mf - 1)) goto F4; //F7: if ((W1 >= dist_prof(m - 1)) && (W >= dist_prof(m))) { // save node 1 if (test_catastrophic && stack_pos > 10000) return 0; stack_pos++; if (stack_pos >= max_stack_size) { max_stack_size = 2 * max_stack_size; S_stack.set_size(max_stack_size, true); W_stack.set_size(max_stack_size, true); b_stack.set_size(max_stack_size, true); c_stack.set_size(max_stack_size, true); } S_stack(stack_pos) = S1; W_stack(stack_pos) = W1; b_stack(stack_pos) = b + 1; // because gone to node 1 c_stack(stack_pos) = c; // because gone to node 1 } // select node 0 S = S0; if (test_catastrophic && W == W0) { c++; if (c > cat_treshold) return 0; } else { c = 0; W = W0; } mf++; goto F2; end: return 1; } //----------- These functions should be moved into some other place ------- /*! Reverses the bitrepresentation of in (of size length) and converts to an integer */ int reverse_int(int length, int in) { int i, j, out = 0; for (i = 0; i < (length >> 1); i++) { out = out | ((in & (1 << i)) << (length - 1 - (i << 1))); } for (j = 0; j < (length - i); j++) { out = out | ((in & (1 << (j + i))) >> ((j << 1) - (length & 1) + 1)); //out = out | ( (in & (1<> ((j<<1)-(length&1)+1) ); old version with preecedence problems in MSC } return out; } /*! Calculate the Hamming weight of the binary representation of in of size length */ int weight_int(int length, int in) { int i, w = 0; for (i = 0; i < length; i++) { w += (in & (1 << i)) >> i; } return w; } /*! Compare two distance spectra. Return 1 if v1 is less, 0 if v2 less, and -1 if equal. */ int compare_spectra(ivec v1, ivec v2) { it_assert_debug(v1.size() == v2.size(), "compare_spectra: wrong sizes"); for (int i = 0; i < v1.size(); i++) { if (v1(i) < v2(i)) { return 1; } else if (v1(i) > v2(i)) { return 0; } } return -1; } /*! Compare two distance spectra using a weight profile. Return 1 if v1 is less, 0 if v2 less, and -1 if equal. */ int compare_spectra(ivec v1, ivec v2, vec weight_profile) { double t1 = 0, t2 = 0; for (int i = 0; i < v1.size(); i++) { t1 += (double)v1(i) * weight_profile(i); t2 += (double)v2(i) * weight_profile(i); } if (t1 < t2) return 1; else if (t1 > t2) return 0; else return -1; } } // namespace itpp itpp-4.3.1/itpp/comm/convcode.h000066400000000000000000000377361216575753400164120ustar00rootroot00000000000000/*! * \file * \brief Definition of a binary convolutional encoder class * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CONVCODE_H #define CONVCODE_H #include #include #include #include #include #include #include namespace itpp { /*! \brief Type of Convolutional Code \ingroup fec */ enum CONVOLUTIONAL_CODE_TYPE {MFD, ODS}; /*! \brief Encoding and decoding methods for Convolutional codes \ingroup fec */ enum CONVOLUTIONAL_CODE_METHOD {Trunc, Tail, Tailbite}; /*! \ingroup fec \brief Binary Convolutional rate 1/n class The codes are given as feedforward encoders and given in the Proakis form. That is, the binary generators (K-tuples) are converted to octal integers. Observe that the constraint length (K) is defined as the number of memory cells plus one (as in Proakis). Encoding is performed with the encode function. The default method for encoding is by adding a tail of K-1 zeros and also assume that the encoder starts in the zero state (the encode_tail() function). Observe that decode() by default also assumes that a tail is added. Both encoding and decoding method can be changed by the set_method() function. Example of use: (rate 1/3 constraint length K=7 ODS code using BPSK over AWGN) \code BPSK bpsk; Convolutional_Code code; ivec generator(3); generator(0)=0133; generator(1)=0165; generator(2)=0171; code.set_generator_polynomials(generator, 7); bvec bits=randb(100), encoded_bits, decoded_bits; vec tx_signal, rx_signal; code.encode_tail(bits, encoded_bits); tx_signal = bpsk.modulate_bits(encoded_bits); rx_signal = tx_signal + sqrt(0.5)*randn(tx_signal.size()); code.decode_tail(rx_signal, decoded_bits); \endcode Comment: ODS-code stand for Optimum Distance Spectrum Code. For details see T. Ottosson, "Coding, Modulation and Multiuser Decoding for DS-CDMA Systems," Ph.d. thesis, Department of Information Theory, Scool of Electrical and Computer Engineering, Chalmers University of Technology, Goteborg 1997. It is also possible to set the generator polynomials directly using the builtin tables which consists of: Maximum Free Distance (MFD) Codes of rates R=1/2 through R=1/8 and Optimum Distance Spectrum (ODS) Codes of rates R=1/2 through R=1/4. */ class ITPP_EXPORT Convolutional_Code : public Channel_Code { public: //! Default constructor - sets (0133,0171) code with tail Convolutional_Code(void): K(0), start_state(0), cc_method(Tail) { set_code(MFD, 2, 7); init_encoder(); } //! Destructor virtual ~Convolutional_Code(void) {} //! Set encoding and decoding method (Trunc, Tail, or Tailbite) void set_method(const CONVOLUTIONAL_CODE_METHOD method) { cc_method = method; } /*! \brief Set the code according to built-in tables The \a type_of_code can be either \a MFD or \a ODS for maximum free distance codes (according to Proakis) or Optimum Distance Spectrum Codes according to Frenger, Orten and Ottosson. */ void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length); //! Set generator polynomials. Given in Proakis integer form void set_generator_polynomials(const ivec &gen, int constraint_length); //! Get generator polynomials ivec get_generator_polynomials(void) const { return gen_pol; } //! Reset encoder and decoder states void reset(); //@{ //! Encode an input binary vector using specified method (Tail by default) virtual void encode(const bvec &input, bvec &output); virtual bvec encode(const bvec &input) { bvec output; encode(input, output); return output; } //@} //@{ /*! * \brief Encode a binary vector starting from the previous encoder state * * The initial encoder state can be changed using set_start_state() * and init_encoder() functions. */ void encode_trunc(const bvec &input, bvec &output); bvec encode_trunc(const bvec &input) { bvec output; encode_trunc(input, output); return output; } //@} //@{ /*! * \brief Encoding that starts and ends in the zero state * * Encode a binary vector of inputs starting from zero state and also * adds a tail of K-1 zeros to force the encoder into the zero state. * Well suited for packet transmission. * * \note The init_encoder() function has no effect on the starting state * for this method. */ void encode_tail(const bvec &input, bvec &output); bvec encode_tail(const bvec &input) { bvec output; encode_tail(input, output); return output; } //@} //@{ /*! * \brief Encode an input binary vector using tailbiting * * In the Tailbiting method the starting state of the encoder is * initialised with the last K-1 bits of the input vector. This gives an * additional information to the decoder that the starting and ending * states are identical, although not known a priori. * * Well suited for packet transmission with small packets, because there * is no tail overhead as in the Tail method. * * \note The init_encoder() function has no effect on the starting state * for this method. */ void encode_tailbite(const bvec &input, bvec &output); bvec encode_tailbite(const bvec &input) { bvec output; encode_tailbite(input, output); return output; } //@} //@{ /*! \brief Encode a binary bit starting from the internal encoder state. To initialize the encoder state use set_start_state() and init_encoder() */ void encode_bit(const bin &input, bvec &output); bvec encode_bit(const bin &input) { bvec output; encode_bit(input, output); return output; } //@} // ------------ Hard-decision decoding is not implemented ---------------- virtual void decode(const bvec &coded_bits, bvec &decoded_bits); virtual bvec decode(const bvec &coded_bits); //@{ //! Decode a block of encoded data using specified method (Tail by default) virtual void decode(const vec &received_signal, bvec &output); virtual bvec decode(const vec &received_signal) { bvec output; decode(received_signal, output); return output; } //@} //@{ /*! \brief Decode a block of encoded data where encode_tail has been used. Thus is assumes a decoder start state of zero and that a tail of K-1 zeros has been added. No memory truncation. */ virtual void decode_tail(const vec &received_signal, bvec &output); virtual bvec decode_tail(const vec &received_signal) { bvec output; decode_tail(received_signal, output); return output; } //@} //@{ /*! * \brief Decode a block of encoded data where encode_tailbite has been * used. * * The decoding algorithm tries all start states, so the * decode_tailbite() is \f$2^{K-1}\f$ times more complex than the * decode_tail method. */ virtual void decode_tailbite(const vec &received_signal, bvec &output); virtual bvec decode_tailbite(const vec &received_signal) { bvec output; decode_tailbite(received_signal, output); return output; } //@} //@{ //! Viterbi decoding using truncation of memory (default = 5*K) virtual void decode_trunc(const vec &received_signal, bvec &output); virtual bvec decode_trunc(const vec &received_signal) { bvec output; decode_trunc(received_signal, output); return output; } //@} //! Return rate of code (not including the rate-loss) virtual double get_rate(void) const { return rate; } //! Set encoder default start state. void set_start_state(int state) { it_error_if((state < 0) || ((state >= (1 << m)) && m != 0), "Convolutional_Code::set_start_state(): Invalid start state"); start_state = state; } /*! * \brief Initialise internal encoder state with start state. Has no * effect on \c Tail and \c Tailbite methods. */ void init_encoder() { encoder_state = start_state; } //! Get the current encoder state int get_encoder_state(void) const { return encoder_state; } //! Set memory truncation length. Must be at least K. void set_truncation_length(const int length) { it_error_if(length < K, "Convolutional_Code::set_truncation_length(): " "Truncation length shorter than K"); trunc_length = length; } //! Get memory truncation length int get_truncation_length(void) const { return trunc_length; } //! Check if catastrophic. Returns true if catastrophic bool catastrophic(void); /*! \brief Calculate the inverse sequence Assumes that encode_tail is used in the encoding process. Returns false if there is an error in the coded sequence (not a valid codeword). Do not check that the tail forces the encoder into the zeroth state. */ bool inverse_tail(const bvec coded_sequence, bvec &input); //! \brief Calculate distance profile. If reverse = true calculate for //! the reverse code instead. void distance_profile(ivec &dist_prof, int dmax = 100000, bool reverse = false); /*! \brief Calculate spectrum Calculates both the weight spectrum (Ad) and the information weight spectrum (Cd) and returns it as ivec:s in the 0:th and 1:st component of spectrum, respectively. Suitable for calculating many terms in the spectra (uses an breadth first algorithm). It is assumed that the code is non-catastrophic or else it is a possibility for an eternal loop. dmax = an upper bound on the free distance no_terms = no_terms including the dmax term that should be calculated Observe that there is a risk that some of the integers are overflow if many terms are calculated in the spectrum. */ void calculate_spectrum(Array &spectrum, int dmax, int no_terms); /*! \brief Cederwall's fast algorithm Calculates both the weight spectrum (Ad) and the information weight spectrum (Cd) and returns it as ivec:s in the 0:th and 1:st component of spectrum, respectively. The FAST algorithm is good for calculating only a few terms in the spectrum. If many terms are desired, use calc_spectrum instead. The algorithm returns -1 if the code tested is worse that the input dfree and Cdfree. It returns 0 if the code MAY be catastrophic (assuming that test_catastrophic is true), and returns 1 if everything went right. \arg \c dfree the free distance of the code (or an upper bound) \arg \c no_terms including the dfree term that should be calculated \arg \c Cdfree is the best value of information weight spectrum found so far Observe that there is a risk that some of the integers are overflow if many terms are calculated in the spectrum. See IT No. 6, pp. 1146-1159, Nov. 1989 for details. */ int fast(Array &spectrum, const int dfree, const int no_terms, const int Cdfree = 1000000, const bool test_catastrophic = false); protected: //! Next state from instate given the input int next_state(const int instate, const int input) { return ((instate >> 1) | (input << (m - 1))); } //! The previous state from state given the input int previous_state(const int state, const int input) { return (((state << 1) | input) & ((1 << m) - 1)); } //! The previous state from state given the input void previous_state(const int state, int &S0, int &S1) { S0 = (state << 1) & (no_states - 1); S1 = S0 | 1; } //! The weight of the transition from given state with the input given int weight(const int state, const int input); //! The weight of the two paths (input 0 or 1) from given state void weight(const int state, int &w0, int &w1); //! \brief The weight (of the reverse code) of the transition from given //! state with the input given int weight_reverse(const int state, const int input); //! \brief The weight (of the reverse code) of the two paths (input 0 //! or 1) from given state void weight_reverse(const int state, int &w0, int &w1); //! Output on transition (backwards) with input from state bvec output_reverse(const int state, const int input); //! Output on transition (backwards) with input from state void output_reverse(const int state, bvec &zero_output, bvec &one_output); //! Output on transition (backwards) with input from state void output_reverse(const int state, int &zero_output, int &one_output); //! Calculate delta metrics for 0 and 1 input branches reaching state void calc_metric_reverse(const int state, const vec &rx_codeword, double &zero_metric, double &one_metric); //! Calculate delta metrics for all possible codewords void calc_metric(const vec &rx_codeword, vec &delta_metrics); //! Returns the input that results in state, that is the MSB of state int get_input(const int state) { return (state >> (m - 1)); } //! Number of generators int n; //! Constraint length int K; //! Memory of the encoder int m; //! Number of states int no_states; //! Generator polynomials ivec gen_pol; //! Generator polynomials for the reverse code ivec gen_pol_rev; //! The current encoder state int encoder_state; //! The encoder start state int start_state; //! The decoder truncation length int trunc_length; //! The rate of the code double rate; //! Auxilary table used by the codec bvec xor_int_table; //! output in int format for a given state and input imat output_reverse_int; //! encoding and decoding method CONVOLUTIONAL_CODE_METHOD cc_method; //! Path memory (trellis) imat path_memory; //! Visited states Array visited_state; //! Metrics accumulator vec sum_metric; //! Truncated path memory pointer int trunc_ptr; //! Truncated memory fill state int trunc_state; }; // --------------- Some other functions that maybe should be moved ----------- /*! \relates Convolutional_Code \brief Reverses the bitrepresentation of in (of size length) and converts to an integer */ ITPP_EXPORT int reverse_int(int length, int in); /*! \relates Convolutional_Code \brief Calculate the Hamming weight of the binary representation of in of size length */ ITPP_EXPORT int weight_int(int length, int in); /*! \relates Convolutional_Code \brief Compare two distance spectra. Return 1 if v1 is less, 0 if v2 less, and -1 if equal. */ ITPP_EXPORT int compare_spectra(ivec v1, ivec v2); /*! \relates Convolutional_Code \brief Compare two distance spectra using a weight profile. Return 1 if v1 is less, 0 if v2 less, and -1 if equal. */ ITPP_EXPORT int compare_spectra(ivec v1, ivec v2, vec weight_profile); } // namespace itpp #endif // #ifndef CONVCODE_H itpp-4.3.1/itpp/comm/crc.cpp000066400000000000000000000105761216575753400157050ustar00rootroot00000000000000/*! * \file * \brief Implementation of a CRC code class * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { void CRC_Code::set_generator(const bvec &poly) { //it_assert(poly(0) == 1 && poly(poly.size()-1) == 1, "CRC_Code::set_polynomial: not a valid polynomial"); it_assert(poly(0) == 1, "CRC_Code::set_polynomial: not a valid polynomial"); polynomial = poly; no_parity = polynomial.size() - 1; } //! \cond std::string crccode[18][2] = { {"CRC-4", "1 1 1 1 1"}, {"CRC-7", "1 1 0 1 0 0 0 1"}, {"CRC-8", "1 1 1 0 1 0 1 0 1"}, {"CRC-12", "1 1 0 0 0 0 0 0 0 1 1 1 1"}, {"CRC-24", "1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1"}, {"CRC-32", "1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 0"}, {"CCITT-4", "1 0 0 1 1"}, {"CCITT-5", "1 1 0 1 0 1"}, {"CCITT-6", "1 0 0 0 0 1 1"}, {"CCITT-16", "1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1"}, {"CCITT-32", "1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 1 1"}, {"WCDMA-8", "1 1 0 0 1 1 0 1 1"}, {"WCDMA-12", "1 1 0 0 0 0 0 0 0 1 1 1 1"}, {"WCDMA-16", "1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1"}, {"WCDMA-24", "1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1"}, {"ATM-8", "1 0 0 0 0 0 1 1 1"}, {"ANSI-16", "1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1"}, {"SDLC-16", "1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 1 1"}, }; //! \endcond void CRC_Code::set_code(const std::string &code) { bvec poly; for (int i = 0; i < 18;i++) { if (crccode[i][0] == code) poly = bvec(crccode[i][1]); } if ((code == "WCDMA-8") || (code == "WCDMA-12") || (code == "WCDMA-16") || (code == "WCDMA-24")) { reverse_parity = true; } it_assert(poly.size() > 0, "This CRC code doesn't exist in the tables"); set_generator(poly); } // Not optimized for speed! void CRC_Code::parity(const bvec &in_bits, bvec &out) const { bvec temp = concat(in_bits, zeros_b(no_parity)); for (int i = 0; i < temp.size() - polynomial.size() + 1; i++) { if (temp(i) == 1) { temp.set_subvector(i, temp(i, i + no_parity) + polynomial); } } out = temp(temp.size() - no_parity, temp.size() - 1); if (reverse_parity) { out = reverse(out); } } // Not optimized for speed bool CRC_Code::check_parity(const bvec &coded_bits) const { int n = coded_bits.size(); bvec temp; if (reverse_parity) { temp = concat(coded_bits.left(n - no_parity), reverse(coded_bits.right(no_parity))); } else { temp = coded_bits; } for (int i = 0; i < temp.size() - polynomial.size() + 1; i++) { if (temp(i) == 1) { temp.set_subvector(i, temp(i, i + no_parity) + polynomial); } } if (temp(temp.size() - no_parity, temp.size() - 1) == zeros_b(no_parity)) return true; else return false; } void CRC_Code::encode(const bvec &in_bits, bvec &out) const { bvec p; parity(in_bits, p); out = concat(in_bits, p); } bvec CRC_Code::encode(const bvec &in_bits) const { bvec temp; encode(in_bits, temp); return temp; } bool CRC_Code::decode(const bvec &coded_bits, bvec &out) const { out = coded_bits(0, coded_bits.size() - no_parity - 1); if (check_parity(coded_bits)) { return true; } else return false; } bool CRC_Code::decode(bvec &coded_bits) const { //coded_bits = coded_bits(0, coded_bits.size()-no_parity-1); <-- OLD CODE if (check_parity(coded_bits)) { return true; } else return false; } } // namespace itpp itpp-4.3.1/itpp/comm/crc.h000066400000000000000000000070741216575753400153510ustar00rootroot00000000000000/*! * \file * \brief Definition of a CRC code class * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CRC_H #define CRC_H #include #include #include namespace itpp { /*! \ingroup fec \brief Cyclic Redundancy Check Codes This class will add the CRC bits after each input word. With b(i) denoting the i-th input bit and p(i) the i-th parity check bit, the order of the outbut bits will be: \code [b(1), b(2), ..., b(k), p(1), p(2), ..., p(n-k)] \endcode When the WCDMA CRC polynomials are used, this class will reverse the order of the parity check bits in order to comply to the WCDMA standard. Thus for the polynomials WCDMA-8, WCDMA-12, WCDMA-16, and WCDMA-24 the output will be: \code [b(1), b(2), ..., b(k), p(n-k), ..., p(2), p(1)] \endcode Usage: \code CRC_Code crc(string("CRC-4")); bvec bits = randb(10), coded_bits, decoded_bits; bool error; coded_bits = crc.encode(bits); error = crc.decode(rec_bits, decoded_bits); \endcode */ class ITPP_EXPORT CRC_Code { public: //! Default Constructor CRC_Code() { reverse_parity = false; } /*! \brief Set CRC code to one of the standardpolynomials using the string value. \param code Possible values: CRC-4, CRC-7, CRC-8, CRC-12, CRC-24, CRC-32, CCITT-4, CCITT-5, CCITT-6, CCITT-16, CCITT-32, WCDMA-8, WCDMA-12, WCDMA-16, WCDMA-24, ATM-8, ANSI-16, SDLC-16 */ CRC_Code(const std::string &code) { reverse_parity = false; set_code(code); } //! Set an arbitary polynomial in bvec form. Start with highest order terms. void set_generator(const bvec &poly); //! Set CRC code to one of the standardpolynomials using the string value. void set_code(const std::string &code); //! Calulate the parity bits void parity(const bvec &in_bits, bvec &out) const; //! Return true if parity checks OK otherwise flase bool check_parity(const bvec &coded_bits) const; //! Calculate and add parity to the in_bits. void encode(const bvec &in_bits, bvec &out) const; //! Returns the in_bits vector with parity added bvec encode(const bvec &in_bits) const; //! Return true if parity checks OK otherwise flase. Also returns the message part in out. bool decode(const bvec &coded_bits, bvec &out) const; //! Return true if parity checks OK otherwise flase. Also returns the message part in bits. bool decode(bvec &bits) const; private: bool reverse_parity; bvec polynomial; int no_parity; }; } // namespace itpp #endif // #ifndef CRC_H itpp-4.3.1/itpp/comm/egolay.cpp000066400000000000000000000076651216575753400164230ustar00rootroot00000000000000/*! * \file * \brief Implementation of the Extended Golay Code (24, 12, 8) * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { Extended_Golay::Extended_Golay(void) { B = "0 1 1 1 1 1 1 1 1 1 1 1;1 1 1 0 1 1 1 0 0 0 1 0;1 1 0 1 1 1 0 0 0 1 0 1;1 0 1 1 1 0 0 0 1 0 1 1;1 1 1 1 0 0 0 1 0 1 1 0;1 1 1 0 0 0 1 0 1 1 0 1;1 1 0 0 0 1 0 1 1 0 1 1;1 0 0 0 1 0 1 1 0 1 1 1;1 0 0 1 0 1 1 0 1 1 1 0;1 0 1 0 1 1 0 1 1 1 0 0;1 1 0 1 1 0 1 1 1 0 0 0;1 0 1 1 0 1 1 1 0 0 0 1"; G = concat_horizontal(eye_b(12), B); } void Extended_Golay::encode(const bvec &uncoded_bits, bvec &coded_bits) { int no_bits = uncoded_bits.length(); int no_blocks = floor_i(no_bits / 12.0); coded_bits.set_size(24*no_blocks, false); bmat Gt = G.T(); int i; for (i = 0; i < no_blocks; i++) coded_bits.replace_mid(24*i, Gt * uncoded_bits.mid(i*12, 12)); } bvec Extended_Golay::encode(const bvec &uncoded_bits) { bvec coded_bits; encode(uncoded_bits, coded_bits); return coded_bits; } void Extended_Golay::decode(const bvec &coded_bits, bvec &decoded_bits) { int no_bits = coded_bits.length(); int no_blocks = floor_i(no_bits / 24.0); decoded_bits.set_size(12*no_blocks, false); int i, j; bvec S(12), BS(12), r(12), temp(12), e(24), c(24); bmat eyetemp = eye_b(12); for (i = 0; i < no_blocks; i++) { r = coded_bits.mid(i * 24, 24); // Step 1. Compute S=G*r. S = G * r; // Step 2. w(S)<=3. e=(S,0). Goto 8. if (weight(S) <= 3) { e = concat(S, zeros_b(12)); goto Step8; } // Step 3. w(S+Ii)<=2. e=(S+Ii,yi). Goto 8. for (j = 0; j < 12; j++) { temp = S + B.get_col(j); if (weight(temp) <= 2) { e = concat(temp, eyetemp.get_row(j)); goto Step8; } } // STEP 4. Compute B*S BS = B * S; // Step 5. w(B*S)<=3. e=(0,BS). Goto8. if (weight(BS) <= 3) { e = concat(zeros_b(12), BS); goto Step8; } // Step 6. w(BS+Ri)<=2. e=(xi,BS+Ri). Goto 8. for (j = 0; j < 12; j++) { temp = BS + B.get_row(j); if (weight(temp) <= 2) { e = concat(eyetemp.get_row(j), temp); goto Step8; } } // Step 7. Uncorrectable erreor pattern. Choose the first 12 bits. e = zeros_b(24); goto Step8; Step8: // Step 8. c=r+e. STOP c = r + e; decoded_bits.replace_mid(i*12, c.left(12)); } } bvec Extended_Golay::decode(const bvec &coded_bits) { bvec decoded_bits; decode(coded_bits, decoded_bits); return decoded_bits; } // -------------- Soft-decision decoding is not implemented ------------------ void Extended_Golay::decode(const vec &, bvec &) { it_error("Extended_Golay::decode(vec, bvec); soft-decision decoding is not implemented"); } bvec Extended_Golay::decode(const vec &) { it_error("Extended_Golay::decode(vec, bvec); soft-decision decoding is not implemented"); return bvec(); } } // namespace itpp itpp-4.3.1/itpp/comm/egolay.h000066400000000000000000000054571216575753400160650ustar00rootroot00000000000000/*! * \file * \brief Definition of the Extended Golay Code (24, 12, 8) * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef EGOLAY_H #define EGOLAY_H #include #include #include #include namespace itpp { /*! \ingroup fec \brief Extended Golay code (24,12,8). \author Tony Ottosson The code is given in systematic form with the information bits first, followed by the parity check bits. The decoder uses the arithmetic decoding algorithm that is for example described in Wicker "Error Control Systems for Digital Communication and Storage", Prentice Hall, 1995 (page 143). */ class ITPP_EXPORT Extended_Golay : public Channel_Code { public: //! Constructor Extended_Golay(); //! Destructor virtual ~Extended_Golay() { } //! Encoder. Will truncate some bits if not \a length = \c integer * 12 virtual void encode(const bvec &uncoded_bits, bvec &coded_bits); //! Encoder. Will truncate some bits if not \a length = \c integer * 12 virtual bvec encode(const bvec &uncoded_bits); //! Decoder. Will truncate some bits if not \a length = \c integer * 24 virtual void decode(const bvec &coded_bits, bvec &decoded_bits); //! Decoder. Will truncate some bits if not \a length = \c integer * 24 virtual bvec decode(const bvec &coded_bits); // Soft-decision decoding is not implemented virtual void decode(const vec &received_signal, bvec &output); virtual bvec decode(const vec &received_signal); //! Get the code rate virtual double get_rate() const { return 0.5; }; //! Gets the generator matrix for the code (also the parity check matrix) bmat get_G() const { return G; } private: bmat B, G; }; } // namespace itpp #endif // #ifndef EGOLAY_H itpp-4.3.1/itpp/comm/error_counters.cpp000066400000000000000000000136311216575753400202040ustar00rootroot00000000000000/*! * \file * \brief Implementation of Bit Error Rate Counter (BERC) and * BLock Error Rate Counter (BLERC) classes * \author Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include namespace itpp { //----------------------------------------------------------- // The Bit error rate counter class (BERC) //----------------------------------------------------------- BERC::BERC(int indelay, int inignorefirst, int inignorelast): delay(indelay), ignorefirst(inignorefirst), ignorelast(inignorelast), errors(0), corrects(0) {} void BERC::count(const bvec &in1, const bvec &in2) { int countlength = std::min(in1.length(), in2.length()) - std::abs(delay) - ignorefirst - ignorelast; if (delay >= 0) { for (int i = 0; i < countlength; i++) { if (in1(i + ignorefirst) == in2(i + ignorefirst + delay)) { corrects++; } else { errors++; } } } else { for (int i = 0; i < countlength; i++) { if (in1(i + ignorefirst - delay) == in2(i + ignorefirst)) { corrects++; } else { errors++; } } } } void BERC::count(const bool x) { if (x) { errors++; } else { corrects++; } } void BERC::estimate_delay(const bvec &in1, const bvec &in2, int mindelay, int maxdelay) { int num, start1, start2; int min_input_length = std::min(in1.length(), in2.length()); int bestdelay = mindelay; double correlation; double bestcorr = 0; for (int i = mindelay; i < maxdelay; i++) { num = min_input_length - std::abs(i) - ignorefirst - ignorelast; start1 = (i < 0) ? -i : 0; start2 = (i > 0) ? i : 0; correlation = fabs(sum(to_vec(elem_mult(in1.mid(start1, num), in2.mid(start2, num))))); if (correlation > bestcorr) { bestdelay = i; bestcorr = correlation; } } delay = bestdelay; } void BERC::report() const { std::cout.setf(std::ios::fixed); std::cout << std::endl << "==================================" << std::endl << " Bit Error Counter Report " << std::endl << "==================================" << std::endl << " Ignore First = " << ignorefirst << std::endl << " Ignore Last = " << ignorelast << std::endl << " Delay = " << delay << std::endl << " Number of counted bits = " << std::setprecision(0) << (errors + corrects) << std::endl << " Number of errors = " << std::setprecision(0) << errors << std::endl << "==================================" << std::endl << " Error rate = " << std::setprecision(8) << (errors / (errors + corrects)) << std::endl << "==================================" << std::endl << std::endl; } double BERC::count_errors(const bvec &in1, const bvec &in2, int indelay, int inignorefirst, int inignorelast) { int countlength = std::min(in1.length(), in2.length()) - std::abs(indelay) - inignorefirst - inignorelast; int local_errors = 0; if (indelay >= 0) { for (int i = 0; i < countlength; i++) { if (in1(i + inignorefirst) != in2(i + inignorefirst + indelay)) { local_errors++; } } } else { for (int i = 0; i < countlength; i++) { if (in1(i + inignorefirst - indelay) != in2(i + inignorefirst)) { local_errors++; } } } return local_errors; } //----------------------------------------------------------- // The Block error rate counter class (BERC) //----------------------------------------------------------- BLERC::BLERC(): setup_done(false), blocksize(0), errors(0), corrects(0) {} BLERC::BLERC(int inblocksize): setup_done(true), blocksize(inblocksize), errors(0), corrects(0) {} void BLERC::set_blocksize(int inblocksize, bool clear) { blocksize = inblocksize; if (clear) { errors = 0; corrects = 0; } setup_done = true; } void BLERC::count(const bvec &in1, const bvec &in2) { it_assert(setup_done == true, "BLERC::count(): Block size has to be setup before counting errors."); int min_input_length = std::min(in1.length(), in2.length()); it_assert(blocksize <= min_input_length, "BLERC::count(): Block size must not be longer than input vectors."); for (int i = 0; i < (min_input_length / blocksize); i++) { CORR = true; for (int j = 0; j < blocksize; j++) { if (in1(i * blocksize + j) != in2(i * blocksize + j)) { CORR = false; break; } } if (CORR) { corrects++; } else { errors++; } } } void BLERC::count(const bool x) { if (x) { errors++; } else { corrects++; } } } // namespace itpp itpp-4.3.1/itpp/comm/error_counters.h000066400000000000000000000122141216575753400176450ustar00rootroot00000000000000/*! * \file * \brief Definitions of Bit Error Rate Counter (BERC) and * BLock Error Rate Counter (BLERC) classes * \author Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ERROR_COUNTERS_H #define ERROR_COUNTERS_H #include #include namespace itpp { /*! \brief Bit Error Rate Counter (BERC) Class Example: \code #include int main() { //Initiate the Bit Error Counter BERC berc; //Initiate a Binary Symetric Channel with cross-over probability 0.1 BSC binary_symetric_channel(0.1); bvec transmitted_bits = randb(100); bvec received_bits = binary_symetric_channel(transmitted_bits); //Count the number of bit errors berc.count(transmitted_bits, received_bits); cout << "Estimated bit error probability is " << berc.get_errorrate() << endl; return 0; } \endcode */ class ITPP_EXPORT BERC { public: /*! \brief Constructor for the berc class.
    • \a delay is positive if \a in2 is a delayed replica of \a in1 and negative otherwise.
    • \a ignorefirst and \a ignorelast may be used if errors in the begining and/or the end is to be ignored.
    */ BERC(int indelay = 0, int inignorefirst = 0, int inignorelast = 0); //! Cumulative error counter void count(const bvec &in1, const bvec &in2); /*! \brief Variant of the cumulative error counter. Counts a bit error if \a x is true, and a correct bit otherwise */ void count(const bool x); /*! \brief Run this member function if the delay between \a in1 and \a in2 is unknown. */ void estimate_delay(const bvec &in1, const bvec &in2, int mindelay = -100, int maxdelay = 100); //! Clears the bit error counter void clear() { errors = 0; corrects = 0; } //! Writes an error report void report() const; //! Return the \a delay, assumed or estimated, between \a in1 and \a in2. int get_delay() const { return delay; } //! Returns the counted number of bit errors double get_errors() const { return errors; } //! Returns the counted number of corectly received bits double get_corrects() const { return corrects; } //! Returns the total number of bits processed double get_total_bits() const { return (errors + corrects); } //! Returns the estimated bit error rate. double get_errorrate() const { return (errors / (corrects + errors)); } /*! \brief static function to allow simple and fast count of bit-errors Returns the number of errors between in1 and in2. Typical usage: \code bvec in1 = randb(100); bvec in2 = randb(100); double errors = BERC::count_errors(in1, in2); \endcode */ static double count_errors(const bvec &in1, const bvec &in2, int indelay = 0, int inignorefirst = 0, int inignorelast = 0); private: int delay; int ignorefirst; int ignorelast; double errors; double corrects; }; /*! \brief Class for counting block error rates. Use this class to count block errors in binary vectors. */ class ITPP_EXPORT BLERC { public: //! Class constructor BLERC(void); //! Specialised constructor BLERC(int blocksize); //! Set the block size void set_blocksize(int inblocksize, bool clear = true); //! Calculate the number of block errors between \a in1 and \a in2 void count(const bvec &in1, const bvec &in2); /*! \brief Variant of the cumulative error counter. Counts a block error if \a x is true, and a correct block otherwise */ void count(const bool x); //! Clear the block error counter void clear() { errors = 0; corrects = 0; } //! Returns the number of block errors double get_errors() const { return errors; } //! Returns the number of correct blocks double get_corrects() const { return corrects; } //! Returns the total number of block processed double get_total_blocks() const { return (errors + corrects); } //! Returns the block error rate double get_errorrate() const { return (errors / (corrects + errors)); } //protected: private: bool setup_done; int blocksize; double errors; double corrects; bool CORR; }; } // namespace itpp #endif // #ifndef ERROR_COUNTERS_H itpp-4.3.1/itpp/comm/exit.cpp000066400000000000000000000061251216575753400161020ustar00rootroot00000000000000/*! * \file * \brief Implementation of EXtrinsic Information Transfer (EXIT) chart class * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include //histogram class for mutual information computation #include namespace itpp { double EXIT::Gaussian_Fct::operator()(double x) const { return (1.0/std::sqrt(_sigma*itpp::m_2pi))*std::exp(-itpp::sqr(x-(_sigma/2.0))/(2.0*_sigma))*::log2(1+std::exp(-x)); } double EXIT::extrinsic_mutual_info(const itpp::vec &obs, const itpp::bvec &cond, const int &N) { //initialize histogram itpp::Histogram hist(itpp::min(obs), itpp::max(obs), N);//common definition interval for both PDFs //conditional PDF knowing that a bit of 0 was emitted itpp::ivec idx = itpp::find(cond==itpp::bin(0)); itpp::vec cond_obs = obs(idx); hist.reset();//start counting hist.update(cond_obs); itpp::vec left_pdf = hist.get_pdf();//the pdf is computed without taking into account the interval length (step) itpp::ivec left_int = itpp::find(left_pdf!=0);//integration interval for the left PDF //conditional PDF knowing that a bit of 1 was emitted idx = itpp::find(cond==itpp::bin(1)); cond_obs = obs(idx); hist.reset();//restart counting hist.update(cond_obs); itpp::vec right_pdf = hist.get_pdf(); itpp::ivec right_int = itpp::find(right_pdf!=0);//integration interval for the right PDF //mutual extrinsic information itpp::vec left_half = itpp::elem_mult(left_pdf(left_int), itpp::log2(itpp::elem_div(2.0*left_pdf(left_int), left_pdf(left_int)+right_pdf(left_int)))); double IE = itpp::sum(left_half)-0.5*(left_half(0)+left_half(left_half.length()-1));//numerical integration without taking into account the inteval length (see conditional PDF computation) itpp::vec right_half = itpp::elem_mult(right_pdf(right_int), itpp::log2(itpp::elem_div(2.0*right_pdf(right_int), left_pdf(right_int)+right_pdf(right_int)))); IE += itpp::sum(right_half)-0.5*(right_half(0)+right_half(right_half.length()-1));//numerical integration IE *= 0.5; return IE; } }//namespace itpp itpp-4.3.1/itpp/comm/exit.h000066400000000000000000000101641216575753400155450ustar00rootroot00000000000000/*! * \file * \brief Definitions for EXtrinsic Information Transfer (EXIT) chart class * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef EXIT_H #define EXIT_H #include #include //BPSK class for a priori information generation #include namespace itpp { /*! \ingroup misccommfunc \brief EXtrinsic Information Transfer (%EXIT) chart Computes the A priori Mutual Information assuming a Gaussian distribution of the a priori information and the Extrinsic Mutual Information between the emitted bits and their extrinsic information Description: - the a priori mutual information is computed using relation (14) - the extrinsic mutual information is computed by estimating first the conditional Probability Density Functions (PDF), given the emitted bits, and then numerically integrating according to relation (19) Reference: Stephan ten Brink, ''Convergence behavior of iteratively decoded parallel concatenated codes,`` IEEE Transactions on Communications, oct. 2001 */ class ITPP_EXPORT EXIT { public: //! Computes the a priori mutual information /*! It is assumed that the a priori information has a Gaussian distribution */ double apriori_mutual_info(const double &in_sigma2A, //!< variance of the a priori information const double &lim=100 //!< [-lim,+lim] is the integration interval (theoretically it should be [-inf,+inf]) ) { _gaussian_fct = Gaussian_Fct(in_sigma2A); return 1.0-itpp::quad(_gaussian_fct, -lim, lim); }; //! Generates a priori information assuming a Gaussian distribution of the a priori information /*! The variance of the a priori information must be already initialized through EXIT::apriori_mutual_info function. * The information generated in this way is used sometimes as intrinsic information at the SISO module input. */ itpp::vec generate_apriori_info(const itpp::bvec &bits) { itpp::BPSK bpsk; double sigma2A = _gaussian_fct.sigma(); return (-sigma2A/2)*bpsk.modulate_bits(bits)+std::sqrt(sigma2A)*itpp::randn(bits.length()); }; //! Computes the extrinsic mutual information /*! The conditional Probability Density Function (PDF) of the extrinsic information is estimated using the histogram of the * extrinsic information and the knowledge of the emitted bits corresponding to the extrinsic information. */ double extrinsic_mutual_info(const itpp::vec &obs, //!< extrinsic information obtained from the SISO module output const itpp::bvec &cond, //!< emitted bits corresponding to the extrinsic information const int &N=100 //!< number of subintervals used to compute the histogram ); private: class ITPP_EXPORT Gaussian_Fct { double _sigma; public: Gaussian_Fct(): _sigma(0.0){} Gaussian_Fct(double sigma): _sigma(sigma){} double sigma() const {return _sigma;} double operator()(double x) const; }; Gaussian_Fct _gaussian_fct; }; } #endif /* EXIT_H_ */ itpp-4.3.1/itpp/comm/galois.cpp000066400000000000000000000140601216575753400164040ustar00rootroot00000000000000/*! * \file * \brief Implementation of Galois Field algebra classes and functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include namespace itpp { Array > GF::alphapow; Array > GF::logalpha; ivec GF::q = "1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536"; // set q=2^mvalue void GF::set_size(int qvalue) { m = static_cast(round_i(::log2(static_cast(qvalue)))); it_assert((1 << m) == qvalue, "GF::setsize : q is not a power of 2"); it_assert((m > 0) && (m <= 16), "GF::setsize : q must be positive and " "less than or equal to 2^16"); /* Construct GF(q), q=2^m. From Wicker, "Error Control Systems for digital communication and storage" pp. 463-465 */ int reduce, temp, n; const int reducetable[] = {3, 3, 3, 5, 3, 9, 29, 17, 9, 5, 83, 27, 43, 3, 4107}; // starts at m=2,..,16 if (alphapow.size() < (m + 1)) { alphapow.set_size(m + 1, true); logalpha.set_size(m + 1, true); } if (alphapow(m).size() == 0) { alphapow(m).set_size(qvalue); logalpha(m).set_size(qvalue); alphapow(m) = 0; logalpha(m) = 0; if (m == 1) { // GF(2), special case alphapow(1)(0) = 1; logalpha(1)(0) = -1; logalpha(1)(1) = 0; } else { reduce = reducetable[m-2]; alphapow(m)(0) = 1; // alpha^0 = 1 for (n = 1; n < (1 << m) - 1; n++) { temp = alphapow(m)(n - 1); temp = (temp << 1); // multiply by alpha if (temp & (1 << m)) // contains alpha**m term alphapow(m)(n) = (temp & ~(1 << m)) ^ reduce; else alphapow(m)(n) = temp; // if no alpha**m term, store as is // create table to go in opposite direction logalpha(m)(0) = -1; // special case, actually log(0)=-inf } for (n = 0;n < (1 << m) - 1;n++) logalpha(m)(alphapow(m)(n)) = n; } } } //! Input stream operator for GF std::istream &operator>>(std::istream &is, GF &ingf) { int val; char c; static const std::string prefix("alpha^"); c = is.get(); if(c == 'a') { //read alpha^pow form from stream std::string::const_iterator pr_it = prefix.begin(); pr_it++; for(; pr_it < prefix.end(); ++pr_it) { c = is.get(); if(*pr_it != c) { is.setstate(std::ios_base::failbit); return is; } } is >> val; if(is) ingf.set(ingf.get_size(),val); } else { //try to read 0 from stream is >> val; if(is && (val==0)) { ingf.set(ingf.get_size(),0); } else { is.setstate(std::ios_base::failbit); } } return is; } //! Output stream operator for GF std::ostream &operator<<(std::ostream &os, const GF &ingf) { if (ingf.value == -1) os << "0"; else os << "alpha^" << ingf.value; return os; } //! Output stream operator for GFX std::ostream &operator<<(std::ostream &os, const GFX &ingfx) { int terms = 0; for (int i = 0; i < ingfx.degree + 1; i++) { if (ingfx.coeffs(i) != GF(ingfx.q, -1)) { if (terms != 0) os << " + "; terms++; if (ingfx.coeffs(i) == GF(ingfx.q, 0)) {// is the coefficient an one (=alpha^0=1) os << "x^" << i; } else { os << ingfx.coeffs(i) << "*x^" << i; } } } if (terms == 0) os << "0"; return os; } //----------------- Help Functions ----------------- //! Division of two GFX (local help function) GFX divgfx(const GFX &c, const GFX &g) { int q = c.get_size(); GFX temp = c; int tempdegree = temp.get_true_degree(); int gdegree = g.get_true_degree(); int degreedif = tempdegree - gdegree; if (degreedif < 0) return GFX(q, 0); // denominator larger than nominator. Return zero polynomial. GFX m(q, degreedif), divisor(q); for (int i = 0; i < c.get_degree(); i++) { m[degreedif] = temp[tempdegree] / g[gdegree]; divisor.set_degree(degreedif); divisor.clear(); divisor[degreedif] = m[degreedif]; temp -= divisor * g; tempdegree = temp.get_true_degree(); degreedif = tempdegree - gdegree; if ((degreedif < 0) || (temp.get_true_degree() == 0 && temp[0] == GF(q, -1))) { break; } } return m; } //! Modulo function of two GFX (local help function) GFX modgfx(const GFX &a, const GFX &b) { int q = a.get_size(); GFX temp = a; int tempdegree = temp.get_true_degree(); int bdegree = b.get_true_degree(); int degreedif = a.get_true_degree() - b.get_true_degree(); if (degreedif < 0) return temp; // Denominator larger than nominator. Return nominator. GFX m(q, degreedif), divisor(q); for (int i = 0; i < a.get_degree(); i++) { m[degreedif] = temp[tempdegree] / b[bdegree]; divisor.set_degree(degreedif); divisor.clear(); divisor[degreedif] = m[degreedif]; temp -= divisor * b; // Bug-fixed. Used to be: temp -= divisor*a; tempdegree = temp.get_true_degree(); degreedif = temp.get_true_degree() - bdegree; if ((degreedif < 0) || (temp.get_true_degree() == 0 && temp[0] == GF(q, -1))) { break; } } return temp; } } // namespace itpp itpp-4.3.1/itpp/comm/galois.h000066400000000000000000000363771216575753400160700ustar00rootroot00000000000000/*! * \file * \brief Definitions of Galois Field algebra classes and functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef GALOIS_H #define GALOIS_H #include #include #include #include #include #include namespace itpp { /*! \brief Galois Field GF(q). \author Tony Ottosson Galois field GF(q), where \a q = 2^m. Possible \a m values is \a m = 1,2,...,16. Elements are given as exponents of the primitive element \a alpha. Observe that the zeroth element are given as "-1". ( log(0)=-Inf ).

    The following primitve polynomials are used to construct the fields:

    • GF(4): 1+x+x^2
    • GF(8): 1+x+x^3
    • GF(16): 1+x+x^4
    • GF(32): 1+x^2+x^5
    • GF(64): 1+x^2+x^6
    • GF(128): 1+x^3+x^7
    • GF(256): 1+x^2+x^3+x^4+x^8
    • GF(512): 1+x^4+x^9
    • GF(1024): 1+x^3+x^10
    • GF(2^11): 1+x^2+x^11
    • GF(2^12): 1+x+x^4+x^12
    • GF(2^13): 1+x+x^3+x^4+x^13
    • GF(2^14): 1+x+x^3+x^5+x^14
    • GF(2^15): 1+x+x^15
    • GF(2^16): 1+x+x^3+x^12+x^16
    As indicated it is possible to use this class for binary elements, that is GF(2). However, this is less efficient in storage (each element take 5 bytes of memory) and in speed. If possible use the class BIN instead. Observe, also that the element "0" is called "-1" and "1" called "0". */ class ITPP_EXPORT GF { public: //! Constructor GF() { m = 0; } //! Constructor GF(int qvalue) { m = 0; if (qvalue == 0) // qvalue==0 gives the zeroth element value = -1; else set_size(qvalue); } //! Constructor GF(int qvalue, int inexp) { m = 0; set(qvalue, inexp); } //! Copy constructor GF(const GF &ingf) { m = ingf.m; value = ingf.value; } //! GF(q) equals \a alpha ^ \a inexp void set(int qvalue, int inexp) { set_size(qvalue); it_assert_debug(inexp >= -1 && inexp < qvalue - 1, "GF::set, out of range"); value = inexp; } /*! \brief GF(q) equals the element that corresponds to the given vector space. The format is (...,c,b,a), where the element x is given as x=...+c*alpha^2+b*alpha+a. */ void set(int qvalue, const bvec &vectorspace); //! set q=2^mvalue void set_size(int qvalue); //! Return q. int get_size() const { return ((m != 0) ? q[m] : 0); } /*! \brief Returns the vector space representation of GF(q). The format is (...,c,b,a), where the element x is given as x=...+c*alpha^2+b*alpha+a. */ bvec get_vectorspace() const; //! Returns the alpha exponent int get_value() const; //! Equality check int operator==(const GF &ingf) const; //! Not-equality check int operator!=(const GF &ingf) const; //! GF(q) equals ingf void operator=(const GF &ingf); //! GF(q) equals alpha^inexp void operator=(const int inexp); //! sum of two GF(q) void operator+=(const GF &ingf); //! sum of two GF(q) GF operator+(const GF &ingf) const; //! Difference of two GF(q), same as sum for q=2^m. void operator-=(const GF &ingf); //! Difference of two GF(q), same as sum for q=2^m. GF operator-(const GF &ingf) const; //! product of two GF(q) void operator*=(const GF &ingf); //! product of two GF(q) GF operator*(const GF &ingf) const; //! division of two GF(q) void operator/=(const GF &ingf); //! product of two GF(q) GF operator/(const GF &ingf) const; //! Output stream for GF(q) ITPP_EXPORT friend std::ostream &operator<<(std::ostream &os, const GF &ingf); //! Input stream for GF(q) ITPP_EXPORT friend std::istream &operator>>(std::istream &is, GF &ingf); protected: private: char m; int value; static Array > alphapow; static Array > logalpha; static ivec q; }; //! \cond #if (defined(_MSC_VER) && defined (ITPP_SHARED_LIB)) //MSVC explicitely instantiate required template while building the shared library template class ITPP_EXPORT Array; #endif //! \endcond class GFX; //! Multiplication of GF and GFX ITPP_EXPORT GFX operator*(const GF &ingf, const GFX &ingfx); //! Multiplication of GFX and GF ITPP_EXPORT GFX operator*(const GFX &ingfx, const GF &ingf); //! Division of GFX by GF ITPP_EXPORT GFX operator/(const GFX &ingfx, const GF &ingf); //! Output stream ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const GFX &ingfx); /*! \brief Polynomials over GF(q)[x], where q=2^m, m=1,...,16 */ class ITPP_EXPORT GFX { public: //! Constructor GFX(); //! Constructor GFX(int qvalue); //! Constructor GFX(int qvalue, int indegree); //! Constructor GFX(int qvalue, const ivec &invalues); //! Constructor GFX(int qvalue, char *invalues); //! Constructor GFX(int qvalue, std::string invalues); //! Copy constructor GFX(const GFX &ingfx); //! Return q. int get_size() const; //! Return degree of GF(q)[x] int get_degree() const; /*! \brief Resize the polynomial to the given \c indegree. If \c copy is set to true, the old polynomial's coefficients are kept in the new polynomial, otherwise they are set to zero. */ void set_degree(int indegree, bool copy = false); //! Return true degree of GF(q)[x] int get_true_degree() const; //! Set the GF(q)[x] polynomial void set(int qvalue, const char *invalues); //! Set the GF(q)[x] polynomial void set(int qvalue, const std::string invalues); //! Set the GF(q)[x] polynomial void set(int qvalue, const ivec &invalues); //! Set all coefficients to zero. void clear(); //! Acces to individual element in the GF(q)[x] polynomial GF operator[](int index) const { it_assert_debug(index<=degree, "GFX::op[], out of range"); return coeffs(index); } //! Acces to individual element in the GF(q)[x] polynomial GF &operator[](int index) { it_assert_debug(index<=degree, "GFX::op[], out of range"); return coeffs(index); } //! Copy void operator=(const GFX &ingfx); //! sum of two GF(q)[x] void operator+=(const GFX &ingfx); //! sum of two GF(q)[x] GFX operator+(const GFX &ingfx) const; //! Difference of two GF(q), same as sum for q=2^m. void operator-=(const GFX &ingfx); //! Difference of two GF(q), same as sum for q=2^m. GFX operator-(const GFX &ingfx) const; //! product of two GF(q)[x] void operator*=(const GFX &ingfx); //! product of two GF(q)[x] GFX operator*(const GFX &ingfx) const; //! Evaluate polynom at alpha^inexp GF operator()(const GF &ingf); //! Multiply a GF element with a GF(q)[x] ITPP_EXPORT friend GFX operator*(const GF &ingf, const GFX &ingfx); //! Multiply a GF(q)[x] with a GF element ITPP_EXPORT friend GFX operator*(const GFX &ingfx, const GF &ingf); //! Divide a GF(q)[x] with a GF element ITPP_EXPORT friend GFX operator/(const GFX &ingfx, const GF &ingf); //! Output stream ITPP_EXPORT friend std::ostream &operator<<(std::ostream &os, const GFX &ingfx); protected: private: int degree, q; Array coeffs; }; //-------------- Help Functions ------------------ /*! \relates GFX \brief Int division of GF[q](x) polynomials: m(x) = c(x)/g(x). The reminder r(x) is not returned by this function. */ ITPP_EXPORT GFX divgfx(const GFX &c, const GFX &g); /*! \relates GFX \brief Function that performs int division of gf[q](x) polynomials (a(x)/g(x)) and returns the reminder. */ ITPP_EXPORT GFX modgfx(const GFX &a, const GFX &b); // --------------- Inlines ------------------------ // --------------- class GF ----------------------- inline void GF::set(int qvalue, const bvec &vectorspace) { set_size(qvalue); it_assert_debug(vectorspace.length() == m, "GF::set, out of range"); value = logalpha(m)(bin2dec(vectorspace)); } inline bvec GF::get_vectorspace() const { bvec temp(m); if (value == -1) temp = dec2bin(m, 0); else temp = dec2bin(m, alphapow(m)(value)); return temp; } inline int GF::get_value() const { return value; } inline int GF::operator==(const GF &ingf) const { if (value == -1 && ingf.value == -1) return true; if (m == ingf.m && value == ingf.value) return true; else return false; } inline int GF::operator!=(const GF &ingf) const { GF tmp(*this); return !(tmp == ingf); } inline void GF::operator=(const GF &ingf) { m = ingf.m; value = ingf.value; } inline void GF::operator=(const int inexp) { it_assert_debug(m > 0 && inexp >= -1 && inexp < (q[m] - 1), "GF::op=, out of range"); value = inexp; } inline void GF::operator+=(const GF &ingf) { if (value == -1) { value = ingf.value; m = ingf.m; } else if (ingf.value != -1) { it_assert_debug(ingf.m == m, "GF::op+=, not same field"); value = logalpha(m)(alphapow(m)(value) ^ alphapow(m)(ingf.value)); } } inline GF GF::operator+(const GF &ingf) const { GF tmp(*this); tmp += ingf; return tmp; } inline void GF::operator-=(const GF &ingf) { (*this) += ingf; } inline GF GF::operator-(const GF &ingf) const { GF tmp(*this); tmp -= ingf; return tmp; } inline void GF::operator*=(const GF &ingf) { if (value == -1 || ingf.value == -1) value = -1; else { it_assert_debug(ingf.m == m, "GF::op+=, not same field"); value = (value + ingf.value) % (q[m] - 1); } } inline GF GF::operator*(const GF &ingf) const { GF tmp(*this); tmp *= ingf; return tmp; } inline void GF::operator/=(const GF &ingf) { it_assert(ingf.value != -1, "GF::operator/: division by zero element"); // no division by the zeroth element if (value == -1) value = -1; else { it_assert_debug(ingf.m == m, "GF::op+=, not same field"); value = (value - ingf.value + q[m] - 1) % (q[m] - 1); } } inline GF GF::operator/(const GF &ingf) const { GF tmp(*this); tmp /= ingf; return tmp; } // ------------------ class GFX -------------------- inline GFX::GFX() { degree = -1; q = 0; } inline GFX::GFX(int qvalue) { it_assert_debug(qvalue >= 0, "GFX::GFX, out of range"); q = qvalue; } inline void GFX::set(int qvalue, const ivec &invalues) { it_assert_debug(qvalue > 0, "GFX::set, out of range"); degree = invalues.size() - 1; coeffs.set_size(degree + 1, false); for (int i = 0;i < degree + 1;i++) coeffs(i).set(qvalue, invalues(i)); q = qvalue; } inline void GFX::set(int qvalue, const char *invalues) { set(qvalue, ivec(invalues)); } inline void GFX::set(int qvalue, const std::string invalues) { set(qvalue, invalues.c_str()); } inline GFX::GFX(int qvalue, int indegree) { it_assert_debug(qvalue > 0 && indegree >= 0, "GFX::GFX, out of range"); q = qvalue; coeffs.set_size(indegree + 1, false); degree = indegree; for (int i = 0;i < degree + 1;i++) coeffs(i).set(q, -1); } inline GFX::GFX(int qvalue, const ivec &invalues) { set(qvalue, invalues); } inline GFX::GFX(int qvalue, char *invalues) { set(qvalue, invalues); } inline GFX::GFX(int qvalue, std::string invalues) { set(qvalue, invalues.c_str()); } inline GFX::GFX(const GFX &ingfx) { degree = ingfx.degree; coeffs = ingfx.coeffs; q = ingfx.q; } inline int GFX::get_size() const { return q; } inline int GFX::get_degree() const { return degree; } inline void GFX::set_degree(int indegree, bool copy) { it_assert_debug(indegree >= -1, "GFX::set_degree, out of range"); coeffs.set_size(indegree + 1, copy); degree = indegree; } inline int GFX::get_true_degree() const { int i = degree; while (coeffs(i).get_value() == -1) { i--; if (i == -1) break; } return i; } inline void GFX::clear() { it_assert_debug(degree >= 0 && q > 0, "GFX::clear, not set"); for (int i = 0;i < degree + 1;i++) coeffs(i).set(q, -1); } inline void GFX::operator=(const GFX &ingfx) { degree = ingfx.degree; coeffs = ingfx.coeffs; q = ingfx.q; } inline void GFX::operator+=(const GFX &ingfx) { it_assert_debug(q == ingfx.q, "GFX::op+=, not same field"); if (ingfx.degree > degree) { coeffs.set_size(ingfx.degree + 1, true); // set new coefficients to the zeroth element for (int j = degree + 1; j < coeffs.size(); j++) { coeffs(j).set(q, -1); } degree = ingfx.degree; } for (int i = 0;i < ingfx.degree + 1;i++) { coeffs(i) += ingfx.coeffs(i); } } inline GFX GFX::operator+(const GFX &ingfx) const { GFX tmp(*this); tmp += ingfx; return tmp; } inline void GFX::operator-=(const GFX &ingfx) { (*this) += ingfx; } inline GFX GFX::operator-(const GFX &ingfx) const { GFX tmp(*this); tmp -= ingfx; return tmp; } inline void GFX::operator*=(const GFX &ingfx) { it_assert_debug(q == ingfx.q, "GFX::op*=, Not same field"); int i, j; Array tempcoeffs = coeffs; coeffs.set_size(degree + ingfx.degree + 1, false); for (j = 0; j < coeffs.size(); j++) coeffs(j).set(q, -1); // set coefficients to the zeroth element (log(0)=-Inf=-1) for (i = 0;i < degree + 1;i++) for (j = 0;j < ingfx.degree + 1;j++) coeffs(i + j) += tempcoeffs(i) * ingfx.coeffs(j); degree = coeffs.size() - 1; } inline GFX GFX::operator*(const GFX &ingfx) const { GFX tmp(*this); tmp *= ingfx; return tmp; } inline GFX operator*(const GF &ingf, const GFX &ingfx) { it_assert_debug(ingf.get_size() == ingfx.q, "GFX::op*, Not same field"); GFX temp(ingfx); for (int i = 0;i < ingfx.degree + 1;i++) temp.coeffs(i) *= ingf; return temp; } inline GFX operator*(const GFX &ingfx, const GF &ingf) { return ingf*ingfx; } inline GFX operator/(const GFX &ingfx, const GF &ingf) { it_assert_debug(ingf.get_size() == ingfx.q, "GFX::op/, Not same field"); GFX temp(ingfx); for (int i = 0;i < ingfx.degree + 1;i++) temp.coeffs(i) /= ingf; return temp; } inline GF GFX::operator()(const GF &ingf) { it_assert_debug(q == ingf.get_size(), "GFX::op(), Not same field"); GF temp(coeffs(0)), ingfpower(ingf); for (int i = 1; i < degree + 1; i++) { temp += coeffs(i) * ingfpower; ingfpower *= ingf; } return temp; } } // namespace itpp #endif // #ifndef GALOIS_H itpp-4.3.1/itpp/comm/hammcode.cpp000066400000000000000000000100361216575753400167020ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Hamming code class * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { Hamming_Code::Hamming_Code(int m) { n = pow2i(m) - 1; k = pow2i(m) - m - 1; H.set_size(n - k, n); G.set_size(k, n); generate_H(); // generate_H must be run before generate_G generate_G(); } void Hamming_Code::generate_H(void) { int i, j, NextPos; char NotUsed; bvec temp; ivec indexes(n); indexes.zeros(); for (i = 1; i <= n - k; i++) { indexes(i - 1) = pow2i(n - k - i); } NextPos = n - k; for (i = 1; i <= n; i++) { NotUsed = 1; for (j = 0; j < n; j++) if (i == indexes(j)) { NotUsed = 0; } if (NotUsed) { indexes(NextPos) = i; NextPos = NextPos + 1; } } for (i = 0; i < n; i++) { temp = dec2bin(n - k, indexes(i)); //<-CHECK THIS OUT!!!! for (j = 0; j < (n - k); j++) { H(j, i) = temp(j); } } } void Hamming_Code::generate_G(void) { int i, j; for (i = 0; i < k; i++) { for (j = 0; j < n - k; j++) G(i, j) = H(j, i + n - k); } for (i = 0; i < k; i++) { for (j = n - k; j < n; j++) G(i, j) = 0; } for (i = 0; i < k; i++) G(i, i + n - k) = 1; } void Hamming_Code::encode(const bvec &uncoded_bits, bvec &coded_bits) { int length = uncoded_bits.length(); int Itterations = floor_i(static_cast(length) / k); bmat Gt = G.T(); int i; coded_bits.set_size(Itterations * n, false); //Code all codewords for (i = 0; i < Itterations; i++) coded_bits.replace_mid(n*i, Gt * uncoded_bits.mid(i*k, k)); } bvec Hamming_Code::encode(const bvec &uncoded_bits) { bvec coded_bits; encode(uncoded_bits, coded_bits); return coded_bits; } void Hamming_Code::decode(const bvec &coded_bits, bvec &decoded_bits) { int length = coded_bits.length(); int Itterations = floor_i(static_cast(length) / n); ivec Hindexes(n); bvec temp(n - k); bvec coded(n), syndrome(n - k); int isynd, errorpos = 0; int i, j; decoded_bits.set_size(Itterations*k, false); for (i = 0; i < n; i++) { for (j = 0; j < n - k; j++) temp(j) = H(j, i); Hindexes(i) = bin2dec(temp); } //Decode all codewords for (i = 0; i < Itterations; i++) { coded = coded_bits.mid(i * n, n); syndrome = H * coded; isynd = bin2dec(syndrome); if (isynd != 0) { for (j = 0; j < n; j++) if (Hindexes(j) == isynd) { errorpos = j; }; coded(errorpos) += 1; } decoded_bits.replace_mid(k*i, coded.right(k)); } } bvec Hamming_Code::decode(const bvec &coded_bits) { bvec decoded_bits; decode(coded_bits, decoded_bits); return decoded_bits; } // -------------- Soft-decision decoding is not implemented ---------------- void Hamming_Code::decode(const vec &, bvec &) { it_error("Hamming_Code::decode(vec, bvec); soft-decision decoding is not implemented"); } bvec Hamming_Code::decode(const vec &) { it_error("Hamming_Code::decode(vec, bvec); soft-decision decoding is not implemented"); return bvec(); } } // namespace itpp itpp-4.3.1/itpp/comm/hammcode.h000066400000000000000000000055601216575753400163550ustar00rootroot00000000000000/*! * \file * \brief Definitions of a Hamming code class * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef HAMMING_H #define HAMMING_H #include #include #include #include namespace itpp { /*! \ingroup fec \brief Binary Hamming codes */ class ITPP_EXPORT Hamming_Code : public Channel_Code { public: //! Constructor for \c hamming(n,k). n = pow(2,m)-1 and k = pow(2,m)-m-1. Hamming_Code(int m); //! Destructor virtual ~Hamming_Code() { } //! Hamming encoder. Will truncate some bits if not \a length = \c integer * \a k. virtual void encode(const bvec &uncoded_bits, bvec &coded_bits); //! Hamming encoder. Will truncate some bits if not \a length = \c integer * \a k. virtual bvec encode(const bvec &uncoded_bits); //! Hamming decoder. Will truncate some bits if not \a length = \c integer * \a n. virtual void decode(const bvec &coded_bits, bvec &decoded_bits); //! Hamming decoder. Will truncate some bits if not \a length = \c integer * \a n. virtual bvec decode(const bvec &coded_bits); // Soft-decision decoding is not implemented virtual void decode(const vec &received_signal, bvec &output); virtual bvec decode(const vec &received_signal); //! Get the code rate virtual double get_rate() const { return static_cast(k) / n; }; //! Gets the code length \a n. int get_n() const { return n; }; //! Gets the number of information bits per code word, \a k. int get_k() const { return k; }; //! Gets the parity check matrix for the code. bmat get_H() const { return H; }; //! Gets the generator matrix for the code. bmat get_G() const { return G; }; private: int n, k; bmat H, G; void generate_H(void); void generate_G(void); }; } // namespace itpp #endif // #ifndef HAMMING_H itpp-4.3.1/itpp/comm/interleave.cpp000066400000000000000000000042361216575753400172700ustar00rootroot00000000000000/*! * \file * \brief Implementation of interleaver classes * \author Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- template class ITPP_EXPORT Block_Interleaver; template class ITPP_EXPORT Block_Interleaver; template class ITPP_EXPORT Block_Interleaver; template class ITPP_EXPORT Block_Interleaver >; template class ITPP_EXPORT Block_Interleaver; template class ITPP_EXPORT Cross_Interleaver; template class ITPP_EXPORT Cross_Interleaver; template class ITPP_EXPORT Cross_Interleaver; template class ITPP_EXPORT Cross_Interleaver >; template class ITPP_EXPORT Cross_Interleaver; template class ITPP_EXPORT Sequence_Interleaver; template class ITPP_EXPORT Sequence_Interleaver; template class ITPP_EXPORT Sequence_Interleaver; template class ITPP_EXPORT Sequence_Interleaver >; template class ITPP_EXPORT Sequence_Interleaver; //! \endcond } // namespace itpp itpp-4.3.1/itpp/comm/interleave.h000066400000000000000000000436401216575753400167370ustar00rootroot00000000000000/*! * \file * \brief Definitions of interleaver classes * \author Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef INTERLEAVE_H #define INTERLEAVE_H #include #include #include #include #include namespace itpp { /*! \addtogroup interl */ /*! \ingroup interl \class Block_Interleaver comm/interleave.h \brief Block Interleaver Class. Data is written row-wise and read column-wise when interleaving.

    Example of use:

    \code BPSK bpsk; bvec bits = "0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1"; vec symbols = bpsk.modulate_bits(bits); Block_Interleaver block_interleaver(4,4); vec interleaved_symbols = block_interleaver.interleave(symbols); \endcode */ template class Block_Interleaver { public: //! Block_Interleaver constructor Block_Interleaver(void) {rows = 0; cols = 0;}; //! Block_Interleaver constructor Block_Interleaver(int in_rows, int in_cols); //! Function for block interleaving. May add some zeros. Vec interleave(const Vec &input); //! Function for block interleaving. May add some zeros. void interleave(const Vec &input, Vec &output); //! Function for block deinterleaving. Removes additional zeros if \a keepzeros = 0. Vec deinterleave(const Vec &input, short keepzeros = 0); //! Function for block deinterleaving. Removes additional zeros if \a keepzeros = 0. void deinterleave(const Vec &input, Vec &output, short keepzeros = 0); //! Set the number of \a rows for block interleaving void set_rows(int in_rows) {rows = in_rows;}; //! Set the number of \a columns for block interleaving void set_cols(int in_cols) {cols = in_cols;}; //! Get the number of \a rows for block interleaving int get_rows(void) {return rows;}; //! Get the number of \a columns for block interleaving int get_cols(void) {return cols;}; private: int rows, cols, input_length; }; /*! \ingroup interl \class Cross_Interleaver comm/interleave.h \brief Cross Interleaver Class.

    Example of use:

    \code BPSK bpsk; bvec bits = "0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1"; vec symbols = bpsk.modulate_bits(bits); Cross_Interleaver cross_interleaver(4); vec interleaved_symbols = cross_interleaver.interleave(symbols); \endcode
    • See S. B. Wicker, "Error control systems for digital communications and storage," Prentice Hall 1995, p. 427 for details.
    */ template class Cross_Interleaver { public: //! Cross_Interleaver constructor Cross_Interleaver(void) {order = 0;}; //! Cross_Interleaver constructor Cross_Interleaver(int in_order); //! Function for cross interleaving. Adds some zeros. Vec interleave(const Vec &input); //! Function for cross interleaving. Adds some zeros. void interleave(const Vec &input, Vec &output); //! Function for cross deinterleaving. Removes aditional zeros if \a keepzeros = 0. Vec deinterleave(const Vec &input, short keepzeros = 0); //! Function for cross deinterleaving. Removes aditional zeros if \a keepzeros = 0. void deinterleave(const Vec &input, Vec &output, short keepzeros = 0); //! Set the \a order of the Cross Interleaver void set_order(int in_order); //! Get the \a order of the Cross Interleaver int get_order(void) {return order;}; private: int order; int input_length; Mat inter_matrix; Vec tempvec, zerostemp; }; /*! \ingroup interl \class Sequence_Interleaver comm/interleave.h \brief Sequence Interleaver Class

    Example of use:

    \code BPSK bpsk; bvec bits = "0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1"; vec symbols = bpsk.modulate_bits(bits); Sequence_Interleaver sequence_interleaver(16); sequence_interleaver.randomize_interleaver_sequence(); vec interleaved_symbols = sequence_snterleaver.interleave(symbols); \endcode */ template class Sequence_Interleaver { public: //! Sequence_Interleaver constructor. Sequence_Interleaver(void) {interleaver_depth = 0;}; /*! \brief Sequence_Interleaver constructor. Chooses a random sequence of length \a in_interleaver_depth for interleaving. */ Sequence_Interleaver(int in_interleaver_depth); /*! \brief Sequence_Interleaver constructor. Uses the \a in_interleaver_sequence for interleaving. */ Sequence_Interleaver(ivec in_interleaver_sequence); //! Function for sequence interleaving. May add some zeros. Vec interleave(const Vec &input); //! Function for sequence interleaving. May add some zeros. void interleave(const Vec &input, Vec &output); //! Function for sequence deinterleaving. Removes additional zeros if \a keepzeros = 0. Vec deinterleave(const Vec &input, short keepzeros = 0); //! Function for sequence deinterleaving. Removes additional zeros if \a keepzeros = 0. void deinterleave(const Vec &input, Vec &output, short keepzeros = 0); //! Generate a new random sequence for interleaving. void randomize_interleaver_sequence(); //! Returns the interleaver sequence presently used. ivec get_interleaver_sequence(); //! Set the interleaver sequence to be used. void set_interleaver_sequence(ivec in_interleaver_sequence); //! Set the length of the interleaver sequence to be used. void set_interleaver_depth(int in_interleaver_depth) { interleaver_depth = in_interleaver_depth; }; //! Get the length of the interleaver sequence presently used. int get_interleaver_depth(void) { return interleaver_depth; }; private: ivec interleaver_sequence; int interleaver_depth, input_length; }; //----------------------------------------------------------------------------- // Implementation of templated members starts here //----------------------------------------------------------------------------- //-------------------------- Block Interleaver --------------------------------- template Block_Interleaver::Block_Interleaver(int in_rows, int in_cols) { rows = in_rows; cols = in_cols; input_length = 0; } template void Block_Interleaver::interleave(const Vec &input, Vec &output) { input_length = input.length(); int steps = (int)std::ceil(double(input_length) / double(rows * cols)); int output_length = steps * rows * cols; output.set_length(output_length, false); int s, r, c; if (input_length == output_length) { //Block interleaver loop: All steps. for (s = 0; s < steps; s++) { for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { output(s*rows*cols + r*cols + c) = input(s * rows * cols + c * rows + r); } } } } else { //Block interleaver loop: All, but the last, steps. for (s = 0; s < steps - 1; s++) { for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { output(s*rows*cols + r*cols + c) = input(s * rows * cols + c * rows + r); } } } //The last step. Vec zerovect(output_length - input_length); zerovect.clear(); Vec temp_last_input = concat(input.right(rows * cols - zerovect.length()), zerovect); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { output((steps - 1)*rows*cols + r*cols + c) = temp_last_input(c * rows + r); } } } } template Vec Block_Interleaver::interleave(const Vec &input) { Vec output; interleave(input, output); return output; } template void Block_Interleaver::deinterleave(const Vec &input, Vec &output, short keepzeros) { int thisinput_length = input.length(); int steps = (int)std::ceil(double(thisinput_length) / double(rows * cols)); int output_length = steps * rows * cols; output.set_size(output_length, false); int s, r, c; if (thisinput_length == output_length) { //Block deinterleaver loop: All, but the last, steps. for (s = 0; s < steps; s++) { for (r = 0; r < rows; r++) { for (c = 0; c < cols; c++) { output(s*rows*cols + c*rows + r) = input(s * rows * cols + r * cols + c); } } } } else { //Block deinterleaver loop: All, but the last, steps. for (s = 0; s < steps - 1; s++) { for (r = 0; r < rows; r++) { for (c = 0; c < cols; c++) { output(s*rows*cols + c*rows + r) = input(s * rows * cols + r * cols + c); } } } //The last step. Vec zerovect(output_length - thisinput_length); zerovect.clear(); Vec temp_last_input = concat(input.right(rows * cols - zerovect.length()), zerovect); for (r = 0; r < rows; r++) { for (c = 0; c < cols; c++) { output((steps - 1)*rows*cols + c*rows + r) = temp_last_input(r * cols + c); } } } if (keepzeros == 0) output.set_size(input_length, true); } template Vec Block_Interleaver::deinterleave(const Vec &input, short keepzeros) { Vec output; deinterleave(input, output, keepzeros); return output; } //---------------------------- Cross Interleaver --------------------------- template Cross_Interleaver::Cross_Interleaver(int in_order) { order = in_order; input_length = 0; inter_matrix.set_size(order, order, false); tempvec.set_size(order, false); zerostemp.set_size(order, false); } template void Cross_Interleaver::interleave(const Vec &input, Vec &output) { input_length = input.length(); int steps = (int)std::ceil(float(input_length) / order) + order; int output_length = steps * order; output.set_length(output_length, false); int i, r, c; inter_matrix.clear(); zerostemp.clear(); //Cross interleaver loop: for (i = 0; i < steps; i++) { //Shift the matrix to the right: for (c = order - 1; c > 0; c--) inter_matrix.set_col(c, inter_matrix.get_col(c - 1)); // Write the new data to the matrix if ((i*order + order) < input_length) tempvec = input.mid(i * order, order); else if ((i*order) < input_length) tempvec = concat(input.right(input_length - i * order), zerostemp.left(order - (input_length - i * order))); else tempvec.clear(); inter_matrix.set_col(0, tempvec); //Read the matrix diagonal-wise: for (r = 0; r < order; r++) output(i*order + r) = inter_matrix(r, r); } } template Vec Cross_Interleaver::interleave(const Vec &input) { Vec output; interleave(input, output); return output; } template void Cross_Interleaver::deinterleave(const Vec &input, Vec &output, short keepzeros) { int thisinput_length = input.length(); int steps = (int)std::ceil(float(thisinput_length) / order) + order; int output_length = steps * order; output.set_size(output_length, false); int i, r, c; inter_matrix.clear(); zerostemp.clear(); //Cross interleaver loop: for (i = 0; i < steps; i++) { //Shift the matrix to the right: for (c = order - 1; c > 0; c--) inter_matrix.set_col(c, inter_matrix.get_col(c - 1)); // Write the new data to the matrix if ((i*order + order) < thisinput_length) tempvec = input.mid(i * order, order); else if ((i*order) < thisinput_length) tempvec = concat(input.right(thisinput_length - i * order), zerostemp.left(order - (thisinput_length - i * order))); else tempvec.clear(); inter_matrix.set_col(0, tempvec); //Read the matrix diagonal-wise: for (r = 0; r < order; r++) output(i*order + r) = inter_matrix(r, order - 1 - r); } if (keepzeros == 0) output = output.mid(round_i(std::pow(double(order), 2)) - order, input_length); } template Vec Cross_Interleaver::deinterleave(const Vec &input, short keepzeros) { Vec output; deinterleave(input, output, keepzeros); return output; } template void Cross_Interleaver::set_order(int in_order) { order = in_order; input_length = 0; inter_matrix.set_size(order, order, false); tempvec.set_size(order, false); zerostemp.set_size(order, false); } //------------------- Sequence Interleaver -------------------------------- template Sequence_Interleaver::Sequence_Interleaver(int in_interleaver_depth) { interleaver_depth = in_interleaver_depth; interleaver_sequence = sort_index(randu(in_interleaver_depth)); input_length = 0; } template Sequence_Interleaver::Sequence_Interleaver(ivec in_interleaver_sequence) { interleaver_depth = in_interleaver_sequence.length(); interleaver_sequence = in_interleaver_sequence; input_length = 0; } template void Sequence_Interleaver::interleave(const Vec &input, Vec &output) { input_length = input.length(); int steps = (int)std::ceil(double(input_length) / double(interleaver_depth)); int output_length = steps * interleaver_depth; output.set_size(output_length, false); int s, i; if (input_length == output_length) { //Sequence interleaver loop: All steps. for (s = 0; s < steps; s++) { for (i = 0; i < interleaver_depth; i++) { output(s*interleaver_depth + i) = input(s * interleaver_depth + interleaver_sequence(i)); } } } else { //Sequence interleaver loop: All, but the last, steps. for (s = 0; s < steps - 1; s++) { for (i = 0; i < interleaver_depth; i++) { output(s*interleaver_depth + i) = input(s * interleaver_depth + interleaver_sequence(i)); } } //The last step. Vec zerovect(output_length - input_length); zerovect.clear(); Vec temp_last_input = concat(input.right(interleaver_depth - zerovect.length()), zerovect); for (i = 0; i < interleaver_depth; i++) { output((steps - 1)*interleaver_depth + i) = temp_last_input(interleaver_sequence(i)); } } } template Vec Sequence_Interleaver::interleave(const Vec &input) { Vec output; interleave(input, output); return output; } template void Sequence_Interleaver::deinterleave(const Vec &input, Vec &output, short keepzeros) { int thisinput_length = input.length(); int steps = (int)std::ceil(double(thisinput_length) / double(interleaver_depth)); int output_length = steps * interleaver_depth; output.set_length(output_length, false); int s, i; if (thisinput_length == output_length) { //Sequence interleaver loop: All steps. for (s = 0; s < steps; s++) { for (i = 0; i < interleaver_depth; i++) { output(s*interleaver_depth + interleaver_sequence(i)) = input(s * interleaver_depth + i); } } } else { //Sequence interleaver loop: All, but the last, steps. for (s = 0; s < steps - 1; s++) { for (i = 0; i < interleaver_depth; i++) { output(s*interleaver_depth + interleaver_sequence(i)) = input(s * interleaver_depth + i); } } //The last step. Vec zerovect(output_length - thisinput_length); zerovect.clear(); Vec temp_last_input = concat(input.right(interleaver_depth - zerovect.length()), zerovect); for (i = 0; i < interleaver_depth; i++) { output((steps - 1)*interleaver_depth + interleaver_sequence(i)) = temp_last_input(i); } if (keepzeros == 0) output.set_size(input_length, true); } } template Vec Sequence_Interleaver::deinterleave(const Vec &input, short keepzeros) { Vec output; deinterleave(input, output, keepzeros); return output; } template void Sequence_Interleaver::randomize_interleaver_sequence() { interleaver_sequence = sort_index(randu(interleaver_depth)); } template ivec Sequence_Interleaver::get_interleaver_sequence() { return interleaver_sequence; } template void Sequence_Interleaver::set_interleaver_sequence(ivec in_interleaver_sequence) { interleaver_sequence = in_interleaver_sequence; interleaver_depth = interleaver_sequence.size(); } //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Block_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Block_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Block_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Block_Interleaver >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Block_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Cross_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Cross_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Cross_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Cross_Interleaver >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Cross_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sequence_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sequence_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sequence_Interleaver; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sequence_Interleaver >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Sequence_Interleaver; //! \endcond } // namespace itpp #endif // #ifndef INTERLEAVE_H itpp-4.3.1/itpp/comm/ldpc.cpp000066400000000000000000001471341216575753400160610ustar00rootroot00000000000000/*! * \file * \brief Implementation of Low-Density Parity Check (LDPC) codes * \author Erik G. Larsson, Mattias Andersson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { /*! * \brief Version of the binary file with generator and decoder data * * This has to be global since it is used in LDPC_Generator and LDPC_Code * classes */ static const int LDPC_binary_file_version = 2; // --------------------------------------------------------------------------- // LDPC_Parity // --------------------------------------------------------------------------- // public methods LDPC_Parity::LDPC_Parity(int nc, int nv): init_flag(false) { initialize(nc, nv); } LDPC_Parity::LDPC_Parity(const std::string& filename, const std::string& format): init_flag(false) { if (format == "alist") { load_alist(filename); } else { it_error("LDPC_Parity::LDPC_Parity(): Only 'alist' format is supported"); } } LDPC_Parity::LDPC_Parity(const GF2mat_sparse_alist &alist): init_flag(false) { import_alist(alist); } void LDPC_Parity::initialize(int nc, int nv) { ncheck = nc; nvar = nv; H = GF2mat_sparse(ncheck, nvar); Ht = GF2mat_sparse(nvar, ncheck); sumX1 = zeros_i(nvar); sumX2 = zeros_i(ncheck); init_flag = true; } void LDPC_Parity::set(int i, int j, bin x) { it_assert(init_flag, "LDPC_Parity::set(): Object not initialized"); it_assert_debug((i >= 0) && (i < ncheck), "LDPC_Parity::set(): Wrong index i"); it_assert_debug((j >= 0) && (j < nvar), "LDPC_Parity::set(): Wrong index j"); it_assert_debug(H(i, j) == Ht(j, i), "LDPC_Parity:set(): Internal error"); int diff = static_cast(x) - static_cast(H(i, j)); sumX1(j) += diff; sumX2(i) += diff; if (x == 1) { H.set(i, j, 1); Ht.set(j, i, 1); } else { H.clear_elem(i, j); Ht.clear_elem(j, i); } it_assert_debug(H(i, j) == x, "LDPC_Parity::set(): Internal error"); it_assert_debug(Ht(j, i) == x, "LDPC_Parity::set(): Internal error"); } void LDPC_Parity::display_stats() const { it_assert(init_flag, "LDPC_Parity::display_stats(): Object not initialized"); int cmax = max(sumX1); int vmax = max(sumX2); vec vdeg = zeros(cmax + 1); // number of variable nodes with n neighbours vec cdeg = zeros(vmax + 1); // number of check nodes with n neighbours for (int col = 0; col < nvar; col++) { vdeg(length(get_col(col).get_nz_indices()))++; it_assert(sumX1(col) == length(get_col(col).get_nz_indices()), "LDPC_Parity::display_stats(): Internal error"); } for (int row = 0; row < ncheck; row++) { cdeg(length(get_row(row).get_nz_indices()))++; it_assert(sumX2(row) == length(get_row(row).get_nz_indices()), "LDPC_Parity::display_stats(): Internal error"); } // from edge perspective // number of edges connected to vnodes of degree n vec vdegedge = elem_mult(vdeg, linspace(0, vdeg.length() - 1, vdeg.length())); // number of edges connected to cnodes of degree n vec cdegedge = elem_mult(cdeg, linspace(0, cdeg.length() - 1, cdeg.length())); int edges = sum(elem_mult(to_ivec(linspace(0, vdeg.length() - 1, vdeg.length())), to_ivec(vdeg))); it_info("--- LDPC parity check matrix ---"); it_info("Dimension [ncheck x nvar]: " << ncheck << " x " << nvar); it_info("Variable node degree distribution from node perspective:\n" << vdeg / nvar); it_info("Check node degree distribution from node perspective:\n" << cdeg / ncheck); it_info("Variable node degree distribution from edge perspective:\n" << vdegedge / edges); it_info("Check node degree distribution from edge perspective:\n" << cdegedge / edges); it_info("Rate: " << get_rate()); it_info("--------------------------------"); } void LDPC_Parity::load_alist(const std::string& alist_file) { import_alist(GF2mat_sparse_alist(alist_file)); } void LDPC_Parity::save_alist(const std::string& alist_file) const { GF2mat_sparse_alist alist = export_alist(); alist.write(alist_file); } void LDPC_Parity::import_alist(const GF2mat_sparse_alist& alist) { GF2mat_sparse X = alist.to_sparse(); initialize(X.rows(), X.cols()); // brute force copy from X to this for (int i = 0; i < ncheck; i++) { for (int j = 0; j < nvar; j++) { if (X(i, j)) { set(i, j, 1); } } } } GF2mat_sparse_alist LDPC_Parity::export_alist() const { it_assert(init_flag, "LDPC_Parity::export_alist(): Object not initialized"); GF2mat_sparse_alist alist; alist.from_sparse(H); return alist; } int LDPC_Parity::check_connectivity(int from_i, int from_j, int to_i, int to_j, int godir, int L) const { it_assert(init_flag, "LDPC_Parity::check_connectivity(): Object not initialized"); int i, j, result; if (L < 0) { // unable to reach coordinate with given L return (-3); } // check if reached destination if ((from_i == to_i) && (from_j == to_j) && (godir != 0)) { return L; } if (get(from_i, from_j) == 0) { // meaningless search return (-2); } if (L == 2) { // Treat this case separately for efficiency if (godir == 2) { // go horizontally if (get(from_i, to_j) == 1) { return 0; } } if (godir == 1) { // go vertically if (get(to_i, from_j) == 1) { return 0; } } return (-3); } if ((godir == 1) || (godir == 0)) { // go vertically ivec cj = get_col(from_j).get_nz_indices(); for (i = 0; i < length(cj); i++) { if (cj(i) != from_i) { result = check_connectivity(cj(i), from_j, to_i, to_j, 2, L - 1); if (result >= 0) { return (result); } } } } if (godir == 2) { // go horizontally ivec ri = get_row(from_i).get_nz_indices(); for (j = 0; j < length(ri); j++) { if (ri(j) != from_j) { result = check_connectivity(from_i, ri(j), to_i, to_j, 1, L - 1); if (result >= 0) { return (result); } } } } return (-1); }; int LDPC_Parity::check_for_cycles(int L) const { it_assert(init_flag, "LDPC_Parity::check_for_cycles(): Object not initialized"); // looking for odd length cycles does not make sense if ((L&1) == 1) { return (-1); } if (L == 0) { return (-4); } int cycles = 0; for (int i = 0; i < nvar; i++) { ivec ri = get_col(i).get_nz_indices(); for (int j = 0; j < length(ri); j++) { if (check_connectivity(ri(j), i, ri(j), i, 0, L) >= 0) { cycles++; } } } return cycles; }; // ivec LDPC_Parity::get_rowdegree() const // { // ivec rdeg = zeros_i(Nmax); // for (int i=0; i Ssmat; typedef Sparse_Vec Ssvec; Maxcyc -= 2; // Construct the adjacency matrix of the graph Ssmat G(ncheck + nvar, ncheck + nvar, 5); for (int j = 0; j < nvar; j++) { GF2vec_sparse col = get_col(j); for (int i = 0; i < col.nnz(); i++) { if (get(col.get_nz_index(i), j) == 1) { G.set(col.get_nz_index(i), j + ncheck, 1); G.set(ncheck + j, col.get_nz_index(i), 1); } } } Array Gpow(Maxcyc); Gpow(0).set_size(ncheck + nvar, ncheck + nvar, 1); Gpow(0).clear(); for (int i = 0; i < ncheck + nvar; i++) { Gpow(0).set(i, i, 1); } Gpow(1) = G; /* Main cycle elimination loop starts here. Note that G and all powers of G are symmetric matrices. This fact is exploited in the code. */ int r; int cycles_found = 0; int scl = Maxcyc; for (r = 4; r <= Maxcyc; r += 2) { // compute the next power of the adjacency matrix Gpow(r / 2) = Gpow(r / 2 - 1) * G; bool traverse_again; do { traverse_again = false; cycles_found = 0; it_info_debug("Starting new pass of cycle elimination, target girth " << (r + 2) << "..."); int pdone = 0; for (int j = 0; j < ncheck + nvar; j++) { // loop over elements of G for (int i = 0; i < ncheck + nvar; i++) { int ptemp = floor_i(100.0 * (i + j * (ncheck + nvar)) / ((nvar + ncheck) * (nvar + ncheck))); if (ptemp > pdone + 10) { it_info_debug(ptemp << "% done."); pdone = ptemp; } if (((Gpow(r / 2))(i, j) >= 2) && ((Gpow(r / 2 - 2))(i, j) == 0)) { // Found a cycle. cycles_found++; // choose k ivec tmpi = (elem_mult(Gpow(r / 2 - 1).get_col(i), G.get_col(j))).get_nz_indices(); // int k = tmpi(rand()%length(tmpi)); int k = tmpi(randi(0, length(tmpi) - 1)); it_assert_debug(G(j, k) == 1 && G(k, j) == 1, "LDPC_Parity_Unstructured::cycle_removal_MGW(): " "Internal error"); // determine candidate edges for an edge swap Ssvec rowjk = Gpow(r / 2) * (Gpow(r / 2 - 1).get_col(j) + Gpow(r / 2 - 1).get_col(k)); int p, l; ivec Ce_ind = sort_index(randu(nvar + ncheck)); // random order for (int s = 0; s < nvar + ncheck; s++) { l = Ce_ind(s); if (rowjk(l) != 0) { continue; } ivec colcandi = G.get_col(l).get_nz_indices(); if (length(colcandi) > 0) { // select a node p which is a member of Ce for (int u = 0; u < length(colcandi); u++) { p = colcandi(u); if (p != l) { if (rowjk(p) == 0) { goto found_candidate_vector; } } } } } continue; // go to the next entry (i,j) found_candidate_vector: // swap edges if (p >= ncheck) { int z = l; l = p; p = z; } if (j >= ncheck) { int z = k; k = j; j = z; } // Swap endpoints of edges (p,l) and (j,k) // cout << "(" << j << "," << k << ")<->(" // << p << "," << l << ") " ; // cout << "."; // cout.flush(); // Update the matrix it_assert_debug((get(j, k - ncheck) == 1) && (get(p, l - ncheck) == 1), "LDPC_Parity_Unstructured::cycle_removal_MGW(): " "Internal error"); set(j, k - ncheck, 0); set(p, l - ncheck, 0); it_assert_debug((get(j, l - ncheck) == 0) && (get(p, k - ncheck) == 0), "LDPC_Parity_Unstructured::cycle_removal_MGW(): " "Internal error"); set(j, l - ncheck, 1); set(p, k - ncheck, 1); // Update adjacency matrix it_assert_debug(G(p, l) == 1 && G(l, p) == 1 && G(j, k) == 1 && G(k, j) == 1, "G"); it_assert_debug(G(j, l) == 0 && G(l, j) == 0 && G(p, k) == 0 && G(k, p) == 0, "G"); // Delta is the update term to G Ssmat Delta(ncheck + nvar, ncheck + nvar, 2); Delta.set(j, k, -1); Delta.set(k, j, -1); Delta.set(p, l, -1); Delta.set(l, p, -1); Delta.set(j, l, 1); Delta.set(l, j, 1); Delta.set(p, k, 1); Delta.set(k, p, 1); // update G and its powers G = G + Delta; it_assert_debug(G(p, l) == 0 && G(l, p) == 0 && G(j, k) == 0 && G(k, j) == 0, "G"); it_assert_debug(G(j, l) == 1 && G(l, j) == 1 && G(p, k) == 1 && G(k, p) == 1, "G"); Gpow(1) = G; Gpow(2) = G * G; for (int z = 3; z <= r / 2; z++) { Gpow(z) = Gpow(z - 1) * G; } traverse_again = true; } // if G()... } // loop over i } // loop over j if ((!traverse_again) && (cycles_found > 0)) { // no point continue scl = r - 2; goto finished; } } while (cycles_found != 0); scl = r; // there were no cycles of length r; move on to next r it_info_debug("Achieved girth " << (scl + 2) << ". Proceeding to next level."); } // loop over r finished: int girth = scl + 2; // scl=length of smallest cycle it_info_debug("Cycle removal (MGW algoritm) finished. Graph girth: " << girth << ". Cycles remaining on next girth level: " << cycles_found); return girth; } void LDPC_Parity_Unstructured::generate_random_H(const ivec& C, const ivec& R, const ivec& cycopt) { // Method based on random permutation. Attempts to avoid placing new // edges so that cycles are created. More aggressive cycle avoidance // for degree-2 nodes. EGL January 2007. initialize(sum(R), sum(C)); // C, R: Target number of columns/rows with certain number of ones // compute number of edges int Ne = 0; for (int i = 0;i < C.length();i++) { for (int j = 0; j < C(i); j++) { for (int m = 0; m < i; m++) Ne++; } } // compute connectivity matrix ivec vcon(Ne); ivec ccon(Ne); ivec vd(nvar); ivec cd(ncheck); int k = 0; int l = 0; for (int i = 0;i < C.length();i++) { for (int j = 0; j < C(i); j++) { for (int m = 0; m < i; m++) { vcon(k) = l; vd(l) = i; k++; } l++; } } k = 0; l = 0; for (int i = 0;i < R.length();i++) { for (int j = 0; j < R(i); j++) { for (int m = 0; m < i; m++) { ccon(k) = l; cd(l) = i; k++; } l++; } } it_assert(k == Ne, "C/R mismatch"); // compute random permutations ivec ind = sort_index(randu(Ne)); ivec cp = sort_index(randu(nvar)); ivec rp = sort_index(randu(ncheck)); // set the girth goal for various variable node degrees ivec Laim = zeros_i(Nmax); for (int i = 0; i < length(cycopt); i++) { Laim(i + 2) = cycopt(i); } for (int i = length(cycopt); i < Nmax - 2; i++) { Laim(i + 2) = cycopt(length(cycopt) - 1); } it_info_debug("Running with Laim=" << Laim.left(25)); int failures = 0; const int Max_attempts = 100; const int apcl = 10; // attempts before reducing girth target for (int k = 0; k < Ne; k++) { const int el = Ne - k - 2; if (k % 250 == 0) { it_info_debug("Processing edge: " << k << " out of " << Ne << ". Variable node degree: " << vd(vcon(k)) << ". Girth target: " << Laim(vd(vcon(k))) << ". Accumulated failures: " << failures); } const int c = cp(vcon(k)); int L = Laim(vd(vcon(k))); int attempt = 0; while (true) { if (attempt > 0 && attempt % apcl == 0 && L >= 6) { L -= 2; }; int r = rp(ccon(ind(k))); if (get(r, c)) { // double edge // set(r,c,0); if (el > 0) { // int t=k+1+rand()%el; int t = k + 1 + randi(0, el - 1); int x = ind(t); ind(t) = ind(k); ind(k) = x; attempt++; if (attempt == Max_attempts) { failures++; break; } } else { // almost at the last edge break; } } else { set(r, c, 1); if (L > 0) { // attempt to avoid cycles if (check_connectivity(r, c, r, c, 0, L) >= 0) { // detected cycle set(r, c, 0); if (el > 0) { // make a swap in the index permutation // int t=k+1+rand()%el; int t = k + 1 + randi(0, el - 1); int x = ind(t); ind(t) = ind(k); ind(k) = x; attempt++; if (attempt == Max_attempts) { // give up failures++; set(r, c, 1); break; } } else { // no edges left set(r, c, 1); break; } } else { break; } } else { break; } } } } } void LDPC_Parity_Unstructured::compute_CR(const vec& var_deg, const vec& chk_deg, const int Nvar, ivec &C, ivec &R) { // compute the degree distributions from a node perspective vec Vi = linspace(1, length(var_deg), length(var_deg)); vec Ci = linspace(1, length(chk_deg), length(chk_deg)); // Compute number of cols with n 1's // C, R: Target number of columns/rows with certain number of ones C = to_ivec(round(Nvar * elem_div(var_deg, Vi) / sum(elem_div(var_deg, Vi)))); C = concat(0, C); int edges = sum(elem_mult(to_ivec(linspace(0, C.length() - 1, C.length())), C)); R = to_ivec(round(edges * elem_div(chk_deg, Ci))); R = concat(0, R); vec Ri = linspace(0, length(R) - 1, length(R)); vec Coli = linspace(0, length(C) - 1, length(C)); // trim to deal with inconsistencies due to rounding errors if (sum(C) != Nvar) { ivec ind = find(C == max(C)); C(ind(0)) = C(ind(0)) - (sum(C) - Nvar); } //the number of edges calculated from R must match the number of //edges calculated from C while (sum(elem_mult(to_vec(R), Ri)) != sum(elem_mult(to_vec(C), Coli))) { //we're only changing R, this is probably(?) better for irac codes if (sum(elem_mult(to_vec(R), Ri)) > sum(elem_mult(to_vec(C), Coli))) { //remove an edge from R ivec ind = find(R == max(R)); int old = R(ind(0)); R.set(ind(0), old - 1); old = R(ind(0) - 1); R.set(ind(0) - 1, old + 1); } else { ivec ind = find(R == max(R)); if (ind(0) == R.length() - 1) { R = concat(R, 0); Ri = linspace(0, length(R) - 1, length(R)); } int old = R(ind(0)); R.set(ind(0), old - 1); old = R(ind(0) + 1); R.set(ind(0) + 1, old + 1); } } C = concat(C, zeros_i(Nmax - length(C))); R = concat(R, zeros_i(Nmax - length(R))); it_info_debug("C=" << C << std::endl); it_info_debug("R=" << R << std::endl); } // ---------------------------------------------------------------------- // LDPC_Parity_Regular // ---------------------------------------------------------------------- LDPC_Parity_Regular::LDPC_Parity_Regular(int Nvar, int k, int l, const std::string& method, const ivec& options) { generate(Nvar, k, l, method, options); } void LDPC_Parity_Regular::generate(int Nvar, int k, int l, const std::string& method, const ivec& options) { vec var_deg = zeros(k); vec chk_deg = zeros(l); var_deg(k - 1) = 1; chk_deg(l - 1) = 1; ivec C, R; compute_CR(var_deg, chk_deg, Nvar, C, R); it_info_debug("sum(C)=" << sum(C) << " Nvar=" << Nvar); it_info_debug("sum(R)=" << sum(R) << " approximate target=" << round_i(Nvar * k / static_cast(l))); if (method == "rand") { generate_random_H(C, R, options); } else { it_error("not implemented"); }; } // ---------------------------------------------------------------------- // LDPC_Parity_Irregular // ---------------------------------------------------------------------- LDPC_Parity_Irregular::LDPC_Parity_Irregular(int Nvar, const vec& var_deg, const vec& chk_deg, const std::string& method, const ivec& options) { generate(Nvar, var_deg, chk_deg, method, options); } void LDPC_Parity_Irregular::generate(int Nvar, const vec& var_deg, const vec& chk_deg, const std::string& method, const ivec& options) { ivec C, R; compute_CR(var_deg, chk_deg, Nvar, C, R); if (method == "rand") { generate_random_H(C, R, options); } else { it_error("not implemented"); }; } // ---------------------------------------------------------------------- // BLDPC_Parity // ---------------------------------------------------------------------- BLDPC_Parity::BLDPC_Parity(const imat& base_matrix, int exp_factor) { expand_base(base_matrix, exp_factor); } BLDPC_Parity::BLDPC_Parity(const std::string& filename, int exp_factor) { load_base_matrix(filename); expand_base(H_b, exp_factor); } void BLDPC_Parity::expand_base(const imat& base_matrix, int exp_factor) { Z = exp_factor; H_b = base_matrix; H_b_valid = true; initialize(H_b.rows() * Z, H_b.cols() * Z); for (int r = 0; r < H_b.rows(); r++) { for (int c = 0; c < H_b.cols(); c++) { int rz = r * Z; int cz = c * Z; switch (H_b(r, c)) { case -1: break; case 0: for (int i = 0; i < Z; ++i) set(rz + i, cz + i, 1); break; default: for (int i = 0; i < Z; ++i) set(rz + i, cz + (i + H_b(r, c)) % Z, 1); break; } } } } int BLDPC_Parity::get_exp_factor() const { return Z; } imat BLDPC_Parity::get_base_matrix() const { return H_b; } void BLDPC_Parity::set_exp_factor(int exp_factor) { Z = exp_factor; if (H_b_valid) { expand_base(H_b, exp_factor); } else { calculate_base_matrix(); } } void BLDPC_Parity::load_base_matrix(const std::string& filename) { std::ifstream bm_file(filename.c_str()); it_assert(bm_file.is_open(), "BLDPC_Parity::load_base_matrix(): Could not " "open file \"" << filename << "\" for reading"); // delete old base matrix content H_b.set_size(0, 0); // parse text file content, row by row std::string line; int line_counter = 0; getline(bm_file, line); while (!bm_file.eof()) { line_counter++; std::stringstream ss(line); ivec row(0); while (ss.good()) { int val; ss >> val; row = concat(row, val); } if ((H_b.rows() == 0) || (row.size() == H_b.cols())) H_b.append_row(row); else it_warning("BLDPC_Parity::load_base_matrix(): Wrong size of " "a parsed row number " << line_counter); getline(bm_file, line); } bm_file.close(); // transpose parsed base matrix if necessary if (H_b.rows() > H_b.cols()) H_b = H_b.transpose(); H_b_valid = true; init_flag = false; } void BLDPC_Parity::save_base_matrix(const std::string& filename) const { it_assert(H_b_valid, "BLDPC_Parity::save_base_matrix(): Base matrix is " "not valid"); std::ofstream bm_file(filename.c_str()); it_assert(bm_file.is_open(), "BLDPC_Parity::save_base_matrix(): Could not " "open file \"" << filename << "\" for writing"); for (int r = 0; r < H_b.rows(); r++) { for (int c = 0; c < H_b.cols(); c++) { bm_file << std::setw(3) << H_b(r, c); } bm_file << "\n"; } bm_file.close(); } void BLDPC_Parity::calculate_base_matrix() { std::string error_str = "BLDPC_Parity::calculate_base_matrix(): " "Invalid BLDPC matrix. Cannot calculate base matrix from it."; int rows = H.rows() / Z; int cols = H.cols() / Z; it_assert((rows * Z == H.rows()) && (cols * Z == H.cols()), error_str); H_b.set_size(rows, cols); for (int r = 0; r < rows; ++r) { int rz = r * Z; for (int c = 0; c < cols; ++c) { int cz = c * Z; GF2mat_sparse H_Z = H.get_submatrix(rz, rz + Z - 1, cz, cz + Z - 1); if (H_Z.nnz() == 0) { H_b(r, c) = -1; } else if (H_Z.nnz() == Z) { // check for cyclic-shifted ZxZ matrix int shift = 0; while ((shift < Z) && (H_Z(0, shift) != 1)) ++shift; it_assert(shift < Z, error_str); for (int i = 1; i < Z; ++i) it_assert(H_Z(0, shift) == H_Z(i, (i + shift) % Z), error_str); H_b(r, c) = shift; } else { it_error(error_str); } } // for (int c = 0; c < cols; ++c) } // for (int r = 0; r < rows; ++r) it_info("Base matrix calculated"); H_b_valid = true; } // ---------------------------------------------------------------------- // LDPC_Generator_Systematic // ---------------------------------------------------------------------- LDPC_Generator_Systematic::LDPC_Generator_Systematic(LDPC_Parity* const H, bool natural_ordering, const ivec& ind): LDPC_Generator("systematic"), G() { ivec tmp; tmp = construct(H, natural_ordering, ind); } ivec LDPC_Generator_Systematic::construct(LDPC_Parity* const H, bool natural_ordering, const ivec& avoid_cols) { int nvar = H->get_nvar(); int ncheck = H->get_ncheck(); // create dense representation of parity check matrix GF2mat Hd(H->get_H()); // -- Determine initial column ordering -- ivec col_order(nvar); if (natural_ordering) { for (int i = 0; i < nvar; i++) { col_order(i) = i; } } else { // take the columns in random order, but the ones to avoid at last vec col_importance = randu(nvar); for (int i = 0; i < length(avoid_cols); i++) { col_importance(avoid_cols(i)) = (-col_importance(avoid_cols(i))); } col_order = sort_index(-col_importance); } ivec actual_ordering(nvar); // Now partition P as P=[P1 P2]. Then find G so [P1 P2][I G]'=0. // -- Create P1 and P2 -- GF2mat P1; //(ncheck,nvar-ncheck); // non-invertible part GF2mat P2; //(ncheck,ncheck); // invertible part it_info_debug("Computing a systematic generator matrix..."); int j1 = 0, j2 = 0; ivec perm; GF2mat T, U; for (int k = 0; k < nvar; k++) { it_error_if(j1 >= nvar - ncheck, "LDPC_Generator_Systematic::construct(): " "Unable to obtain enough independent columns."); bvec c = Hd.get_col(col_order(k)); if (j2 == 0) { // first column in P2 is number col_order(k) P2 = GF2mat(c); P2.T_fact(T, U, perm);/* return value not used */ actual_ordering(k) = nvar - ncheck; j2++; } else { if (j2 < ncheck) { if (P2.T_fact_update_addcol(T, U, perm, c)) { P2 = P2.concatenate_horizontal(c); actual_ordering(k) = nvar - ncheck + j2; j2++; continue; } } if (j1 == 0) { P1 = GF2mat(c); actual_ordering(k) = j1; } else { P1 = P1.concatenate_horizontal(c); actual_ordering(k) = j1; } j1++; } } it_info_debug("Rank of parity check matrix: " << j2); // -- Compute the systematic part of the generator matrix -- G = (P2.inverse() * P1).transpose(); // -- Permute the columns of the parity check matrix -- GF2mat P = P1.concatenate_horizontal(P2); *H = LDPC_Parity(ncheck, nvar); // brute force copy from P to H for (int i = 0; i < ncheck; i++) { for (int j = 0; j < nvar; j++) { if (P.get(i, j)) { H->set(i, j, 1); } } } // -- Check that the result was correct -- it_assert_debug((GF2mat(H->get_H()) * (gf2dense_eye(nvar - ncheck).concatenate_horizontal(G)).transpose()).is_zero(), "LDPC_Generator_Systematic::construct(): Incorrect generator matrix G"); G = G.transpose(); // store the generator matrix in transposed form it_info_debug("Systematic generator matrix computed."); mark_initialized(); return actual_ordering; } void LDPC_Generator_Systematic::save(const std::string& filename) const { it_file f(filename); int ver; f >> Name("Fileversion") >> ver; it_assert(ver == LDPC_binary_file_version, "LDPC_Generator_Systematic::save(): Unsupported file format"); f << Name("G_type") << get_type(); f << Name("G") << G; f.close(); } void LDPC_Generator_Systematic::load(const std::string& filename) { it_ifile f(filename); int ver; f >> Name("Fileversion") >> ver; it_assert(ver == LDPC_binary_file_version, "LDPC_Generator_Systematic::load(): Unsupported file format"); std::string gen_type; f >> Name("G_type") >> gen_type; it_assert(gen_type == get_type(), "LDPC_Generator_Systematic::load(): Wrong generator type"); f >> Name("G") >> G; f.close(); mark_initialized(); } void LDPC_Generator_Systematic::encode(const bvec &input, bvec &output) { it_assert(is_initialized(), "LDPC_Generator_Systematic::encode(): Systematic " "generator not set up"); it_assert(input.size() == G.cols(), "LDPC_Generator_Systematic::encode(): " "Improper input vector size (" << input.size() << " != " << G.cols() << ")"); output = concat(input, G * input); } // ---------------------------------------------------------------------- // BLDPC_Generator // ---------------------------------------------------------------------- BLDPC_Generator::BLDPC_Generator(const BLDPC_Parity* const H, const std::string type): LDPC_Generator(type), H_enc(), N(0), M(0), K(0), Z(0) { construct(H); } void BLDPC_Generator::encode(const bvec &input, bvec &output) { it_assert(is_initialized(), "BLDPC_Generator::encode(): Cannot encode with not " "initialized generator"); it_assert(input.size() == K, "BLDPC_Generator::encode(): Input vector " "length is not equal to K"); // copy systematic bits first output = input; output.set_size(N, true); // backward substitution to obtain the first Z parity check bits for (int k = 0; k < Z; k++) { for (int j = 0; j < K; j++) { output(K + k) += H_enc(M - 1 - k, j) * input(j); } for (int j = 0; j < k; j++) { output(K + k) += H_enc(M - 1 - k, K + j) * output(K + j); } } // forward substitution to obtain the next M-Z parity check bits for (int k = 0; k < M - Z; k++) { for (int j = 0; j < K; j++) { output(K + Z + k) += H_enc(k, j) * input(j); } for (int j = K; j < K + Z; j++) { output(K + Z + k) += H_enc(k, j) * output(j); } for (int j = K + Z; j < K + Z + k; j++) { output(K + Z + k) += H_enc(k, j) * output(j); } } } void BLDPC_Generator::construct(const BLDPC_Parity* const H) { if (H != 0 && H->is_valid()) { H_enc = H->get_H(); // sparse to dense conversion Z = H->get_exp_factor(); N = H_enc.cols(); M = H_enc.rows(); K = N - M; // ---------------------------------------------------------------------- // STEP 1 // ---------------------------------------------------------------------- // loop over last M-Z columns of matrix H for (int i = 0; i < M - Z; i += Z) { // loop over last Z rows of matrix H for (int j = 0; j < Z; j++) { // Gaussian elimination by adding particular rows H_enc.add_rows(M - 1 - j, M - Z - 1 - j - i); } } // ---------------------------------------------------------------------- // STEP 2 // ---------------------------------------------------------------------- // set first processed row index to M-Z int r1 = M - Z; // loop over columns with indexes K .. K+Z-1 for (int c1 = K + Z - 1; c1 >= K; c1--) { int r2 = r1; // find the first '1' in column c1 while (H_enc(r2, c1) == 0 && r2 < M - 1) r2++; // if necessary, swap rows r1 and r2 if (r2 != r1) H_enc.swap_rows(r1, r2); // look for the other '1' in column c1 and get rid of them for (r2 = r1 + 1; r2 < M; r2++) { if (H_enc(r2, c1) == 1) { // Gaussian elimination by adding particular rows H_enc.add_rows(r2, r1); } } // increase first processed row index r1++; } mark_initialized(); } } void BLDPC_Generator::save(const std::string& filename) const { it_assert(is_initialized(), "BLDPC_Generator::save(): Can not save not initialized generator"); // Every Z-th row of H_enc until M-Z GF2mat H_T(M / Z - 1, N); for (int i = 0; i < M / Z - 1; i++) { H_T.set_row(i, H_enc.get_row(i*Z)); } // Last Z preprocessed rows of H_enc GF2mat H_Z = H_enc.get_submatrix(M - Z, 0, M - 1, N - 1); it_file f(filename); int ver; f >> Name("Fileversion") >> ver; it_assert(ver == LDPC_binary_file_version, "BLDPC_Generator::save(): " "Unsupported file format"); f << Name("G_type") << get_type(); f << Name("H_T") << H_T; f << Name("H_Z") << H_Z; f << Name("Z") << Z; f.close(); } void BLDPC_Generator::load(const std::string& filename) { GF2mat H_T, H_Z; it_ifile f(filename); int ver; f >> Name("Fileversion") >> ver; it_assert(ver == LDPC_binary_file_version, "BLDPC_Generator::load(): " "Unsupported file format"); std::string gen_type; f >> Name("G_type") >> gen_type; it_assert(gen_type == get_type(), "BLDPC_Generator::load(): Wrong generator type"); f >> Name("H_T") >> H_T; f >> Name("H_Z") >> H_Z; f >> Name("Z") >> Z; f.close(); N = H_T.cols(); M = (H_T.rows() + 1) * Z; K = N - M; H_enc = GF2mat(M - Z, N); for (int i = 0; i < H_T.rows(); i++) { for (int j = 0; j < Z; j++) { for (int k = 0; k < N; k++) { if (H_T(i, (k / Z)*Z + (k + Z - j) % Z)) { H_enc.set(i*Z + j, k, 1); } } } } H_enc = H_enc.concatenate_vertical(H_Z); mark_initialized(); } // ---------------------------------------------------------------------- // LDPC_Code // ---------------------------------------------------------------------- LDPC_Code::LDPC_Code(): H_defined(false), G_defined(false), dec_method(new std::string), max_iters(50), psc(true), pisc(false), llrcalc(LLR_calc_unit()) { set_decoding_method("BP");} LDPC_Code::LDPC_Code(const LDPC_Parity* const H, LDPC_Generator* const G_in, bool perform_integrity_check): H_defined(false), G_defined(false), dec_method(new std::string), max_iters(50), psc(true), pisc(false), llrcalc(LLR_calc_unit()) { set_decoding_method("BP"); set_code(H, G_in, perform_integrity_check); } LDPC_Code::LDPC_Code(const std::string& filename, LDPC_Generator* const G_in): H_defined(false), G_defined(false), dec_method(new std::string), max_iters(50), psc(true), pisc(false), llrcalc(LLR_calc_unit()) { set_decoding_method("BP"); load_code(filename, G_in); } void LDPC_Code::set_code(const LDPC_Parity* const H, LDPC_Generator* const G_in, bool perform_integrity_check) { decoder_parameterization(H); setup_decoder(); G = G_in; if (G != 0) { G_defined = true; if (perform_integrity_check) { integrity_check(); } else { it_info_debug("LDPC_Code::set_code(): integrity check was not performed"); } } } void LDPC_Code::load_code(const std::string& filename, LDPC_Generator* const G_in) { it_info_debug("LDPC_Code::load_code(): Loading LDPC codec from " << filename); it_ifile f(filename); int ver; f >> Name("Fileversion") >> ver; it_assert(ver == LDPC_binary_file_version, "LDPC_Code::load_code(): " "Unsupported file format"); f >> Name("H_defined") >> H_defined; f >> Name("G_defined") >> G_defined; f >> Name("nvar") >> nvar; f >> Name("ncheck") >> ncheck; f >> Name("C") >> C; f >> Name("V") >> V; f >> Name("sumX1") >> sumX1; f >> Name("sumX2") >> sumX2; f >> Name("iind") >> iind; f >> Name("jind") >> jind; f.close(); // load generator data if (G_defined) { it_assert(G_in != 0, "LDPC_Code::load_code(): Generator object is " "missing. Can not load the generator data from a file."); G = G_in; G->load(filename); } else { G = 0; it_info_debug("LDPC_Code::load_code(): Generator data not loaded. " "Generator object will not be used."); } it_info_debug("LDPC_Code::load_code(): Successfully loaded LDPC codec " "from " << filename); setup_decoder(); } void LDPC_Code::save_code(const std::string& filename) const { it_assert(H_defined, "LDPC_Code::save_to_file(): There is no parity " "check matrix"); it_info_debug("LDPC_Code::save_to_file(): Saving LDPC codec to " << filename); it_file f; f.open(filename, true); f << Name("Fileversion") << LDPC_binary_file_version; f << Name("H_defined") << H_defined; f << Name("G_defined") << G_defined; f << Name("nvar") << nvar; f << Name("ncheck") << ncheck; f << Name("C") << C; f << Name("V") << V; f << Name("sumX1") << sumX1; f << Name("sumX2") << sumX2; f << Name("iind") << iind; f << Name("jind") << jind; f.close(); // save generator data; if (G_defined) G->save(filename); else it_info_debug("LDPC_Code::save_code(): Missing generator object - " "generator data not saved"); it_info_debug("LDPC_Code::save_code(): Successfully saved LDPC codec to " << filename); } void LDPC_Code::set_decoding_method(const std::string& method_in) { it_assert((method_in == "bp") || (method_in == "BP"), "LDPC_Code::set_decoding_method(): Not implemented decoding method"); *dec_method = method_in; } void LDPC_Code::set_exit_conditions(int max_iters_in, bool syndr_check_each_iter, bool syndr_check_at_start) { it_assert(max_iters >= 0, "LDPC_Code::set_nrof_iterations(): Maximum " "number of iterations can not be negative"); max_iters = max_iters_in; psc = syndr_check_each_iter; pisc = syndr_check_at_start; } void LDPC_Code::set_llrcalc(const LLR_calc_unit& llrcalc_in) { llrcalc = llrcalc_in; } void LDPC_Code::encode(const bvec &input, bvec &output) { it_assert(G_defined, "LDPC_Code::encode(): LDPC Generator is required " "for encoding"); G->encode(input, output); it_assert_debug(syndrome_check(output), "LDPC_Code::encode(): Syndrome " "check failed"); } bvec LDPC_Code::encode(const bvec &input) { bvec result; encode(input, result); return result; } void LDPC_Code::decode(const vec &llr_in, bvec &syst_bits) { QLLRvec qllrin = llrcalc.to_qllr(llr_in); QLLRvec qllrout; bp_decode(qllrin, qllrout); syst_bits = (qllrout.left(nvar - ncheck) < 0); } bvec LDPC_Code::decode(const vec &llr_in) { bvec syst_bits; decode(llr_in, syst_bits); return syst_bits; } void LDPC_Code::decode_soft_out(const vec &llr_in, vec &llr_out) { QLLRvec qllrin = llrcalc.to_qllr(llr_in); QLLRvec qllrout; bp_decode(qllrin, qllrout); llr_out = llrcalc.to_double(qllrout); } vec LDPC_Code::decode_soft_out(const vec &llr_in) { vec llr_out; decode_soft_out(llr_in, llr_out); return llr_out; } int LDPC_Code::bp_decode(const QLLRvec &LLRin, QLLRvec &LLRout) { // Note the IT++ convention that a sure zero corresponds to // LLR=+infinity it_assert(H_defined, "LDPC_Code::bp_decode(): Parity check matrix not " "defined"); it_assert((LLRin.size() == nvar) && (sumX1.size() == nvar) && (sumX2.size() == ncheck), "LDPC_Code::bp_decode(): Wrong " "input dimensions"); if (pisc && syndrome_check(LLRin)) { LLRout = LLRin; return 0; } LLRout.set_size(LLRin.size()); // allocate temporary variables used for the check node update ivec jj(max_cnd); QLLRvec m(max_cnd); QLLRvec ml(max_cnd); QLLRvec mr(max_cnd); // initial step for (int i = 0; i < nvar; i++) { int index = i; for (int j = 0; j < sumX1(i); j++) { mvc[index] = LLRin(i); index += nvar; } } bool is_valid_codeword = false; int iter = 0; do { iter++; if (nvar >= 100000) { it_info_no_endl_debug("."); } // --------- Step 1: check to variable nodes ---------- for (int j = 0; j < ncheck; j++) { // The check node update calculations are hardcoded for degrees // up to 6. For larger degrees, a general algorithm is used. switch (sumX2(j)) { case 0: it_error("LDPC_Code::bp_decode(): sumX2(j)=0"); case 1: it_error("LDPC_Code::bp_decode(): sumX2(j)=1"); case 2: { mcv[j+ncheck] = mvc[jind[j]]; mcv[j] = mvc[jind[j+ncheck]]; break; } case 3: { int j0 = j; QLLR m0 = mvc[jind[j0]]; int j1 = j0 + ncheck; QLLR m1 = mvc[jind[j1]]; int j2 = j1 + ncheck; QLLR m2 = mvc[jind[j2]]; mcv[j0] = llrcalc.Boxplus(m1, m2); mcv[j1] = llrcalc.Boxplus(m0, m2); mcv[j2] = llrcalc.Boxplus(m0, m1); break; } case 4: { int j0 = j; QLLR m0 = mvc[jind[j0]]; int j1 = j0 + ncheck; QLLR m1 = mvc[jind[j1]]; int j2 = j1 + ncheck; QLLR m2 = mvc[jind[j2]]; int j3 = j2 + ncheck; QLLR m3 = mvc[jind[j3]]; QLLR m01 = llrcalc.Boxplus(m0, m1); QLLR m23 = llrcalc.Boxplus(m2, m3); mcv[j0] = llrcalc.Boxplus(m1, m23); mcv[j1] = llrcalc.Boxplus(m0, m23); mcv[j2] = llrcalc.Boxplus(m01, m3); mcv[j3] = llrcalc.Boxplus(m01, m2); break; } case 5: { int j0 = j; QLLR m0 = mvc[jind[j0]]; int j1 = j0 + ncheck; QLLR m1 = mvc[jind[j1]]; int j2 = j1 + ncheck; QLLR m2 = mvc[jind[j2]]; int j3 = j2 + ncheck; QLLR m3 = mvc[jind[j3]]; int j4 = j3 + ncheck; QLLR m4 = mvc[jind[j4]]; QLLR m01 = llrcalc.Boxplus(m0, m1); QLLR m02 = llrcalc.Boxplus(m01, m2); QLLR m34 = llrcalc.Boxplus(m3, m4); QLLR m24 = llrcalc.Boxplus(m2, m34); mcv[j0] = llrcalc.Boxplus(m1, m24); mcv[j1] = llrcalc.Boxplus(m0, m24); mcv[j2] = llrcalc.Boxplus(m01, m34); mcv[j3] = llrcalc.Boxplus(m02, m4); mcv[j4] = llrcalc.Boxplus(m02, m3); break; } case 6: { int j0 = j; QLLR m0 = mvc[jind[j0]]; int j1 = j0 + ncheck; QLLR m1 = mvc[jind[j1]]; int j2 = j1 + ncheck; QLLR m2 = mvc[jind[j2]]; int j3 = j2 + ncheck; QLLR m3 = mvc[jind[j3]]; int j4 = j3 + ncheck; QLLR m4 = mvc[jind[j4]]; int j5 = j4 + ncheck; QLLR m5 = mvc[jind[j5]]; QLLR m01 = llrcalc.Boxplus(m0, m1); QLLR m23 = llrcalc.Boxplus(m2, m3); QLLR m45 = llrcalc.Boxplus(m4, m5); QLLR m03 = llrcalc.Boxplus(m01, m23); QLLR m25 = llrcalc.Boxplus(m23, m45); QLLR m0145 = llrcalc.Boxplus(m01, m45); mcv[j0] = llrcalc.Boxplus(m1, m25); mcv[j1] = llrcalc.Boxplus(m0, m25); mcv[j2] = llrcalc.Boxplus(m0145, m3); mcv[j3] = llrcalc.Boxplus(m0145, m2); mcv[j4] = llrcalc.Boxplus(m03, m5); mcv[j5] = llrcalc.Boxplus(m03, m4); break; } default: { int nodes = sumX2(j); if( nodes > max_cnd ) { std::ostringstream m_sout; m_sout << "check node degrees >" << max_cnd << " not supported in this version"; it_error( m_sout.str() ); } nodes--; jj[0] = j; m[0] = mvc[jind[jj[0]]]; for(int i = 1; i <= nodes; i++ ) { jj[i] = jj[i-1] + ncheck; m[i] = mvc[jind[jj[i]]]; } // compute partial sums from the left and from the right ml[0] = m[0]; mr[0] = m[nodes]; for(int i = 1; i < nodes; i++ ) { ml[i] = llrcalc.Boxplus( ml[i-1], m[i] ); mr[i] = llrcalc.Boxplus( mr[i-1], m[nodes-i] ); } // merge partial sums mcv[jj[0]] = mr[nodes-1]; mcv[jj[nodes]] = ml[nodes-1]; for(int i = 1; i < nodes; i++ ) mcv[jj[i]] = llrcalc.Boxplus( ml[i-1], mr[nodes-1-i] ); } } // switch statement } // step 2: variable to check nodes for (int i = 0; i < nvar; i++) { switch (sumX1(i)) { case 0: it_error("LDPC_Code::bp_decode(): sumX1(i)=0"); case 1: { /* This case is rare but apparently occurs for codes used in the DVB-T2 standard. */ QLLR m0 = mcv[iind[i]]; mvc[i] = LLRin(i); LLRout(i) = LLRin(i) + m0; break; } case 2: { QLLR m0 = mcv[iind[i]]; int i1 = i + nvar; QLLR m1 = mcv[iind[i1]]; mvc[i] = LLRin(i) + m1; mvc[i1] = LLRin(i) + m0; LLRout(i) = mvc[i1] + m1; break; } case 3: { int i0 = i; QLLR m0 = mcv[iind[i0]]; int i1 = i0 + nvar; QLLR m1 = mcv[iind[i1]]; int i2 = i1 + nvar; QLLR m2 = mcv[iind[i2]]; LLRout(i) = LLRin(i) + m0 + m1 + m2; mvc[i0] = LLRout(i) - m0; mvc[i1] = LLRout(i) - m1; mvc[i2] = LLRout(i) - m2; break; } case 4: { int i0 = i; QLLR m0 = mcv[iind[i0]]; int i1 = i0 + nvar; QLLR m1 = mcv[iind[i1]]; int i2 = i1 + nvar; QLLR m2 = mcv[iind[i2]]; int i3 = i2 + nvar; QLLR m3 = mcv[iind[i3]]; LLRout(i) = LLRin(i) + m0 + m1 + m2 + m3; mvc[i0] = LLRout(i) - m0; mvc[i1] = LLRout(i) - m1; mvc[i2] = LLRout(i) - m2; mvc[i3] = LLRout(i) - m3; break; } default: { // differential update QLLR mvc_temp = LLRin(i); int index_iind = i; // tracks i+jp*nvar for (int jp = 0; jp < sumX1(i); jp++) { mvc_temp += mcv[iind[index_iind]]; index_iind += nvar; } LLRout(i) = mvc_temp; index_iind = i; // tracks i+j*nvar for (int j = 0; j < sumX1[i]; j++) { mvc[index_iind] = mvc_temp - mcv[iind[index_iind]]; index_iind += nvar; } } } } if (psc && syndrome_check(LLRout)) { is_valid_codeword = true; break; } } while (iter < max_iters); if (nvar >= 100000) { it_info_debug(""); } return (is_valid_codeword ? iter : -iter); } bool LDPC_Code::syndrome_check(const bvec &x) const { QLLRvec llr = 1 - 2 * to_ivec(x); return syndrome_check(llr); } bool LDPC_Code::syndrome_check(const QLLRvec &LLR) const { // Please note the IT++ convention that a sure zero corresponds to // LLR=+infinity int i, j, synd, vi; for (j = 0; j < ncheck; j++) { synd = 0; int vind = j; // tracks j+i*ncheck for (i = 0; i < sumX2(j); i++) { vi = V(vind); if (LLR(vi) < 0) { synd++; } vind += ncheck; } if ((synd&1) == 1) { return false; // codeword is invalid } } return true; // codeword is valid }; QLLRvec LDPC_Code::soft_syndrome_check(const QLLRvec &LLR) const { QLLRvec result(ncheck); int i,j,vi,vind; for (j=0; jsumX1; sumX2 = Hmat->sumX2; nvar = Hmat->nvar; //get_nvar(); ncheck = Hmat->ncheck; //get_ncheck(); int cmax = max(sumX1); int vmax = max(sumX2); // decoder parameterization V = zeros_i(ncheck * vmax); C = zeros_i(cmax * nvar); jind = zeros_i(ncheck * vmax); iind = zeros_i(nvar * cmax); it_info_debug("LDPC_Code::decoder_parameterization(): Computations " "- phase 1"); for (int i = 0; i < nvar; i++) { ivec coli = Hmat->get_col(i).get_nz_indices(); for (int j0 = 0; j0 < length(coli); j0++) { C(j0 + cmax*i) = coli(j0); } } it_info_debug("LDPC_Code::decoder_parameterization(): Computations " "- phase 2"); it_info_debug("Computing decoder parameterization. Phase 2"); for (int j = 0; j < ncheck; j++) { ivec rowj = Hmat->get_row(j).get_nz_indices(); for (int i0 = 0; i0 < length(rowj); i0++) { V(j + ncheck*i0) = rowj(i0); } } it_info_debug("LDPC_Code::decoder_parameterization(): Computations " "- phase 3"); it_info_debug("Computing decoder parameterization. Phase 3."); for (int j = 0; j < ncheck; j++) { for (int ip = 0; ip < sumX2(j); ip++) { int vip = V(j + ip * ncheck); int k = 0; while (1 == 1) { if (C(k + vip*cmax) == j) { break; } k++; } jind(j + ip*ncheck) = vip + k * nvar; } } it_info_debug("LDPC_Code::decoder_parameterization(): Computations " "- phase 4"); for (int i = 0; i < nvar; i++) { for (int jp = 0; jp < sumX1(i); jp++) { int cjp = C(jp + i * cmax); int k = 0; while (1 == 1) { if (V(cjp + k*ncheck) == i) {break; } k++; } iind(i + jp*nvar) = cjp + k * ncheck; } } H_defined = true; } void LDPC_Code::setup_decoder() { if (H_defined) { mcv.set_size(max(sumX2) * ncheck); mvc.set_size(max(sumX1) * nvar); } } void LDPC_Code::integrity_check() { if (G_defined) { it_info_debug("LDPC_Code::integrity_check(): Checking integrity of " "the LDPC_Parity and LDPC_Generator data"); bvec bv(nvar - ncheck), cw; bv.clear(); bv(0) = 1; for (int i = 0; i < nvar - ncheck; i++) { G->encode(bv, cw); it_assert(syndrome_check(cw), "LDPC_Code::integrity_check(): Syndrome check failed"); bv.shift_right(bv(nvar - ncheck - 1)); } } else { it_info_debug("LDPC_Code::integrity_check(): No generator defined " "- no check performed"); } } // ---------------------------------------------------------------------- // Related functions // ---------------------------------------------------------------------- std::ostream &operator<<(std::ostream &os, const LDPC_Code &C) { ivec rdeg = zeros_i(max(C.sumX2) + 1); for (int i = 0; i < C.ncheck; i++) { rdeg(C.sumX2(i))++; } ivec cdeg = zeros_i(max(C.sumX1) + 1); for (int j = 0; j < C.nvar; j++) { cdeg(C.sumX1(j))++; } os << "--- LDPC codec ----------------------------------\n" << "Nvar : " << C.get_nvar() << "\n" << "Ncheck : " << C.get_ncheck() << "\n" << "Rate : " << C.get_rate() << "\n" << "Column degrees (node perspective): " << cdeg << "\n" << "Row degrees (node perspective): " << rdeg << "\n" << "-------------------------------------------------\n" << "Decoder parameters:\n" << " - method : " << C.get_decoding_method() << "\n" << " - max. iterations : " << C.max_iters << "\n" << " - syndrome check at each iteration : " << C.psc << "\n" << " - syndrome check at start : " << C.pisc << "\n" << "-------------------------------------------------\n" << C.llrcalc << "\n"; return os; } } // namespace itpp itpp-4.3.1/itpp/comm/ldpc.h000066400000000000000000001052731216575753400155240ustar00rootroot00000000000000/*! * \file * \brief Implementation of Low-Density Parity Check (LDPC) codes * \author Erik G. Larsson, Mattias Andersson, Adam Piatyszek and Gorka Prieto * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef LDPC_H #define LDPC_H #include #include #include #include #include #include #include namespace itpp { // --------------------------------------------------------------------------- // LDPC_Parity // --------------------------------------------------------------------------- /*! \brief LDPC parity check matrix generic class This class provides a basic set of functions needed to represent a parity check matrix, which defines an LDPC code. This class is used as base class for a set of specific LDPC parity check matrix classes, e.g. regular or irregular LDPC codes. This class stores a parity check matrix as a sparse matrix. The transpose of the matrix is also stored to enable efficient access to its rows. All parity check matrices can be loaded from (saved to) a file by converting them from (to) a portable \c GF2mat_sparse_alist format. However, typically one will want to create a \c LDPC_Code from the parity check matrix (and optionally a generator) and save the codec binary data instead. Please refer to the tutorial \ref ldpc_gen_codes for some examples of code generation. \author Erik G. Larsson, Mattias Andersson and Adam Piatyszek */ class ITPP_EXPORT LDPC_Parity { friend class LDPC_Code; public: //! Default constructor LDPC_Parity(): init_flag(false) {} //! Constructor that gives an empty matrix of size ncheck x nvar LDPC_Parity(int ncheck, int nvar); /*! \brief Load an LDPC parity check matrix from a file \param filename file name \param format file format \note Currently, only "alist" format is supported (see \c GF2mat_sparse_alist for its definition). \sa \c load_alist() and \c save_alist() */ LDPC_Parity(const std::string& filename, const std::string& format); //! Constructor, from a \c GF2mat_sparse_alist object LDPC_Parity(const GF2mat_sparse_alist& alist); //! Virtual destructor virtual ~LDPC_Parity() {} //! Initialize an empty matrix of size ncheck x nvar void initialize(int ncheck, int nvar); //! Get the parity check matrix, optionally its transposed form GF2mat_sparse get_H(bool transpose = false) const { return (transpose ? Ht : H); } //! Get a specific column from the matrix Sparse_Vec get_col(int c) const { return H.get_col(c); } //! Get a specific row from the matrix Sparse_Vec get_row(int r) const { return Ht.get_col(r); } //! Get the number of variable nodes (number of columns) int get_nvar() const { it_assert_debug(H.cols() == nvar, "LDPC_Parity::get_nvar(): Internal error"); it_assert_debug(Ht.rows() == nvar, "LDPC_Parity::get_nvar(): Internal error"); return nvar; } //! Get the number of check nodes (number of rows) int get_ncheck() const { it_assert_debug(H.rows() == ncheck, "LDPC_Parity::get_ncheck(): Internal error"); it_assert_debug(Ht.cols() == ncheck, "LDPC_Parity::get_ncheck(): Internal error"); return ncheck; } //! Set element (i,j) of the parity check matrix to value void set(int i, int j, bin value); //! Get element (i,j) of the parity check matrix bin get(int i, int j) const { it_assert_debug(H(i, j) == Ht(j, i), "LDPC_Parity::get(): Internal error"); return H(i, j); } //! Get element (i,j) of the parity check matrix bin operator()(int i, int j) const { it_assert_debug(H(i, j) == Ht(j, i), "LDPC_Parity::operator(): Internal error"); return H(i, j); } //! Display some information about the matrix virtual void display_stats() const; //! Get the code rate double get_rate() const { return (1.0 - static_cast(ncheck) / nvar); } //! Import matrix from \c GF2mat_sparse_alist format void import_alist(const GF2mat_sparse_alist& H_alist); //! Export matrix to \c GF2mat_sparse_alist format GF2mat_sparse_alist export_alist() const; //! Load matrix from \c alist_file text file in alist format void load_alist(const std::string& alist_file); //! Save matrix to \c alist_file text file in alist format void save_alist(const std::string& alist_file) const; protected: //! Flag that indicates proper initialization bool init_flag; //! Maximum node degree class can handle static const int Nmax = 200; //! The parity check matrix GF2mat_sparse H; //! The transposed parity check matrix GF2mat_sparse Ht; //! Number of variable nodes int nvar; //! Number of check nodes int ncheck; //! Actual number of ones in each column ivec sumX1; //! Actual number of ones in each row ivec sumX2; /*! \brief Check for cycles of length L This function implements a recursive routine to find loops. The function is mainly a tool for testing and debugging more sophisticated functions for graph manipulation. \param L length of cycles to look for \return The function returns the number of cycles found of length L or shorter. Cycles may be counted multiple times. \note This function can be very slow for large matrices. It is mainly intended as a debugging aid. */ int check_for_cycles(int L) const; /*! \brief Check for connectivity between nodes This function examines whether the point (to_m, to_n) in the matrix can be reached from the point (from_m, from_n) using at most L steps. A recursive search is used. The function can be used to search for cycles in the matrix. To search for a cycle of length L, set from_m=to_m and from_n=to_n, and godir=0. \param from_m starting coordinate, row number \param to_m goal coordinate, row number \param from_n starting coordinate, column number \param to_n goal coordinate, row number \param g direction: 1=start going vertically, 2=start going horizontally \param L number of permitted steps \return - -1 or -3 : destination unreachable - -2 : meaningless search (started in a "0" point), - -4 : meaningless search - >=0 : destination reached with certain number of steps left \note This function can be very slow depending on the nature of the matrix. Note that smaller cycles may appear as longer cycles when using this method. More specifically, suppose the method is run with a given L and there are cycles in the neighborhood of (from_m,from_n) of length L-2 or less, but which do not contain (from_m,from_n). These shorter cycles may then also be reported as a cycle of length L. For example, if one of the immediate neighbors of (from_m,from_n) is part of a cycle of length 4 this method will report that (from_m,from_n) is part of a cycle of length 6, if run with L=6. However, if it is known that there are no cycles of length L-2 or smaller, and check_connectivity(from_m,from_n,from_m,from_n,0,L) returns a non-negative value, then one will know with certainty that the point (from_m,from_n) is part of a cycle of length L. (This behavior is inherent to the simple recursive search used.) */ int check_connectivity(int from_m, int from_n, int to_m, int to_n, int g, int L) const; // inline int get_cmax() const { return (max(sumX1)); } // inline int get_vmax() const { return (max(sumX2)); } // ivec get_coldegree() const; // ivec get_rowdegree() const; }; // ---------------------------------------------------------------------- // LDPC_Parity_Unstructured // ---------------------------------------------------------------------- /*! \brief Pure abstract class for unstructured LDPC matrices This class provides a common set of methods for unstructured LDPC matrices. For unstructured codes the parity checks are distributed at random rather than according to a specific pattern, and the generation of a parity matrix can be viewed as drawing a random sample from an ensemble of graphs (matrices) that are described by a specific degree distribution. This class is used as base for the \c LDPC_Parity_Irregular and \c LDPC_Parity_Regular generator classes. \author Erik G. Larsson, Mattias Andersson and Adam Piatyszek */ class ITPP_EXPORT LDPC_Parity_Unstructured : public LDPC_Parity { public: //! Display some information about the matrix virtual void display_stats() const = 0; /*! \brief Remove cycles (loops) from unstructured parity check matrix. This function implements the cycle removal algorithm presented by McGowan and Williamson at the IT workshop 2003. The maximum girth of the graph that will be attempted is L. The algorithm is bound to remove all loops of length L, insofar this is possible. I.e., it does not terminate until it is impossible to remove more cycles by swapping two edges. \param L Target girth. For example, L=6 attempts to removes all 4-cycles. \return The girth of the graph, i.e. the length of the shortest cycle. For example, a return value of 6 means that there are no 4-cycles. \note This algorithm can take a long time to run for large L or large graphs. */ int cycle_removal_MGW(int L); protected: //! Generate a random parity check matrix void generate_random_H(const ivec& C, const ivec& R, const ivec& cycopt); /*! \brief Compute target number of columns (C) and rows (R) with a specific number of ones. \param var_deg vector of variable degree distributions, from an edge perspective \param chk_deg vector of check degree distributions, from an edge perspective \param Nvar number of variable nodes \param C number of columns with a specific number of ones \param R number of rows with a specific number of ones The result is passed by reference and saved in C and R. */ void compute_CR(const vec& var_deg, const vec& chk_deg, const int Nvar, ivec &C, ivec &R); }; // ---------------------------------------------------------------------- // LDPC_Parity_Irregular // ---------------------------------------------------------------------- /*! \brief Irregular LDPC code generator class \author Erik G. Larsson, Mattias Andersson and Adam Piatyszek */ class ITPP_EXPORT LDPC_Parity_Irregular : public LDPC_Parity_Unstructured { public: //! Default constructor LDPC_Parity_Irregular() {} //! Constructor that invokes \c generate() method LDPC_Parity_Irregular(int Nvar, const vec& var_deg, const vec& chk_deg, const std::string& method = "rand", const ivec& options = "200 6"); /*! \brief Generate an irregular LDPC code \param Nvar number of variable nodes \param var_deg vector of variable degree distributions, from an edge perspective \param chk_deg vector of check degree distributions, from an edge perspective \param method currently the only provided method is "rand" (see below) \param options Determines the level of matrix optimization. The "rand" method generates a fully unstructured random matrix. Some stochastic optimization is performed to avoid cycles. This optimization is controlled via the parameter \c options. In particular, the girth for the variable-node-degree-2 part of the graph can be controlled via the parameter options(0). The girth for the rest of the nodes can be controlled via the parameter options(1). The recommended value for options is "200 6" for graphs of small size, and "100 4" for large graphs. The value "0 0" means no optimization. Double edges are always avoided. \note The "rand" method for graph construction provided in this function is not intended to provide the best possible error performance, but it is a simple, basic, fast tool that can easily be used to build relatively good irregular graphs. Better results in terms of performance and error-floor can be achieved by using other performance measures for the graph than cycle length (for irregular codes, the so-called ACE measure for example). Additionally, the "rand" method builds the graph edge by edge, with no possibility of removing an edge once it has been placed. Better results may be achieved by building the graphs by placing pairs or n-tuples of edges at time, for example, column by column. \note Alternative (user-defined) methods for code generation can be implemented by inheriting \c LDPC_Parity_Irregular. */ void generate(int Nvar, const vec& var_deg, const vec& chk_deg, const std::string& method = "rand", const ivec& options = "200 6"); //! Display some information about the matrix void display_stats() const { LDPC_Parity::display_stats(); } }; // ---------------------------------------------------------------------- // LDPC_Parity_Regular // ---------------------------------------------------------------------- /*! \brief Regular LDPC code generator class \author Erik G. Larsson, Mattias Andersson and Adam Piatyszek */ class ITPP_EXPORT LDPC_Parity_Regular : public LDPC_Parity_Unstructured { public: //! Default constructor LDPC_Parity_Regular() {} //! Constructor that invokes \c generate() method LDPC_Parity_Regular(int Nvar, int k, int l, const std::string& method = "rand", const ivec& options = "200 6"); /*! \brief Generate a (k,l) regular LDPC code \param Nvar number of variable nodes \param k number of ones per column \param l number of ones per row \param method See \c LDPC_Parity_Irregular::generate() \param options See \c LDPC_Parity_Irregular::generate() \note Alternative (user-defined) methods for code generation can be implemented by inheriting \c LDPC_Parity_Regular. \note In some cases it may be impossible to construct a perfectly regular parity check matrix with the desired (k,l,Nvar) parameters. The degree distribution will then be automatically adjusted so that the matrix can be constructed and in this event the resulting code will not be perfectly regular. */ void generate(int Nvar, int k, int l, const std::string& method = "rand", const ivec& options = "200 6"); //! Display some information about the matrix void display_stats() const { LDPC_Parity::display_stats(); } }; // ---------------------------------------------------------------------- // BLDPC_Parity // ---------------------------------------------------------------------- /*! \brief Block LDPC code parity-check matrix \author Adam Piatyszek Block LDPC Codes (B-LDPC) are a special class of Quasi-Cyclic LDPC Codes (QC-LDPC). Linear encoding properties and memory efficiency are their main advantages. B-LDPC codes' parity-check matrix is constructed from so-called base matrix by expansion of each single value with a zero matrix or cyclic-shifted identity matrix of size Z x Z, where Z is an expansion factor. Each non negative value of the base matrix represents the cyclic shift value, e.g. 0 means that the identity matrix should not be shifted; 6 means than the identity matrix should be circularly right-shifted by (6 mod Z). Negative values (usually -1) represents zero matrix of size Z x Z. Please refer to [MYK05] for more details. References: [MYK05] S. Myung, K. Yang, J. Kim, "Quasi-Cyclic LDPC Codes for Fast Encoding", IEEE Trans. on Inform. Theory, vol. 51, no. 8, August 2005 */ class ITPP_EXPORT BLDPC_Parity : public LDPC_Parity { public: //! Default constructor BLDPC_Parity(): LDPC_Parity(), Z(0), H_b(), H_b_valid(false) {} //! Construct BLDPC matrix from base matrix BLDPC_Parity(const imat &base_matrix, int exp_factor); //! Construct BLDPC matrix parsing base matrix from a text file BLDPC_Parity(const std::string &filename, int exp_factor); //! Create BLDPC matrix from base matrix by expansion void expand_base(const imat &base_matrix, int exp_factor); //! Get expansion factor int get_exp_factor() const; //! Get base matrix imat get_base_matrix() const; //! Verify initialisation bool is_valid() const { return H_b_valid && init_flag; } //! Set expansion factor void set_exp_factor(int exp_factor); //! Load base matrix from a text file void load_base_matrix(const std::string &filename); //! Save base matrix to a text file void save_base_matrix(const std::string &filename) const; private: int Z; //!< Expansion factor imat H_b; //!< Base matrix bool H_b_valid; //!< Indicates that base matrix is valid //! Calculate base matrix from parity matrix \c H and \c Z void calculate_base_matrix(); }; // ---------------------------------------------------------------------- // LDPC_Generator // ---------------------------------------------------------------------- /*! \brief LDPC Generator pure virtual base class This is an abstract base class for LDPC generators. It provides a generic interface that is used by the \c LDPC_Code class. The \c LDPC_Generator class can be inherited to create a new type of generator. In addition to the default constructor, the following three pure virtual methods need to be defined in a derived class: \c encode(), \c save() and \c load(). See the \c LDPC_Generator_Systematic class for an example implementation of a derived generator. \author Adam Piatyszek */ class ITPP_EXPORT LDPC_Generator { friend class LDPC_Code; public: //! Default constructor LDPC_Generator(const std::string& type_in = ""): init_flag(false), type(new std::string(type_in)) {} //! Virtual destructor virtual ~LDPC_Generator() {delete type;} //! Generator specific encode function virtual void encode(const bvec &input, bvec &output) = 0; //! Return generator type std::string get_type() const { return *type; } //! Mark generator as initialized void mark_initialized() {init_flag = true;}; //! Check if generator is initialized bool is_initialized() const {return init_flag;}; private: bool init_flag; //!< True if generator is initialized std::string* type; //!< Generator type protected: //! Save generator data to a file virtual void save(const std::string& filename) const = 0; //! Read generator data from a file virtual void load(const std::string& filename) = 0; }; // ---------------------------------------------------------------------- // LDPC_Generator_Systematic // ---------------------------------------------------------------------- /*! \brief Systematic LDPC Generator class A generator is basically a dense GF(2) matrix with a constructor that can create the generator matrix from a parity check matrix. \note Please refer to the tutorials for examples of how to use this class. \author Erik G. Larsson and Adam Piatyszek */ class ITPP_EXPORT LDPC_Generator_Systematic : public LDPC_Generator { public: //! Default constructor LDPC_Generator_Systematic(): LDPC_Generator("systematic"), G() {} //! Parametrized constructor LDPC_Generator_Systematic(LDPC_Parity* const H, bool natural_ordering = false, const ivec& ind = ""); //! Virtual destructor virtual ~LDPC_Generator_Systematic() {} //! Generator specific encode function virtual void encode(const bvec &input, bvec &output); /*! \brief Construct systematic generator matrix This function constructs a systematic generator matrix from a parity check matrix (\c LDPC_Parity). The order of the columns is randomized unless otherwise requested via the \c natural_ordering parameter. \param H A pointer to the parity check matrix \c H \param natural_ordering If this flag is true, the columns are not randomly reordered (no interleaving applied), i.e. the function tries so far as possible to avoid permuting columns at all. The permutation takes place only if absolutely necessary. \param ind Vector of column indices (variable nodes) to avoid in the systematic part. If this vector is supplied, the algorithm then avoids to use variable nodes corresponding to this index vector as systematic bits. This can be used for example to avoid using variable nodes of a low degree as systematic bits. This parameter is ignored if the natural_ordering flag is set. \return This function returns the permutation vector \c P on the variable nodes that was necessary to construct a full rank generator. This is the permutation which effectively has been applied to the columns of \c H. The k-th column of the original \c H is the \c P(k)-th column of the rearranged \c H. \note This function modifies the parity check matrix \c H. Its columns may be sorted so that it gets the structure \f$ H = [H_{1} H_{2}] \f$ where \f$ H_{2} \f$ is square and invertible. The computed generator then satisfies \f$ [H_{1} H_{2}][I; G'] = 0 \f$. */ ivec construct(LDPC_Parity* const H, bool natural_ordering = false, const ivec& ind = ""); protected: //! Save generator data to a file virtual void save(const std::string& filename) const; //! Read generator data from a file virtual void load(const std::string& filename); private: GF2mat G; // the matrix is stored in transposed form }; // ---------------------------------------------------------------------- // BLDPC_Generator // ---------------------------------------------------------------------- /*! \brief Block LDPC Generator class \author Adam Piatyszek \note Please refer to the BLDPC_Parity class description for information on B-LDPC codes */ class ITPP_EXPORT BLDPC_Generator : public LDPC_Generator { public: //! Default constructor BLDPC_Generator(const std::string type = "BLDPC"): LDPC_Generator(type), H_enc(), N(0), M(0), K(0), Z(0) {} //! Parametrized constructor BLDPC_Generator(const BLDPC_Parity* const H, const std::string type = "BLDPC"); //! Get expansion factor int get_exp_factor() const { return Z; } //! Generator specific encode function void encode(const bvec &input, bvec &output); //! Construct the BLDPC generator void construct(const BLDPC_Parity* const H); protected: //! Save generator data to a file void save(const std::string &filename) const; //! Read generator data from a file void load(const std::string &filename); GF2mat H_enc; //!< Preprocessed parity check matrix int N; //!< Codeword length = H_enc.cols() int M; //!< Number of parity check bits = H_enc.rows() int K; //!< Number of information bits = N-M int Z; //!< Expansion factor }; // ---------------------------------------------------------------------- // LDPC_Code // ---------------------------------------------------------------------- /*! \ingroup fec \brief Low-density parity check (LDPC) codec This class provides the functionality for encoding and decoding of LDPC codes defined via \c LDPC_Parity and \c LDPC_Generator classes. LDPC codecs are constructed from parity check and generator matrices. Since the procedure of constructing the codec can be time-consuming (for example, due to optimization of the parity matrix and computation of the generator matrix), codecs can be saved to a file for later use. This class provides functionality and a special file format (the file format is designed to optimize the operation of the decoder) to do this. Some examples of load and save operations follow: Saving a codec without generator matrix: \code // assume the parity matrix is already defined and stored in H LDPC_Code C(&H); C.save_code("filename.it"); \endcode Saving a codec with generator matrix (for the example of systematic generator): \code // assume the parity matrix is already defined and stored in H LDPC_Generator_Systematic G(&H); // create generator LDPC_Code C(&H, &G); C.save_code("filename.it"); \endcode Loading a codec without a generator: \code LDPC_Code("filename.it"); \endcode Loading a codec with a generator (systematic in this example): \code LDPC_Generator_Systematic G; // the generator object must be created first LDPC_Code("filename.it", &G); \endcode \note Please refer to the tutorials \ref ldpc_gen_codes and \ref ldpc_bersim_awgn for extensive examples of how to use LDPC codes. \note For issues relating to the accuracy of LLR computations, please see the documentation of \c LLR_calc_unit \author Erik G. Larsson, Adam Piatyszek and Gorka Prieto (decoder improvements) */ class ITPP_EXPORT LDPC_Code : public Channel_Code { public: //! Default constructor LDPC_Code(); /*! \brief Constructor, from a parity check matrix and optionally a generator. This constructor simply calls \c set_code(). \param H The parity check matrix \param G A pointer to the optional generator object \param perform_integrity_check if true, then check that the parity and generator matrices are consistent */ LDPC_Code(const LDPC_Parity* const H, LDPC_Generator* const G = 0, bool perform_integrity_check = true); /*! \brief Constructor, from a saved file This constructor simply calls \c load_code(). */ LDPC_Code(const std::string& filename, LDPC_Generator* const G = 0); //! Destructor virtual ~LDPC_Code() {delete dec_method;} /*! \brief Set the codec, from a parity check matrix and optionally a generator \param H The parity check matrix \param G A pointer to the optional generator object \param perform_integrity_check if true, then check that the parity and generator matrices are consistent */ void set_code(const LDPC_Parity* const H, LDPC_Generator* const G = 0, bool perform_integrity_check = true); /*! \brief Set the codec, by reading from a saved file The file format is defined in the source code. LDPC codecs can be saved with the function \c save_code(). \param filename Name of the file where the codec is stored \param G A pointer to the optional generator object \note If \c G points at \c 0 (default), the generator data is not read from the saved file. This means that the encoding can not be performed. */ void load_code(const std::string& filename, LDPC_Generator* const G = 0); /*! \brief Save the codec to a file \param filename Name of the file where to store the codec \note The decoder parameters (\c max_iters, \c syndr_check_each_iter, \c syndr_check_at_start and \c llrcalc) are not saved to a file. */ void save_code(const std::string& filename) const; /*! \brief Set the decoding method Currently only a belief propagation method ("BP" or "bp") is supported. \note The default method set in the class constructors is "BP". */ void set_decoding_method(const std::string& method); /*! \brief Set the decoding loop exit conditions \param max_iters Maximum number of the decoding iterations \param syndr_check_each_iter If true, break the decoding loop as soon as valid codeword is found. Recommended value: \c true. \param syndr_check_at_start If true, perform a syndrome check before entering the decoding loop. If LLRin corresponds to a valid codeword, set LLRout = LLRin. Recommended value: \c false. \note The default values set in the class constructor are: "50", "true" and "false", respectively. */ void set_exit_conditions(int max_iters, bool syndr_check_each_iter = true, bool syndr_check_at_start = false); //! Set LLR calculation unit void set_llrcalc(const LLR_calc_unit& llrcalc); // ------------ Encoding --------------------- /*! \brief Encode codeword This is a wrapper functions which calls a proper implementation from the \c LDPC_Generator object. \param input Vector of \c ncheck input bits \param output Vector of \c nvar output bits */ virtual void encode(const bvec &input, bvec &output); //! \brief Encode codeword virtual bvec encode(const bvec &input); // ------------ Decoding --------------------- //! Inherited from the base class - not implemented here virtual void decode(const bvec &, bvec &) { it_error("LDPC_Code::decode(): Hard input decoding not implemented"); } //! Inherited from the base class - not implemented here virtual bvec decode(const bvec &) { it_error("LDPC_Code::decode(): Hard input decoding not implemented"); return bvec(); } //! This function outputs systematic bits of the decoded codeword virtual void decode(const vec &llr_in, bvec &syst_bits); //! This function outputs systematic bits of the decoded codeword virtual bvec decode(const vec &llr_in); //! This function is a wrapper for \c bp_decode() void decode_soft_out(const vec &llr_in, vec &llr_out); //! This function is a wrapper for \c bp_decode() vec decode_soft_out(const vec &llr_in); /*! \brief Belief propagation decoding. This function implements the sum-product message passing decoder (Pearl's belief propagation) using LLR values as messages. A fast update mechanism is used for nodes with large degrees. \param LLRin vector of \c nvar input LLR values \param LLRout vector of \c nvar output LLR values If the decoder converged to a valid codeword, the function returns the number of iterations performed. Otherwise the function returns the number of iterations performed but with negative sign. One can use \c set_exit_conditions() method to change the number of decoding iterations and related parameters parameters. The decoding function uses \c LLR_calc_unit to implement table-lookup for the Boxplus operator. By setting the parameters of the \c LLR_calc_unit provided in \c set_llrcalc(), one can change the resolution, for example to use a logmax approximation. See the documentation of \c LLR_calc_unit for details on how to do this. */ int bp_decode(const QLLRvec &LLRin, QLLRvec &LLRout); /*! \brief Syndrome check, on QLLR vector This function performs a syndrome check on a softbit (LLR vector). The function returns true for a valid codeword, false else. \param LLR LLR-vector to check */ bool syndrome_check(const QLLRvec &LLR) const; //! Syndrome check, on bit vector bool syndrome_check(const bvec &b) const; /*! \brief Soft syndrome check This function checks all parity constraints and computes for each one the posterior probability that it is satisfied. The result is a vector, whose i:th element is given by \f[ \mbox{Boxplus}_j LLR_{p_{ij}} \f] where \f[ p_{ij} \f] is the index of the j:th nonzero element of the i:th row of the code's parity check matrix. */ QLLRvec soft_syndrome_check(const QLLRvec &LLR) const; // ------------ Basic information gathering functions ------ //! Get the coderate double get_rate() const { return (1.0 - static_cast(ncheck) / nvar); } //! Get the number of variable nodes int get_nvar() const { return nvar; } //! Get the number of check nodes int get_ncheck() const { return ncheck; } //! Get the number of information bits per codeword int get_ninfo() const { return nvar - ncheck; } //! Return the decoding method std::string get_decoding_method() const { return *dec_method; } //! Get the maximum number of iterations of the decoder int get_nrof_iterations() const { return max_iters; } //! Get LLR calculation unit used in decoder LLR_calc_unit get_llrcalc() const { return llrcalc; } //! Print some properties of the codec in plain text friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const LDPC_Code &C); protected: //! Function to compute decoder parameterization void decoder_parameterization(const LDPC_Parity* const H); //! Function to check the integrity of the parity check matrix and generator void integrity_check(); //! Initialize decoder void setup_decoder(); private: bool H_defined; //!< true if parity check matrix is defined bool G_defined; //!< true if generator is defined int nvar; //!< Number of variable nodes int ncheck; //!< Number of check nodes LDPC_Generator *G; //!< Generator object pointer // decoder parameters std::string* dec_method; //!< Decoding method int max_iters; //!< Maximum number of iterations bool psc; //!< check syndrom after each iteration bool pisc; //!< check syndrom before first iteration LLR_calc_unit llrcalc; //!< LLR calculation unit // Parity check matrix parameterization ivec C, V, sumX1, sumX2, iind, jind; // temporary storage for decoder (memory allocated when codec defined) QLLRvec mvc, mcv; //! Maximum check node degree that the class can handle static const int max_cnd = 200; }; /*! \relatesalso LDPC_Code \brief Print some properties of the LDPC codec in plain text. */ ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const LDPC_Code &C); } #endif itpp-4.3.1/itpp/comm/llr.cpp000066400000000000000000000120651216575753400157220ustar00rootroot00000000000000/*! * \file * \brief Class for numerically efficient log-likelihood algebra * \author Erik G. Larsson and Martin Senst * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { LLR_calc_unit::LLR_calc_unit() { init_llr_tables(); } LLR_calc_unit::LLR_calc_unit(short int d1, short int d2, short int d3) { init_llr_tables(d1, d2, d3); } ivec LLR_calc_unit::get_Dint() { ivec r(3); r(0) = Dint1; r(1) = Dint2; r(2) = Dint3; return r; } void LLR_calc_unit::init_llr_tables(short int d1, short int d2, short int d3) { Dint1 = d1; // 1<(Dint3 - Dint1)) * i; result(i) = to_qllr(std::log(1 + std::exp(-x))); } it_assert(length(result) == Dint2, "Ldpc_codec::construct_logexp_table()"); return result; } QLLRvec LLR_calc_unit::to_qllr(const vec &l) const { int n = length(l); ivec result(n); for (int i = 0; i < n; i++) { result.set(i, to_qllr(l(i))); } return result; } vec LLR_calc_unit::to_double(const QLLRvec &l) const { int n = length(l); vec result(n); for (int i = 0; i < n; i++) { result.set(i, to_double(l(i))); } return result; } QLLRmat LLR_calc_unit::to_qllr(const mat &l) const { int m = l.rows(); int n = l.cols(); imat result(m, n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { result.set(i, j, to_qllr(l(i, j))); } } return result; } mat LLR_calc_unit::to_double(const QLLRmat &l) const { int m = l.rows(); int n = l.cols(); mat result(m, n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { result.set(i, j, to_double(l(i, j))); } } return result; } // This function used to be inline, but in my experiments, // the non-inlined version was actually faster /Martin Senst QLLR LLR_calc_unit::Boxplus(QLLR a, QLLR b) const { QLLR a_abs = (a > 0 ? a : -a); QLLR b_abs = (b > 0 ? b : -b); QLLR minabs = (a_abs > b_abs ? b_abs : a_abs); QLLR term1 = (a > 0 ? (b > 0 ? minabs : -minabs) : (b > 0 ? -minabs : minabs)); if (Dint2 == 0) { // logmax approximation - avoid looking into empty table // Don't abort when overflowing, just saturate the QLLR if (term1 > QLLR_MAX) { it_info_debug("LLR_calc_unit::Boxplus(): LLR overflow"); return QLLR_MAX; } if (term1 < -QLLR_MAX) { it_info_debug("LLR_calc_unit::Boxplus(): LLR overflow"); return -QLLR_MAX; } return term1; } QLLR apb = a + b; QLLR term2 = logexp((apb > 0 ? apb : -apb)); QLLR amb = a - b; QLLR term3 = logexp((amb > 0 ? amb : -amb)); QLLR result = term1 + term2 - term3; // Don't abort when overflowing, just saturate the QLLR if (result > QLLR_MAX) { it_info_debug("LLR_calc_unit::Boxplus() LLR overflow"); return QLLR_MAX; } if (result < -QLLR_MAX) { it_info_debug("LLR_calc_unit::Boxplus() LLR overflow"); return -QLLR_MAX; } return result; } std::ostream &operator<<(std::ostream &os, const LLR_calc_unit &lcu) { os << "---------- LLR calculation unit -----------------" << std::endl; os << "LLR_calc_unit table properties:" << std::endl; os << "The granularity in the LLR representation is " << pow2(static_cast(-lcu.Dint1)) << std::endl; os << "The LLR scale factor is " << (1 << lcu.Dint1) << std::endl; os << "The largest LLR that can be represented is " << lcu.to_double(QLLR_MAX) << std::endl; os << "The table resolution is " << pow2(static_cast(lcu.Dint3 - lcu.Dint1)) << std::endl; os << "The number of entries in the table is " << lcu.Dint2 << std::endl; os << "The tables truncates at the LLR value " << pow2(static_cast(lcu.Dint3 - lcu.Dint1)) * lcu.Dint2 << std::endl; os << "-------------------------------------------------" << std::endl; return os; } } itpp-4.3.1/itpp/comm/llr.h000066400000000000000000000240471216575753400153720ustar00rootroot00000000000000/*! * \file * \brief Class for numerically efficient log-likelihood algebra * \author Erik G. Larsson and Martin Senst * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef LLR_H #define LLR_H #include #include #include #include #include #include #include namespace itpp { /*! \relates LLR_calc_unit The quantized log-likelihood ratio (QLLR) representation, scalar form. See \c LLR_calc_unit. */ typedef signed int QLLR; /*! \relates LLR_calc_unit The quantized log-likelihood ratio (QLLR) representation, vector form. See \c LLR_calc_unit. */ typedef Vec QLLRvec; /*! \relates LLR_calc_unit The quantized log-likelihood ratio (QLLR) representation, matrix form. See \c LLR_calc_unit. */ typedef Mat QLLRmat; /*! \relates LLR_calc_unit The largest possible QLLR value */ const QLLR QLLR_MAX = (std::numeric_limits::max() >> 4); // added some margin to make sure the sum of two LLR is still permissible /*! \brief Log-likelihood algebra calculation unit. This class contains functions for algebra with log-likelihood ratios (LLRs). The class is mainly useful for modules that rely on certain nonlinear operations on LLRs (e.g. boxplus for LDPC and turbo decoding and Jacobian logarithm for soft demodulation). The routines provided are numerically efficient and use only integer arithmetics. Additionally, they allow for arbitrary quantization of LLRs in order to study effects of limited precision (fixed point number representations). As a consequence, computations are approximate. With the standard settings, the numerical precision should be sufficient (and practically equivalent to floating point precision) for all practical applications. However, one can construct cases where small numerical artifacts due to quantization effects (e.g., soft demodulation with very high or very low SNR) can be observed. An LLR for an information bit b is defined according to \f[ L = \log \frac{P(b=0)}{P(b=1)} \f] and it is in general a real number. LLR values are represented via the special type, "quantized LLR" (QLLR). The relation between the quantized representation and the real (floating-point) LLR value is \f[ \mbox{QLLR} = \mbox{round} \left(2^{\mbox{Dint1}}\cdot \mbox{LLR}\right) \f] The user parameter Dint1 determines the granularity of the quantization, and it can be set arbitrarily. The functions to_double() and to_qllr() can be used to perform conversions between the two representations (QLLR to floating-point, and vice versa). The class provides functions for the computation of the Jacobian logarithm and Hagenauer's "boxplus" operator. These functions are based on a table-lookup. The resolution of the table is determined by the parameters Dint2 and Dint3. See the class constructor for more detail. When an object of LLR_calc_unit is created, corresponding lookup-tables are also generated. The resolution of these tables can be adjusted by providing parameters to the constructor. The variable table resolution allows one to study complexity versus accuracy (i.e., how different table resolutions would degrade performance) to some extent. Yet the main purpose of the QLLR representation is to provide a tool for writing efficient simulation code, rather than to provide for bit-level (fixed-point) simulations. For bit-level simulations, a true fixed point representation of LLRs would be preferred/required. With the default setting of the table parameters, using the QLLR type is practically as accurate (but much faster) as using "double" to represent LLRs. Decoder implementations may then provide functions using QLLR, fixed-point, or double (for compatibility reasons) representations of LLR values. Note: the QLLR type does not check that the correct quantization level is used. I.e., in theory it would be possible to add two QLLR types with different quantization (Dint) parameters. This is intentionally implemented this way to achieve maximum runtime efficiency. */ class ITPP_EXPORT LLR_calc_unit { public: //! Constructor, using the default table resolution LLR_calc_unit(); /*! * \brief Constructor, using a specific table resolution. * * See init_llr_tables() for more details on the parameters. */ LLR_calc_unit(short int Dint1, short int Dint2, short int Dint3); /*! \brief Set the quantization and table parameters \param Dint1 Determines the relation between LLR represented as real number and as integer. The relation is \f[ \mbox{QLLR} = \mbox{round} \left(2^{\mbox{Dint1}}\cdot \mbox{LLR}\right) \f] \param Dint2 Number of entries in the table. If this is zero, then logmap becomes logmax. \param Dint3 Determines the table resolution. The spacing between each entry is \f[ 2^{-(Dint1-Dint3)} \f] The default parameter values are chosen to give a performance practically indistinguishable from that of using floating point calculations. Example: (recommended settings with "exact" computation via high resolution lookup table) \code LLR_calc_unit lcalc(12, 300, 7); \endcode Example: (recommended settings with logmax, i.e. no table lookup) \code LLR_calc_unit lcalc(12, 0, 7); \endcode */ void init_llr_tables(short int Dint1 = 12, short int Dint2 = 300, short int Dint3 = 7); //! Convert a "real" LLR value to an LLR type QLLR to_qllr(double l) const; //! Convert a vector of "real" LLR values to an LLR type QLLRvec to_qllr(const vec &l) const; //! Convert a matrix of "real" LLR values to an LLR type QLLRmat to_qllr(const mat &l) const; //! Convert an LLR type to a "real" LLR double to_double(QLLR l) const; //! Convert a vector of LLR types to a "real" LLR vec to_double(const QLLRvec &l) const; //! Convert a matrix of LLR types to a "real" LLR mat to_double(const QLLRmat &l) const; /*! * \brief Jacobian logarithm. * * This function computes \f[ \log(\exp(a)+\exp(b)) \f] */ inline QLLR jaclog(QLLR a, QLLR b) const; // Note: a version of this function taking "double" values as input // is deliberately omitted, because this is rather slow. /*! * \brief Hagenauer's "Boxplus" operator. * * This function computes: * \f[ \mbox{sign}(a) * \mbox{sign}(b) * \mbox{min}(|a|,|b|) * + f(|a+b|) - f(|a-b|) \f] * where \f[ f(x) = \log(1+\exp(-x)) \f] */ QLLR Boxplus(QLLR a, QLLR b) const; /*! * \brief Logexp operator. * * This function computes \f[ f(x) = \log(1+\exp(-x)) \f] */ inline QLLR logexp(QLLR x) const; //! Retrieve the table resolution values ivec get_Dint(); //! Print some properties of the LLR calculation unit in plain text friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const LLR_calc_unit &l); private: //! Compute the table for \f[ f(x) = \log(1+\exp(-x)) \f] ivec construct_logexp_table(); //! The lookup tables for the decoder ivec logexp_table; //! Decoder (lookup-table) parameters short int Dint1, Dint2, Dint3; }; /*! \relatesalso LLR_calc_unit \brief Print some properties of the LLR calculation unit in plain text. */ ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const LLR_calc_unit &lcu); // ---------------------------------------------------------------------- // implementation of some inline functions // ---------------------------------------------------------------------- inline double LLR_calc_unit::to_double(QLLR l) const { return static_cast(l) / (1 << Dint1); } inline QLLR LLR_calc_unit::to_qllr(double l) const { double QLLR_MAX_double = to_double(QLLR_MAX); // Don't abort when overflow occurs, just saturate the QLLR if (l > QLLR_MAX_double) { it_info_debug("LLR_calc_unit::to_qllr(): LLR overflow"); return QLLR_MAX; } if (l < -QLLR_MAX_double) { it_info_debug("LLR_calc_unit::to_qllr(): LLR overflow"); return -QLLR_MAX; } return static_cast(std::floor(0.5 + (1 << Dint1) * l)); } inline QLLR LLR_calc_unit::logexp(QLLR x) const { it_assert_debug(x >= 0, "LLR_calc_unit::logexp(): Wrong LLR value"); int ind = x >> Dint3; if (ind >= Dint2) // outside table return 0; it_assert_debug(ind >= 0, "LLR_calc_unit::logexp(): Internal error"); it_assert_debug(ind < Dint2, "LLR_calc_unit::logexp(): internal error"); // With interpolation // int delta=x-(ind<> Dint3); // Without interpolation return logexp_table(ind); } inline QLLR LLR_calc_unit::jaclog(QLLR a, QLLR b) const { QLLR x, maxab; if (a > b) { maxab = a; x = a - b; } else { maxab = b; x = b - a; } if (maxab >= QLLR_MAX) return QLLR_MAX; else return (maxab + logexp(x)); } } #endif itpp-4.3.1/itpp/comm/modulator.cpp000066400000000000000000000406531216575753400171430ustar00rootroot00000000000000/*! * \file * \brief One- and two-dimensional modulators - source file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { //! \cond //MSVC explicitely instantiate required template while building the shared library template class ITPP_EXPORT Modulator; template class ITPP_EXPORT Modulator >; //! \endcond // ---------------------------------------------------------------------- // QAM // ---------------------------------------------------------------------- void QAM::set_M(int Mary) { k = levels2bits(Mary); M = Mary; it_assert((pow2i(k) == M) && (is_even(k)), "QAM::set_M(): M = " << M << " is not an even power of 2"); L = round_i(std::sqrt(static_cast(M))); double average_energy = (M - 1) * 2.0 / 3.0; scaling_factor = std::sqrt(average_energy); symbols.set_size(M); bitmap.set_size(M, k); bits2symbols.set_size(M); bmat gray_code = graycode(levels2bits(L)); for (int i = 0; i < L; i++) { for (int j = 0; j < L; j++) { symbols(i*L + j) = std::complex(((L - 1) - j * 2) / scaling_factor, ((L - 1) - i * 2) / scaling_factor); bitmap.set_row(i*L + j, concat(gray_code.get_row(i), gray_code.get_row(j))); bits2symbols(bin2dec(bitmap.get_row(i*L + j))) = i * L + j; } } calculate_softbit_matrices(); setup_done = true; } void QAM::demodulate_bits(const cvec &signal, bvec &out) const { it_assert_debug(setup_done, "QAM::demodulate_bits(): Modulator not ready."); out.set_size(k*signal.size(), false); int temp_real, temp_imag; for (int i = 0; i < signal.size(); i++) { temp_real = round_i((L - 1) - (std::real(signal(i) * scaling_factor) + (L - 1)) / 2.0); temp_imag = round_i((L - 1) - (std::imag(signal(i) * scaling_factor) + (L - 1)) / 2.0); if (temp_real < 0) temp_real = 0; else if (temp_real > (L - 1)) temp_real = (L - 1); if (temp_imag < 0) temp_imag = 0; else if (temp_imag > (L - 1)) temp_imag = (L - 1); out.replace_mid(k*i, bitmap.get_row(temp_imag * L + temp_real)); } } bvec QAM::demodulate_bits(const cvec &signal) const { bvec out; demodulate_bits(signal, out); return out; } // ---------------------------------------------------------------------- // PSK // ---------------------------------------------------------------------- void PSK::set_M(int Mary) { k = levels2bits(Mary); M = Mary; it_assert(pow2i(k) == M, "PSK::set_M(): M is not a power of 2"); symbols.set_size(M); bitmap = graycode(k); bits2symbols.set_size(M); double delta = m_2pi / M; double epsilon = delta / 10000.0; std::complex symb; for (int i = 0; i < M; i++) { symb = std::complex(std::polar(1.0, delta * i)); if (std::fabs(std::real(symb)) < epsilon) { symbols(i) = std::complex(0.0, std::imag(symb)); } else if (std::fabs(std::imag(symb)) < epsilon) { symbols(i) = std::complex(std::real(symb), 0.0); } else { symbols(i) = symb; } bits2symbols(bin2dec(bitmap.get_row(i))) = i; } calculate_softbit_matrices(); setup_done = true; } void PSK::demodulate_bits(const cvec &signal, bvec &out) const { it_assert_debug(setup_done, "PSK::demodulate_bits(): Modulator not ready."); int est_symbol; double ang, temp; out.set_size(k*signal.size(), false); for (int i = 0; i < signal.size(); i++) { ang = std::arg(signal(i)); temp = (ang < 0) ? (m_2pi + ang) : ang; est_symbol = round_i(temp * (M >> 1) / pi) % M; out.replace_mid(i*k, bitmap.get_row(est_symbol)); } } bvec PSK::demodulate_bits(const cvec &signal) const { bvec out; demodulate_bits(signal, out); return out; } // ---------------------------------------------------------------------- // QPSK // ---------------------------------------------------------------------- void QPSK::demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits, Soft_Method) const { soft_bits.set_size(k * rx_symbols.size()); std::complex temp; double factor = 2 * std::sqrt(2.0) / N0; std::complex exp_pi4 = std::complex(std::cos(pi / 4), std::sin(pi / 4)); for (int i = 0; i < rx_symbols.size(); i++) { temp = rx_symbols(i) * exp_pi4; soft_bits((i << 1) + 1) = std::real(temp) * factor; soft_bits(i << 1) = std::imag(temp) * factor; } } vec QPSK::demodulate_soft_bits(const cvec &rx_symbols, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, N0, out, method); return out; } void QPSK::demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits, Soft_Method) const { soft_bits.set_size(2*rx_symbols.size(), false); std::complex temp; double factor = 2 * std::sqrt(2.0) / N0; std::complex exp_pi4 = std::complex(std::cos(pi / 4), std::sin(pi / 4)); for (int i = 0; i < rx_symbols.size(); i++) { temp = rx_symbols(i) * std::conj(channel(i)) * exp_pi4; soft_bits((i << 1) + 1) = std::real(temp) * factor; soft_bits(i << 1) = std::imag(temp) * factor; } } vec QPSK::demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, channel, N0, out, method); return out; } // ---------------------------------------------------------------------- // BPSK_c // ---------------------------------------------------------------------- void BPSK_c::modulate_bits(const bvec &bits, cvec &out) const { out.set_size(bits.size(), false); for (int i = 0; i < bits.size(); i++) { out(i) = (bits(i) == 0 ? 1.0 : -1.0); } } cvec BPSK_c::modulate_bits(const bvec &bits) const { cvec out(bits.size()); modulate_bits(bits, out); return out; } void BPSK_c::demodulate_bits(const cvec &signal, bvec &out) const { out.set_size(signal.size(), false); for (int i = 0; i < signal.length(); i++) { out(i) = (std::real(signal(i)) > 0) ? bin(0) : bin(1); } } bvec BPSK_c::demodulate_bits(const cvec &signal) const { bvec out(signal.size()); demodulate_bits(signal, out); return out; } void BPSK_c::demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits, Soft_Method) const { double factor = 4 / N0; soft_bits.set_size(rx_symbols.size(), false); for (int i = 0; i < rx_symbols.size(); i++) { soft_bits(i) = factor * std::real(rx_symbols(i)); } } vec BPSK_c::demodulate_soft_bits(const cvec &rx_symbols, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, N0, out, method); return out; } void BPSK_c::demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits, Soft_Method) const { double factor = 4 / N0; soft_bits.set_size(rx_symbols.size(), false); for (int i = 0; i < rx_symbols.size(); i++) { soft_bits(i) = factor * std::real(rx_symbols(i) * std::conj(channel(i))); } } vec BPSK_c::demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, channel, N0, out, method); return out; } // ---------------------------------------------------------------------- // BPSK // ---------------------------------------------------------------------- void BPSK::modulate_bits(const bvec &bits, vec &out) const { out.set_size(bits.size(), false); for (int i = 0; i < bits.size(); i++) { out(i) = (bits(i) == 0 ? 1.0 : -1.0); } } vec BPSK::modulate_bits(const bvec &bits) const { vec out(bits.size()); modulate_bits(bits, out); return out; } void BPSK::demodulate_bits(const vec &signal, bvec &out) const { out.set_size(signal.size(), false); for (int i = 0; i < signal.length(); i++) { out(i) = (signal(i) > 0) ? bin(0) : bin(1); } } bvec BPSK::demodulate_bits(const vec &signal) const { bvec out(signal.size()); demodulate_bits(signal, out); return out; } void BPSK::demodulate_soft_bits(const vec &rx_symbols, double N0, vec &soft_bits, Soft_Method) const { double factor = 4 / N0; soft_bits.set_size(rx_symbols.size(), false); for (int i = 0; i < rx_symbols.size(); i++) { soft_bits(i) = factor * rx_symbols(i); } } vec BPSK::demodulate_soft_bits(const vec &rx_symbols, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, N0, out, method); return out; } void BPSK::demodulate_soft_bits(const vec &rx_symbols, const vec &channel, double N0, vec &soft_bits, Soft_Method) const { double factor = 4 / N0; soft_bits.set_size(rx_symbols.size(), false); for (int i = 0; i < rx_symbols.size(); i++) { soft_bits(i) = factor * (rx_symbols(i) * channel(i)); } } vec BPSK::demodulate_soft_bits(const vec &rx_symbols, const vec &channel, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, channel, N0, out, method); return out; } // ---------------------------------------------------------------------- // PAM_c // ---------------------------------------------------------------------- void PAM_c::set_M(int Mary) { M = Mary; k = levels2bits(M); it_assert(pow2i(k) == M, "PAM_c::set_M(): M is not a power of 2"); symbols.set_size(M, false); bits2symbols.set_size(M, false); bitmap = graycode(k); double average_energy = (sqr(M) - 1) / 3.0; scaling_factor = std::sqrt(average_energy); for (int i = 0; i < M; i++) { symbols(i) = ((M - 1) - i * 2) / scaling_factor; bits2symbols(bin2dec(bitmap.get_row(i))) = i; } calculate_softbit_matrices(); setup_done = true; } void PAM_c::demodulate_bits(const cvec &signal, bvec &out) const { it_assert_debug(setup_done, "PAM_c::demodulate_bits(): Modulator not ready."); int est_symbol; out.set_size(k*signal.size(), false); for (int i = 0; i < signal.size(); i++) { est_symbol = round_i((M - 1) - (std::real(signal(i)) * scaling_factor + (M - 1)) / 2); if (est_symbol < 0) est_symbol = 0; else if (est_symbol > (M - 1)) est_symbol = M - 1; out.replace_mid(i*k, bitmap.get_row(est_symbol)); } } bvec PAM_c::demodulate_bits(const cvec &signal) const { bvec temp(signal.size()); demodulate_bits(signal, temp); return temp; } void PAM_c::demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits, Soft_Method method) const { it_assert_debug(setup_done, "PAM_c::demodulate_soft_bits(): Modulator not ready."); double P0, P1, d0min, d1min, temp; vec metric(M); soft_bits.set_size(k * rx_symbols.size()); if (method == LOGMAP) { for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = std::exp(-sqr(std::real(rx_symbols(l) - symbols(j))) / N0); } for (int i = 0; i < k; i++) { P0 = P1 = 0; for (int j = 0; j < (M >> 1); j++) { P0 += metric(S0(i, j)); P1 += metric(S1(i, j)); } soft_bits(l*k + i) = trunc_log(P0) - trunc_log(P1); } } } else { // method == APPROX for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = sqr(std::real(rx_symbols(l) - symbols(j))); } for (int i = 0; i < k; i++) { d0min = d1min = std::numeric_limits::max(); for (int j = 0; j < (M >> 1); j++) { temp = metric(S0(i, j)); if (temp < d0min) { d0min = temp; } temp = metric(S1(i, j)); if (temp < d1min) { d1min = temp; } } soft_bits(l*k + i) = (-d0min + d1min) / N0; } } } } vec PAM_c::demodulate_soft_bits(const cvec &rx_symbols, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, N0, out, method); return out; } void PAM_c::demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits, Soft_Method method) const { it_assert_debug(setup_done, "PAM_c::demodulate_soft_bits(): Modulator not ready."); double P0, P1, d0min, d1min, temp; vec metric(M); soft_bits.set_size(k * rx_symbols.size()); if (method == LOGMAP) { for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = std::exp(-sqr(std::real(rx_symbols(l) - channel(l) * symbols(j))) / N0); } for (int i = 0; i < k; i++) { P0 = P1 = 0; for (int j = 0; j < (M >> 1); j++) { P0 += metric(S0(i, j)); P1 += metric(S1(i, j)); } soft_bits(l*k + i) = trunc_log(P0) - trunc_log(P1); } } } else { // method == APPROX for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = sqr(std::real(rx_symbols(l) - channel(l) * symbols(j))); } for (int i = 0; i < k; i++) { d0min = d1min = std::numeric_limits::max(); for (int j = 0; j < (M >> 1); j++) { temp = metric(S0(i, j)); if (temp < d0min) { d0min = temp; } temp = metric(S1(i, j)); if (temp < d1min) { d1min = temp; } } soft_bits(l*k + i) = (-d0min + d1min) / N0; } } } } vec PAM_c::demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, Soft_Method method) const { vec out; demodulate_soft_bits(rx_symbols, channel, N0, out, method); return out; } // ---------------------------------------------------------------------- // PAM // ---------------------------------------------------------------------- void PAM::set_M(int Mary) { M = Mary; k = levels2bits(M); it_assert(pow2i(k) == M, "PAM::set_M(): M is not a power of 2"); symbols.set_size(M, false); bits2symbols.set_size(M, false); bitmap = graycode(k); double average_energy = (sqr(M) - 1) / 3.0; scaling_factor = std::sqrt(average_energy); for (int i = 0; i < M; i++) { symbols(i) = ((M - 1) - i * 2) / scaling_factor; bits2symbols(bin2dec(bitmap.get_row(i))) = i; } calculate_softbit_matrices(); setup_done = true; } void PAM::demodulate_bits(const vec &signal, bvec &out) const { it_assert_debug(setup_done, "PAM::demodulate_bits(): Modulator not ready."); int est_symbol; out.set_size(k*signal.size(), false); for (int i = 0; i < signal.size(); i++) { est_symbol = round_i((M - 1) - (signal(i) * scaling_factor + (M - 1)) / 2); if (est_symbol < 0) est_symbol = 0; else if (est_symbol > (M - 1)) est_symbol = M - 1; out.replace_mid(i*k, bitmap.get_row(est_symbol)); } } bvec PAM::demodulate_bits(const vec &signal) const { bvec temp(signal.size()); demodulate_bits(signal, temp); return temp; } } // namespace itpp itpp-4.3.1/itpp/comm/modulator.h000066400000000000000000001263741216575753400166150ustar00rootroot00000000000000/*! * \file * \brief One- and two-dimensional modulators - header file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2011 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MODULATOR_H #define MODULATOR_H #include #include #include #include #include #include namespace itpp { /*! * \ingroup modulators * \brief Soft demodulation methods */ enum Soft_Method { LOGMAP, //!< Log-MAP full calculation APPROX //!< Approximate faster method }; /*! \ingroup modulators \brief General modulator for 1D or 2D signal constellations. The Modulator class is designed for modeling any kind of 1D (real) or 2D (complex) signal constellations. Therefore it is used as a base class for such modulations like PAM, PSK, QAM, etc. The constellation of the modulator is described with two vectors. The first one contains the real or complex values representing the constellation points, whereas the other one includes the corresponding bit to symbol mapping (in the decimal from). Beside hard demapping, this class can also perform soft demodulation. To use it properly the received symbols should be equal to: \f[r_k = c_k s_k + n_k,\f] where \f$c_k\f$ is the real or complex channel gain, \f$s_k\f$ is the transmitted constellation symbol, and \f$n_k\f$ is the AWGN of the channel (with variance \f$N_0\f$). It is also assumed that the channel estimates are perfect when calculating the soft bits. */ template class Modulator { public: //! Default constructor Modulator(); //! Constructor Modulator(const Vec& symbols, const ivec& bits2symbols); //! Destructor virtual ~Modulator() {} //! Set the constellation to use in the modulator virtual void set(const Vec& symbols, const ivec& bits2symbols); //! Returns number of bits per symbol virtual int bits_per_symbol() const { return k; } //! Returns number of bits per symbol virtual int get_k() const { return k; } //! Returns number of modulation symbols virtual int get_M() const { return M; } //! Get the symbol values used in the modulator virtual Vec get_symbols() const { return symbols; } /*! * \brief Get the bitmap, which maps input bits into symbols * * The mapping is done as follows. An input bit sequence in decimal * notation is used for indexing the \c bits2symbols table. The indexing * result denotes the symbol to be used from the \c symbols table, e.g.: * * \code * PSK mod(8); // assume 8-PSK modulator * cvec sym = mod.get_symbols(); * ivec bits2sym = mod.get_bits2symbols(); * bvec in_bits = "100" // input bits * int d = bin2dec(in_bits); // decimal representation of in_bits = 4 * // mapping of d into PSK symbol using bits2sym and sym tables * std::complex out_symbol = sym(bits2sym(d)); * \endcode */ virtual ivec get_bits2symbols() const { return bits2symbols; } //! Modulation of symbols virtual void modulate(const ivec& symbolnumbers, Vec& output) const; //! Modulation of symbols virtual Vec modulate(const ivec& symbolnumbers) const; //! Demodulation of symbols virtual void demodulate(const Vec& signal, ivec& output) const; //! Demodulation of symbols virtual ivec demodulate(const Vec& signal) const; //! Modulation of bits virtual void modulate_bits(const bvec& bits, Vec& output) const; //! Modulation of bits virtual Vec modulate_bits(const bvec& bits) const; //! Hard demodulation of bits virtual void demodulate_bits(const Vec& signal, bvec& bits) const; //! Hard demodulation of bits virtual bvec demodulate_bits(const Vec& signal) const; /*! \brief Soft demodulator for AWGN channels This function calculates the log-likelihood ratio (LLR) of the received signal from AWGN channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation: \f[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} \right) \f] or approximate, but faster calculation is performed. The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let \f$d_0 = |r_k - s_0|\f$ denote the distance to the closest zero point and \f$d_1 = |r_k - s_1|\f$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes \f[\frac{d_1^2 - d_0^2}{N_0}\f] This function can be used on channels where the channel gain \f$c_k = 1\f$. When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function. \param rx_symbols The received noisy constellation symbols \param N0 The spectral density of the AWGN noise \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (\c Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const Vec& rx_symbols, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for AWGN channels virtual vec demodulate_soft_bits(const Vec& rx_symbols, double N0, Soft_Method method = LOGMAP) const; /*! \brief Soft demodulator for fading channels This function calculates the log-likelihood ratio (LLR) of the received signal from fading channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation: \f[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} \right) \f] or approximate, but faster calculation is performed. The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let \f$d_0 = |r_k - c_k s_0|\f$ denote the distance to the closest zero point and \f$d_1 = |r_k - c_k s_1|\f$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes \f[\frac{d_1^2 - d_0^2}{N_0}\f] When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function. \param rx_symbols The received noisy constellation symbols \f$r_k\f$ \param channel The channel values \f$c_k\f$ \param N0 The spectral density of the AWGN noise \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const Vec& rx_symbols, const Vec& channel, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for fading channels virtual vec demodulate_soft_bits(const Vec& rx_symbols, const Vec& channel, double N0, Soft_Method method = LOGMAP) const; protected: //! Setup indicator bool setup_done; //! Number of bits per modulation symbol int k; //! Number of modulation symbols int M; //! Bit to symbol mapping table (size: M x k) bmat bitmap; //! Bit to symbol mapping in decimal form (size: M) ivec bits2symbols; //! Corresponding modulation symbols (size: M) Vec symbols; /*! \brief Matrix where row k contains the constellation points with '0' in bit position k */ imat S0; /*! \brief Matrix where row k contains the constellation points with '1' in bit position k */ imat S1; //! This function calculates the soft bit mapping matrices S0 and S1 void calculate_softbit_matrices(); }; // ---------------------------------------------------------------------- // Type definitions of Modulator_1D and Modulator_2D // ---------------------------------------------------------------------- /*! * \relates Modulator * \brief Definition of 1D Modulator (with real symbols) */ typedef Modulator Modulator_1D; /*! * \relates Modulator * \brief Definition of 2D Modulator (with complex symbols) */ typedef Modulator > Modulator_2D; // ---------------------------------------------------------------------- // Implementation of templated Modulator members // ---------------------------------------------------------------------- template Modulator::Modulator() : setup_done(false), k(0), M(0), bitmap(""), bits2symbols(""), symbols(""), S0(""), S1("") {} template Modulator::Modulator(const Vec &symbols, const ivec &bits2symbols) { set(symbols, bits2symbols); } template void Modulator::set(const Vec &in_symbols, const ivec &in_bits2symbols) { it_assert(in_symbols.size() == in_bits2symbols.size(), "Modulator::set(): Number of symbols and bits2symbols does not match"); it_assert(is_even(in_symbols.size()) && (in_symbols.size() > 0), "Modulator::set(): Number of symbols needs to be even and non-zero"); it_assert((max(in_bits2symbols) == in_bits2symbols.size() - 1) && (min(in_bits2symbols) == 0), "Modulator::set(): Improper bits2symbol vector"); symbols = in_symbols; bits2symbols = in_bits2symbols; M = bits2symbols.size(); k = levels2bits(M); bitmap.set_size(M, k); for (int m = 0; m < M; m++) { bitmap.set_row(bits2symbols(m), dec2bin(k, m)); } calculate_softbit_matrices(); setup_done = true; } template void Modulator::modulate(const ivec &symbolnumbers, Vec& output) const { it_assert_debug(setup_done, "Modulator::modulate(): Modulator not ready."); output.set_size(symbolnumbers.length()); for (int i = 0; i < symbolnumbers.length(); i++) output(i) = symbols(symbolnumbers(i)); } template Vec Modulator::modulate(const ivec &symbolnumbers) const { Vec output(symbolnumbers.length()); modulate(symbolnumbers, output); return output; } template void Modulator::demodulate(const Vec &signal, ivec& output) const { it_assert_debug(setup_done, "Modulator::demodulate(): Modulator not ready."); double dist, mindist; int closest; output.set_size(signal.size()); for (int i = 0; i < signal.size(); i++) { mindist = std::abs(symbols(0) - signal(i)); closest = 0; for (int j = 1; j < M; j++) { dist = std::abs(symbols(j) - signal(i)); if (dist < mindist) { mindist = dist; closest = j; } } output(i) = closest; } } template ivec Modulator::demodulate(const Vec& signal) const { ivec output(signal.length()); demodulate(signal, output); return output; } template void Modulator::modulate_bits(const bvec &bits, Vec &output) const { it_assert_debug(setup_done, "Modulator::modulate_bits(): Modulator not ready."); // Check if some bits have to be cut and print warning message in such // case. if (bits.length() % k) { it_warning("Modulator::modulate_bits(): The number of input bits is not a multiple of k (number of bits per symbol). Remainder bits are not modulated."); } int no_symbols = bits.length() / k; output.set_size(no_symbols); for (int i = 0; i < no_symbols; i++) { output(i) = symbols(bits2symbols(bin2dec(bits.mid(i * k, k)))); } } template Vec Modulator::modulate_bits(const bvec &bits) const { Vec output; modulate_bits(bits, output); return output; } template void Modulator::demodulate_bits(const Vec &signal, bvec &bits) const { it_assert_debug(setup_done, "Modulator::demodulate_bist(): Modulator not ready."); double dist, mindist; int closest; bits.set_size(k*signal.size()); for (int i = 0; i < signal.size(); i++) { mindist = std::abs(symbols(0) - signal(i)); closest = 0; for (int j = 1; j < M; j++) { dist = std::abs(symbols(j) - signal(i)); if (dist < mindist) { mindist = dist; closest = j; } } bits.replace_mid(i*k, bitmap.get_row(closest)); } } template bvec Modulator::demodulate_bits(const Vec &signal) const { bvec bits; demodulate_bits(signal, bits); return bits; } template void Modulator::demodulate_soft_bits(const Vec &rx_symbols, double N0, vec &soft_bits, Soft_Method method) const { it_assert_debug(setup_done, "Modulator::demodulate_soft_bits(): Modulator not ready."); double P0, P1, d0min, d1min, temp; vec metric(M); soft_bits.set_size(k * rx_symbols.size()); if (method == LOGMAP) { for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = std::exp(-sqr(rx_symbols(l) - symbols(j)) / N0); } for (int i = 0; i < k; i++) { P0 = P1 = 0; for (int j = 0; j < (M >> 1); j++) { P0 += metric(S0(i, j)); P1 += metric(S1(i, j)); } soft_bits(l*k + i) = trunc_log(P0) - trunc_log(P1); } } } else { // method == APPROX for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = sqr(rx_symbols(l) - symbols(j)); } for (int i = 0; i < k; i++) { d0min = d1min = std::numeric_limits::max(); for (int j = 0; j < (M >> 1); j++) { temp = metric(S0(i, j)); if (temp < d0min) { d0min = temp; } temp = metric(S1(i, j)); if (temp < d1min) { d1min = temp; } } soft_bits(l*k + i) = (-d0min + d1min) / N0; } } } } template vec Modulator::demodulate_soft_bits(const Vec &rx_symbols, double N0, Soft_Method method) const { vec output; demodulate_soft_bits(rx_symbols, N0, output, method); return output; } template void Modulator::demodulate_soft_bits(const Vec &rx_symbols, const Vec &channel, double N0, vec &soft_bits, Soft_Method method) const { it_assert_debug(setup_done, "Modulator_2D::demodulate_soft_bits(): Modulator not ready."); double P0, P1, d0min, d1min, temp; vec metric(M); soft_bits.set_size(k * rx_symbols.size()); if (method == LOGMAP) { for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = std::exp(-sqr(rx_symbols(l) - channel(l) * symbols(j)) / N0); } for (int i = 0; i < k; i++) { P0 = P1 = 0; for (int j = 0; j < (M >> 1); j++) { P0 += metric(S0(i, j)); P1 += metric(S1(i, j)); } soft_bits(l*k + i) = trunc_log(P0) - trunc_log(P1); } } } else { // method == APPROX for (int l = 0; l < rx_symbols.size(); l++) { for (int j = 0; j < M; j++) { metric(j) = sqr(rx_symbols(l) - channel(l) * symbols(j)); } for (int i = 0; i < k; i++) { d0min = d1min = std::numeric_limits::max(); for (int j = 0; j < (M >> 1); j++) { temp = metric(S0(i, j)); if (temp < d0min) { d0min = temp; } temp = metric(S1(i, j)); if (temp < d1min) { d1min = temp; } } soft_bits(l*k + i) = (-d0min + d1min) / N0; } } } } template vec Modulator::demodulate_soft_bits(const Vec &rx_symbols, const Vec &channel, double N0, Soft_Method method) const { vec output; demodulate_soft_bits(rx_symbols, channel, N0, output, method); return output; } template void Modulator::calculate_softbit_matrices() { int count0, count1; // Allocate storage space for the result matrices: S0.set_size(k, M >> 1, false); S1.set_size(k, M >> 1, false); for (int i = 0; i < k; i++) { count0 = 0; count1 = 0; for (int j = 0; j < M; j++) { if (bitmap(j, i) == bin(0)) { S0(i, count0++) = j; } else { S1(i, count1++) = j; } } } } //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Modulator; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Modulator >; //! \endcond // ---------------------------------------------------------------------- // QAM : Modulator_2D // ---------------------------------------------------------------------- /*! \ingroup modulators \brief M-ary QAM modulator with square lattice. The size of the QAM constellation is \f$M = 2^k\f$, where \f$k = 1, 2, \ldots \f$. Symbol values in each dimension are: \f$\{-(\sqrt{M}-1), \ldots, -3, -1, 1, 3, \ldots, (\sqrt{M}-1)\}\f$. The bitmap is Gray encoded. Symbols are normalized so that the average energy is 1. That is, normalized with \f$\sqrt{2(M-1)/3}\f$. Beside hard demapping, this class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits. To use it properly the received symbols should be equal to: \f[r_k = c_k s_k + n_k,\f] where \f$c_k\f$ is the real or complex channel gain, \f$s_k\f$ is the transmitted constellation symbol, and \f$n_k\f$ is the AWGN of the channel (with variance \f$N_0\f$). It is also assumed that the channel estimates are perfect when calculating the soft bits. */ class ITPP_EXPORT QAM : public Modulator > { public: //! Default Constructor QAM() {} //! Class Constructor QAM(int M) { set_M(M); } //! Destructor virtual ~QAM() { } //! Change the size of the signal constellation void set_M(int M); //! Hard demodulation of bits void demodulate_bits(const cvec& signal, bvec& bits) const; //! Hard demodulation of bits bvec demodulate_bits(const cvec& signal) const; protected: //! The square-root of M int L; //! Scaling factor of square QAM constellation (sqrt((M-1)*2/3)) double scaling_factor; }; // ---------------------------------------------------------------------- // PSK : Modulator > // ---------------------------------------------------------------------- /*! \ingroup modulators \brief M-ary PSK modulator. This class implements the M-ary PSK modulator with \f$M = 2^k\f$ constellation points, where \f$k = 1, 2, \ldots \f$. The symbol numbering is counter clockwise starting from the real axis, i.e. symbol \f$(1, 0)\f$. The bitmap is Gray encoded. The symbol energy is normalized to 1. Beside hard demapping, this class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits. To use it properly the received symbols should be equal to: \f[r_k = c_k s_k + n_k,\f] where \f$c_k\f$ is the real or complex channel gain, \f$s_k\f$ is the transmitted constellation symbol, and \f$n_k\f$ is the AWGN of the channel (with variance \f$N_0\f$). It is also assumed that the channel estimates are perfect when calculating the soft bits. */ class ITPP_EXPORT PSK : public Modulator > { public: //! Default Constructor PSK() {} //! Class constructor PSK(int M) { set_M(M); } //! Destructor virtual ~PSK() { } //! Change the size of the signal constellation void set_M(int M); //! Hard demodulation of bits void demodulate_bits(const cvec& signal, bvec& bits) const; //! Hard demodulation of bits bvec demodulate_bits(const cvec& signal) const; }; // ---------------------------------------------------------------------- // QPSK : PSK : Modulator > // ---------------------------------------------------------------------- /*! \ingroup modulators \brief QPSK modulator. This is a special version of the PSK modulator with \f$M = 4\f$ constellation points. Symbol numbering is counter clockwise starting from the real axis. Bits are Gray coded onto symbols. Symbol energy is normalized to 1. Beside hard demapping, this class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits. To use it properly the received symbols should be equal to: \f[r_k = c_k s_k + n_k,\f] where \f$c_k\f$ is the real or complex channel gain, \f$s_k\f$ is the transmitted constellation symbol, and \f$n_k\f$ is the AWGN of the channel (with variance \f$N_0\f$). It is also assumed that the channel estimates are perfect when calculating the soft bits. */ class ITPP_EXPORT QPSK : public PSK { public: //! Class Constructor QPSK(): PSK(4) {} //! Destructor virtual ~QPSK() {} /*! \brief Soft demodulator for AWGN channel This function calculates the log-MAP estimate assuming equally likely bits transmitted: \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{2 \sqrt{2}}{N_0} \Im\{r_k \exp \left(j \frac{\Pi}{4} \right) \}\f] and \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{2 \sqrt{2}}{N_0} \Re\{r_k \exp \left(j \frac{\Pi}{4} \right) \}\f] depending on the bit positon in the QPSK symbol. \param rx_symbols The received noisy constellation symbols, \f$r\f$ \param N0 The spectral density of the AWGN noise, \f$n\f$ \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const cvec& rx_symbols, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for AWGN channel vec demodulate_soft_bits(const cvec& rx_symbols, double N0, Soft_Method method = LOGMAP) const; /*! \brief Soft demodulator for a known channel in AWGN This function calculates the log-MAP estimate assuming equally likely bits transmitted: \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{2 \sqrt{2}}{N_0} \Im\{r_k c_k \exp \left(j \frac{\Pi}{4} \right) \}\f] and \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{2 \sqrt{2}}{N_0} \Re\{r_k c_k \exp \left(j \frac{\Pi}{4} \right) \}\f] depending on the bit positon in the QPSK symbol. \param rx_symbols The received noisy constellation symbols, \f$r\f$ \param channel The channel coefficients, \f$c\f$ \param N0 The spectral density of the AWGN noise, \f$n\f$ \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const cvec& rx_symbols, const cvec& channel, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for a known channel in AWGN vec demodulate_soft_bits(const cvec& rx_symbols, const cvec& channel, double N0, Soft_Method method = LOGMAP) const; }; // ---------------------------------------------------------------------- // BPSK_c : PSK : Modulator > // ---------------------------------------------------------------------- /*! \ingroup modulators \brief BPSK modulator with complex symbols. This is a special version of the PSK modulator with \f$M = 2\f$ constellation points. The following bit to symbol mapping is used: - \f$0 \rightarrow 1+0i\f$ - \f$1 \rightarrow -1+0i\f$. Beside hard demapping, this class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits. To use it properly the received symbols should be equal to: \f[r_k = c_k s_k + n_k,\f] where \f$c_k\f$ is the real or complex channel gain, \f$s_k\f$ is the transmitted constellation symbol, and \f$n_k\f$ is the AWGN of the channel (with variance \f$N_0\f$). It is also assumed that the channel estimates are perfect when calculating the soft bits. \note Although constellation points of the BPSK modulator can be represented in the real domain only, this class uses complex signals to be compatible with other PSK and QAM based modulators. \sa BPSK */ class ITPP_EXPORT BPSK_c : public PSK { public: //! Constructor BPSK_c(): PSK(2) {} //! Destructor virtual ~BPSK_c() {} //! Modulate bits into BPSK symbols in complex domain void modulate_bits(const bvec& bits, cvec& output) const; //! Modulate bits into BPSK symbols in complex domain cvec modulate_bits(const bvec& bits) const; //! Demodulate noisy BPSK symbols in complex domain into bits void demodulate_bits(const cvec& signal, bvec& output) const; //! Demodulate noisy BPSK symbols in complex domain into bits bvec demodulate_bits(const cvec& signal) const; /*! \brief Soft demodulator for AWGN channel This function calculates the log-MAP estimate assuming equally likely bits transmitted: \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{4 \Re\{r\}} {N_0}\f] \param rx_symbols The received noisy constellation symbols, \f$r\f$ (complex but symbols in real part) \param N0 The spectral density of the AWGN noise, \f$n\f$ \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const cvec& rx_symbols, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for AWGN channel vec demodulate_soft_bits(const cvec& rx_symbols, double N0, Soft_Method method = LOGMAP) const; /*! \brief Soft demodulator for a known channel in AWGN This function calculates the log-MAP estimate assuming equally likely bits transmitted: \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{4 \Re\{r c^{*}\}}{N_0}\f] \param rx_symbols The received noisy constellation symbols, \f$r\f$ (complex but symbols in real part) \param channel The channel coefficients, \f$c\f$ (complex) \param N0 The spectral density of the AWGN noise, \f$n\f$ \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const cvec& rx_symbols, const cvec& channel, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for a known channel in AWGN vec demodulate_soft_bits(const cvec& rx_symbols, const cvec& channel, double N0, Soft_Method method = LOGMAP) const; }; // ---------------------------------------------------------------------- // BPSK : Modulator // ---------------------------------------------------------------------- /*! \ingroup modulators \brief BPSK modulator with real symbols. This is a special version of the PSK modulator with \f$M = 2\f$ constellation points. The following bit to symbol mapping is used: - \f$0 \rightarrow 1\f$ - \f$1 \rightarrow -1\f$. Beside hard demapping, this class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits. To use it properly the received symbols should be equal to: \f[r_k = c_k s_k + n_k,\f] where \f$c_k\f$ is the real or complex channel gain, \f$s_k\f$ is the transmitted constellation symbol, and \f$n_k\f$ is the AWGN of the channel (with variance \f$N_0\f$). It is also assumed that the channel estimates are perfect when calculating the soft bits. \note This class uses real values for representing symbols. There is a similar class named BPSK_c, which uses complex values for symbols and therefore is compatible with other PSK and QAM based modulators. */ class ITPP_EXPORT BPSK : public Modulator { public: //! Constructor BPSK(): Modulator("1.0 -1.0", "0 1") {} //! Destructor virtual ~BPSK() {} //! Modulate bits into BPSK symbols in complex domain void modulate_bits(const bvec& bits, vec& output) const; //! Modulate bits into BPSK symbols in complex domain vec modulate_bits(const bvec& bits) const; //! Demodulate noisy BPSK symbols in complex domain into bits void demodulate_bits(const vec& signal, bvec& output) const; //! Demodulate noisy BPSK symbols in complex domain into bits bvec demodulate_bits(const vec& signal) const; /*! \brief Soft demodulator for AWGN channel This function calculates the log-MAP estimate assuming equally likely bits transmitted: \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{4 r}{N_0}\f] \param rx_symbols The received noisy constellation symbols, \f$r\f$ \param N0 The spectral density of the AWGN noise, \f$n\f$ \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const vec& rx_symbols, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for AWGN channel vec demodulate_soft_bits(const vec& rx_symbols, double N0, Soft_Method method = LOGMAP) const; /*! \brief Soft demodulator for a known channel in AWGN This function calculates the log-MAP estimate assuming equally likely bits transmitted: \f[\log \left( \frac{P(b=0|r)}{P(b=1|r)} \right) = \frac{4 \Re\{r c^{*}\}}{N_0}\f] \param rx_symbols The received noisy constellation symbols, \f$r\f$ (complex but symbols in real part) \param channel The channel coefficients, \f$c\f$ (complex) \param N0 The spectral density of the AWGN noise, \f$n\f$ \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const vec& rx_symbols, const vec& channel, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for a known channel in AWGN vec demodulate_soft_bits(const vec& rx_symbols, const vec& channel, double N0, Soft_Method method = LOGMAP) const; }; // ---------------------------------------------------------------------- // PAM_c : Modulator > // ---------------------------------------------------------------------- /*! \ingroup modulators \brief M-ary PAM modulator with complex symbols. This class implements an M-ary PAM modulator with the following signal values: \f$\{-(M-1), \ldots, -3, -1, 1, 3, \ldots, (M-1)\}\f$. Symbol numbering is from right to left in the increasing order. The Gray encoding of bits to symbols is used. The constellation symbols are normalized so that the average energy is equal to 1. That is, normalized with \f$ \sqrt{(M^2-1)/3}\f$. \note Although the constellation points can be represented in the real domain only, this class uses complex based interface to be compatible with other PSK and QAM based modulators. \sa PAM */ class ITPP_EXPORT PAM_c : public Modulator > { public: //! Default Constructor PAM_c() {} //! Constructor PAM_c(int M) { set_M(M); } //! Destructor virtual ~PAM_c() {} //! Set the size of the signal constellation void set_M(int M); //! Hard demodulation of PAM symbols in complex domain to bits void demodulate_bits(const cvec& signal, bvec& output) const; //! Hard demodulation of PAM symbols in complex domain to bits bvec demodulate_bits(const cvec& signal) const; /*! \brief Soft demodulator for AWGN channels. This function calculates the log-likelihood ratio (LLR) of the received signal from AWGN channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation: \f[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} \right) \f] or approximate, but faster calculation is performed. The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let \f$d_0 = |r_k - s_0|\f$ denote the distance to the closest zero point and \f$d_1 = |r_k - s_1|\f$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes \f[\frac{d_1^2 - d_0^2}{N_0}\f] This function can be used on channels where the channel gain \f$c = 1\f$. When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function. \param rx_symbols The received noisy constellation symbols \f$r_k\f$ (complex, but symbols are real) \param N0 The spectral density of the AWGN noise \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const cvec& rx_symbols, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for AWGN channels. virtual vec demodulate_soft_bits(const cvec& rx_symbols, double N0, Soft_Method method = LOGMAP) const; /*! \brief Soft demodulator for known fading channels. This function calculates the log-likelihood ratio (LLR) of the received signal from fading channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation: \f[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} \right) \f] or approximate, but faster calculation is performed. The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let \f$d_0 = |r_k - c_k s_0|\f$ denote the distance to the closest zero point and \f$d_1 = |r_k - c_k s_1|\f$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes \f[\frac{d_1^2 - d_0^2}{N_0}\f] When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function. \param rx_symbols The received noisy constellation symbols \f$r_k\f$ (complex) \param channel The channel values \f$c_k\f$ \param N0 The spectral density of the AWGN noise \param soft_bits The soft bits calculated using the expression above \param method The method used for demodulation (LOGMAP or APPROX) \note For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of \c Modulator_1D/\c Modulator_2D and \c Modulator_ND is not advised. */ virtual void demodulate_soft_bits(const cvec& rx_symbols, const cvec& channel, double N0, vec& soft_bits, Soft_Method method = LOGMAP) const; //! Soft demodulator for known fading channels. virtual vec demodulate_soft_bits(const cvec& rx_symbols, const cvec& channel, double N0, Soft_Method method = LOGMAP) const; protected: //! Scaling factor used to normalize the average energy to 1 double scaling_factor; }; // ---------------------------------------------------------------------- // PAM : Modulator // ---------------------------------------------------------------------- /*! \ingroup modulators \brief M-ary PAM modulator with real symbols. This class implements an M-ary PAM modulator with the following signal values: \f$\{-(M-1), \ldots, -3, -1, 1, 3, \ldots, (M-1)\}\f$. Symbol numbering is from right to left in the increasing order. The Gray encoding of bits to symbols is used. The constellation symbols are normalized so that the average energy is equal to 1. That is, normalized with \f$ \sqrt{(M^2-1)/3}\f$. \note This class uses real values for representing symbols. There is a similar class named PAM_c, which uses complex values for symbols and therefore is compatible with other PSK and QAM based modulators. */ class ITPP_EXPORT PAM : public Modulator { public: //! Default Constructor PAM() {} //! Constructor PAM(int M) { set_M(M); } //! Destructor virtual ~PAM() {} //! Set the size of the signal constellation void set_M(int M); //! Hard demodulation of PAM symbols in complex domain to bits void demodulate_bits(const vec& signal, bvec& output) const; //! Hard demodulation of PAM symbols in complex domain to bits bvec demodulate_bits(const vec& signal) const; protected: //! Scaling factor used to normalize the average energy to 1 double scaling_factor; }; } // namespace itpp #endif // #ifndef MODULATOR_H itpp-4.3.1/itpp/comm/modulator_nd.cpp000066400000000000000000001240321216575753400176160ustar00rootroot00000000000000/*! * \file * \brief Implementation of vector (MIMO) modulator classes * \author Mirsad Cirkic, Erik G. Larsson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace itpp { // ---------------------------------------------------------------------- // Modulator_ND // ---------------------------------------------------------------------- QLLRvec Modulator_ND::probabilities(QLLR l) { QLLRvec result(2); if(l < 0) { // this can be done more efficiently result(1) = -llrcalc.jaclog(0, -l); result(0) = result(1) - l; } else { result(0) = -llrcalc.jaclog(0, l); result(1) = result(0) + l; } return result; } void Modulator_ND::update_LLR(const Array &logP_apriori, int s, QLLR scaled_norm, int j, QLLRvec &p1, QLLRvec &p0) { QLLR log_apriori_prob_const_point = 0; int b = 0; for (int i = 0; i < k(j); i++) { log_apriori_prob_const_point += ((bitmap(j)(s, i) == 0) ? logP_apriori(b)(1) : logP_apriori(b)(0)); b++; } b = 0; for (int i = 0; i < k(j); i++) { if (bitmap(j)(s, i) == 0) { p1(b) = llrcalc.jaclog(p1(b), scaled_norm + log_apriori_prob_const_point); } else { p0(b) = llrcalc.jaclog(p0(b), scaled_norm + log_apriori_prob_const_point); } b++; } } void Modulator_ND::update_LLR(const Array &logP_apriori, const ivec &s, QLLR scaled_norm, QLLRvec &p1, QLLRvec &p0) { QLLR log_apriori_prob_const_point = 0; int b = 0; for (int j = 0; j < nt; j++) { for (int i = 0; i < k(j); i++) { log_apriori_prob_const_point += ((bitmap(j)(s[j], i) == 0) ? logP_apriori(b)(1) : logP_apriori(b)(0)); b++; } } b = 0; for (int j = 0; j < nt; j++) { for (int i = 0; i < k(j); i++) { if (bitmap(j)(s[j], i) == 0) { p1(b) = llrcalc.jaclog(p1(b), scaled_norm + log_apriori_prob_const_point); } else { p0(b) = llrcalc.jaclog(p0(b), scaled_norm + log_apriori_prob_const_point); } b++; } } } void Modulator_ND::marginalize_bits(itpp::QLLRvec& llr, Soft_Demod_Method method) const { if(method == FULL_ENUM_LOGMAP) { // -- Demodulate the last 3 bits. The demodulation is hardcoded // -- to avoid initialization of many but tiny inner-loops demodllrbit0(llr[0]); if(nb > 1) demodllrbit1(llr[1]); if(nb > 2) demodllrbit2(llr[2]); // -- Demodulate the remaining bits except the first one QLLR logsum0, logsum1; const QLLR *const addrfirst = Qnorms._data(); const QLLR *const addrsemilast = addrfirst + (1 << (nb - 1)), *const addrlast = addrfirst + (1 << nb); const QLLR *Qptr; for(int bi = 3; bi < nb - 1 ; bi++) { // Run the loops for bits 3,...,nb-1. logsum0 = -QLLR_MAX; logsum1 = -QLLR_MAX; const int forhalfdiff = 1 << bi, fordiff = 2 * forhalfdiff, fordbldiff = 2 * fordiff; Qptr = addrfirst; const QLLR *const addr1 = addrfirst + forhalfdiff, *const addr2 = addr1 + fordiff, *const addr3 = addrlast - fordiff; while(Qptr < addr1) logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); while(Qptr < addr2) logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); const QLLR *addrdyn0, *addrdyn1; while(Qptr < addr3) { addrdyn0 = Qptr + fordiff; addrdyn1 = Qptr + fordbldiff; while(Qptr < addrdyn0) logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); while(Qptr < addrdyn1) logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); } while(Qptr < addrlast) logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); llr[bi] = logsum0 - logsum1; } // -- Demodulate the first bit logsum0 = -QLLR_MAX; logsum1 = -QLLR_MAX; Qptr = addrfirst; while(Qptr < addrsemilast) logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); while(Qptr < addrlast) logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); llr[nb - 1] = logsum0 - logsum1; } else if(method == FULL_ENUM_MAXLOG) { // -- Demodulate the last 3 bits. The demodulation is hardcoded to // -- avoid initialization of many but tiny inner-loops. demodmaxbit0(llr[0]); if(nb > 1) demodmaxbit1(llr[1]); if(nb > 2) demodmaxbit2(llr[2]); // -- Demodulate the remaining bits except the first one QLLR logmax0, logmax1; const QLLR *const addrfirst = Qnorms._data(); const QLLR *const addrsemilast = addrfirst + (1 << (nb - 1)), *const addrlast = addrfirst + (1 << nb); const QLLR *Qptr; for(int bi = 3; bi < nb - 1; bi++) { // Run the loops for bits nb-3,nb-4,...,2. logmax0 = -QLLR_MAX; logmax1 = -QLLR_MAX; const int forhalfdiff = 1 << bi, fordiff = 2 * forhalfdiff, fordbldiff = 2 * fordiff; Qptr = addrfirst; const QLLR *const addr1 = addrfirst + forhalfdiff, *const addr2 = addr1 + fordiff, *const addr3 = addrlast - fordiff; for(; Qptr < addr1; Qptr++) logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; for(; Qptr < addr2; Qptr++) logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; const QLLR *addrdyn0, *addrdyn1; while(Qptr < addr3) { addrdyn0 = Qptr + fordiff; addrdyn1 = Qptr + fordbldiff; for(; Qptr < addrdyn0; Qptr++) logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; for(; Qptr < addrdyn1; Qptr++) logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; } for(; Qptr < addrlast; Qptr++) logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; llr[bi] = logmax0 - logmax1; } // -- Demodulate the first bit logmax0 = -QLLR_MAX; logmax1 = -QLLR_MAX; Qptr = addrfirst; for(; Qptr < addrsemilast; Qptr++) logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; for(; Qptr < addrlast; Qptr++) logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; llr[nb - 1] = logmax0 - logmax1; } else it_error("Improper soft demodulation method\n."); } void Modulator_ND::demodllrbit0(itpp::QLLR& llr) const { using namespace itpp; QLLR logsum0 = -QLLR_MAX, logsum1 = -QLLR_MAX; const QLLR *const addrfirst = Qnorms._data(), *const addr3 = addrfirst + (1 << nb) - 1; const QLLR *Qptr = addrfirst; logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); while(Qptr < addr3) { logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); } logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); llr = logsum0 - logsum1; } void Modulator_ND::demodllrbit1(itpp::QLLR& llr) const { using namespace itpp; QLLR logsum0 = -QLLR_MAX, logsum1 = -QLLR_MAX; const QLLR *const addrfirst = Qnorms._data(), *const addr3 = addrfirst + (1 << nb) - 2; const QLLR *Qptr = addrfirst; logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); while(Qptr < addr3) { logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); } logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); llr = logsum0 - logsum1; } void Modulator_ND::demodllrbit2(itpp::QLLR& llr) const { using namespace itpp; QLLR logsum0 = -QLLR_MAX, logsum1 = -QLLR_MAX; const QLLR *const addrfirst = Qnorms._data(), *const addr3 = addrfirst + (1 << nb) - 4; const QLLR *Qptr = addrfirst; logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); while(Qptr < addr3) { logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); logsum1 = llrcalc.jaclog(*(Qptr++), logsum1); } logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); logsum0 = llrcalc.jaclog(*(Qptr++), logsum0); llr = logsum0 - logsum1; } void Modulator_ND::demodmaxbit0(itpp::QLLR& maxllr) const { using namespace itpp; QLLR logmax0 = -QLLR_MAX, logmax1 = -QLLR_MAX; const QLLR *const addrfirst = Qnorms._data(), *const addr3 = addrfirst + (1 << nb) - 1; const QLLR *Qptr = addrfirst; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; while(Qptr < addr3) { logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; } logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; maxllr = logmax0 - logmax1; } void Modulator_ND::demodmaxbit1(itpp::QLLR& maxllr) const { using namespace itpp; QLLR logmax0 = -QLLR_MAX, logmax1 = -QLLR_MAX; const QLLR *const addrfirst = Qnorms._data(), *const addr3 = addrfirst + (1 << nb) - 2; const QLLR *Qptr = addrfirst; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; while(Qptr < addr3) { logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; } logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; maxllr = logmax0 - logmax1; } void Modulator_ND::demodmaxbit2(itpp::QLLR& maxllr) const { using namespace itpp; QLLR logmax0 = -QLLR_MAX, logmax1 = -QLLR_MAX; const QLLR *const addrfirst = Qnorms._data(), *const addr3 = addrfirst + (1 << nb) - 4; const QLLR *Qptr = addrfirst; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; while(Qptr < addr3) { logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; logmax1 = *Qptr > logmax1 ? *Qptr : logmax1; Qptr++; } logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; Qptr++; logmax0 = *Qptr > logmax0 ? *Qptr : logmax0; maxllr = logmax0 - logmax1; } Array Modulator_ND::probabilities(const QLLRvec &l) { Array result(length(l)); for(int i = 0; i < length(l); i++) { result(i) = probabilities(l(i)); } return result; } // ---------------------------------------------------------------------- // Modulator_NRD // ---------------------------------------------------------------------- Array Modulator_NRD::get_symbols() const { Array retvec(nt); for(int i = 0; i < nt; ++i) { it_assert(M.length() == symbols.length(), "Modulator_NRD::get_symbols(): " "The length of M vector is different than length of the symbols vector."); retvec(i) = symbols(i).left(M(i)); } return retvec; } void Modulator_NRD::modulate_bits(const bvec &bits, vec &out_symbols) const { it_assert(length(bits) == sum(k), "Modulator_NRD::modulate_bits(): " "The number of input bits does not match."); out_symbols.set_size(nt); int b = 0; for(int i = 0; i < nt; ++i) { int symb = bin2dec(bits.mid(b, k(i))); out_symbols(i) = symbols(i)(bits2symbols(i)(symb)); b += k(i); } } vec Modulator_NRD::modulate_bits(const bvec &bits) const { vec result(nt); modulate_bits(bits, result); return result; } void Modulator_NRD::init_soft_demodulator(const itpp::mat& H_in, const double& sigma2) { using namespace itpp; it_assert(H_in.cols() == nt, "Number of Tx antennas is wrong.\n"); it_assert(sum(k) < 32, "Number of total bits per transmission can not be larger than 32.\n"); it_assert(pow2i(sum(k)) == prod(M), "Modulator must use exhaustive constellations, i.e., #bits=log2(#symbs).\n"); H = H_in; bitcumsum = reverse(cumsum(reverse(k)) - reverse(k)); // Shifted cummulative sum nb = sum(k); hnorms.set_size(1 << nb); Qnorms.set_size(1 << nb); hspacings.set_size(nt); yspacings.set_size(nt); bpos2cpos.set_size(nb); gray2dec.set_size(nt); gaussnorm = 2 * sigma2; vec startsymbvec(nt); for(int ci = 0; ci < nt; ci++) startsymbvec[ci] = symbols(ci)[0]; itpp::vec Hx = H * startsymbvec; for(int ci = 0, bcs = 0; ci < nt; bcs += k[ci++]) { for(int bi = 0; bi < k[ci]; bi++) bpos2cpos[bcs + bi] = ci; gray2dec(ci).set_size(M[ci]); for(int si = 0; si < M[ci]; si++) gray2dec(ci)[si ^(si >> 1)] = si; yspacings(ci).set_size(M[ci] - 1); hspacings(ci).set_size(M[ci] - 1); for(int si = 0; si < M[ci] - 1; si++) { double xspacing = symbols(ci)[bits2symbols(ci)[(si + 1) ^((si + 1) >> 1)]]; xspacing -= symbols(ci)[bits2symbols(ci)[si ^(si >> 1)]]; hspacings(ci)(si) = H.get_col(ci) * xspacing; } } bpos2cpos = reverse(bpos2cpos); unsigned bitstring = 0, ind = 0; hxnormupdate(Hx, bitstring, ind, nb - 1); demod_initialized = true; } void Modulator_NRD::demodulate_soft_bits(const itpp::vec& y, const itpp::QLLRvec& llr_apr, itpp::QLLRvec& llr, Soft_Demod_Method method) { using namespace itpp; it_assert_debug(demod_initialized, "You have to first run init_soft_demodulator().\n"); it_assert_debug(H.rows() == y.length(), "The dimensions are not correct.\n"); it_assert_debug(llr_apr.length() == nb, "The LLR_apr length is not correct.\n"); // -- Prepare all the norms with the newly received vectory y llr.set_size(nb); llrapr = reverse(llr_apr); /* The bits are reversed due to the norm-updating functions having the rightmost bit as the least significant*/ vec ytil = H.T() * y; vec startsymbvec(nt); for(int ci = 0; ci < nt; ci++) startsymbvec[ci] = symbols(ci)[0]; double yx = 2*(ytil * startsymbvec); QLLR lapr = 0; for(int bi = 0; bi < nb; lapr -= llrcalc.jaclog(0, -llrapr[bi++])); for(int ci = 0; ci < nt; ci++) for(int si = 0; si < M[ci] - 1; si++) { double xspacing = symbols(ci)[bits2symbols(ci)[(si + 1) ^((si + 1) >> 1)]]; xspacing -= symbols(ci)[bits2symbols(ci)[si ^(si >> 1)]]; yspacings(ci)[si] = 2*(ytil(ci) * xspacing); } unsigned bitstring = 0, ind = 0; yxnormupdate(yx, lapr, bitstring, ind, nb - 1); // Recursive update of all the norms marginalize_bits(llr,method); // Perform the appropriate bit marginalization llr = reverse(llr); } void Modulator_NRD::demodulate_soft_bits(const vec &y, const mat &H, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method) { switch(method) { case ZF_LOGMAP: { it_assert(H.rows() >= H.cols(), "Modulator_NRD::demodulate_soft_bits():" " ZF demodulation impossible for undetermined systems"); // Set up the ZF detector mat Ht = H.T(); mat inv_HtH = inv(Ht * H); vec shat = inv_HtH * Ht * y; vec h = ones(shat.size()); for(int i = 0; i < shat.size(); ++i) { // noise covariance of shat double sigma_zf = std::sqrt(inv_HtH(i, i) * sigma2); shat(i) /= sigma_zf; h(i) /= sigma_zf; } demodulate_soft_bits(shat, h, 1.0, zeros_i(sum(k)), LLR_aposteriori); } break; default: { init_soft_demodulator(H, sigma2); demodulate_soft_bits(y, LLR_apriori, LLR_aposteriori, method); } } } QLLRvec Modulator_NRD::demodulate_soft_bits(const vec &y, const mat &H, double sigma2, const QLLRvec &LLR_apriori, Soft_Demod_Method method) { QLLRvec result; demodulate_soft_bits(y, H, sigma2, LLR_apriori, result, method); return result; } void Modulator_NRD::demodulate_soft_bits(const vec &y, const vec &h, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori) { it_assert(length(LLR_apriori) == sum(k), "Modulator_NRD::demodulate_soft_bits(): Wrong sizes"); it_assert((length(h) == length(y)) && (length(h) == nt), "Modulator_NRD::demodulate_soft_bits(): Wrong sizes"); // set size of the output vector LLR_aposteriori.set_size(LLR_apriori.size()); // normalisation constant "minus one over two sigma^2" double moo2s2 = -1.0 / (2.0 * sigma2); int b = 0; for(int i = 0; i < nt; ++i) { QLLRvec bnum = -QLLR_MAX * ones_i(k(i)); QLLRvec bdenom = bnum; Array logP_apriori = probabilities(LLR_apriori(b, b + k(i) - 1)); for(int j = 0; j < M(i); ++j) { double norm2 = moo2s2 * sqr(y(i) - h(i) * symbols(i)(j)); QLLR scaled_norm = llrcalc.to_qllr(norm2); update_LLR(logP_apriori, j, scaled_norm, i, bnum, bdenom); } LLR_aposteriori.set_subvector(b, bnum - bdenom); b += k(i); } } void Modulator_NRD::hxnormupdate(itpp::vec& Hx, unsigned& bitstring, unsigned& ind, unsigned bit) { using namespace itpp; const unsigned col = bpos2cpos[bit]; if(bit < 1) { hnorms[ind++] = Hx * Hx; unsigned oldi = gray2dec(col)[bitstring & (M[col] - 1)]; bitstring ^= 1; unsigned newi = gray2dec(col)[bitstring & (M[col] - 1)]; Hx += oldi > newi ? -hspacings(col)(newi) : hspacings(col)(oldi); hnorms[ind++] = Hx * Hx; return; } hxnormupdate(Hx, bitstring, ind, bit - 1); unsigned oldi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; bitstring ^= 1 << bit; unsigned newi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; Hx += oldi > newi ? -hspacings(col)(newi) : hspacings(col)(oldi); hxnormupdate(Hx, bitstring, ind, bit - 1); } void Modulator_NRD::yxnormupdate(double& yx, itpp::QLLR& lapr, unsigned& bitstring, unsigned& ind, unsigned bit) { using namespace itpp; const unsigned col = bpos2cpos[bit]; if(bit < 1) { Qnorms[ind] = llrcalc.to_qllr((yx - hnorms[ind]) / gaussnorm) + lapr; ind++; unsigned oldi = gray2dec(col)[bitstring & (M[col] - 1)]; bitstring ^= 1; unsigned newi = gray2dec(col)[bitstring & (M[col] - 1)]; yx += oldi > newi ? -yspacings(col)[newi] : yspacings(col)[oldi]; lapr += (bitstring & 1) ? -llrapr[bit] : llrapr[bit]; Qnorms[ind] = llrcalc.to_qllr((yx - hnorms[ind]) / gaussnorm) + lapr; ind++; return; } yxnormupdate(yx, lapr, bitstring, ind, bit - 1); unsigned oldi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; bitstring ^= 1 << bit; unsigned newi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; yx += oldi > newi ? -yspacings(col)[newi] : yspacings(col)[oldi]; lapr += ((bitstring >> bit) & 1) ? -llrapr[bit] : llrapr[bit]; yxnormupdate(yx, lapr, bitstring, ind, bit - 1); } std::ostream &operator<<(std::ostream &os, const Modulator_NRD &mod) { os << "--- REAL MIMO (NRD) CHANNEL ---------" << std::endl; os << "Dimension (nt): " << mod.nt << std::endl; os << "Bits per dimension (k): " << mod.k << std::endl; os << "Symbols per dimension (M):" << mod.M << std::endl; for(int i = 0; i < mod.nt; i++) { os << "Bitmap for dimension " << i << ": " << mod.bitmap(i) << std::endl; // skip printing the trailing zero os << "Symbol coordinates for dimension " << i << ": " << mod.symbols(i).left(mod.M(i)) << std::endl; } os << mod.get_llrcalc() << std::endl; return os; } // ---------------------------------------------------------------------- // Modulator_NCD // ---------------------------------------------------------------------- Array Modulator_NCD::get_symbols() const { Array retvec(nt); for(int i = 0; i < nt; ++i) { it_assert(M.length() == symbols.length(), "Modulator_NRD::get_symbols(): " "The length of M vector is different than length of the symbols vector."); retvec(i) = symbols(i).left(M(i)); } return retvec; } void Modulator_NCD::modulate_bits(const bvec &bits, cvec &out_symbols) const { it_assert(length(bits) == sum(k), "Modulator_NCD::modulate_bits(): " "The number of input bits does not match."); out_symbols.set_size(nt); int b = 0; for(int i = 0; i < nt; ++i) { int symb = bin2dec(bits.mid(b, k(i))); out_symbols(i) = symbols(i)(bits2symbols(i)(symb)); b += k(i); } } cvec Modulator_NCD::modulate_bits(const bvec &bits) const { cvec result(nt); modulate_bits(bits, result); return result; } void Modulator_NCD::init_soft_demodulator(const itpp::cmat& H_in, const double& sigma2) { using namespace itpp; it_assert_debug(H_in.cols() == nt, "The number of Tx antennas is wrong.\n"); it_assert_debug(sum(k) < 32, "Number of total bits per transmission can not be larger than 32.\n"); it_assert_debug(pow2i(sum(k)) == prod(M), "The modulater must use exhaustive constellations, i.e., #bits=log2(#symbs).\n"); H = H_in; bitcumsum = reverse(cumsum(reverse(k)) - reverse(k)); // Shifted cummulative sum nb = sum(k); hnorms.set_size(1 << nb); Qnorms.set_size(1 << nb); hspacings.set_size(nt); yspacings.set_size(nt); bpos2cpos.set_size(nb); gray2dec.set_size(nt); gaussnorm = sigma2; cvec startsymbvec(nt); for(int ci = 0; ci < nt; ci++) startsymbvec[ci] = symbols(ci)[0]; cvec Hx = H * startsymbvec; for(int ci = 0, bcs = 0; ci < nt; bcs += k[ci++]) { for(int bi = 0; bi < k[ci]; bi++) bpos2cpos[bcs + bi] = ci; gray2dec(ci).set_size(M[ci]); for(int si = 0; si < M[ci]; si++) gray2dec(ci)[si ^(si >> 1)] = si; yspacings(ci).set_size(M[ci] - 1); hspacings(ci).set_size(M[ci] - 1); for(int si = 0; si < M[ci] - 1; si++) { std::complex xspacing = symbols(ci)[bits2symbols(ci)[(si + 1) ^((si + 1) >> 1)]]; xspacing -= symbols(ci)[bits2symbols(ci)[si ^(si >> 1)]]; hspacings(ci)(si) = H.get_col(ci) * xspacing; } } bpos2cpos = reverse(bpos2cpos); unsigned bitstring = 0, ind = 0; hxnormupdate(Hx, bitstring, ind, nb - 1); demod_initialized = true; } void Modulator_NCD::demodulate_soft_bits(const itpp::cvec& y, const itpp::QLLRvec& llr_apr, itpp::QLLRvec& llr, Soft_Demod_Method method) { using namespace itpp; it_assert_debug(demod_initialized, "You have to first run init_soft_demodulator().\n"); it_assert_debug(H.rows() == y.length(), "The dimensions are not correct.\n"); it_assert_debug(llr_apr.length() == nb, "The LLR_apr length is not correct.\n"); // -- Prepare all the norms with the newly received vectory y llr.set_size(nb); llrapr = reverse(llr_apr); /* The bits are reversed due to the norm-updating functions having the rightmost bit as the least significant*/ cvec ytil = conj(H.H() * y); cvec startsymbvec(nt); for(int ci = 0; ci < nt; ci++) startsymbvec[ci] = symbols(ci)[0]; double yx = 2*(ytil * startsymbvec).real(); QLLR lapr = 0; for(int bi = 0; bi < nb; lapr -= llrcalc.jaclog(0, -llrapr[bi++])); for(int ci = 0; ci < nt; ci++) for(int si = 0; si < M[ci] - 1; si++) { std::complex xspacing = symbols(ci)[bits2symbols(ci)[(si + 1) ^((si + 1) >> 1)]]; xspacing -= symbols(ci)[bits2symbols(ci)[si ^(si >> 1)]]; yspacings(ci)[si] = 2*(ytil[ci] * xspacing).real(); } unsigned bitstring = 0, ind = 0; yxnormupdate(yx, lapr, bitstring, ind, nb - 1); // Recursive update of all the norms marginalize_bits(llr,method); llr=reverse(llr); } void Modulator_NCD::demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method) { switch(method) { case ZF_LOGMAP: { it_assert(H.rows() >= H.cols(), "Modulator_NCD::demodulate_soft_bits():" " ZF demodulation impossible for undetermined systems"); // Set up the ZF detector cmat Hht = H.H(); cmat inv_HhtH = inv(Hht * H); cvec shat = inv_HhtH * Hht * y; cvec h = ones_c(shat.size()); for(int i = 0; i < shat.size(); ++i) { double sigma_zf = std::sqrt(real(inv_HhtH(i, i)) * sigma2); shat(i) /= sigma_zf; h(i) /= sigma_zf; } demodulate_soft_bits(shat, h, 1.0, zeros_i(sum(k)), LLR_aposteriori); } break; default: { init_soft_demodulator(H, sigma2); demodulate_soft_bits(y, LLR_apriori, LLR_aposteriori, method); } } } QLLRvec Modulator_NCD::demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2, const QLLRvec &LLR_apriori, Soft_Demod_Method method) { QLLRvec result; demodulate_soft_bits(y, H, sigma2, LLR_apriori, result, method); return result; } void Modulator_NCD::demodulate_soft_bits(const cvec &y, const cvec &h, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori) { it_assert(length(LLR_apriori) == sum(k), "Modulator_NCD::demodulate_soft_bits(): Wrong sizes"); it_assert((length(h) == length(y)) && (length(h) == nt), "Modulator_NCD::demodulate_soft_bits(): Wrong sizes"); // set size of the output vector LLR_aposteriori.set_size(LLR_apriori.size()); // normalisation constant "minus one over sigma^2" double moos2 = -1.0 / sigma2; int b = 0; for(int i = 0; i < nt; ++i) { QLLRvec bnum = -QLLR_MAX * ones_i(k(i)); QLLRvec bdenom = -QLLR_MAX * ones_i(k(i)); Array logP_apriori = probabilities(LLR_apriori(b, b + k(i) - 1)); for(int j = 0; j < M(i); ++j) { double norm2 = moos2 * sqr(y(i) - h(i) * symbols(i)(j)); QLLR scaled_norm = llrcalc.to_qllr(norm2); update_LLR(logP_apriori, j, scaled_norm, i, bnum, bdenom); } LLR_aposteriori.set_subvector(b, bnum - bdenom); b += k(i); } } void Modulator_NCD::hxnormupdate(itpp::cvec& Hx, unsigned& bitstring, unsigned& ind, unsigned bit) { using namespace itpp; const unsigned col = bpos2cpos[bit]; if(bit < 1) { hnorms[ind++] = sqr(norm(Hx)); unsigned oldi = gray2dec(col)[bitstring & (M[col] - 1)]; bitstring ^= 1; unsigned newi = gray2dec(col)[bitstring & (M[col] - 1)]; Hx += oldi > newi ? -hspacings(col)(newi) : hspacings(col)(oldi); hnorms[ind++] = sqr(norm(Hx)); return; } hxnormupdate(Hx, bitstring, ind, bit - 1); unsigned oldi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; bitstring ^= 1 << bit; unsigned newi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; Hx += oldi > newi ? -hspacings(col)(newi) : hspacings(col)(oldi); hxnormupdate(Hx, bitstring, ind, bit - 1); } void Modulator_NCD::yxnormupdate(double& yx, itpp::QLLR& lapr, unsigned& bitstring, unsigned& ind, unsigned bit) { using namespace itpp; const unsigned col = bpos2cpos[bit]; if(bit < 1) { Qnorms[ind] = llrcalc.to_qllr((yx - hnorms[ind]) / gaussnorm) + lapr; //std::cerr << dec2bin(sum(k),(int)bitstring) << " " << Qnorms[ind] << " " // << llrcalc.to_qllr((2*(rec.H()*H*modulate_bits(dec2bin(sum(k),(int)bitstring)))[0].real() - hnorms[ind]) / gaussnorm) + lapr << std::endl; ind++; unsigned oldi = gray2dec(col)[bitstring & (M[col] - 1)]; bitstring ^= 1; unsigned newi = gray2dec(col)[bitstring & (M[col] - 1)]; yx += oldi > newi ? -yspacings(col)[newi] : yspacings(col)[oldi]; lapr += (bitstring & 1) ? -llrapr[bit] : llrapr[bit]; Qnorms[ind] = llrcalc.to_qllr((yx - hnorms[ind]) / gaussnorm) + lapr; ind++; return; } yxnormupdate(yx, lapr, bitstring, ind, bit - 1); unsigned oldi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; bitstring ^= 1 << bit; unsigned newi = gray2dec(col)[(bitstring >> bitcumsum[col]) & (M[col] - 1)]; yx += oldi > newi ? -yspacings(col)[newi] : yspacings(col)[oldi]; lapr += ((bitstring >> bit) & 1) ? -llrapr[bit] : llrapr[bit]; yxnormupdate(yx, lapr, bitstring, ind, bit - 1); } std::ostream &operator<<(std::ostream &os, const Modulator_NCD &mod) { os << "--- COMPLEX MIMO (NCD) CHANNEL --------" << std::endl; os << "Dimension (nt): " << mod.nt << std::endl; os << "Bits per dimension (k): " << mod.k << std::endl; os << "Symbols per dimension (M):" << mod.M << std::endl; for(int i = 0; i < mod.nt; i++) { os << "Bitmap for dimension " << i << ": " << mod.bitmap(i) << std::endl; os << "Symbol coordinates for dimension " << i << ": " << mod.symbols(i).left(mod.M(i)) << std::endl; } os << mod.get_llrcalc() << std::endl; return os; } // ---------------------------------------------------------------------- // ND_UPAM // ---------------------------------------------------------------------- ND_UPAM::ND_UPAM(int nt, int Mary) { set_M(nt, Mary); } void ND_UPAM::set_M(int nt_in, int Mary) { nt = nt_in; ivec Mary_temp(nt); Mary_temp = Mary; set_M(nt, Mary_temp); } void ND_UPAM::set_M(int nt_in, ivec Mary) { nt = nt_in; it_assert(length(Mary) == nt, "ND_UPAM::set_M(): Mary has wrong length"); k.set_size(nt); M = Mary; bitmap.set_size(nt); symbols.set_size(nt); bits2symbols.set_size(nt); spacing.set_size(nt); for(int i = 0; i < nt; i++) { k(i) = round_i(::log2(static_cast(M(i)))); it_assert((k(i) > 0) && ((1 << k(i)) == M(i)), "ND_UPAM::set_M(): M is not a power of 2."); symbols(i).set_size(M(i) + 1); bits2symbols(i).set_size(M(i)); bitmap(i) = graycode(k(i)); double average_energy = (M(i) * M(i) - 1) / 3.0; double scaling_factor = std::sqrt(average_energy); for(int j = 0; j < M(i); ++j) { symbols(i)(j) = ((M(i) - 1) - j * 2) / scaling_factor; bits2symbols(i)(bin2dec(bitmap(i).get_row(j))) = j; } // the "symbols" vector must end with a zero; only for a trick // exploited in update_norm() symbols(i)(M(i)) = 0.0; spacing(i) = 2.0 / scaling_factor; } } int ND_UPAM::sphere_search_SE(const vec &y_in, const mat &H, const imat &zrange, double r, ivec &zhat) { // The implementation of this function basically follows the // Schnorr-Eucner algorithm described in Agrell et al. (IEEE // Trans. IT, 2002), but taking into account constellation // boundaries, see the "accelerated sphere decoder" in Boutros et // al. (IEEE Globecom, 2003). No lattice reduction is performed. // Potentially the function can be speeded up by performing // lattice reduction, but it seems difficult to keep track of // constellation boundaries. mat R = chol(H.transpose() * H); mat Ri = inv(R); mat Q = H * Ri; vec y = Q.transpose() * y_in; mat Vi = Ri.transpose(); int n = H.cols(); vec dist(n); dist(n - 1) = 0; double bestdist = r * r; int status = -1; // search failed mat E = zeros(n, n); for(int i = 0; i < n; i++) { // E(k,:) = y*Vi; for(int j = 0; j < n; j++) { E(i * n + n - 1) += y(j) * Vi(j + n * i); } } ivec z(n); zhat.set_size(n); z(n - 1) = floor_i(0.5 + E(n * n - 1)); z(n - 1) = std::max(z(n - 1), zrange(n - 1, 0)); z(n - 1) = std::min(z(n - 1), zrange(n - 1, 1)); double p = (E(n * n - 1) - z(n - 1)) / Vi(n * n - 1); ivec step(n); step(n - 1) = sign_nozero_i(p); // Run search loop int k = n - 1; // k uses natural indexing, goes from 0 to n-1 while(true) { double newdist = dist(k) + p * p; if((newdist < bestdist) && (k != 0)) { for(int i = 0; i < k; i++) { E(k - 1 + i * n) = E(k + i * n) - p * Vi(k + i * n); } k--; dist(k) = newdist; z(k) = floor_i(0.5 + E(k + k * n)); z(k) = std::max(z(k), zrange(k, 0)); z(k) = std::min(z(k), zrange(k, 1)); p = (E(k + k * n) - z(k)) / Vi(k + k * n); step(k) = sign_nozero_i(p); } else { while(true) { if(newdist < bestdist) { zhat = z; bestdist = newdist; status = 0; } else if(k == n - 1) { goto exit_point; } else { k++; } z(k) += step(k); if((z(k) < zrange(k, 0)) || (z(k) > zrange(k, 1))) { step(k) = (-step(k) - sign_nozero_i(step(k))); z(k) += step(k); } if((z(k) >= zrange(k, 0)) && (z(k) <= zrange(k, 1))) { break; } } p = (E(k + k * n) - z(k)) / Vi(k + k * n); step(k) = (-step(k) - sign_nozero_i(step(k))); } } exit_point: return status; } int ND_UPAM::sphere_decoding(const vec &y, const mat &H, double rstart, double rmax, double stepup, QLLRvec &detected_bits) { it_assert(H.rows() == length(y), "ND_UPAM::sphere_decoding(): dimension mismatch"); it_assert(H.cols() == nt, "ND_UPAM::sphere_decoding(): dimension mismatch"); it_assert(rstart > 0, "ND_UPAM::sphere_decoding(): radius error"); it_assert(rmax > rstart, "ND_UPAM::sphere_decoding(): radius error"); // This function can be improved, e.g., by using an ordered search. vec ytemp = y; mat Htemp(H.rows(), H.cols()); for(int i = 0; i < H.cols(); i++) { Htemp.set_col(i, H.get_col(i)*spacing(i)); ytemp += Htemp.get_col(i) * 0.5 * (M(i) - 1.0); } imat crange(nt, 2); for(int i = 0; i < nt; i++) { crange(i, 0) = 0; crange(i, 1) = M(i) - 1; } int status = 0; double r = rstart; ivec s(sum(M)); while(r <= rmax) { status = sphere_search_SE(ytemp, Htemp, crange, r, s); if(status == 0) { // search successful detected_bits.set_size(sum(k)); int b = 0; for(int j = 0; j < nt; j++) { for(int i = 0; i < k(j); i++) { if(bitmap(j)((M(j) - 1 - s[j]), i) == 0) { detected_bits(b) = 1000; } else { detected_bits(b) = -1000; } b++; } } return status; } r = r * stepup; } return status; } // ---------------------------------------------------------------------- // ND_UQAM // ---------------------------------------------------------------------- // The ND_UQAM (MIMO with uniform QAM) class could alternatively // have been implemented by using a ND_UPAM class of twice the // dimension, but this does not fit as elegantly into the class // structure ND_UQAM::ND_UQAM(int nt, int Mary) { set_M(nt, Mary); } void ND_UQAM::set_M(int nt_in, int Mary) { nt = nt_in; ivec Mary_temp(nt); Mary_temp = Mary; set_M(nt, Mary_temp); } void ND_UQAM::set_M(int nt_in, ivec Mary) { nt = nt_in; it_assert(length(Mary) == nt, "ND_UQAM::set_M(): Mary has wrong length"); k.set_size(nt); M = Mary; L.set_size(nt); bitmap.set_size(nt); symbols.set_size(nt); bits2symbols.set_size(nt); for(int i = 0; i < nt; ++i) { k(i) = round_i(::log2(static_cast(M(i)))); it_assert((k(i) > 0) && ((1 << k(i)) == M(i)), "ND_UQAM::set_M(): M is not a power of 2"); L(i) = round_i(std::sqrt(static_cast(M(i)))); it_assert(L(i)*L(i) == M(i), "ND_UQAM: constellation M must be square"); symbols(i).set_size(M(i) + 1); bitmap(i).set_size(M(i), k(i)); bits2symbols(i).set_size(M(i)); double average_energy = (M(i) - 1) * 2.0 / 3.0; double scaling_factor = std::sqrt(average_energy); bmat gray_code = graycode(levels2bits(L(i))); for(int j1 = 0; j1 < L(i); ++j1) { for(int j2 = 0; j2 < L(i); ++j2) { symbols(i)(j1 * L(i) + j2) = std::complex(((L(i) - 1) - j2 * 2.0) / scaling_factor, ((L(i) - 1) - j1 * 2.0) / scaling_factor); bitmap(i).set_row(j1 * L(i) + j2, concat(gray_code.get_row(j1), gray_code.get_row(j2))); bits2symbols(i)(bin2dec(bitmap(i).get_row(j1 * L(i) + j2))) = j1 * L(i) + j2; } } // must end with a zero; only for a trick exploited in // update_norm() symbols(i)(M(i)) = 0.0; } } void ND_UQAM::set_constellation_points(const int nth, const cvec& inConstellation, const ivec& in_bit2symbols) { it_assert(nt > nth, "ND_UQAM::set_constellation_points(): Number of input to change is out of the size"); it_assert(inConstellation.size() == in_bit2symbols.size(), "ND_UQAM::set_constellation_points(): Number of constellation and bits2symbols does not match"); it_assert(is_even(inConstellation.size()) && (inConstellation.size() > 0), "ND_UQAM::set_constellation_points(): Number of symbols needs to be even and non-zero"); symbols(nth).replace_mid(0, inConstellation); bits2symbols(nth) = in_bit2symbols; for(int m = 0; m < M(nth); ++m) { bitmap(nth).set_row(bits2symbols(nth)(m), dec2bin(k(nth), m)); } // must end with a zero; only for a trick exploited in // update_norm() symbols(nth)(M(nth)) = 0.0; }; // ---------------------------------------------------------------------- // ND_UPSK // ---------------------------------------------------------------------- ND_UPSK::ND_UPSK(int nt, int Mary) { set_M(nt, Mary); } void ND_UPSK::set_M(int nt_in, int Mary) { nt = nt_in; ivec Mary_temp(nt); Mary_temp = Mary; set_M(nt, Mary_temp); } void ND_UPSK::set_M(int nt_in, ivec Mary) { nt = nt_in; it_assert(length(Mary) == nt, "ND_UPSK::set_M() Mary has wrong length"); k.set_size(nt); M = Mary; bitmap.set_size(nt); symbols.set_size(nt); bits2symbols.set_size(nt); for(int i = 0; i < nt; ++i) { k(i) = round_i(::log2(static_cast(M(i)))); it_assert((k(i) > 0) && ((1 << k(i)) == M(i)), "ND_UPSK::set_M(): M is not a power of 2"); symbols(i).set_size(M(i) + 1); bits2symbols(i).set_size(M(i)); bitmap(i) = graycode(k(i)); double delta = 2.0 * pi / M(i); double epsilon = delta / 10000.0; for(int j = 0; j < M(i); ++j) { std::complex symb = std::complex(std::polar(1.0, delta * j)); if(std::abs(std::real(symb)) < epsilon) { symbols(i)(j) = std::complex(0.0, std::imag(symb)); } else if(std::abs(std::imag(symb)) < epsilon) { symbols(i)(j) = std::complex(std::real(symb), 0.0); } else { symbols(i)(j) = symb; } bits2symbols(i)(bin2dec(bitmap(i).get_row(j))) = j; } // must end with a zero; only for a trick exploited in // update_norm() symbols(i)(M(i)) = 0.0; } } } // namespace itpp itpp-4.3.1/itpp/comm/modulator_nd.h000066400000000000000000000730341216575753400172700ustar00rootroot00000000000000/*! * \file * \brief Definition of vector (MIMO) modulator classes * \author Mirsad Cirkic, Erik G. Larsson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MODULATOR_ND_H #define MODULATOR_ND_H #include #include #include #include #include namespace itpp { /*! * \addtogroup modulators */ // ---------------------------------------------------------------------- // Modulator_ND // ---------------------------------------------------------------------- /*! * \ingroup modulators * \brief Base class for an N-dimensional (ND) vector (MIMO) modulator. * * See \c ND_UPAM class for examples. * * \note Can also be used for scalar modulation/demodulation as an * alternative to \c Modulator_1D or \c Modulator_2D. Mixed use of \c * Modulator_1D or \c Modulator_2D and \c Modulator_ND is not * advised. * * \note For issues relating to the accuracy of LLR computations, * please see the documentation of \c LLR_calc_unit */ class ITPP_EXPORT Modulator_ND { public: //! Soft demodulation method enum Soft_Demod_Method { //! Log-MAP demodulation by "brute-force" enumeration of all points FULL_ENUM_LOGMAP, //! Max-Log demodulation by "brute-force" enumeration of all points FULL_ENUM_MAXLOG, //! Zero-Forcing Log-MAP approximated demodulation ZF_LOGMAP }; //! Default constructor Modulator_ND(LLR_calc_unit llrcalc_in = LLR_calc_unit()): llrcalc(llrcalc_in), demod_initialized(false) {} //! Destructor virtual ~Modulator_ND() {} //! Set LLR calculation unit void set_llrcalc(LLR_calc_unit llrcalc_in) { llrcalc = llrcalc_in; }; //! Get LLR calculation unit LLR_calc_unit get_llrcalc() const { return llrcalc; } //! Get number of dimensions int get_dim() const { return nt; } //! Get number of bits per modulation symbol per dimension ivec get_k() const { return k; } //! Get number of bits per modulation symbol per dimension ivec bits_per_symbol() const { return k; } //! Get number of modulation symbols per dimension ivec get_M() const { return M; } //! Get bit pattern in decimal Array get_bits2symbols() const { return bits2symbols; } //! Get Bit mapping table Array get_bitmap() const { return bitmap; } protected: //! Number of dimensions int nt; //! Number of bits in the symbol vector int nb; //! LLR calculation unit LLR_calc_unit llrcalc; //! Number of bits per modulation symbol ivec k; //! Number of modulation symbols along each dimension ivec M; //! Flag indicating whether the demodulator has been initialized bool demod_initialized; //! Bit mapping table (one table per dimension) Array bitmap; //! Bit pattern in decimal form ordered and the corresponding symbols (one pattern per dimension) Array bits2symbols; //! The normalization factor in the exponent (in front of the square norm) in the Gaussian distribution double gaussnorm; //! Norms part dependent on H itpp::vec hnorms; //! Norms part depending on both H and y itpp::QLLRvec Qnorms; //! A prioi information itpp::QLLRvec llrapr; //! The bit to column mapping itpp::ivec bpos2cpos; //! The cumulative sum of bits in the symbol vector itpp::ivec bitcumsum; //! The Gray to decimal mapping itpp::Array > gray2dec; //! Convert LLR to log-probabilities QLLRvec probabilities(QLLR l); // some abuse of what QLLR stands for... //! Convert LLR to log-probabilities, vector version Array probabilities(const QLLRvec &l); //! Marginalize (sum) over the bits void marginalize_bits(itpp::QLLRvec& llr, Soft_Demod_Method method) const; //! Hardcoded implementation of 1:st bit demodulation void demodllrbit0(itpp::QLLR& llr) const; //! Hardcoded implementation of 2:nd bit demodulation void demodllrbit1(itpp::QLLR& llr) const; //! Hardcoded implementation of 3:rd bit demodulation void demodllrbit2(itpp::QLLR& llr) const; //! Hardcoded implementation of 1:st bit demodulation void demodmaxbit0(itpp::QLLR& maxllr) const; //! Hardcoded implementation of 2:nd bit demodulation void demodmaxbit1(itpp::QLLR& maxllr) const; //! Hardcoded implementation of 3:rd bit demodulation void demodmaxbit2(itpp::QLLR& maxllr) const; /*! * \brief Update LLR (for internal use) * * This function updates the numerator and denominator in the expression * \f[ * \log \left( \frac {\sum_{s:b_k=0} \exp(-x^2) P(s)} * {\sum_{s:b_k=1} \exp(-x^2) P(s)} \right) * \f] * * \param[in] logP_apriori Vector of a priori probabilities per bit * \param[in] s Symbol vector * \param[in] scaled_norm Argument of the exponents in the above * equation * \param[out] num Logarithm of the numerator in the above * expression * \param[out] denom Logarithm of the denominator in the above * expression */ void update_LLR(const Array &logP_apriori, const ivec &s, QLLR scaled_norm, QLLRvec &num, QLLRvec &denom); /*! * \brief Update LLR, for scalar channel (for internal use) * * This function updates the numerator and denominator in the expression * \f[ * \log \left( \frac {\sum_{s:b_k=0} \exp (-x^2) P(s)} * {\sum_{s:b_k=1} \exp (-x^2) P(s)} \right) * \f] * * \param[in] logP_apriori Vector of a priori probabilities per bit * \param[in] s Symbol * \param[in] scaled_norm Argument of the exponents in the above * equation * \param[in] j Channel index (dimension) * \param[out] num Logarithm of the numerator in the above * expression * \param[out] denom Logarithm of the denominator in the above * expression */ void update_LLR(const Array &logP_apriori, int s, QLLR scaled_norm, int j, QLLRvec &num, QLLRvec &denom); }; // ---------------------------------------------------------------------- // Modulator_NRD // ---------------------------------------------------------------------- /*! * \ingroup modulators * \brief Base class for N-dimensional vector (MIMO) channel * modulators/demodulators with real-valued components. * * This class can be used to perform modulation and demodulation for a * matrix (MIMO) channel of the form * \f[ y = Hx+e \f], * where H is the channel matrix of dimension \f$n_r\times n_t\f$, \f$y\f$ * is a received vector of length \f$n_r\f$, \f$x\f$ is a transmitted vector * of length \f$n_t\f$ and \f$e\f$ is a noise vector. * * The class supports soft-input soft-output demodulation. It can also be * used for scalar modulation to take advantage of this feature. * * Complex MIMO channels can be handled by using the \c Modulator_NCD * class. Alternatively, if the signal constellation is separable in I/Q * then the complex channel can be first transformed to a real channel * \f[ * G = \left[ \begin{array}{cc} H_r & -H_i \\ H_i & H_r \end{array} \right] * \f] * * See \c ND_UPAM for examples. * * \note For issues relating to the accuracy of LLR computations, * please see the documentation of \c LLR_calc_unit */ class ITPP_EXPORT Modulator_NRD : public Modulator_ND { public: //! Constructor Modulator_NRD() {} //! Destructor virtual ~Modulator_NRD() {} //! Get modulation symbols per dimension Array get_symbols() const; //! Modulate \c bits into \c symbols void modulate_bits(const bvec &bits, vec &symbols) const; //! Modulate \c bits vector. Symbols are returned. vec modulate_bits(const bvec &bits) const; /*! * \brief Soft MAP demodulation for multidimensional channel, by * "brute-force" enumeration of all constellation points. * * This function precomputes the norms * \f[\frac{|Hs|^2}{2\sigma^2}\f] * used to compute the LLR values * \f[ * LLR(k) = \log \left( \frac * {\sum_{s:b_k=0} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * {\sum_{s:b_k=1} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * \right) * \f] * * without approximations. It is assumed that H is * real-valued. Complex-valued channels can be handled using the \c * Modulator_NCD class. */ void init_soft_demodulator(const itpp::mat& H, const double& sigma2); /*! * \brief Soft MAP demodulation for multidimensional channel, by * "brute-force" enumeration of all constellation points. * * This function computes the LLR values * \f[ * LLR(k) = \log \left( \frac * {\sum_{s:b_k=0} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * {\sum_{s:b_k=1} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * \right) * \f] * * without approximations. It is assumed that H, y and s are * real-valued. Complex-valued channels can be handled using the \c * Modulator_NCD class. Currently the following two demodulation methods * are supported: * - FULL_ENUM_LOGMAP - exact demodulation, which use "brute-force" * enumeration of all constellation points * - FULL_ENUM_MAXLOG - max-log approximate demodulation, which use "brute-force" * enumeration to find the constellation points that give the smallest euclidian * distances * * \param[in] y Received vector * (typically \f$N_0/2\f$) * \param[in] LLR_apriori Vector of a priori LLR values per bit * \param[out] LLR_aposteriori Vector of a posteriori LLR values * \param[in] method Soft demodulation method * * The function performs an exhaustive search over all possible points * \c s in the n-dimensional constellation. This is only feasible for * relatively small constellations. The Jacobian logarithm is used to * compute the sum-exp expression. */ void demodulate_soft_bits(const vec &y, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method = FULL_ENUM_LOGMAP); /*! * \brief Soft demodulation wrapper function for various methods * * Currently the following three demodulation methods are supported: * - FULL_ENUM_LOGMAP - exact demodulation, which use "brute-force" * enumeration of all constellation points * - FULL_ENUM_MAXLOG - max-log approximate demodulation, which use "brute-force" * enumeration to find the constellation points that give the smallest euclidian * distances * - ZF_LOGMAP - approximated methods with Zero-Forcing preprocessing, * which sometimes tends to perform poorly, especially for poorly * conditioned H * * \param[in] y Received vector * \param[in] H Channel matrix * \param[in] sigma2 Noise variance per real dimension * (typically \f$N_0/2\f$) * \param[in] LLR_apriori Vector of a priori LLR values per bit * \param[out] LLR_aposteriori Vector of a posteriori LLR values * \param[in] method Soft demodulation method */ void demodulate_soft_bits(const vec &y, const mat &H, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method = FULL_ENUM_LOGMAP); /*! * \brief Soft demodulation wrapper function for various methods * * Currently the following two demodulation methods are supported: * - FULL_ENUM_LOGMAP - exact demodulation, which use "brute-force" * enumeration of all constellation points * - ZF_LOGMAP - approximated methods with Zero-Forcing preprocessing, * which sometimes tends to perform poorly, especially for poorly * conditioned H * * \param[in] y Received vector * \param[in] H Channel matrix * \param[in] sigma2 Noise variance per real dimension * (typically \f$N_0/2\f$) * \param[in] LLR_apriori Vector of a priori LLR values per bit * \param[in] method Soft demodulation method * \return Vector of a posteriori LLR values */ QLLRvec demodulate_soft_bits(const vec &y, const mat &H, double sigma2, const QLLRvec &LLR_apriori, Soft_Demod_Method method = FULL_ENUM_LOGMAP); /*! * \brief Soft MAP demodulation for parallelchannels without crosstalk. * * This function is a much faster equivalent to \c demodulate_soft_bits * with \f$H = \mbox{diag}(h)\f$. Its complexity is linear in the number * of subchannels. */ void demodulate_soft_bits(const vec &y, const vec &h, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori); //! Output some properties of the MIMO modulator (mainly to aid debugging) friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m); protected: //! Vectors of modulation symbols (along each dimension) Array symbols; /*! * \brief Update residual norm (for internal use). * * Update the residual norm \f$|y-Hs|\f$ when moving from one * constellation point to an adjacent point. * * \param[in,out] norm Norm to be updated * \param[in] k Position where s changed * \param[in] sold Old value of s[k] * \param[in] snew New value of s[k] * \param[in] ytH y'H vector * \param[in] HtH Grammian matrix H'H * \param[in] s Symbol vector */ void update_norm(double &norm, int k, int sold, int snew, const vec &ytH, const mat &HtH, const ivec &s); //! Calculation of the part of the norms that depends on H void hxnormupdate(itpp::vec& Hx, unsigned& bitstring, unsigned& ind, unsigned bit); //! Calculation of the remaining part of the norms that depends both on H and y void yxnormupdate(double& yx, itpp::QLLR& lapr, unsigned& bitstring, unsigned& ind, unsigned bit); //! Real channel matrix itpp::mat H; //! The spacing between different constellation points multiplied by the different H columns itpp::Array > hspacings; //! The spacing between different constellation points scaled by different y elements itpp::Array yspacings; }; /*! * \relatesalso Modulator_NRD * \brief Print some properties of the MIMO modulator (mainly to aid debugging) */ ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m); // ---------------------------------------------------------------------- // Modulator_NCD // ---------------------------------------------------------------------- /*! * \ingroup modulators * \brief Base class for vector (MIMO) channel modulator/demodulators * with complex valued components. * * This class is equivalent to \c Modulator_NRD except for that all * quantities are complex-valued. * * See \c ND_UPAM for examples. * * \note For issues relating to the accuracy of LLR computations, * please see the documentation of \c LLR_calc_unit */ class ITPP_EXPORT Modulator_NCD : public Modulator_ND { public: //! Constructor Modulator_NCD() {} //! Destructor virtual ~Modulator_NCD() {} //! Get modulation symbols per dimension Array get_symbols() const; //! Modulate \c bits into \c symbols void modulate_bits(const bvec &bits, cvec &symbols) const; //! Modulation of bits cvec modulate_bits(const bvec &bits) const; /*! * \brief Soft MAP demodulation for multidimensional channel, by * "brute-force" enumeration of all constellation points. * * This function computes the norms * \f[\frac{|y - Hs|^2}{2\sigma^2}\f] * used to compute the LLR values * \f[ * LLR(k) = \log \left( \frac * {\sum_{s:b_k=0} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * {\sum_{s:b_k=1} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * \right) * \f] * * without approximations. It is assumed that H is * real-valued. Complex-valued channels can be handled using the \c * Modulator_NCD class. */ void init_soft_demodulator(const itpp::cmat& H, const double& sigma2); /*! * \brief Soft MAP demodulation for multidimensional channel, by * "brute-force" enumeration of all constellation points. * * This function computes the LLR values * \f[ * LLR(k) = \log \left( \frac * {\sum_{s:b_k=0} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * {\sum_{s:b_k=1} \exp \left( -\frac{|y - Hs|^2}{2\sigma^2} \right) P(s)} * \right) * \f] * * without approximations. Currently the following two demodulation methods * are supported: * - FULL_ENUM_LOGMAP - exact demodulation, which use "brute-force" * enumeration of all constellation points * - FULL_ENUM_MAXLOG - max-log approximate demodulation, which use "brute-force" * enumeration to find the constellation points that give the smallest euclidian * distances * * \param[in] y Received vector * (typically \f$N_0/2\f$) * \param[in] LLR_apriori Vector of a priori LLR values per bit * \param[out] LLR_aposteriori Vector of a posteriori LLR values * \param[in] method Soft demodulation method * * The function performs an exhaustive search over all possible points * \c s in the n-dimensional constellation. This is only feasible for * relatively small constellations. The Jacobian logarithm is used to * compute the sum-exp expression. */ void demodulate_soft_bits(const cvec &y, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method = FULL_ENUM_LOGMAP); //! Soft demodulation wrapper function for various methods /*! * \brief Soft demodulation wrapper function for various methods * * Currently the following three demodulation methods are supported: * - FULL_ENUM_LOGMAP - exact demodulation, which use "brute-force" * enumeration of all constellation points * - FULL_ENUM_MAXLOG - max-log approximate demodulation, which use "brute-force" * enumeration to find the constellation points that give the smallest euclidian * distances * - ZF_LOGMAP - approximated methods with Zero-Forcing preprocessing, * which sometimes tends to perform poorly, especially for poorly * conditioned H * * \param[in] y Received vector * \param[in] H Channel matrix * \param[in] sigma2 Noise variance per complex dimension, * i.e. the sum of real and imaginary parts * (typically \f$N_0\f$) * \param[in] LLR_apriori Vector of a priori LLR values per bit * \param[out] LLR_aposteriori Vector of a posteriori LLR values * \param[in] method Soft demodulation method */ void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method = FULL_ENUM_LOGMAP); /*! * \brief Soft demodulation wrapper function for various methods * * Currently the following three demodulation methods are supported: * - FULL_ENUM_LOGMAP - exact demodulation, which use "brute-force" * enumeration of all constellation points * - FULL_ENUM_MAXLOG - max-log approximate demodulation, which use "brute-force" * enumeration to find the constellation points that give the smallest euclidian * distances * - ZF_LOGMAP - approximated methods with Zero-Forcing preprocessing, * which sometimes tends to perform poorly, especially for poorly * conditioned H * * \param[in] y Received vector * \param[in] H Channel matrix * \param[in] sigma2 Noise variance per complex dimension, * i.e. the sum of real and imaginary parts * (typically \f$N_0\f$) * \param[in] LLR_apriori Vector of a priori LLR values per bit * \param[in] method Soft demodulation method * \return Vector of a posteriori LLR values */ QLLRvec demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2, const QLLRvec &LLR_apriori, Soft_Demod_Method method = FULL_ENUM_LOGMAP); /*! * \brief Soft MAP demodulation for parallelchannels without crosstalk. * * This function is a much faster equivalent to \c demodulate_soft_bits * with \f$H = \mbox{diag}(h)\f$. Its complexity is linear in the number * of subchannels. */ void demodulate_soft_bits(const cvec &y, const cvec &h, double sigma2, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori); //! Print some properties of the MIMO modulator (mainly to aid debugging) friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m); protected: //! Vectors of modulation symbols (along each dimension) Array symbols; //! Complex-valued channel matrix itpp::cmat H; //! The spacing between different constellation points multiplied by the different H columns itpp::Array > hspacings; //! The spacing between different constellation points scaled by different y elements itpp::Array yspacings; void hxnormupdate(itpp::cvec& Hx, unsigned& bitstring, unsigned& ind, unsigned bit); void yxnormupdate(double& yx, itpp::QLLR& lapr, unsigned& bitstring, unsigned& ind, unsigned bit); }; /*! * \relatesalso Modulator_NCD * \brief Print some properties of the MIMO modulator (mainly to aid debugging) */ ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m); // ---------------------------------------------------------------------- // ND_UPAM // ---------------------------------------------------------------------- /*! * \ingroup modulators * \brief Real-valued MIMO channel with uniform PAM along each dimension. * * Example: (4 x 3 matrix channel with 4-PAM) * \code * ND_UPAM chan; // multidimensional channel with uniform PAM * chan.set_M(3, 4); // 3-dimensional matrix channel, 4-PAM per dimension * cout << chan << endl; * bvec b = randb(3*2); // 3*2 bits in total * vec x = chan.modulate_bits(b); * mat H = randn(4,3); // 4 x 3 real matrix channel * double sigma2 = 0.01; // noise variance per real dimension * vec y = H*x + sqrt(sigma2)*randn(4); // transmit vector x * QLLRvec llr; // log-likelihood ratios * QLLRvec llr_ap = zeros_i(3*2); // a priori equiprobable bits * chan.demodulate_soft_bits(y, H, sigma2, llr_ap, llr); * cout << "True bits:" << b << endl; * cout << "LLRs:" << chan.get_llrcalc().to_double(llr) << endl; * \endcode * * Example: (scalar channel with 8-PAM) * \code * ND_UPAM chan; * chan.set_M(1, 8); // scalar channel, 8-PAM (3 bits per symbol) * cout << chan << endl; * bvec b = randb(3); * vec x = chan.modulate_bits(b); * mat H = "1.0"; // scalar channel * double sigma2 = 0.01; * vec y= H*x + sqrt(sigma2)*randn(); // transmit vector x * QLLRvec llr; * QLLRvec llr_ap = zeros_i(3); * chan.demodulate_soft_bits(y, H, sigma2, llr_ap, llr); * cout << "True bits:" << b << endl; * cout << "LLRs:" << chan.get_llrcalc().to_double(llr) << endl; * \endcode * * \note For issues relating to the accuracy of LLR computations, * please see the documentation of \c LLR_calc_unit */ class ITPP_EXPORT ND_UPAM : public Modulator_NRD { public: //! Constructor ND_UPAM(int nt = 1, int Mary = 2); //! Destructor virtual ~ND_UPAM() {} //! Set component modulators to M-PAM with Gray mapping void set_M(int nt = 1, int Mary = 2); //! Set component modulators to M-PAM with Gray mapping, different M per component void set_M(int nt = 1, ivec Mary = "2"); /*! * \brief Sphere decoding * * This function solves the integer-constrained minimization problem * \f[ * \mbox{min} |y - Hs| * \f] * with respect to \f$s\f$ using a sphere decoding algorithm and the * Schnorr-Eucner search strategy (see the source code for further * implementation notes). The function starts with an initial search * radius and increases it with a factor (\c stepup) until the search * succeeds. * * \param[in] y received data vector (\f$n_r\times 1\f$) * \param[in] H channel matrix (\f$n_r\times n_t\f$) * \param[in] rmax maximum possible sphere radius to try * \param[in] rmin sphere radius in the first try * \param[in] stepup factor with which the sphere radius is * increased if the search fails * \param[out] detected_bits result of the search (hard decisions only, * QLLR for a sure "1" is set to 1000) * \return status of the decoding: 0 if the search suceeds, -1 otherwise */ int sphere_decoding(const vec &y, const mat &H, double rmin, double rmax, double stepup, QLLRvec &detected_bits); private: // Sphere decoding search with Schnorr Eucner strategy. int sphere_search_SE(const vec &y, const mat &H, const imat &zrange, double r, ivec &zhat); vec spacing; // spacing between the constellation points inline int sign_nozero_i(int a) { return (a > 0 ? 1 : -1); } inline int sign_nozero_i(double a) { return (a > 0.0 ? 1 : -1); } }; // ---------------------------------------------------------------------- // ND_UQAM // ---------------------------------------------------------------------- /*! * \ingroup modulators * \brief Complex MIMO channel with uniform QAM per dimension * * \note For issues relating to the accuracy of LLR computations, * please see the documentation of \c LLR_calc_unit */ class ITPP_EXPORT ND_UQAM : public Modulator_NCD { public: //! Constructor ND_UQAM(int nt = 1, int Mary = 4); //! Destructor virtual ~ND_UQAM() {} //! Set component modulators to M-QAM with Gray mapping void set_M(int nt = 1, int Mary = 4); //! Set component modulators to M-QAM with Gray mapping, different M per component void set_M(int nt = 1, ivec Mary = "4"); /*! * \brief Set the constellation points * \param[in] nth - number of antenna * \param[in] inConstellation - new constellation points * \param[in] vector of mapping transmitted data symbols (index in the vector) to constellation points (value in the vector). * *

    Example of use:

    * \code * ND_UQAM qam(1,16); //QAM-16 with Gray mapping * * //now set the new Gray mapping (a little bit different than hardcoded in it++). * qam.set_constellation_points(1, qam.get_symbols()(0), "0 1 5 4 2 3 7 6 10 11 15 14 8 9 13 12"); * * bvec bits = "0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1"; * cvec modulated_symbols = qam.modulate_bits(bits); * \endcode */ void set_constellation_points(const int nth, const cvec& inConstellation, const ivec& in_bit2symbols); protected: ivec L; //!< the square root of M }; // ---------------------------------------------------------------------- // ND_UPSK // ---------------------------------------------------------------------- /*! * \ingroup modulators * Complex MIMO channel with uniform PSK per dimension * * \note For issues relating to the accuracy of LLR computations, * please see the documentation of \c LLR_calc_unit */ class ITPP_EXPORT ND_UPSK : public Modulator_NCD { public: //! Constructor ND_UPSK(int nt = 1, int Mary = 4); //! Destructor virtual ~ND_UPSK() {} //! Set component modulators to M-QAM with Gray mapping void set_M(int nt = 1, int Mary = 4); //! Set component modulators to M-QAM with Gray mapping, different M per component void set_M(int nt = 1, ivec Mary = "4"); }; } // namespace itpp #endif // #ifndef MODULATOR_ND_H itpp-4.3.1/itpp/comm/multilateration.cpp000066400000000000000000001271121216575753400203460ustar00rootroot00000000000000/*! * \file * \brief Implementation of multilateration class for indoor localization * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #ifdef _MSC_VER #include #define isfinite _finite #endif using namespace std; namespace itpp { struct Point { double x; double y; double z; }; //class for managing a set of integers (indices) class IndexSet { public: IndexSet(unsigned int max_size) : size_(0), max_size_(max_size), data_(new unsigned int[max_size]) {} unsigned int get_size() const { return size_; } ~IndexSet() { delete[] data_; } unsigned int& operator[](unsigned int n) { return data_[n]; } unsigned int operator[](unsigned int n) const { return data_[n]; } void set_size(unsigned int size) { size_ = size; } bool exist(unsigned int elem) { bool res = false; for(unsigned int i = 0; i < size_; ++i) { if(data_[i] == elem) { res = true; break; } } return res; } bool insert(unsigned int elem) { bool res = false; if((size_ < max_size_) && (false == exist(elem))) { data_[size_++] = elem; res = true; } return res; } bool remove(unsigned int elem) { bool res = false; for(unsigned int i = 0; i < size_; ++i) { if(data_[i] == elem) { if((i + 1) < size_) { memcpy(data_ + i, data_ + i + 1, (size_ - i - 1)*sizeof(*data_)); } --size_; res = true; break; } } return res; } private: unsigned int size_; unsigned int max_size_; unsigned int *data_; }; //helper class class PosHelper { public: static double get_dist(const Point *p0, const Point *p1) { double out = 0.0; double *coord_p0 = (double*)p0; double *coord_p1 = (double*)p1; for(int n = 0; n < 3; ++n) { out += (coord_p1[n] - coord_p0[n]) * (coord_p1[n] - coord_p0[n]); } return std::sqrt(out); } static bool test_uniqueness(const Point *bs_pos, int bs_pos_len, double eps) { int i, j; for(i = bs_pos_len - 1; i >= 0; --i) { for(j = i - 1; j >= 0; --j) { if((fabs(bs_pos[i].x - bs_pos[j].x) < eps) && (fabs(bs_pos[i].y - bs_pos[j].y) < eps) && (fabs(bs_pos[i].z - bs_pos[j].z) < eps)) { it_warning("found 2 identical BSs"); return false; } } } return true; } static double det_3by3(const double mat[9]) { return mat[0] * (mat[4] * mat[8] - mat[5] * mat[7]) + mat[3] * (mat[2] * mat[7] - mat[1] * mat[8]) + mat[6] * (mat[1] * mat[5] - mat[2] * mat[4]); } static double det_4by4(const double mat[16]) { return mat[0] * mat[5] * mat[10] * mat[15] + mat[0] * mat[9] * mat[14] * mat[7] + mat[0] * mat[13] * mat[6] * mat[11] + mat[4] * mat[1] * mat[14] * mat[11] + mat[4] * mat[9] * mat[2] * mat[15] + mat[4] * mat[13] * mat[10] * mat[3] + mat[8] * mat[1] * mat[6] * mat[15] + mat[8] * mat[5] * mat[14] * mat[3] + mat[8] * mat[13] * mat[2] * mat[7] + mat[12] * mat[1] * mat[10] * mat[7] + mat[12] * mat[5] * mat[2] * mat[11] + mat[12] * mat[9] * mat[6] * mat[3] - mat[0] * mat[5] * mat[14] * mat[11] - mat[0] * mat[9] * mat[6] * mat[15] - mat[0] * mat[13] * mat[10] * mat[7] - mat[4] * mat[1] * mat[10] * mat[15] - mat[4] * mat[9] * mat[14] * mat[3] - mat[4] * mat[13] * mat[2] * mat[11] - mat[8] * mat[1] * mat[14] * mat[7] - mat[8] * mat[5] * mat[2] * mat[15] - mat[8] * mat[13] * mat[6] * mat[3] - mat[12] * mat[1] * mat[6] * mat[11] - mat[12] * mat[5] * mat[10] * mat[3] - mat[12] * mat[9] * mat[2] * mat[7]; } static bool inv_3by3(double *inv, const double *mat) { double det = det_3by3(mat); if((0 == det) || (0 == isfinite(det))) { memset(inv, 0, 9 * sizeof(*inv)); return false; } inv[0] = (mat[4] * mat[8] - mat[5] * mat[7]) / det; inv[1] = (mat[2] * mat[7] - mat[1] * mat[8]) / det; inv[2] = (mat[1] * mat[5] - mat[2] * mat[4]) / det; inv[3] = (mat[5] * mat[6] - mat[3] * mat[8]) / det; inv[4] = (mat[0] * mat[8] - mat[2] * mat[6]) / det; inv[5] = (mat[2] * mat[3] - mat[0] * mat[5]) / det; inv[6] = (mat[3] * mat[7] - mat[4] * mat[6]) / det; inv[7] = (mat[1] * mat[6] - mat[0] * mat[7]) / det; inv[8] = (mat[0] * mat[4] - mat[1] * mat[3]) / det; return true; } static bool test_noncoplanar(const Point *bs_pos, int bs_pos_len) { double mat[3 * 3]; double *coord[] = {NULL, NULL}; int i; int j; if((NULL == bs_pos) || (4 != bs_pos_len)) { it_warning("4 points are needed"); return false; } coord[0] = (double*)bs_pos; for(i = 0; i < 3; ++i) { coord[1] = (double*)(bs_pos + i + 1); for(j = 0; j < 3; ++j) { mat[i + 3 * j] = (*(coord[1] + j)) - (*(coord[0] + j)); } } return (0 != det_3by3(mat)) ? true : false; } static bool combination(unsigned int *comb_mat, unsigned int *nb_cols, unsigned int nb_rows, unsigned int len) { unsigned int idx = 0; unsigned int j, k, l, m; if((NULL == comb_mat) || (NULL == nb_cols)) { it_warning("invalid input"); return false; } if(nb_rows > len) { //it_warning("number of rows superior to total length"); return false; } switch(nb_rows) { case 5: { for(j = 1; j < len; ++j) { for(k = j + 1; k < len; ++k) { for(l = k + 1; l < len; ++l) { for(m = l + 1; m < len; ++m) { comb_mat[idx++] = 0; comb_mat[idx++] = j; comb_mat[idx++] = k; comb_mat[idx++] = l; comb_mat[idx++] = m; } } } } } break; case 4: { for(j = 1; j < len; ++j) { for(k = j + 1; k < len; ++k) { for(l = k + 1; l < len; ++l) { comb_mat[idx++] = 0; comb_mat[idx++] = j; comb_mat[idx++] = k; comb_mat[idx++] = l; } } } } break; case 3: { for(j = 1; j < len; ++j) { for(k = j + 1; k < len; ++k) { comb_mat[idx++] = 0; comb_mat[idx++] = j; comb_mat[idx++] = k; } } } break; case 2: { for(j = 1; j < len; ++j) { comb_mat[idx++] = 0; comb_mat[idx++] = j; } } break; default: it_warning("invalid nb_rows"); return false; } *nb_cols = idx / nb_rows; return true; } static unsigned int comb_nb(unsigned int n, unsigned int k) { unsigned int i; unsigned int nom = 1; unsigned int denom = 1; for(i = k + 1; i <= n; ++i) { nom *= i; } for(i = 2; i <= (n - k); ++i) { denom *= i; } return nom / denom; } static bool update_subsets(IndexSet &used_subset_idx, IndexSet &unused_subset_idx, const unsigned int *subset_idx, unsigned int subset_idx_len) { unsigned int i; bool res = true; for(i = 0; i < subset_idx_len; ++i) { if((true == used_subset_idx.insert(subset_idx[i])) && (false == unused_subset_idx.remove(subset_idx[i]))) { it_warning("cannot update subsets"); res = false; break; } } return res; } static bool store_subset(unsigned int **subsets, unsigned int *in_subset, unsigned int in_subset_len, unsigned int in_subset_idx) { bool rc = false; /* realloc memory */ *subsets = (unsigned int*)realloc(*subsets, (in_subset_idx + 1) * in_subset_len * sizeof(**subsets)); if(NULL != *subsets) { /* copy subset */ memcpy((*subsets) + in_subset_idx * in_subset_len, in_subset, in_subset_len * sizeof(*in_subset)); rc = true; } else { it_warning("cannot allocate memory"); } return rc; } }; // interface for multilateration algorithms: spherical or hyperbolic class Algorithm { public: enum GeoPos {GEO_POS_NO = 0, GEO_POS_YES, GEO_POS_EXACT}; virtual GeoPos validate(const Point *bs_pos, unsigned int bs_pos_len, const double *r) = 0; virtual bool setup(const Point *bs_pos, unsigned int bs_pos_len) = 0; /* compute an unique MS position */ virtual bool get_pos(Point *ms_pos, const double *range, unsigned int range_len) = 0; virtual void set_meas_mat(const double *meas) = 0; virtual void get_meas(double *meas, const unsigned int *bs_subset_idx, unsigned int len) = 0; virtual bool get_meas_mult_mat(const unsigned int *bs_pos_idx, unsigned int rows, unsigned int cols) = 0; virtual void get_meas_mult(unsigned int *meas_mult, const unsigned int *subset_idx, unsigned int meas_mult_len) = 0; virtual bool get_grad(double *grad, const Point *bs_pos, unsigned int bs_nb, const Point *ms_pos) = 0; virtual double* get_meas_mat() const = 0; virtual unsigned int* get_mult_mat() const = 0; virtual ~Algorithm() {} }; class Spherical : public Algorithm { public: explicit Spherical(unsigned int nb_bs); virtual ~Spherical(); virtual Algorithm::GeoPos validate(const Point *bs_pos, unsigned int bs_pos_len, const double *r); virtual bool setup(const Point *bs_pos, unsigned int bs_pos_len); virtual bool get_pos(Point *ms_pos, const double *range, unsigned int range_len); virtual void set_meas_mat(const double *meas) { memcpy(meas_mat_, meas, nb_bs_ * sizeof(*meas)); } virtual void get_meas(double *meas, const unsigned int *bs_subset_idx, unsigned int len); virtual bool get_meas_mult_mat(const unsigned int *bs_pos_idx, unsigned int rows, unsigned int cols); virtual void get_meas_mult(unsigned int *meas_mult, const unsigned int *subset_idx, unsigned int meas_mult_len); virtual bool get_grad(double *grad, const Point *bs_pos, unsigned int bs_nb, const Point *ms_pos); virtual double* get_meas_mat() const { return meas_mat_; } virtual unsigned int* get_mult_mat() const { return mult_mat_; } private: double mult_vTMw(double v[2], double M[4], double w[2]) { return w[0] * (M[0] * v[0] + M[1] * v[1]) + w[1] * (M[2] * v[0] + M[3] * v[1]); } double comp_quadratic(double *u, const double *range) { double v[10]; double scalar; int i; v[0] = u[0] = 1; v[1] = u[1] = range[0] * range[0]; v[2] = u[2] = range[1] * range[1]; v[3] = u[3] = range[2] * range[2]; v[4] = u[1] * u[1]; v[5] = u[2] * u[2]; v[6] = u[3] * u[3]; v[7] = u[1] * u[2]; v[8] = u[1] * u[3]; v[9] = u[2] * u[3]; /*could generate numerical overflows*/ scalar = xi[0] * v[0]; for(i = 1; i < 10; ++i) { scalar += xi[i] * v[i]; } return scalar; } //data members Point bs_pos_; unsigned int bs_pos_len_; double xi[10]; double Lambda[12]; double mu[6]; unsigned int nb_bs_; double *meas_mat_; unsigned int *mult_mat_; }; Spherical::Spherical(unsigned int nb_bs) : nb_bs_(nb_bs), meas_mat_(new double[nb_bs]), mult_mat_(new unsigned int [nb_bs]) { } Spherical::~Spherical() { delete[] meas_mat_; delete[] mult_mat_; } /*validate a given set of BSs and the associated measurements*/ Algorithm::GeoPos Spherical::validate(const Point *bs_pos, unsigned int bs_pos_len, const double *r) { GeoPos out = GEO_POS_NO; if(3 > bs_pos_len) { it_warning("invalid input"); return GEO_POS_NO; } if(true == Spherical::setup(bs_pos, bs_pos_len)) { double u[4];/*not used*/ double scalar = comp_quadratic(u, r); if(0 == scalar) { out = GEO_POS_EXACT; } else if((0 < scalar) && (1 == bs_pos_len_)) { out = GEO_POS_YES; } else { out = GEO_POS_NO; } } return out; } bool Spherical::setup(const Point *bs_pos, unsigned int bs_pos_len) { double S[3]; double W[4]; double detW; double invW[4]; double G[4];/*W^{-T}*W^{-1}*/ double d[2]; double rh1[2]; double a; double delta[2]; double e[2]; double lambda[4]; double w1Td; double w2Td; int i; if(3 > bs_pos_len) { it_warning("at least 3 BSs are needed"); return false; } memset(xi, 0, sizeof(xi)); memset(Lambda, 0, sizeof(Lambda)); memset(mu, 0, sizeof(mu)); bs_pos_len_ = 0; for(i = 0; i < 3; ++i) { S[i] = bs_pos[i].x * bs_pos[i].x + bs_pos[i].y * bs_pos[i].y + bs_pos[i].z * bs_pos[i].z; } W[0] = bs_pos[1].x - bs_pos[0].x; W[1] = bs_pos[2].x - bs_pos[0].x; W[2] = bs_pos[1].y - bs_pos[0].y; W[3] = bs_pos[2].y - bs_pos[0].y; detW = W[0] * W[3] - W[1] * W[2]; if(0 == detW) { //it_warning("please make sure that the 3 known points are not colinear"); return false; } invW[0] = W[3] / detW; invW[1] = -W[1] / detW; invW[2] = -W[2] / detW; invW[3] = W[0] / detW; G[0] = invW[0] * invW[0] + invW[1] * invW[1]; G[1] = invW[0] * invW[2] + invW[1] * invW[3]; G[2] = G[1]; G[3] = invW[2] * invW[2] + invW[3] * invW[3]; rh1[0] = bs_pos[0].x; rh1[1] = bs_pos[0].y; for(i = 0; i < 2; ++i) { d[i] = bs_pos[i + 1].z - bs_pos[0].z; delta[i] = S[0] - S[i + 1]; } for(i = 0; i < 2; ++i) { e[i] = 0.5 * (delta[0] * G[2 * i] + delta[1] * G[2 * i + 1]) + rh1[0] * invW[2 * i] + rh1[1] * invW[2 * i + 1]; } a = 1.0 + mult_vTMw(d, G, d); lambda[0] = -(2 * mult_vTMw(rh1, invW, d) - 2 * bs_pos[0].z + mult_vTMw(d, G, delta)) / (2 * a); lambda[1] = ((bs_pos[1].z - bs_pos[0].z) * (G[0] + G[1]) + (bs_pos[2].z - bs_pos[0].z) * (G[1] + G[3])) / (2 * a); lambda[2] = -((bs_pos[1].z - bs_pos[0].z) * G[0] + (bs_pos[2].z - bs_pos[0].z) * G[1]) / (2 * a); lambda[3] = -((bs_pos[2].z - bs_pos[0].z) * G[3] + (bs_pos[1].z - bs_pos[0].z) * G[1]) / (2 * a); xi[0] = lambda[0] * lambda[0] - (0.25 * mult_vTMw(delta, G, delta) + mult_vTMw(rh1, invW, delta) + S[0]) / a; xi[1] = 2 * lambda[0] * lambda[1] + (1 + e[0] + e[1]) / a; xi[2] = 2 * lambda[0] * lambda[2] - e[0] / a; xi[3] = 2 * lambda[0] * lambda[3] - e[1] / a; xi[4] = lambda[1] * lambda[1] - (G[0] + 2 * G[1] + G[3]) / (4 * a); xi[5] = lambda[2] * lambda[2] - G[0] / (4 * a); xi[6] = lambda[3] * lambda[3] - G[3] / (4 * a); xi[7] = 2 * lambda[1] * lambda[2] + (G[0] + G[1]) / (2 * a); xi[8] = 2 * lambda[1] * lambda[3] + (G[1] + G[3]) / (2 * a); xi[9] = 2 * lambda[2] * lambda[3] - G[1] / (2 * a); w1Td = invW[0] * d[0] + invW[2] * d[1]; w2Td = invW[1] * d[0] + invW[3] * d[1]; /*row 0*/ Lambda[0] = -w1Td * lambda[0] - (invW[0] * delta[0] + invW[2] * delta[1]) / 2; Lambda[3] = -w1Td * lambda[1] + (bs_pos[2].y - bs_pos[1].y) / (2 * detW); Lambda[6] = -w1Td * lambda[2] - (bs_pos[2].y - bs_pos[0].y) / (2 * detW); Lambda[9] = -w1Td * lambda[3] + (bs_pos[1].y - bs_pos[0].y) / (2 * detW); /*row 1*/ Lambda[1] = -w2Td * lambda[0] - (invW[1] * delta[0] + invW[3] * delta[1]) / 2; Lambda[4] = -w2Td * lambda[1] + (bs_pos[1].x - bs_pos[2].x) / (2 * detW); Lambda[7] = -w2Td * lambda[2] + (bs_pos[2].x - bs_pos[0].x) / (2 * detW); Lambda[10] = -w2Td * lambda[3] - (bs_pos[1].x - bs_pos[0].x) / (2 * detW); /*row 2*/ Lambda[2] = lambda[0]; Lambda[5] = lambda[1]; Lambda[8] = lambda[2]; Lambda[11] = lambda[3]; mu[0] = -w1Td; mu[1] = -w2Td; mu[2] = 1; mu[3] = w1Td; mu[4] = w2Td; mu[5] = -1; if(4 == bs_pos_len) { if(false == PosHelper::test_noncoplanar(bs_pos, bs_pos_len)) { //it_warning("4 noncoplanar BSs are needed"); return false; } bs_pos_ = bs_pos[3]; bs_pos_len_ = 1; } return true; } bool Spherical::get_pos(Point *ms_pos, const double *range, unsigned int range_len) { double u[4]; double scalar; int i; int j; double *coord = NULL; if(3 > range_len) { it_warning("at least 3 measurements are needed"); return false; } if(0 == bs_pos_len_) { it_warning("geo_spheric_setup needs to be called first"); return false; } scalar = comp_quadratic(u, range); if(scalar < 0) { it_warning("square root from negative number"); scalar = std::sqrt(-scalar); } else { scalar = std::sqrt(scalar); } /* first solution */ coord = (double*)ms_pos; for(j = 0; j < 3; ++j) { coord[j] = mu[j] * scalar; for(i = 0; i < 4; ++i) { coord[j] += Lambda[3 * i + j] * u[i]; } } if(0 != scalar) { double r1[2]; Point tmp_pos; /* second solution */ coord = (double*)(&tmp_pos); for(j = 0; j < 3; ++j) { coord[j] = mu[3 + j] * scalar; for(i = 0; i < 4; ++i) { coord[j] += Lambda[3 * i + j] * u[i]; } } /*smallest distance wrt the fourth measure gives the position*/ r1[0] = fabs(PosHelper::get_dist(ms_pos, &bs_pos_) - range[3]); r1[1] = fabs(PosHelper::get_dist(&tmp_pos, &bs_pos_) - range[3]); if(r1[0] > r1[1]) { *ms_pos = tmp_pos; } } return true; } void Spherical::get_meas(double *meas, const unsigned int *bs_subset_idx, unsigned int len) { unsigned int i; for(i = 0; i < len; ++i) { meas[i] = meas_mat_[bs_subset_idx[i]]; } } bool Spherical::get_meas_mult_mat(const unsigned int *bs_pos_idx, unsigned int rows, unsigned int cols) { memset(mult_mat_, 0, nb_bs_ * sizeof(*mult_mat_)); if(1 == rows) { it_warning("nothing to do"); return true; } for(unsigned int i = 0; i < (rows * cols); ++i) { if(nb_bs_ <= bs_pos_idx[i]) { return false; } ++mult_mat_[bs_pos_idx[i]]; } return true; } void Spherical::get_meas_mult(unsigned int *meas_mult, const unsigned int *subset_idx, unsigned int meas_mult_len) { for(unsigned int i = 0; i < meas_mult_len; ++i) { meas_mult[i] = mult_mat_[subset_idx[i]]; } } bool Spherical::get_grad(double *grad, const Point *bs_pos, unsigned int bs_nb, const Point *ms_pos) { double *coord_ms = NULL; double *coord_bs = NULL; double denom = 0; unsigned int n; int i; coord_ms = (double*)ms_pos; for(n = 0; n < bs_nb; ++n) { denom = PosHelper::get_dist(ms_pos, bs_pos + n); if(0 == denom) { it_warning("division by zero"); return false; } coord_bs = (double*)(bs_pos + n); /*BSn*/ for(i = 0; i < 3; ++i) { grad[i + 3 * n] = (coord_ms[i] - coord_bs[i]) / denom; } } return true; } class Hyperbolic : public Algorithm { public: explicit Hyperbolic(unsigned int nb_bs); virtual ~Hyperbolic(); virtual Algorithm::GeoPos validate(const Point *bs_pos, unsigned int bs_pos_len, const double *r); virtual bool setup(const Point *bs_pos, unsigned int bs_pos_len); virtual bool get_pos(Point *ms_pos, const double *range, unsigned int range_len); virtual void set_meas_mat(const double *meas) { memcpy(meas_mat_, meas, nb_bs_ * nb_bs_ * sizeof(*meas)); } virtual void get_meas(double *meas, const unsigned int *bs_subset_idx, unsigned int len); virtual bool get_meas_mult_mat(const unsigned int *bs_pos_idx, unsigned int rows, unsigned int cols); virtual void get_meas_mult(unsigned int *meas_mult, const unsigned int *subset_idx, unsigned int meas_mult_len); virtual bool get_grad(double *grad, const Point *bs_pos, unsigned int bs_nb, const Point *ms_pos); virtual double* get_meas_mat() const { return meas_mat_; } virtual unsigned int* get_mult_mat() const { return mult_mat_; } private: double dot_prod(const double *v, const double *w, int len) { double out = v[0] * w[0]; int i; for(i = 1; i < len; ++i) { out += v[i] * w[i]; } return out; } char comp_quadratic(double *c, double *r1, double *beta, const double *r) { double diff_range2[3]; double alpha[3]; double d, e, f; char out = 0; int i; double delta; double *coord; for(i = 0; i < 3; ++i) { diff_range2[i] = r[i] * r[i]; } coord = (double*)(bs_pos_); for(i = 0; i < 3; ++i) { c[i] = b[i] - 0.5 * dot_prod(A + 3 * i, diff_range2, 3); alpha[i] = coord[i] - c[i]; beta[i] = dot_prod(A + 3 * i, r, 3); } /* quadratic equation */ d = -1.0; e = f = 0; for(i = 0; i < 3; ++i) { d += beta[i] * beta[i]; e += 2 * alpha[i] * beta[i]; f += alpha[i] * alpha[i]; } delta = e * e - 4 * d * f; if(0 > delta) { //it_warning("square root of negative number, inverting sign"); delta = -delta; out = -1; } else if(0 < delta) { out = 1; } /* compute both solutions */ r1[0] = (-e + std::sqrt(delta)) / (2 * d); r1[1] = (-e - std::sqrt(delta)) / (2 * d); return out; } //internal data double b[3]; double A[9]; Point bs_pos_[2];/*BS 1 and 5*/ unsigned int bs_pos_len_; double *meas_mat_; unsigned int *mult_mat_; unsigned int nb_bs_; }; Hyperbolic::Hyperbolic(unsigned int nb_bs) : nb_bs_(nb_bs), meas_mat_(new double[nb_bs*nb_bs]), mult_mat_(new unsigned int[nb_bs*nb_bs]) { } Hyperbolic::~Hyperbolic() { delete[] meas_mat_; delete[] mult_mat_; } bool Hyperbolic::setup(const Point *bs_pos, unsigned int bs_pos_len) { double K[3]; double K0; double tmp[3 * 3]; int i; if((4 > bs_pos_len) || (NULL == bs_pos)) { it_warning("at least 4 BSs are needed"); return false; } memset(b, 0, sizeof(b)); memset(A, 0, sizeof(A)); memset(bs_pos_, 0, sizeof(bs_pos_)); bs_pos_len_ = 0; for(i = 0; i < 3; ++i) { tmp[i] = bs_pos[i + 1].x - bs_pos[0].x; tmp[i + 3] = bs_pos[i + 1].y - bs_pos[0].y; tmp[i + 2 * 3] = bs_pos[i + 1].z - bs_pos[0].z; } if(false == PosHelper::inv_3by3(A, tmp)) { //it_warning("base stations cannot be all in the same plane"); return false; } /*transpose as A needs to be stored row-wise*/ for(i = 0; i < 3; ++i) { tmp[3 * i] = A[i]; tmp[3 * i + 1] = A[3 + i]; tmp[3 * i + 2] = A[6 + i]; } memcpy(A, tmp, sizeof(A)); K0 = bs_pos[0].x * bs_pos[0].x + bs_pos[0].y * bs_pos[0].y + bs_pos[0].z * bs_pos[0].z; for(i = 0; i < 3; ++i) { K[i] = bs_pos[i + 1].x * bs_pos[i + 1].x + bs_pos[i + 1].y * bs_pos[i + 1].y + bs_pos[i + 1].z * bs_pos[i + 1].z - K0; } for(i = 0; i < 3; ++i) { b[i] = 0.5 * dot_prod(A + 3 * i, K, 3); } memcpy(bs_pos_, bs_pos, sizeof(bs_pos_[0])); bs_pos_len_ = 1; if(5 == bs_pos_len) { /*test that all BSs are unique*/ /*TODO: condition on 5th BS position*/ if(false == PosHelper::test_uniqueness(bs_pos, bs_pos_len, 1e-3)) { return false; } /*copy the 5th BS position*/ memcpy(bs_pos_ + 1, bs_pos + 4, sizeof(bs_pos_[1])); ++bs_pos_len_; } return true; } Algorithm::GeoPos Hyperbolic::validate(const Point *bs_pos, unsigned int bs_pos_len, const double *r) { double c[3]; double r1[2]; double beta[3]; Algorithm::GeoPos out = GEO_POS_NO; char delta_sign; if((NULL == bs_pos) || (0 == bs_pos_len) || (NULL == r)) { it_warning("invalid input"); return out; } if(true == setup(bs_pos, bs_pos_len)) { /*quadratic equation*/ delta_sign = comp_quadratic(c, r1, beta, r); /*decide if a precise location is possible*/ if(0 == delta_sign) { /* very uncommon situation */ out = GEO_POS_EXACT; } else if((0 < delta_sign) && (2 == bs_pos_len_)) { /*compute the determinant of the 4x4 matrix*/ double tmp[4 * 4]; int i; double det; for(i = 0; i < 4; ++i) { tmp[i] = bs_pos[i + 1].x - bs_pos[0].x; tmp[4 + i] = bs_pos[i + 1].y - bs_pos[0].y; tmp[2 * 4 + i] = bs_pos[i + 1].z - bs_pos[0].z; tmp[3 * 4 + i] = r[i]; } det = PosHelper::det_4by4(tmp); out = (0 != det) ? GEO_POS_YES : GEO_POS_NO; } } return out; } bool Hyperbolic::get_pos(Point *ms_pos, const double *r, unsigned int r_len) { int i, j; double c[3]; double r1[2]; double beta[3]; char delta_sign; double *coord; if((3 > r_len) || (NULL == r)) { it_warning("at least 3 measurements are needed"); return false; } if(NULL == ms_pos) { it_warning("output is NULL"); return false; } if(0 == bs_pos_len_) { it_warning("geo_hyper_setup needs to be called first"); return false; } /* quadratic equation */ delta_sign = comp_quadratic(c, r1, beta, r); /* bs_position */ if(0 == delta_sign) { /* one solution */ coord = (double*)(ms_pos); for(j = 0; j < 3; ++j) { coord[j] = c[j] - beta[j] * r1[0]; } } else { Point out[2];/* two possible solutions */ if((4 != r_len) || (2 != bs_pos_len_)) { it_warning("4 measurements from 5 BSs are needed"); return false; } /* compute both positions */ for(i = 0; i < 2; ++i) { coord = (double*)(out + i); for(j = 0; j < 3; ++j) { coord[j] = c[j] - beta[j] * r1[i]; } } /* compute TDOA distance for each solution */ for(i = 0; i < 2; ++i) { r1[i] = PosHelper::get_dist(bs_pos_ + 1, out + i) - PosHelper::get_dist(bs_pos_, out + i); r1[i] = fabs(r1[i] - r[3]); } /*smallest distance wrt the fourth measure gives the position*/ /*TODO: should put a condition on the 5th BS*/ j = (r1[0] > r1[1]); memcpy(ms_pos, out + j, sizeof(*ms_pos)); } return true; } void Hyperbolic::get_meas(double *meas, const unsigned int *bs_subset_idx, unsigned int len) { for(unsigned int i = 0; i < (len - 1); ++i) { meas[i] = meas_mat_[bs_subset_idx[i + 1] + nb_bs_ * bs_subset_idx[0]]; } } bool Hyperbolic::get_meas_mult_mat(const unsigned int *bs_pos_idx, unsigned int rows, unsigned int cols) { unsigned int i, j; memset(mult_mat_, 0, nb_bs_ * nb_bs_ * sizeof(*mult_mat_)); if(1 == rows) { it_warning("nothing to do"); return true; } for(j = 0; j < cols; ++j) { if(nb_bs_ <= bs_pos_idx[rows * j]) { return false; } for(i = 0; i < (rows - 1); ++i) { if(nb_bs_ <= bs_pos_idx[i + 1 + rows * j]) { return false; } ++mult_mat_[bs_pos_idx[i + 1 + rows * j] + nb_bs_ * bs_pos_idx[rows * j]]; } } return true; } void Hyperbolic::get_meas_mult(unsigned int *meas_mult, const unsigned int *subset_idx, unsigned int meas_mult_len) { for(unsigned int i = 0; i < meas_mult_len; ++i) { meas_mult[i] = mult_mat_[subset_idx[i + 1] + nb_bs_ * subset_idx[0]]; } } /* get gradient for the measurement function generated by the current set of BSs and the MS * By convention, the first BS is the reference BS * Output * grad: matrix 3x(bs_nb-1) stored column-wise*/ bool Hyperbolic::get_grad(double *grad, const Point *bs_pos, unsigned int bs_nb, const Point *ms_pos) { double dr[3]; double *coord_ms = NULL; double *coord_bs = NULL; double denom = 0; int i; unsigned int n; denom = PosHelper::get_dist(ms_pos, bs_pos); if(0 == denom) { it_warning("division by zero"); return false; } coord_ms = (double*)ms_pos; coord_bs = (double*)bs_pos;/*BS0*/ for(i = 0; i < 3; ++i) { dr[i] = (coord_ms[i] - coord_bs[i]) / denom; } for(n = 1; n < bs_nb; ++n) { denom = PosHelper::get_dist(ms_pos, bs_pos + n); if(0 == denom) { it_warning("division by zero"); return false; } coord_bs = (double*)(bs_pos + n); /*BSn*/ for(i = 0; i < 3; ++i) { grad[i + 3 * (n - 1)] = (coord_ms[i] - coord_bs[i]) / denom - dr[i]; } } return true; } bool Multilateration::set_method(const itpp::bvec &method) { int method_len = length(method); int n = 0; type_ = MULTI_FAILURE; method_.set_size(0); if((0 == nb_bs_) || (4 > method_len)) { it_warning("BSs positions are not set or too small method length"); return false; } method_ = method; for(n = 0; n < method_len; ++n) { if(bin(1) == method[n]) { break; } } if(n == method_len) { type_ = MULTI_SPHERICAL; goto set_algo; } for(n = 0; n < method_len; ++n) { if(bin(0) == method[n]) { break; } } if(n == method_len) { type_ = MULTI_HYPERBOLIC; goto set_algo; } type_ = MULTI_HYBRID; set_algo: //set algorithm if(NULL != algo_) { delete algo_; } switch(type_) { case MULTI_HYPERBOLIC: if((method_len + 1) != nb_bs_) { it_warning("For hyperbolic multilateration the number of BSs should exceed by one the number of measures"); return false; } algo_ = new Hyperbolic(nb_bs_); break; case MULTI_HYBRID: if((method_len + 1) != nb_bs_) { it_warning("For hybrid multilateration the number of BSs should exceed by one the number of measures"); return false; } algo_ = new Spherical(nb_bs_ - 1); /* after conversion the number of BSs is reduced by one */ break; case MULTI_SPHERICAL: if(method_len != nb_bs_) { it_warning("For spherical multilateration the number of BSs should equal the number of measures"); return false; } algo_ = new Spherical(nb_bs_); break; default: it_warning("unknown multilateration method"); algo_ = NULL; } nb_fails_part = nb_fails_pos = 0; return (NULL != algo_) ? true : false; } bool Multilateration::set_bs_pos(const itpp::mat &bs_pos) { int rows = bs_pos.rows(); int cols = bs_pos.cols(); if(((3 != cols) && (3 != rows)) || (cols == rows)) { it_warning("BS positions should be specified in 3D cartezian coordinates on either columns or rows"); return false; } nb_bs_ = (3 == cols) ? rows : cols; if(NULL != bs_pos_) { delete[] bs_pos_; } bs_pos_ = new Point[nb_bs_]; unsigned int n = 0; if(3 == cols) { for(n = 0; n < nb_bs_; ++n) { bs_pos_[n].x = bs_pos(n, 0); bs_pos_[n].y = bs_pos(n, 1); bs_pos_[n].z = bs_pos(n, 2); } } else if(3 == rows) { for(n = 0; n < nb_bs_; ++n) { bs_pos_[n].x = bs_pos(0, n); bs_pos_[n].y = bs_pos(1, n); bs_pos_[n].z = bs_pos(2, n); } } return true; } Multilateration::~Multilateration() { delete algo_; delete bs_pos_; } bool Multilateration::get_pos(itpp::vec &ms_pos, const double *measures) { unsigned int *subsets_idx = NULL; unsigned int subsets_nb = 0; unsigned int subset_len = 0; Point *tmp_bs_pos = NULL; Point *bs_pos = bs_pos_; unsigned int nb_bs = nb_bs_; bool out = false; const int method_len = length(method_); Point tmp_ms_pos; if((0 == method_len) || (NULL == bs_pos_) || (0 == nb_bs_) || (NULL == algo_)) { return false; } algo_->set_meas_mat(measures); switch(type_) { case MULTI_HYPERBOLIC: subset_len = 5; break; case MULTI_HYBRID: tmp_bs_pos = (Point*)malloc(nb_bs_ * sizeof(*tmp_bs_pos)); memcpy(tmp_bs_pos, bs_pos_, nb_bs_ * sizeof(*tmp_bs_pos)); if(false == hybrid2spherical(tmp_bs_pos, algo_->get_meas_mat())) { goto exit; } bs_pos = tmp_bs_pos;/* BS position might be changed after conversion */ /* from this point on we deal with spherical multilateration (the number of BSs is reduced by one) */ --nb_bs; /* fall through */ case MULTI_SPHERICAL: subset_len = 4; break; default: (void)0; } /*ML algorithm*/ if((false == partition(&subsets_idx, &subsets_nb, bs_pos, nb_bs, subset_len)) || (0 == subsets_nb)) { ++nb_fails_part; } if(0 != subsets_nb) { if(false == algo_->get_meas_mult_mat(subsets_idx, subset_len, subsets_nb)) { goto exit; } if(false == get_ml_pos(&tmp_ms_pos, bs_pos, nb_bs, subsets_idx, subsets_nb, subset_len)) { ++nb_fails_pos; } else { ms_pos.set_size(3); ms_pos(0) = tmp_ms_pos.x; ms_pos(1) = tmp_ms_pos.y; ms_pos(2) = tmp_ms_pos.z; } } out = (0 != subsets_nb) ? true : false; exit: /* free subsets_idx */ if(NULL != subsets_idx) { free(subsets_idx); subsets_idx = NULL; } /* free temporary array of BS positions */ if(NULL != tmp_bs_pos) { free(tmp_bs_pos); tmp_bs_pos = NULL; } return out; } bool Multilateration::hybrid2spherical(Point *bs_pos, double *meas) { int n; int k; Point *out_bs_pos = NULL; double *out_meas = NULL; int method_len = length(method_); static const bin zero = bin(0); if((4 > method_len) || (NULL == bs_pos) || (NULL == meas)) { return false; } if(MULTI_SPHERICAL == type_) { return true;/* no conversion is needed */ } /* find first TOA measure */ for(n = 0; n < method_len; ++n) { if(zero == method_[n]) { break; } } if(n == method_len) { return false;/* no TOA measure (must be hyperbolic multilateration) */ } out_bs_pos = (Point*)malloc(method_len * sizeof(*out_bs_pos)); if(NULL == out_bs_pos) { return false; } out_meas = (double*)malloc(method_len * sizeof(*out_meas)); if(NULL == out_meas) { free(out_bs_pos); return false; } if(0 == n) { /* BS_0 is used for TOA */ out_meas[0] = meas[0]; out_bs_pos[0] = bs_pos[0]; for(k = 1; k < method_len; ++k) { if(zero == method_[k]) { out_bs_pos[k] = bs_pos[k]; out_meas[k] = meas[k]; } else { out_meas[k] = meas[k] + out_meas[0]; out_bs_pos[k] = bs_pos[k + 1]; } } } else { /* BS_n is used for TOA */ int idx = 1; out_meas[0] = meas[n] - meas[n - 1]; out_bs_pos[0] = bs_pos[0]; for(k = 0; k < method_len; ++k) { if((n - 1) == k) { continue; /* skip this measure */ } if(zero == method_[k]) { out_bs_pos[idx] = bs_pos[k]; out_meas[idx] = meas[k]; } else { out_bs_pos[idx] = bs_pos[k + 1]; out_meas[idx] = meas[k] + out_meas[0]; } ++idx; } } /* copy to output */ for(k = 0; k < method_len; ++k) { bs_pos[k] = out_bs_pos[k]; meas[k] = out_meas[k]; } free(out_bs_pos); free(out_meas); return true; } bool Multilateration::partition(unsigned int **subsets_idx, unsigned int *subsets_nb, const Point *bs_pos, unsigned int nb_bs, unsigned int subset_len) { unsigned int nb_avail_bs = nb_bs; unsigned int *comb_mat = NULL; unsigned int nb_comb = 0; unsigned int i = 0; unsigned int n = 0; unsigned int k = 0; Point bs_pos_subset[5];/*enough for both hyperbolic and spherical trilateration*/ unsigned int *bs_subset_idx = NULL; double meas[4]; char subset_found = 0; int valid_res = Algorithm::GEO_POS_NO; bool res = true; if((nb_avail_bs < subset_len) || (NULL == subsets_idx) || (NULL == subsets_nb) || (NULL == bs_pos)) { it_warning("invalid input"); return false; } *subsets_idx = NULL;/* make sure that the output is freed properly */ *subsets_nb = 0; /* init subsets */ IndexSet unused_subset_idx(nb_avail_bs); for(n = 0; n < nb_avail_bs; ++n) { unused_subset_idx[n] = n; } unused_subset_idx.set_size(nb_avail_bs); IndexSet used_subset_idx(nb_avail_bs);//size is zero nb_comb = PosHelper::comb_nb(nb_avail_bs - 1, subset_len - 1); comb_mat = (unsigned int*)malloc(subset_len * nb_comb * sizeof(*comb_mat)); if(NULL == comb_mat) { it_warning("cannot allocate memory"); return false; } bs_subset_idx = (unsigned int*)malloc(subset_len * sizeof(*bs_subset_idx)); if(NULL == bs_subset_idx) { free(comb_mat); it_warning("cannot allocate memory"); return false; } /*main loop*/ subset_found = 0; while((0 != unused_subset_idx.get_size()) && (nb_avail_bs >= subset_len)) { /* check the unused set */ if(false == PosHelper::combination(comb_mat, &nb_comb, subset_len, unused_subset_idx.get_size())) { //it_warning("error in PosHelper::combination"); /* no error here */ goto combine_both; } n = 0; while(n < nb_comb) { for(i = 0; i < subset_len; ++i) { bs_subset_idx[i] = unused_subset_idx[comb_mat[i + n * subset_len]]; bs_pos_subset[i] = bs_pos[bs_subset_idx[i]]; } algo_->get_meas(meas, bs_subset_idx, subset_len); valid_res = algo_->validate(bs_pos_subset, subset_len, meas); if((Algorithm::GEO_POS_EXACT == valid_res) || (Algorithm::GEO_POS_YES == valid_res)) { /*store the subset*/ if(false == PosHelper::store_subset(subsets_idx, bs_subset_idx, subset_len, *subsets_nb)) { it_warning("error in geo_pos_store_subset"); res = false; break; } /*update used and unused sets*/ if(false == PosHelper::update_subsets(used_subset_idx, unused_subset_idx, bs_subset_idx, subset_len)) { it_warning("error in geo_pos_update_subsets"); res = false; break; } /*increment index*/ ++(*subsets_nb); /* next iteration */ n = 0; if(false == PosHelper::combination(comb_mat, &nb_comb, subset_len, unused_subset_idx.get_size())) { /* no error code here, continue the algorithm */ break; } continue;/*restart to iterate through new combinations set*/ } ++n; } if((0 == unused_subset_idx.get_size()) || (false == res)) { break; } /* combine unused and used sets */ combine_both: if(false == PosHelper::combination(comb_mat, &nb_comb, subset_len, nb_avail_bs)) { it_warning("error in geo_pos_combination"); res = false;/* should not fail at this point */ break; } for(n = 0; n < nb_comb; ++n) { if(comb_mat[subset_len - 1 + subset_len * n] < unused_subset_idx[0]) { /* TODO: check for correctness */ continue;/*skip already searched sets*/ } for(i = 0; i < subset_len; ++i) { k = comb_mat[i + n * subset_len]; if(k < unused_subset_idx.get_size()) { bs_subset_idx[i] = unused_subset_idx[k]; } else { /* ensure that recently added BSs are used first */ bs_subset_idx[i] = used_subset_idx[used_subset_idx.get_size() - 1 - (k - unused_subset_idx.get_size())]; } bs_pos_subset[i] = bs_pos[bs_subset_idx[i]]; } algo_->get_meas(meas, bs_subset_idx, subset_len); valid_res = algo_->validate(bs_pos_subset, subset_len, meas); if((Algorithm::GEO_POS_EXACT == valid_res) || (Algorithm::GEO_POS_YES == valid_res)) { /*store the subset*/ if(false == PosHelper::store_subset(subsets_idx, bs_subset_idx, subset_len, *subsets_nb)) { it_warning("error in geo_pos_store_subset"); res = false; break; } /*update used and unused sets*/ if(false == PosHelper::update_subsets(used_subset_idx, unused_subset_idx, bs_subset_idx, subset_len)) { it_warning("error in geo_pos_update_subsets"); res = false; break; } /*increment index*/ ++(*subsets_nb); /* stop after finding a subset */ subset_found = 1; break; } } if((0 == unused_subset_idx.get_size()) || (false == res)) { break; } /* remove first BS if no subset found */ if(0 == subset_found) { res = false; //it_warning("no subset found"); if(false == unused_subset_idx.remove(unused_subset_idx[0])) { it_warning("error in utils_set_remove"); break; } --nb_avail_bs; } else { subset_found = 0; } } free(comb_mat); free(bs_subset_idx); return res; } bool Multilateration::get_bs_pos_subset(Point *bs_pos_subset, const Point *bs_pos, unsigned int nb_bs, const unsigned int *subset_idx, unsigned int subset_len) { unsigned int i; unsigned int k; for(i = 0; i < subset_len; ++i) { k = subset_idx[i]; if(nb_bs <= k) { it_warning("index out of range"); return false; } bs_pos_subset[i] = bs_pos[k]; } return true; } bool Multilateration::get_ml_pos(Point *ms_pos, const Point *bs_pos, unsigned int nb_bs, const unsigned int *subsets_idx, unsigned int subsets_nb, unsigned int subset_len) { Point bs_pos_subset[5]; double meas[4]; unsigned int meas_mult[4]; double grad[3 * 4]; double nom[3]; double denom[9]; double coeff[9]; unsigned int n; int k; int i; double *coord = NULL; bool res = false; if((NULL == bs_pos) || (0 == nb_bs) || (NULL == subsets_idx) || (0 == subsets_nb) || (0 == subset_len) || (NULL == ms_pos)) { it_warning("invalid input"); return false; } if(1 != subsets_nb) { memset(nom, 0, sizeof(nom)); memset(denom, 0, sizeof(denom)); } for(n = 0; n < subsets_nb; ++n) { /* compute MS position from current subset */ if(false == get_bs_pos_subset(bs_pos_subset, bs_pos, nb_bs, subsets_idx + n * subset_len, subset_len)) { goto exit; } if(false == algo_->setup(bs_pos_subset, subset_len)) { it_warning("error in geo_hyper_setup"); goto exit; } algo_->get_meas(meas, subsets_idx + n * subset_len, subset_len); if(false == algo_->get_pos(ms_pos, meas, 4)) { it_warning("error in geo_hyper_get_pos"); goto exit; } if(1 == subsets_nb) { res = true; goto exit; } /* coefficient estimation */ if(false == algo_->get_grad(grad, bs_pos_subset, subset_len, ms_pos)) { it_warning("error in geo_hyper_get_grad"); goto exit; } algo_->get_meas_mult(meas_mult, subsets_idx + n * subset_len, 4); if(false == prod(coeff, grad, meas_mult, 3, 4)) { it_warning("error in geo_hyper_get_grad"); goto exit; } /*nominator and denominator for the ML estimator*/ coord = (double*)ms_pos; for(k = 0; k < 3; ++k) { for(i = 0; i < 3; ++i) { nom[k] += coeff[k + 3 * i] * coord[i]; denom[k + 3 * i] += coeff[k + 3 * i]; } } } /*ML estimator from several subsets*/ if(true == PosHelper::inv_3by3(coeff, denom)) { coord = (double*)ms_pos; for(n = 0; n < 3; ++n) { coord[n] = 0; for(k = 0; k < 3; ++k) { coord[n] += coeff[n + 3 * k] * nom[k]; } } res = true; } exit: return res; } bool Multilateration::prod(double *out, const double *AT, const unsigned int *d, unsigned int cols, unsigned int rows) { unsigned int i; unsigned int n; unsigned int k; if((NULL == out) || (NULL == AT) || (NULL == d) || (0 == cols) || (0 == rows)) { it_warning("invalid input"); return false; } for(i = 0; i < cols; ++i) { /* each line first input */ for(n = 0; n < cols; ++n) { /* each column of the second input */ out[i + cols * n] = 0.0; for(k = 0; k < rows; ++k) { /* each column of the first input or each row of the second input */ if(0 == d[k]) { it_warning("division by zero"); return false; } out[i + cols * n] += (AT[i + k * cols] / (double)d[k]) * AT[n + k * cols]; } } } return true; } double Multilateration::get_crlb(const vec &ms_pos, double sigma2) { if((3 != length(ms_pos)) || (0 == nb_bs_)) { it_error("invalid input"); } if(0.0 == sigma2) { return 0.0; } vec pos(3); vec pos_ref(3); pos_ref(0) = bs_pos_[0].x; pos_ref(1) = bs_pos_[0].y; pos_ref(2) = bs_pos_[0].z; static const bin zero = bin(0); const unsigned int method_len = length(method_); mat dh(3, method_len); dh.zeros(); unsigned int n; unsigned int i; for(n = 0; n < method_len; ++n) { if(zero == method_(n)) { pos(0) = bs_pos_[n].x; pos(1) = bs_pos_[n].y; pos(2) = bs_pos_[n].z; for(i = 0; i < 3; ++i) { dh(i, n) = (ms_pos(i) - pos(i)) / std::sqrt(sum_sqr(ms_pos - pos)); } } else { pos(0) = bs_pos_[n + 1].x; pos(1) = bs_pos_[n + 1].y; pos(2) = bs_pos_[n + 1].z; for(i = 0; i < 3; ++i) { dh(i, n) = (ms_pos(i) - pos(i)) / std::sqrt(sum_sqr(ms_pos - pos)) - (ms_pos(i) - pos_ref(i)) / std::sqrt(sum_sqr(ms_pos - pos_ref)); } } } mat info_mat(3, 3); for(n = 0; n < 3; ++n) { for(i = 0; i < 3; ++i) { info_mat(n, i) = dh.get_row(n) * dh.get_row(i); } } info_mat = info_mat / sigma2; return std::sqrt(sum(diag(inv(info_mat)))); } } itpp-4.3.1/itpp/comm/multilateration.h000066400000000000000000000235451216575753400200200ustar00rootroot00000000000000/*! * \file * \brief Definition of multilateration class for indoor localization * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MULTILATERATION_H #define MULTILATERATION_H #include #include namespace itpp { class Algorithm; struct Point; /*! \ingroup misccommfunc \brief %Multilateration class for 3D indoor localization Implements geometry-based methods for indoor localization: - spherical multilateration (which uses Time Of Arrival (TOA) ranging techniques), - hyperbolic multilateration (using Time Difference Of Arrival (TDOA)) and - hybrid multilateration (both TOA and TDOA are used) In addition, it allows to compute the theoretical performance of the algorithm based on Cramer Rao Lower Bound (CRLB). Geometry-based methods for indoor localization use several Base Stations (BSs), whose position is known, in order to compute the position of the Mobile Station (MS). By computing the distance to each BS (TOA ranging) or the difference between the distances to two BSs (TDOA) a system of non-linear equations is obtained that allows to compute the MS position. At least 4 measures (TOA or TDOA) are needed in order to obtain a determinate equation system. The algorithm implemented in this class can handle any number of measures (at least four) by using an asymptotic Maximum Likelihood (ML) estimator [1]. The input of the algorithm is represented by a method vector, specifying the type of each ranging measure (0 for TOA and 1 for TDOA), a matrix with BSs positions and a vector (for spherical and hybrid) or a matrix (for hyperbolic multilateration) with the ranging measures. The output is a vector of length 3 with the position of the MS in 3D cartezian coordinates. Note that for hybrid multilateration the method vector should have at least a one and a zero, for spherical multilateration the method vector is all zeros, while for hyperbolic multilateration is all ones. The CRLB is computed as the Euclidean distance between the estimated position of the MS and the true MS position. The noise variance is needed as input together with the true MS position. It is assumed that the noise affecting the measures has the same variance for all measures. Usage example: \code Multilateration multi; bvec method(4); method.zeros();//spherical multilateration mat bs_pos = randn(3, 4);//four BSs multi.setup(method, bs_pos); vec measures(4); //measures are generated following TOA ranging method (see unit tests file for an example) vec ms_pos;//algorithm output bool rc = multi.get_pos(ms_pos, measures);//algorithm has failed if the output is false \endcode Reference: [1] Urruela, A. and Riba, J. - Novel closed-form ML position estimator for hyperbolic location, ICASSP'04 */ class ITPP_EXPORT Multilateration { public: //! %Multilateration types as detected from user input (method binary vector) enum Type {MULTI_FAILURE = -1, //!< the algorithm has failed MULTI_SPHERICAL, //!< spherical multilateration MULTI_HYPERBOLIC, //!< hyperbolic multilateration MULTI_HYBRID //!< hybrid multilateration }; //! %Multilateration class default constructor Multilateration() : algo_(NULL), nb_fails_part(0), nb_fails_pos(0), type_(MULTI_FAILURE), method_(itpp::bvec()), bs_pos_(NULL), nb_bs_(0) {} //! %Multilateration class constructor /*! The BS positions are specified as a matrix, each BS position can be specified on either rows or columns. * The method vector specify the measure type: 0 for TOA or 1 for TDOA. For example, a vector with all zeros represents * spherical multilateration, while a vector with all ones represents hyperbolic multilateration. * * For spherical multilateration the number of BSs and the method length must be equal. * For hybrid and hyperbolic multilateration the number of BSs must be the method length plus one. */ Multilateration(const itpp::bvec &method, //!< multilateration method const itpp::mat &bs_pos //!< base station positions in 3D cartezian coordinates ) : algo_(NULL), nb_fails_part(0), nb_fails_pos(0), type_(MULTI_FAILURE), method_(itpp::bvec()), bs_pos_(NULL), nb_bs_(0) { setup(method, bs_pos); } //! %Multilateration destructor virtual ~Multilateration(); //! Setup function for specifying the multilateration method and the base station positions /*! The BS positions are specified as a matrix, each BS position can be specified on either rows or columns. * The method vector specify the measure type: O for TOA or 1 for TDOA. A vector with all zeros represents * spherical multilateration, while a vector with all ones represents hyperbolic multilateration. * * For spherical multilateration the number of BSs and the method lenght must be equal and it must also equal * the length of the measures vector. * * For hybrid and hyperbolic multilateration the number of BSs must be the method length plus one. */ void setup(const itpp::bvec &method, //!< multilateration method const itpp::mat &bs_pos //!< base station positions ) { if((false == set_bs_pos(bs_pos)) || (false == set_method(method))) { it_error("cannot init multilateration"); } } //! Computes the mobile station position for spherical and hybrid multilateration /*! For spherical multilateration the vector of measures should be generated as follows: * \f[ measures(i) = dist(bs\_pos(i), ms\_pos) \f] * where \f$ dist() \f$ is the Euclidean distance between two points in 3D cartezian coordinates. * * For hybrid multilateration the vector of measures is generated as: * - if \f$ 1 == method(i) \f$ (TDOA ranging measure) * \f[ measures(i) = dist(bs\_pos(i+1), ms\_pos)-dist(bs\_pos(0), ms\_pos) \f] * - if \f$ 0 == method(i) \f$ (TOA ranging measure) * \f[ measures(i) = dist(bs\_pos(i), ms\_pos) \f] */ bool get_pos(itpp::vec &ms_pos, //!< output with mobile station position in 3D cartezian coordinates const itpp::vec &measures //!< vector with ranging measures ) { return get_pos(ms_pos, measures._data()); } //! Computes the mobile station position for hyperbolic multilateration /*! The matrix of measures is computed as follows: * \f[ measures(i,j) = dist(bs\_pos(i), ms\_pos)-dist(bs\_pos(j), ms\_pos) \f] * where \f$ dist() \f$ is the Euclidean distance between two points in 3D cartezian coordinates. */ bool get_pos(itpp::vec &ms_pos, //!< output with mobile station position in 3D cartezian coordiates const itpp::mat &measures //!< matrix with ranging measures ) { return get_pos(ms_pos, measures._data()); } //! Gets the number of failures of the partitioning algorithm used internally by the ML-estimator unsigned int get_nb_fails_part() const { return nb_fails_part; } //! Gets the number of failures of the positioning algorithm used internally by the ML-estimator unsigned int get_nb_fails_pos() const { return nb_fails_pos; } //! Resets the error counters (number of failures for the partitioning and positioning algorithms) void reset_err_counters() { nb_fails_part = 0; nb_fails_pos = 0; } //! Gets the type of the multilateration method currently used by the ML-estimator Type get_type() const { return type_; } //! Computes the Cramer Rao lower bound for the ML-estimator assuming the same noise variance for all measures double get_crlb(const vec &ms_pos, //!< true mobile station position double sigma2 //!< noise variance affecting the measures ); private: //! Computes MS position using as input an arrays of measures bool get_pos(itpp::vec &ms_pos, const double *measures); //! Sets multilateation method vector bool set_method(const itpp::bvec &method); //! Sets BS positions (must be called before set_method) bool set_bs_pos(const itpp::mat &bs_pos); //! Converts a hybrid multilateration into an equivalent multilateration bool hybrid2spherical(Point *bs_pos, double *meas); bool partition(unsigned int **subsets_idx, unsigned int *subsets_nb, const Point *bs_pos, unsigned int nb_bs, unsigned int subset_len); //! Computes MS position using the ML-estimator bool get_ml_pos(Point *ms_pos, const Point *bs_pos, unsigned int nb_bs, const unsigned int *subsets_idx, unsigned int subsets_nb, unsigned int subset_len); //! Gets a subset of BSs based on an input subset of indices in the initial array of BSs bool get_bs_pos_subset(Point *bs_pos_subset, const Point *bs_pos, unsigned int nb_bs, const unsigned int *subset_idx, unsigned int subset_len); //! Computes the product \f$A^T*d*A\f$ bool prod(double *out, const double *AT, const unsigned int *d, unsigned int cols, unsigned int rows); Algorithm *algo_; unsigned int nb_fails_part; unsigned int nb_fails_pos; Type type_; itpp::bvec method_; Point *bs_pos_; unsigned int nb_bs_; }; } #endif itpp-4.3.1/itpp/comm/ofdm.cpp000066400000000000000000000066511216575753400160620ustar00rootroot00000000000000/*! * \file * \brief Implementation of an Orthogonal Frequency Division Multiplex * (OFDM) class * \author Pal Frenger, Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { OFDM::OFDM(int inNfft, int inNcp, int inNupsample) { set_parameters(inNfft, inNcp, inNupsample); } void OFDM::set_parameters(const int inNfft, const int inNcp, const int inNupsample) { it_assert(inNfft >= 2, "OFDM: Nfft must be >=2."); it_assert(inNcp >= 0 && inNcp <= inNfft, "OFDM: Ncp must be >=0 and <=Nfft."); it_assert(inNupsample >= 1 && inNupsample <= 100, "OFDM: Ncp must be >=1 and <=100."); Nfft = inNfft; Ncp = inNcp; Nupsample = inNupsample; norm_factor = std::sqrt(static_cast(Nupsample * Nfft * Nfft) / (Nfft + Ncp)); setup_done = true; } void OFDM::modulate(const cvec &input, cvec &output) { it_assert(setup_done == true, "OFDM::modulate: You must set the length of the FFT and the cyclic prefix!"); const int N = input.length() / Nfft; it_assert(N*Nfft == input.length(), "OFDM::modulate: Length of input vector is not a multiple of Nfft."); output.set_length(Nupsample*N*(Nfft + Ncp)); cvec outtemp(Nfft); for (int i = 0; i < N; i++) { outtemp = ifft(concat(input.mid(i * Nfft, Nfft / 2), zeros_c(Nfft * (Nupsample - 1)), input.mid(i * Nfft + Nfft / 2, Nfft / 2))) * norm_factor; output.replace_mid(Nupsample*(Nfft + Ncp)*i, concat(outtemp.right(Nupsample*Ncp), outtemp)); } } cvec OFDM::modulate(const cvec &input) { cvec output; modulate(input, output); return output; } void OFDM::demodulate(const cvec& input, cvec &output) { it_assert(setup_done == true, "OFDM::demodulate: You must set the length of the FFT and the cyclic prefix!"); const int N = input.length() / (Nfft + Ncp) / Nupsample; it_assert(Nupsample*N*(Nfft + Ncp) == input.length(), "OFDM: Length of input vector is not a multiple of Nfft+Ncp."); output.set_length(N*Nfft); // normalize also taking the energy loss into the cyclic prefix into account for (int i = 0; i < N; i++) { cvec x = fft(input.mid(Nupsample * (i * (Nfft + Ncp) + Ncp), Nupsample * Nfft)); output.replace_mid(Nfft*i, concat(x.left(Nfft / 2), x.right(Nfft / 2)) / norm_factor); } } cvec OFDM::demodulate(const cvec &input) { cvec output; demodulate(input, output); return output; } } //namespace itpp itpp-4.3.1/itpp/comm/ofdm.h000066400000000000000000000050771216575753400155300ustar00rootroot00000000000000/*! * \file * \brief Interface of an Orthogonal Frequency Division Multiplex * (OFDM) class * \author Pal Frenger, Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef OFDM_H #define OFDM_H #include #include namespace itpp { /*! \ingroup modulators \brief Class for modulating and demodulation of OFDM signals using the FFT The modulated signal is normalized taking into account the cyclic prefix */ class ITPP_EXPORT OFDM { public: //! Empty constructor OFDM(void) { setup_done = false; } //! Constructor \a Nfft is the size of the FFT. \a Ncp is the length of the cyclic prefix. \a Nupsample is the upsampling factor (default=1) OFDM(int inNfft, int inNcp, int inNupsample = 1); //! Return the number of carriers int no_carriers() {return Nfft;} //! Set parameters void set_parameters(const int Nfft, const int Ncp, const int inNupsample = 1); //! Modulate complex data symbols. Length of \c input must be an integer multiple of \c Nfft cvec modulate(const cvec &input); //! Modulate complex data symbols. Length of \c input must be an integer multiple of \c Nfft void modulate(const cvec &input, cvec &output); //! Demodulate to complex valued symbols. Length of \c input must be an integer multiple of \c Nfft+Ncp cvec demodulate(const cvec &input); //! Demodulate to complex valued symbols. Length of \c input must be an integer multiple of \c Nfft+Ncp void demodulate(const cvec &input, cvec &output); private: double norm_factor; bool setup_done; int Nfft, Ncp, Nupsample; }; } // namespace itpp #endif // #ifndef OFDM_H itpp-4.3.1/itpp/comm/pulse_shape.cpp000066400000000000000000000035551216575753400174450ustar00rootroot00000000000000/*! * \file * \brief Pulse shaping classes - source file * \author Tony Ottosson, Hakan Eriksson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- template class ITPP_EXPORT Pulse_Shape; template class ITPP_EXPORT Pulse_Shape < std::complex, double, std::complex >; template class ITPP_EXPORT Pulse_Shape < std::complex, std::complex, std::complex >; template class ITPP_EXPORT Root_Raised_Cosine; template class ITPP_EXPORT Root_Raised_Cosine >; template class ITPP_EXPORT Raised_Cosine; template class ITPP_EXPORT Raised_Cosine >; //! \endcond } // namespace itpp itpp-4.3.1/itpp/comm/pulse_shape.h000066400000000000000000000376611216575753400171170ustar00rootroot00000000000000/*! * \file * \brief Pulse shaping classes - header file * \author Tony Ottosson, Hakan Eriksson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PULSE_SHAPE_H #define PULSE_SHAPE_H #include #include #include #include #include namespace itpp { /*! \brief General FIR Pulse Shape Upsamples and shapes symbols according to a given FIR filter. Observe that since the shaping is done with a FIR filter, the first samples in the output are zero or small before the memory of the filter is filled. The class is templated as follows:
    • \c T1 is the type of the input samples
    • \c T2 is the type of the filter coefficients
    • \c T3 is the type of the output samples
    An example of usage is: \code #include "itpp/itcomm.h" vec filter_response; filter_response ="0.7 0.3 0.6"; Pulse_Shape shaper(filter_response, 4); BPSK bpsk; vec symbols, samples; symbols = bpsk.modulate_bits(randb(20)); samples = shaper.shape_symbols(symbols); \endcode */ template class Pulse_Shape { public: //! Constructor Pulse_Shape(); //! Constructor Pulse_Shape(const Vec &impulse_response, int upsampling_factor); //! Destructor virtual ~Pulse_Shape() {} /*! \brief Set the general impulse response of the FIR filter Observe that the pulse shape must have a duration of an integer number of symbols. Thus the length of the impulse response-1 modulo over sampling is an integer. */ void set_pulse_shape(const Vec &impulse_response, int upsampling_factor); //! Get the pulse shape Vec get_pulse_shape(void) const; //! Get the over sampling factor int get_upsampling_factor() const; //! Get the length of the pulse in number of symbols int get_pulse_length() const; //! Get the length of the internal FIR filter int get_filter_length() const; //! Shape the input symbols performing upsampling void shape_symbols(const Vec &input, Vec &output); //! Shape the input symbols performing upsampling Vec shape_symbols(const Vec &input); //! Shape the input samples already upsampled void shape_samples(const Vec &input, Vec &output); //! Shape the input symbols already upsampled Vec shape_samples(const Vec &input); //! Clear internal states void clear(void); protected: //! The impulse resounse of the pulse shaping filter Vec impulse_response; //! The pulse shaping filter MA_Filter shaping_filter; //! Length in symbols int pulse_length; //! Samples per input symbol int upsampling_factor; //! Ensures that setup is called before any other member function bool setup_done; }; /*! \brief Raised Cosine (RC) Pulse Shaper Upsamples and shapes symbols as raised cosine pulses with a given roll-off factor \f$ \alpha \f$. The raised cosine pulse shape is defined as: \f[ p(t) = \frac{\sin(\pi t / T)}{\pi t / T} \frac{\cos(\alpha \pi t / T)}{1 - (2 \alpha t / T)^2} \f] For more details see e.g. Lee & Messerschmitt, p. 190. Observe that the shaping is done with a FIR filter where the size is given by \a filter_length * \a over_sample_factor + 1. The first samples in the output will therefore be zero or small before the memory of the filter is filled. What is important, when using RC shaping in a transmission system with the AWGN channel, the mean power of the output samples is not normalised, so the channel noise variance (or shaped signal) should be scaled appropriately. The class is templated as follows: \c T1 is the type of the input and the output samples. An example of usage is: \code #include "itpp/itcomm.h" Raised_Cosine rc(0.5, 6, 8); BPSK bpsk; vec symbols, samples; symbols = bpsk.modulate_bits(randb(20)); samples = rc.shape_symbols(symbols); \endcode */ template class Raised_Cosine : public Pulse_Shape { public: //! Constructor Raised_Cosine() {} //! Constructor Raised_Cosine(double roll_off, int filter_length = 6, int upsampling_factor = 8); //! Destructor virtual ~Raised_Cosine() {} //! Set pulse shape (roll_off_factor between 0 and 1, filter_length even) void set_pulse_shape(double roll_off_factor, int filter_length = 6, int upsampling_factor = 8); //! Get the roll-off factor double get_roll_off(void) const; protected: //! The roll off factor (i.e. alpha) double roll_off_factor; }; /*! \brief (Square) Root Raised Cosine (RRC) Pulse Shaper Upsamples and shapes symbols as square root raised cosine pulses with a given roll-off factor \f$ \alpha \f$ (zero is not allowed - use raised cosine instead). The Root Raised Cosine pulse shape is defined as: \f[ p(t) = \frac{4 \alpha}{\pi \sqrt{T}} \frac{\cos((1+\alpha)\pi t / T) + T \sin((1-\alpha)\pi t / T) / (4 \alpha t) }{1 - (4 \pi t / T)^2} \f] It is called square root raised cosine since it is defined as the square root of the raised cosine pulse in the frequency domain. Thus with a transmitter pulse shape of root raised cosine and a receiver filter that is root raised cosine, the overall response will be a raised cosine. For more details see e.g. Lee & Messerschmitt, p. 228. Observe that the shaping is done with a FIR filter where the size is given by \a filter_length * \a over_sample_factor + 1. The first samples in the output will therefore be zero or small before the memory of the filter is filled. What is important, when using RRC shaping in a transmission system with the AWGN channel, the mean power of the output samples is not normalised, so the channel noise variance (or shaped signal) should be scaled appropriately. The class is templated as follows: \c T1 is the type of the input and the output samples. An example of usage is: \code #include "itpp/itcomm.h" Root_Raised_Cosine rrc(0.5,6,8); BPSK bpsk; vec symbols, samples; symbols = bpsk.modulate_bits(randb(20)); samples = rrc.shape_symbols(symbols); \endcode */ template class Root_Raised_Cosine : public Pulse_Shape { public: //! Constructor Root_Raised_Cosine() {} //! Constructor Root_Raised_Cosine(double roll_off_factor, int filter_length = 6, int upsampling_factor = 8); //! Destructor virtual ~Root_Raised_Cosine() {} //! Set pulse_shape, roll_off_factor between 0 and 1, filter_length even void set_pulse_shape(double roll_off_factor, int filter_length = 6, int upsampling_factor = 8); //! Get the Roll-off factor double get_roll_off(void) const; protected: //! The roll off factor (i.e. alpha) double roll_off_factor; }; //------------------------------------------------------------------------- // Implementation of templated code starts here //------------------------------------------------------------------------- //---------------------------- Pulse_Shape -------------------------------- template Pulse_Shape::Pulse_Shape() { setup_done = false; pulse_length = 0; upsampling_factor = 0; } template Pulse_Shape::Pulse_Shape(const Vec &impulse_response, int upsampling_factor) { set_pulse_shape(impulse_response, upsampling_factor); } template void Pulse_Shape::set_pulse_shape(const Vec &impulse_response_in, int upsampling_factor_in) { it_error_if(impulse_response_in.size() == 0, "Pulse_Shape: impulse response is zero length"); it_error_if(upsampling_factor_in < 1, "Pulse_Shape: incorrect upsampling factor"); pulse_length = (impulse_response_in.size() - 1) / upsampling_factor_in; upsampling_factor = upsampling_factor_in; impulse_response = impulse_response_in; shaping_filter.set_coeffs(impulse_response); shaping_filter.clear(); setup_done = true; } template Vec Pulse_Shape::get_pulse_shape(void) const { return impulse_response; } template int Pulse_Shape::get_upsampling_factor(void) const { return upsampling_factor; } template int Pulse_Shape::get_pulse_length(void) const { return pulse_length; } template int Pulse_Shape::get_filter_length(void) const { return impulse_response.size(); } template void Pulse_Shape::shape_symbols(const Vec& input, Vec &output) { it_assert(setup_done, "Pulse_Shape must be set up before using"); it_error_if(pulse_length == 0, "Pulse_Shape: impulse response is zero length"); it_error_if(input.size() == 0, "Pulse_Shape: input is zero length"); if (upsampling_factor > 1) output = shaping_filter(upsample(input, upsampling_factor)); else output = input; } template Vec Pulse_Shape::shape_symbols(const Vec& input) { it_assert(setup_done, "Pulse_Shape must be set up before using"); Vec temp; shape_symbols(input, temp); return temp; } template void Pulse_Shape::shape_samples(const Vec& input, Vec &output) { it_assert(setup_done, "Pulse_Shape must be set up before using"); it_error_if(pulse_length == 0, "Pulse_Shape: impulse response is zero length"); it_error_if(input.size() == 0, "Pulse_Shape: input is zero length"); if (upsampling_factor > 1) output = shaping_filter(input); else output = input; } template Vec Pulse_Shape::shape_samples(const Vec& input) { it_assert(setup_done, "Pulse_Shape must be set up before using"); Vec temp; shape_samples(input, temp); return temp; } template void Pulse_Shape::clear(void) { it_assert(setup_done, "Pulse_Shape must be set up before using"); shaping_filter.clear(); } //-------------------- Raised_Cosine ----------------------------------- template Raised_Cosine::Raised_Cosine(double roll_off_factor, int filter_length, int upsampling_factor) { set_pulse_shape(roll_off_factor, filter_length, upsampling_factor); } template void Raised_Cosine::set_pulse_shape(double roll_off_factor_in, int filter_length, int upsampling_factor_in) { it_error_if(roll_off_factor_in < 0 || roll_off_factor_in > 1, "Raised_Cosine: roll-off out of range"); roll_off_factor = roll_off_factor_in; it_assert(is_even(filter_length), "Raised_Cosine: Filter length not even"); int i; double t, den; this->upsampling_factor = upsampling_factor_in; this->pulse_length = filter_length; this->impulse_response.set_size(filter_length * upsampling_factor_in + 1, false); for (i = 0; i < this->impulse_response.size(); i++) { // delayed to be casual t = (double)(i - filter_length * upsampling_factor_in / 2) / upsampling_factor_in; den = 1 - sqr(2 * roll_off_factor * t); if (den == 0) { // exception according to "The Care and feeding of digital, // pulse-shaping filters" by Ken Gentile, // the limit of raised cosine impulse responce function, // as (alpha * t / tau) approaches (+- 0.5) is given as: this->impulse_response(i) = sinc(t) * pi / 4; } else { this->impulse_response(i) = std::cos(roll_off_factor * pi * t) * sinc(t) / den; } } // BUGFIX: Commented out to achieve similar results to Matlab // rcosfil function. Now the concatenation of two root-raised // cosine filters gives tha same results as a one raised cosine // shaping function. // this->impulse_response /= std::sqrt(double(this->upsampling_factor)); this->shaping_filter.set_coeffs(this->impulse_response); this->shaping_filter.clear(); this->setup_done = true; } template double Raised_Cosine::get_roll_off(void) const { it_assert(this->setup_done, "Pulse_Shape must be set up before using"); return roll_off_factor; } //-------------------- Root_Raised_Cosine ----------------------------------- template Root_Raised_Cosine::Root_Raised_Cosine(double roll_off_factor, int filter_length, int upsampling_factor) { set_pulse_shape(roll_off_factor, filter_length, upsampling_factor); } template void Root_Raised_Cosine::set_pulse_shape(double roll_off_factor_in, int filter_length, int upsampling_factor_in) { it_error_if(roll_off_factor_in <= 0 || roll_off_factor_in > 1, "Root_Raised_Cosine: roll-off out of range"); roll_off_factor = roll_off_factor_in; it_assert(is_even(filter_length), "Root_Raised_Cosine: Filter length not even"); int i; double t, num, den, tmp_arg; this->upsampling_factor = upsampling_factor_in; this->pulse_length = filter_length; this->impulse_response.set_size(filter_length * upsampling_factor_in + 1, false); for (i = 0; i < this->impulse_response.size(); i++) { // delayed to be casual t = (double)(i - filter_length * upsampling_factor_in / 2) / upsampling_factor_in; den = 1 - sqr(4 * roll_off_factor * t); if (t == 0) { this->impulse_response(i) = 1 + (4 * roll_off_factor / pi) - roll_off_factor; } else if (den == 0) { tmp_arg = pi / (4 * roll_off_factor); this->impulse_response(i) = roll_off_factor / std::sqrt(2.0) * ((1 + 2 / pi) * std::sin(tmp_arg) + (1 - 2 / pi) * std::cos(tmp_arg)); } else { num = std::sin(pi * (1 - roll_off_factor) * t) + std::cos(pi * (1 + roll_off_factor) * t) * 4 * roll_off_factor * t; this->impulse_response(i) = num / (pi * t * den); } } this->impulse_response /= std::sqrt(double(upsampling_factor_in)); this->shaping_filter.set_coeffs(this->impulse_response); this->shaping_filter.clear(); this->setup_done = true; } template double Root_Raised_Cosine::get_roll_off(void) const { it_assert(this->setup_done, "Pulse_Shape must be set up before using"); return roll_off_factor; } //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Pulse_Shape; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Pulse_Shape < std::complex, double, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Pulse_Shape < std::complex, std::complex, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Root_Raised_Cosine; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Root_Raised_Cosine >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Raised_Cosine; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Raised_Cosine >; //! \endcond } // namespace itpp #endif // #ifndef PULSE_SHAPE_H itpp-4.3.1/itpp/comm/punct_convcode.cpp000066400000000000000000000535051216575753400201460ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Binary Punctured Convolutional Encoder class * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // --------------------- Punctured_Conv_Code -------------------------------- //------- Protected functions ----------------------- int Punctured_Convolutional_Code::weight(int state, int input, int time) { int i, j, temp, out, w = 0, shiftreg = state; shiftreg = shiftreg | (int(input) << m); for (j = 0; j < n; j++) { if (puncture_matrix(j, time) == bin(1)) { out = 0; temp = shiftreg & gen_pol(j); for (i = 0; i < K; i++) { out ^= (temp & 1); temp = temp >> 1; } w += out; } } return w; } int Punctured_Convolutional_Code::weight_reverse(int state, int input, int time) { int i, j, temp, out, w = 0, shiftreg = state; shiftreg = shiftreg | (int(input) << m); for (j = 0; j < n; j++) { if (puncture_matrix(j, Period - 1 - time) == bin(1)) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < K; i++) { out ^= (temp & 1); temp = temp >> 1; } w += out; } } return w; } void Punctured_Convolutional_Code::weight(int state, int &w0, int &w1, int time) { int i, j, temp, out, shiftreg = state; w0 = 0; w1 = 0; shiftreg = shiftreg | (1 << m); for (j = 0; j < n; j++) { if (puncture_matrix(j, time) == bin(1)) { out = 0; temp = shiftreg & gen_pol(j); for (i = 0; i < m; i++) { out ^= (temp & 1); temp = temp >> 1; } w0 += out; w1 += out ^(temp & 1); } } } void Punctured_Convolutional_Code::weight_reverse(int state, int &w0, int &w1, int time) { int i, j, temp, out, shiftreg = state; w0 = 0; w1 = 0; shiftreg = shiftreg | (1 << m); for (j = 0; j < n; j++) { if (puncture_matrix(j, Period - 1 - time) == bin(1)) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < m; i++) { out ^= (temp & 1); temp = temp >> 1; } w0 += out; w1 += out ^(temp & 1); } } } //------- Public functions ----------------------- void Punctured_Convolutional_Code::set_puncture_matrix(const bmat &pmatrix) { it_error_if((pmatrix.rows() != n) || (pmatrix.cols() == 0), "Wrong size of puncture matrix"); puncture_matrix = pmatrix; Period = puncture_matrix.cols(); int p, j; total = 0; for (j = 0; j < n; j++) { for (p = 0; p < Period; p++) total = total + (int)(puncture_matrix(j, p)); } rate = (double)Period / total; } void Punctured_Convolutional_Code::encode(const bvec &input, bvec &output) { switch (cc_method) { case Trunc: encode_trunc(input, output); break; case Tail: encode_tail(input, output); break; case Tailbite: encode_tailbite(input, output); break; default: encode_tail(input, output); break; }; } void Punctured_Convolutional_Code::encode_trunc(const bvec &input, bvec &output) { Convolutional_Code::encode_trunc(input, output); int nn = 0, i, p = 0, j; for (i = 0; i < int(output.size() / n); i++) { for (j = 0; j < n; j++) { if (puncture_matrix(j, p) == bin(1)) { output(nn) = output(i * n + j); nn++; } } p = (p + 1) % Period; } output.set_size(nn, true); } void Punctured_Convolutional_Code::encode_tail(const bvec &input, bvec &output) { Convolutional_Code::encode_tail(input, output); int nn = 0, i, p = 0, j; for (i = 0; i < int(output.size() / n); i++) { for (j = 0; j < n; j++) { if (puncture_matrix(j, p) == bin(1)) { output(nn) = output(i * n + j); nn++; } } p = (p + 1) % Period; } output.set_size(nn, true); } void Punctured_Convolutional_Code::encode_tailbite(const bvec &input, bvec &output) { Convolutional_Code::encode_tailbite(input, output); int nn = 0, i, p = 0, j; for (i = 0; i < int(output.size() / n); i++) { for (j = 0; j < n; j++) { if (puncture_matrix(j, p) == bin(1)) { output(nn) = output(i * n + j); nn++; } } p = (p + 1) % Period; } output.set_size(nn, true); } // --------------- Hard-decision decoding is not implemented -------------------------------- void Punctured_Convolutional_Code::decode(const bvec &, bvec &) { it_error("Punctured_Convolutional_Code::decode(bvec, bvec); hard-decision decoding is not implemented"); } bvec Punctured_Convolutional_Code::decode(const bvec &) { it_error("Punctured_Convolutional_Code::decode(bvec, bvec); hard-decision decoding is not implemented"); return bvec(); } /* Decode a block of encoded data using specified method */ void Punctured_Convolutional_Code::decode(const vec &received_signal, bvec &output) { switch (cc_method) { case Trunc: decode_trunc(received_signal, output); break; case Tail: decode_tail(received_signal, output); break; case Tailbite: decode_tailbite(received_signal, output); break; default: decode_tail(received_signal, output); break; }; } // Viterbi decoder using TruncLength (=5*K if not specified) void Punctured_Convolutional_Code::decode_trunc(const vec &received_signal, bvec &output) { int nn = 0, i = 0, p = received_signal.size() / total, j; int temp_size = p * Period * n; // number of punctured bits in a fraction of the puncture matrix // correcponding to the end of the received_signal vector p = received_signal.size() - p * total; // precise calculation of the number of unpunctured bits // (in the above fraction of the puncture matrix) while (p > 0) { for (j = 0; j < n; j++) { if (puncture_matrix(j, nn) == bin(1)) p--; } nn++; } temp_size += n * nn; if (p != 0) { it_warning("Punctured_Convolutional_Code::decode(): Improper length of " "the received punctured block, dummy bits have been added"); } vec temp(temp_size); nn = 0; j = 0; p = 0; while (nn < temp.size()) { if ((puncture_matrix(j, p) == bin(1)) && (i < received_signal.size())) { temp(nn) = received_signal(i); i++; } else { // insert dummy symbols with the same contribution for 0 and 1 temp(nn) = 0; } nn++; j++; if (j == n) { j = 0; p = (p + 1) % Period; } } // while Convolutional_Code::decode_trunc(temp, output); } // Viterbi decoder using TruncLength (=5*K if not specified) void Punctured_Convolutional_Code::decode_tail(const vec &received_signal, bvec &output) { int nn = 0, i = 0, p = received_signal.size() / total, j; int temp_size = p * Period * n; // number of punctured bits in a fraction of the puncture matrix // correcponding to the end of the received_signal vector p = received_signal.size() - p * total; // precise calculation of the number of unpunctured bits // (in the above fraction of the puncture matrix) while (p > 0) { for (j = 0; j < n; j++) { if (puncture_matrix(j, nn) == bin(1)) p--; } nn++; } temp_size += n * nn; if (p != 0) { it_warning("Punctured_Convolutional_Code::decode_tail(): Improper length " "of the received punctured block, dummy bits have been added"); } vec temp(temp_size); nn = 0; j = 0; p = 0; while (nn < temp.size()) { if ((puncture_matrix(j, p) == bin(1)) && (i < received_signal.size())) { temp(nn) = received_signal(i); i++; } else { // insert dummy symbols with same contribution for 0 and 1 temp(nn) = 0; } nn++; j++; if (j == n) { j = 0; p = (p + 1) % Period; } } // while Convolutional_Code::decode_tail(temp, output); } // Decode a block of encoded data where encode_tailbite has been used. Tries all start states. void Punctured_Convolutional_Code::decode_tailbite(const vec &received_signal, bvec &output) { int nn = 0, i = 0, p = received_signal.size() / total, j; int temp_size = p * Period * n; // number of punctured bits in a fraction of the puncture matrix // correcponding to the end of the received_signal vector p = received_signal.size() - p * total; // precise calculation of the number of unpunctured bits // (in the above fraction of the puncture matrix) while (p > 0) { for (j = 0; j < n; j++) { if (puncture_matrix(j, nn) == bin(1)) p--; } nn++; } temp_size += n * nn; if (p != 0) { it_warning("Punctured_Convolutional_Code::decode_tailbite(): Improper " "length of the received punctured block, dummy bits have been " "added"); } vec temp(temp_size); nn = 0; j = 0; p = 0; while (nn < temp.size()) { if ((puncture_matrix(j, p) == bin(1)) && (i < received_signal.size())) { temp(nn) = received_signal(i); i++; } else { // insert dummy symbols with same contribution for 0 and 1 temp(nn) = 0; } nn++; j++; if (j == n) { j = 0; p = (p + 1) % Period; } } // while Convolutional_Code::decode_tailbite(temp, output); } /* Calculate the inverse sequence Assumes that encode_tail is used in the encoding process. Returns false if there is an error in the coded sequence (not a valid codeword). Does not check that the tail forces the encoder into the zeroth state. */ bool Punctured_Convolutional_Code::inverse_tail(const bvec coded_sequence, bvec &input) { int state = 0, zero_state, one_state, zero_temp, one_temp, i, j, p = 0, prev_pos = 0, no_symbols; int block_length = 0; bvec zero_output(n), one_output(n), temp_output(n); block_length = coded_sequence.size() * Period / total - m; it_error_if(block_length <= 0, "The input sequence is to short"); input.set_length(block_length, false); // not include the tail in the output p = 0; for (i = 0; i < block_length; i++) { zero_state = state; one_state = state | (1 << m); no_symbols = 0; for (j = 0; j < n; j++) { if (puncture_matrix(j, p) == bin(1)) { zero_temp = zero_state & gen_pol(j); one_temp = one_state & gen_pol(j); zero_output(no_symbols) = xor_int_table(zero_temp); one_output(no_symbols) = xor_int_table(one_temp); no_symbols++; } } if (coded_sequence.mid(prev_pos, no_symbols) == zero_output.left(no_symbols)) { input(i) = bin(0); state = zero_state >> 1; } else if (coded_sequence.mid(prev_pos, no_symbols) == one_output.left(no_symbols)) { input(i) = bin(1); state = one_state >> 1; } else return false; prev_pos += no_symbols; p = (p + 1) % Period; } return true; } /* It is possible to do this more efficiently by registrating all (inputs,states,Periods) that has zero metric (just and with the generators). After that build paths from a input=1 state. */ bool Punctured_Convolutional_Code::catastrophic(void) { int max_stack_size = 50000; ivec S_stack(max_stack_size), t_stack(max_stack_size); int start, S, W0, W1, S0, S1, pos, t = 0; int stack_pos = -1; for (pos = 0; pos < Period; pos++) { // test all start positions for (start = 0; start < (1 << m); start++) { stack_pos = -1; S = start; t = 0; node1: if (t > (1 << m) * Period) { return true; } S0 = next_state(S, 0); S1 = next_state(S, 1); weight(S, W0, W1, (pos + t) % Period); if (W1 > 0) { goto node0; } if ((W0 == 0) && (S0 == start) && (((pos + t + 1) % Period) == pos)) { return true; } if ((W0 == 0) && (S0 == 0) && (S != 0)) { return true; } if ((S0 != 0) && (W0 == 0)) { stack_pos++; if (stack_pos >= max_stack_size) { max_stack_size = 2 * max_stack_size; S_stack.set_size(max_stack_size, true); t_stack.set_size(max_stack_size, true); } S_stack(stack_pos) = S0; t_stack(stack_pos) = t + 1; } if ((W1 == 0) && (S1 == start) && (((pos + t + 1) % Period) == pos)) { return true; } S = S1; t++; goto node1; node0: if (W0 > 0) goto stack; if ((W0 == 0) && (S0 == start) && (((pos + t + 1) % Period) == pos)) { return true; } if ((W0 == 0) && (S0 == 0) && (S != 0)) { return true; } if (S0 != 0) { S = S0; t++; goto node1; } else { goto stack; } stack: if (stack_pos >= 0) { S = S_stack(stack_pos); t = t_stack(stack_pos); stack_pos--; goto node1; } } } return false; } void Punctured_Convolutional_Code::distance_profile(ivec &dist_prof, int start_time, int dmax, bool reverse) { int max_stack_size = 50000; ivec S_stack(max_stack_size), W_stack(max_stack_size), t_stack(max_stack_size); int stack_pos = -1, t, S, W, W0, w0, w1; dist_prof.zeros(); dist_prof += dmax; // just select a big number! if (reverse) W = weight_reverse(0, 1, start_time); else W = weight(0, 1, start_time); S = next_state(0, 1); // start from zero state and a one input t = 0; dist_prof(0) = W; node1: if (reverse) weight_reverse(S, w0, w1, (start_time + t + 1) % Period); else weight(S, w0, w1, (start_time + t + 1) % Period); if (t < m) { W0 = W + w0; if (W0 < dist_prof(m)) { // store node0 (S, W0, and t+1) stack_pos++; if (stack_pos >= max_stack_size) { max_stack_size = 2 * max_stack_size; S_stack.set_size(max_stack_size, true); W_stack.set_size(max_stack_size, true); t_stack.set_size(max_stack_size, true); } S_stack(stack_pos) = next_state(S, 0); W_stack(stack_pos) = W0; t_stack(stack_pos) = t + 1; } } else goto stack; W += w1; if (W > dist_prof(m)) goto stack; t++; S = next_state(S, 1); if (W < dist_prof(t)) dist_prof(t) = W; if (t == m) goto stack; goto node1; stack: if (stack_pos >= 0) { // get root node from stack S = S_stack(stack_pos); W = W_stack(stack_pos); t = t_stack(stack_pos); stack_pos--; if (W < dist_prof(t)) dist_prof(t) = W; if (t == m) goto stack; goto node1; } } int Punctured_Convolutional_Code::fast(Array &spectrum, int start_time, int dfree, int no_terms, int d_best_so_far, bool test_catastrophic) { int cat_treshold = (1 << m) * Period; int i, j, t = 0; ivec dist_prof(K), dist_prof_rev(K), dist_prof_temp(K); //calculate distance profile distance_profile(dist_prof, start_time, dfree); distance_profile(dist_prof_rev, 0, dfree, true); // for the reverse code int dist_prof_rev0 = dist_prof_rev(0); bool reverse = true; // true = use reverse dist_prof // choose the lowest dist_prof over all periods for (i = 1; i < Period; i++) { distance_profile(dist_prof_temp, i, dfree, true); // switch if new is lower for (j = 0; j < K; j++) { if (dist_prof_temp(j) < dist_prof_rev(j)) { dist_prof_rev(j) = dist_prof_temp(j); } } } dist_prof_rev0 = dist_prof(0); dist_prof = dist_prof_rev; int d = dfree + no_terms - 1; int max_stack_size = 50000; ivec S_stack(max_stack_size), W_stack(max_stack_size), b_stack(max_stack_size); ivec c_stack(max_stack_size), t_stack(max_stack_size); int stack_pos = -1; // F1. int mf = 1, b = 1; spectrum.set_size(2); spectrum(0).set_size(dfree + no_terms, 0); // ad spectrum(1).set_size(dfree + no_terms, 0); // cd spectrum(0).zeros(); spectrum(1).zeros(); int S, S0, S1, W0, W1, w0, w1, c = 0; S = next_state(0, 1); // start in zero state and one input int W = d - dist_prof_rev0; t = 1; F2: S0 = next_state(S, 0); S1 = next_state(S, 1); if (reverse) { weight(S, w0, w1, (start_time + t) % Period); } else { weight_reverse(S, w0, w1, (start_time + t) % Period); } W0 = W - w0; W1 = W - w1; if (mf < m) goto F6; //F3: if (W0 >= 0) { spectrum(0)(d - W0)++; spectrum(1)(d - W0) += b; } //Test on d_best_so_far if ((d - W0) < d_best_so_far) { return -1; } F4: if ((W1 < dist_prof(m - 1)) || (W < dist_prof(m))) goto F5; // select node 1 if (test_catastrophic && (W == W1)) { c++; if (c > cat_treshold) return 0; } else { c = 0; } W = W1; S = S1; t++; mf = 1; b++; goto F2; F5: if (stack_pos == -1) goto end; // get node from stack S = S_stack(stack_pos); W = W_stack(stack_pos); b = b_stack(stack_pos); c = c_stack(stack_pos); t = t_stack(stack_pos); stack_pos--; mf = 1; goto F2; F6: if (W0 < dist_prof(m - mf - 1)) goto F4; //F7: if ((W1 >= dist_prof(m - 1)) && (W >= dist_prof(m))) { // save node 1 if (test_catastrophic && (stack_pos > 40000)) return 0; stack_pos++; if (stack_pos >= max_stack_size) { max_stack_size = 2 * max_stack_size; S_stack.set_size(max_stack_size, true); W_stack.set_size(max_stack_size, true); b_stack.set_size(max_stack_size, true); c_stack.set_size(max_stack_size, true); t_stack.set_size(max_stack_size, true); } S_stack(stack_pos) = S1; W_stack(stack_pos) = W1; b_stack(stack_pos) = b + 1; // because gone to node 1 c_stack(stack_pos) = c; t_stack(stack_pos) = t + 1; } // select node 0 S = S0; t++; if (test_catastrophic && (W == W0)) { c++; if (c > cat_treshold) return false; } else { c = 0; } W = W0; mf++; goto F2; end: return 1; } void Punctured_Convolutional_Code::calculate_spectrum(Array &spectrum, int dmax, int no_terms) { Array temp_spectra(2); spectrum.set_size(2); spectrum(0).set_size(dmax + no_terms, false); spectrum(1).set_size(dmax + no_terms, false); spectrum(0).zeros(); spectrum(1).zeros(); for (int pos = 0; pos < Period; pos++) { calculate_spectrum(temp_spectra, pos, dmax, no_terms); spectrum(0) += temp_spectra(0); spectrum(1) += temp_spectra(1); } } void Punctured_Convolutional_Code::calculate_spectrum(Array &spectrum, int time, int dmax, int no_terms, int block_length) { imat Ad_states(1 << (K - 1), dmax + no_terms), Cd_states(1 << m, dmax + no_terms); imat Ad_temp(1 << (K - 1), dmax + no_terms), Cd_temp(1 << m, dmax + no_terms); ivec mindist(1 << (K - 1)), mindist_temp(1 << m); spectrum.set_size(2); spectrum(0).set_size(dmax + no_terms, false); spectrum(1).set_size(dmax + no_terms, false); spectrum(0).zeros(); spectrum(1).zeros(); Ad_states.zeros(); Cd_states.zeros(); mindist.zeros(); int wmax = dmax + no_terms; ivec visited_states(1 << m), visited_states_temp(1 << m); bool proceede, expand_s1; int t, d, w0, w1, s, s0, s1 = 0, s_start; // initial phase. Evolv trellis up to time K. visited_states.zeros(); // 0 = false s1 = next_state(0, 1); // Start in state 0 and 1 input visited_states(s1) = 1; // 1 = true. w1 = weight(0, 1, time); Ad_states(s1, w1) = 1; Cd_states(s1, w1) = 1; mindist(s1) = w1; if (block_length > 0) { s0 = next_state(0, 0); visited_states(s0) = 1; // 1 = true. Expand also the zero-path w0 = weight(0, 0, time); Ad_states(s0, w0) = 1; Cd_states(s0, w0) = 0; mindist(s0) = w0; s_start = 0; } else { s_start = 1; } t = 1; proceede = true; while (proceede) { proceede = false; Ad_temp.zeros(); Cd_temp.zeros(); mindist_temp.zeros(); visited_states_temp.zeros(); //false for (s = s_start; s < (1 << m); s++) { if (visited_states(s) == 1) { if ((mindist(s) >= 0) && (mindist(s) < wmax)) { proceede = true; weight(s, w0, w1, (time + t) % Period); s0 = next_state(s, 0); for (d = mindist(s); d < (wmax - w0); d++) { Ad_temp(s0, d + w0) += Ad_states(s, d); Cd_temp(s0, d + w0) += Cd_states(s, d); } if (visited_states_temp(s0) == 0) { mindist_temp(s0) = mindist(s) + w0; } else { mindist_temp(s0) = ((mindist(s) + w0) < mindist_temp(s0)) ? mindist(s) + w0 : mindist_temp(s0); } visited_states_temp(s0) = 1; //true expand_s1 = false; if ((block_length == 0) || (t < (block_length - (K - 1)))) { expand_s1 = true; } if (expand_s1) { s1 = next_state(s, 1); for (d = mindist(s); d < (wmax - w1); d++) { Ad_temp(s1, d + w1) += Ad_states(s, d); Cd_temp(s1, d + w1) += Cd_states(s, d) + Ad_states(s, d); } if (visited_states_temp(s1) == 0) { mindist_temp(s1) = mindist(s) + w1; } else { mindist_temp(s1) = ((mindist(s) + w1) < mindist_temp(s1)) ? mindist(s) + w1 : mindist_temp(s1); } visited_states_temp(s1) = 1; //true } } } } Ad_states = Ad_temp; Cd_states = Cd_temp; if (block_length == 0) { spectrum(0) += Ad_temp.get_row(0); spectrum(1) += Cd_temp.get_row(0); } visited_states = visited_states_temp; mindist = elem_mult(mindist_temp, visited_states); t++; if ((t > block_length) && (block_length > 0)) { proceede = false; } } if (block_length > 0) { spectrum(0) = Ad_states.get_row(0); spectrum(1) = Cd_states.get_row(0); } } } // namespace itpp itpp-4.3.1/itpp/comm/punct_convcode.h000066400000000000000000000300341216575753400176030ustar00rootroot00000000000000/*! * \file * \brief Definitions of a Binary Punctured Convolutional Encoder class * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PUNCT_CONVCODE_H #define PUNCT_CONVCODE_H #include #include #include #include #include namespace itpp { /*! \ingroup fec \brief Binary Punctured Convolutional Code Class. The codes are given as feedforward encoders an given in the Proakis form. That is the binary generators (K-tuples) are converted to octal integers. Observe that the constraint length (K) is defined as the number of meomory cells plus one (as in Proakis). The puncture matrix should be of size \a n * \a Period, where \a Period is the puncturing period. Encoding is performed with the \c encode function. By default the \c encode_tail function is called which automatically add a tail of K-1 zeros and also assume that the encoder starts in the zero state. Observe that \c decode_tail is used for data encoded with \c encode_tail, and decode_trunc assumes that the memory truncation length either is the default (5*K) or set using the \c set_truncation_length function. Encoding and decoding method can be changed by calling the set_method() function. Example of use: (rate 1/3 constraint length K=7 ODS code using BPSK over AWGN) \code BPSK bpsk; Punctured_Convolutional_Code code; ivec generator(3); generator(0)=0133; generator(1)=0165; generator(2)=0171; code.set_generator_polynomials(generator, 7); bmat puncture_matrix = "1 1;0 1"; code.set_puncture_matrix(puncture_matrix); code.set_truncation_length(30); bvec bits=randb(100), encoded_bits, decoded_bits; vec tx_signal, rx_signal; code.encode(bits, encoded_bits); tx_signal = bpsk.modulate_bits(encoded_bits); rx_signal = tx_signal + sqrt(0.5)*randn(tx_signal.size()); code.decode(rx_signal, decoded_bits); \endcode */ class ITPP_EXPORT Punctured_Convolutional_Code : public Convolutional_Code { public: //! Constructor Punctured_Convolutional_Code(void) : Convolutional_Code() {} //! Destructor virtual ~Punctured_Convolutional_Code(void) {} /*! \brief Set the code according to built-in tables The \a type_of_code can be either \a MFD or \a ODS for maximum free distance codes (according to Proakis) or Optimum Distance Spectrum Codes according to Frenger, Orten and Ottosson. */ void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length) { Convolutional_Code::set_code(type_of_code, inverse_rate, constraint_length); } //! Set generator polynomials. Given in Proakis integer form void set_generator_polynomials(const ivec &gen, int constraint_length) { Convolutional_Code::set_generator_polynomials(gen, constraint_length); } //! Get generator polynomials ivec get_generator_polynomials() const { return gen_pol; } //! Return rate of code virtual double get_rate() const { return rate; } //! Set encoding and decoding method (Trunc, Tail, or Tailbite) void set_method(const CONVOLUTIONAL_CODE_METHOD method) { Convolutional_Code::set_method(method); } //! Set puncture matrix (size n*Period) void set_puncture_matrix(const bmat &pmatrix); // add test of matrix size //! Get puncture matrix bmat get_puncture_matrix() const { return puncture_matrix; } //! Get puncturing period int get_puncture_period() const { return Period; } //! Set the encoder internal state in start_state (set by set_start_state()). void init_encoder() { encoder_state = start_state; } //! Encode a binary vector of inputs using specified method void encode(const bvec &input, bvec &output); //! Encode a binary vector of inputs using specified method bvec encode(const bvec &input) { bvec output; encode(input, output); return output; } //! Encode a binary vector of inputs starting from state set by the set_state function. void encode_trunc(const bvec &input, bvec &output); //! Encode a binary vector of inputs starting from state set by the set_state function. bvec encode_trunc(const bvec &input) { bvec output; encode_trunc(input, output); return output; } /*! \brief Encoding that begins and ends in the zero state Encode a binary vector of inputs starting from zero state and also adds a tail of K-1 zeros to force the encoder into the zero state. Well suited for packet transmission. */ void encode_tail(const bvec &input, bvec &output); /*! \brief Encoding that begins and ends in the zero state Encode a binary vector of inputs starting from zero state and also adds a tail of K-1 zeros to force the encoder into the zero state. Well suited for packet transmission. */ bvec encode_tail(const bvec &input) { bvec output; encode_tail(input, output); return output; } //! Encode a binary vector of inputs using tailbiting. void encode_tailbite(const bvec &input, bvec &output); //! Encode a binary vector of inputs using tailbiting. bvec encode_tailbite(const bvec &input) { bvec output; encode_tailbite(input, output); return output; } //! Viterbi decoding using specified method virtual void decode(const vec &received_signal, bvec &output); //! Viterbi decoding using specified method virtual bvec decode(const vec &received_signal) { bvec output; decode(received_signal, output); return output; } // ------------ Hard-decision decoding is not implemented ------------------- virtual void decode(const bvec &coded_bits, bvec &decoded_bits); virtual bvec decode(const bvec &coded_bits); //! Viterbi decoding using truncation of memory (default = 5*K) void decode_trunc(const vec &received_signal, bvec &output); //! Viterbi decoding using truncation of memory (default = 5*K) bvec decode_trunc(const vec &received_signal) { bvec output; decode_trunc(received_signal, output); return output; } /*! \brief Decode a block of encoded data where encode_tail has been used. Thus is assumes a decoder start state of zero and that a tail of K-1 zeros has been added. No memory truncation. */ void decode_tail(const vec &received_signal, bvec &output); /*! \brief Decode a block of encoded data where encode_tail has been used. Thus is assumes a decoder start state of zero and that a tail of K-1 zeros has been added. No memory truncation. */ bvec decode_tail(const vec &received_signal) { bvec output; decode_tail(received_signal, output); return output; } //! Decode a block of encoded data where encode_tailbite has been used. Tries all start states. void decode_tailbite(const vec &received_signal, bvec &output); //! Decode a block of encoded data where encode_tailbite has been used. Tries all start states. bvec decode_tailbite(const vec &received_signal) { bvec output; decode_tailbite(received_signal, output); return output; } /* \brief Calculate the inverse sequence Assumes that encode_tail is used in the encoding process. Returns false if there is an error in the coded sequence (not a valid codeword). */ bool inverse_tail(const bvec coded_sequence, bvec &input); //! Check if the code is catastrophic. Returns true if catastrophic bool catastrophic(void); //! Calculate distance profile. If reverse = true calculate for the reverse code instead. void distance_profile(ivec &dist_prof, int time, int dmax = 100000, bool reverse = false); /*! \brief Calculate spectrum. Calculates both the weight spectrum (Ad) and the information weight spectrum (Cd) and returns it as ivec:s in the 0:th and 1:st component of spectrum, respectively. For a punctrued code the spectrum is a sum of the spectras of all starting positions. Suitable for calculating many terms in the spectra (uses an breadth first algorithm). It is assumed that the code is non-catastrophic or else it is a possibility for an eternal loop.
    • \a dmax = an upper bound on the free distance
    • \a no_terms = number of terms including the \a dmax term that should be calculated
    Observe that there is a risk that some of the integers are overflow if many terms are calculated in the spectrum. */ void calculate_spectrum(Array &spectrum, int dmax, int no_terms); /*! \brief Calculate spectrum. Suitable when calculating many terms in the spectra. Breadth first search. Use this function to evaluate the spectum whith a speccific puncturing period, or to calculate the spectrum for block transmission. To calculate spectra for block transmission:
    • Use \a time = 0 if the puncturing is restarted at each block.
    • Use \a block_length = 0 (default value) for infinite blocks.
    */ void calculate_spectrum(Array &spectrum, int time, int dmax, int no_terms, int block_length = 0); /*! \brief Cederwall's fast algorithm.
    • See IEEE Trans. Information Theory No. 6, pp. 1146-1159, Nov. 1989 for details.
    • Calculates both the weight spectrum (Ad) and the information weight spectrum (Cd) and returns it as ivec:s in the 0:th and 1:st component of spectrum, respectively.
    • The algorithm returns -1 if the code tested is worse that the input \a dfree and \a Cdfree.
    • It returns 0 if the code MAY be catastrophic (assuming that \a test_catastrophic is \c true), and returns 1 if everything went right.
    • \a dfree = the free distance of the code (or an upper bound).
    • \a no_terms = Number of terms including the \a dfree term that should be calculated.
    • \a d_best_so_far = the best value of the free distance found so far.
    • The FAST algorithm is good for calculating only a few terms in the spectrum. If many terms are desired, use \c calc_spectrum instead.
    Observe that there is a risk that some of the integers are overflow if many terms are calculated in the spectrum. */ int fast(Array &spectrum, int time, int dfree, int no_terms, int d_best_so_far = 0, bool test_catastrophic = false); protected: //! The weight of path from \c state with \c input (0 or 1) at transition \c time int weight(const int state, const int input, int time); //! The weight of the two paths (input 0 or 1) from given state void weight(const int state, int &w0, int &w1, int time); //! Weight of the reverse code from \c state with \c input (0 or 1) at transition \c time int weight_reverse(const int state, const int input, int time); //! The weight of the reverse code of two paths (input 0 or 1) from given state void weight_reverse(const int state, int &w0, int &w1, int time); //! The puncture period (i.e. the number of columns in the puncture matrix) int Period; //! The number of "1" in the puncture matrix int total; //! The puncture matrix (\a n rows and \a Period columns) bmat puncture_matrix; }; } // namespace itpp #endif // #ifndef PUNCT_CONVCODE_H itpp-4.3.1/itpp/comm/rec_syst_conv_code.cpp000066400000000000000000000635331216575753400210110ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Recursive Systematic Convolutional codec class * \author Pal Frenger. QLLR support by Erik G. Larsson. * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { //! Pointer to logarithmic branch metric function double(*com_log)(double, double) = NULL; //! \cond // This wrapper is because "com_log = std::max;" below caused an error inline double max(double x, double y) { return std::max(x, y); } //! \endcond // ----------------- Protected functions ----------------------------- int Rec_Syst_Conv_Code::calc_state_transition(const int instate, const int input, ivec &parity) { int i, j, in = 0, temp = (gen_pol_rev(0) & (instate << 1)), parity_temp, parity_bit; for (i = 0; i < K; i++) { in = (temp & 1) ^ in; temp = temp >> 1; } in = in ^ input; parity.set_size(n - 1, false); for (j = 0; j < (n - 1); j++) { parity_temp = ((instate << 1) + in) & gen_pol_rev(j + 1); parity_bit = 0; for (i = 0; i < K; i++) { parity_bit = (parity_temp & 1) ^ parity_bit; parity_temp = parity_temp >> 1; } parity(j) = parity_bit; } return in + ((instate << 1) & ((1 << m) - 1)); } // --------------- Public functions ------------------------- void Rec_Syst_Conv_Code::set_generator_polynomials(const ivec &gen, int constraint_length) { int j; gen_pol = gen; n = gen.size(); K = constraint_length; m = K - 1; rate = 1.0 / n; gen_pol_rev.set_size(n, false); for (int i = 0; i < n; i++) { gen_pol_rev(i) = reverse_int(K, gen_pol(i)); } Nstates = (1 << m); state_trans.set_size(Nstates, 2, false); rev_state_trans.set_size(Nstates, 2, false); output_parity.set_size(Nstates, 2*(n - 1), false); rev_output_parity.set_size(Nstates, 2*(n - 1), false); int s0, s1, s_prim; ivec p0, p1; for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = calc_state_transition(s_prim, 0, p0); state_trans(s_prim, 0) = s0; rev_state_trans(s0, 0) = s_prim; for (j = 0; j < (n - 1); j++) { output_parity(s_prim, 2*j + 0) = p0(j); rev_output_parity(s0, 2*j + 0) = p0(j); } s1 = calc_state_transition(s_prim, 1, p1); state_trans(s_prim, 1) = s1; rev_state_trans(s1, 1) = s_prim; for (j = 0; j < (n - 1); j++) { output_parity(s_prim, 2*j + 1) = p1(j); rev_output_parity(s1, 2*j + 1) = p1(j); } } ln2 = std::log(2.0); //The default value of Lc is 1: Lc = 1.0; } void Rec_Syst_Conv_Code::set_awgn_channel_parameters(double Ec, double N0) { Lc = 4.0 * std::sqrt(Ec) / N0; } void Rec_Syst_Conv_Code::set_scaling_factor(double in_Lc) { Lc = in_Lc; } void Rec_Syst_Conv_Code::encode_tail(const bvec &input, bvec &tail, bmat &parity_bits) { int i, j, length = input.size(), target_state; parity_bits.set_size(length + m, n - 1, false); tail.set_size(m, false); encoder_state = 0; for (i = 0; i < length; i++) { for (j = 0; j < (n - 1); j++) { parity_bits(i, j) = output_parity(encoder_state, 2 * j + int(input(i))); } encoder_state = state_trans(encoder_state, int(input(i))); } // add tail of m=K-1 zeros for (i = 0; i < m; i++) { target_state = (encoder_state << 1) & ((1 << m) - 1); if (state_trans(encoder_state, 0) == target_state) { tail(i) = bin(0); } else { tail(i) = bin(1); } for (j = 0; j < (n - 1); j++) { parity_bits(length + i, j) = output_parity(encoder_state, 2 * j + int(tail(i))); } encoder_state = target_state; } terminated = true; } void Rec_Syst_Conv_Code::encode(const bvec &input, bmat &parity_bits) { int i, j, length = input.size(); parity_bits.set_size(length, n - 1, false); encoder_state = 0; for (i = 0; i < length; i++) { for (j = 0; j < (n - 1); j++) { parity_bits(i, j) = output_parity(encoder_state, 2 * j + int(input(i))); } encoder_state = state_trans(encoder_state, int(input(i))); } terminated = false; } void Rec_Syst_Conv_Code::map_decode(const vec &rec_systematic, const mat &rec_parity, const vec &extrinsic_input, vec &extrinsic_output, bool in_terminated) { double gamma_k_e, nom, den, temp0, temp1, exp_temp0, exp_temp1; int j, s0, s1, k, kk, s, s_prim, s_prim0, s_prim1, block_length = rec_systematic.length(); ivec p0, p1; mat alpha(Nstates, block_length + 1); mat beta(Nstates, block_length + 1); mat gamma(2*Nstates, block_length + 1); vec denom(block_length + 1); denom.clear(); extrinsic_output.set_size(block_length, false); if (in_terminated) { terminated = true; } //Calculate gamma for (k = 1; k <= block_length; k++) { kk = k - 1; for (s_prim = 0; s_prim < Nstates; s_prim++) { exp_temp0 = 0.0; exp_temp1 = 0.0; for (j = 0; j < (n - 1); j++) { exp_temp0 += 0.5 * Lc * rec_parity(kk, j) * double(1 - 2 * output_parity(s_prim, 2 * j + 0)); /* Is this OK? */ exp_temp1 += 0.5 * Lc * rec_parity(kk, j) * double(1 - 2 * output_parity(s_prim, 2 * j + 1)); } // gamma(2*s_prim+0,k) = std::exp( 0.5*(extrinsic_input(kk) + Lc*rec_systematic(kk))) * std::exp( exp_temp0 ); // gamma(2*s_prim+1,k) = std::exp(-0.5*(extrinsic_input(kk) + Lc*rec_systematic(kk))) * std::exp( exp_temp1 ); /* == Changed to trunc_exp() to address bug 1088420 which described a numerical instability problem in map_decode() at high SNR. This should be regarded as a temporary fix and it is not necessarily a waterproof one: multiplication of probabilities still can result in values out of range. (Range checking for the multiplication operator was not implemented as it was felt that this would sacrifice too much runtime efficiency. Some margin was added to the numerical hardlimits below to reflect this. The hardlimit values below were taken as the minimum range that a "double" should support reduced by a few orders of magnitude to make sure multiplication of several values does not exceed the limits.) It is suggested to use the QLLR based log-domain() decoders instead of map_decode() as they are much faster and more numerically stable. EGL 8/06. == */ gamma(2*s_prim + 0, k) = trunc_exp(0.5 * (extrinsic_input(kk) + Lc * rec_systematic(kk)) + exp_temp0); gamma(2*s_prim + 1, k) = trunc_exp(-0.5 * (extrinsic_input(kk) + Lc * rec_systematic(kk)) + exp_temp1); } } //Initiate alpha alpha.set_col(0, zeros(Nstates)); alpha(0, 0) = 1.0; //Calculate alpha and denom going forward through the trellis for (k = 1; k <= block_length; k++) { for (s = 0; s < Nstates; s++) { s_prim0 = rev_state_trans(s, 0); s_prim1 = rev_state_trans(s, 1); temp0 = alpha(s_prim0, k - 1) * gamma(2 * s_prim0 + 0, k); temp1 = alpha(s_prim1, k - 1) * gamma(2 * s_prim1 + 1, k); alpha(s, k) = temp0 + temp1; denom(k) += temp0 + temp1; } alpha.set_col(k, alpha.get_col(k) / denom(k)); } //Initiate beta if (terminated) { beta.set_col(block_length, zeros(Nstates)); beta(0, block_length) = 1.0; } else { beta.set_col(block_length, alpha.get_col(block_length)); } //Calculate beta going backward in the trellis for (k = block_length; k >= 2; k--) { for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = state_trans(s_prim, 0); s1 = state_trans(s_prim, 1); beta(s_prim, k - 1) = (beta(s0, k) * gamma(2 * s_prim + 0, k)) + (beta(s1, k) * gamma(2 * s_prim + 1, k)); } beta.set_col(k - 1, beta.get_col(k - 1) / denom(k)); } //Calculate extrinsic output for each bit for (k = 1; k <= block_length; k++) { kk = k - 1; nom = 0; den = 0; for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = state_trans(s_prim, 0); s1 = state_trans(s_prim, 1); exp_temp0 = 0.0; exp_temp1 = 0.0; for (j = 0; j < (n - 1); j++) { exp_temp0 += 0.5 * Lc * rec_parity(kk, j) * double(1 - 2 * output_parity(s_prim, 2 * j + 0)); exp_temp1 += 0.5 * Lc * rec_parity(kk, j) * double(1 - 2 * output_parity(s_prim, 2 * j + 1)); } // gamma_k_e = std::exp( exp_temp0 ); gamma_k_e = trunc_exp(exp_temp0); nom += alpha(s_prim, k - 1) * gamma_k_e * beta(s0, k); // gamma_k_e = std::exp( exp_temp1 ); gamma_k_e = trunc_exp(exp_temp1); den += alpha(s_prim, k - 1) * gamma_k_e * beta(s1, k); } // extrinsic_output(kk) = std::log(nom/den); extrinsic_output(kk) = trunc_log(nom / den); } } void Rec_Syst_Conv_Code::log_decode(const vec &rec_systematic, const mat &rec_parity, const vec &extrinsic_input, vec &extrinsic_output, bool in_terminated, std::string metric) { if (metric == "TABLE") { /* Use the QLLR decoder. This can probably be done more efficiently since it converts floating point vectors to QLLR. However we have to live with this for the time being. */ QLLRvec rec_systematic_q = llrcalc.to_qllr(rec_systematic); QLLRmat rec_parity_q = llrcalc.to_qllr(rec_parity); QLLRvec extrinsic_input_q = llrcalc.to_qllr(extrinsic_input); QLLRvec extrinsic_output_q(length(extrinsic_output)); log_decode(rec_systematic_q, rec_parity_q, extrinsic_input_q, extrinsic_output_q, in_terminated); extrinsic_output = llrcalc.to_double(extrinsic_output_q); return; } double nom, den, exp_temp0, exp_temp1, rp, temp0, temp1; int i, j, s0, s1, k, kk, l, s, s_prim, s_prim0, s_prim1, block_length = rec_systematic.length(); ivec p0, p1; //Set the internal metric: if (metric == "LOGMAX") { com_log = max; } else if (metric == "LOGMAP") { com_log = log_add; } else { it_error("Rec_Syst_Conv_Code::log_decode: Illegal metric parameter"); } mat alpha(Nstates, block_length + 1); mat beta(Nstates, block_length + 1); mat gamma(2*Nstates, block_length + 1); extrinsic_output.set_size(block_length, false); vec denom(block_length + 1); for (k = 0; k <= block_length; k++) { denom(k) = -infinity; } if (in_terminated) { terminated = true; } //Check that Lc = 1.0 it_assert(Lc == 1.0, "Rec_Syst_Conv_Code::log_decode: This function assumes that Lc = 1.0. Please use proper scaling of the input data"); //Calculate gamma for (k = 1; k <= block_length; k++) { kk = k - 1; for (s_prim = 0; s_prim < Nstates; s_prim++) { exp_temp0 = 0.0; exp_temp1 = 0.0; for (j = 0; j < (n - 1); j++) { rp = rec_parity(kk, j); if (output_parity(s_prim , 2*j + 0) == 0) { exp_temp0 += rp; } else { exp_temp0 -= rp; } if (output_parity(s_prim , 2*j + 1) == 0) { exp_temp1 += rp; } else { exp_temp1 -= rp; } } gamma(2*s_prim + 0, k) = 0.5 * ((extrinsic_input(kk) + rec_systematic(kk)) + exp_temp0); gamma(2*s_prim + 1, k) = -0.5 * ((extrinsic_input(kk) + rec_systematic(kk)) - exp_temp1); } } //Initiate alpha for (j = 1; j < Nstates; j++) { alpha(j, 0) = -infinity; } alpha(0, 0) = 0.0; //Calculate alpha, going forward through the trellis for (k = 1; k <= block_length; k++) { for (s = 0; s < Nstates; s++) { s_prim0 = rev_state_trans(s, 0); s_prim1 = rev_state_trans(s, 1); temp0 = alpha(s_prim0, k - 1) + gamma(2 * s_prim0 + 0, k); temp1 = alpha(s_prim1, k - 1) + gamma(2 * s_prim1 + 1, k); alpha(s, k) = com_log(temp0, temp1); denom(k) = com_log(alpha(s, k), denom(k)); } //Normalization of alpha for (l = 0; l < Nstates; l++) { alpha(l, k) -= denom(k); } } //Initiate beta if (terminated) { for (i = 1; i < Nstates; i++) { beta(i, block_length) = -infinity; } beta(0, block_length) = 0.0; } else { beta.set_col(block_length, alpha.get_col(block_length)); } //Calculate beta going backward in the trellis for (k = block_length; k >= 1; k--) { for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = state_trans(s_prim, 0); s1 = state_trans(s_prim, 1); beta(s_prim, k - 1) = com_log(beta(s0, k) + gamma(2 * s_prim + 0, k) , beta(s1, k) + gamma(2 * s_prim + 1, k)); } //Normalization of beta for (l = 0; l < Nstates; l++) { beta(l, k - 1) -= denom(k); } } //Calculate extrinsic output for each bit for (k = 1; k <= block_length; k++) { kk = k - 1; nom = -infinity; den = -infinity; for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = state_trans(s_prim, 0); s1 = state_trans(s_prim, 1); exp_temp0 = 0.0; exp_temp1 = 0.0; for (j = 0; j < (n - 1); j++) { rp = rec_parity(kk, j); if (output_parity(s_prim , 2*j + 0) == 0) { exp_temp0 += rp; } else { exp_temp0 -= rp; } if (output_parity(s_prim , 2*j + 1) == 0) { exp_temp1 += rp; } else { exp_temp1 -= rp; } } nom = com_log(nom, alpha(s_prim, kk) + 0.5 * exp_temp0 + beta(s0, k)); den = com_log(den, alpha(s_prim, kk) + 0.5 * exp_temp1 + beta(s1, k)); } extrinsic_output(kk) = nom - den; } } void Rec_Syst_Conv_Code::log_decode_n2(const vec &rec_systematic, const vec &rec_parity, const vec &extrinsic_input, vec &extrinsic_output, bool in_terminated, std::string metric) { if (metric == "TABLE") { // use the QLLR decoder; also see comment under log_decode() QLLRvec rec_systematic_q = llrcalc.to_qllr(rec_systematic); QLLRvec rec_parity_q = llrcalc.to_qllr(rec_parity); QLLRvec extrinsic_input_q = llrcalc.to_qllr(extrinsic_input); QLLRvec extrinsic_output_q(length(extrinsic_output)); log_decode_n2(rec_systematic_q, rec_parity_q, extrinsic_input_q, extrinsic_output_q, in_terminated); extrinsic_output = llrcalc.to_double(extrinsic_output_q); return; } // const double INF = 10e300; // replaced by DEFINE to be file-wide in scope double nom, den, exp_temp0, exp_temp1, rp; int k, kk, l, s, s_prim, s_prim0, s_prim1, block_length = rec_systematic.length(); int ext_info_length = extrinsic_input.length(); ivec p0, p1; double ex, norm; //Set the internal metric: if (metric == "LOGMAX") { com_log = max; } else if (metric == "LOGMAP") { com_log = log_add; } else { it_error("Rec_Syst_Conv_Code::log_decode_n2: Illegal metric parameter"); } mat alpha(Nstates, block_length + 1); mat beta(Nstates, block_length + 1); mat gamma(2*Nstates, block_length + 1); extrinsic_output.set_size(ext_info_length, false); //denom.set_size(block_length+1,false); for (k=0; k<=block_length; k++) { denom(k) = -infinity; } if (in_terminated) { terminated = true; } //Check that Lc = 1.0 it_assert(Lc == 1.0, "Rec_Syst_Conv_Code::log_decode_n2: This function assumes that Lc = 1.0. Please use proper scaling of the input data"); //Initiate alpha for (s = 1; s < Nstates; s++) { alpha(s, 0) = -infinity; } alpha(0, 0) = 0.0; //Calculate alpha and gamma going forward through the trellis for (k = 1; k <= block_length; k++) { kk = k - 1; if (kk < ext_info_length) { ex = 0.5 * (extrinsic_input(kk) + rec_systematic(kk)); } else { ex = 0.5 * rec_systematic(kk); } rp = 0.5 * rec_parity(kk); for (s = 0; s < Nstates; s++) { s_prim0 = rev_state_trans(s, 0); s_prim1 = rev_state_trans(s, 1); if (output_parity(s_prim0 , 0)) { exp_temp0 = -rp; } else { exp_temp0 = rp; } if (output_parity(s_prim1 , 1)) { exp_temp1 = -rp; } else { exp_temp1 = rp; } gamma(2*s_prim0 , k) = ex + exp_temp0; gamma(2*s_prim1 + 1, k) = -ex + exp_temp1; alpha(s, k) = com_log(alpha(s_prim0, kk) + gamma(2 * s_prim0 , k), alpha(s_prim1, kk) + gamma(2 * s_prim1 + 1, k)); //denom(k) = com_log( alpha(s,k), denom(k) ); } norm = alpha(0, k); //norm = denom(k); for (l = 0; l < Nstates; l++) { alpha(l, k) -= norm; } } //Initiate beta if (terminated) { for (s = 1; s < Nstates; s++) { beta(s, block_length) = -infinity; } beta(0, block_length) = 0.0; } else { beta.set_col(block_length, alpha.get_col(block_length)); } //Calculate beta going backward in the trellis for (k = block_length; k >= 1; k--) { kk = k - 1; for (s_prim = 0; s_prim < Nstates; s_prim++) { beta(s_prim, kk) = com_log(beta(state_trans(s_prim, 0), k) + gamma(2 * s_prim, k), beta(state_trans(s_prim, 1), k) + gamma(2 * s_prim + 1, k)); } norm = beta(0, k); //norm = denom(k); for (l = 0; l < Nstates; l++) { beta(l, k) -= norm; } } //Calculate extrinsic output for each bit for (k = 1; k <= block_length; k++) { kk = k - 1; if (kk < ext_info_length) { nom = -infinity; den = -infinity; rp = 0.5 * rec_parity(kk); for (s_prim = 0; s_prim < Nstates; s_prim++) { if (output_parity(s_prim , 0)) { exp_temp0 = -rp; } else { exp_temp0 = rp; } if (output_parity(s_prim , 1)) { exp_temp1 = -rp; } else { exp_temp1 = rp; } nom = com_log(nom, alpha(s_prim, kk) + exp_temp0 + beta(state_trans(s_prim, 0), k)); den = com_log(den, alpha(s_prim, kk) + exp_temp1 + beta(state_trans(s_prim, 1), k)); } extrinsic_output(kk) = nom - den; } } } // === Below new decoder functions by EGL, using QLLR arithmetics =========== void Rec_Syst_Conv_Code::log_decode(const QLLRvec &rec_systematic, const QLLRmat &rec_parity, const QLLRvec &extrinsic_input, QLLRvec &extrinsic_output, bool in_terminated) { int nom, den, exp_temp0, exp_temp1, rp, temp0, temp1; int i, j, s0, s1, k, kk, l, s, s_prim, s_prim0, s_prim1, block_length = rec_systematic.length(); // ivec p0, p1; QLLRmat alpha_q(Nstates, block_length + 1); QLLRmat beta_q(Nstates, block_length + 1); QLLRmat gamma_q(2*Nstates, block_length + 1); extrinsic_output.set_size(block_length, false); QLLRvec denom_q(block_length + 1); for (k = 0; k <= block_length; k++) { denom_q(k) = -QLLR_MAX; } if (in_terminated) { terminated = true; } //Check that Lc = 1.0 it_assert(Lc == 1.0, "Rec_Syst_Conv_Code::log_decode: This function assumes that Lc = 1.0. Please use proper scaling of the input data"); //Calculate gamma_q for (k = 1; k <= block_length; k++) { kk = k - 1; for (s_prim = 0; s_prim < Nstates; s_prim++) { exp_temp0 = 0; exp_temp1 = 0; for (j = 0; j < (n - 1); j++) { rp = rec_parity(kk, j); if (output_parity(s_prim , 2*j + 0) == 0) { exp_temp0 += rp; } else { exp_temp0 -= rp; } if (output_parity(s_prim , 2*j + 1) == 0) { exp_temp1 += rp; } else { exp_temp1 -= rp; } } // right shift cannot be used due to implementation dependancy of how sign is handled? gamma_q(2*s_prim + 0, k) = ((extrinsic_input(kk) + rec_systematic(kk)) + exp_temp0) / 2; gamma_q(2*s_prim + 1, k) = - ((extrinsic_input(kk) + rec_systematic(kk)) - exp_temp1) / 2; } } //Initiate alpha_q for (j = 1; j < Nstates; j++) { alpha_q(j, 0) = -QLLR_MAX; } alpha_q(0, 0) = 0; //Calculate alpha_q, going forward through the trellis for (k = 1; k <= block_length; k++) { for (s = 0; s < Nstates; s++) { s_prim0 = rev_state_trans(s, 0); s_prim1 = rev_state_trans(s, 1); temp0 = alpha_q(s_prim0, k - 1) + gamma_q(2 * s_prim0 + 0, k); temp1 = alpha_q(s_prim1, k - 1) + gamma_q(2 * s_prim1 + 1, k); // alpha_q(s,k) = com_log( temp0, temp1 ); // denom_q(k) = com_log( alpha_q(s,k), denom_q(k) ); alpha_q(s, k) = llrcalc.jaclog(temp0, temp1); denom_q(k) = llrcalc.jaclog(alpha_q(s, k), denom_q(k)); } //Normalization of alpha_q for (l = 0; l < Nstates; l++) { alpha_q(l, k) -= denom_q(k); } } //Initiate beta_q if (terminated) { for (i = 1; i < Nstates; i++) { beta_q(i, block_length) = -QLLR_MAX; } beta_q(0, block_length) = 0; } else { beta_q.set_col(block_length, alpha_q.get_col(block_length)); } //Calculate beta_q going backward in the trellis for (k = block_length; k >= 1; k--) { for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = state_trans(s_prim, 0); s1 = state_trans(s_prim, 1); // beta_q(s_prim,k-1) = com_log( beta_q(s0,k) + gamma_q(2*s_prim+0,k) , beta_q(s1,k) + gamma_q(2*s_prim+1,k) ); beta_q(s_prim, k - 1) = llrcalc.jaclog(beta_q(s0, k) + gamma_q(2 * s_prim + 0, k) , beta_q(s1, k) + gamma_q(2 * s_prim + 1, k)); } //Normalization of beta_q for (l = 0; l < Nstates; l++) { beta_q(l, k - 1) -= denom_q(k); } } //Calculate extrinsic output for each bit for (k = 1; k <= block_length; k++) { kk = k - 1; nom = -QLLR_MAX; den = -QLLR_MAX; for (s_prim = 0; s_prim < Nstates; s_prim++) { s0 = state_trans(s_prim, 0); s1 = state_trans(s_prim, 1); exp_temp0 = 0; exp_temp1 = 0; for (j = 0; j < (n - 1); j++) { rp = rec_parity(kk, j); if (output_parity(s_prim , 2*j + 0) == 0) { exp_temp0 += rp; } else { exp_temp0 -= rp; } if (output_parity(s_prim , 2*j + 1) == 0) { exp_temp1 += rp; } else { exp_temp1 -= rp; } } // nom = com_log(nom, alpha_q(s_prim,kk) + 0.5*exp_temp0 + beta_q(s0,k) ); // den = com_log(den, alpha_q(s_prim,kk) + 0.5*exp_temp1 + beta_q(s1,k) ); nom = llrcalc.jaclog(nom, alpha_q(s_prim, kk) + exp_temp0 / 2 + beta_q(s0, k)); den = llrcalc.jaclog(den, alpha_q(s_prim, kk) + exp_temp1 / 2 + beta_q(s1, k)); } extrinsic_output(kk) = nom - den; } } void Rec_Syst_Conv_Code::log_decode_n2(const QLLRvec &rec_systematic, const QLLRvec &rec_parity, const QLLRvec &extrinsic_input, QLLRvec &extrinsic_output, bool in_terminated) { int nom, den, exp_temp0, exp_temp1, rp; int k, kk, l, s, s_prim, s_prim0, s_prim1, block_length = rec_systematic.length(); int ext_info_length = extrinsic_input.length(); ivec p0, p1; int ex, norm; QLLRmat alpha_q(Nstates, block_length + 1); QLLRmat beta_q(Nstates, block_length + 1); QLLRmat gamma_q(2*Nstates, block_length + 1); extrinsic_output.set_size(ext_info_length, false); //denom.set_size(block_length+1,false); for (k=0; k<=block_length; k++) { denom(k) = -infinity; } if (in_terminated) { terminated = true; } //Check that Lc = 1.0 it_assert(Lc == 1.0, "Rec_Syst_Conv_Code::log_decode_n2: This function assumes that Lc = 1.0. Please use proper scaling of the input data"); //Initiate alpha for (s = 1; s < Nstates; s++) { alpha_q(s, 0) = -QLLR_MAX; } alpha_q(0, 0) = 0; //Calculate alpha and gamma going forward through the trellis for (k = 1; k <= block_length; k++) { kk = k - 1; if (kk < ext_info_length) { ex = (extrinsic_input(kk) + rec_systematic(kk)) / 2; } else { ex = rec_systematic(kk) / 2; } rp = rec_parity(kk) / 2; for (s = 0; s < Nstates; s++) { s_prim0 = rev_state_trans(s, 0); s_prim1 = rev_state_trans(s, 1); if (output_parity(s_prim0 , 0)) { exp_temp0 = -rp; } else { exp_temp0 = rp; } if (output_parity(s_prim1 , 1)) { exp_temp1 = -rp; } else { exp_temp1 = rp; } gamma_q(2*s_prim0 , k) = ex + exp_temp0; gamma_q(2*s_prim1 + 1, k) = -ex + exp_temp1; alpha_q(s, k) = llrcalc.jaclog(alpha_q(s_prim0, kk) + gamma_q(2 * s_prim0 , k), alpha_q(s_prim1, kk) + gamma_q(2 * s_prim1 + 1, k)); //denom(k) = com_log( alpha(s,k), denom(k) ); } norm = alpha_q(0, k); //norm = denom(k); for (l = 0; l < Nstates; l++) { alpha_q(l, k) -= norm; } } //Initiate beta if (terminated) { for (s = 1; s < Nstates; s++) { beta_q(s, block_length) = -QLLR_MAX; } beta_q(0, block_length) = 0; } else { beta_q.set_col(block_length, alpha_q.get_col(block_length)); } //Calculate beta going backward in the trellis for (k = block_length; k >= 1; k--) { kk = k - 1; for (s_prim = 0; s_prim < Nstates; s_prim++) { beta_q(s_prim, kk) = llrcalc.jaclog(beta_q(state_trans(s_prim, 0), k) + gamma_q(2 * s_prim, k), beta_q(state_trans(s_prim, 1), k) + gamma_q(2 * s_prim + 1, k)); } norm = beta_q(0, k); //norm = denom(k); for (l = 0; l < Nstates; l++) { beta_q(l, k) -= norm; } } //Calculate extrinsic output for each bit for (k = 1; k <= block_length; k++) { kk = k - 1; if (kk < ext_info_length) { nom = -QLLR_MAX; den = -QLLR_MAX; rp = rec_parity(kk) / 2; for (s_prim = 0; s_prim < Nstates; s_prim++) { if (output_parity(s_prim , 0)) { exp_temp0 = -rp; } else { exp_temp0 = rp; } if (output_parity(s_prim , 1)) { exp_temp1 = -rp; } else { exp_temp1 = rp; } nom = llrcalc.jaclog(nom, alpha_q(s_prim, kk) + exp_temp0 + beta_q(state_trans(s_prim, 0), k)); den = llrcalc.jaclog(den, alpha_q(s_prim, kk) + exp_temp1 + beta_q(state_trans(s_prim, 1), k)); } extrinsic_output(kk) = nom - den; } } } void Rec_Syst_Conv_Code::set_llrcalc(LLR_calc_unit in_llrcalc) { llrcalc = in_llrcalc; } } // namespace itpp itpp-4.3.1/itpp/comm/rec_syst_conv_code.h000066400000000000000000000242471216575753400204550ustar00rootroot00000000000000/*! * \file * \brief Definitions of a Recursive Systematic Convolutional codec class * \author Pal Frenger. QLLR support by Erik G. Larsson. * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef REC_SYST_CONV_CODE_H #define REC_SYST_CONV_CODE_H #include #include #include #include #include namespace itpp { /*! \ingroup fec \brief A Recursive Systematic Convolutional Encoder/Decoder class The main purpose of this class is to be used by the Turbo_Codec class which uses two recursive systematic convolutional encoders. It can however be used as a stand alone class. The map_decode member function implementation follows the paper "A Turbo Code Tutorial" by William E. Ryan, New Mexico State University. This paper was found on the web and is probably unpublished. */ class ITPP_EXPORT Rec_Syst_Conv_Code { public: //! Class constructor Rec_Syst_Conv_Code(): infinity(1e30) {} //! Class constructor virtual ~Rec_Syst_Conv_Code() {} /*! \brief Set generator polynomials. The generator polynomials are given in Proakis integer form. First generator (gen(0)) is the recursive polynomial. \param gen A vector containing the generator polynomials of the RSC Code. \param constraint_length The Constraint length of the encoder. */ void set_generator_polynomials(const ivec &gen, int constraint_length); /*! \brief Sets the channel parameters needed for MAP-decoding. \param Ec is the energy per channel symbol \param N0 is the single-sided power spectral density of the AWGN on the channel. */ void set_awgn_channel_parameters(double Ec, double N0); /*! \brief Set scaling factor for the decoder \param in_Lc is the channel reliability factor (i.e. \a Lc = 4 x sqrt( \a Ec ) / \a N0) */ void set_scaling_factor(double in_Lc); /*! \brief Set the lookup table for algebra with quantized LLR values (see \c LLR_calc_unit class) */ void set_llrcalc(LLR_calc_unit in_llrcalc); /*! \brief Encode a binary vector of inputs and also adds a tail of \a K-1 zeros to force the encoder into the zero state. The encoder remembers that the trellis is terminated in the zero state at the end of the input block. This is then utilized by the decoder when going through the trellis in the reverse direction. The tailbits used are returned in \a tail. Parity bits for both the input part and the tail part of the data are returned in the matrix \a parity bits. */ void encode_tail(const bvec &input, bvec &tail, bmat &parity_bits); /*! \brief Encode a binary vector of inputs starting from zero state without adding of a tail */ void encode(const bvec &input, bmat &parity_bits); /*! \brief Maximum A Posteriori (MAP) Probability symbol-by-symbol decoder. The extrinsic_input is the a priori information on each systematic bit. If no a priori information is available, this vector should contain only zeros. The extrinsic_output term may be passed to a subsequent decoder in a Turbo scheme. The decision variable is \code L = Lc*rec_systematic + extrinsic_output + extrinsic_input \endcode where \code Lc = 4*sqrt(Ec)/N0 \endcode \param rec_systematic Including both systematic bits and tail bits (if any) \param rec_parity Matrix including all parity bits from all polynomials as well as parity bits from the tail (if terminated) \param extrinsic_input For all systematic bits \param extrinsic_output For all systematic bits \param set_terminated Equal to \a true if the trellis was terminated by the encoder and false otherwise Note: It is recommended to use the log_decode() decoder instead, as it is much faster and more numerically stable. */ virtual void map_decode(const vec &rec_systematic, const mat &rec_parity, const vec &extrinsic_input, vec &extrinsic_output, bool set_terminated = false); /*! \brief Log domain implementation of the Maximum A Posteriori (MAP) Probability symbol-by-symbol decoder. The extrinsic_input is the a priori information on each systematic bit. If no a priori information is available, this vector should contain only zeros. The extrinsic_output term may be passed to a subsequent decoder in a Turbo scheme. The decision variable is \code L = Lc*rec_systematic + extrinsic_output + extrinsic_input \endcode where \code Lc = 4*sqrt(Ec)/N0 \endcode \param rec_systematic Including both systematic bits and tail bits (if any) \param rec_parity Matrix including all parity bits from all polynomials as well as parity bits from the tail (if terminated) \param extrinsic_input For all systematic bits \param extrinsic_output For all systematic bits \param set_terminated Equal to \a true if the trellis was terminated by the encoder and false otherwise \param metric May be "LOGMAP", "LOGMAX" (default), or "TABLE" Note: Unless LOGMAX decoding is desired, it is recommended to use the TABLE metric instead of LOGMAP as the table-based decoder is much faster and numerically stable. */ virtual void log_decode(const vec &rec_systematic, const mat &rec_parity, const vec &extrinsic_input, vec &extrinsic_output, bool set_terminated = false, std::string metric = "LOGMAX"); /*! \brief Special Log-MAP/Log-MAX decoder implementation for \a n = 2 \param rec_systematic Including both systematic bits and tail bits (if any) \param rec_parity Matrix including all parity bits from all polynomials as well as parity bits from the tail (if terminated) \param extrinsic_input For all systematic bits \param extrinsic_output For all systematic bits \param set_terminated Equal to \a true if the trellis was terminated by the encoder and false otherwise \param metric May be "LOGMAP", "LOGMAX" (default), or "TABLE" Note: Unless LOGMAX decoding is desired, it is recommended to use the TABLE metric instead of LOGMAP as the table-based decoder is much faster and numerically stable. */ virtual void log_decode_n2(const vec &rec_systematic, const vec &rec_parity, const vec &extrinsic_input, vec &extrinsic_output, bool set_terminated = false, std::string metric = "LOGMAX"); // ===== EGL: ADDED FUNCTIONS NOV 2005 (THESE ARE DERIVATIVES OF EXISTING FUNCTIONS) ====== /*! \brief Implementation of the log-map decoder using quantized LLR values (the \c QLLR type) and table-lookup (using the \c LLR_calc_unit class). \param rec_systematic Including both systematic bits and tail bits (if any) \param rec_parity Matrix including all parity bits from all polynomials as well as parity bits from the tail (if terminated) \param extrinsic_input For all systematic bits \param extrinsic_output For all systematic bits \param set_terminated Equal to \a true if the trellis was terminated by the encoder and false otherwise */ virtual void log_decode(const QLLRvec &rec_systematic, const QLLRmat &rec_parity, const QLLRvec &extrinsic_input, QLLRvec &extrinsic_output, bool set_terminated = false); /*! \brief Implementation of the log-map decoder for the n=2 case using quantized LLR values (the \c QLLR type) and table-lookup (using the \c LLR_calc_unit class). \param rec_systematic Including both systematic bits and tail bits (if any) \param rec_parity Matrix including all parity bits from all polynomials as well as parity bits from the tail (if terminated) \param extrinsic_input For all systematic bits \param extrinsic_output For all systematic bits \param set_terminated Equal to \a true if the trellis was terminated by the encoder and false otherwise */ virtual void log_decode_n2(const QLLRvec &rec_systematic, const QLLRvec &rec_parity, const QLLRvec &extrinsic_input, QLLRvec &extrinsic_output, bool set_terminated = false); // ======================================================== //! Dummy assignment operator - MSVC++ warning C4512 Rec_Syst_Conv_Code & operator=(const Rec_Syst_Conv_Code &) { return *this; } private: //! Used for precalculations of the trellis state transitions int calc_state_transition(const int instate, const int input, ivec &parity); int n, K, m; ivec gen_pol, gen_pol_rev; int encoder_state, Nstates; double rate, Lc; imat state_trans, output_parity, rev_state_trans, rev_output_parity; bool terminated; double ln2; /*! This instance of an \c LLR_calc_unit contains the tables used for table lookup in the table-based map decoder. */ LLR_calc_unit llrcalc; // This const value replaces INT definition used previously const double infinity; }; } // namespace itpp #endif // #ifndef REC_SYST_CONV_CODE_H itpp-4.3.1/itpp/comm/reedsolomon.cpp000066400000000000000000000231221216575753400174530ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Reed-Solomon codec class * \author Pal Frenger, Steve Peters and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { //-------------------- Help Function ---------------------------- //! Local help function GFX formal_derivate(const GFX &f) { int degree = f.get_true_degree(); int q = f.get_size(); int i; GFX fprim(q, degree); fprim.clear(); for (i = 0; i <= degree - 1; i += 2) { fprim[i] = f[i + 1]; } return fprim; } //-------------------- Reed-Solomon ---------------------------- //A Reed-Solomon code is a q^m-ary BCH code of length n = pow(q,m)-1. //k = pow(q,m)-1-t. This class works for q==2. Reed_Solomon::Reed_Solomon(int in_m, int in_t, bool sys, int in_b): m(in_m), t(in_t), b(in_b), systematic(sys) { n = pow2i(m) - 1; k = pow2i(m) - 1 - 2 * t; q = pow2i(m); it_assert( (b >= 0) && (b < n), "Reed_Solomon::Reed_Solomon: narrow-sense parameter restricted to 0 <= b <= n."); GFX x(q, (char *)"-1 0"); ivec alphapow(1); g.set(q, (char *)"0"); for (int i = 1; i <= 2 * t; i++) { alphapow(0) = b + i - 1; g *= (x - GFX(q, alphapow)); } } void Reed_Solomon::encode(const bvec &uncoded_bits, bvec &coded_bits) { int i, j, iterations = floor_i(static_cast(uncoded_bits.length()) / (k * m)); GFX mx(q, k), cx(q, n); GFX r(n + 1, n - k); GFX uncoded_shifted(n + 1, n); GF mpow; bvec mbit(k * m), cbit(m); coded_bits.set_size(iterations * n * m, false); if (systematic) for (i = 0; i < n - k; i++) uncoded_shifted[i] = GF(n + 1, -1); for (i = 0; i < iterations; i++) { //Fix the message polynom m(x). for (j = 0; j < k; j++) { mpow.set(q, uncoded_bits.mid((i * m * k) + (j * m), m)); mx[j] = mpow; if (systematic) { cx[j] = mx[j]; uncoded_shifted[j + n - k] = mx[j]; } } //Fix the outputbits cbit. if (systematic) { r = modgfx(uncoded_shifted, g); for (j = k; j < n; j++) { cx[j] = r[j - k]; } } else { cx = g * mx; } for (j = 0; j < n; j++) { cbit = cx[j].get_vectorspace(); coded_bits.replace_mid((i * n * m) + (j * m), cbit); } } } bvec Reed_Solomon::encode(const bvec &uncoded_bits) { bvec coded_bits; encode(uncoded_bits, coded_bits); return coded_bits; } bool Reed_Solomon::decode(const bvec &coded_bits, const ivec &erasure_positions, bvec &decoded_message, bvec &cw_isvalid) { bool decoderfailure, no_dec_failure; int j, i, kk, l, L, foundzeros, iterations = floor_i(static_cast(coded_bits.length()) / (n * m)); bvec mbit(m * k); decoded_message.set_size(iterations * k * m, false); cw_isvalid.set_length(iterations); GFX rx(q, n - 1), cx(q, n - 1), mx(q, k - 1), ex(q, n - 1), S(q, 2 * t), Xi(q, 2 * t), Gamma(q), Lambda(q), Psiprime(q), OldLambda(q), T(q), Omega(q); GFX dummy(q), One(q, (char*)"0"), Omegatemp(q); GF delta(q), tempsum(q), rtemp(q), temp(q), Xk(q), Xkinv(q); ivec errorpos; if ( erasure_positions.length() ) { it_assert(max(erasure_positions) < iterations*n, "Reed_Solomon::decode: erasure position is invalid."); } no_dec_failure = true; for (i = 0; i < iterations; i++) { decoderfailure = false; //Fix the received polynomial r(x) for (j = 0; j < n; j++) { rtemp.set(q, coded_bits.mid(i * n * m + j * m, m)); rx[j] = rtemp; } // Fix the Erasure polynomial Gamma(x) // and replace erased coordinates with zeros rtemp.set(q, -1); ivec alphapow = - ones_i(2); Gamma = One; for (j = 0; j < erasure_positions.length(); j++) { rx[erasure_positions(j)] = rtemp; alphapow(1) = erasure_positions(j); Gamma *= (One - GFX(q, alphapow)); } //Fix the syndrome polynomial S(x). S.clear(); for (j = 1; j <= 2 * t; j++) { S[j] = rx(GF(q, b + j - 1)); } // calculate the modified syndrome polynomial Xi(x) = Gamma * (1+S) - 1 Xi = Gamma * (One + S) - One; // Apply Berlekam-Massey algorithm if (Xi.get_true_degree() >= 1) { //Errors in the received word // Iterate to find Lambda(x), which hold all error locations kk = 0; Lambda = One; L = 0; T = GFX(q, (char*)"-1 0"); while (kk < 2 * t) { kk = kk + 1; tempsum = GF(q, -1); for (l = 1; l <= L; l++) { tempsum += Lambda[l] * Xi[kk - l]; } delta = Xi[kk] - tempsum; if (delta != GF(q, -1)) { OldLambda = Lambda; Lambda -= delta * T; if (2 * L < kk) { L = kk - L; T = OldLambda / delta; } } T = GFX(q, (char*)"-1 0") * T; } // Find the zeros to Lambda(x) errorpos.set_size(Lambda.get_true_degree()); foundzeros = 0; for (j = q - 2; j >= 0; j--) { if (Lambda(GF(q, j)) == GF(q, -1)) { errorpos(foundzeros) = (n - j) % n; foundzeros += 1; if (foundzeros >= Lambda.get_true_degree()) { break; } } } if (foundzeros != Lambda.get_true_degree()) { decoderfailure = true; } else { // Forney algorithm... //Compute Omega(x) using the key equation for RS-decoding Omega.set_degree(2 * t); Omegatemp = Lambda * (One + Xi); for (j = 0; j <= 2 * t; j++) { Omega[j] = Omegatemp[j]; } //Find the error/erasure magnitude polynomial by treating them the same Psiprime = formal_derivate(Lambda*Gamma); errorpos = concat(errorpos, erasure_positions); ex.clear(); for (j = 0; j < errorpos.length(); j++) { Xk = GF(q, errorpos(j)); Xkinv = GF(q, 0) / Xk; // we calculate ex = - error polynomial, in order to avoid the // subtraction when recunstructing the corrected codeword ex[errorpos(j)] = (Xk * Omega(Xkinv)) / Psiprime(Xkinv); if (b != 1) { // non-narrow-sense code needs corrected error magnitudes int correction_exp = ( errorpos(j)*(1-b) ) % n; ex[errorpos(j)] *= GF(q, correction_exp + ( (correction_exp < 0) ? n : 0 )); } } //Reconstruct the corrected codeword. // instead of subtracting the error/erasures, we calculated // the negative error with 'ex' above cx = rx + ex; //Code word validation S.clear(); for (j = 1; j <= 2 * t; j++) { S[j] = cx(GF(q, b + j - 1)); } if (S.get_true_degree() >= 1) { decoderfailure = true; } } } else { cx = rx; decoderfailure = false; } //Find the message polynomial mbit.clear(); if (decoderfailure == false) { if (cx.get_true_degree() >= 1) { // A nonzero codeword was transmitted if (systematic) { for (j = 0; j < k; j++) { mx[j] = cx[j]; } } else { mx = divgfx(cx, g); } for (j = 0; j <= mx.get_true_degree(); j++) { mbit.replace_mid(j * m, mx[j].get_vectorspace()); } } } else { //Decoder failure. // for a systematic code it is better to extract the undecoded message // from the received code word, i.e. obtaining a bit error // prob. p_b << 1/2, than setting all-zero (p_b = 1/2) if (systematic) { mbit = coded_bits.mid(i * n * m, k * m); } else { mbit = zeros_b(k); } no_dec_failure = false; } decoded_message.replace_mid(i * m * k, mbit); cw_isvalid(i) = (!decoderfailure); } return no_dec_failure; } bool Reed_Solomon::decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid) { ivec erasures(0); return decode(coded_bits, erasures, decoded_message, cw_isvalid); } void Reed_Solomon::decode(const bvec &coded_bits, bvec &decoded_bits) { bvec cw_isvalid; ivec erasures(0); if (!decode(coded_bits, erasures, decoded_bits, cw_isvalid)) { for (int i = 0; i < cw_isvalid.length(); i++) { if (!cw_isvalid(i)) { decoded_bits.replace_mid(i * k * m, zeros_b(k * m)); } } } } bvec Reed_Solomon::decode(const bvec &coded_bits) { bvec decoded_bits; decode(coded_bits, decoded_bits); return decoded_bits; } // --- Soft-decision decoding is not implemented --- void Reed_Solomon::decode(const vec &, bvec &) { it_error("Reed_Solomon::decode(): Soft-decision decoding not implemented"); } bvec Reed_Solomon::decode(const vec &) { it_error("Reed_Solomon::decode(): Soft-decision decoding not implemented"); return bvec(); } } // namespace itpp itpp-4.3.1/itpp/comm/reedsolomon.h000066400000000000000000000117571216575753400171330ustar00rootroot00000000000000/*! * \file * \brief Definitions of a Reed-Solomon codec class * \author Pal Frenger, Steve Peters and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef REEDSOLOMON_H #define REEDSOLOMON_H #include #include #include #include namespace itpp { //---------------------- Reed-Solomon -------------------------------------- /*! \ingroup fec \brief Reed-Solomon Codes. Uses the Berlkamp-Massey algorithm for decoding as described in: S. B. Wicker, "Error Control Systems for digital communication and storage," Prentice Hall. The code is \f$2^m\f$ - ary of length \f$2^m-1\f$ capable of correcting \f$t\f$ errors. */ class ITPP_EXPORT Reed_Solomon : public Channel_Code { public: /*! Class constructor for the \f$2^m\f$ - ary, \f$t\f$ error correcting RS-code. * The generator polynomial will be $g(x)=\prod_{i=0}^{2t-1}(x-\alpha^{b+i})$, * where $\alpha$ is a root of the primitive polynomial of \c itpp::GF. */ Reed_Solomon(int in_m, int in_t, bool sys = false, int in_b = 1); //! Destructor virtual ~Reed_Solomon() { } //! Encoder function. virtual void encode(const bvec &uncoded_bits, bvec &coded_bits); //! Encoder function. virtual bvec encode(const bvec &uncoded_bits); /*! * \brief Decode the RS code bits. Return false if there has been any decoding failure. * * The \c coded_bits are block-wise decoded into \c decoded_message messages. If * there has been any decoding failure, the function will return \c false. * If this happened in the n-th block, then \c cw_isvalid(n) will be set * to \c false (zero-indexed). In case of a systematic code the systematic bits will be * extracted and presented in the corresponding block of \c decoded_message. * This is better than just presenting zeros, which is done in case of a * decoding failure of non-systematic codes. * * For erasure decoding the indices of erased positions need to be passed in \c erasure_positions * as indices to the erased \fsymbol\f (not bit!). * */ virtual bool decode(const bvec &coded_bits, const ivec &erasure_positions, bvec &decoded_message, bvec &cw_isvalid); /*! * \brief Decode the RS code bits. Return false if there has been any decoding failure. * * The \c coded_bits are block-wise decoded into \c decoded_message messages. If * there has been any decoding failure, the function will return \c false. * If this happened in the n-th block, then \c cw_isvalid(n) will be set * to \c false (zero-indexed). In case of a systematic code the systematic bits will be * extracted and presented in the corresponding block of \c decoded_message. * This is better than just presenting zeros, which is done in case of a * decoding failure of non-systematic codes. */ virtual bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid); //! Decoder a \c bvec of coded data. This function is kept for backward compatibility. Better use \code bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)\endcode. virtual void decode(const bvec &coded_bits, bvec &decoded_bits); //! Decoder a \c bvec of coded data. This function is kept for backward compatibility. Better use \code bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)\endcode. virtual bvec decode(const bvec &coded_bits); // Soft-decision decoding is not implemented virtual void decode(const vec &received_signal, bvec &output); virtual bvec decode(const vec &received_signal); //! Gets the rate of the RS-code. virtual double get_rate() const { return static_cast(k) / n; } //! Dummy assignment operator - MSVC++ warning C4512 Reed_Solomon & operator=(const Reed_Solomon &) { return *this; } protected: /*! Internal encoder/decoder parameters * @{ */ int m, t, k, n, q, b; /*! @} */ //! The generator polynomial of the RS code GFX g; //! Whether or not the code is systematic const bool systematic; }; } // namespace itpp #endif // #ifndef REEDSOLOMON_H itpp-4.3.1/itpp/comm/sequence.cpp000066400000000000000000000124151216575753400167400ustar00rootroot00000000000000/*! * \file * \brief Implementation of binary sequence classes and functions * \author Tony Ottosson and Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { LFSR::LFSR(const bvec &connections) { set_connections(connections); } LFSR::LFSR(const ivec &connections) { set_connections(connections); } void LFSR::set_connections(const bvec &connections) { int N = connections.size() - 1; memory.set_size(N, true); // Should this be true??? Connections = connections.right(N); } void LFSR::set_connections(const ivec &connections) { bvec temp = oct2bin(connections); int N = temp.size() - 1; memory.set_size(N, true); // Should this be true??? Connections = temp.right(N); } void LFSR::set_state(const bvec &state) { it_assert(state.length() == memory.size(), "LFSR::set_state(): dimension mismatch"); memory = state; } void LFSR::set_state(const ivec &state) { bvec temp = oct2bin(state, 1); it_assert(temp.length() >= memory.size(), "LFSR::set_state(): dimension mismatch"); memory = temp.right(memory.size()); } bvec LFSR::shift(int no_shifts) { it_assert(no_shifts > 0, "LFSR::shift(): shift must be positive"); bvec temp(no_shifts); for (int i = 0;i < no_shifts;i++) { temp(i) = shift(); } return temp; } //--------------------------- class Gold ------------------------- Gold::Gold(int degree) { bvec mseq1_connections, mseq2_connections; switch (degree) { case 5: mseq1_connections = bvec("1 0 1 0 0 1"); mseq2_connections = bvec("1 0 1 1 1 1"); break; case 7: mseq1_connections = bvec("1 0 0 1 0 0 0 1"); mseq2_connections = bvec("1 1 1 1 0 0 0 1"); break; case 8: mseq1_connections = bvec("1 1 1 0 0 1 1 1 1"); mseq2_connections = bvec("1 1 0 0 0 0 1 1 1"); break; case 9: mseq1_connections = bvec("1 0 0 0 1 0 0 0 0 1"); mseq2_connections = bvec("1 0 0 1 1 0 1 0 0 1"); break; default: it_error("This degree of Gold sequence is not available"); } mseq1.set_connections(mseq1_connections); mseq2.set_connections(mseq2_connections); N = pow2i(mseq1.get_length()) - 1; } Gold::Gold(const bvec &mseq1_connections, const bvec &mseq2_connections) { it_assert(mseq1_connections.size() == mseq2_connections.size(), "Gold::Gold(): dimension mismatch"); mseq1.set_connections(mseq1_connections); mseq2.set_connections(mseq2_connections); N = pow2i(mseq1.get_length()) - 1; } Gold::Gold(const ivec &mseq1_connections, const ivec &mseq2_connections) { mseq1.set_connections(mseq1_connections); mseq2.set_connections(mseq2_connections); it_assert(mseq1.get_length() == mseq1.get_length(), "Gold::Gold(): dimension mismatch"); N = pow2i(mseq1.get_length()) - 1; } void Gold::set_state(const bvec &state1, const bvec &state2) { mseq1.set_state(state1); mseq2.set_state(state2); } void Gold::set_state(const ivec &state1, const ivec &state2) { mseq1.set_state(state1); mseq2.set_state(state2); } bvec Gold::shift(int no_shifts) { it_assert(no_shifts > 0, "Gold::shift(): shift must be positive"); bvec temp(no_shifts); for (int i = 0;i < no_shifts;i++) { temp(i) = shift(); } return temp; } bmat Gold::get_family(void) { bmat codes(N + 2, N); bvec temp = dec2bin(mseq1.get_length(), 1); set_state(temp, temp); // The two m-seq. codes.set_row(0, mseq1.shift(N)); codes.set_row(1, mseq2.shift(N)); // The sum of mseq1 and all time shifts of mseq2 for (int i = 0;i < N;i++) { codes.set_row(i + 2, codes.get_row(0) + concat((codes.get_row(1)).right(i), (codes.get_row(1)).left(N - i))); } return codes; } smat wcdma_spreading_codes(int SF) { it_assert((SF == 1) || (SF == 2) || (SF == 4) || (SF == 8) || (SF == 16) || (SF == 32) || (SF == 64) || (SF == 128) || (SF == 256) || (SF == 512), "wcdma_spreading_codes: SF must equal 1, 2, 4, 8, 16, 32, 64, 128, 256, or 512"); smat codes(SF, SF); if (SF == 1) { codes(0, 0) = short(1); } else { int i; smat prev_codes(SF / 2, SF / 2); prev_codes = wcdma_spreading_codes(SF / 2); for (i = 0; i < SF / 2; i++) { codes.set_row(2*i, concat(prev_codes.get_row(i), prev_codes.get_row(i))); codes.set_row(2*i + 1, concat(prev_codes.get_row(i), (-prev_codes.get_row(i)))); } } return codes; } } // namespace itpp itpp-4.3.1/itpp/comm/sequence.h000066400000000000000000000122131216575753400164010ustar00rootroot00000000000000/*! * \file * \brief Definitions of binary sequence classes and functions * \author Tony Ottosson and Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SEQUENCE_H #define SEQUENCE_H #include #include #include namespace itpp { /*! \brief Binary Linear Feedback Shift Register (LFSR) \ingroup sequence - The LFSR is on Fibonacci form (see p. 104 in Peterson, Ziemer and Borth, "Introduction to Spread Spctrum communications", Prentice-Hall, 1995) - If the connect_polynomial=1+g1*D+g2*D^2+...+gr*D^r is a primitive polynomial, a Maximum Length Sequence (m-sequence) of length N=2^r-1 is constructed. Use an arbitrary state not equal to zero, to get a phase of the m-sequence - For a table of primtive polynomials see p. 117 in the reference above or a suitable book on coding */ class ITPP_EXPORT LFSR { public: //! Constructor LFSR(void) {}; //! Input connect_polynomial=1+g1*D+g2*D^2+...+gr*D^r in bvec format [g0,g1,...,gr] LFSR(const bvec &connections); //! Input connect_polynomial=1+g1*D+g2*D^2+...+gr*D^r in octal format LFSR(const ivec &connections); //! Input connect_polynomial=1+g1*D+g2*D^2+...+gr*D^r in bvec format [g0,g1,...,gr] void set_connections(const bvec &connections); //! Input connect_polynomial=1+g1*D+g2*D^2+...+gr*D^r in octal format void set_connections(const ivec &connections); //! Set state (contents in the shift registers) in bvec format void set_state(const bvec &state); //! Set state (contents in the shift registers) in octal format void set_state(const ivec &state); //! Shift one step and output binary symbol bin shift(void); //! Shift no_shifts steps and output bvec bvec shift(int no_shifts); //! Return length of shift register int get_length(void); //! Returns the state of the shift register bvec get_state(void); private: bvec memory, Connections; }; /*! \brief Gold Sequences \ingroup sequence */ class ITPP_EXPORT Gold { public: /*! \brief Class constructor Automatic selection of a preferred pair of connections. Just give the degree \f$N = 2^{deg} - 1\f$ where \f$deg = \{ 5, 7, 8, 9 \}\f$. Only one pair is available for each degree. */ Gold(int degree); //! Input connect_polynomials=1+g1*D+g2*D^2+...+gr*D^r in bvec format [g0,g1,...,gr] Gold(const bvec &mseq1_connections, const bvec &mseq2_connections); //! Input connect_polynomials=1+g1*D+g2*D^2+...+gr*D^r in octal format Gold(const ivec &mseq1_connections, const ivec &mseq2_connections); //! Set state (contents in the shift registers) in bvec format void set_state(const bvec &state1, const bvec &state2); //! Set state (contents in the shift registers) in octal format void set_state(const ivec &state1, const ivec &state2); //! Shift one step and output binary symbol bin shift(void); //! Shift no_shifts steps and output bvec bvec shift(int no_shifts); //! Returns the length (period) of a Gold-sequence int get_sequence_length(void); /*! \brief Returns the code family The Gold code family is defined by the two m-sequences (\a mseq1 and \a mseq2 ) and the sum of \a mseq1 and all time shifts of \a mseq2. The return matric thus contain \a N + 2 rows and \a N columns, where \a N is the length of the m-sequences. */ bmat get_family(void); private: int N; LFSR mseq1, mseq2; }; // --------------- Inlines --------------------- inline bin LFSR::shift(void) {bin temp = memory * Connections;memory.shift_right(temp);return temp;} inline int LFSR::get_length(void) {return memory.size();} inline bvec LFSR::get_state(void) {return memory;} inline bin Gold::shift(void) {return (mseq1.shift() + mseq2.shift());} inline int Gold::get_sequence_length(void) {return N;} // --------------- Functions --------------------- /*! \brief Generates the OVSF (orthogonal variable spreading factor) spreading codes used in WCDMA. \ingroup sequence The codes are written row-wise in the return matrix. */ ITPP_EXPORT smat wcdma_spreading_codes(int SF); } // namespace itpp #endif // #ifndef SEQUENCE_H itpp-4.3.1/itpp/comm/siso.h000066400000000000000000001141241216575753400155520ustar00rootroot00000000000000/*! * \file * \brief Definitions for Soft Input Soft Output (SISO) modules class * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SISO_H #define SISO_H #include //IT++ base module #include namespace itpp { /*! \ingroup fec \brief Soft Input Soft Output (%SISO) modules The following SISO modules are implemented: - decoder for an \f$1/2\f$ Recursive Systematic Convolutional (RSC) code - decoder for an \f$1/r\f$ Non-recursive non-Systematic Convolutional (NSC) code - equalizer (without and with precoding) - descrambler used in Interleave Division Multiple Access (IDMA) systems - Multi User Detectors (MUDs) for IDMA systems - demappers for Bit Interleaved Coded Modulation (BICM) systems - demappers for Space Time (ST) BICM systems \note BPSK mapping is realized as follows: 0 -> +1 and 1 -> -1. Thus the xor truth table is preserved when multiplying BPSK symbols. \note There is some overlap in functionality between the SISO class and the Modulator_ND class as follows: - When used for ST-BICM systems, both SISO and Modulator_ND classes can be used for iterative (turbo reception), but the for the SISO class the emitter part is implemented by the STC class, while for the Modulator_ND class the emitter is implemented by the same class. - When used for reception, the SISO class is more generic than the Modulator_ND class since it allows the use of several ST codes following Hassibi's model (see STC class) and several reception algorithms. - The SISO demapper for ST-BICM systems when using V-BLAST as ST code can be replaced by the ND demodulator (see Modulator_ND class). The best performance could be achieved with the ND demodulator using FULL_ENUM_LOGMAP algorithm followed by the SISO demapper with Hassibi_maxlogMAP algorithm (less complex than FULL_ENUM_LOGMAP). There is no configuration in which the ND demodulator and the SISO demapper can be considered completely equivalent (from an implementation point of view). */ class ITPP_EXPORT SISO { public: //! %SISO class constructor /*! Internal variables are initialized with default values: * - the trellis used in MAP algorithm is not terminated * - maxlogMAP metric is used * - simplified GCD is selected * - no scrambler is used * - GA demapper is selected, etc. */ SISO(); //! Sets the metric for MAP algorithm (convolutional codes and multipath channels) /*! Possible input values are: * - logMAP * - maxlogMAP * - SOVA * - Viterbi * * \note Soft Output Viterbi Algorithm (SOVA) is equivalent to the MAP algorithm * only when the a priori information is zero. */ void set_map_metric(const std::string &in_MAP_metric); //! Sets the precoder generator polynomial for turbo equalizer /*! The precoder is used in turbo equalization. * The generator polynomial describes the feedback connections of the precoder. */ void set_precoder_generator(const itpp::bvec &in_prec_gen); void set_precoder_generator(const int &in_prec_gen, const int &constraint_length); //! Sets convolutional code generator polynomials /*! * The generator polynomials are specified as rows of the input binary matrix. */ void set_generators(const itpp::bmat &in_gen); void set_generators(const itpp::ivec &in_gen, const int &constraint_length); //! Signals whether the trellis used in the MAP algorithm is terminated or not (only for convolutional codes and multipath channels) /*! * If the input value is true, the trellis is terminated. In order to terminate * the trellis an ending bit tail is added to the input stream of the encoder. */ void set_tail(const bool &in_tail); //! Sets the length of the trellis used by the SOVA void set_viterbi_win_len(const int &win_len); //! Sets the scaling factor used to normalize the reliability value computed by the SOVA void set_sova_scaling_factor(const double &scaling_factor); //! Sets the threshold value used to limit the reliability value computed by SOVA void set_sova_threshold(const double &threshold); //! Sets the Viterbi algorithm scaling factors void set_viterbi_scaling_factors(const double &matching_scaling_factor, //!< scaling factor for matching bits const double &nonmatching_scaling_factor //!< scaling factor for non matching bits ); //! Sets the Viterbi algorithm hard output flag (true when only the hard output is needed) void set_viterbi_hard_output_flag(const bool &flag); //channel setup functions //! Sets Additive White Gaussian Noise variance for each dimension void set_noise(const double &in_sigma2); //! Sets channel impulse response for equalizer /*! The input is a real channel impulse response. */ void set_impulse_response(const itpp::vec &h); //! Sets channel impulse response for Multi-User Detectors /*! The input is a real matrix with each row represented by the channel impulse response of one user. */ void set_impulse_response(const itpp::mat &H); //! Sets the channel attenuations for demappers (when only a modulator is used) /*! The input is the vector of channel attenuations for each received symbol */ void set_impulse_response(const itpp::cvec &h); //! Sets channel attenuations for demappers (when Space-Time codes are used) /*! The input is a complex matrix of dimension \f$MN\times tx\_duration\f$, * where \f$M\f$ and \f$N\f$ is the number of emission and reception antennas, * respectively and \f$tx\_duration\f$ is the transmission duration expressed * in symbol durations. * * This input matrix is formed as follows: * - the starting point is an \f$M\times N\f$ complex matrix (channel matrix) * with one row represented by the atenuations seen by each of \f$N\f$ reception * antennas during one symbol duration, when the signal is emitted by a given * emission antenna. The row number represents the number of emission antenna. * - the \f$M\times N\f$ channel matrix is then transformed into a vector of * length \f$MN\f$, with the first \f$M\f$ elements the first column of the channel matrix * - the vector of length \f$MN\f$ represents one column of the input matrix * - in the input matrix, the vector is repeated \f$\tau_c\f$ times and * \f$tx\_duration/\tau_c\f$ different vectors are used. Thus, the channel * is supposed constant over \f$\tau_c\f$ symbol durations (channel coherence time) * and \f$tx\_duration/\tau_c\f$ different channel realisations are used. * - in our implementation \f$\tau_c\f$ must be and integer multiple of \f$T\f$, * where \f$T\f$ is the ST block code duration expressed in symbol durations. * This means that the channel matrix must be constant over at least \f$T\f$ symbol durations. */ void set_impulse_response(const itpp::cmat &cH); //! Sets scrambler pattern /*! The scrambler pattern must be a sequence of \f$\pm1\f$ and is used by * the %SISO NSC module in IDMA systems reception. At emission side the bits * are first encoded by an NSC code, BPSK modulated and then scrambled with the given pattern. */ void set_scrambler_pattern(const itpp::vec &phi); void set_scrambler_pattern(const itpp::bvec &phi); //! Sets Multi-User Detector method /*! Possible input values are: * - maxlogMAP * - GCD * - sGCD (simplified GCD) */ void set_mud_method(const std::string &method); //demodulator and MIMO demapper setup //! Sets symbol constellation /*! The correspondence between each symbol and its binary representation is given. * Note that if the symbols are normalized to the square root of the number of emission antenna * you should use the normalized constellation as input for this method. */ void set_constellation(const int &in_nb_bits_symb, //!< the number of symbols const itpp::cvec &in_constellation, //!< all possible symbols as a complex vector const itpp::bmat &in_bin_constellation //!< binary representations of symbols as a binary matrix (each row corresponds to one symbol) ); void set_constellation(const int &in_nb_bits_symb, //!< the number of symbols const itpp::cvec &in_constellation, //!< all possible symbols as a complex vector const itpp::ivec &in_int_constellation //!< integer representations of symbols as a vector ); //! Sets Space-Time block code parameters /*! ST block codes are generated using Hassibi's model. */ void set_st_block_code(const int &Q, //!< the number of symbols per block const itpp::cmat &A, //!< generator matrices const itpp::cmat &B, //!< of the ST block code const int &N //!< the number of reception antennas ); //! Sets demapper method /*! Possible input values are: * - Hassibi_maxlogMAP (maxlogMAP algorithm applied for ST block codes represented * using Hassibi's model) * - GA * - sGA (simplified GA) * - mmsePIC * - zfPIC (simplified mmsePIC) * - Alamouti_maxlogMAP (maxlogMAP algorithm applied to Alamouti code using matched-filter * reception method) */ void set_demapper_method(const std::string &method); //! %SISO decoder for RSC codes void rsc(itpp::vec &extrinsic_coded, //!< extrinsic information of coded bits itpp::vec &extrinsic_data, //!< extrinsic information of data bits const itpp::vec &intrinsic_coded, //!< intrinsic information of coded bits const itpp::vec &apriori_data //!< a priori information of data bits ); //! %SISO decoder for RSC codes (tail is set through input) void rsc(itpp::vec &extrinsic_coded, //!< extrinsic information of coded bits itpp::vec &extrinsic_data, //!< extrinsic information of data bits const itpp::vec &intrinsic_coded, //!< intrinsic information of coded bits const itpp::vec &apriori_data, //!< a priori information of data bits const bool &tail //!< if true the trellis is terminated ); //! %SISO decoder for NSC codes void nsc(itpp::vec &extrinsic_coded, //!< extrinsic information of coded bits itpp::vec &extrinsic_data, //!< extrinsic information of data bits const itpp::vec &intrinsic_coded, //!< intrinsic information of coded bits const itpp::vec &apriori_data //!< a priori information of data bits ); //! %SISO decoder for NSC codes (tail is set through input) void nsc(itpp::vec &extrinsic_coded, //!< extrinsic information of coded bits itpp::vec &extrinsic_data, //!< extrinsic information of data bits const itpp::vec &intrinsic_coded, //!< intrinsic information of coded bits const itpp::vec &apriori_data, //!< a priori information of data bits const bool &tail //!< if true the trellis is terminated ); //! %SISO equalizer /*! Channel trellis is generated so that BPSK mapping is assumed: 0->+1 and 1->-1 * (xor truth table is preserved) */ void equalizer(itpp::vec &extrinsic_data, //!< extrinsic informations of input symbols const itpp::vec &rec_sig, //!< received signal const itpp::vec &apriori_data //!< a priori informations of input symbols ); //! %SISO equalizer (tail is set through input) /*! Channel trellis is generated so that BPSK mapping is assumed: 0->+1 and 1->-1 * (xor truth table is preserved) */ void equalizer(itpp::vec &extrinsic_data, //!< extrinsic informations of input symbols const itpp::vec &rec_sig, //!< received signal const itpp::vec &apriori_data, //!< a priori informations of input symbols const bool &tail //!< if true the trellis is terminated ); //! %SISO descrambler void descrambler(itpp::vec &extrinsic_coded, //!< extrinsic information of scrambled bits itpp::vec &extrinsic_data, //!< extrinsic information of informational bits const itpp::vec &intrinsic_coded, //!< intrinsic information of scrambled bits const itpp::vec &apriori_data //!< a priori information of informational bits ); //! %SISO Multi-User Detector void mud(itpp::mat &extrinsic_data, //!< extrinsic informations of emitted chips from all users const itpp::vec &rec_sig, //!< received signal const itpp::mat &apriori_data //!< a priori informations of emitted chips from all users ); //! %SISO demapper (when only a modulator is used) void demapper(itpp::vec &extrinsic_data, //!< extrinsic informations of emitted bits const itpp::cvec &rec_sig, //!< received signal const itpp::vec &apriori_data //!< a priori informations of emitted bits ); //! %SISO demapper (when Space-Time codes are used) void demapper(itpp::vec &extrinsic_data, //!< extrinsic informations of emitted bits const itpp::cmat &rec_sig, //!< received signal const itpp::vec &apriori_data //!< a priori informations of emitted bits ); //! Functions used to limit values at a given +- threshold static double threshold(const double &x, const double &value); static itpp::vec threshold(const itpp::vec &in, const double &value); static itpp::mat threshold(const itpp::mat &in, const double &value); private: //! SISO::rsc using logMAP algorithm void rsc_logMAP(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data); //! SISO::rsc using maxlogMAP algorithm void rsc_maxlogMAP(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data); //! SISO::rsc using %SOVA void rsc_sova(itpp::vec &extrinsic_data, //!< extrinsic information of data bits const itpp::vec &intrinsic_coded, //!< intrinsic information of coded bits const itpp::vec &apriori_data, //!< a priori information of data bits const int &win_len //!< window length used to represent the trellis ); //! SISO::rsc using Viterbi algorithm void rsc_viterbi(itpp::vec &extrinsic_coded, //!< extrinsic information of coded bits itpp::vec &extrinsic_data, //!< extrinsic information of data bits const itpp::vec &intrinsic_coded, //!< intrinsic information of coded bits const itpp::vec &apriori_data, //!< a priori information of data bits const int &win_len //!< window length used to represent the trellis ); //! SISO::nsc using logMAP algorithm void nsc_logMAP(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data); //! SISO::nsc using maxlogMAP algorithm void nsc_maxlogMAP(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data); //! SISO::equalizer using logMAP algorithm void equalizer_logMAP(itpp::vec &extrinsic_data, const itpp::vec &rec_sig, const itpp::vec &apriori_data); //! SISO::equalizer using maxlogMAP algorithm void equalizer_maxlogMAP(itpp::vec &extrinsic_data, const itpp::vec &rec_sig, const itpp::vec &apriori_data); //! SISO::mud using maxlogMAP algorithm void mud_maxlogMAP(itpp::mat &extrinsic_data, const itpp::vec &rec_sig, const itpp::mat &apriori_data); //! SISO::mud using maxlogMAP algorithm based on T-BCJR void mud_maxlogTMAP(itpp::mat &extrinsic_data, const itpp::vec &rec_sig, const itpp::mat &apriori_data, const double &threshold=-5); //! SISO::mud using Gaussian Chip Detector (GCD) void GCD(itpp::mat &extrinsic_data, const itpp::vec &rec_sig, const itpp::mat &apriori_data); //! SISO::mud using simplified Gaussian Chip Detector (sGCD) void sGCD(itpp::mat &extrinsic_data, const itpp::vec &rec_sig, const itpp::mat &apriori_data); //! SISO::demapper using maxlogMAP algorithm for ST block codes described using Hassibi's model void Hassibi_maxlogMAP(itpp::vec &extrinsic_data, const itpp::cmat &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using Gaussian Approximation (GA) algorithm void GA(itpp::vec &extrinsic_data, const itpp::cmat &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using simplified Gaussian Approximation (sGA) algorithm void sGA(itpp::vec &extrinsic_data, const itpp::cmat &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using MMSE Parallel Interference Canceller (PIC) void mmsePIC(itpp::vec &extrinsic_data, const itpp::cmat &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using ZF Parallel Interference Canceller (PIC) void zfPIC(itpp::vec &extrinsic_data, const itpp::cmat &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using maxlogMAP algorithm and matched filter receiver for Alamouti ST code void Alamouti_maxlogMAP(itpp::vec &extrinsic_data, const itpp::cmat &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using logMAP algorithm for complex modulators void demodulator_logMAP(itpp::vec &extrinsic_data, const itpp::cvec &rec_sig, const itpp::vec &apriori_data); //! SISO::demapper using maxlogMAP algorithm for complex modulators void demodulator_maxlogMAP(itpp::vec &extrinsic_data, const itpp::cvec &rec_sig, const itpp::vec &apriori_data); //! Prints an error message to standard output /*! If the %SISO class is used in a mex file, this function ensures that * the proper function is used for displaying the error message */ void print_err_msg(const std::string &msg) const; // MAP algorithm variables //! MAP algorithm metric struct ITPP_EXPORT MAP_Metrics { enum Type {Unknown, logMAP, maxlogMAP, SOVA, Viterbi}; MAP_Metrics() : _t(Unknown) {} MAP_Metrics(Type t) : _t(t) {} operator Type () const {return _t;} private: Type _t; template operator T () const; }; MAP_Metrics MAP_metric; //! Generator polynomials for convolutional codes (CC) itpp::bmat gen; //! Precoder generator polynomial itpp::bvec prec_gen; //! True if trellis of CC is terminated bool tail; // SOVA & Viterbi variables //! Viterbi trellis window length int Viterbi_win_len; //! SOVA scaling factor used to multiply the reliabiliy information double SOVA_scaling_factor; //! SOVA threshold used to limit the reliability information double SOVA_threshold; //! Viterbi scaling factors double Viterbi_scaling_factor[2]; //! Viterbi hard output flag (true when only hard output is needed) bool Viterbi_hard_output_flag; //channel variables //! AWGN noise variance double sigma2; //! Real channel impulse response itpp::mat impulse_response; //! Complex channel impulse response itpp::cmat c_impulse_response; //! Scrambler pattern itpp::bvec scrambler_pattern; //! MUD method struct ITPP_EXPORT MUD_Methods { enum Type {Unknown, sGCD, maxlogMAP, GCD}; MUD_Methods() : _t(Unknown) {} MUD_Methods(Type t) : _t(t) {} operator Type () const {return _t;} private: Type _t; template operator T () const; }; MUD_Methods MUD_method; //constellation variables //! Number of bits/symbol int nb_bits_symb; //! Complex constellation itpp::cvec constellation; //! Binary constellation itpp::bmat bin_constellation; //Space Time block code variables //! Number of symbols/block int symbols_block; //! Number of emission antennas int nb_em_ant; //! Number of reception antennas int nb_rec_ant; //! ST code block duration int block_duration; //! ST generator matrix 1 itpp::cmat ST_gen1; //! ST generator matrix 2 itpp::cmat ST_gen2; //! Demapper method struct ITPP_EXPORT Demapper_Methods { enum Type {Unknown, GA, Hassibi_maxlogMAP, sGA, mmsePIC, zfPIC, Alamouti_maxlogMAP}; Demapper_Methods() : _t(Unknown) {} Demapper_Methods(Type t) : _t(t) {} operator Type () const {return _t;} private: Type _t; template operator T () const; }; Demapper_Methods demapper_method; //internal variables and functions //! FIR filter for a zero padded signals (\f$L\f$ zeros are added at the end of the signal, where \f$L\f$ is the order of the filter) void zpFIRfilter(itpp::vec& filt, //!< filtered signal const itpp::vec &h, //!< filter impulse response const itpp::vec &sig //!< signal to filter ); //! Generates (precoded) channel trellis void gen_chtrellis(void); //! Generates (precoded) hyper channel trellis void gen_hyperTrellis(void); //! (Hyper) Channel trellis struct { int numInputSymbols;//!< number of input symbols int stateNb;//!< number of states int* prevState;//!< previous states int* nextState;//!< next states double* output;//!< output int* input;//!< input } chtrellis; //! Generates Recursive and Systematic Convolutional (RSC) code trellis void gen_rsctrellis(void); //! RSC code trellis struct { int numStates;//!< number of states int* prevStates;//!< previous states int* nextStates;//!< next states double* PARout;//!< parity output bit itpp::bin* fm;//! feedback memory } rsctrellis; //! Generates Non recursive and non Systematic Convolutional (NSC) code trellis void gen_nsctrellis(void); //! NSC code trellis struct { int stateNb;//!< number of states int* prevState;//!< previous states int* nextState;//!< next states double* output;//!< output int* input;//!< input } nsctrellis; //! Finds half constellations void find_half_const(int &select_half, itpp::vec &re_part, itpp::bmat &re_bin_part, itpp::vec &im_part, itpp::bmat &im_bin_part); //! Finds equivalent received signal with real coefficients void EquivRecSig(itpp::vec &x_eq, const itpp::cmat &rec_sig); //! Finds equivalent channel with real coefficients void EquivCh(itpp::mat &H_eq, const itpp::cvec &H); //! Computes equivalent symbols statistics (mean and variance of the real and imaginary part) void compute_symb_stats(itpp::vec &Es, itpp::vec &Vs, int ns, int select_half, const itpp::vec &apriori_data, const itpp::vec &re_part, const itpp::vec &im_part, const itpp::bmat &re_bin_part, const itpp::bmat &im_bin_part); static MAP_Metrics map_metric_from_string(const std::string &in_MAP_metric); static MUD_Methods mud_method_from_string(const std::string &in_mud_method); static Demapper_Methods demapper_method_from_string(const std::string &in_dem_method); }; inline SISO::SISO() { tail = false; MAP_metric = MAP_Metrics::maxlogMAP; MUD_method = MUD_Methods::sGCD; scrambler_pattern = "0";//corresponds to +1 using BPSK mapping prec_gen = "1"; demapper_method = Demapper_Methods::GA; Viterbi_win_len = 20;//should be set according to the generator polynomials SOVA_scaling_factor = 0.8;//set according to Wang [2003] SOVA_threshold = 10;//according to Wang [2003] an adaptive value should be used Viterbi_scaling_factor[0] = 1.4;//according to Kerner [2009] Viterbi_scaling_factor[1] = 0.4; Viterbi_hard_output_flag = false; } inline SISO::MAP_Metrics SISO::map_metric_from_string(const std::string &in_MAP_metric) { if (in_MAP_metric=="logMAP") { return MAP_Metrics::logMAP; } else if (in_MAP_metric=="maxlogMAP") { return MAP_Metrics::maxlogMAP; } else if (in_MAP_metric=="SOVA") { return MAP_Metrics::SOVA; } else if (in_MAP_metric=="Viterbi") { return MAP_Metrics::Viterbi; } else { return MAP_Metrics::Unknown; } } inline SISO::MUD_Methods SISO::mud_method_from_string(const std::string &in_mud_method) { if (in_mud_method=="maxlogMAP") { return MUD_Methods::maxlogMAP; } else if (in_mud_method=="sGCD") { return MUD_Methods::sGCD; } else if (in_mud_method=="GCD") { return MUD_Methods::GCD; } else { return MUD_Methods::Unknown; } } inline SISO::Demapper_Methods SISO::demapper_method_from_string(const std::string &in_dem_method) { if (in_dem_method=="Hassibi_maxlogMAP") { return Demapper_Methods::Hassibi_maxlogMAP; } else if (in_dem_method=="Alamouti_maxlogMAP") { return Demapper_Methods::Alamouti_maxlogMAP; } else if (in_dem_method=="GA") { return Demapper_Methods::GA; } else if (in_dem_method=="sGA") { return Demapper_Methods::sGA; } else if (in_dem_method=="mmsePIC") { return Demapper_Methods::mmsePIC; } else if (in_dem_method=="zfPIC") { return Demapper_Methods::zfPIC; } else { return Demapper_Methods::Unknown; } } inline void SISO::set_map_metric(const std::string &in_MAP_metric) { MAP_metric = map_metric_from_string(in_MAP_metric); } inline void SISO::set_precoder_generator(const itpp::bvec &in_prec_gen)//set precoder polynomial { prec_gen = in_prec_gen; } inline void SISO::set_precoder_generator(const int &in_prec_gen, const int &constraint_length)//set precoder polynomial { prec_gen = itpp::dec2bin(constraint_length, in_prec_gen); } inline void SISO::set_generators(const itpp::bmat &in_gen) { gen = in_gen; } inline void SISO::set_generators(const itpp::ivec &in_gen, const int &constraint_length) { int nb_outputs = in_gen.length(); gen.set_size(nb_outputs, constraint_length); for (int n=0; n+1 and 1->-1 register int n; for (n=0; n+1 and 1->-1 } inline void SISO::set_scrambler_pattern(const itpp::bvec &phi) { scrambler_pattern = phi; } inline void SISO::set_mud_method(const std::string &method) { MUD_method = mud_method_from_string(method); } inline void SISO::set_constellation(const int &in_nb_bits_symb, const itpp::cvec &in_constellation, const itpp::bmat &in_bin_constellation) { nb_bits_symb = in_nb_bits_symb; constellation = in_constellation; bin_constellation = in_bin_constellation; } inline void SISO::set_constellation(const int &in_nb_bits_symb, const itpp::cvec &in_constellation, const itpp::ivec &in_int_constellation) { nb_bits_symb = in_nb_bits_symb; int nb_symb = in_constellation.length(); constellation.set_size(nb_symb); bin_constellation.set_size(nb_symb, nb_bits_symb); for (int n=0; nvalue)||(x<-value)) return (x>0?value:-value); return x; } inline itpp::vec SISO::threshold(const itpp::vec &in, const double &value) { itpp::vec out(in.length()); register int n; for (n=0; n. * * ------------------------------------------------------------------------- */ #include #include #ifndef INFINITY #define INFINITY std::numeric_limits::infinity() #endif namespace itpp { void SISO::find_half_const(int &select_half, itpp::vec &re_part, itpp::bmat &re_bin_part, itpp::vec &im_part, itpp::bmat &im_bin_part) /* finds real in imaginary parts of the constellation and its corresponding bits * this approach is used for equivalent channel according to Hassibi's model * the constellation must be quadratic and the number of bits per symbol must be a multiple of two */ { //values needed for initializations int const_size = itpp::pow2i(nb_bits_symb);//constellation size int half_nb_bits_symb = nb_bits_symb/2; int half_len = itpp::pow2i(half_nb_bits_symb);//number of values of real(imaginary) part //initialize output variables select_half = 0; re_part.set_size(half_len); re_bin_part.set_size(half_len, half_nb_bits_symb); re_part.zeros(); re_part(0) = constellation(0).real(); im_part.set_size(half_len); im_bin_part.set_size(half_len, half_nb_bits_symb); im_part.zeros(); im_part(0) = constellation(0).imag(); //select half for real (imaginary) to binary correspondence if (nb_bits_symb%2) { print_err_msg("SISO::find_half_const: number of bits per symbol must be a multiple of two"); return; } const double min_diff = 1e-3; itpp::ivec idx = itpp::find(itpp::abs(itpp::real(constellation)-re_part(0))min_diff) { re_idx++; re_part(re_idx) = buffer; re_bin_part.set_row(re_idx, temp(select_half*half_nb_bits_symb,(1+select_half)*half_nb_bits_symb-1)); } buffer = constellation(n).imag(); if (fabs(itpp::prod(im_part-buffer))>min_diff) { im_idx++; im_part(im_idx) = buffer; im_bin_part.set_row(im_idx, temp((1-select_half)*half_nb_bits_symb,(2-select_half)*half_nb_bits_symb-1)); } } } void SISO::EquivRecSig(itpp::vec &x_eq, const itpp::cmat &rec_sig) //finds equivalent received signal with real coefficients //the equivalent received signal follows the model of Hassibi's paper //ouput: //x_eq - equivalent received signal with real coefficients //inputs: //rec_sig - received signal { for (int k=0; k. * * ------------------------------------------------------------------------- */ #include #include #ifndef INFINITY #define INFINITY std::numeric_limits::infinity() #endif namespace itpp { void SISO::gen_chtrellis(void) // generate trellis for precoded FIR channels with real coefficients { //get parameters int mem_len = impulse_response.cols()-1;//memory length of the channel int p_order = prec_gen.length()-1;//order of the precoder polynomial //other variables register int n,k,j; double inputs[] = {1.0,-1.0};//1->-1, 0->+1 int index; double feedback[2]; //create channel trellis int equiv_ch_mem_len = std::max(mem_len, p_order); chtrellis.stateNb = (1<-1, 0->+1 //output for (k=0; k<2; k++) { feedback[k] = inputs[k]; for (j=1; j<=p_order; j++) if (prec_gen[j]) feedback[k] *= enc_mem[j-1];//xor truth table must remain the same chtrellis.output[n+k*chtrellis.stateNb] = feedback[k]*impulse_response(0,0); for (j=1; j<=mem_len; j++) chtrellis.output[n+k*chtrellis.stateNb] += (enc_mem[j-1]*impulse_response(0,j)); } //next state for (j=(equiv_ch_mem_len-1); j>0; j--) enc_mem[j] = enc_mem[j-1]; for (k=0; k<2; k++) { enc_mem[0] = int(feedback[k]); chtrellis.nextState[n+k*chtrellis.stateNb] = itpp::bin2dec(itpp::to_bvec((1-enc_mem)/2), true);//-1->1, +1->0 } } #pragma omp parallel for private(j,index,n,k) for (j=0; j=0; n--) { sum = 0;//normalisation factor for (m=0; m=0; n--) { sum = -INFINITY;//normalisation factor for (m=0; m. * * ------------------------------------------------------------------------- */ #include #include #ifndef INFINITY #define INFINITY std::numeric_limits::infinity() #endif namespace itpp { void SISO::descrambler(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data) /* inputs: intrinsic_coded - intrinsic information of coded bits (repetition code output) apriori_data - a priori information of informational bits (repetition code input) outputs: extrinsic_coded - extrinsic information of coded bits extrinsic_data - Logarithm of Likelihood Ratio of informational bits */ { //get parameters int nb_bits = apriori_data.length(); int Nc = scrambler_pattern.length(); //implementation extrinsic_data.set_size(nb_bits); extrinsic_coded.set_size(nb_bits*Nc); register int n,k; #pragma omp parallel for private(n,k) for (k=0; k=N) { continue;//channel has state 0 in the end } filt[n] += (h[l]*sig[n-l]); } } } void SISO::gen_hyperTrellis(void) /* generates channel hyper trellis for binary symbols * the channel is a MISO system * BPSK mapping: 0->+1, 1->-1 */ { //get parameters int nb_usr = impulse_response.rows(); int ch_order = impulse_response.cols()-1; int p_order = prec_gen.length()-1; int max_order = std::max(ch_order, p_order); //initialize hypertrellis chtrellis.numInputSymbols = itpp::pow2i(nb_usr); int mem_len = nb_usr*max_order; if (mem_len>=(int)(8*sizeof(int))) { std::string msg = "SISO::gen_hyperTrellis: memory length of the hyperchannel should be at most "; msg += itpp::to_str(8*sizeof(int)-1); msg += ". Try to lower the number of users, channel order or the order of the precoding polynomial (if any)"; print_err_msg(msg); return; } chtrellis.stateNb = itpp::pow2i(mem_len); try { unsigned int len = static_cast(chtrellis.stateNb)*static_cast(chtrellis.numInputSymbols); chtrellis.nextState = new int[len]; chtrellis.prevState = new int[len]; chtrellis.output = new double[len]; chtrellis.input = new int[len]; } catch (std::bad_alloc) { std::string msg = "SISO::gen_hyperTrellis: not enough memory for the channel trellis variables. The number of states is "; msg += itpp::to_str(chtrellis.stateNb); msg += " and the number of input symbols "; msg += itpp::to_str(chtrellis.numInputSymbols); print_err_msg(msg); return; } itpp::ivec index(chtrellis.stateNb); index.zeros(); itpp::bvec hyper_ch_mem(mem_len); itpp::bvec hyper_ch_in(nb_usr); itpp::bvec hyper_states(mem_len); itpp::bin feedback; //create hypertrellis register int n,k,p,r; int buffer; double hyper_ch_out; for (k=0; k=0; n--) { buffer = -INFINITY;//normalization factor for (s=0; s. * * ------------------------------------------------------------------------- */ #include #include #include #ifndef INFINITY #define INFINITY std::numeric_limits::infinity() #endif namespace itpp { void SISO::gen_nsctrellis(void) /* generate trellis for non systematic non recursive convolutional codes r - number of outputs of the CC mem_len - memory length of the CC */ { //get parameters int r = gen.rows(); int mem_len = gen.cols()-1; //other parameters register int n,k,j,p; itpp::bin inputs[] = {0,1}; int index; nsctrellis.stateNb = (1<0; j--) { enc_mem[j] = enc_mem[j-1]; } for (k=0; k<2; k++) { enc_mem[0] = inputs[k]; nsctrellis.nextState[n+k*nsctrellis.stateNb] = itpp::bin2dec(enc_mem, true); } } #pragma omp parallel for private(n,k,j,index) for (j=0; j=0; n--) { sum = 0;//normalisation factor for (m=0; m=(nsctrellis.stateNb/2));//0 if input is 0, 1 if input is 1 C[0] = (index?apriori_data[n]:0); for (k=0; k=0; n--) { sum = -INFINITY;//normalisation factor for (m=0; m=(nsctrellis.stateNb/2));//0 if input is 0, 1 if input is 1 C[0] = (index?apriori_data[n]:0); for (k=0; k. * * ------------------------------------------------------------------------- */ #include #include #include #ifndef INFINITY #define INFINITY std::numeric_limits::infinity() #endif namespace itpp { void SISO::gen_rsctrellis(void) //generates 1/2 RSC trellis structure for binary symbols //the states are numbered from 0 { int mem_len = gen.cols()-1; register int n,k,j; itpp::bin feedback,out; int buffer; rsctrellis.numStates = (1<0; j--) { cases[j] = cases[j-1]; } cases[0] = feedback; //next and previous state buffer = itpp::bin2dec(cases, true); rsctrellis.nextStates[k+n*rsctrellis.numStates] = buffer;//next state rsctrellis.prevStates[buffer+n*rsctrellis.numStates] = k;//previous state } } } void SISO::rsc_logMAP(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data) /* logMAP (SISO) decoder for RSC of rate 1/2 extrinsic_coded - extrinsic information of coded bits extrinsic_data - extrinsic information of data (informational) bits intrinsic_coded - intrinsic information of coded (systematic and parity) bits apriori_data - a priori information of data (informational) bits Reference: Steven S. Pietrobon and Adrian S. Barbulescu, "A simplification of the modified Bahl decoding algorithm for systematic convolutional codes", Proc. ISITA, 1994 */ { //get parameters int N = apriori_data.length(); //other parameters register int n,k; double buffer; int index; double A_min, A_max; double sum0, sum1; //trellis generation gen_rsctrellis(); //parameter initialization double* Lc1I = new double[N]; double* Lc2I = new double[N]; #pragma omp parallel for private(n) for (n=0; n=0; n--) { for (k=0; k=0; n--) { for (k=0; k +1, 1 -> -1. * Changes have been made to adapt the code for RSC codes of rate 1/2 * and for soft input informations. * Improved SOVA has been implemented using a scaling factor and threshold for * the reliability information (see Wang [2003]). Even so, PCCC performance * are close to the original SOVA. */ { //number of code outputs int nb_outputs = gen.rows(); //setup internal variables based on RSC trellis register int i,j,s; gen_rsctrellis();//trellis generation for 1/2 RSC codes int nb_states = rsctrellis.numStates; itpp::Array bin_out(2);//contains code output for each initial state and code input itpp::imat next_state(nb_states,2);//next state in the trellis for (i=0; i<2; i++) { bin_out(i).set_size(nb_states, nb_outputs); for (j=0; j (0,0) itpp::mat surv(nb_states,win_len+1);//survivor state buffer surv.zeros(); itpp::mat inpt(nb_states,win_len+1);//survivor input buffer (dec. output) inpt.zeros(); itpp::mat diff(nb_states,win_len+1);//path metric difference diff.zeros(); itpp::mat comp(nb_states,win_len+1);//competitor state buffer comp.zeros(); itpp::mat inpc(nb_states,win_len+1);//competitor input buffer inpc.zeros(); //soft output (sign with reliability) itpp::vec sft(len); sft.zeros(); sft += INFINITY; //decode all the bits int Cur,Nxt,nxt,sur,b,tmp,idx; itpp::vec buf(nb_outputs); double llb,mtr,dif,cmp,inc,srv,inp; itpp::vec bin(nb_outputs); itpp::ivec cyclic_buffer(win_len); extrinsic_data.set_size(len); for (i = 0; i < len; i++) { //indices + precalculations Cur = i%(win_len+1);//curr trellis (cycl. buf) position Nxt = (i+1)%(win_len+1);//next trellis (cycl. buf) position buf = intrinsic_coded(i*nb_outputs,(i+1)*nb_outputs-1);//intrinsic_info portion to be processed llb = apriori_data(i);//SOVA: apriori_info portion to be processed metr.set_col(Nxt, -INFINITY*itpp::ones(nb_states)); //forward recursion for (s = 0; s bin_out(2);//contains code output for each initial state and code input itpp::imat next_state(nb_states,2);//next state in the trellis for (i=0; i<2; i++) { bin_out(i).set_size(nb_states, nb_outputs); for (j=0; j (0,0) itpp::mat surv(nb_states,win_len+1);//survivor state buffer surv.zeros(); itpp::mat inpt(nb_states,win_len+1);//survivor input bits buffer (dec. output) inpt.zeros(); itpp::mat parity(nb_states,win_len+1);//survivor parity bits buffer (dec. output) parity.zeros(); //decode all the bits int Cur,Nxt,nxt,sur,b; itpp::vec buf(nb_outputs); double llb,mtr; itpp::vec bin(nb_outputs); itpp::ivec cyclic_buffer(win_len); extrinsic_coded.set_size(2*len);//initialize memory for output extrinsic_data.set_size(len); for (i = 0; i < len; i++) { //indices + precalculations Cur = i%(win_len+1);//curr trellis (cycl. buf) position Nxt = (i+1)%(win_len+1);//next trellis (cycl. buf) position buf = intrinsic_coded(i*nb_outputs,(i+1)*nb_outputs-1);//intrinsic_info portion to be processed llb = apriori_data(i);//SOVA: apriori_info portion to be processed metr.set_col(Nxt, -INFINITY*itpp::ones(nb_states)); //forward recursion for (s = 0; s=0)^(extrinsic_data(i)==1.0); } itpp::ivec *ptr_idx_matching = new itpp::ivec; itpp::ivec *ptr_idx_nonmatching = new itpp::ivec; *ptr_idx_matching = itpp::find(tmp==itpp::bin(0)); *ptr_idx_nonmatching = itpp::find(tmp==itpp::bin(1)); //Estimated Bit Error Rate int idx_nonmatching_len = ptr_idx_nonmatching->length(); double error_rate = double(idx_nonmatching_len)/double(len); //Logarithm of Likelihood Ratio double LLR; if (error_rate==0.0) { LLR = std::log(double(len)); } else if (error_rate==1.0) { LLR = -std::log(double(len)); } else { LLR = std::log((1.0-error_rate)/error_rate); } for (i=0; ilength(); i++) { extrinsic_data(ptr_idx_matching->get(i)) = Viterbi_scaling_factor[0]* (2.0*extrinsic_data(ptr_idx_matching->get(i))-1.0)*LLR; } for (i=0; iget(i)) = Viterbi_scaling_factor[1]* (2.0*extrinsic_data(ptr_idx_nonmatching->get(i))-1.0)*LLR; } //extrinsic information extrinsic_data -= apriori_data; //provide soft output for coded bits tmp.set_length(2*len); for (i=0; i<(2*len); i++) { tmp(i) = (intrinsic_coded(i)>=0)^(extrinsic_coded(i)==1.0); } delete ptr_idx_matching;//free old memory delete ptr_idx_nonmatching; ptr_idx_matching = new itpp::ivec;//allocate memory for new vectors ptr_idx_nonmatching = new itpp::ivec; *ptr_idx_matching = itpp::find(tmp==itpp::bin(0)); *ptr_idx_nonmatching = itpp::find(tmp==itpp::bin(1)); //Estimated Bit Error Rate idx_nonmatching_len = ptr_idx_nonmatching->length(); error_rate = double(idx_nonmatching_len)/double(2*len); //Logarithm of Likelihood Ratio if (error_rate==0.0) { LLR = std::log(double(2*len)); } else if (error_rate==1.0) { LLR = -std::log(double(2*len)); } else { LLR = std::log((1.0-error_rate)/error_rate); } for (i=0; ilength(); i++) { extrinsic_coded(ptr_idx_matching->get(i)) = Viterbi_scaling_factor[0]* (2.0*extrinsic_coded(ptr_idx_matching->get(i))-1.0)*LLR; } for (i=0; iget(i)) = Viterbi_scaling_factor[1]* (2.0*extrinsic_coded(ptr_idx_nonmatching->get(i))-1.0)*LLR; } delete ptr_idx_matching; delete ptr_idx_nonmatching; //extrinsic information extrinsic_coded -= intrinsic_coded; } } itpp-4.3.1/itpp/comm/sources.mk000066400000000000000000000041721216575753400164410ustar00rootroot00000000000000h_comm_sources = \ $(top_srcdir)/itpp/comm/bch.h \ $(top_srcdir)/itpp/comm/channel_code.h \ $(top_srcdir)/itpp/comm/channel.h \ $(top_srcdir)/itpp/comm/commfunc.h \ $(top_srcdir)/itpp/comm/convcode.h \ $(top_srcdir)/itpp/comm/crc.h \ $(top_srcdir)/itpp/comm/egolay.h \ $(top_srcdir)/itpp/comm/error_counters.h \ $(top_srcdir)/itpp/comm/exit.h \ $(top_srcdir)/itpp/comm/galois.h \ $(top_srcdir)/itpp/comm/hammcode.h \ $(top_srcdir)/itpp/comm/interleave.h \ $(top_srcdir)/itpp/comm/ldpc.h \ $(top_srcdir)/itpp/comm/llr.h \ $(top_srcdir)/itpp/comm/modulator.h \ $(top_srcdir)/itpp/comm/modulator_nd.h \ $(top_srcdir)/itpp/comm/ofdm.h \ $(top_srcdir)/itpp/comm/pulse_shape.h \ $(top_srcdir)/itpp/comm/punct_convcode.h \ $(top_srcdir)/itpp/comm/rec_syst_conv_code.h \ $(top_srcdir)/itpp/comm/reedsolomon.h \ $(top_srcdir)/itpp/comm/sequence.h \ $(top_srcdir)/itpp/comm/siso.h \ $(top_srcdir)/itpp/comm/spread.h \ $(top_srcdir)/itpp/comm/stc.h \ $(top_srcdir)/itpp/comm/turbo.h cpp_comm_sources = \ $(top_srcdir)/itpp/comm/bch.cpp \ $(top_srcdir)/itpp/comm/channel.cpp \ $(top_srcdir)/itpp/comm/commfunc.cpp \ $(top_srcdir)/itpp/comm/convcode.cpp \ $(top_srcdir)/itpp/comm/crc.cpp \ $(top_srcdir)/itpp/comm/egolay.cpp \ $(top_srcdir)/itpp/comm/error_counters.cpp \ $(top_srcdir)/itpp/comm/exit.cpp \ $(top_srcdir)/itpp/comm/galois.cpp \ $(top_srcdir)/itpp/comm/hammcode.cpp \ $(top_srcdir)/itpp/comm/interleave.cpp \ $(top_srcdir)/itpp/comm/ldpc.cpp \ $(top_srcdir)/itpp/comm/llr.cpp \ $(top_srcdir)/itpp/comm/modulator.cpp \ $(top_srcdir)/itpp/comm/modulator_nd.cpp \ $(top_srcdir)/itpp/comm/ofdm.cpp \ $(top_srcdir)/itpp/comm/pulse_shape.cpp \ $(top_srcdir)/itpp/comm/punct_convcode.cpp \ $(top_srcdir)/itpp/comm/rec_syst_conv_code.cpp \ $(top_srcdir)/itpp/comm/reedsolomon.cpp \ $(top_srcdir)/itpp/comm/sequence.cpp \ $(top_srcdir)/itpp/comm/siso_dem.cpp \ $(top_srcdir)/itpp/comm/siso_eq.cpp \ $(top_srcdir)/itpp/comm/siso_mud.cpp \ $(top_srcdir)/itpp/comm/siso_nsc.cpp \ $(top_srcdir)/itpp/comm/siso_rsc.cpp \ $(top_srcdir)/itpp/comm/spread.cpp \ $(top_srcdir)/itpp/comm/stc.cpp \ $(top_srcdir)/itpp/comm/turbo.cpp itpp-4.3.1/itpp/comm/spread.cpp000066400000000000000000000113251216575753400164050ustar00rootroot00000000000000/*! * \file * \brief Implementation of spread spectrum classes and functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { //------------- Spread1d ------------------- Spread_1d::Spread_1d(const vec &incode) { set_code(incode); } void Spread_1d::set_code(const vec &incode) { N = incode.size(); code = incode; code /= norm(code); } vec Spread_1d::get_code() { return code; } void Spread_1d::spread(const vec &symbols, vec &out) { out.set_size(symbols.length()*N, false); for (int i = 0;i < symbols.length();i++) out.replace_mid(i*N, symbols(i)*code); } void Spread_1d::despread(const vec &rec_signal, vec &out, int timing) { int nosymbols = (int)std::floor(double((rec_signal.length() - timing)) / N); out.set_size(nosymbols); for (int i = 0;i < nosymbols;i++) out(i) = rec_signal.mid(i * N + timing, N) * code; } //---------------- Spread2d ---------------------- vec Spread_2d::get_codeI() { return spreadI.get_code(); } vec Spread_2d::get_codeQ() { return spreadQ.get_code(); } Spread_2d::Spread_2d(const vec &incodeI, const vec &incodeQ) { set_code(incodeI, incodeQ); } void Spread_2d::set_code(const vec &incodeI, const vec &incodeQ) { it_assert(incodeI.length() == incodeQ.length(), "Size of I and Q codes doesn't match"); spreadI.set_code(incodeI); spreadQ.set_code(incodeQ); } void Spread_2d::spread(const cvec &symbols, cvec &out) { out = to_cvec(spreadI.spread(real(symbols)), spreadQ.spread(imag(symbols))); } void Spread_2d::despread(const cvec &rec_signal, cvec &out, int timing) { out = to_cvec(spreadI.despread(real(rec_signal), timing), spreadQ.despread(imag(rec_signal), timing)); } //------------- Multicode_Spread_1d ---------------- Multicode_Spread_1d::Multicode_Spread_1d(const mat &incodes) { set_codes(incodes); } void Multicode_Spread_1d::set_codes(const mat &incodes) { codes = incodes; N = incodes.cols(); L = incodes.rows(); for (int i = 0; i < L; i++) codes.set_row(i, codes.get_row(i) / norm(codes.get_row(i))); } mat Multicode_Spread_1d::get_codes() { return codes; } vec Multicode_Spread_1d::spread(const vec &symbols) { int i; int nomcsymbols = (int)std::floor(double(symbols.length() / L)); vec temp(nomcsymbols*N); for (i = 0;i < nomcsymbols;i++) { temp.replace_mid(i*N, codes.T() * symbols.mid(i*L, L)); // TODO: this is now very slow } return temp; } vec Multicode_Spread_1d::despread(const vec &receivedsignal, int timing) { int i; int nosymbols = (int)std::floor(double((receivedsignal.length() - timing)) / N); vec temp(nosymbols*L); for (i = 0;i < nosymbols;i++) { temp.replace_mid(i*L, codes*receivedsignal.mid(i*N + timing, N)); } return temp; } //----------------- Multicode_Spread_2d ------------------- Multicode_Spread_2d::Multicode_Spread_2d(const mat &incodesI, const mat &incodesQ) { set_codes(incodesI, incodesQ); } mat Multicode_Spread_2d::get_codesI() { return mcspreadI.get_codes(); } mat Multicode_Spread_2d::get_codesQ() { return mcspreadQ.get_codes(); } void Multicode_Spread_2d::set_codes(const mat &incodesI, const mat &incodesQ) { it_assert(incodesI.rows() == incodesQ.rows() && incodesI.cols() == incodesQ.cols(), "Multicode_Spread_2d::set_codes(): dimension mismatch"); mcspreadI.set_codes(incodesI); mcspreadQ.set_codes(incodesQ); } cvec Multicode_Spread_2d::spread(const cvec &symbols) { return to_cvec(mcspreadI.spread(real(symbols)), mcspreadQ.spread(imag(symbols))); } cvec Multicode_Spread_2d::despread(const cvec &receivedsignal, int timing) { return to_cvec(mcspreadI.despread(real(receivedsignal), timing), mcspreadQ.despread(imag(receivedsignal), timing)); } } // namespace itpp itpp-4.3.1/itpp/comm/spread.h000066400000000000000000000225541216575753400160600ustar00rootroot00000000000000/*! * \file * \brief Definition of spread spectrum classes and functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SPREAD_H #define SPREAD_H #include #include #include namespace itpp { /*! \ingroup modulators \brief Spreading of float symbols to float output Spreading block for generation of 1-dimensional DS-CDMA signals Useful in the simulation of DS-CDMA systems on chip level or upsampled chip level. Obeserve that the spreading is normalized so that the energy per bit is preserved before and after spreading (that is each symbol is multiplied with \c 1/sqrt(N)). Hence, for the multicode case the energy is normalized for one symbol (code) but the transmitted signal consist of a sum of several signals. Four different classes exist:
    • Spread_1d for 1-dimensional symbols (e.g. BPSK).
    • Spread_2d for 2-dimensional symbols (e.g. QPSK).
    For multicode transmission, that is each user uses several codes in parallel to transmit data, there exist
    • Multicode_Spread_1d for 1-dimensional symbols.
    • Multicode_Spread_2d for 2-dimensional symbols.
    Example: \code #include "itpp/itcomm.h" int main() { //Generate the spreading code you want to use. vec spreading_code = "-1 1 -1 1"; //Initiate th Spreading class Spread_1d spread_1d(spreading_code); //Generate the symbols to transmitt bvec transmitted_bits = randb(10); BPSK bpsk; vec transmitted_symbols = bpsk.modulate_bits(transmitted_bits); //Spread the symbols vec transmitted_signal = spread_1d.spread(transmitted_symbols); //Generate the received signal vec received_signal = transmitted_signal; //Despread the received signal vec received_symbols = spread_1d.despread(received_signal,0); //demodulate the bits bvec received_bits = bpsk.demodulate_bits(received_symbols); } \endcode */ class ITPP_EXPORT Spread_1d { public: //! Constructor Spread_1d() { } //! Constructor Spread_1d(const vec &incode); //! Spreading of signal return i out. void spread(const vec &symbols, vec &out); //! Spreading of signal. vec spread(const vec &symbols) { vec out; spread(symbols, out); return out; } /*! \brief Despreading of signal. \a timing is the start position of the first symbol, given in number of samples. */ void despread(const vec &rec_signal, vec &out, int timing); /*! \brief Despreading of signal. \a timing is the start position of the first symbol, given in number of samples. */ vec despread(const vec &rec_signal, int timing) { vec out; despread(rec_signal, out, timing); return out; } //! Set the spreading code used for spreading void set_code(const vec &incode); //! Returns the spreading code used vec get_code(); //! Get the period of the code (length of code vector). int get_period() { return N; } protected: //! The spreading code vec code; //! The spreading factor int N; }; /*! \ingroup modulators \brief Spreading of complex symbols to complex output. The spreading are done independently for the I and Q phases. That is real(symbols) are spread by the incodeI and imag(symbols) are spread by incodeQ. Before despreading the phase should be corrected, that is the complex baseband signal should be multiplied by exp(j*PHIk), where PHIk is the phase of that user (and path). Obeserve that the spreading is normalized so that the energy per bit is preserved before and after spreading (that is each symbol is multiplied with \c 1/sqrt(N)). Hence, for the multicode case the energy is normalized for one symbol (code) but the transmitted signal consist of a sum of several signals. Example: See Spread_1d */ class ITPP_EXPORT Spread_2d { public: //! Constructor Spread_2d() { } //! Constructor Spread_2d(const vec &incodeI, const vec &incodeQ); //! Spreading of signal void spread(const cvec &symbols, cvec &out); //! Spreading of signal cvec spread(const cvec &symbols) { cvec out; spread(symbols, out); return out; } /*! \brief Despreading of signal. \a timing is the start position of the first symbol, given in number of samples. */ void despread(const cvec &rec_signal, cvec &out, int timing); /*! \brief Despreading of signal. \a timing is the start position of the first symbol, given in number of samples. */ cvec despread(const cvec &rec_signal, int timing) { cvec out; despread(rec_signal, out, timing); return out; } //! Set the in-phase and the quadrature-phase spreading codes void set_code(const vec &incodeI, const vec &incodeQ); //! Returns the in-phase spreading code vec get_codeI(); //! Returns the quadrature-phase spreading code vec get_codeQ(); //! Get the period of the code (length of code vector). int get_period() { return spreadI.get_period(); } protected: /*! The spreaders for the I and Q channels respectively * @{ */ Spread_1d spreadI, spreadQ; /*! @} */ }; /*! \ingroup modulators \brief Multicode spreading of float symbols Obeserve that the spreading is normalized so that the energy per bit is preserved before and after spreading (that is each symbol is multiplied with \c 1/sqrt(N)). Hence, for the multicode case the energy is normalized for one symbol (code) but the transmitted signal consist of a sum of several signals. Example: See Spread_1d */ class ITPP_EXPORT Multicode_Spread_1d { public: //! Constructor Multicode_Spread_1d() { } //! Constructor Multicode_Spread_1d(const mat &incodes); //! Spreading function vec spread(const vec &symbols); //! Despreading of signal. \a timing is the start position of the first symbol, given in number of samples. vec despread(const vec &receivedsignal, int timing); //! Set the spreading codes. Each row represent one spreading code. The spreading factor equals the number of columns void set_codes(const mat &incodes); //! Returns the matrix containing the spreading codes used as rows in the matrix mat get_codes(); //! Returns the spreading factor int get_period() { return N; } //! Returns the number of multi-codes used int get_nocodes() { return L; } protected: //! The spreading codes used size (\f$L \times N\f$) mat codes; //! The number of multi-codes int L; //! The spreading factor int N; }; /*! \ingroup modulators \brief Multicode spreading of complex symbols to complex output. The spreading are done independently for the I and Q phases. That is real(symbols) are spread by the incodeI and imag(symbols) are spread by incodeQ. Before despreading the phase should be corrected, that is the complex baseband signal should be multiplied by exp(j*PHIk), where PHIk is the phase of that user (and path). Obeserve that the spreading is normalized so that the energy per bit is preserved before and after spreading (that is each symbol is multiplied with \c 1/sqrt(N)). Hence, for the multicode case the energy is normalized for one symbol (code) but the transmitted signal consist of a sum of several signals. Example: See Spread_1d */ class ITPP_EXPORT Multicode_Spread_2d { public: //! Constructor Multicode_Spread_2d() { } //! Constructor Multicode_Spread_2d(const mat &incodesI, const mat &incodesQ); //! Spreading of signal cvec spread(const cvec &symbols); //! Despreading of signal. \a timing is the start position of the first symbol, given in number of samples. cvec despread(const cvec &receivedsignal, int timing); /*! \brief Set the spreading codes The codes are given as rows in the matricies \a incodesI and \a incodesQ. The number of rows shall equal the number of multiple spreading codes */ void set_codes(const mat &incodesI, const mat &incodesQ); //! Return the matrix containing the in-phase codes (as rows) mat get_codesI(); //! Return the matrix containing the quadrature-phase codes (as rows) mat get_codesQ(); //! Returns the spreading factor int get_period() { return mcspreadI.get_period(); } protected: /*! The multicode spreaders for the I and Q channels respectively * @{ */ Multicode_Spread_1d mcspreadI, mcspreadQ; /*! @} */ }; } // namespace itpp #endif // #ifndef SPREAD_H itpp-4.3.1/itpp/comm/stc.cpp000066400000000000000000000577641216575753400157410ustar00rootroot00000000000000/*! * \file * \brief Implementation of Space Time block Codes (STC) class * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2011 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { void STC::Hassibi_block_code(void) /* This function generates the A and B matrices needed for Space-Time block codes * generation following Hassibi's approach: * S = sum_{q=1}^symb_block (A_q alpha_q + jB_q beta_q), * where s_q = alpha_q+jbeta_q is the symbol after modulation * each A_q and B_q matrix has dimension TxM * different A_q and B_q matrices are stacked one below the other, e.g. * [A_1;A_2;...;A_Q] * input: code_name - code name whose generator matrices are to be generated * const_size - constellation size (used in Damen code) * outputs: symb_block - number of symbols per block * A, B - generator matrices * inputs/outputs: for some codes these are inputs for others they are * predefined, so they are outputs only * em_antennas - number of emission antenna * channel_uses - channel uses */ { if (code_name==Code_Names::V_BLAST_MxN)//classical V-BLAST { it_assert(channel_uses > 0, "Channel uses should be strictly positive"); it_assert(em_antenna > 0, "Number of emission antenna should be strictly positive"); symb_block = channel_uses*em_antenna;//number of symbols/block A.set_size(symb_block*channel_uses, em_antenna); A.zeros(); itpp::mat temp(channel_uses, em_antenna); temp.zeros(); register int tau,m; for (tau=0; tau 0, "Number of emission antenna should be strictly positive"); it_assert(channel_uses == em_antenna, "Channel uses and the number of emission antenna must be equal"); symb_block = channel_uses*em_antenna;//number of symbols/block std::complex j(0,1); itpp::cmat D = itpp::diag(exp(j*(2*itpp::pi/em_antenna)* itpp::linspace(0, em_antenna-1, em_antenna))); itpp::mat P = itpp::diag(itpp::ones(em_antenna-1), -1); P(0,em_antenna-1) = 1; A.set_size(symb_block*channel_uses, em_antenna); A.zeros(); register int k,l; for (k=0; k theta((1+std::sqrt(5.0))/2,0); std::complex theta_b((1-std::sqrt(5.0))/2,0); std::complex j(0,1); std::complex one(1,0); std::complex alpha = one+j*(one-theta); std::complex alpha_b = one+j*(one-theta_b); std::complex gamma = j; A.set_size(8,2); A(0,0) = alpha/std::sqrt(5.0); A(0,1) = 0; A(1,0) = 0; A(1,1) = alpha_b/std::sqrt(5.0);//A_1 A(2,0) = alpha*theta/std::sqrt(5.0); A(2,1) = 0; A(3,0) = 0; A(3,1) = alpha_b*theta_b/std::sqrt(5.0);//A_2 A(4,0) = 0; A(4,1) = gamma*alpha_b/std::sqrt(5.0); A(5,0) = alpha/std::sqrt(5.0); A(5,1) = 0;//A_3 A(6,0) = 0; A(6,1) = gamma*alpha_b*theta_b/std::sqrt(5.0); A(7,0) = alpha*theta/std::sqrt(5.0); A(7,1) = 0;//A_4 B = A; } else if (code_name== Code_Names::Damen_2x2)//ST code based on number theory as proposed by Damen { em_antenna = 2;//emission antenna channel_uses = 2;//channel uses symb_block = 4;//number of symbols/block double lambda; if (const_size==4) lambda = 0.5; else if (const_size==16) lambda = 0.521; else if (const_size>=256) lambda = itpp::pi/4; else { lambda = itpp::pi/4; std::cout << "STC::LDcode: Warning! For " << string_from_code_name(code_name) << " and const. size " << const_size << ", lambda has the " "value " << lambda << std::endl; } std::complex j(0,1); std::complex phi = std::exp(j*lambda); std::complex theta = std::exp(j*(lambda/2)); A.set_size(8, 2); A(0,0) = 1/std::sqrt(2.0); A(0,1) = 0; A(1,0) = 0; A(1,1) = 1/std::sqrt(2.0);//A_1 A(2,0) = phi/std::sqrt(2.0); A(2,1) = 0; A(3,0) = 0; A(3,1) = -phi/std::sqrt(2.0);//A_2 A(4,0) = 0; A(4,1) = theta/std::sqrt(2.0); A(5,0) = theta/std::sqrt(2.0); A(5,1) = 0;//A_3 A(6,0) = 0; A(6,1) = -theta*phi/std::sqrt(2.0); A(7,0) = theta*phi/std::sqrt(2.0); A(7,1) = 0;//A_4 B = A; } else if (code_name== Code_Names::ortho34_3xN)//rate 3/4 orthogonal code (mutual information 5.13 bits/channel use at rho=20 dB) { em_antenna = 3;//emission antenna channel_uses = 4;//channel uses symb_block = 3;//number of symbols/block A = "1 0 0;" "0 1 0;" "0 0 1;" "0 0 0;" "0 1 0;" "-1 0 0;" "0 0 0;" "0 0 1;" "0 0 1;" "0 0 0;" "-1 0 0;" "0 -1 0";//A_1; A_2; A_3 A /= std::sqrt(double(4)/double(3)); B = "1 0 0;" "0 -1 0;" "0 0 -1;" "0 0 0;" "0 1 0;" "1 0 0;" "0 0 0;" "0 0 -1;" "0 0 1;" "0 0 0;" "1 0 0;" "0 1 0";//B_1; B_2; B_3 B /= std::sqrt(double(4)/double(3)); } else if (code_name== Code_Names::LD36_3xN)//(36) LD code with mutual info. 6.25bits/channel use at rho=20dB { em_antenna = 3;//emission antenna channel_uses = 4;//channel uses symb_block = 4;//number of symbols/block A.set_size(16, 3); A(0,0) = 1; A(0,1) = 0; A(0,2) = 0; A(1,0) = 1; A(1,1) = 1; A(1,2) = 0; A(2,0) = 0; A(2,1) = 0; A(2,2) = 1; A(3,0) = 0; A(3,1) = 0; A(3,2) = 0;//A_1 A(4,0) = 0; A(4,1) = 1/std::sqrt(2.0); A(4,2) = 0; A(5,0) = -1/std::sqrt(2.0); A(5,1) = 0; A(5,2) = -1/std::sqrt(2.0); A(6,0) = 0; A(6,1) = 1/std::sqrt(2.0); A(6,2) = 0; A(7,0) = 1/std::sqrt(2.0); A(7,1) = 0; A(7,2) = -1/std::sqrt(2.0);//A_2 A(8,0) = 1; A(8,1) = 0; A(8,2) = 0; A(9,0) = 0; A(9,1) = 0; A(9,2) = 0; A(10,0) = 0; A(10,1) = 0; A(10,2) = -1; A(11,0) = 0; A(11,1) = -1; A(11,2) = 0;//A_3 A(12,0) = 0; A(12,1) = -1/std::sqrt(2.0); A(12,2) = 0; A(13,0) = 1/std::sqrt(2.0); A(13,1) = 0; A(13,2) = -1/std::sqrt(2.0); A(14,0) = 0; A(14,1) = 1/std::sqrt(2.0); A(14,2) = 0; A(15,0) = -1/std::sqrt(2.0); A(15,1) = 0; A(15,2) = -1/std::sqrt(2.0);//A_4 B.set_size(16, 3); B(0,0) = 0; B(0,1) = -1/std::sqrt(2.0); B(0,2) = 0; B(1,0) = -1/std::sqrt(2.0); B(1,1) = 0; B(1,2) = 1/std::sqrt(2.0); B(2,0) = 0; B(2,1) = 1/std::sqrt(2.0); B(2,2) = 0; B(3,0) = 1/std::sqrt(2.0); B(3,1) = 0; B(3,2) = 1/std::sqrt(2.0);//B_1 B(4,0) = 1/std::sqrt(2.0); B(4,1) = double(-1)/double(2); B(4,2) = 0; B(5,0) = double(-1)/double(2); B(5,1) = -1/std::sqrt(2.0); B(5,2) = double(-1)/double(2); B(6,0) = 0; B(6,1) = double(-1)/double(2); B(6,2) = 1/std::sqrt(2.0); B(7,0) = double(1)/double(2); B(7,1) = 0; B(7,2) = double(-1)/double(2);//B_2 B(8,0) = 1/std::sqrt(2.0); B(8,1) = double(1)/double(2); B(8,2) = 0; B(9,0) = double(1)/double(2); B(9,1) = -1/std::sqrt(2.0); B(9,2) = double(1)/double(2); B(10,0) = 0; B(10,1) = double(1)/double(2); B(10,2) = 1/std::sqrt(2.0); B(11,0) = double(-1)/double(2); B(11,1) = 0; B(11,2) = double(1)/double(2);//B_3 B(12,0) = 1; B(12,1) = 0; B(12,2) = 0; B(13,0) = 0; B(13,1) = 0; B(13,2) = 0; B(14,0) = 0; B(14,1) = 0; B(14,2) = -1; B(15,0) = 0; B(15,1) = 1; B(15,2) = 0;//B_4 } else if (code_name== Code_Names::LD37_3xN)//(37) LD code 3-antenna LD code obtained from the symetrical concatenation of 3 2-antenna orthogonal design { em_antenna = 3;//emission antenna channel_uses = 6;//channel uses symb_block = 6;//number of symbols/block A = "1 0 0;" "0 1 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 1 0;" "-1 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 1 0;" "0 0 1;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 1;" "0 -1 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "1 0 0;" "0 0 1;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 1;" "-1 0 0";//A_1; A_2; A_3; A_4; A_5; A_6 A *= std::sqrt(double(3)/double(2)); B = "1 0 0;" "0 -1 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 1 0;" "1 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 1 0;" "0 0 -1;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 1;" "0 1 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "1 0 0;" "0 0 -1;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 0;" "0 0 1;" "1 0 0";//B_1; B_2; B_3; B_4; B_5; B_6 B *= std::sqrt(double(3)/double(2)); } else if (code_name== Code_Names::LD39_3xN) { em_antenna = 3;//emission antenna channel_uses = 6;//channel uses symb_block = 6;//number of symbols/block A.set_size(36, 3); A(0,0) = 1/std::sqrt(2.0); A(0,1) = 0; A(0,2) = 0; A(1,0) = 0; A(1,1) = 1/std::sqrt(2.0); A(1,2) = 0; A(2,0) = 0; A(2,1) = 1/std::sqrt(2.0); A(2,2) = 0; A(3,0) = 0; A(3,1) = 0; A(3,2) = 1/std::sqrt(2.0); A(4,0) = 1/std::sqrt(2.0); A(4,1) = 0; A(4,2) = 0; A(5,0) = 0; A(5,1) = 0; A(5,2) = 1/std::sqrt(2.0);//A_1 A(6,0) = 0; A(6,1) = 1/std::sqrt(2.0); A(6,2) = 0; A(7,0) = -1/std::sqrt(2.0); A(7,1) = 0; A(7,2) = 0; A(8,0) = 0; A(8,1) = 0; A(8,2) = 1/std::sqrt(2.0); A(9,0) = 0; A(9,1) = -1/std::sqrt(2.0); A(9,2) = 0; A(10,0) = 0; A(10,1) = 0; A(10,2) = 1/std::sqrt(2.0); A(11,0) = -1/std::sqrt(2.0); A(11,1) = 0; A(11,2) = 0;//A_2 A(12,0) = 1/std::sqrt(2.0); A(12,1) = 0; A(12,2) = 0; A(13,0) = 0; A(13,1) = 1/std::sqrt(2.0); A(13,2) = 0; A(14,0) = 0; A(14,1) = -1/(2*std::sqrt(2.0)); A(14,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(15,0) = 0; A(15,1) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(15,2) = -1/(2*std::sqrt(2.0)); A(16,0) = -1/(2*std::sqrt(2.0)); A(16,1) = 0; A(16,2) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(17,0) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(17,1) = 0; A(17,2) = -1/(2*std::sqrt(2.0));//A_3 A(18,0) = 0; A(18,1) = 1/std::sqrt(2.0); A(18,2) = 0; A(19,0) = -1/std::sqrt(2.0); A(19,1) = 0; A(19,2) = 0; A(20,0) = 0; A(20,1) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(20,2) = -1/(2*std::sqrt(2.0)); A(21,0) = 0; A(21,1) = 1/(2*std::sqrt(2.0)); A(21,2) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(22,0) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(22,1) = 0; A(22,2) = -1/(2*std::sqrt(2.0)); A(23,0) = 1/(2*std::sqrt(2.0)); A(23,1) = 0; A(23,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0));//A_4 A(24,0) = 1/std::sqrt(2.0); A(24,1) = 0; A(24,2) = 0; A(25,0) = 0; A(25,1) = 1/std::sqrt(2.0); A(25,2) = 0; A(26,0) = 0; A(26,1) = -1/(2*std::sqrt(2.0)); A(26,2) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(27,0) = 0; A(27,1) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(27,2) = -1/(2*std::sqrt(2.0)); A(28,0) = -1/(2*std::sqrt(2.0)); A(28,1) = 0; A(28,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(29,0) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(29,1) = 0; A(29,2) = -1/(2*std::sqrt(2.0));//A_5 A(30,0) = 0; A(30,1) = 1/std::sqrt(2.0); A(30,2) = 0; A(31,0) = -1/std::sqrt(2.0); A(31,1) = 0; A(31,2) = 0; A(32,0) = 0; A(32,1) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(32,2) = -1/(2*std::sqrt(2.0)); A(33,0) = 0; A(33,1) = 1/(2*std::sqrt(2.0)); A(33,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); A(34,0) = std::sqrt(3.0)/(2*std::sqrt(2.0)); A(34,1) = 0; A(34,2) = -1/(2*std::sqrt(2.0)); A(35,0) = 1/(2*std::sqrt(2.0)); A(35,1) = 0; A(35,2) = std::sqrt(3.0)/(2*std::sqrt(2.0));//A_6 B.set_size(36, 3); B(0,0) = 1/std::sqrt(2.0); B(0,1) = 0; B(0,2) = 0; B(1,0) = 0; B(1,1) = -1/std::sqrt(2.0); B(1,2) = 0; B(2,0) = 0; B(2,1) = 1/std::sqrt(2.0); B(2,2) = 0; B(3,0) = 0; B(3,1) = 0; B(3,2) = -1/std::sqrt(2.0); B(4,0) = 1/std::sqrt(2.0); B(4,1) = 0; B(4,2) = 0; B(5,0) = 0; B(5,1) = 0; B(5,2) = -1/std::sqrt(2.0);//B_1 B(6,0) = 0; B(6,1) = 1/std::sqrt(2.0); B(6,2) = 0; B(7,0) = 1/std::sqrt(2.0); B(7,1) = 0; B(7,2) = 0; B(8,0) = 0; B(8,1) = 0; B(8,2) = 1/std::sqrt(2.0); B(9,0) = 0; B(9,1) = 1/std::sqrt(2.0); B(9,2) = 0; B(10,0) = 0; B(10,1) = 0; B(10,2) = 1/std::sqrt(2.0); B(11,0) = 1/std::sqrt(2.0); B(11,1) = 0; B(11,2) = 0;//B_2 B(12,0) = 1/std::sqrt(2.0); B(12,1) = 0; B(12,2) = 0; B(13,0) = 0; B(13,1) = -1/std::sqrt(2.0); B(13,2) = 0; B(14,0) = 0; B(14,1) = -1/(2*std::sqrt(2.0)); B(14,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(15,0) = 0; B(15,1) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(15,2) = 1/(2*std::sqrt(2.0)); B(16,0) = -1/(2*std::sqrt(2.0)); B(16,1) = 0; B(16,2) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(17,0) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(17,1) = 0; B(17,2) = 1/(2*std::sqrt(2.0));//B_3 B(18,0) = 0; B(18,1) = 1/std::sqrt(2.0); B(18,2) = 0; B(19,0) = 1/std::sqrt(2.0); B(19,1) = 0; B(19,2) = 0; B(20,0) = 0; B(20,1) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(20,2) = -1/(2*std::sqrt(2.0)); B(21,0) = 0; B(21,1) = -1/(2*std::sqrt(2.0)); B(21,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(22,0) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(22,1) = 0; B(22,2) = -1/(2*std::sqrt(2.0)); B(23,0) = -1/(2*std::sqrt(2.0)); B(23,1) = 0; B(23,2) = std::sqrt(3.0)/(2*std::sqrt(2.0));//B_4 B(24,0) = 1/std::sqrt(2.0); B(24,1) = 0; B(24,2) = 0; B(25,0) = 0; B(25,1) = -1/std::sqrt(2.0); B(25,2) = 0; B(26,0) = 0; B(26,1) = -1/(2*std::sqrt(2.0)); B(26,2) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(27,0) = 0; B(27,1) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(27,2) = 1/(2*std::sqrt(2.0)); B(28,0) = -1/(2*std::sqrt(2.0)); B(28,1) = 0; B(28,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(29,0) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(29,1) = 0; B(29,2) = 1/(2*std::sqrt(2.0));//B_5 B(30,0) = 0; B(30,1) = 1/std::sqrt(2.0); B(30,2) = 0; B(31,0) = 1/std::sqrt(2.0); B(31,1) = 0; B(31,2) = 0; B(32,0) = 0; B(32,1) = -std::sqrt(3.0)/(2*std::sqrt(2.0)); B(32,2) = -1/(2*std::sqrt(2.0)); B(33,0) = 0; B(33,1) = -1/(2*std::sqrt(2.0)); B(33,2) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(34,0) = std::sqrt(3.0)/(2*std::sqrt(2.0)); B(34,1) = 0; B(34,2) = -1/(2*std::sqrt(2.0)); B(35,0) = -1/(2*std::sqrt(2.0)); B(35,1) = 0; B(35,2) = -std::sqrt(3.0)/(2*std::sqrt(2.0));//B_6 } else { it_assert(false, "Unknown code name."); } } itpp::cmat STC::encode(const itpp::cvec &symb) //LD code generation (symb_block symbols go to an channel_uses x em_antennas matrix) following Hassibi's approach { int nb_subblocks = symb.length()/symb_block; int tx_duration = channel_uses*nb_subblocks; itpp::cmat S(tx_duration,em_antenna); itpp::cmat temp(channel_uses,em_antenna); std::complex j(0,1); register int ns,k; for (ns=0; ns >(symb(k+ns*symb_block).real())+ j*B(k*channel_uses,(k+1)*channel_uses-1,0,em_antenna-1)* static_cast< std::complex >(symb(k+ns*symb_block).imag())); } S.set_submatrix(ns*channel_uses, 0, temp); } return S; } itpp::cmat STC::diag_pow(const itpp::cmat &in_mat, double in_exp) //first input should be a diagonal square matrix with complex elements { register int n; int dim = in_mat.rows(); itpp::cmat out_mat(dim,dim); out_mat.zeros(); for (n=0; n0)?out:itpp::inv(out); } } itpp-4.3.1/itpp/comm/stc.h000066400000000000000000000206751216575753400153750ustar00rootroot00000000000000/*! * \file * \brief Definitions for Space Time Codes (STC) class * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2011 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef STC_H #define STC_H #include //IT++ base module #include namespace itpp { /*! \ingroup misccommfunc \brief Space Time block Codes (STC) class Implements space time block codes using Hassibi's model. The following codes are available: - V-BLAST_MxN - imp_V-BLAST_MxN - Alamouti_2xN - Switched_Alamouti_4xN - Double_Alamouti_4xN - Jafarkhani_4xN - Golden_2x2 - Damen_2x2 - 34ortho_3xN - 36LD_3xN - 37LD_3xN - 39LD_3xN The code name and the constellation size are always needed to generate the requested code. The number of emission antenna and the channel uses are required by some codes to be provided by the user as input parameters, for other codes they have predefined values and don't need to be specified by the user. The number of symbols per block is always set internally. Therefore, it is recommended that after setting up the generator matrices (either through the constructor or through the setup() method) to call getters in order to obtain the number of emission antenna, the channel uses and the number of symbols per block. Usage example: \code STC stc(code_name, const_size); nb_em_antenna = stc.get_nb_emission_antenna(); channel_uses = stc.get_channel_uses(); symb_block = stc.get_nb_symbols_per_block(); //symbol generation enc_symb = stc.encode(symb); \endcode Reference: B. Hassibi and B. M. Hochwald, ''High-rate codes that are linear in space and time,`` IEEE Transactions on Information Theory, vol. 48, pp. 1804-1824, July 2002 */ class ITPP_EXPORT STC { public: //! Space Time Code constructor (sets up the generator matrices using Hassibi's method) inline STC(const std::string &in_code_name, //!< code name (see available codes) int in_const_size, //!< constellation size (should be at least two) int in_em_antenna = 0, //!< number of emission antenna (for some codes it is set internally and should be obtained with get_nb_emission_antenna()) int in_channel_uses = 0 //!< number of channel uses (for some codes it is set internally and should be obtained with get_channel_uses()) ) { setup(in_code_name, in_const_size, in_em_antenna, in_channel_uses); } //! Sets up the generator matrices using Hassibi's method (can be used to obtain new generator matrices, e.g. for a different code) inline void setup(const std::string &in_code_name, //!< code name (see available codes) int in_const_size, //!< constellation size (should be at least two) int in_em_antenna = 0, //!< number of emission antenna (for some codes it is set internally and should be obtained with get_nb_emission_antenna()) int in_channel_uses = 0 //!< number of channel uses (for some codes it is set internally and should be obtained with get_channel_uses()) ) { code_name = code_name_from_string(in_code_name); it_assert(in_const_size >= 2, "Constellation size should be at least two"); const_size = in_const_size; em_antenna = in_em_antenna; channel_uses = in_channel_uses; Hassibi_block_code(); } //! Gets the number of emission antenna (for some codes this is a predefined parameter) inline int get_nb_emission_antenna(void) const { return em_antenna; } //! Gets the channel uses (for some codes this is a predefined parameter) inline int get_channel_uses(void) const { return channel_uses; } //! Gets the number of symbols per block (for all codes this is an output parameter) inline int get_nb_symbols_per_block(void) const { return symb_block; } //! Gets the first generator matrix of the ST code following Hassibi's approach inline itpp::cmat get_1st_gen_matrix(void) const { return A; } //! Gets the second generator matrix of the ST code following Hassibi's approach inline itpp::cmat get_2nd_gen_matrix(void) const { return B; } //! Encodes input symbols according to the specified ST code itpp::cmat encode(const itpp::cvec &symb); private: STC(const STC&);//not used STC& operator=(const STC&);//not used void Hassibi_block_code(void); itpp::cmat diag_pow(const itpp::cmat &in_mat, double in_exp); itpp::mat mat_pow(const itpp::mat &in_mat, int in_exp); struct ITPP_EXPORT Code_Names { enum Type {Unknown, V_BLAST_MxN, imp_V_BLAST_MxN, Alamouti_2xN, Switched_Alamouti_4xN, Double_Alamouti_4xN, Jafarkhani_4xN, Golden_2x2, Damen_2x2, ortho34_3xN, LD36_3xN, LD37_3xN, LD39_3xN}; Code_Names() : _t(Unknown) {} Code_Names(Type t) : _t(t) {} operator Type () const {return _t;} private: Type _t; template operator T () const; }; Code_Names code_name; int const_size; int em_antenna; int channel_uses; int symb_block; itpp::cmat A; itpp::cmat B; static Code_Names code_name_from_string(const std::string &name); static std::string string_from_code_name(const Code_Names& cn); }; inline STC::Code_Names STC::code_name_from_string(const std::string &name) { if (name=="V-BLAST_MxN") { return Code_Names::V_BLAST_MxN; } else if (name =="imp_V-BLAST_MxN") { return Code_Names::imp_V_BLAST_MxN; } else if (name =="Alamouti_2xN") { return Code_Names::Alamouti_2xN; } else if (name =="Switched_Alamouti_4xN") { return Code_Names::Switched_Alamouti_4xN; } else if (name =="Double_Alamouti_4xN") { return Code_Names::Double_Alamouti_4xN; } else if (name =="Jafarkhani_4xN") { return Code_Names::Jafarkhani_4xN; } else if (name =="Golden_2x2") { return Code_Names::Golden_2x2; } else if (name =="Damen_2x2") { return Code_Names::Damen_2x2; } else if (name =="34ortho_3xN") { return Code_Names::ortho34_3xN; } else if (name =="36LD_3xN") { return Code_Names::LD36_3xN; } else if (name =="37LD_3xN") { return Code_Names::LD37_3xN; } else if (name =="39LD_3xN") { return Code_Names::LD39_3xN; } else { return Code_Names::Unknown; } } inline std::string STC::string_from_code_name(const STC::Code_Names& cn) { if (cn==Code_Names::V_BLAST_MxN) { return std::string("V-BLAST_MxN"); } else if (cn==Code_Names::imp_V_BLAST_MxN) { return std::string("imp_V-BLAST_MxN"); } else if (cn==Code_Names::Alamouti_2xN) { return std::string("Alamouti_2xN"); } else if (cn==Code_Names::Switched_Alamouti_4xN) { return std::string("Switched_Alamouti_4xN"); } else if (cn==Code_Names::Double_Alamouti_4xN) { return std::string("Double_Alamouti_4xN"); } else if (cn==Code_Names::Jafarkhani_4xN) { return std::string("Jafarkhani_4xN"); } else if (cn==Code_Names::Golden_2x2) { return std::string("Golden_2x2"); } else if (cn==Code_Names::Damen_2x2) { return std::string("Damen_2x2"); } else if (cn==Code_Names::ortho34_3xN) { return std::string("34ortho_3xN"); } else if (cn==Code_Names::LD36_3xN) { return std::string("36LD_3xN"); } else if (cn==Code_Names::LD37_3xN) { return std::string("37LD_3xN"); } else if (cn==Code_Names::LD39_3xN) { return std::string("39LD_3xN"); } else { return std::string("Unknown"); } } } #endif /* STC_H_ */ itpp-4.3.1/itpp/comm/turbo.cpp000066400000000000000000001141141216575753400162620ustar00rootroot00000000000000/*! * \file * \brief Implementation of a turbo encoder/decoder class * \author Pal Frenger. QLLR support by Erik G. Larsson. * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // ------------------------------------------------------------------------------------- // Turbo Codec // ------------------------------------------------------------------------------------- std::string Turbo_Codec::string_from_metric(const Turbo_Codec::Metric& in_metric) { if(in_metric == Metric::LOGMAX) { return std::string("LOGMAX"); } else if(in_metric == Metric::LOGMAP) { return std::string("LOGMAP"); } else if(in_metric == Metric::MAP) { return std::string("MAP"); } else if(in_metric == Metric::TABLE) { return std::string("TABLE"); } else { return std::string("UNKNOWN"); } } void Turbo_Codec::set_parameters(ivec gen1, ivec gen2, int constraint_length, const ivec &interleaver_sequence, int in_iterations, const std::string &in_metric, double in_logmax_scale_factor, bool in_adaptive_stop, LLR_calc_unit in_llrcalc) { //Set the input parameters: iterations = in_iterations; interleaver_size = interleaver_sequence.size(); Nuncoded = interleaver_size; logmax_scale_factor = in_logmax_scale_factor; adaptive_stop = in_adaptive_stop; //Check the decoding metric if(in_metric == "LOGMAX") { metric = Metric::LOGMAX; } else if(in_metric == "LOGMAP") { metric = Metric::LOGMAP; } else if(in_metric == "MAP") { metric = Metric::MAP; } else if(in_metric == "TABLE") { metric = Metric::TABLE; } else { it_error("Turbo_Codec::set_parameters: The decoder metric must be either MAP, LOGMAP, LOGMAX or TABLE"); } if(logmax_scale_factor != 1.0) { it_assert(metric == Metric::LOGMAX, "Turbo_Codec::set_parameters: logmax_scale_factor can only be used together with LOGMAX decoding"); } //The RSC Encoders: rscc1.set_generator_polynomials(gen1, constraint_length); rscc2.set_generator_polynomials(gen2, constraint_length); n1 = gen1.length() - 1; //Number of parity bits from rscc1 n2 = gen2.length() - 1; //Number of parity bits from rscc2 n_tot = 1 + n1 + n2; //Total number of parity bits and systematic bits //Set the number of tail bits: m_tail = constraint_length - 1; //Calculate the number of coded bits per code-block: Ncoded = Nuncoded * n_tot + m_tail * (1 + n1) + m_tail * (1 + n2); //Set the interleaver sequence bit_interleaver.set_interleaver_depth(interleaver_size); float_interleaver.set_interleaver_depth(interleaver_size); bit_interleaver.set_interleaver_sequence(interleaver_sequence); float_interleaver.set_interleaver_sequence(interleaver_sequence); //Default value of the channel reliability scaling factor is 1 Lc = 1.0; // LLR algebra table rscc1.set_llrcalc(in_llrcalc); rscc2.set_llrcalc(in_llrcalc); } void Turbo_Codec::set_interleaver(const ivec &interleaver_sequence) { interleaver_size = interleaver_sequence.size(); Nuncoded = interleaver_size; //Calculate the number of coded bits per code-block: Ncoded = Nuncoded * n_tot + m_tail * (1 + n1) + m_tail * (1 + n2); //Set the interleaver sequence bit_interleaver.set_interleaver_depth(interleaver_size); float_interleaver.set_interleaver_depth(interleaver_size); bit_interleaver.set_interleaver_sequence(interleaver_sequence); float_interleaver.set_interleaver_sequence(interleaver_sequence); } void Turbo_Codec::set_metric(std::string in_metric, double in_logmax_scale_factor, LLR_calc_unit in_llrcalc) { logmax_scale_factor = in_logmax_scale_factor; //Check the decoding metric if(in_metric == "LOGMAX") { metric = Metric::LOGMAX; } else if(in_metric == "LOGMAP") { metric = Metric::LOGMAP; } else if(in_metric == "MAP") { metric = Metric::MAP; } else if(in_metric == "TABLE") { metric = Metric::TABLE; } else { it_error("Turbo_Codec::set_metric: The decoder metric must be either MAP, LOGMAP, LOGMAX or TABLE"); } rscc1.set_llrcalc(in_llrcalc); rscc2.set_llrcalc(in_llrcalc); } void Turbo_Codec::set_iterations(int in_iterations) { iterations = in_iterations; } void Turbo_Codec::set_adaptive_stop(bool in_adaptive_stop) { adaptive_stop = in_adaptive_stop; } void Turbo_Codec::set_awgn_channel_parameters(double in_Ec, double in_N0) { Ec = in_Ec; N0 = in_N0; Lc = 4.0 * std::sqrt(Ec) / N0; } void Turbo_Codec::set_scaling_factor(double in_Lc) { Lc = in_Lc; } void Turbo_Codec::encode(const bvec &input, bvec &output) { //Local variables: int i, k, j, no_blocks; int count; bvec input_bits, in1, in2, tail1, tail2, out; bmat parity1, parity2; //Initializations: no_blocks = input.length() / Nuncoded; output.set_size(no_blocks * Ncoded, false); //Set the bit counter to zero: count = 0; //Encode all code blocks: for(i = 0; i < no_blocks; i++) { //Encode one block input_bits = input.mid(i * Nuncoded, Nuncoded); encode_block(input_bits, in1, in2, parity1, parity2); //The data part: for(k = 0; k < Nuncoded; k++) { output(count) = in1(k); count++; //Systematic bits for(j = 0; j < n1; j++) { output(count) = parity1(k, j); count++; } //Parity-1 bits for(j = 0; j < n2; j++) { output(count) = parity2(k, j); count++; } //Parity-2 bits } //The first tail: for(k = 0; k < m_tail; k++) { output(count) = in1(Nuncoded + k); count++; //First systematic tail bit for(j = 0; j < n1; j++) { output(count) = parity1(Nuncoded + k, j); count++; } //Parity-1 tail bits } //The second tail: for(k = 0; k < m_tail; k++) { output(count) = in2(Nuncoded + k); count++; //Second systematic tail bit for(j = 0; j < n2; j++) { output(count) = parity2(Nuncoded + k, j); count++; } //Parity-2 tail bits } } } void Turbo_Codec::decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits) { ivec nrof_used_iterations; decode(received_signal, decoded_bits, nrof_used_iterations, true_bits); } void Turbo_Codec::decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits) { if((n1 == 1) && (n2 == 1) && (metric != Metric::MAP)) { //This is a speed optimized decoder for R=1/3 (log domain metrics only) decode_n3(received_signal, decoded_bits, nrof_used_iterations, true_bits); } else { //Local variables: vec rec, rec_syst1, rec_syst2; mat rec_parity1, rec_parity2; bmat decoded_bits_i; int no_blocks, i, j, k, nrof_used_iterations_i; int count; bool CHECK_TRUE_BITS; //Initilaizations: no_blocks = received_signal.length() / Ncoded; decoded_bits.set_size(no_blocks * Nuncoded, false); decoded_bits_i.set_size(iterations, no_blocks * Nuncoded, false); rec_syst1.set_size(Nuncoded + m_tail, false); rec_syst2.set_size(Nuncoded + m_tail, false); rec_syst2.clear(); rec_parity1.set_size(Nuncoded + m_tail, n1, false); rec_parity2.set_size(Nuncoded + m_tail, n2, false); nrof_used_iterations.set_size(no_blocks, false); //Check the vector true_bits: if(true_bits.size() > 1) { it_assert(true_bits.size() == (Nuncoded * no_blocks), "Turbo_Codec::decode: Wrong size of input vectors"); CHECK_TRUE_BITS = true; } else { CHECK_TRUE_BITS = false; } //Set the bit counter to zero: count = 0; //Itterate over all received code blocks: for(i = 0; i < no_blocks; i++) { //The data part: for(k = 0; k < Nuncoded; k++) { rec_syst1(k) = received_signal(count); count++; //Systematic bit for(j = 0; j < n1; j++) { rec_parity1(k, j) = received_signal(count); count++; } //Parity-1 bits for(j = 0; j < n2; j++) { rec_parity2(k, j) = received_signal(count); count++; } //Parity-2 bits } //The first tail: for(k = 0; k < m_tail; k++) { rec_syst1(Nuncoded + k) = received_signal(count); count++; //Tail 1 systematic bit for(j = 0; j < n1; j++) { rec_parity1(Nuncoded + k, j) = received_signal(count); count++; } //Tail 1 parity-1 bits } //The second tail: for(k = 0; k < m_tail; k++) { rec_syst2(Nuncoded + k) = received_signal(count); count++; //Tail2 systematic bit for(j = 0; j < n2; j++) { rec_parity2(Nuncoded + k, j) = received_signal(count); count++; } //Tali2 parity-2 bits } //Scale the input data if necessary: if(Lc != 1.0) { rec_syst1 *= Lc; rec_syst2 *= Lc; rec_parity1 *= Lc; rec_parity2 *= Lc; } //Decode the block: if(CHECK_TRUE_BITS) { decode_block(rec_syst1, rec_syst2, rec_parity1, rec_parity2, decoded_bits_i, nrof_used_iterations_i, true_bits.mid(i * Nuncoded, Nuncoded)); nrof_used_iterations(i) = nrof_used_iterations_i; } else { decode_block(rec_syst1, rec_syst2, rec_parity1, rec_parity2, decoded_bits_i, nrof_used_iterations_i); nrof_used_iterations(i) = nrof_used_iterations_i; } //Put the decoded bits in the output vector: decoded_bits.replace_mid(i * Nuncoded, decoded_bits_i.get_row(iterations - 1)); } } } void Turbo_Codec::encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2) { //Local variables: bvec tail1, tail2, interleaved_input; //Error check: it_assert(input.length() == Nuncoded, "Turbo_Codec::encode_block: Parameter error in Nuncoded."); //Initializations: tail1.set_size(m_tail, false); tail1.clear(); tail2.set_size(m_tail, false); tail2.clear(); parity1.set_size(Nuncoded + m_tail, n1, false); parity1.clear(); parity2.set_size(Nuncoded + m_tail, n2, false); parity2.clear(); interleaved_input.set_size(Nuncoded, false); interleaved_input.clear(); //The first encoder: rscc1.encode_tail(input, tail1, parity1); //The interleaver: bit_interleaver.interleave(input, interleaved_input); //The second encoder: rscc2.encode_tail(interleaved_input, tail2, parity2); //The input vectors used to the two constituent encoders: in1 = concat(input, tail1); in2 = concat(interleaved_input, tail2); } void Turbo_Codec::decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2, bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits) { //Local variables: int i; int count, l, k; vec extrinsic_input, extrinsic_output, int_rec_syst1, int_rec_syst, tmp; vec deint_rec_syst2, rec_syst, sub_rec_syst, Le12, Le21, Le12_int, Le21_int, L, tail1, tail2; bool CHECK_TRUE_BITS, CONTINUE; //Size initializations: decoded_bits_i.set_size(iterations, Nuncoded, false); Le12.set_size(Nuncoded + m_tail, false); Le21.set_size(Nuncoded + m_tail, false); Le21.zeros(); //Calculate the interleaved and the deinterleaved sequences: float_interleaver.interleave(rec_syst1.left(interleaver_size), int_rec_syst1); float_interleaver.deinterleave(rec_syst2.left(interleaver_size), deint_rec_syst2); //Combine the results from rec_syst1 and rec_syst2 (in case some bits are transmitted several times) rec_syst = rec_syst1.left(interleaver_size) + deint_rec_syst2; int_rec_syst = rec_syst2.left(interleaver_size) + int_rec_syst1; //Get the two tails tail1 = rec_syst1.right(m_tail); tail2 = rec_syst2.right(m_tail); //Form the input vectors (including tails) to the two decoders: rec_syst = concat(rec_syst, tail1); int_rec_syst = concat(int_rec_syst, tail2); // Check the vector true_bits if(true_bits.size() > 1) { it_assert(true_bits.size() == Nuncoded, "Turbo_Codec::decode_block: Illegal size of input vector true_bits"); CHECK_TRUE_BITS = true; } else { CHECK_TRUE_BITS = false; } if(CHECK_TRUE_BITS) { it_assert(adaptive_stop == false, "Turbo_Codec::decode_block: You can not stop iterations both adaptively and on true bits"); } // Do the iterative decoding: nrof_used_iterations_i = iterations; for(i = 0; i < iterations; i++) { // Decode Code 1 if(metric == Metric::MAP) { rscc1.map_decode(rec_syst, rec_parity1, Le21, Le12, true); } else if((metric == Metric::LOGMAX) || (metric == Metric::LOGMAP) || (metric == Metric::TABLE)) { rscc1.log_decode(rec_syst, rec_parity1, Le21, Le12, true, string_from_metric(metric)); if(logmax_scale_factor != 1.0) { Le12 *= logmax_scale_factor; } } else { it_error("Turbo_Codec::decode_block: Illegal metric value"); } // Interleave the extrinsic information: float_interleaver.interleave(Le12.left(interleaver_size), tmp); Le12_int = concat(tmp, zeros(Le12.size() - interleaver_size)); // Decode Code 2 if(metric == Metric::MAP) { rscc2.map_decode(int_rec_syst, rec_parity2, Le12_int, Le21_int, true); } else if((metric == Metric::LOGMAX) || (metric == Metric::LOGMAP) || (metric == Metric::TABLE)) { rscc2.log_decode(int_rec_syst, rec_parity2, Le12_int, Le21_int, true, string_from_metric(metric)); if(logmax_scale_factor != 1.0) { Le21_int *= logmax_scale_factor; } } else { it_error("Turbo_Codec::decode_block: Illegal metric value"); } // De-interleave the extrinsic information: float_interleaver.deinterleave(Le21_int.left(interleaver_size), tmp); Le21 = concat(tmp, zeros(Le21_int.size() - interleaver_size)); // Take bit decisions L = rec_syst + Le21 + Le12; count = 0; for(l = 0; l < Nuncoded; l++) { (L(l) > 0.0) ? (decoded_bits_i(i, count) = bin(0)) : (decoded_bits_i(i, count) = bin(1)); count++; } //Check if it is possible to stop iterating early: CONTINUE = true; if(i < (iterations - 1)) { if(CHECK_TRUE_BITS) { CONTINUE = false; for(k = 0; k < Nuncoded; k++) { if(true_bits(k) != decoded_bits_i(i, k)) { CONTINUE = true; break; } } } if((adaptive_stop) && (i > 0)) { CONTINUE = false; for(k = 0; k < Nuncoded; k++) { if(decoded_bits_i(i - 1, k) != decoded_bits_i(i, k)) { CONTINUE = true; break; } } } } //Check if iterations shall continue: if(CONTINUE == false) { //Copy the results from current iteration to all following iterations: for(k = (i + 1); k < iterations; k++) { decoded_bits_i.set_row(k, decoded_bits_i.get_row(i)); nrof_used_iterations_i = i + 1; } break; } } } void Turbo_Codec::decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits) { //Local variables: vec rec, rec_syst1, int_rec_syst1, rec_syst2; vec rec_parity1, rec_parity2; vec extrinsic_input, extrinsic_output, Le12, Le21, Le12_int, Le21_int, L; bvec temp_decoded_bits; int no_blocks, i, j, k, l, nrof_used_iterations_i; int count, count_out; bool CHECK_TRUE_BITS, CONTINUE; //Initializations: no_blocks = received_signal.length() / Ncoded; decoded_bits.set_size(no_blocks * Nuncoded, false); rec_syst1.set_size(Nuncoded + m_tail, false); rec_syst2.set_size(Nuncoded + m_tail, false); rec_syst2.clear(); rec_parity1.set_size(Nuncoded + m_tail, false); rec_parity2.set_size(Nuncoded + m_tail, false); temp_decoded_bits.set_size(Nuncoded, false); decoded_bits_previous_iteration.set_size(Nuncoded, false); nrof_used_iterations.set_size(no_blocks, false); //Size initializations: Le12.set_size(Nuncoded, false); Le21.set_size(Nuncoded, false); //Set the bit counter to zero: count = 0; count_out = 0; // Check the vector true_bits if(true_bits.size() > 1) { it_assert(true_bits.size() == Nuncoded * no_blocks, "Turbo_Codec::decode_n3: Illegal size of input vector true_bits"); CHECK_TRUE_BITS = true; } else { CHECK_TRUE_BITS = false; } if(CHECK_TRUE_BITS) { it_assert(adaptive_stop == false, "Turbo_Codec::decode_block: You can not stop iterations both adaptively and on true bits"); } //Iterate over all received code blocks: for(i = 0; i < no_blocks; i++) { //Reset extrinsic data: Le21.zeros(); //The data part: for(k = 0; k < Nuncoded; k++) { rec_syst1(k) = received_signal(count); count++; //Systematic bit rec_parity1(k) = received_signal(count); count++; //Parity-1 bits rec_parity2(k) = received_signal(count); count++; //Parity-2 bits } //The first tail: for(k = 0; k < m_tail; k++) { rec_syst1(Nuncoded + k) = received_signal(count); count++; //Tail 1 systematic bit rec_parity1(Nuncoded + k) = received_signal(count); count++; //Tail 1 parity-1 bits } //The second tail: for(k = 0; k < m_tail; k++) { rec_syst2(Nuncoded + k) = received_signal(count); count++; //Tail2 systematic bit rec_parity2(Nuncoded + k) = received_signal(count); count++; //Tali2 parity-2 bits } float_interleaver.interleave(rec_syst1.left(Nuncoded), int_rec_syst1); rec_syst2.replace_mid(0, int_rec_syst1); //Scale the input data if necessary: if(Lc != 1.0) { rec_syst1 *= Lc; rec_syst2 *= Lc; rec_parity1 *= Lc; rec_parity2 *= Lc; } //Decode the block: CONTINUE = true; nrof_used_iterations_i = iterations; for(j = 0; j < iterations; j++) { rscc1.log_decode_n2(rec_syst1, rec_parity1, Le21, Le12, true, string_from_metric(metric)); if(logmax_scale_factor != 1.0) { Le12 *= logmax_scale_factor; } float_interleaver.interleave(Le12, Le12_int); rscc2.log_decode_n2(rec_syst2, rec_parity2, Le12_int, Le21_int, true, string_from_metric(metric)); if(logmax_scale_factor != 1.0) { Le21_int *= logmax_scale_factor; } float_interleaver.deinterleave(Le21_int, Le21); if(adaptive_stop) { L = rec_syst1.left(Nuncoded) + Le21.left(Nuncoded) + Le12.left(Nuncoded); for(l = 0; l < Nuncoded; l++) {(L(l) > 0.0) ? (temp_decoded_bits(l) = bin(0)) : (temp_decoded_bits(l) = bin(1)); } if(j == 0) { decoded_bits_previous_iteration = temp_decoded_bits; } else { if(temp_decoded_bits == decoded_bits_previous_iteration) { CONTINUE = false; } else if(j < (iterations - 1)) { decoded_bits_previous_iteration = temp_decoded_bits; } } } if(CHECK_TRUE_BITS) { L = rec_syst1.left(Nuncoded) + Le21.left(Nuncoded) + Le12.left(Nuncoded); for(l = 0; l < Nuncoded; l++) {(L(l) > 0.0) ? (temp_decoded_bits(l) = bin(0)) : (temp_decoded_bits(l) = bin(1)); } if(temp_decoded_bits == true_bits.mid(i * Nuncoded, Nuncoded)) { CONTINUE = false; } } if(CONTINUE == false) { nrof_used_iterations_i = j + 1; break; } } //Take final bit decisions L = rec_syst1.left(Nuncoded) + Le21.left(Nuncoded) + Le12.left(Nuncoded); for(l = 0; l < Nuncoded; l++) { (L(l) > 0.0) ? (decoded_bits(count_out) = bin(0)) : (decoded_bits(count_out) = bin(1)); count_out++; } nrof_used_iterations(i) = nrof_used_iterations_i; } } // ------------------------------------------------------------------------------------- // Punctured Turbo Codec // ------------------------------------------------------------------------------------- void Punctured_Turbo_Codec::set_parameters(ivec gen1, ivec gen2, int constraint_length, const ivec &interleaver_sequence, bmat &pmatrix, int in_iterations, std::string in_metric, double in_logmax_scale_factor, bool in_adaptive_stop, itpp::LLR_calc_unit lcalc) { Turbo_Codec::set_parameters(gen1, gen2, constraint_length, interleaver_sequence, in_iterations, in_metric, in_logmax_scale_factor, in_adaptive_stop, lcalc); set_puncture_matrix(pmatrix); } void Punctured_Turbo_Codec::set_puncture_matrix(const bmat &pmatrix) { int p, j; punct_total = 0; punct_total2 = 0; it_error_if(pmatrix.rows() != n_tot || pmatrix.cols() == 0, "Wrong size of puncture matrix"); puncture_matrix = pmatrix; Period = puncture_matrix.cols(); // all rows for(j = 0; j < n_tot; j++) { for(p = 0; p < Period; p++) punct_total += static_cast(puncture_matrix(j, p)); } // systematic bits for(p = 0; p < Period; p++) punct_total2 += static_cast(puncture_matrix(0, p)); punct_total1 = punct_total2; // 1st code parity bits for(j = 1; j < n1 + 1; j++) { for(p = 0; p < Period; p++) punct_total1 += static_cast(puncture_matrix(j, p)); } // 2nd code parity bits for(j = 1 + n1; j < n_tot; j++) { for(p = 0; p < Period; p++) punct_total2 += static_cast(puncture_matrix(j, p)); } // nominal rate rate = Period / static_cast(punct_total); calculate_punctured_size(); } double Punctured_Turbo_Codec::get_rate(bool nominal) { if(nominal) return rate; else { if(Period == 0) return static_cast(Nuncoded) / Ncoded; else return static_cast(Nuncoded) / pNcoded; } } bvec Punctured_Turbo_Codec::encode(const bvec &input) { bvec coded_bits; encode(input, coded_bits); return coded_bits; } bvec Punctured_Turbo_Codec::decode(const vec &received_signal) { bvec decoded_bits; decode(received_signal, decoded_bits); return decoded_bits; } void Punctured_Turbo_Codec::encode(const bvec &input, bvec &output) { it_assert(Period != 0, "Punctured_Turbo_Codec: puncture matrix is not set"); Turbo_Codec::encode(input, output); int i, k, p, j, p1; int no_blocks = output.size() / Ncoded; int count = 0, count_p = 0; for(k = 0; k < no_blocks; k++) { p = 0; // data for(i = 0; i < Nuncoded; i++) { for(j = 0; j < n_tot; j++) { if(puncture_matrix(j, p) == bin(1)) { output(count_p) = output(count); count_p++; } count++; } p = (p + 1) % Period; } p1 = p; //The first tail: for(i = 0; i < m_tail; i++) { for(j = 0; j < n1 + 1; j++) { if(puncture_matrix(j, p) == bin(1)) { output(count_p) = output(count); count_p++; } count++; } p = (p + 1) % Period; } //The second tail: for(i = 0; i < m_tail; i++) { // systematic bit if(puncture_matrix(0, p1) == bin(1)) { output(count_p) = output(count); count_p++; } count++; // parity for(j = n1 + 1; j < n_tot; j++) { if(puncture_matrix(j, p1) == bin(1)) { output(count_p) = output(count); count_p++; } count++; } p1 = (p1 + 1) % Period; } } //for output.set_size(count_p, true); } void Punctured_Turbo_Codec::decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits) { int i, k, p, j, p1; int index = 0, index_p = 0; int no_blocks = received_signal.size() / pNcoded; vec temp(no_blocks * Ncoded); it_assert(Period != 0, "Punctured_Turbo_Codec: puncture matrix is not set"); it_assert(no_blocks * pNcoded == received_signal.size(), "Punctured_Turbo_Codec: received vector is not an integer multiple of encoded block"); for(i = 0; i < no_blocks; i++) { p = 0; // data for(k = 0; k < Nuncoded; k++) { for(j = 0; j < n_tot; j++) { if(puncture_matrix(j, p) == bin(1)) { temp(index) = received_signal(index_p); index_p++; } else { // insert dummy symbols with same contribution for 0 and 1 temp(index) = 0; } index++; } p = (p + 1) % Period; } // for p1 = p; // 1st code tail for(k = 0; k < m_tail; k++) { for(j = 0; j < n1 + 1; j++) { if(puncture_matrix(j, p) == bin(1)) { temp(index) = received_signal(index_p); index_p++; } else { // insert dummy symbols with same contribution for 0 and 1 temp(index) = 0; } index++; } p = (p + 1) % Period; } // for // 2nd code tail for(k = 0; k < m_tail; k++) { // systematic bits if(puncture_matrix(0, p1) == bin(1)) { temp(index) = received_signal(index_p); index_p++; } else { // insert dummy symbols with same contribution for 0 and 1 temp(index) = 0; } index++; // parity bits for(j = n1 + 1; j < n_tot; j++) { if(puncture_matrix(j, p1) == bin(1)) { temp(index) = received_signal(index_p); index_p++; } else { // insert dummy symbols with same contribution for 0 and 1 temp(index) = 0; } index++; } p1 = (p1 + 1) % Period; } //2nd tail } // for Turbo_Codec::decode(temp, decoded_bits, nrof_used_iterations, true_bits); } void Punctured_Turbo_Codec::decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits) { ivec nrof_used_iterations; decode(received_signal, decoded_bits, nrof_used_iterations, true_bits); } void Punctured_Turbo_Codec::calculate_punctured_size(void) { int i, j, ii, p = 0, p1; if(Period == 0) pNcoded = Ncoded; else { i = (Nuncoded / Period); ii = i * punct_total; i *= Period; for(; i < Nuncoded; i++) { for(j = 0; j < n_tot; j++) if(puncture_matrix(j, p) == bin(1)) ii++; p = (p + 1) % Period; } p1 = p; // first tail for(i = 0; i < m_tail; i++) { for(j = 0; j < n1 + 1; j++) if(puncture_matrix(j, p) == bin(1)) ii++; p = (p + 1) % Period; } // second tail for(i = 0; i < m_tail; i++) { for(j = 0; j < n_tot; j++) { if(puncture_matrix(j, p1) == bin(1)) ii++; if(j == 0) j += n1; } p1 = (p1 + 1) % Period; } pNcoded = ii; } } int calculate_uncoded_size(Punctured_Turbo_Codec &tc, int punctured_size, int &fill_bits) { // fill_bits - number of bits that must be added at the end of encoded block (in order to obtain punctured_size length vector) int Nuncoded; if(tc.Period == 0) { Nuncoded = (punctured_size - tc.m_tail * (tc.n_tot + 1)) / tc.n_tot; fill_bits = punctured_size - (Nuncoded * tc.n_tot + tc.m_tail * (tc.n_tot + 1)); } else { int i, j, ii, p, p1, no_pblocks; // uncoded - // no_pblocks might be too small j = static_cast(std::ceil(static_cast(tc.m_tail * (tc.punct_total1 + tc.punct_total2)) / tc.Period)); no_pblocks = (punctured_size - j) / tc.punct_total; ii = punctured_size - no_pblocks * tc.punct_total - j; for(i = 0; i < 2 * tc.Period; i++) { for(j = 0; j < tc.n_tot; j++) if(tc.puncture_matrix(j, i % tc.Period) == bin(1)) ii--; if(ii < 0) break; } Nuncoded = no_pblocks * tc.Period + i; // punctured (from uncoded) no_pblocks = (Nuncoded / tc.Period); ii = no_pblocks * tc.punct_total; p = 0; for(i = no_pblocks * tc.Period; i < Nuncoded; i++) { for(j = 0; j < tc.n_tot; j++) if(tc.puncture_matrix(j, p) == bin(1)) ii++; p = (p + 1) % tc.Period; } p1 = p; // first tail for(i = 0; i < tc.m_tail; i++) { for(j = 0; j < tc.n1 + 1; j++) if(tc.puncture_matrix(j, p1) == bin(1)) ii++; p1 = (p1 + 1) % tc.Period; } // second tail for(i = 0; i < tc.m_tail; i++) { for(j = 0; j < tc.n_tot; j++) { if(tc.puncture_matrix(j, p1) == bin(1)) ii++; if(j == 0) j += tc.n1; } p1 = (p1 + 1) % tc.Period; } fill_bits = punctured_size - ii; } return Nuncoded; } // ------------------------------------------------------------------------------------- // Special interleaver sequence generators // ------------------------------------------------------------------------------------- ivec wcdma_turbo_interleaver_sequence(int interleaver_size) { const int MAX_INTERLEAVER_SIZE = 5114; const int MIN_INTERLEAVER_SIZE = 40; int K; //Interleaver size int R; //Number of rows of rectangular matrix int C; //Number of columns of rectangular matrix int p; //Prime number int v; //Primitive root ivec s; //Base sequence for intra-row permutation ivec q; //Minimum prime integers ivec r; //Permuted prime integers ivec T; //Inter-row permutation pattern imat U; //Intra-row permutation patter ivec I; //The interleaver sequence ivec primes, roots, Pat1, Pat2, Pat3, Pat4, Isort; int i, j, qj, temp, row, col, index, count; if(interleaver_size > MAX_INTERLEAVER_SIZE) { I = sort_index(randu(interleaver_size)); return I; } else { p = 0; v = 0; //Check the range of the interleaver size: it_assert(interleaver_size <= MAX_INTERLEAVER_SIZE, "wcdma_turbo_interleaver_sequence: The interleaver size is to large"); it_assert(interleaver_size >= MIN_INTERLEAVER_SIZE, "wcdma_turbo_interleaver_sequence: The interleaver size is to small"); K = interleaver_size; //Definitions of primes and associated primitive roots: primes = "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257"; roots = "0 0 0 3 2 2 3 2 5 2 3 2 6 3 5 2 2 2 2 7 5 3 2 3 5 2 5 2 6 3 3 2 3 2 2 6 5 2 5 2 2 2 19 5 2 3 2 3 2 6 3 7 7 6 3"; //Determine R if((K >= 40) && (K <= 159)) { R = 5; } else if(((K >= 160) && (K <= 200)) || ((K >= 481) && (K <= 530))) { R = 10; } else { R = 20; } //Determine C if((K >= 481) && (K <= 530)) { p = 53; v = 2; C = p; } else { //Find minimum prime p such that (p+1) - K/R >= 0 ... for(i = 0; i < primes.length(); i++) { if((double(primes(i) + 1) - double(K) / double(R)) >= 0.0) { p = primes(i); v = roots(i); break; } } //... and etermine C such that if((double(p) - double(K) / double(R)) >= 0.0) { if((double(p) - 1.0 - double(K) / double(R)) >= 0.0) { C = p - 1; } else { C = p; } } else { C = p + 1; } } //Construct the base sequencs s for intra-row permutaions s.set_size(p - 1, false); s.clear(); s(0) = 1; for(i = 1; i <= (p - 2); i++) { s(i) = mod(v * s(i - 1), p); } //Let q(0) = 1 be the first prime integer in {q(j)}, and select the consecutive //minimum prime integers {q(j)}, j = 1, 2, ..., (R-1) such that gcd( q(j), p-1) == 1, q(j) > 6, and q(j) > q(j-1) q.set_size(R, false); q.clear(); q(0) = 1; for(j = 1; j <= (R - 1); j++) { for(i = 0; i < primes.length(); i++) { qj = primes(i); if((qj > 6) && (qj > q(j - 1))) { if(gcd(qj, p - 1) == 1) { q(j) = qj; break; } } } } //Definitions of Pat1, Pat2, Pat3, and Pat4: Pat1 = "19 9 14 4 0 2 5 7 12 18 10 8 13 17 3 1 16 6 15 11"; Pat2 = "19 9 14 4 0 2 5 7 12 18 16 13 17 15 3 1 6 11 8 10"; Pat3 = "9 8 7 6 5 4 3 2 1 0"; Pat4 = "4 3 2 1 0"; //T(j) is the inter-row permutation patters defined as one of the following four //kinds of patterns: Pat1, Pat2, Pat3, and Pat4 depending on the number of input bits K if(K >= 3211) { T = Pat1; } else if(K >= 3161) { T = Pat2; } else if(K >= 2481) { T = Pat1; } else if(K >= 2281) { T = Pat2; } else if(K >= 531) { T = Pat1; } else if(K >= 481) { T = Pat3; } else if(K >= 201) { T = Pat1; } else if(K >= 160) { T = Pat3; } else { T = Pat4; } //Permute {q(j)} to make {r(j)} such that r(T(j)) = q(j), j = 0, 1, ..., (R-1), //where T(j) indicates the original row position of the j-th permuted row r.set_size(R, false); r.clear(); for(j = 0; j <= (R - 1); j++) { r(T(j)) = q(j); } //U(j,i) is the input bit position of i-th output after the permutation of j-th row //Perform the j-th (j=0, 1, 2, ..., (R-1)) intra-row permutation as U.set_size(R, C, false); U.clear(); if(C == p) { for(j = 0; j <= (R - 1); j++) { for(i = 0; i <= (p - 2); i++) { U(j, i) = s(mod(i * r(j), p - 1)); } U(j, p - 1) = 0; } } else if(C == (p + 1)) { for(j = 0; j <= (R - 1); j++) { for(i = 0; i <= (p - 2); i++) { U(j, i) = s(mod(i * r(j), p - 1)); } U(j, p - 1) = 0; U(j, p) = p; } if(K == (C * R)) { temp = U(R - 1, p); U(R - 1, p) = U(R - 1, 0); U(R - 1, 0) = temp; } } else if(C == (p - 1)) { for(j = 0; j <= (R - 1); j++) { for(i = 0; i <= (p - 2); i++) { U(j, i) = s(mod(i * r(j), p - 1)) - 1; } } } //Calculate the interleaver sequence: I.set_size(K, false); I.clear(); count = 0; for(i = 0; i < C; i++) { for(j = 0; j < R; j++) { row = T(j); col = U(row, i); index = row * C + col; if(index < K) { I(count) = index; count++; } } } return I; } } ivec lte_turbo_interleaver_sequence(int interleaver_size) // for standard see pp. 14 http://www.3gpp.org/FTP/Specs/latest/Rel-10/36_series/36212-a50.zip { //Definitions of block lengths and associated f1 and f2 factors: ivec block_lengths("40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 160 168 176 184 192 200 208 216 224 232 240 248 256 264 272 280 288 296 304 312 320 328 336 344 352 360 368 376 384 392 400 408 416 424 432 440 448 456 464 472 480 488 496 504 512 528 544 560 576 592 608 624 640 656 672 688 704 720 736 752 768 784 800 816 832 848 864 880 896 912 928 944 960 976 992 1008 1024 1056 1088 1120 1152 1184 1216 1248 1280 1312 1344 1376 1408 1440 1472 1504 1536 1568 1600 1632 1664 1696 1728 1760 1792 1824 1856 1888 1920 1952 1984 2016 2048 2112 2176 2240 2304 2368 2432 2496 2560 2624 2688 2752 2816 2880 2944 3008 3072 3136 3200 3264 3328 3392 3456 3520 3584 3648 3712 3776 3840 3904 3968 4032 4096 4160 4224 4288 4352 4416 4480 4544 4608 4672 4736 4800 4864 4928 4992 5056 5120 5184 5248 5312 5376 5440 5504 5568 5632 5696 5760 5824 5888 5952 6016 6080 6144"); ivec f1_factors(" 3 7 19 7 7 11 5 11 7 41 103 15 9 17 9 21 101 21 57 23 13 27 11 27 85 29 33 15 17 33 103 19 19 37 19 21 21 115 193 21 133 81 45 23 243 151 155 25 51 47 91 29 29 247 29 89 91 157 55 31 17 35 227 65 19 37 41 39 185 43 21 155 79 139 23 217 25 17 127 25 239 17 137 215 29 15 147 29 59 65 55 31 17 171 67 35 19 39 19 199 21 211 21 43 149 45 49 71 13 17 25 183 55 127 27 29 29 57 45 31 59 185 113 31 17 171 209 253 367 265 181 39 27 127 143 43 29 45 157 47 13 111 443 51 51 451 257 57 313 271 179 331 363 375 127 31 33 43 33 477 35 233 357 337 37 71 71 37 39 127 39 39 31 113 41 251 43 21 43 45 45 161 89 323 47 23 47 263"); ivec f2_factors("10 12 42 16 18 20 22 24 26 84 90 32 34 108 38 120 84 44 46 48 50 52 36 56 58 60 62 32 198 68 210 36 74 76 78 120 82 84 86 44 90 46 94 48 98 40 102 52 106 72 110 168 114 58 118 180 122 62 84 64 66 68 420 96 74 76 234 80 82 252 86 44 120 92 94 48 98 80 102 52 106 48 110 112 114 58 118 60 122 124 84 64 66 204 140 72 74 76 78 240 82 252 86 88 60 92 846 48 28 80 102 104 954 96 110 112 114 116 354 120 610 124 420 64 66 136 420 216 444 456 468 80 164 504 172 88 300 92 188 96 28 240 204 104 212 192 220 336 228 232 236 120 244 248 168 64 130 264 134 408 138 280 142 480 146 444 120 152 462 234 158 80 96 902 166 336 170 86 174 176 178 120 182 184 186 94 190 480"); const int MAX_INTERLEAVER_SIZE = 6144; const int MIN_INTERLEAVER_SIZE = 40; // Check the range of the interleaver size: it_assert(interleaver_size <= MAX_INTERLEAVER_SIZE, "lte_turbo_interleaver_sequence: The interleaver size is too large"); it_assert(interleaver_size >= MIN_INTERLEAVER_SIZE, "lte_turbo_interleaver_sequence: The interleaver size is too small"); // Check whether the given interleaver size is correct: int left, right, index, temp; bool search = true; // do a binary search for interleaver_size in block_lengths left = 0; right = block_lengths.size() - 1; temp = 0; while((search) && (left <= right)) { index = (left + right) / 2; temp = block_lengths(index); if(temp == interleaver_size) { search = false; } else { if(temp > interleaver_size) { right = index - 1; } else { left = index + 1; } } } it_assert(!search, "lte_turbo_interleaver_sequence: The interleaver size is incorrect!"); // Definitions of key parameters: int K = interleaver_size; // Interleaver size int f1_factor = f1_factors(index); int f2_factor = f2_factors(index); ivec I(K); //The interleaver sequence // Calculate the interleaver sequence: for(int i = 0; i < K; i++) { I(i) = static_cast((static_cast(i) * f1_factor + static_cast(i) * i * f2_factor) % K); } return I; } } // namespace itpp itpp-4.3.1/itpp/comm/turbo.h000066400000000000000000000557741216575753400157470ustar00rootroot00000000000000/*! * \file * \brief Definition of a (punctured) turbo encoder/decoder class * \author Pal Frenger and Zbigniew Dlugaszewski. QLLR support by Erik G. Larsson. * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef TURBO_H #define TURBO_H #include #include #include #include namespace itpp { //! \cond #if (defined(_MSC_VER) && defined (ITPP_SHARED_LIB)) //MSVC explicitely instantiate required template while building the shared library template class ITPP_EXPORT Sequence_Interleaver; template class ITPP_EXPORT Sequence_Interleaver; #endif //! \endcond /*! \brief Turbo encoder/decoder Class \ingroup fec \author Pal Frenger To set up the turbo encoder used in e.g. WCDMA the following code can be used (assuming a code block size of 320 bits): \code Turbo_Codec turbo; ivec gen(2); gen(0) = 013; gen(1) = 015; int constraint_length = 4; ivec interleaver_sequence = wcdma_turbo_interleaver_sequence( 320 ); turbo.set_parameters(gen, gen, constraint_length, interleaver_sequence); \endcode */ class ITPP_EXPORT Turbo_Codec { public: //! Class constructor Turbo_Codec(void) {} //! Class destructor virtual ~Turbo_Codec(void) {} /*! \brief Set parameters for the turbo encoder/decoder \param gen1 A vector with \a n1 elements containing the generator polynomials for the first constituent encoder \param gen2 A vector with \a n2 elements containing the generator polynomials for the second constituent encoder \param constraint_length The constraint length of the two constituent encoders \param interleaver_sequence An ivec defining the internal turbo interleaver. \param in_iterations The number of decoding iterations. Default value is 8. \param in_metric Determines the decoder metric: "MAP", LOGMAP", "LOGMAX", or "TABLE". The default is "LOGMAX". \param in_logmax_scale_factor The extrinsic information from each constituent decoder is to optimistic when LOGMAX decoding is used. This parameter allows for a down-scaling of the extrinsic information that will be passed on to the next decoder. The default value is 1.0. This parameter is ignored for other metrics than "LOGMAX". \param in_adaptive_stop If this parameter is true, then the iterations will stop if the decoding results after one full iteration equals the previous iteration. Default value is false. \param lcalc This parameter can be used to provide a specific \c LLR_calc_unit which defines the resolution in the table-lookup if decoding with the metric "TABLE" is used. \note For issues relating to the accuracy of LLR computations, please see the documentation of \c LLR_calc_unit */ void set_parameters(ivec gen1, ivec gen2, int constraint_length, const ivec &interleaver_sequence, int in_iterations = 8, const std::string &in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0, bool in_adaptive_stop = false, LLR_calc_unit lcalc = LLR_calc_unit()); /*! \brief Set a new internal interleaver sequence for the turbo encoder/decoder By changing the interleaver sequence it is possible to change the code word size of the turbo codec. Note that you still must use the \a set_parameters function first to set the other parameters of the turbo codec. */ void set_interleaver(const ivec &interleaver_sequence); /*! \brief Set the decoder metric \param in_metric Determines the decoder metric: "MAP", LOGMAP", "LOGMAX", or "TABLE". The default is "LOGMAX". \param in_logmax_scale_factor The extrinsic information from each constituent decoder is to optimistic when LOGMAX decoding is used. This parameter allows for a down-scaling of the extrinsic information that will be passed on to the next decoder. The default value is 1.0. This parameter is ignored for other metrics than "LOGMAX". \param lcalc This parameter can be used to provide a specific \c LLR_calc_unit which defines the resolution in the table-lookup if decoding with the metric "TABLE" is used. */ void set_metric(std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0, LLR_calc_unit lcalc = LLR_calc_unit()); /*! \brief Sets the number of decoding iterations. Default value is 8. */ void set_iterations(int in_iterations = 8); /*! \brief Use and adaptive number of iterations When the adaptive stop criterion is used the iterations will stop before the maximum number of iterations is executed if the decoding results after one full iteration equals the previous iteration. Default value is \c true. */ void set_adaptive_stop(bool in_adaptive_stop = true); /*! \brief Set parameters for decoding on an AWGN channel \param in_Ec The received energy per channel symbol (i.e. per soft input bit) \param in_N0 The single sided spectral density of the AWGN noise */ void set_awgn_channel_parameters(double in_Ec, double in_N0); /*! \brief Set scaling factor for decoding on e.g. Rayleigh fading channels Setting the correct value of the channel reliability function is important for MAP decoder algorithms. However, if the Log-MAX decoding algorithm is used, then the value of \a Lc is not important. Assuming that the received soft values \f$r_k\f$ from the channel equal \f[ r_k = h_k c_k + w_k \f] where \f$h_k\f$ is the (complex valued) channel gain, \f$c_k\f$ is the transmitted symbol equal to \f$\{-\sqrt{E_c},+\sqrt{E_c}\}\f$, and \f$w_k\f$ is the AWGN (complex valued) noise with total variance of the real plus imaginary part equal to \f$N_0\f$. The input to the turbo decoder shall then be \f[ z_k = \hat{h}_k^{*} r_k \f] where \f$\hat{h}_k^{*}\f$ is the conjugate of the channel estimate. Assuming that the channel estimate is perfect, the channel reliability factor shall be set to \f[ L_c = 4\sqrt{E_c} / {N_0} \f] \param in_Lc the channel reliability factor of the channel. */ void set_scaling_factor(double in_Lc); /*! \brief Encoder function This function can encode several consecutive coding blocks. The output is organized as follows: \f[ s(1), p_{1,1}(1), p_{1,2}(1), \ldots , p_{1,n_1}(1), p_{2,1}(1), p_{2,2}(1), \ldots , p_{2,n_2}(1), s(2), \ldots \f] In the above expression \f$s(n)\f$ is the n-th systematic bit and \f$p_{l,k}(n)\f$ is the n-th bit from the k-th encoder polynomial of the l-th constituent encoder. A tail of both systematic and parity bits is added after each coding block to force both encoder to the zero state. The tail of each encoder is structured as follows (using encoder one as an example): \f[ t_1(1), pt_{1,1}(1), pt_{1,2}(1), \ldots , pt_{1,n_1}(1), \ldots pt_{1,n_1}(m) \f] The tailbits from the first encoder are placed before the tailbits from the second encoder. \param input The input bits to the encoder. Must contain an integer number of code blocks \param output The encoded bits including two tail, one from each constituent encoder, after each coding block. */ void encode(const bvec &input, bvec &output); /*! \brief Decoder function This function can decode several consecutive coding blocks that were encoded with the encode member function \param received_signal The vector of received bits \param decoded_bits A vector of decoded bits \param true_bits If this input vector is provided then the iterations will stop as soon as the decoded bits equals the \c true_bits. Note that this feature can not be used if the \c in_adaptive_stop parameter in the setup function is set to \c true. */ virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits = "0"); /*! \brief Decoder function This function can decode several consecutive coding blocks that were encoded with the encode member function \param received_signal The vector of received bits \param decoded_bits A vector of decoded bits \param nrof_used_iterations Returns the number of used iterations for each code block. \param true_bits If this input vector is provided then the iterations will stop as soon as the decoded bits equals the \c true_bits. Note that this feature can not be used if the \c in_adaptive_stop parameter in the setup function is set to \c true. */ virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits = "0"); /*! \brief Encode a single block This function is useful if rate matching is to be applied after the turbo encoder. The size of \a in1 and \a in2 equals the size of \a input plus the tail bits. Tailbits are appended ate the end of \a in1 and \a in2. The number of rows in \a parity1 and \a parity2 equals the lengths of \a in1 and \a in2 respectively. The number of columns of \a parity1 and \a parity2 equals the number of parity bits from the first and the second constituent encoders respectively. \param input The input bits to the encoder. Must contain a single code block \param in1 The input bits to the first constituent encoder with a tail added at the end \param in2 The input bits to the second constituent encoder (i.e. the interleaved data bits) with a tail added at the end \param parity1 The parity bits from the first constituent encoder (including parity bits for the first tail) \param parity2 The parity bits from the second constituent encoder (including parity bits for the second tail) */ void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2); /*! \brief Decode a single block This function can decode a single coding blocks that was encoded with the encode_block member function. In order to speed up the decoding process it is possible to input the correct data bits. If this information is provided the decoder can stop iterating as soon as the decoded bits match the correct data bits. This simulation trick can greatly speed up the simulation time for high SNR cases when only a few iterations are required. If errors still exist after the maximum number of iterations have been performed, the decoding process stops. The matrix \a decoded_bits_i contains the result from decoding iteration \a i on row \a i. Even though both \a rec_syst1 and \a rec_syst2 are given as inputs, the systematic bits in \a rec_syst2 will in most cases be punctured and only the tailbits at the end of the vector \a rec_syst2 will have values different from zero. \note This decoding function assumes that the input is scaled as +-2*SNR + noise. This means that the channel reliability factor \a Lc must be equal to 1.0. No additional scaling is performed by this function. \param rec_syst1 The received input bits to the first constituent decoder with a tail added at the end \param rec_syst2 The received input bits to the second constituent decoder with a tail added at the end \param rec_parity1 The received parity bits for the first constituent decoder (including parity bits for the first tail) \param rec_parity2 The received parity bits for the second constituent decoder (including parity bits for the second tail) \param decoded_bits_i Contains the result from decoding iteration \a i on row \a i. \param nrof_used_iterations_i Returns the number of iterations used for decoding of this block. \param true_bits Optional input parameter. If given, the iterations will stop as soon as the decoded bits match the true bits. */ virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2, bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits = "0"); //! Get number of coded bits int get_Ncoded() const { return Ncoded; } //! Get number of uncoded bits int get_Nuncoded() const { return Nuncoded; } protected: /*! \brief Special decoder function for \a R = 1/3 i.e. two parity bits for each systematic bit */ void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits = "0"); //Scalars: int interleaver_size; int Ncoded, Nuncoded; int m_tail, n1, n2, n_tot, iterations; double Ec, N0, Lc, R, logmax_scale_factor; bool adaptive_stop; struct ITPP_EXPORT Metric { enum Type {Unknown, LOGMAX, LOGMAP, MAP, TABLE}; Metric() : _t(Unknown) {} Metric(Type t) : _t(t) {} operator Type () const {return _t;} private: Type _t; template operator T () const; }; Metric metric; //Vectors: bvec decoded_bits_previous_iteration; //Classes: Rec_Syst_Conv_Code rscc1, rscc2; Sequence_Interleaver bit_interleaver; Sequence_Interleaver float_interleaver; static std::string string_from_metric(const Metric& m); }; /*! \brief Punctured turbo encoder/decoder Class \ingroup fec \author Zbigniew Dlugaszewski To set up the turbo encoder rate 1/2 with random interleaver the following code can be used: \code Punctured_Turbo_Codec turbo; ivec gen(2); gen(0) = 013; gen(1) = 015; int constraint_length = 4; int block_length = 400; turbo.set_parameters(gen, gen, constraint_length, block_length); bmat puncture_matrix = "1 1;1 0;0 1"; turbo.set_puncture_matrix(puncture_matrix); \endcode */ class ITPP_EXPORT Punctured_Turbo_Codec : public Turbo_Codec { public: //! Class constructor Punctured_Turbo_Codec(void) { Period = 0; }; //! Class destructor virtual ~Punctured_Turbo_Codec(void) {} /*! \brief Set parameters for the punctured turbo encoder/decoder the same parameters as with \c Turbo_Codec : \param gen1 A vector with \a n1 elements containing the generator polynomials for the first constituent encoder \param gen2 A vector with \a n2 elements containing the generator polynomials for the second constituent encoder \param constraint_length The constraint length of the two constituent encoders \param interleaver_sequence An ivec defining the internal turbo interleaver. \param in_iterations The number of decoding iterations. Default value is 8. \param in_metric Determines the decoder metric: "MAP", LOGMAP", "LOGMAX", or "TABLE". The default is "LOGMAX". \param in_logmax_scale_factor The extrinsic information from each constituent decoder is to optimistic when LOGMAX decoding is used. This parameter allows for a down-scaling of the extrinsic information that will be passed on to the next decoder. The default value is 1.0. This parameter is ignored for other metrics than "LOGMAX". \param in_adaptive_stop If this parameter is true, then the iterations will stop if the decoding results after one full iteration equals the previous iteration. Default value is false. \param lcalc This parameter can be used to provide a specific \c LLR_calc_unit which defines the resolution in the table-lookup if decoding with the metric "TABLE" is used. additionally: \param pmatrix Puncturing matrix containing "1" for transmitted bits and "0" for punctured ones with \a n_tot rows and \a Period columns. \note For issues relating to the accuracy of LLR computations, please see the documentation of \c LLR_calc_unit */ void set_parameters(ivec gen1, ivec gen2, int constraint_length, const ivec &interleaver_sequence, bmat &pmatrix, int in_iterations = 8, std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0, bool in_adaptive_stop = false, itpp::LLR_calc_unit lcalc = itpp::LLR_calc_unit()); /*! \brief Sets puncturing matrix for turbo code (size \a n_tot * \a Period) \param pmatrix Puncturing matrix containing "1" for transmitted bits and "0" for punctured ones with \a n_tot rows and \a Period columns. */ void set_puncture_matrix(const bmat &pmatrix); /*! \brief Returns puncturing matrix */ bmat get_puncture_matrix(void) { return puncture_matrix; }; /*! \brief Returns \a Period (number of columns) of the puncturing matrix */ int get_puncture_period(void) { return Period; }; /*! \brief Returns size of a single punctured block Returns size of a single encoded block after puncturing. */ int get_punctured_size(void) { it_assert(Period != 0, "Punctured_Turbo_Codec: puncture matrix is not set"); return pNcoded; }; /*! \brief Returns rate of the turbo code \param nominal Determines whether the function returns nominal code rate or the actual code rate (taking into account tail bits). Default value is true, i.e. nominal rate is returned. */ double get_rate(bool nominal = true); /*! \brief Returns size of a single block prior to the puncturing Returns size of a single encoded block prior to the puncturing. */ int get_coded_size(void) { return Ncoded; }; /*! \brief Encoder function This function can encode (using function from the parent \c Turbo_Codec class) and puncture several consecutive coding blocks. Encoded bits are organized as follows: \f[ s(1), p_{1,1}(1), p_{1,2}(1), \ldots , p_{1,n_1}(1), p_{2,1}(1), p_{2,2}(1), \ldots , p_{2,n_2}(1), s(2), \ldots \f] In the above expression \f$s(n)\f$ is the n-th systematic bit and \f$p_{l,k}(n)\f$ is the n-th bit from the k-th encoder polynom of the l-th constituent encoder. A tail of both systematic and parity bits is added after each coding block to force both encoder to the zero state. The tail of each encoder is structured as follows (using encoder one as an example): \f[ t_1(1), pt_{1,1}(1), pt_{1,2}(1), \ldots , pt_{1,n_1}(1), \ldots pt_{1,n_1}(m) \f] The tailbits from the first encoder are placed before the tailbits from the second encoder. Each encoded block is punctured (independenly from other blocks) according to the pncturing scheme given in the \a puncture_matrix \param input The input bits to the encoder. Must contain an integer number of code blocks \param output The encoded bits including two tail, one from each constituent encoder, after each coding block. */ void encode(const bvec &input, bvec &output); /*! \brief Encoder function returning vector \param input The input bits to the encoder. Must contain an integer number of code blocks The same function as above but has only one parameter \a input and returns a vector containing encoded bits. */ bvec encode(const bvec &input); /*! \brief Decoder function This function can decode several consecutive coding blocks that were encoded with the encode member function \param received_signal The vector of received bits \param decoded_bits A vector of decoded bits \param true_bits If this input vector is provided then the iterations will stop as soon as the decoded bits equals the \c true_bits. Note that this feature can not be used if the \c in_adaptive_stop parameter in the setup function is set to \c true. */ virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits = "0"); /*! \brief Decoder function returning vector This function can decode several consecutive coding blocks that were encoded with the encode member function \param received_signal The vector of received bits Function returns decoded bits. */ virtual bvec decode(const vec &received_signal); /*! \brief Decoder function This function can decode several consecutive coding blocks that were encoded with the encode member function \param received_signal The vector of received bits \param decoded_bits A vector of decoded bits \param nrof_used_iterations Returns the number of used iterations for each code block. \param true_bits If this input vector is provided then the iterations will stop as soon as the decoded bits equals the \c true_bits. Note that this feature can not be used if the \c in_adaptive_stop parameter in the setup function is set to \c true. */ virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits = "0"); /*! \brief Calculates length of uncoded block Calculates length of the turbo code input block required to produce output block of length \a punctured_size. Some puncturing patterns might not allow to create block with such a length and then \a fill_bits of dummy bits must be used. \param tc Instance of \a Punctured_Turbo_Codec \param punctured_size Required size of punctured encoded block \param fill_bits Number of dummy bits that must be attached to the encoded block (parameter calculated within the function) */ friend int calculate_uncoded_size(Punctured_Turbo_Codec &tc, int punctured_size, int &fill_bits); protected: /*! \brief Calculates length of the puncturing codeword Calculates length of punctured encoded block based on a \a puncture_matrix and length of the input block (size of the turbo code interleaver) */ void calculate_punctured_size(void); //Scalars: int Period; ///< Number of columns in the puncturing matrix long pNcoded; int punct_total, punct_total1, punct_total2; double rate; bmat puncture_matrix; }; /*! \relatesalso Turbo_Codec \brief Generates the interleaver sequence for the internal turbo encoder interleaver used in WCDMA */ ITPP_EXPORT ivec wcdma_turbo_interleaver_sequence(int interleaver_size); /*! \relatesalso Turbo_Codec \author qdelfin and Stephan Ludwig \brief Generates the interleaver sequence for the internal turbo encoder interleaver used in LTE */ ITPP_EXPORT ivec lte_turbo_interleaver_sequence(int interleaver_size); } // namespace itpp #endif // #ifndef TURBO_H itpp-4.3.1/itpp/config.h.cmake000066400000000000000000000125041216575753400161650ustar00rootroot00000000000000/* itpp/config.h.cmake used by cmake to generate config.h */ #ifndef CONFIG_H #define CONFIG_H /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ #cmakedefine F77_DUMMY_MAIN /* Define if F77 and FC dummy `main' functions are identical. */ #cmakedefine FC_DUMMY_MAIN_EQ_F77 /* Define to 1 if you have the `acosh' function. */ #cmakedefine HAVE_ACOSH 1 /* Define to 1 if you have the `asinh' function. */ #cmakedefine HAVE_ASINH 1 /* Define to 1 if you have the `atanh' function. */ #cmakedefine HAVE_ATANH 1 /* Define if you have a BLAS library. */ #cmakedefine HAVE_BLAS /* Define if you have ACML library for Windows (TODO: remove this) */ #cmakedefine HAVE_ACML /* Define if you have an ACML BLAS library. */ #cmakedefine HAVE_BLAS_ACML /* Define if you have an ATLAS BLAS library. */ #cmakedefine HAVE_BLAS_ATLAS /* Define if you have MKL library for Windows (TODO: remove this) */ #cmakedefine HAVE_MKL /* Define if you have an MKL BLAS library. */ #cmakedefine HAVE_BLAS_MKL /* Define to 1 if you have the `cbrt' function. */ #cmakedefine HAVE_CBRT /* Define to 1 if you have the header file. */ #cmakedefine HAVE_CMATH 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_COMPLEX 1 /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #cmakedefine HAVE_DECL_ISFINITE 1 /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #cmakedefine HAVE_DECL_ISINF 1 /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #cmakedefine HAVE_DECL_ISNAN 1 /* Define to 1 if you have the declaration of `signgam', and to 0 if you don't. */ #cmakedefine HAVE_DECL_SIGNGAM 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DLFCN_H 1 /* Define to 1 if you have the `erf' function. */ #cmakedefine HAVE_ERF 1 /* Define to 1 if you have the `erfc' function. */ #cmakedefine HAVE_ERFC 1 /* Define to 1 if you have the `expm1' function. */ #cmakedefine HAVE_EXPM1 1 /* Define if you have FFT library. */ #cmakedefine HAVE_FFT /* Define if you have FFTW3 library. */ #cmakedefine HAVE_FFTW3 /* Define if you have ACML FFT library. */ #cmakedefine HAVE_FFT_ACML /* Define if you have MKL FFT library. */ #cmakedefine HAVE_FFT_MKL /* Define to 1 if you have the `finite' function. */ #cmakedefine HAVE_FINITE 1 /* Define to 1 if you have the `fpclass' function. */ #cmakedefine HAVE_FPCLASS 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_IEEEFP_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isfinite' function. */ #cmakedefine HAVE_ISFINITE 1 /* Define to 1 if you have the `isinf' function. */ #cmakedefine HAVE_ISINF 1 /* Define to 1 if you have the `isnan' function. */ #cmakedefine HAVE_ISNAN 1 /* Define if you have LAPACK library. */ #cmakedefine HAVE_LAPACK /* Define to 1 if you have the `lgamma' function. */ #cmakedefine HAVE_LGAMMA 1 /* Define to 1 if you have the `log1p' function. */ #cmakedefine HAVE_LOG1P 1 /* Define to 1 if you have the `log2' function. */ #cmakedefine HAVE_LOG2 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MEMORY_H 1 /* Define to 1 if you have the `rint' function. */ #cmakedefine HAVE_RINT 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDLIB_H 1 /* Define to 1 if you have the `std::isfinite' function. */ #cmakedefine HAVE_STD_ISFINITE 1 /* Define to 1 if you have the `std::isinf' function. */ #cmakedefine HAVE_STD_ISINF 1 /* Define to 1 if you have the `std::isnan' function. */ #cmakedefine HAVE_STD_ISNAN 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the `tgamma' function. */ #cmakedefine HAVE_TGAMMA 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H 1 /* Define if you want exceptions handling */ #cmakedefine ITPP_EXCEPTIONS /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #cmakedefine LT_OBJDIR /* Name of package */ #cmakedefine PACKAGE /* Define to the address where bug reports for this package should be sent. */ #cmakedefine PACKAGE_BUGREPORT /* Define to the full name of this package. */ #cmakedefine PACKAGE_NAME /* Define to the full name and version of this package. */ #cmakedefine PACKAGE_STRING /* Define to the one symbol short name of this package. */ #cmakedefine PACKAGE_TARNAME /* Define to the home page for this package. */ #cmakedefine PACKAGE_URL /* Define to the version of this package. */ #cmakedefine PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS 1 /* Define to 1 if you can safely include both and . */ #cmakedefine TIME_WITH_SYS_TIME 1 /* Version number of package */ #cmakedefine VERSION #if defined(HAVE_CMATH) # include #endif #endif /* #ifndef CONFIG_H */ itpp-4.3.1/itpp/config.h.in000066400000000000000000000113341216575753400155130ustar00rootroot00000000000000/* itpp/config.h.in. Generated from configure.ac by autoheader. */ #ifndef CONFIG_H #define CONFIG_H /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ #undef F77_DUMMY_MAIN /* Define if F77 and FC dummy `main' functions are identical. */ #undef FC_DUMMY_MAIN_EQ_F77 /* Define to 1 if you have the `acosh' function. */ #undef HAVE_ACOSH /* Define to 1 if you have the `asinh' function. */ #undef HAVE_ASINH /* Define to 1 if you have the `atanh' function. */ #undef HAVE_ATANH /* Define if you have a BLAS library. */ #undef HAVE_BLAS /* Define if you have an ACML BLAS library. */ #undef HAVE_BLAS_ACML /* Define if you have an ATLAS BLAS library. */ #undef HAVE_BLAS_ATLAS /* Define if you have an MKL BLAS library. */ #undef HAVE_BLAS_MKL /* Define to 1 if you have the `cbrt' function. */ #undef HAVE_CBRT /* Define to 1 if you have the header file. */ #undef HAVE_CMATH /* Define to 1 if you have the header file. */ #undef HAVE_COMPLEX /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #undef HAVE_DECL_ISFINITE /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #undef HAVE_DECL_ISINF /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #undef HAVE_DECL_ISNAN /* Define to 1 if you have the declaration of `signgam', and to 0 if you don't. */ #undef HAVE_DECL_SIGNGAM /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `erf' function. */ #undef HAVE_ERF /* Define to 1 if you have the `erfc' function. */ #undef HAVE_ERFC /* Define to 1 if you have the `expm1' function. */ #undef HAVE_EXPM1 /* Define if you have FFT library. */ #undef HAVE_FFT /* Define if you have FFTW3 library. */ #undef HAVE_FFTW3 /* Define if you have ACML FFT library. */ #undef HAVE_FFT_ACML /* Define if you have MKL FFT library. */ #undef HAVE_FFT_MKL /* Define to 1 if you have the `finite' function. */ #undef HAVE_FINITE /* Define to 1 if you have the `fpclass' function. */ #undef HAVE_FPCLASS /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isfinite' function. */ #undef HAVE_ISFINITE /* Define to 1 if you have the `isinf' function. */ #undef HAVE_ISINF /* Define to 1 if you have the `isnan' function. */ #undef HAVE_ISNAN /* Define if you have LAPACK library. */ #undef HAVE_LAPACK /* Define to 1 if you have the `lgamma' function. */ #undef HAVE_LGAMMA /* Define to 1 if you have the `log1p' function. */ #undef HAVE_LOG1P /* Define to 1 if you have the `log2' function. */ #undef HAVE_LOG2 /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `rint' function. */ #undef HAVE_RINT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `std::isfinite' function. */ #undef HAVE_STD_ISFINITE /* Define to 1 if you have the `std::isinf' function. */ #undef HAVE_STD_ISINF /* Define to 1 if you have the `std::isnan' function. */ #undef HAVE_STD_ISNAN /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the `tgamma' function. */ #undef HAVE_TGAMMA /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you want exceptions handling */ #undef ITPP_EXCEPTIONS /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Version number of package */ #undef VERSION #if defined(HAVE_CMATH) # include #endif #endif /* #ifndef CONFIG_H */ itpp-4.3.1/itpp/config_msvc.h000066400000000000000000000141011216575753400161310ustar00rootroot00000000000000/* itpp/config.h. Generated from config.h.in by configure. */ /* itpp/config.h.in. Generated from configure.ac by autoheader. */ #ifndef CONFIG_H #define CONFIG_H /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ /* #undef F77_DUMMY_MAIN */ /* Define if F77 and FC dummy `main' functions are identical. */ /* #undef FC_DUMMY_MAIN_EQ_F77 */ /* Define to 1 if you have the `acosh' function. */ /* #undef HAVE_ACOSH */ /* Define to 1 if you have the `asinh' function. */ /* #undef HAVE_ASINH */ /* Define to 1 if you have the `atanh' function. */ /* #undef HAVE_ATANH */ #if defined(HAVE_ACML) || defined(HAVE_MKL) /* Define if you have a BLAS library. */ # define HAVE_BLAS 1 #endif #ifdef HAVE_ACML /* Define if you have an ACML BLAS library. */ # define HAVE_BLAS_ACML 1 #endif /* Define if you have an ATLAS BLAS library. */ /* #undef HAVE_BLAS_ATLAS */ #ifdef HAVE_MKL /* Define if you have an MKL BLAS library. */ # define HAVE_BLAS_MKL 1 #endif /* Define to 1 if you have the `cbrt' function. */ /* #undef HAVE_CBRT */ /* Define to 1 if you have the header file. */ #define HAVE_CMATH 1 /* Define to 1 if you have the header file. */ #define HAVE_COMPLEX 1 /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #define HAVE_DECL_ISFINITE 0 /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #define HAVE_DECL_ISINF 0 /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #define HAVE_DECL_ISNAN 0 /* Define to 1 if you have the declaration of `signgam', and to 0 if you don't. */ #define HAVE_DECL_SIGNGAM 0 /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `erf' function. */ /* #undef HAVE_ERF */ /* Define to 1 if you have the `erfc' function. */ /* #undef HAVE_ERFC */ /* Define to 1 if you have the `expm1' function. */ /* #undef HAVE_EXPM1 */ /* Define if the compiler supports extern template */ /* #undef HAVE_EXTERN_TEMPLATE */ #if defined(HAVE_ACML) || defined(HAVE_MKL) /* Define if you have FFT library. */ # define HAVE_FFT 1 #endif /* Define if you have FFTW3 library. */ /* #undef HAVE_FFTW3 */ #ifdef HAVE_ACML /* Define if you have ACML FFT library. */ # define HAVE_FFT_ACML 1 #endif #ifdef HAVE_MKL /* Define if you have MKL FFT library. */ # define HAVE_FFT_MKL 1 #endif /* Define to 1 if you have the `finite' function. */ #define HAVE_FINITE 1 /* Define to 1 if you have the `fpclass' function. */ #define HAVE_FPCLASS 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_IEEEFP_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_INTTYPES_H */ /* Define to 1 if you have the `isfinite' function. */ #define HAVE_ISFINITE 1 /* Define to 1 if you have the `isinf' function. */ /* #undef HAVE_ISINF */ /* Define to 1 if you have the `isnan' function. */ #define HAVE_ISNAN 1 #if defined(HAVE_ACML) || defined(HAVE_MKL) /* Define if you have LAPACK library. */ # define HAVE_LAPACK 1 #endif /* Define to 1 if you have the `lgamma' function. */ /* #undef HAVE_LGAMMA */ /* Define to 1 if you have the `log1p' function. */ /* #undef HAVE_LOG1P */ /* Define to 1 if you have the `log2' function. */ /* #undef HAVE_LOG2 */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `rint' function. */ /* #undef HAVE_RINT */ /* Define to 1 if you have the header file. */ /* #undef HAVE_STDINT_H */ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `std::isfinite' function. */ /* #undef HAVE_STD_ISFINITE */ /* Define to 1 if you have the `std::isinf' function. */ /* #undef HAVE_STD_ISINF */ /* Define to 1 if you have the `std::isnan' function. */ /* #undef HAVE_STD_ISNAN */ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the `tgamma' function. */ /* #undef HAVE_TGAMMA */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define if you use zdotusub_ Fortran wrapper. */ /* #undef HAVE_ZDOTUSUB */ /* Define if "void zdotu_()" should be used. */ #define HAVE_ZDOTU_VOID 1 /* Define if you want exceptions handling */ /* #undef ITPP_EXCEPTIONS */ /* Name of package */ #define PACKAGE "itpp" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "ediap@users.sourceforge.net" /* Define to the full name of this package. */ #define PACKAGE_NAME "IT++" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "IT++ 4.0.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "itpp" /* Define to the version of this package. */ #define PACKAGE_VERSION "4.0.0" /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `unsigned int', as computed by sizeof. */ #define SIZEOF_UNSIGNED_INT 4 /* The size of `unsigned long', as computed by sizeof. */ #define SIZEOF_UNSIGNED_LONG 4 /* The size of `unsigned long long', as computed by sizeof. */ #define SIZEOF_UNSIGNED_LONG_LONG 8 /* The size of `unsigned short', as computed by sizeof. */ #define SIZEOF_UNSIGNED_SHORT 2 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if you can safely include both and . */ /* #undef TIME_WITH_SYS_TIME */ /* Version number of package */ #define VERSION "4.0.0" #if defined(HAVE_CMATH) # include #endif #endif /* #ifndef CONFIG_H */ itpp-4.3.1/itpp/fixed/000077500000000000000000000000001216575753400145655ustar00rootroot00000000000000itpp-4.3.1/itpp/fixed/Makefile.am000066400000000000000000000007261216575753400166260ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libfixed.la if ENABLE_DEBUG noinst_LTLIBRARIES += libfixed_debug.la endif libfixed_la_SOURCES = $(h_fixed_sources) $(cpp_fixed_sources) libfixed_la_CXXFLAGS = $(CXXFLAGS_OPT) libfixed_debug_la_SOURCES = $(h_fixed_sources) $(cpp_fixed_sources) libfixed_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/fixed pkginclude_HEADERS = $(h_fixed_sources) itpp-4.3.1/itpp/fixed/Makefile.in000066400000000000000000001165461216575753400166470ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libfixed_debug.la subdir = itpp/fixed ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libfixed_la_LIBADD = am__objects_1 = am__objects_2 = libfixed_la-cfix.lo libfixed_la-cfixed.lo \ libfixed_la-fix_base.lo libfixed_la-fix.lo \ libfixed_la-fixed.lo libfixed_la-fix_factory.lo \ libfixed_la-fix_functions.lo libfixed_la-fix_operators.lo am_libfixed_la_OBJECTS = $(am__objects_1) $(am__objects_2) libfixed_la_OBJECTS = $(am_libfixed_la_OBJECTS) libfixed_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libfixed_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libfixed_debug_la_LIBADD = am__objects_3 = libfixed_debug_la-cfix.lo libfixed_debug_la-cfixed.lo \ libfixed_debug_la-fix_base.lo libfixed_debug_la-fix.lo \ libfixed_debug_la-fixed.lo libfixed_debug_la-fix_factory.lo \ libfixed_debug_la-fix_functions.lo \ libfixed_debug_la-fix_operators.lo am_libfixed_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libfixed_debug_la_OBJECTS = $(am_libfixed_debug_la_OBJECTS) libfixed_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libfixed_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libfixed_la_SOURCES) $(libfixed_debug_la_SOURCES) DIST_SOURCES = $(libfixed_la_SOURCES) $(libfixed_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/fixed ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_fixed_sources = \ $(top_srcdir)/itpp/fixed/cfixed.h \ $(top_srcdir)/itpp/fixed/cfix.h \ $(top_srcdir)/itpp/fixed/fix_base.h \ $(top_srcdir)/itpp/fixed/fixed.h \ $(top_srcdir)/itpp/fixed/fix_factory.h \ $(top_srcdir)/itpp/fixed/fix_functions.h \ $(top_srcdir)/itpp/fixed/fix.h \ $(top_srcdir)/itpp/fixed/fix_operators.h cpp_fixed_sources = \ $(top_srcdir)/itpp/fixed/cfix.cpp \ $(top_srcdir)/itpp/fixed/cfixed.cpp \ $(top_srcdir)/itpp/fixed/fix_base.cpp \ $(top_srcdir)/itpp/fixed/fix.cpp \ $(top_srcdir)/itpp/fixed/fixed.cpp \ $(top_srcdir)/itpp/fixed/fix_factory.cpp \ $(top_srcdir)/itpp/fixed/fix_functions.cpp \ $(top_srcdir)/itpp/fixed/fix_operators.cpp noinst_LTLIBRARIES = libfixed.la $(am__append_1) libfixed_la_SOURCES = $(h_fixed_sources) $(cpp_fixed_sources) libfixed_la_CXXFLAGS = $(CXXFLAGS_OPT) libfixed_debug_la_SOURCES = $(h_fixed_sources) $(cpp_fixed_sources) libfixed_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_fixed_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/fixed/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/fixed/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libfixed.la: $(libfixed_la_OBJECTS) $(libfixed_la_DEPENDENCIES) $(libfixed_la_LINK) $(libfixed_la_OBJECTS) $(libfixed_la_LIBADD) $(LIBS) libfixed_debug.la: $(libfixed_debug_la_OBJECTS) $(libfixed_debug_la_DEPENDENCIES) $(libfixed_debug_la_LINK) $(am_libfixed_debug_la_rpath) $(libfixed_debug_la_OBJECTS) $(libfixed_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-cfix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-cfixed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-fix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-fix_base.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-fix_factory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-fix_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-fix_operators.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_debug_la-fixed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-cfix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-cfixed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-fix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-fix_base.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-fix_factory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-fix_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-fix_operators.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfixed_la-fixed.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libfixed_la-cfix.lo: $(top_srcdir)/itpp/fixed/cfix.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-cfix.lo -MD -MP -MF $(DEPDIR)/libfixed_la-cfix.Tpo -c -o libfixed_la-cfix.lo `test -f '$(top_srcdir)/itpp/fixed/cfix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfix.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-cfix.Tpo $(DEPDIR)/libfixed_la-cfix.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/cfix.cpp' object='libfixed_la-cfix.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-cfix.lo `test -f '$(top_srcdir)/itpp/fixed/cfix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfix.cpp libfixed_la-cfixed.lo: $(top_srcdir)/itpp/fixed/cfixed.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-cfixed.lo -MD -MP -MF $(DEPDIR)/libfixed_la-cfixed.Tpo -c -o libfixed_la-cfixed.lo `test -f '$(top_srcdir)/itpp/fixed/cfixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfixed.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-cfixed.Tpo $(DEPDIR)/libfixed_la-cfixed.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/cfixed.cpp' object='libfixed_la-cfixed.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-cfixed.lo `test -f '$(top_srcdir)/itpp/fixed/cfixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfixed.cpp libfixed_la-fix_base.lo: $(top_srcdir)/itpp/fixed/fix_base.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-fix_base.lo -MD -MP -MF $(DEPDIR)/libfixed_la-fix_base.Tpo -c -o libfixed_la-fix_base.lo `test -f '$(top_srcdir)/itpp/fixed/fix_base.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_base.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-fix_base.Tpo $(DEPDIR)/libfixed_la-fix_base.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_base.cpp' object='libfixed_la-fix_base.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-fix_base.lo `test -f '$(top_srcdir)/itpp/fixed/fix_base.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_base.cpp libfixed_la-fix.lo: $(top_srcdir)/itpp/fixed/fix.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-fix.lo -MD -MP -MF $(DEPDIR)/libfixed_la-fix.Tpo -c -o libfixed_la-fix.lo `test -f '$(top_srcdir)/itpp/fixed/fix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-fix.Tpo $(DEPDIR)/libfixed_la-fix.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix.cpp' object='libfixed_la-fix.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-fix.lo `test -f '$(top_srcdir)/itpp/fixed/fix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix.cpp libfixed_la-fixed.lo: $(top_srcdir)/itpp/fixed/fixed.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-fixed.lo -MD -MP -MF $(DEPDIR)/libfixed_la-fixed.Tpo -c -o libfixed_la-fixed.lo `test -f '$(top_srcdir)/itpp/fixed/fixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fixed.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-fixed.Tpo $(DEPDIR)/libfixed_la-fixed.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fixed.cpp' object='libfixed_la-fixed.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-fixed.lo `test -f '$(top_srcdir)/itpp/fixed/fixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fixed.cpp libfixed_la-fix_factory.lo: $(top_srcdir)/itpp/fixed/fix_factory.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-fix_factory.lo -MD -MP -MF $(DEPDIR)/libfixed_la-fix_factory.Tpo -c -o libfixed_la-fix_factory.lo `test -f '$(top_srcdir)/itpp/fixed/fix_factory.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_factory.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-fix_factory.Tpo $(DEPDIR)/libfixed_la-fix_factory.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_factory.cpp' object='libfixed_la-fix_factory.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-fix_factory.lo `test -f '$(top_srcdir)/itpp/fixed/fix_factory.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_factory.cpp libfixed_la-fix_functions.lo: $(top_srcdir)/itpp/fixed/fix_functions.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-fix_functions.lo -MD -MP -MF $(DEPDIR)/libfixed_la-fix_functions.Tpo -c -o libfixed_la-fix_functions.lo `test -f '$(top_srcdir)/itpp/fixed/fix_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_functions.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-fix_functions.Tpo $(DEPDIR)/libfixed_la-fix_functions.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_functions.cpp' object='libfixed_la-fix_functions.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-fix_functions.lo `test -f '$(top_srcdir)/itpp/fixed/fix_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_functions.cpp libfixed_la-fix_operators.lo: $(top_srcdir)/itpp/fixed/fix_operators.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_la-fix_operators.lo -MD -MP -MF $(DEPDIR)/libfixed_la-fix_operators.Tpo -c -o libfixed_la-fix_operators.lo `test -f '$(top_srcdir)/itpp/fixed/fix_operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_operators.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_la-fix_operators.Tpo $(DEPDIR)/libfixed_la-fix_operators.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_operators.cpp' object='libfixed_la-fix_operators.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_la-fix_operators.lo `test -f '$(top_srcdir)/itpp/fixed/fix_operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_operators.cpp libfixed_debug_la-cfix.lo: $(top_srcdir)/itpp/fixed/cfix.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-cfix.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-cfix.Tpo -c -o libfixed_debug_la-cfix.lo `test -f '$(top_srcdir)/itpp/fixed/cfix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfix.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-cfix.Tpo $(DEPDIR)/libfixed_debug_la-cfix.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/cfix.cpp' object='libfixed_debug_la-cfix.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-cfix.lo `test -f '$(top_srcdir)/itpp/fixed/cfix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfix.cpp libfixed_debug_la-cfixed.lo: $(top_srcdir)/itpp/fixed/cfixed.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-cfixed.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-cfixed.Tpo -c -o libfixed_debug_la-cfixed.lo `test -f '$(top_srcdir)/itpp/fixed/cfixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfixed.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-cfixed.Tpo $(DEPDIR)/libfixed_debug_la-cfixed.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/cfixed.cpp' object='libfixed_debug_la-cfixed.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-cfixed.lo `test -f '$(top_srcdir)/itpp/fixed/cfixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/cfixed.cpp libfixed_debug_la-fix_base.lo: $(top_srcdir)/itpp/fixed/fix_base.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-fix_base.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-fix_base.Tpo -c -o libfixed_debug_la-fix_base.lo `test -f '$(top_srcdir)/itpp/fixed/fix_base.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_base.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-fix_base.Tpo $(DEPDIR)/libfixed_debug_la-fix_base.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_base.cpp' object='libfixed_debug_la-fix_base.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-fix_base.lo `test -f '$(top_srcdir)/itpp/fixed/fix_base.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_base.cpp libfixed_debug_la-fix.lo: $(top_srcdir)/itpp/fixed/fix.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-fix.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-fix.Tpo -c -o libfixed_debug_la-fix.lo `test -f '$(top_srcdir)/itpp/fixed/fix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-fix.Tpo $(DEPDIR)/libfixed_debug_la-fix.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix.cpp' object='libfixed_debug_la-fix.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-fix.lo `test -f '$(top_srcdir)/itpp/fixed/fix.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix.cpp libfixed_debug_la-fixed.lo: $(top_srcdir)/itpp/fixed/fixed.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-fixed.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-fixed.Tpo -c -o libfixed_debug_la-fixed.lo `test -f '$(top_srcdir)/itpp/fixed/fixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fixed.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-fixed.Tpo $(DEPDIR)/libfixed_debug_la-fixed.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fixed.cpp' object='libfixed_debug_la-fixed.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-fixed.lo `test -f '$(top_srcdir)/itpp/fixed/fixed.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fixed.cpp libfixed_debug_la-fix_factory.lo: $(top_srcdir)/itpp/fixed/fix_factory.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-fix_factory.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-fix_factory.Tpo -c -o libfixed_debug_la-fix_factory.lo `test -f '$(top_srcdir)/itpp/fixed/fix_factory.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_factory.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-fix_factory.Tpo $(DEPDIR)/libfixed_debug_la-fix_factory.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_factory.cpp' object='libfixed_debug_la-fix_factory.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-fix_factory.lo `test -f '$(top_srcdir)/itpp/fixed/fix_factory.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_factory.cpp libfixed_debug_la-fix_functions.lo: $(top_srcdir)/itpp/fixed/fix_functions.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-fix_functions.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-fix_functions.Tpo -c -o libfixed_debug_la-fix_functions.lo `test -f '$(top_srcdir)/itpp/fixed/fix_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_functions.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-fix_functions.Tpo $(DEPDIR)/libfixed_debug_la-fix_functions.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_functions.cpp' object='libfixed_debug_la-fix_functions.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-fix_functions.lo `test -f '$(top_srcdir)/itpp/fixed/fix_functions.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_functions.cpp libfixed_debug_la-fix_operators.lo: $(top_srcdir)/itpp/fixed/fix_operators.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libfixed_debug_la-fix_operators.lo -MD -MP -MF $(DEPDIR)/libfixed_debug_la-fix_operators.Tpo -c -o libfixed_debug_la-fix_operators.lo `test -f '$(top_srcdir)/itpp/fixed/fix_operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_operators.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfixed_debug_la-fix_operators.Tpo $(DEPDIR)/libfixed_debug_la-fix_operators.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/fixed/fix_operators.cpp' object='libfixed_debug_la-fix_operators.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfixed_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libfixed_debug_la-fix_operators.lo `test -f '$(top_srcdir)/itpp/fixed/fix_operators.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/fixed/fix_operators.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/fixed/cfix.cpp000066400000000000000000000226101216575753400162230ustar00rootroot00000000000000/*! * \file * \brief Implementation of a complex fixed-point data type CFix * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { CFix& CFix::operator=(const CFix &x) { shift = x.shift; re = apply_o_mode(x.re); im = apply_o_mode(x.im); return *this; } CFix& CFix::operator=(const Fix &x) { shift = x.shift; re = apply_o_mode(x.re); im = 0; return *this; } CFix& CFix::operator=(const std::complex &x) { shift = 0; re = apply_o_mode(fixrep(std::real(x))); im = apply_o_mode(fixrep(std::imag(x))); return *this; } CFix& CFix::operator=(const int x) { shift = 0; re = apply_o_mode(x); im = 0; return *this; } CFix& CFix::operator+=(const CFix &x) { shift = assert_shifts(*this, x); re = apply_o_mode(re + x.re); im = apply_o_mode(im + x.im); return *this; } CFix& CFix::operator+=(const Fix &x) { shift = assert_shifts(*this, x); re = apply_o_mode(re + x.re); return *this; } CFix& CFix::operator+=(const int x) { assert_shifts(*this, x); re = apply_o_mode(re + x); return *this; } CFix& CFix::operator-=(const CFix &x) { shift = assert_shifts(*this, x); re = apply_o_mode(re - x.re); im = apply_o_mode(im - x.im); return *this; } CFix& CFix::operator-=(const Fix &x) { shift = assert_shifts(*this, x); re = apply_o_mode(re - x.re); return *this; } CFix& CFix::operator-=(const int x) { assert_shifts(*this, x); re = apply_o_mode(re - x); return *this; } CFix& CFix::operator*=(const CFix &x) { shift += x.shift; fixrep tmp_re = apply_o_mode(re * x.re - im * x.im); im = apply_o_mode(re * x.im + im * x.re); re = tmp_re; return *this; } CFix& CFix::operator*=(const Fix &x) { shift += x.shift; re = apply_o_mode(re * x.re); im = apply_o_mode(im * x.re); return *this; } CFix& CFix::operator*=(const int x) { re = apply_o_mode(re * x); im = apply_o_mode(im * x); return *this; } CFix& CFix::operator/=(const CFix &x) { shift -= x.shift; fixrep denominator = x.re * x.re + x.im * x.im; fixrep tmp_re = apply_o_mode((re * x.re + im * x.im) / denominator); im = apply_o_mode((im * x.re - re * x.im) / denominator); re = tmp_re; return *this; } CFix& CFix::operator/=(const Fix &x) { shift -= x.shift; re = apply_o_mode(re / x.re); im = apply_o_mode(im / x.re); return *this; } CFix& CFix::operator/=(const int x) { re = apply_o_mode(re / x); im = apply_o_mode(im / x); return *this; } CFix CFix::operator-() const { return CFix(-re, -im, shift, 0, 0); } CFix& CFix::operator<<=(const int n) { it_assert_debug(n >= 0, "CFix::operator<<=: n cannot be negative!"); shift += n; re = apply_o_mode(re << n); im = apply_o_mode(im << n); return *this; } CFix& CFix::operator>>=(const int n) { shift -= n; re = rshift_and_apply_q_mode(re, n); im = rshift_and_apply_q_mode(im, n); return *this; } void CFix::set(double real, double imag, int n) { shift = n; re = scale_and_apply_modes(real); im = scale_and_apply_modes(imag); } void CFix::set(double real, double imag, int n, q_mode q) { shift = n; re = scale_and_apply_modes(real, q); im = scale_and_apply_modes(imag, q); } void CFix::set(const std::complex &x, int n) { shift = n; re = scale_and_apply_modes(std::real(x)); im = scale_and_apply_modes(std::imag(x)); } void CFix::set(const std::complex &x, int n, q_mode q) { shift = n; re = scale_and_apply_modes(std::real(x), q); im = scale_and_apply_modes(std::imag(x), q); } void CFix::lshift(int n) { it_assert_debug(n >= 0, "CFix::lshift: n cannot be negative!"); shift += n; re = apply_o_mode(re << n); im = apply_o_mode(im << n); } void CFix::rshift(int n) { shift -= n; re = rshift_and_apply_q_mode(re, n); im = rshift_and_apply_q_mode(im, n); } void CFix::rshift(int n, q_mode q) { shift -= n; re = rshift_and_apply_q_mode(re, n, q); im = rshift_and_apply_q_mode(im, n, q); } std::complex CFix::unfix() const { it_assert_debug(shift >= -63 && shift <= 64, "CFix::unfix: Illegal shift!"); return std::complex(double(re)*DOUBLE_POW2[64 - shift], double(im)*DOUBLE_POW2[64 - shift]); } void CFix::print() const { Fix_Base::print(); std::cout << "re = " << re << std::endl; std::cout << "im = " << im << std::endl; } int assert_shifts(const CFix &x, const CFix &y) { int ret = 0; if (x.shift == y.shift) ret = x.shift; else if (x.re == 0 && x.im == 0) ret = y.shift; else if (y.re == 0 && y.im == 0) ret = x.shift; else it_error("assert_shifts: Different shifts not allowed!"); return ret; } int assert_shifts(const CFix &x, const Fix &y) { int ret = 0; if (x.shift == y.shift) ret = x.shift; else if (x.re == 0 && x.im == 0) ret = y.shift; else if (y.re == 0) ret = x.shift; else it_error("assert_shifts: Different shifts not allowed!"); return ret; } int assert_shifts(const CFix &x, int y) { it_error_if((x.shift != 0) && !(x.re == 0 && x.im == 0) && (y != 0), "assert_shifts: Different shifts not allowed!"); return x.shift; } std::istream &operator>>(std::istream &is, CFix &x) { std::complex value; is >> value; if (!is.eof() && (is.peek() == '<')) { int shift; is.get(); // Swallow '<' sign if (is.peek() == '<') { is.get(); // Swallow '<' sign is >> shift; x.set(value, shift); } else { is >> shift; is.get(); // Swallow '>' sign x.set_re(fixrep(std::real(value))); x.set_im(fixrep(std::imag(value))); x.set_shift(shift); } } else { // Change data representation but keep shift x.set_re(fixrep(std::real(value))); x.set_im(fixrep(std::imag(value))); } return is; } std::ostream &operator<<(std::ostream &os, const CFix &x) { switch (x.get_output_mode()) { case OUTPUT_FIX: if (x.get_im() < 0) os << x.get_re() << x.get_im() << 'i'; else os << x.get_re() << '+' << x.get_im() << 'i'; break; case OUTPUT_FIX_SHIFT: if (x.get_im() < 0) os << x.get_re() << x.get_im() << 'i'; else os << x.get_re() << '+' << x.get_im() << 'i'; os << '<' << x.get_shift() << '>'; break; case OUTPUT_FLOAT: os << std::complex(x); break; case OUTPUT_FLOAT_SHIFT: os << std::complex(x) << "<<" << x.get_shift(); break; default: it_error("operator<<: Illegal output mode!"); } return os; } // Specialization of template definition in vec.cpp template<> void cfixvec::set(const char *values) { std::istringstream buffer(values); int default_shift = 0, pos = 0, maxpos = 10; if (datasize > 0) { // Assume that all elements have the same shift default_shift = data[0].get_shift(); } alloc(maxpos); while (buffer.peek() != EOF) { switch (buffer.peek()) { case ':': it_error("set: expressions with ':' are not valid for cfixvec"); break; case ',': buffer.get(); break; default: pos++; if (pos > maxpos) { maxpos *= 2; set_size(maxpos, true); } data[pos-1].set_shift(default_shift); buffer >> data[pos-1]; // May override default_shift while (buffer.peek() == ' ') { buffer.get(); } break; } } set_size(pos, true); } // Specialization of template definition in mat.cpp template<> void cfixmat::set(const char *values) { std::istringstream buffer(values); int default_shift = 0, rows = 0, maxrows = 10, cols = 0, nocols = 0, maxcols = 10; if (datasize > 0) { // Assume that all elements have the same shift default_shift = data[0].get_shift(); } alloc(maxrows, maxcols); while (buffer.peek() != EOF) { rows++; if (rows > maxrows) { maxrows = maxrows * 2; set_size(maxrows, maxcols, true); } cols = 0; while ((buffer.peek() != ';') && (buffer.peek() != EOF)) { if (buffer.peek() == ',') { buffer.get(); } else { cols++; if (cols > nocols) { nocols = cols; if (cols > maxcols) { maxcols = maxcols * 2; set_size(maxrows, maxcols, true); } } this->operator()(rows-1, cols - 1).set_shift(default_shift); buffer >> this->operator()(rows-1, cols - 1); // May override default_shift while (buffer.peek() == ' ') { buffer.get(); } } } if (!buffer.eof()) buffer.get(); } set_size(rows, nocols, true); } } // namespace itpp itpp-4.3.1/itpp/fixed/cfix.h000066400000000000000000000200071216575753400156660ustar00rootroot00000000000000/*! * \file * \brief Definitions of a complex fixed-point data type CFix * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CFIX_H #define CFIX_H #include #include namespace itpp { // Forward declarations template class Vec; template class Mat; //! \addtogroup fixed //!@{ /*! \brief Complex fixed-point data type. See the Detailed Description in the \ref fixed module. */ class ITPP_EXPORT CFix : public Fix_Base { template friend class CFixed; public: //! Default constructor CFix(double r = 0.0, double i = 0.0, int s = 0, int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : Fix_Base(s, w, e, o, q, ptr), re(scale_and_apply_modes(r)), im(scale_and_apply_modes(i)) {} //! Constructor CFix(std::complex x, double, int s = 0, int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : Fix_Base(s, w, e, o, q, ptr), re(scale_and_apply_modes(std::real(x))), im(scale_and_apply_modes(std::imag(x))) {} //! Constructor explicit CFix(const Fix_Factory &f) : Fix_Base(0, f.wordlen, f.emode, f.omode, f.qmode, f.stat_ptr), re(0), im(0) {} //! Constructor for internal use. No restrictions are applied. The dummies help to avoid ambiguities CFix(fixrep r, fixrep i, int s, int, int) : Fix_Base(s), re(r), im(i) {} //! Constructor CFix(const Fix &r, const Fix &i = 0.0, int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : Fix_Base(assert_shifts(r, i), w, e, o, q, ptr), re(r.re), im(i.re) {} //! Copy constructor CFix(const CFix &x, double, int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : Fix_Base(x.shift, w, e, o, q, ptr), re(x.re), im(x.im) {} //! Destructor virtual ~CFix() {} //! Assignment from CFix CFix& operator=(const CFix &x); //! Assignment from Fix CFix& operator=(const Fix &x); //! Assignment from std::complex. Fractional part is truncated CFix& operator=(const std::complex &x); //! Assignment from int CFix& operator=(const int x); //! Addition of CFix CFix& operator+=(const CFix &x); //! Addition of Fix CFix& operator+=(const Fix &x); //! Addition of int CFix& operator+=(const int x); //! Subtraction of CFix CFix& operator-=(const CFix &x); //! Subtraction of Fix CFix& operator-=(const Fix &x); //! Subtraction of int CFix& operator-=(const int x); //! Multiplication with CFix. Temporary variables use the maximum word length (64 bits) CFix& operator*=(const CFix &x); //! Multiplication with Fix. Temporary variables use the maximum word length (64 bits) CFix& operator*=(const Fix &x); //! Multiplication with int. Temporary variables use the maximum word length (64 bits) CFix& operator*=(const int x); //! Division with CFix using quantization mode \c TRN. Temporary variables use the maximum word length (64 bits) CFix& operator/=(const CFix &x); //! Division with Fix using quantization mode \c TRN. Temporary variables use the maximum word length (64 bits) CFix& operator/=(const Fix &x); //! Division with int using quantization mode \c TRN. Temporary variables use the maximum word length (64 bits) CFix& operator/=(const int x); //! Unary negative of CFix CFix operator-() const; //! Left shift \c n bits CFix& operator<<=(const int n); //! Right shift \c n bits using quantization mode \c qmode (constructor argument) CFix& operator>>=(const int n); //! Set to (real + i*imag) * pow2(n) using quantization mode \c qmode (constructor argument) void set(double real, double imag, int n); //! Set to (real + i*imag) * pow2(n) using quantization mode \c q (function argument) void set(double real, double imag, int n, q_mode q); //! Set to x * pow2(n) using quantization mode \c qmode (constructor argument) void set(const std::complex &x, int n); //! Set to x * pow2(n) using quantization mode \c q (function argument) void set(const std::complex &x, int n, q_mode q); //! Set data representation for real part (mainly for internal use since it reveals the representation type) void set_re(fixrep x) {re = apply_o_mode(x);} //! Set data representation for imaginary part (mainly for internal use since it reveals the representation type) void set_im(fixrep x) {im = apply_o_mode(x);} //! Left shift \c n bits void lshift(int n); //! Right shift \c n bits using quantization mode \c qmode (constructor argument) void rshift(int n); //! Right shift \c n bits using quantization mode \c q (function argument) void rshift(int n, q_mode q); //! Print restrictions virtual void print() const; //! Get data representation for real part (mainly for internal use since it reveals the representation type) fixrep get_re() const {return re;} //! Get data representation for imaginary part (mainly for internal use since it reveals the representation type) fixrep get_im() const {return im;} //! Conversion to std::complex std::complex unfix() const; #ifndef NO_IMPLICIT_FIX_CONVERSION //! Conversion to std::complex operator std::complex() const { it_assert_debug(shift >= -63 && shift <= 64, "CFix::operator complex: Illegal shift!"); return std::complex(double(re)*DOUBLE_POW2[64 - shift], double(im)*DOUBLE_POW2[64 - shift]); } #endif //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) friend ITPP_EXPORT int assert_shifts(const CFix &x, const CFix &y); //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) friend ITPP_EXPORT int assert_shifts(const CFix &x, const Fix &y); //! Check that x.shift==0 OR x==0 OR y==0 and return x.shift friend ITPP_EXPORT int assert_shifts(const CFix &x, int y); protected: fixrep re; //!< Real data part fixrep im; //!< Imaginary data part }; //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) ITPP_EXPORT int assert_shifts(const CFix &x, const CFix &y); //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) ITPP_EXPORT int assert_shifts(const CFix &x, const Fix &y); //! Check that x.shift==0 OR x==0 OR y==0 and return x.shift ITPP_EXPORT int assert_shifts(const CFix &x, int y); //! Input bit representation and, optionally, the shift ITPP_EXPORT std::istream &operator>>(std::istream &is, CFix &x); //! Output bit representation and, optionally, the shift ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const CFix &x); //! Typedef for complex fixed-point vector type typedef Vec cfixvec; //! Typedef for complex fixed-point matrix type typedef Mat cfixmat; // Specialization of template definition in vec.cpp template<> void cfixvec::set(const char *values); // Specialization of template definition in mat.cpp template<> void cfixmat::set(const char *values); //!@} } // namespace itpp #endif // #ifndef CFIX_H itpp-4.3.1/itpp/fixed/cfixed.cpp000066400000000000000000000023641216575753400165400ustar00rootroot00000000000000/*! * \file * \brief Implementation of a complex fixed-point data type CFixed * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // Template instantiations template class ITPP_EXPORT CFixed<64, TC, WRAP>; } // namespace itpp itpp-4.3.1/itpp/fixed/cfixed.h000066400000000000000000000201071216575753400162000ustar00rootroot00000000000000/*! * \file * \brief Definitions of a complex fixed-point data type CFixed * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef CFIXED_H #define CFIXED_H #include #include namespace itpp { /*! * \addtogroup fixed * @{ */ /*! \brief Templated complex fixed-point data type See the Detailed Description in the \ref fixed module. */ template < int w, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN > class CFixed : public CFix { public: //! Default constructor CFixed(double r = 0.0, double i = 0.0, int s = 0, Stat *ptr = 0) : CFix(r, i, s, w, e, o, q, ptr) {} //! Constructor CFixed(std::complex x, double, int s = 0, Stat *ptr = 0) : CFix(x, 0.0, s, w, e, o, q, ptr) {} //! Constructor explicit CFixed(Stat *ptr) : CFix(0.0, 0.0, 0, w, e, o, q, ptr) {} //! Constructor CFixed(const Fix &r, const Fix &i = 0.0, Stat *ptr = 0) : CFix(r, i, w, e, o, q, ptr) {} //! Constructor CFixed(const CFix &x, double, Stat *ptr = 0) : CFix(x, 0.0, w, e, o, q, ptr) {} //! Destructor virtual ~CFixed() {} //! Assignment from CFix CFixed& operator=(const CFix &x) { shift = x.shift; re = apply_o_mode(x.re); im = apply_o_mode(x.im); return *this; } //! Assignment from Fix CFixed& operator=(const Fix &x) { shift = x.shift; re = apply_o_mode(x.re); im = 0; return *this; } //! Assignment from complex. Fractional part is truncated CFixed& operator=(const std::complex &x) { shift = 0; re = apply_o_mode(fixrep(real(x))); im = apply_o_mode(fixrep(imag(x))); return *this; } //! Assignment from int CFixed& operator=(int x) { shift = 0; re = apply_o_mode(x); im = 0; return *this; } protected: }; /*! @} */ //! Typedefs for CFixed (cfixed1, cfixed2, ..., cfixed64) typedef CFixed<1, TC, WRAP> cfixed1; //! \cond typedef CFixed<2, TC, WRAP> cfixed2; typedef CFixed<3, TC, WRAP> cfixed3; typedef CFixed<4, TC, WRAP> cfixed4; typedef CFixed<5, TC, WRAP> cfixed5; typedef CFixed<6, TC, WRAP> cfixed6; typedef CFixed<7, TC, WRAP> cfixed7; typedef CFixed<8, TC, WRAP> cfixed8; typedef CFixed<9, TC, WRAP> cfixed9; typedef CFixed<10, TC, WRAP> cfixed10; typedef CFixed<11, TC, WRAP> cfixed11; typedef CFixed<12, TC, WRAP> cfixed12; typedef CFixed<13, TC, WRAP> cfixed13; typedef CFixed<14, TC, WRAP> cfixed14; typedef CFixed<15, TC, WRAP> cfixed15; typedef CFixed<16, TC, WRAP> cfixed16; typedef CFixed<17, TC, WRAP> cfixed17; typedef CFixed<18, TC, WRAP> cfixed18; typedef CFixed<19, TC, WRAP> cfixed19; typedef CFixed<20, TC, WRAP> cfixed20; typedef CFixed<21, TC, WRAP> cfixed21; typedef CFixed<22, TC, WRAP> cfixed22; typedef CFixed<23, TC, WRAP> cfixed23; typedef CFixed<24, TC, WRAP> cfixed24; typedef CFixed<25, TC, WRAP> cfixed25; typedef CFixed<26, TC, WRAP> cfixed26; typedef CFixed<27, TC, WRAP> cfixed27; typedef CFixed<28, TC, WRAP> cfixed28; typedef CFixed<29, TC, WRAP> cfixed29; typedef CFixed<30, TC, WRAP> cfixed30; typedef CFixed<31, TC, WRAP> cfixed31; typedef CFixed<32, TC, WRAP> cfixed32; typedef CFixed<33, TC, WRAP> cfixed33; typedef CFixed<34, TC, WRAP> cfixed34; typedef CFixed<35, TC, WRAP> cfixed35; typedef CFixed<36, TC, WRAP> cfixed36; typedef CFixed<37, TC, WRAP> cfixed37; typedef CFixed<38, TC, WRAP> cfixed38; typedef CFixed<39, TC, WRAP> cfixed39; typedef CFixed<40, TC, WRAP> cfixed40; typedef CFixed<41, TC, WRAP> cfixed41; typedef CFixed<42, TC, WRAP> cfixed42; typedef CFixed<43, TC, WRAP> cfixed43; typedef CFixed<44, TC, WRAP> cfixed44; typedef CFixed<45, TC, WRAP> cfixed45; typedef CFixed<46, TC, WRAP> cfixed46; typedef CFixed<47, TC, WRAP> cfixed47; typedef CFixed<48, TC, WRAP> cfixed48; typedef CFixed<49, TC, WRAP> cfixed49; typedef CFixed<50, TC, WRAP> cfixed50; typedef CFixed<51, TC, WRAP> cfixed51; typedef CFixed<52, TC, WRAP> cfixed52; typedef CFixed<53, TC, WRAP> cfixed53; typedef CFixed<54, TC, WRAP> cfixed54; typedef CFixed<55, TC, WRAP> cfixed55; typedef CFixed<56, TC, WRAP> cfixed56; typedef CFixed<57, TC, WRAP> cfixed57; typedef CFixed<58, TC, WRAP> cfixed58; typedef CFixed<59, TC, WRAP> cfixed59; typedef CFixed<60, TC, WRAP> cfixed60; typedef CFixed<61, TC, WRAP> cfixed61; typedef CFixed<62, TC, WRAP> cfixed62; typedef CFixed<63, TC, WRAP> cfixed63; typedef CFixed<64, TC, WRAP> cfixed64; //! \endcond //! Typedefs for saturated CFixed (scfixed1, scfixed2, ..., scfixed64) typedef CFixed<1, TC, WRAP> cfixed1; //! \cond typedef CFixed<1, TC, SAT> scfixed1; typedef CFixed<2, TC, SAT> scfixed2; typedef CFixed<3, TC, SAT> scfixed3; typedef CFixed<4, TC, SAT> scfixed4; typedef CFixed<5, TC, SAT> scfixed5; typedef CFixed<6, TC, SAT> scfixed6; typedef CFixed<7, TC, SAT> scfixed7; typedef CFixed<8, TC, SAT> scfixed8; typedef CFixed<9, TC, SAT> scfixed9; typedef CFixed<10, TC, SAT> scfixed10; typedef CFixed<11, TC, SAT> scfixed11; typedef CFixed<12, TC, SAT> scfixed12; typedef CFixed<13, TC, SAT> scfixed13; typedef CFixed<14, TC, SAT> scfixed14; typedef CFixed<15, TC, SAT> scfixed15; typedef CFixed<16, TC, SAT> scfixed16; typedef CFixed<17, TC, SAT> scfixed17; typedef CFixed<18, TC, SAT> scfixed18; typedef CFixed<19, TC, SAT> scfixed19; typedef CFixed<20, TC, SAT> scfixed20; typedef CFixed<21, TC, SAT> scfixed21; typedef CFixed<22, TC, SAT> scfixed22; typedef CFixed<23, TC, SAT> scfixed23; typedef CFixed<24, TC, SAT> scfixed24; typedef CFixed<25, TC, SAT> scfixed25; typedef CFixed<26, TC, SAT> scfixed26; typedef CFixed<27, TC, SAT> scfixed27; typedef CFixed<28, TC, SAT> scfixed28; typedef CFixed<29, TC, SAT> scfixed29; typedef CFixed<30, TC, SAT> scfixed30; typedef CFixed<31, TC, SAT> scfixed31; typedef CFixed<32, TC, SAT> scfixed32; typedef CFixed<33, TC, SAT> scfixed33; typedef CFixed<34, TC, SAT> scfixed34; typedef CFixed<35, TC, SAT> scfixed35; typedef CFixed<36, TC, SAT> scfixed36; typedef CFixed<37, TC, SAT> scfixed37; typedef CFixed<38, TC, SAT> scfixed38; typedef CFixed<39, TC, SAT> scfixed39; typedef CFixed<40, TC, SAT> scfixed40; typedef CFixed<41, TC, SAT> scfixed41; typedef CFixed<42, TC, SAT> scfixed42; typedef CFixed<43, TC, SAT> scfixed43; typedef CFixed<44, TC, SAT> scfixed44; typedef CFixed<45, TC, SAT> scfixed45; typedef CFixed<46, TC, SAT> scfixed46; typedef CFixed<47, TC, SAT> scfixed47; typedef CFixed<48, TC, SAT> scfixed48; typedef CFixed<49, TC, SAT> scfixed49; typedef CFixed<50, TC, SAT> scfixed50; typedef CFixed<51, TC, SAT> scfixed51; typedef CFixed<52, TC, SAT> scfixed52; typedef CFixed<53, TC, SAT> scfixed53; typedef CFixed<54, TC, SAT> scfixed54; typedef CFixed<55, TC, SAT> scfixed55; typedef CFixed<56, TC, SAT> scfixed56; typedef CFixed<57, TC, SAT> scfixed57; typedef CFixed<58, TC, SAT> scfixed58; typedef CFixed<59, TC, SAT> scfixed59; typedef CFixed<60, TC, SAT> scfixed60; typedef CFixed<61, TC, SAT> scfixed61; typedef CFixed<62, TC, SAT> scfixed62; typedef CFixed<63, TC, SAT> scfixed63; typedef CFixed<64, TC, SAT> scfixed64; // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT CFixed<64, TC, WRAP>; //! \endcond } // namespace itpp #endif // #ifndef CFIXED_H itpp-4.3.1/itpp/fixed/fix.cpp000066400000000000000000000166451216575753400160730ustar00rootroot00000000000000/*! * \file * \brief Implementation of a fixed-point data type Fix * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { Fix& Fix::operator=(const Fix &x) { shift = x.shift; re = apply_o_mode(x.re); return *this; } Fix& Fix::operator=(const int x) { shift = 0; re = apply_o_mode(x); return *this; } Fix& Fix::operator+=(const Fix &x) { shift = assert_shifts(*this, x); re = apply_o_mode(re + x.re); return *this; } Fix& Fix::operator+=(const int x) { assert_shifts(*this, x); re = apply_o_mode(re + x); return *this; } Fix& Fix::operator-=(const Fix &x) { shift = assert_shifts(*this, x); re = apply_o_mode(re - x.re); return *this; } Fix& Fix::operator-=(const int x) { assert_shifts(*this, x); re = apply_o_mode(re - x); return *this; } Fix& Fix::operator*=(const Fix &x) { shift += x.shift; re = apply_o_mode(re * x.re); return *this; } Fix& Fix::operator*=(const int x) { re = apply_o_mode(re * x); return *this; } Fix& Fix::operator/=(const Fix &x) { shift -= x.shift; re = apply_o_mode(re / x.re); return *this; } Fix& Fix::operator/=(const int x) { re = apply_o_mode(re / x); return *this; } Fix Fix::operator-() const { return Fix(-re, shift, 0, 0); } Fix& Fix::operator<<=(const int n) { it_assert_debug(n >= 0, "Fix::operator<<=: n cannot be negative!"); shift += n; re = apply_o_mode(re << n); return *this; } Fix& Fix::operator>>=(const int n) { shift -= n; re = rshift_and_apply_q_mode(re, n); return *this; } void Fix::set(double x, int n) { shift = n; re = scale_and_apply_modes(x); } void Fix::set(double x, int n, q_mode q) { shift = n; re = scale_and_apply_modes(x, q); } void Fix::lshift(int n) { it_assert_debug(n >= 0, "Fix::lshift: n cannot be negative!"); shift += n; re = apply_o_mode(re << n); } void Fix::rshift(int n) { shift -= n; re = rshift_and_apply_q_mode(re, n); } void Fix::rshift(int n, q_mode q) { shift -= n; re = rshift_and_apply_q_mode(re, n, q); } double Fix::unfix() const { it_assert_debug(shift >= -63 && shift <= 64, "Fix::unfix: Illegal shift!"); return double(re)*DOUBLE_POW2[64 - shift]; } void Fix::print() const { Fix_Base::print(); std::cout << "re = " << re << std::endl; } int assert_shifts(const Fix &x, const Fix &y) { int ret = 0; if (x.shift == y.shift) ret = x.shift; else if (x.re == 0) ret = y.shift; else if (y.re == 0) ret = x.shift; else it_error("assert_shifts: Different shifts not allowed!"); return ret; } int assert_shifts(const Fix &x, int y) { it_error_if((x.shift != 0) && (x.re != 0) && (y != 0), "assert_shifts: Different shifts not allowed!"); return x.shift; } std::istream &operator>>(std::istream &is, Fix &x) { double value; is >> value; if (!is.eof() && (is.peek() == '<')) { int shift; is.get(); // Swallow '<' sign if (is.peek() == '<') { is.get(); // Swallow '<' sign is >> shift; x.set(value, shift); } else { is >> shift; is.get(); // Swallow '>' sign x.set_re(fixrep(value)); x.set_shift(shift); } } else { // Change data representation but keep shift x.set_re(fixrep(value)); } return is; } std::ostream &operator<<(std::ostream &os, const Fix &x) { switch (x.get_output_mode()) { case OUTPUT_FIX: os << x.get_re(); break; case OUTPUT_FIX_SHIFT: os << x.get_re() << '<' << x.get_shift() << '>'; break; case OUTPUT_FLOAT: os << double(x); break; case OUTPUT_FLOAT_SHIFT: os << double(x) << "<<" << x.get_shift(); break; default: it_error("operator<<: Illegal output mode!"); } return os; } // Specialization of template definition in vec.cpp template<> void fixvec::set(const char *values) { std::istringstream buffer(values); int b = 0, c = 0; int default_shift = 0, pos = 0, maxpos = 10; if (datasize > 0) { // Assume that all elements have the same shift default_shift = data[0].get_shift(); } alloc(maxpos); while (buffer.peek() != EOF) { switch (buffer.peek()) { case ':': // reads format a:b:c or a:b buffer.get(); if (!buffer.eof()) { buffer >> b; } if (!buffer.eof() && buffer.peek() == ':') { buffer.get(); if (!buffer.eof()) { buffer >> c; while (int(double(data[pos-1])) + b - c <= 0) { pos++; if (pos > maxpos) { maxpos = maxpos * 2; set_size(maxpos, true); } data[pos-1] = data[pos-2]; data[pos-1] += b; } } } else { while (int(double(data[pos-1])) < b) { pos++; if (pos > maxpos) { maxpos = maxpos * 2; set_size(maxpos, true); } data[pos-1] = data[pos-2]; data[pos-1] += 1; } } break; case ',': buffer.get(); break; default: pos++; if (pos > maxpos) { maxpos *= 2; set_size(maxpos, true); } data[pos-1].set_shift(default_shift); buffer >> data[pos-1]; // May override default_shift while (buffer.peek() == ' ') { buffer.get(); } break; } } set_size(pos, true); } // Specialization of template definition in mat.cpp template<> void fixmat::set(const char *values) { std::istringstream buffer(values); int default_shift = 0, rows = 0, maxrows = 10, cols = 0, nocols = 0, maxcols = 10; if (datasize > 0) { // Assume that all elements have the same shift default_shift = data[0].get_shift(); } alloc(maxrows, maxcols); while (buffer.peek() != EOF) { rows++; if (rows > maxrows) { maxrows = maxrows * 2; set_size(maxrows, maxcols, true); } cols = 0; while ((buffer.peek() != ';') && (buffer.peek() != EOF)) { if (buffer.peek() == ',') { buffer.get(); } else { cols++; if (cols > nocols) { nocols = cols; if (cols > maxcols) { maxcols = maxcols * 2; set_size(maxrows, maxcols, true); } } this->operator()(rows-1, cols - 1).set_shift(default_shift); buffer >> this->operator()(rows-1, cols - 1); // May override default_shift while (buffer.peek() == ' ') { buffer.get(); } } } if (!buffer.eof()) buffer.get(); } set_size(rows, nocols, true); } } //namespace itpp itpp-4.3.1/itpp/fixed/fix.h000066400000000000000000000132641216575753400155320ustar00rootroot00000000000000/*! * \file * \brief Definitions of a fixed-point data type Fix * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FIX_H #define FIX_H #include #include #include namespace itpp { // Forward declarations template class Vec; template class Mat; //! \addtogroup fixed //!@{ /*! \brief Fixed-point data type See the Detailed Description in the \ref fixed module. */ class ITPP_EXPORT Fix : public Fix_Base { friend class CFix; template friend class Fixed; template friend class CFixed; public: //! Default constructor Fix(double x = 0.0, int s = 0, int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : Fix_Base(s, w, e, o, q, ptr), re(scale_and_apply_modes(x)) {} //! Constructor explicit Fix(const Fix_Factory &f) : Fix_Base(0, f.wordlen, f.emode, f.omode, f.qmode, f.stat_ptr), re(0) {} //! Constructor for internal use. No restrictions are applied. The dummies help to avoid ambiguities Fix(fixrep r, int s, int, int) : Fix_Base(s), re(r) {} //! Copy constructor Fix(const Fix &x, int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : Fix_Base(x.shift, w, e, o, q, ptr), re(x.re) {} //! Destructor virtual ~Fix() {} //! Assignment from Fix Fix& operator=(const Fix &x); //! Assignment from int Fix& operator=(const int x); //! Addition of Fix Fix& operator+=(const Fix &x); //! Addition of int Fix& operator+=(const int x); //! Subtraction of Fix Fix& operator-=(const Fix &x); //! Subtraction of int Fix& operator-=(const int x); //! Multiplication with Fix Fix& operator*=(const Fix &x); //! Multiplication with int Fix& operator*=(const int x); //! Division with Fix using quantization mode \c TRN Fix& operator/=(const Fix &x); //! Division with int using quantization mode \c TRN Fix& operator/=(const int x); //! Unary negative of Fix Fix operator-() const; //! Left shift \c n bits Fix& operator<<=(const int n); //! Right shift \c n bits using quantization mode \c qmode (constructor argument) Fix& operator>>=(const int n); //! Set to x * pow2(n) using quantization mode \c qmode (constructor argument) void set(double x, int n); //! Set to x * pow2(n) using quantization mode \c q (function argument) void set(double x, int n, q_mode q); //! Set data representation (mainly for internal use since it reveals the representation type) void set_re(fixrep x) {re = apply_o_mode(x);} //! Left shift \c n bits void lshift(int n); //! Right shift \c n bits using quantization mode \c qmode (constructor argument) void rshift(int n); //! Right shift \c n bits using quantization mode \c q (function argument) void rshift(int n, q_mode q); //! Print restrictions virtual void print() const; //! Get data representation (mainly for internal use since it reveals the representation type) fixrep get_re() const {return re;} //! Conversion to double double unfix() const; #ifndef NO_IMPLICIT_FIX_CONVERSION //! Conversion to double operator double() const { it_assert_debug(shift>=-63 && shift <= 64, "Fix::operator double: Illegal shift!"); return double(re)*DOUBLE_POW2[64 - shift]; } #endif //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) friend ITPP_EXPORT int assert_shifts(const CFix &x, const Fix &y); //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) friend ITPP_EXPORT int assert_shifts(const Fix &x, const Fix &y); //! Check that x.shift==0 OR x==0 OR y==0 and return x.shift friend ITPP_EXPORT int assert_shifts(const Fix &x, int y); protected: //! Data representation fixrep re; }; //! Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument) ITPP_EXPORT int assert_shifts(const Fix &x, const Fix &y); //! Check that x.shift==0 OR x==0 OR y==0 and return x.shift ITPP_EXPORT int assert_shifts(const Fix &x, int y); //! Input bit representation and, optionally, the shift ITPP_EXPORT std::istream &operator>>(std::istream &is, Fix &x); //! Output bit representation and, optionally, the shift ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Fix &x); //! Typedef for fixed-point vector type typedef Vec fixvec; //! Typedef for fixed-point matrix type typedef Mat fixmat; // Specialization of template definition in vec.cpp template<> void fixvec::set(const char *values); // Specialization of template definition in mat.cpp template<> void fixmat::set(const char *values); //!@} } // namespace itpp #endif // #ifndef FIX_H itpp-4.3.1/itpp/fixed/fix_base.cpp000066400000000000000000000175331216575753400170620ustar00rootroot00000000000000/*! * \file * \brief Implementation of a base class for fixed-point data types * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { // Definition and initialization of static data member output_mode Fix_Base::outputmode = OUTPUT_FIX_SHIFT; void Fix_Base::set_output_mode(std::string o) { if (o == "OUTPUT_FIX") outputmode = OUTPUT_FIX; else if (o == "OUTPUT_FIX_SHIFT") outputmode = OUTPUT_FIX_SHIFT; else if (o == "OUTPUT_FLOAT") outputmode = OUTPUT_FLOAT; else if (o == "OUTPUT_FLOAT_SHIFT") outputmode = OUTPUT_FLOAT_SHIFT; else it_error("Fix_Base::set_output_mode: Illegal output mode!"); } void Fix_Base::print() const { std::cout << "shift = " << shift << std::endl << "wordlen = " << wordlen << std::endl << "int(emode) = " << int(emode) << std::endl << "int(omode) = " << int(omode) << std::endl << "int(qmode) = " << int(qmode) << std::endl << "stat_ptr = " << stat_ptr << std::endl << "min = " << min << std::endl << "max = " << max << std::endl << "n_unused_bits = " << n_unused_bits << std::endl; } void Fix_Base::init() { switch (emode) { case TC: it_assert_debug(wordlen >= 1 && wordlen <= 64, "Fix_Base::calc_apply_o_modes: Illegal word length!"); max = fixrep(UINT64_POW2[wordlen - 1] - 1); min = -max - 1; break; case US: it_assert_debug(wordlen >= 0 && wordlen <= 63, "Fix_Base::calc_apply_o_modes: Illegal word length!"); min = 0; max = fixrep(UINT64_POW2[wordlen] - 1); break; default: it_error("Fix_Base::init: Illegal sign encoding mode!"); break; } n_unused_bits = MAX_WORDLEN - wordlen; } fixrep Fix_Base::apply_o_mode(fixrep x) const { fixrep ret = x; bool overflow = false; if (ret < min) { overflow = true; switch (omode) { case WRAP: ret = fixrep((fixrep(ret) << n_unused_bits) >> n_unused_bits); break; case SAT: ret = min; break; default: it_error("Fix_Base::apply_o_mode: Illegal overflow mode!"); break; } } else if (ret > max) { overflow = true; switch (omode) { case WRAP: ret = fixrep((fixrep(ret) << n_unused_bits) >> n_unused_bits); break; case SAT: ret = max; break; default: it_error("Fix_Base::apply_o_mode: Illegal overflow mode!"); break; } } if (stat_ptr != 0) stat_ptr->sample(double(ret), overflow); return ret; } fixrep Fix_Base::scale_and_apply_modes(double x, q_mode q) const { it_assert_debug(shift >= -64 && shift <= 63, "Fix_Base::scale_and_apply_modes: Illegal shift!"); fixrep ret = 0; double scaled_value = x * DOUBLE_POW2[shift + 64]; switch (q) { case RND: ret = apply_o_mode(fixrep(std::floor(scaled_value + 0.5))); break; case RND_ZERO: if (x < 0) ret = apply_o_mode(fixrep(std::floor(scaled_value + 0.5))); else ret = apply_o_mode(fixrep(-std::floor(-scaled_value + 0.5))); break; case RND_MIN_INF: ret = apply_o_mode(fixrep(-std::floor(-scaled_value + 0.5))); break; case RND_INF: if (x < 0) ret = apply_o_mode(fixrep(scaled_value - 0.5)); else ret = apply_o_mode(fixrep(scaled_value + 0.5)); break; case RND_CONV: if (scaled_value == std::floor(scaled_value) + 0.5) ret = apply_o_mode((fixrep(round(scaled_value)) >> 1) << 1); else ret = apply_o_mode(fixrep(std::floor(scaled_value + 0.5))); break; case RND_CONV_ODD: if (scaled_value == std::floor(scaled_value) + 0.5) if (scaled_value < 0) ret = apply_o_mode(((fixrep(std::ceil(scaled_value)) >> 1) << 1) - 1); else ret = apply_o_mode(((fixrep(std::floor(scaled_value)) >> 1) << 1) + 1); else ret = apply_o_mode(fixrep(std::floor(scaled_value + 0.5))); break; case TRN: ret = apply_o_mode(fixrep(std::floor(scaled_value))); break; case TRN_ZERO: ret = apply_o_mode(fixrep(scaled_value)); break; default: it_error("Fix_Base::scale_and_apply_modes: Illegal quantization mode!"); break; } return ret; } fixrep Fix_Base::rshift_and_apply_q_mode(fixrep x, int n, q_mode q) const { it_assert_debug(n >= 0, "Fix_Base::rshift_and_apply_q_mode: n cannot be negative!"); fixrep ret = 0; if (n == 0) { ret = x; } else { switch (q) { case RND: // Add the most significant deleted bit to the remaining bits ret = ((x >> (n - 1)) + 1) >> 1; break; case RND_ZERO: // If the most significant deleted bit is 1, // and either the sign bit or at least one other deleted bit is 1, // add 1 to the remaining bits if ((x & (fixrep(1) << (n - 1))) && ((x < 0) || (x & ((fixrep(1) << (n - 1)) - 1)))) ret = (x >> n) + 1; else ret = x >> n; break; case RND_MIN_INF: // If the most significant deleted bit is 1, // and at least one other deleted bit is 1, // add 1 to the remaining bits if ((x & (fixrep(1) << (n - 1))) && (x & ((fixrep(1) << (n - 1)) - 1))) ret = (x >> n) + 1; else ret = x >> n; break; case RND_INF: // If the most significant deleted bit is 1, // and either the inverted value of the sign bit or at least one other deleted bit is 1, // add 1 to the remaining bits if ((x & (fixrep(1) << (n - 1))) && ((x >= 0) || (x & ((fixrep(1) << (n - 1)) - 1)))) ret = (x >> n) + 1; else ret = x >> n; break; case RND_CONV: // If the most significant deleted bit is 1, // and either the least significant of the remaining bits or at least one other deleted bit is 1, // add 1 to the remaining bits if ((x & (fixrep(1) << (n - 1))) && ((x & (fixrep(1) << n)) || (x & ((fixrep(1) << (n - 1)) - 1)))) ret = (x >> n) + 1; else ret = x >> n; break; case RND_CONV_ODD: // If the most significant deleted bit is 1, // and either the least significant of the remaining bits is 0 or at least one other deleted bit is 1, // add 1 to the remaining bits if ((x & (fixrep(1) << (n - 1))) && (!(x & (fixrep(1) << n)) || (x & ((fixrep(1) << (n - 1)) - 1)))) ret = (x >> n) + 1; else ret = x >> n; break; case TRN: // Just copy the remaining bits ret = x >> n; break; case TRN_ZERO: // If the sign bit is 1, // and either the most significant deleted bit or at least one other deleted bit is 1, // add 1 to the remaining bits if ((x < 0) && (x & ((fixrep(1) << n) - 1))) ret = (x >> n) + 1; else ret = x >> n; break; default: it_error("Fix_Base::rshift_and_apply_q_mode: Illegal quantization mode!"); break; } } if (stat_ptr != 0) stat_ptr->sample(double(ret), false); return ret; } } // namespace itpp itpp-4.3.1/itpp/fixed/fix_base.h000066400000000000000000001263521216575753400165270ustar00rootroot00000000000000/*! * \file * \brief Definitions of a base class for fixed-point data types * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FIX_BASE_H #define FIX_BASE_H #include #include #include namespace itpp { /*! \addtogroup fixed \brief Fixed-Point Data Types \author Johan Bergman \section fix_contents Contents
    • \ref fix_intro
    • \ref fix_base
      • \ref fix_base_shift
      • \ref fix_base_wordlen
      • \ref fix_base_emode
      • \ref fix_base_omode
      • \ref fix_base_qmode
      • \ref fix_base_stat
      • \ref fix_base_outputmode
    • \ref fix_real
    • \ref fix_complex
    • \ref fix_factory
    • \ref fix_ops
      • \ref fix_ops_asn
      • \ref fix_ops_add
      • \ref fix_ops_mult
      • \ref fix_ops_shift
      • \ref fix_ops_conv
      • \ref fix_ops_get
      • \ref fix_ops_io
    • \ref fix_fcn
      • \ref fix_fcn_isfix
      • \ref fix_fcn_setfix
      • \ref fix_fcn_shiftfix
      • \ref fix_fcn_assert
      • \ref fix_fcn_unfix
      • \ref fix_fcn_to
      • \ref fix_fcn_other
    \section fix_intro Introduction How to include the support for fixed-point data types in your program: \code #include #include using namespace itpp; \endcode Fixed-point data types in IT++:
    • itpp::Fix (real-valued, restrictions specified as constructor arguments)
    • itpp::Fixed (real-valued, restrictions specified as template arguments)
    • itpp::CFix (complex-valued, restrictions specified as constructor arguments)
    • itpp::CFixed (complex-valued, restrictions specified as template arguments)
    These classes have a common base class called Fix_Base; see inheritance diagram in the itpp::Fix_Base documentation. The following data members are inherited from Fix_Base:
    • Shift factor
    • Word length
    • Sign encoding mode
    • Overflow mode
    • Quantization mode
    • Statistics object pointer
    • Output mode
    The term "fixed-point restrictions" refers to all these data members except for the shift factor, which is considered to be part of the "fixed-point number". The shift factor has some resemblance to a binary point. The value of the shift factor is set in initializations and assignments and it is modified by multiplications, divisions and bit-shifting operations. The shift factor is used for checking that both terms have been shifted the same amount in additions and subtractions. Also, it is used to "un-shift" the data when a fixed-point number is converted to floating point. Names of classes and enums have been aligned with the fixed-point data types in SystemC to some extent, but the fixed-point data types in IT++ and SystemC are quite different. In fact, the fixed-point data types in IT++ probably correspond better to the variable-precision integer types in SystemC (with one important difference: the fixed-point numbers in IT++ remember the amount of bit-shifting that has been applied to them, so that they can be converted back to "floating-point magnitude" easily if this is desired). The reason for this design choice in IT++ is to make the fixed-point simulations as fast as possible. If necessary, the core parts in itbase.h (e.g. Array, Vec and Mat) should be able to use some other data type than the ones presented here, assuming that a proper itpp::Factory is created for the data type, just like itpp::Fix_Factory has been created for these data types. Sometimes the documentation for the IT++ fixed-point data types states that a function is "useful in templated code". This means that the function facilitates writing templated code where the template argument is meant to be either a floating-point type (double or complex) or a fixed-point type (Fix or CFix), i.e. code which is supposed to support both floating-point and fixed-point simulations. For example, the operator >>= is defined for Fix and CFix, but not for double and complex, so it might be a better idea to use the function rshift_fix which is defined for Fix and CFix as well as double and complex. For an example program, take a look at tests/fix_test.cpp. \section fix_base Fix_Base \subsection fix_base_shift Shift factor Supported shift factors: -64 ... +63 bit-shifts. 0 is \e default. An IT++ fixed-point number consists of a bit representation and a shift factor. The shift factor is a member of Fix_Base, while the bit representation is a member of the inherited class (Fix or CFix). The shift factor indicates the number of bit-shifts that have been performed on the data. A positive shift factor means that the data has been left-shifted while a negative shift factor means that the data has been right-shifted. For information about how the shift factor is affected by different operators, see section \ref fix_ops. \subsection fix_base_wordlen Word length Supported word lengths: 1 ... 64 bits. 64 is \e default. \warning Fix, Fixed, CFix and CFixed always use \e signed 64-bit integers to represent the fixed-point data. Therefore it is not recommended to declare variables with 64 bits and sign encoding mode US. \subsection fix_base_emode Sign encoding mode Supported sign encoding modes (itpp::e_mode):
    • TC (Two's complement)
    • US (Unsigned)
    TC is \e default. \warning Fix, Fixed, CFix and CFixed always use \e signed 64-bit integers to represent the fixed-point data. Therefore it is not recommended to declare variables with 64 bits and sign encoding mode US. \subsection fix_base_omode Overflow mode Supported overflow modes (itpp::o_mode):
    • SAT (Saturation)
    • WRAP (Wrap-around)
    WRAP is \e default. \note Fix, Fixed, CFix and CFixed apply this restriction during initialization and assignments only. \subsection fix_base_qmode Quantization mode Supported quantization modes (itpp::q_mode), with definitions borrowed from SystemC (see SystemC documentation for further details):
    • RND (Rounding to plus infinity): Add the most significant deleted bit to the remaining bits.
    • RND_ZERO (Rounding to zero): If the most significant deleted bit is 1, and either the sign bit or at least one other deleted bit is 1, add 1 to the remaining bits.
    • RND_MIN_INF (Rounding to minus infinity): If the most significant deleted bit is 1, and at least one other deleted bit is 1, add 1 to the remaining bits.
    • RND_INF (Rounding to infinity): If the most significant deleted bit is 1, and either the inverted value of the sign bit or at least one other deleted bit is 1, add 1 to the remaining bits.
    • RND_CONV (Convergent rounding with half-way value rounded to even value): If the most significant deleted bit is 1, and either the least significant of the remaining bits or at least one other deleted bit is 1, add 1 to the remaining bits.
    • RND_CONV_ODD (Convergent rounding with half-way value rounded to odd value): If the most significant deleted bit is 1, and either the least significant of the remaining bits is 0 or at least one other deleted bit is 1, add 1 to the remaining bits (not defined in SystemC).
    • TRN (Truncation): Just copy the remaining bits.
    • TRN_ZERO (Truncation to zero): If the sign bit is 1, and either the most significant deleted bit or at least one other deleted bit is 1, add 1 to the remaining bits.
    TRN is \e default. RND and TRN are usually the most implementation friendly. However, note that it is RND_INF that corresponds to "ordinary rounding" and TRN_ZERO that corresponds to "ordinary truncation". \note Fix, Fixed, CFix and CFixed apply this restriction during initialization and right-shift operations only. \subsection fix_base_stat Statistics object pointer Supported statistics object pointer values: either a pointer to an itpp::Stat object or 0. 0 is \e default. The sample method in the statistics object is called during initializations and assignments. A single statistics object can collect statistics from more than one fixed-point variable. \subsection fix_base_outputmode Output mode Supported output modes (itpp::output_mode), used by the output stream operator \<\<:
    • OUTPUT_FIX: Output fixed-point representation only
    • OUTPUT_FIX_SHIFT: Output fixed-point representation followed by \
    • OUTPUT_FLOAT: Output floating-point value
    • OUTPUT_FLOAT_SHIFT: Output floating-point value followed by \<\ OUTPUT_FIX_SHIFT is \e default. Unlike the other modes, output_mode is a \e static data member of Fix_Base, i.e. the output_mode is common for all fixed-point variables. Use the following commands to change output_mode: \code Fix_Base::set_output_mode(OUTPUT_FIX); Fix_Base::set_output_mode(OUTPUT_FIX_SHIFT); Fix_Base::set_output_mode(OUTPUT_FLOAT); Fix_Base::set_output_mode(OUTPUT_FLOAT_SHIFT); // Alternative using a string parameter Fix_Base::set_output_mode("OUTPUT_FIX"); Fix_Base::set_output_mode("OUTPUT_FIX_SHIFT"); Fix_Base::set_output_mode("OUTPUT_FLOAT"); Fix_Base::set_output_mode("OUTPUT_FLOAT_SHIFT"); // Alternative using an ostream modifier cout << OUTPUT_FIX; cout << OUTPUT_FIX_SHIFT; cout << OUTPUT_FLOAT; cout << OUTPUT_FLOAT_SHIFT; \endcode \section fix_real Fix and Fixed Fix and Fixed are real-valued fixed-point data types primarily intended to replace \c double when a design is refined from floating- to fixed-point implementation. The data is stored in the least significant bits of a 64-bit integer variable. The following example shows how to declare a two's complement (i.e. a signed) 20-bit variable with wrap-around as overflow handling with the initial value 3.14 shifted up 10 bits: \code Fix a(3.14, 10, 20, TC, WRAP); Fixed<20, TC, WRAP> b(3.14, 10); \endcode Note that Fix takes the initial values as well as the fixed-point restrictions as constructor arguments. Fixed also takes the initial values as constructor arguments but it takes the fixed-point restrictions as template arguments. Choose Fix or Fixed depending on your needs. There are three main reasons why you would want to choose Fix instead of Fixed. First, if you want to change the fixed-point restrictions for a variable during run time, you have to use Fix, since the fixed-point restrictions for Fixed have been "fixed" at compile time. Second, if your code is using a lot of templating, you might end up with many more template arguments if you use Fixed than you would if you use Fix, since each set of fixed-point restrictions that you want to use will correspond to another type (based on the class template Fixed) instead of just different configurations of a single type (Fix). Third, the vector and matrix operations currently work better for Fix than for Fixed. \note Fixed is derived from Fix, which means that operators, methods and functions for Fix can be used for Fixed as well. However, the functions for Vec (fixvec) and Mat (fixmat) cannot be used for Vec and Mat. If you choose Fix, you should also read the section \ref fix_factory. If you choose Fixed, you may find it convenient to use the following typedefs: \code typedef Fixed<1, TC, WRAP> fixed1; // for Fixed with 1 bit ... typedef Fixed<64, TC, WRAP> fixed64; // for Fixed with 64 bits typedef Fixed<1, US, WRAP> ufixed1; // for Unsigned Fixed with 1 bit ... typedef Fixed<64, US, WRAP> ufixed64; // for Unsigned Fixed with 64 bits typedef Fixed<1, TC, SAT> sfixed1; // for Saturated Fixed with 1 bit ... typedef Fixed<64, TC, SAT> sfixed64; // for Saturated Fixed with 64 bits typedef Fixed<1, US, SAT> sufixed1; // for Saturated Unsigned Fixed with 1 bit ... typedef Fixed<64, US, SAT> sufixed64; // for Saturated Unsigned Fixed with 64 bits \endcode \note These typedefs use the default values for quantization mode (TRN) and statistics object pointer value (0). Also note that U stands for Unsigned but S stands for Saturated, NOT for Signed. Declaration corresponding to the above Fixed example but using one of the typedefs: \code fixed20 b(3.14, 10); \endcode \section fix_complex CFix and CFixed CFix and CFixed are complex-valued fixed-point data types primarily intended to replace complex when a design is refined from floating- to fixed-point implementation. The data is stored in the least significant bits of two 64-bit integer variables: one for the real part and one for the imaginary part. The two parts have a common shift factor (the one inherited from Fix_Base), so it is not possible to shift only one of them. The following example shows two ways to declare a two's complement (i.e. a signed) 20-bit variable with wrap-around as overflow handling with the initial value 1.11 + 2.22i shifted up 10 bits: \code CFix a(1.11, 2.22, 10, 20, TC, WRAP); CFixed<20, TC, WRAP> b(1.11, 2.22, 10); CFix c(complex(1.11, 2.22), 0.0, 10, 20, TC, WRAP); CFixed<20, TC, WRAP> d(complex(1.11, 2.22), 0.0, 10); \endcode \note The shift factor is passed as the third argument to the CFix/CFixed constructors. If the first argument is complex, the second argument is a dummy (that was set to 0.0 in the examples above). Choose CFix or CFixed depending on your needs; see section \ref fix_real. If you choose CFix, you should also read the section \ref fix_factory. \note CFixed is derived from CFix, which means that operators, methods and functions for CFix can be used for CFixed as well. However, the functions for Vec (cfixvec) and Mat (cfixmat) cannot be used for Vec and Mat. If you choose CFixed, you may find it convenient to use the following typedefs, which are predefined in IT++: \code typedef CFixed<1, TC, WRAP> cfixed1; // for CFixed with 1 bit ... typedef CFixed<64, TC, WRAP> cfixed64; // for CFixed with 64 bits typedef CFixed<1, TC, SAT> scfixed1; // for Saturated CFixed with 1 bit ... typedef CFixed<64, TC, SAT> scfixed64; // for Saturated CFixed with 64 bits \endcode \note These typedefs use the default values for sign encoding mode (TC), quantization mode (TRN) and statistics object pointer value (0). Also note that S stands for Saturated, NOT for Signed. Declarations corresponding to the above CFixed examples but using one of the typedefs: \code cfixed20 b(1.11, 2.22, 10); cfixed20 d(complex(1.11, 2.22), 0.0, 10); \endcode \section fix_factory Fix_Factory IF you choose to use Fix/CFix (instead of Fixed/CFixed) AND you want to declare an Array/Vec/Mat with Fix/CFix elements AND you wish to specify some non-default fixed-point restrictions for these elements (i.e. something else than 64-bit word length, two's complement as sign encoding mode, wrap-around as overflow mode, truncation as quantization mode, and no statistics object), THEN you will need to use a Fix_Factory when declaring the Array/Vec/Mat of Fix/CFix. Here is how it works, somewhat simplified: you give the fixed-point restrictions as parameters to the Fix_Factory, then you give the Fix_Factory as a parameter to the Array/Vec/Mat, and finally the Array/Vec/Mat uses the Fix_Factory to create Fix/CFix elements with those fixed-point restrictions. All constructors for Array, Vec and Mat can take a Fix_Factory (or any other Factory for that matter) as their last, optional argument. It is assumed that all elements in the Array/Vec/Mat should have the same fixed-point restrictions (and use a common statistics object, if any). Note that a Fix_Factory can create both Fix and CFix objects. For information on Factory in general and Fix_Factory in particular, see the Detailed Descriptions for itpp::Factory and itpp::Fix_Factory, respectively. The following example shows how to declare a vector of length 7 with Fix elements that are two's complement 20-bit variables with wrap-around as overflow handling: \code Vec a(7, FIX20); \endcode FIX20 is one of many predefined Fix_Factory; see the Detailed Description for itpp::Fix_Factory. \note One might wonder why the Array/Vec/Mat classes themselves cannot take the fixed-point restrictions as parameters directly and create the Fix/CFix elements without help from a Fix_Factory. The main benefit with the chosen solution is that the Array/Vec/Mat classes are not "contaminated" with knowledge (parameters, methods, etc) that is specific to the Fix/CFix types. If the user for some reason prefers to use some other type (i.e. a type not known by IT++) as the Array/Vec/Mat element type, this should work fine as long as he or she creates a corresponding Factory. And this is exactly the way that Fix/CFix and Fix_Factory work. Fix/CFix should not need to know about Fix_Factory, but for the sake of uniform syntax in declarations, an exception has been made: \code Fix a(FIX20); \endcode i.e. a Fix/CFix declaration can take a Fix_Factory as an argument, just like the Vec declaration above did. \note All declarations with a Fix_Factory as a constructor argument also work in templated code; see the Detailed Description for itpp::Fix_Factory. \section fix_ops Operators and methods \subsection fix_ops_asn Initialization and assignment Fixed-point variables can be initialized with a fixed- or a floating-point value: \code // Initialize a with the floating-point value double(3.14*pow2(10)) // and word length 20, two's complement, wrap-around and rounding Fix a(3.14, 10, 20, TC, WRAP, RND); // Initialize b with the fixed-point value a // and word length 7, two's complement, wrap-around and rounding Fix b(a, 7, TC, WRAP, RND); \endcode In this example, \c b was initialized with the same value as \c a but with smaller word length resulting in overflow, since round(3.14*pow2(10)) does not fit in the 7-bit variable \c b. \warning All fixed-point data types have default constructors. For Fix/CFix, the default constructor gives full word length (64 bits). If you call templated functions with Fix/CFix as the template argument, they might use these default constructors for declaration of temporary variables, which may then contain unrestricted (64-bit) temporary results. If you want these temporary results to be restricted, then you may have to modify the function to introduce fixed-point restrictions for the temporary results, and even introduce new temporary variables in order to avoid more than one operation per expression (demonstrated in an example below). For Fixed/CFixed, on the other hand, the default constructor gives certain fixed-point restrictions, but note that it may still be necessary to introduce other fixed-point restrictions as well as new temporary variables in the function. The assignment operators =, +=, -=, *=, /=, <<= and >>= are supported. For =, +=, -=, *= and /=, the right-hand operand can be another fixed-point variable or an integer value. If it is an integer value, it is interpreted as a fixed-point value with shift factor 0. The = operator simply copies the shift factor from the right side to the left side. For information on how the other operators treat the shift factor, see sections \ref fix_ops_add, \ref fix_ops_mult and \ref fix_ops_shift. If assignment to a scaled \c double is desired (when initialization has already taken place), the itpp::Fix::set method can be used. \code // Initialize c with the floating-point value double(3.14*pow2(10)) // The shift factor is set to 10 Fix c(3.14, 10); // Set c equal to 123. The shift factor is set to 0 // Note that the old shift factor 10 is discarded c = 123; // Set c equal to the integer portion of double(3.14*pow2(10)) // The shift factor is set to 10 (again) c.set(3.14, 10); // Achieve the same result using a temporary variable // Note that the assignment operator copies the shift factor c = Fix(3.14, 10); \endcode When the floating-point value is quantized, the quantization mode of the fixed-point variable (TRN in the example above, since \c c has this quantization mode) will be used, unless some other quantization mode (e.g. RND) is specified as a third argument to set: \code c.set(3.14, 10, RND); \endcode \note If you write templated code, you are better off if you use the set_fix function described in section \ref fix_fcn_setfix instead of the set method. There are also methods for setting data representation and shift directly: itpp::Fix::set_re, itpp::CFix::set_im and itpp::Fix_Base::set_shift. They are mainly intended for internal use. \subsection fix_ops_add Addition and subtraction Addition and subtraction between two fixed-point variables as well as between a fixed-point variable and an integer variable is supported. The unary minus operator is also defined. For Fix and CFix, several vector and matrix operations are also supported. \code // Declare a fixed-point vector with 7 elements // (using the predefined Fix_Factory FIX20) Vec d(7, FIX20); // Set all 7 elements equal to 77 with shift factor 0 d = Fix(77); // Declare an integer vector with 7 elements ivec e = "1 2 3 4 5 6 7"; // Add fixed-point vector d and integer vector e. Both have shift factor 0 Vec f(d + e, FIX20); \endcode \note The addition and subtraction operators require that both operands have the same shift factor, unless at least one of the operands is zero. If \c d had been assigned with a different shift factor than 0 in the above example (and ASSERT_LEVEL > 0), the addition d + e would have failed, resulting in termination with the error message "assert_shifts: Different shifts not allowed!". As hinted earlier, the fixed-point restrictions are applied during initialization, assignment and bit-shifting operations only. This means that the result of an addition or subtraction is unrestricted (64 bits). \code Fix g(0, 0, 8, TC, SAT); Fix h(100, 0, 8, TC, SAT); Fix i(100, 0, 8, TC, SAT); Fix j(-100, 0, 8, TC, SAT); // The result of h + i is unrestricted (64 bits) but when it is assigned to g, // it is restricted according to the fixed-point restrictions of g (8 bits). // We get overflow, since 100+100=200 doesn't fit in an 8-bit signed variable. // The saturated result will be 127 g = h + i; // But now we don't get overflow since 100+100-100=100 does fit! g = h + i + j; // If we do want the temporary result to be restricted, we have to make // an explicit temporary variable (with appropriate restrictions) for it Fix tmp(0, 0, 8, TC, SAT); // The first sum will be saturated to 127 tmp = h + i; // The final sum will be 127-100=27, i.e. we got a different // result when we introduced a restricted temporary variable g = tmp + j; \endcode \subsection fix_ops_mult Multiplication and division Multiplication and division between two fixed-point variables as well as between a fixed-point variable and an integer variable is supported. For Fix and CFix, several vector and matrix operations are also supported. As stated earlier, the fixed-point restrictions are applied during initialization, assignment and bit-shifting operations only. This means that the result of a multiplication or division is unrestricted (64 bits) in the same way as for an addition or subtraction; see section \ref fix_ops_add. The resulting shift factor after a multiplication is the sum of the two shift factors, while the resulting shift factor after a division is the difference between the numerator shift factor and the denominator shift factor. The result of a division is always quantized using truncation, i.e. the quantization modes of the involved fixed-point variables do not matter. Note that sometimes divisions can be replaced with multiplications and/or bit-shifting operations; see section \ref fix_ops_shift. \warning Complex multiplications and divisions are supported, but they utilize temporary variables with full word length (64 bits). \subsection fix_ops_shift Bit-shifting The <<= and >>= operators are defined for the fixed-point data types. As an alternative, you can use the itpp::Fix::lshift and itpp::Fix::rshift methods. The appropriate fixed-point restrictions of the variable are applied, i.e. for left-shifting the overflow mode is applied and for right-shifting the quantization mode is applied. There is also a version of rshift that takes a quantization mode as the last argument (but there is no corresponding version of the >>= operator since it cannot take an extra argument). \code // Declare a fixed-point variable with the default quantization mode (TRN) Fix a(3.14, 10); // Right shift 5 bits using the quantization mode of a (i.e. TRN) a.rshift(5); // Right shift 5 bits using the specified quantization mode (i.e. RND) a.rshift(5, RND); \endcode \note If you write templated code, you are better off if you use the lshift_fix and rshift_fix functions described in section \ref fix_fcn_shiftfix instead of the <<= and >>= operators and the lshift and rshift methods. The << and >> operators are not defined for the fixed-point data types since it is not clear what quantization mode that should be applied for the >> operator. \subsection fix_ops_conv Conversion Fix and Fixed can be converted to double, while CFix and CFixed can be converted to complex. The conversion operators "un-shift" the data by multiplying the fixed-point bit representation with pow2(-shift). The itpp::Fix::unfix and itpp::CFix::unfix methods can always be used: \code Fix a(3.14, 5); cout << a.unfix() << endl; \endcode The resulting output is 3.125. \note If you write templated code, you are better off if you use the functions unfix or to described in sections \ref fix_fcn_unfix and \ref fix_fcn_to instead of the unfix method. Equivalently, the double(Fix&) and complex(CFix&) operators can be used, unless you define NO_IMPLICIT_FIX_CONVERSION before you include IT++ in your program. \code Fix a(3.14, 5); cout << double(a) << endl; \endcode The resulting output is 3.125. Finally, Fix/Fixed can be converted to CFix/CFixed using the appropriate CFix/CFixed constructors. \subsection fix_ops_get Get data members This example shows how to get the data members of fixed-point variables: \code Fix a; int64_t the_bit_representation = a.get_re(); int the_shift_factor = a.get_shift(); int the_word_length = a.get_wordlen(); e_mode the_sign_encoding_mode = a.get_e_mode(); o_mode the_overflow_mode = a.get_o_mode(); q_mode the_quantization_mode = a.get_q_mode(); int64_t max_bit_representation = a.get_max(); int64_t min_bit_representation = a.get_min(); \endcode \note For CFix and CFixed, you get the bit representation for the imaginary part with the method get_im(). \subsection fix_ops_io Input and output The print() method outputs the entire state; see section \ref fix_ops_get. \code Fix a; a.print(); \endcode This code example shows how to input and output fixed-point numbers: \code CFix a(FIX8); a.set(0.0, 0.0, 4); cout << "Old a: " << a << endl; cout << "New a? "; cin >> a; cout << "New a: " << a << endl; \endcode Complex numbers can be input on both the C++ form and the IT++ form: \code Old a: 0+0i<4> New a? 1+2i New a: 1+2i<4> \endcode \code Old a: 0+0i<4> New a? (1,2) New a: 1+2i<4> \endcode \note The output_mode is OUTPUT_FIX_SHIFT in these examples; see section \ref fix_base_outputmode. In the above examples, only the data representation was changed, while the shift (4) was kept. It is however possible to enter another (positive or negative) shift factor as well: \code Old a: 0+0i<4> New a? 1+2i<5> New a: 1+2i<5> \endcode It is also possible to enter a floating-point value and a (positive or negative) shift, rather than the data representation and a shift, if a slightly different format is used: \code Old a: 0+0i<4> New a? 1+2i<<5 New a: 32+64i<5> \endcode The resulting data representation is the entered floating-point value 1+2i multiplied by 2^5. \note In order to enter a negative shift, write 1+2i<<-5. It is not possible to write 1+2i>>5. Vectors and matrices support the same formats for fixed-point numbers. However, all old elements are assumed to have the same shift factor, and the shift factor of the first old element becomes the default shift factor for all elements of the vector or matrix. The same holds in e.g. an Array of vectors, i.e. the shift factor of the first old element in each vector becomes the default shift factor for all elements of that vector. The default shift factor in an empty vector or matrix is zero. \section fix_fcn Functions \subsection fix_fcn_isfix Function is_fix The function itpp::is_fix returns true only if the argument is of type Fix or CFix or an Array/Vec/Mat of Fix or CFix. \code Array > > aavf(FIX20); bool will_be_true = is_fix(aavf); \endcode \warning Unfortunately, the function is_fix returns false if the argument is of type Fixed or CFixed. \subsection fix_fcn_setfix Function set_fix The function itpp::set_fix sets y = x * pow2(n) if the first argument is of type Fix or CFix or an Array/Vec/Mat of Fix or CFix. If the first argument is of type double or complex or an Array/Vec/Mat of double or complex, the function just sets y = x. \code Fix fix_var(FIX20); set_fix(fix_var, 3.14, 10); // fix_var will equal the integer portion of 3.14 * pow2(10) double double_var(FIX20); set_fix(double_var, 3.14, 10); // double_var will just equal 3.14 \endcode When the floating-point value is quantized, the quantization mode of the first argument (TRN in the example above, since fix_var has this quantization mode) will be used, unless some other quantization mode (e.g. RND) is specified as a fourth argument to set_fix: \code set_fix(fix_var, 3.14, 10, RND); \endcode \subsection fix_fcn_shiftfix Functions lshift_fix and rshift_fix The functions itpp::lshift_fix and itpp::rshift_fix perform left and right bit-shifts, respectively, if the first argument is of type Fix or CFix or an Array/Vec/Mat of Fix or CFix. If the first argument is of type double or complex or an Array/Vec/Mat of double or complex, the functions do not do anything at all. \code // This will right-shift fix_var 10 bits rshift_fix(fix_var, 10); // This will not affect double_var rshift_fix(double_var, 10); \endcode When a fixed-point value is right-shifted using rshift_fix, the quantization mode of the first argument (TRN in the example above, since fix_var has this quantization mode) will be used, unless some other quantization mode (e.g. RND) is specified as a third argument to rshift_fix: \code rshift_fix(fix_var, 10, RND); \endcode When a fixed-point value is left-shifted using lshift_fix, on the other hand, the overflow mode of the first argument is always used. \subsection fix_fcn_assert Function assert_fixshift The itpp::assert_fixshift function can be used to verify that the shift factor has the expected value: \code Fix a(3.14, 5); // We will pass this check since 5 = 5 assert_fixshift(a, 5); // The program will terminate (if ASSERT_LEVEL > 0) since 5 != 6 assert_fixshift(a, 6); \endcode If the first argument is of type double or complex instead, no test will be performed (since they have no shift factors). \subsection fix_fcn_unfix Function unfix The itpp::unfix function converts a fixed-point variable to a floating-point variable (or an Array/Vec/Mat of fixed-point variables to an Array/Vec/Mat of floating-point variables) by multiplying the fixed-point bit representation with pow2(-shift), using the unfix method mentioned above. \code Fix a(3.14, 5); double b = unfix(a); Array > c(FIX40); cin >> c; Array d = unfix(c); \endcode If the argument is a floating-point variable (or an Array/Vec/Mat of floating-point variables) instead, the function just returns the argument. \subsection fix_fcn_to Function to The itpp::to function is a very general conversion function. It converts a floating- or fixed-point variable to a floating- or fixed-point variable (or a floating- or fixed-point Array/Vec/Mat to a floating- or fixed-point Array/Vec/Mat) depending on the types of the argument and of the specified template parameter. \code // Convert a Vec to a Vec and assign it to f Vec e = "1.0 2.0 3.0"; Vec f; f = to(e); // convert e "to Fix" // Convert an Array > > called g to // an Array > > and assign it to h Array > > h; h = to(g); // convert g "to CFix" \endcode \note The variants to(x) and to >(x) provide the same functionality as unfix(x). \warning Be aware that the variants to(x) and to(x) will return a fixed-point variable with the shift factor(s) set to zero if x is a floating-point variable. However, if x is a fixed-point variable, the shift will be copied to the return variable. \subsection fix_fcn_other Other functions
      • itpp::abs
      • itpp::real
      • itpp::imag
      • itpp::conj
      */ //!@{ //! Representation for fixed-point data types typedef int64_t fixrep; //! Max word length const int MAX_WORDLEN = 64; //! Table for fast multiplication or division by 2^n const uint64_t UINT64_POW2[64] = { uint64_t(1), uint64_t(1) << 1, uint64_t(1) << 2, uint64_t(1) << 3, uint64_t(1) << 4, uint64_t(1) << 5, uint64_t(1) << 6, uint64_t(1) << 7, uint64_t(1) << 8, uint64_t(1) << 9, uint64_t(1) << 10, uint64_t(1) << 11, uint64_t(1) << 12, uint64_t(1) << 13, uint64_t(1) << 14, uint64_t(1) << 15, uint64_t(1) << 16, uint64_t(1) << 17, uint64_t(1) << 18, uint64_t(1) << 19, uint64_t(1) << 20, uint64_t(1) << 21, uint64_t(1) << 22, uint64_t(1) << 23, uint64_t(1) << 24, uint64_t(1) << 25, uint64_t(1) << 26, uint64_t(1) << 27, uint64_t(1) << 28, uint64_t(1) << 29, uint64_t(1) << 30, uint64_t(1) << 31, uint64_t(1) << 32, uint64_t(1) << 33, uint64_t(1) << 34, uint64_t(1) << 35, uint64_t(1) << 36, uint64_t(1) << 37, uint64_t(1) << 38, uint64_t(1) << 39, uint64_t(1) << 40, uint64_t(1) << 41, uint64_t(1) << 42, uint64_t(1) << 43, uint64_t(1) << 44, uint64_t(1) << 45, uint64_t(1) << 46, uint64_t(1) << 47, uint64_t(1) << 48, uint64_t(1) << 49, uint64_t(1) << 50, uint64_t(1) << 51, uint64_t(1) << 52, uint64_t(1) << 53, uint64_t(1) << 54, uint64_t(1) << 55, uint64_t(1) << 56, uint64_t(1) << 57, uint64_t(1) << 58, uint64_t(1) << 59, uint64_t(1) << 60, uint64_t(1) << 61, uint64_t(1) << 62, uint64_t(1) << 63 }; //! Table for fast multiplication by 2^(n-64) const double DOUBLE_POW2[128] = { 0.5 / UINT64_POW2[63], 1.0 / UINT64_POW2[63], 1.0 / UINT64_POW2[62], 1.0 / UINT64_POW2[61], 1.0 / UINT64_POW2[60], 1.0 / UINT64_POW2[59], 1.0 / UINT64_POW2[58], 1.0 / UINT64_POW2[57], 1.0 / UINT64_POW2[56], 1.0 / UINT64_POW2[55], 1.0 / UINT64_POW2[54], 1.0 / UINT64_POW2[53], 1.0 / UINT64_POW2[52], 1.0 / UINT64_POW2[51], 1.0 / UINT64_POW2[50], 1.0 / UINT64_POW2[49], 1.0 / UINT64_POW2[48], 1.0 / UINT64_POW2[47], 1.0 / UINT64_POW2[46], 1.0 / UINT64_POW2[45], 1.0 / UINT64_POW2[44], 1.0 / UINT64_POW2[43], 1.0 / UINT64_POW2[42], 1.0 / UINT64_POW2[41], 1.0 / UINT64_POW2[40], 1.0 / UINT64_POW2[39], 1.0 / UINT64_POW2[38], 1.0 / UINT64_POW2[37], 1.0 / UINT64_POW2[36], 1.0 / UINT64_POW2[35], 1.0 / UINT64_POW2[34], 1.0 / UINT64_POW2[33], 1.0 / UINT64_POW2[32], 1.0 / UINT64_POW2[31], 1.0 / UINT64_POW2[30], 1.0 / UINT64_POW2[29], 1.0 / UINT64_POW2[28], 1.0 / UINT64_POW2[27], 1.0 / UINT64_POW2[26], 1.0 / UINT64_POW2[25], 1.0 / UINT64_POW2[24], 1.0 / UINT64_POW2[23], 1.0 / UINT64_POW2[22], 1.0 / UINT64_POW2[21], 1.0 / UINT64_POW2[20], 1.0 / UINT64_POW2[19], 1.0 / UINT64_POW2[18], 1.0 / UINT64_POW2[17], 1.0 / UINT64_POW2[16], 1.0 / UINT64_POW2[15], 1.0 / UINT64_POW2[14], 1.0 / UINT64_POW2[13], 1.0 / UINT64_POW2[12], 1.0 / UINT64_POW2[11], 1.0 / UINT64_POW2[10], 1.0 / UINT64_POW2[9], 1.0 / UINT64_POW2[8], 1.0 / UINT64_POW2[7], 1.0 / UINT64_POW2[6], 1.0 / UINT64_POW2[5], 1.0 / UINT64_POW2[4], 1.0 / UINT64_POW2[3], 1.0 / UINT64_POW2[2], 1.0 / UINT64_POW2[1], 1.0, 1.0*UINT64_POW2[1], 1.0*UINT64_POW2[2], 1.0*UINT64_POW2[3], 1.0*UINT64_POW2[4], 1.0*UINT64_POW2[5], 1.0*UINT64_POW2[6], 1.0*UINT64_POW2[7], 1.0*UINT64_POW2[8], 1.0*UINT64_POW2[9], 1.0*UINT64_POW2[10], 1.0*UINT64_POW2[11], 1.0*UINT64_POW2[12], 1.0*UINT64_POW2[13], 1.0*UINT64_POW2[14], 1.0*UINT64_POW2[15], 1.0*UINT64_POW2[16], 1.0*UINT64_POW2[17], 1.0*UINT64_POW2[18], 1.0*UINT64_POW2[19], 1.0*UINT64_POW2[20], 1.0*UINT64_POW2[21], 1.0*UINT64_POW2[22], 1.0*UINT64_POW2[23], 1.0*UINT64_POW2[24], 1.0*UINT64_POW2[25], 1.0*UINT64_POW2[26], 1.0*UINT64_POW2[27], 1.0*UINT64_POW2[28], 1.0*UINT64_POW2[29], 1.0*UINT64_POW2[30], 1.0*UINT64_POW2[31], 1.0*UINT64_POW2[32], 1.0*UINT64_POW2[33], 1.0*UINT64_POW2[34], 1.0*UINT64_POW2[35], 1.0*UINT64_POW2[36], 1.0*UINT64_POW2[37], 1.0*UINT64_POW2[38], 1.0*UINT64_POW2[39], 1.0*UINT64_POW2[40], 1.0*UINT64_POW2[41], 1.0*UINT64_POW2[42], 1.0*UINT64_POW2[43], 1.0*UINT64_POW2[44], 1.0*UINT64_POW2[45], 1.0*UINT64_POW2[46], 1.0*UINT64_POW2[47], 1.0*UINT64_POW2[48], 1.0*UINT64_POW2[49], 1.0*UINT64_POW2[50], 1.0*UINT64_POW2[51], 1.0*UINT64_POW2[52], 1.0*UINT64_POW2[53], 1.0*UINT64_POW2[54], 1.0*UINT64_POW2[55], 1.0*UINT64_POW2[56], 1.0*UINT64_POW2[57], 1.0*UINT64_POW2[58], 1.0*UINT64_POW2[59], 1.0*UINT64_POW2[60], 1.0*UINT64_POW2[61], 1.0*UINT64_POW2[62], 1.0*UINT64_POW2[63] }; //! Sign encoding modes (aligned with SystemC) enum e_mode { TC, //!< Two's complement US //!< Unsigned }; //! Overflow modes (aligned with SystemC) enum o_mode { SAT, //!< Saturation SAT_ZERO, //!< Saturation to zero (Not implemented) SAT_SYM, //!< Symmetrical saturation (Not implemented) WRAP, //!< Wrap-around WRAP_SM //!< Sign magnitued wrap-around (Not implemented) }; //! Quantization modes (aligned with SystemC) enum q_mode { RND, //!< Rounding to plus infinity RND_ZERO, //!< Rounding to zero RND_MIN_INF, //!< Rounding to minus infinity RND_INF, //!< Rounding to infinity RND_CONV, //!< Convergent rounding with half-way value rounded to even value RND_CONV_ODD, //!< Convergent rounding with half-way value rounded to odd value (not defined in SystemC) TRN, //!< Truncation TRN_ZERO //!< Truncation to zero }; //! Output modes enum output_mode { OUTPUT_FIX, //!< Output fixed-point representation only OUTPUT_FIX_SHIFT, //!< Output fixed-point representation followed by \ (default) OUTPUT_FLOAT, //!< Output floating-point value OUTPUT_FLOAT_SHIFT //!< Output floating-point value followed by \<\limit() fixrep scale_and_apply_modes(double x) const {return scale_and_apply_modes(x, qmode);} //! Convert from \c double to \c fixrep using \c shift and quantization mode \c q, then call limit() fixrep scale_and_apply_modes(double x, q_mode q) const; //! Right shift \c n bits using quantization mode \c qmode and make call to statistics object (if any) fixrep rshift_and_apply_q_mode(fixrep x, int n) const {return rshift_and_apply_q_mode(x, n, qmode);} //! Right shift \c n bits using quantization mode \c q and make call to statistics object (if any) fixrep rshift_and_apply_q_mode(fixrep x, int n, q_mode q) const; private: //! Output mode static output_mode outputmode; }; //! Set output mode inline std::ostream &operator<<(std::ostream &os, const output_mode &o) { Fix_Base::set_output_mode(o); return os; } //!@} } // namespace itpp #endif // #ifndef FIX_BASE_H itpp-4.3.1/itpp/fixed/fix_factory.cpp000066400000000000000000000057301216575753400176130ustar00rootroot00000000000000/*! * \file * \brief Implementation of a class factory for fixed-point data types Fix * and CFix * \author Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { void Fix_Factory::create(Fix* &ptr, const int n) const { void *p = ::operator new(sizeof(Fix) * n); ptr = reinterpret_cast(p); // Set fixed-point restrictions for (int i = 0; i < n; ++i) { new(ptr + i) Fix(0.0, 0, wordlen, emode, omode, qmode, stat_ptr); } } void Fix_Factory::create(CFix* &ptr, const int n) const { void *p = ::operator new(sizeof(CFix) * n); ptr = reinterpret_cast(p); // Set fixed-point restrictions for (int i = 0; i < n; ++i) { new(ptr + i) CFix(0.0, 0, wordlen, emode, omode, qmode, stat_ptr); } } template<> void create_elements(Fix* &ptr, const int n, const Factory &f) { if (const Fix_Factory *fix_factory_ptr = dynamic_cast(&f)) { // Yes, f seems to be a Fix_Factory. Now call the Fix_Factory::create method fix_factory_ptr->create(ptr, n); } else { // No, f does not seem to be a Fix_Factory. As a fallback solution, // assume that f is DEFAULT_FACTORY and use the default constructor void *p = ::operator new(sizeof(Fix) * n); ptr = reinterpret_cast(p); for (int i = 0; i < n; i++) { new(ptr + i) Fix(); } } } template<> void create_elements(CFix* &ptr, const int n, const Factory &f) { if (const Fix_Factory *fix_factory_ptr = dynamic_cast(&f)) { // Yes, f seems to be a Fix_Factory. Now call the Fix_Factory::create method fix_factory_ptr->create(ptr, n); } else { // No, f does not seem to be a Fix_Factory. As a fallback solution, // assume that f is DEFAULT_FACTORY and use the default constructor void *p = ::operator new(sizeof(CFix) * n); ptr = reinterpret_cast(p); for (int i = 0; i < n; i++) { new(ptr + i) CFix(); } } } } // namespace itpp itpp-4.3.1/itpp/fixed/fix_factory.h000066400000000000000000000366121216575753400172630ustar00rootroot00000000000000/*! * \file * \brief Definitions of a class factory for fixed-point data types Fix * and CFix * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FIX_FACTORY_H #define FIX_FACTORY_H #include #include #include namespace itpp { // Forward declarations class Fix; class CFix; //! \addtogroup fixed //!@{ /*! \brief Class factory for fixed-point data types Fix and CFix For an introduction to factories, see the Detailed Description for Factory. For more information on the fixed-point data types, see the Detailed Description in the \ref fixed module. This example shows how to declare a Fix_Factory: \code // Declare UFIX32, a factory for 32-bit unsigned Fix/CFix with wrap-around // i.e. a factory for Fix(0.0, 0, 32, US, WRAP) and CFix(0.0, 0, 32, US, WRAP) Fix_Factory UFIX32(32, US, WRAP); \endcode However, the user does not need to declare \c UFIX32 since it is one of the already declared factories in fix_factory.h (which is included by itbase.h): \code Fix_Factory FIX1(1, TC, WRAP); // for Fix/CFix with 1 bit ... Fix_Factory FIX64(64, TC, WRAP); // for Fix/CFix with 64 bits Fix_Factory UFIX1(1, US, WRAP); // for Unsigned Fix/CFix with 1 bit ... Fix_Factory UFIX64(64, US, WRAP); // for Unsigned Fix/CFix with 64 bits Fix_Factory SFIX1(1, TC, SAT); // for Saturated Fix/CFix with 1 bit ... Fix_Factory SFIX64(64, TC, SAT); // for Saturated Fix/CFix with 64 bits Fix_Factory SUFIX1(1, US, SAT); // for Saturated Unsigned Fix/CFix with 1 bit ... Fix_Factory SUFIX64(64, US, SAT); // for Saturated Unsigned Fix/CFix with 64 bits \endcode This means that it is only necessary for the user to declare a Fix_Factory if it is desired to have some other overflow mode than \c WRAP or \c SAT, or some other quantization mode than \c TRN, or a non-zero statistics object pointer. \note U stands for Unsigned but S stands for Saturated, NOT for Signed. The Array/Vec/Mat constructors can take a Fix_Factory as an argument: \code // Declare a Vec with size 10 that will use // Fix(0.0, 0, 32, US, WRAP) for element creation Vec vf(10, UFIX32); // Declare an Array > > with size 10 that will use // CFix(0.0, 0, 32, US, WRAP) for element creation Array > > aamcf(10, UFIX32); \endcode Even a Fix/CFix declaration can take a Fix_Factory as a constructor argument: \code // Equivalent to // Fix f(0.0, 0, 32, US, WRAP); Fix f(UFIX32); \endcode This syntax is also legal if Fix is replaced with \c double and CFix is replaced with complex, i.e. \code // The factory will be ignored Vec vd(10, UFIX32); // The factory will be ignored Array > > > aamcd(10, UFIX32); // The factory will be converted to double(0.0) i.e. innocent initialization double d(UFIX32); \endcode which can be useful in templated code, e.g. when the same code should support both floating- and fixed-point data types. */ class ITPP_EXPORT Fix_Factory : public Factory { friend class Fix; friend class CFix; public: //! Constructor explicit Fix_Factory(int w = MAX_WORDLEN, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN, Stat *ptr = 0) : wordlen(w), emode(e), omode(o), qmode(q), stat_ptr(ptr) {} //! Destructor virtual ~Fix_Factory() {} //! Conversion operator. Useful in templated code operator double() const {return 0.0;} //! Create an n-length array of Fix virtual void create(Fix* &ptr, const int n) const; //! Create an n-length array of CFix virtual void create(CFix* &ptr, const int n) const; protected: //! Word length int wordlen; //! Sign encoding mode e_mode emode; //! Overflow mode o_mode omode; //! Quantization mode q_mode qmode; //! Pointer to statistics object Stat *stat_ptr; }; //! Create an n-length array of Fix using Fix_Factory \c f template<> ITPP_EXPORT void create_elements(Fix* &ptr, const int n, const Factory &f); //! Create an n-length array of CFix using Fix_Factory \c f template<> ITPP_EXPORT void create_elements(CFix* &ptr, const int n, const Factory &f); //!@} //! Fix_Factories for signed Fix/CFix with wrap-around (FIX1, FIX2, ..., FIX64) const Fix_Factory FIX1(1, TC, WRAP); //! \cond const Fix_Factory FIX2(2, TC, WRAP); const Fix_Factory FIX3(3, TC, WRAP); const Fix_Factory FIX4(4, TC, WRAP); const Fix_Factory FIX5(5, TC, WRAP); const Fix_Factory FIX6(6, TC, WRAP); const Fix_Factory FIX7(7, TC, WRAP); const Fix_Factory FIX8(8, TC, WRAP); const Fix_Factory FIX9(9, TC, WRAP); const Fix_Factory FIX10(10, TC, WRAP); const Fix_Factory FIX11(11, TC, WRAP); const Fix_Factory FIX12(12, TC, WRAP); const Fix_Factory FIX13(13, TC, WRAP); const Fix_Factory FIX14(14, TC, WRAP); const Fix_Factory FIX15(15, TC, WRAP); const Fix_Factory FIX16(16, TC, WRAP); const Fix_Factory FIX17(17, TC, WRAP); const Fix_Factory FIX18(18, TC, WRAP); const Fix_Factory FIX19(19, TC, WRAP); const Fix_Factory FIX20(20, TC, WRAP); const Fix_Factory FIX21(21, TC, WRAP); const Fix_Factory FIX22(22, TC, WRAP); const Fix_Factory FIX23(23, TC, WRAP); const Fix_Factory FIX24(24, TC, WRAP); const Fix_Factory FIX25(25, TC, WRAP); const Fix_Factory FIX26(26, TC, WRAP); const Fix_Factory FIX27(27, TC, WRAP); const Fix_Factory FIX28(28, TC, WRAP); const Fix_Factory FIX29(29, TC, WRAP); const Fix_Factory FIX30(30, TC, WRAP); const Fix_Factory FIX31(31, TC, WRAP); const Fix_Factory FIX32(32, TC, WRAP); const Fix_Factory FIX33(33, TC, WRAP); const Fix_Factory FIX34(34, TC, WRAP); const Fix_Factory FIX35(35, TC, WRAP); const Fix_Factory FIX36(36, TC, WRAP); const Fix_Factory FIX37(37, TC, WRAP); const Fix_Factory FIX38(38, TC, WRAP); const Fix_Factory FIX39(39, TC, WRAP); const Fix_Factory FIX40(40, TC, WRAP); const Fix_Factory FIX41(41, TC, WRAP); const Fix_Factory FIX42(42, TC, WRAP); const Fix_Factory FIX43(43, TC, WRAP); const Fix_Factory FIX44(44, TC, WRAP); const Fix_Factory FIX45(45, TC, WRAP); const Fix_Factory FIX46(46, TC, WRAP); const Fix_Factory FIX47(47, TC, WRAP); const Fix_Factory FIX48(48, TC, WRAP); const Fix_Factory FIX49(49, TC, WRAP); const Fix_Factory FIX50(50, TC, WRAP); const Fix_Factory FIX51(51, TC, WRAP); const Fix_Factory FIX52(52, TC, WRAP); const Fix_Factory FIX53(53, TC, WRAP); const Fix_Factory FIX54(54, TC, WRAP); const Fix_Factory FIX55(55, TC, WRAP); const Fix_Factory FIX56(56, TC, WRAP); const Fix_Factory FIX57(57, TC, WRAP); const Fix_Factory FIX58(58, TC, WRAP); const Fix_Factory FIX59(59, TC, WRAP); const Fix_Factory FIX60(60, TC, WRAP); const Fix_Factory FIX61(61, TC, WRAP); const Fix_Factory FIX62(62, TC, WRAP); const Fix_Factory FIX63(63, TC, WRAP); const Fix_Factory FIX64(64, TC, WRAP); //! \endcond //! Fix_Factories for unsigned Fix/CFix with wrap-around (UFIX1, UFIX2, ..., UFIX64) const Fix_Factory UFIX1(1, US, WRAP); //! \cond const Fix_Factory UFIX2(2, US, WRAP); const Fix_Factory UFIX3(3, US, WRAP); const Fix_Factory UFIX4(4, US, WRAP); const Fix_Factory UFIX5(5, US, WRAP); const Fix_Factory UFIX6(6, US, WRAP); const Fix_Factory UFIX7(7, US, WRAP); const Fix_Factory UFIX8(8, US, WRAP); const Fix_Factory UFIX9(9, US, WRAP); const Fix_Factory UFIX10(10, US, WRAP); const Fix_Factory UFIX11(11, US, WRAP); const Fix_Factory UFIX12(12, US, WRAP); const Fix_Factory UFIX13(13, US, WRAP); const Fix_Factory UFIX14(14, US, WRAP); const Fix_Factory UFIX15(15, US, WRAP); const Fix_Factory UFIX16(16, US, WRAP); const Fix_Factory UFIX17(17, US, WRAP); const Fix_Factory UFIX18(18, US, WRAP); const Fix_Factory UFIX19(19, US, WRAP); const Fix_Factory UFIX20(20, US, WRAP); const Fix_Factory UFIX21(21, US, WRAP); const Fix_Factory UFIX22(22, US, WRAP); const Fix_Factory UFIX23(23, US, WRAP); const Fix_Factory UFIX24(24, US, WRAP); const Fix_Factory UFIX25(25, US, WRAP); const Fix_Factory UFIX26(26, US, WRAP); const Fix_Factory UFIX27(27, US, WRAP); const Fix_Factory UFIX28(28, US, WRAP); const Fix_Factory UFIX29(29, US, WRAP); const Fix_Factory UFIX30(30, US, WRAP); const Fix_Factory UFIX31(31, US, WRAP); const Fix_Factory UFIX32(32, US, WRAP); const Fix_Factory UFIX33(33, US, WRAP); const Fix_Factory UFIX34(34, US, WRAP); const Fix_Factory UFIX35(35, US, WRAP); const Fix_Factory UFIX36(36, US, WRAP); const Fix_Factory UFIX37(37, US, WRAP); const Fix_Factory UFIX38(38, US, WRAP); const Fix_Factory UFIX39(39, US, WRAP); const Fix_Factory UFIX40(40, US, WRAP); const Fix_Factory UFIX41(41, US, WRAP); const Fix_Factory UFIX42(42, US, WRAP); const Fix_Factory UFIX43(43, US, WRAP); const Fix_Factory UFIX44(44, US, WRAP); const Fix_Factory UFIX45(45, US, WRAP); const Fix_Factory UFIX46(46, US, WRAP); const Fix_Factory UFIX47(47, US, WRAP); const Fix_Factory UFIX48(48, US, WRAP); const Fix_Factory UFIX49(49, US, WRAP); const Fix_Factory UFIX50(50, US, WRAP); const Fix_Factory UFIX51(51, US, WRAP); const Fix_Factory UFIX52(52, US, WRAP); const Fix_Factory UFIX53(53, US, WRAP); const Fix_Factory UFIX54(54, US, WRAP); const Fix_Factory UFIX55(55, US, WRAP); const Fix_Factory UFIX56(56, US, WRAP); const Fix_Factory UFIX57(57, US, WRAP); const Fix_Factory UFIX58(58, US, WRAP); const Fix_Factory UFIX59(59, US, WRAP); const Fix_Factory UFIX60(60, US, WRAP); const Fix_Factory UFIX61(61, US, WRAP); const Fix_Factory UFIX62(62, US, WRAP); const Fix_Factory UFIX63(63, US, WRAP); const Fix_Factory UFIX64(64, US, WRAP); //! \endcond //! Fix_Factories for unsigned Fix/CFix with wrap-around (SFIX1, SFIX2, ..., SFIX64) const Fix_Factory SFIX1(1, TC, SAT); //! \cond const Fix_Factory SFIX2(2, TC, SAT); const Fix_Factory SFIX3(3, TC, SAT); const Fix_Factory SFIX4(4, TC, SAT); const Fix_Factory SFIX5(5, TC, SAT); const Fix_Factory SFIX6(6, TC, SAT); const Fix_Factory SFIX7(7, TC, SAT); const Fix_Factory SFIX8(8, TC, SAT); const Fix_Factory SFIX9(9, TC, SAT); const Fix_Factory SFIX10(10, TC, SAT); const Fix_Factory SFIX11(11, TC, SAT); const Fix_Factory SFIX12(12, TC, SAT); const Fix_Factory SFIX13(13, TC, SAT); const Fix_Factory SFIX14(14, TC, SAT); const Fix_Factory SFIX15(15, TC, SAT); const Fix_Factory SFIX16(16, TC, SAT); const Fix_Factory SFIX17(17, TC, SAT); const Fix_Factory SFIX18(18, TC, SAT); const Fix_Factory SFIX19(19, TC, SAT); const Fix_Factory SFIX20(20, TC, SAT); const Fix_Factory SFIX21(21, TC, SAT); const Fix_Factory SFIX22(22, TC, SAT); const Fix_Factory SFIX23(23, TC, SAT); const Fix_Factory SFIX24(24, TC, SAT); const Fix_Factory SFIX25(25, TC, SAT); const Fix_Factory SFIX26(26, TC, SAT); const Fix_Factory SFIX27(27, TC, SAT); const Fix_Factory SFIX28(28, TC, SAT); const Fix_Factory SFIX29(29, TC, SAT); const Fix_Factory SFIX30(30, TC, SAT); const Fix_Factory SFIX31(31, TC, SAT); const Fix_Factory SFIX32(32, TC, SAT); const Fix_Factory SFIX33(33, TC, SAT); const Fix_Factory SFIX34(34, TC, SAT); const Fix_Factory SFIX35(35, TC, SAT); const Fix_Factory SFIX36(36, TC, SAT); const Fix_Factory SFIX37(37, TC, SAT); const Fix_Factory SFIX38(38, TC, SAT); const Fix_Factory SFIX39(39, TC, SAT); const Fix_Factory SFIX40(40, TC, SAT); const Fix_Factory SFIX41(41, TC, SAT); const Fix_Factory SFIX42(42, TC, SAT); const Fix_Factory SFIX43(43, TC, SAT); const Fix_Factory SFIX44(44, TC, SAT); const Fix_Factory SFIX45(45, TC, SAT); const Fix_Factory SFIX46(46, TC, SAT); const Fix_Factory SFIX47(47, TC, SAT); const Fix_Factory SFIX48(48, TC, SAT); const Fix_Factory SFIX49(49, TC, SAT); const Fix_Factory SFIX50(50, TC, SAT); const Fix_Factory SFIX51(51, TC, SAT); const Fix_Factory SFIX52(52, TC, SAT); const Fix_Factory SFIX53(53, TC, SAT); const Fix_Factory SFIX54(54, TC, SAT); const Fix_Factory SFIX55(55, TC, SAT); const Fix_Factory SFIX56(56, TC, SAT); const Fix_Factory SFIX57(57, TC, SAT); const Fix_Factory SFIX58(58, TC, SAT); const Fix_Factory SFIX59(59, TC, SAT); const Fix_Factory SFIX60(60, TC, SAT); const Fix_Factory SFIX61(61, TC, SAT); const Fix_Factory SFIX62(62, TC, SAT); const Fix_Factory SFIX63(63, TC, SAT); const Fix_Factory SFIX64(64, TC, SAT); //! \endcond //! Fix_Factories for unsigned Fix/CFix with saturation (SUFIX1, SUFIX2, ..., SUFIX64) const Fix_Factory SUFIX1(1, US, SAT); //! \cond const Fix_Factory SUFIX2(2, US, SAT); const Fix_Factory SUFIX3(3, US, SAT); const Fix_Factory SUFIX4(4, US, SAT); const Fix_Factory SUFIX5(5, US, SAT); const Fix_Factory SUFIX6(6, US, SAT); const Fix_Factory SUFIX7(7, US, SAT); const Fix_Factory SUFIX8(8, US, SAT); const Fix_Factory SUFIX9(9, US, SAT); const Fix_Factory SUFIX10(10, US, SAT); const Fix_Factory SUFIX11(11, US, SAT); const Fix_Factory SUFIX12(12, US, SAT); const Fix_Factory SUFIX13(13, US, SAT); const Fix_Factory SUFIX14(14, US, SAT); const Fix_Factory SUFIX15(15, US, SAT); const Fix_Factory SUFIX16(16, US, SAT); const Fix_Factory SUFIX17(17, US, SAT); const Fix_Factory SUFIX18(18, US, SAT); const Fix_Factory SUFIX19(19, US, SAT); const Fix_Factory SUFIX20(20, US, SAT); const Fix_Factory SUFIX21(21, US, SAT); const Fix_Factory SUFIX22(22, US, SAT); const Fix_Factory SUFIX23(23, US, SAT); const Fix_Factory SUFIX24(24, US, SAT); const Fix_Factory SUFIX25(25, US, SAT); const Fix_Factory SUFIX26(26, US, SAT); const Fix_Factory SUFIX27(27, US, SAT); const Fix_Factory SUFIX28(28, US, SAT); const Fix_Factory SUFIX29(29, US, SAT); const Fix_Factory SUFIX30(30, US, SAT); const Fix_Factory SUFIX31(31, US, SAT); const Fix_Factory SUFIX32(32, US, SAT); const Fix_Factory SUFIX33(33, US, SAT); const Fix_Factory SUFIX34(34, US, SAT); const Fix_Factory SUFIX35(35, US, SAT); const Fix_Factory SUFIX36(36, US, SAT); const Fix_Factory SUFIX37(37, US, SAT); const Fix_Factory SUFIX38(38, US, SAT); const Fix_Factory SUFIX39(39, US, SAT); const Fix_Factory SUFIX40(40, US, SAT); const Fix_Factory SUFIX41(41, US, SAT); const Fix_Factory SUFIX42(42, US, SAT); const Fix_Factory SUFIX43(43, US, SAT); const Fix_Factory SUFIX44(44, US, SAT); const Fix_Factory SUFIX45(45, US, SAT); const Fix_Factory SUFIX46(46, US, SAT); const Fix_Factory SUFIX47(47, US, SAT); const Fix_Factory SUFIX48(48, US, SAT); const Fix_Factory SUFIX49(49, US, SAT); const Fix_Factory SUFIX50(50, US, SAT); const Fix_Factory SUFIX51(51, US, SAT); const Fix_Factory SUFIX52(52, US, SAT); const Fix_Factory SUFIX53(53, US, SAT); const Fix_Factory SUFIX54(54, US, SAT); const Fix_Factory SUFIX55(55, US, SAT); const Fix_Factory SUFIX56(56, US, SAT); const Fix_Factory SUFIX57(57, US, SAT); const Fix_Factory SUFIX58(58, US, SAT); const Fix_Factory SUFIX59(59, US, SAT); const Fix_Factory SUFIX60(60, US, SAT); const Fix_Factory SUFIX61(61, US, SAT); const Fix_Factory SUFIX62(62, US, SAT); const Fix_Factory SUFIX63(63, US, SAT); const Fix_Factory SUFIX64(64, US, SAT); //! \endcond } // namespace itpp #endif // #ifndef FIX_FACTORY_H itpp-4.3.1/itpp/fixed/fix_functions.cpp000066400000000000000000000045771216575753400201640ustar00rootroot00000000000000/*! * \file * \brief Implementation of a set of functions for Fix, Fixed, CFix and * CFixed classes * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { vec to_vec(const fixvec &v) { vec temp(v.length()); for (int i = 0; i < v.length(); i++) { temp(i) = v(i).unfix(); } return temp; } cvec to_cvec(const cfixvec &v) { cvec temp(v.length()); for (int i = 0; i < v.length(); i++) { temp(i) = v(i).unfix(); } return temp; } mat to_mat(const fixmat &m) { mat temp(m.rows(), m.cols()); for (int i = 0; i < m.rows(); i++) { for (int j = 0; j < m.cols(); j++) { temp(i, j) = m(i, j).unfix(); } } return temp; } cmat to_cmat(const cfixmat &m) { cmat temp(m.rows(), m.cols()); for (int i = 0; i < m.rows(); i++) { for (int j = 0; j < m.cols(); j++) { temp(i, j) = m(i, j).unfix(); } } return temp; } Fix abs(const Fix &x) { fixrep tmp = x.get_re(); return Fix((tmp >= 0 ? tmp : -tmp), // Risk for overflow! x.get_shift(), 0, 0); } Fix real(const CFix &x) { return Fix(x.get_re(), x.get_shift(), 0, 0); } Fix imag(const CFix &x) { return Fix(x.get_im(), x.get_shift(), 0, 0); } CFix conj(const CFix &x) { return CFix(x.get_re(), -x.get_im(), x.get_shift(), 0, 0); } } // namespace itpp itpp-4.3.1/itpp/fixed/fix_functions.h000066400000000000000000000553671216575753400176340ustar00rootroot00000000000000/*! * \file * \brief Definitions of a set of functions for Fix, Fixed, CFix and * CFixed classes * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FIX_FUNCTIONS_H #define FIX_FUNCTIONS_H #include #include #include #include #include #include namespace itpp { //! \addtogroup fixed //!@{ //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template inline bool is_fix(const T &) {return false;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template<> inline bool is_fix(const Fix &) {return true;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template<> inline bool is_fix(const fixvec &) {return true;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template<> inline bool is_fix(const fixmat &) {return true;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template<> inline bool is_fix(const CFix &) {return true;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template<> inline bool is_fix(const cfixvec &) {return true;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template<> inline bool is_fix(const cfixmat &) {return true;} //! Return true only if argument is of type Fix or CFix (or an Array/Vec/Mat of Fix or CFix) template inline bool is_fix(const Array &) {return is_fix(T());} //! Set y = x * pow2(n) using the quantization mode of \c y inline void set_fix(Fix &y, double x, int n) {y.set(x, n);} //! Set y = x * pow2(n) using the specified quantization mode \c q inline void set_fix(Fix &y, double x, int n, q_mode q) {y.set(x, n, q);} //! Set y = x * pow2(n) using the quantization mode of \c y inline void set_fix(fixvec &y, const vec &x, int n) { y.set_size(x.length()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n); } //! Set y = x * pow2(n) using the specified quantization mode \c q inline void set_fix(fixvec &y, const vec &x, int n, q_mode q) { y.set_size(x.length()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n, q); } //! Set y = x * pow2(n) using the quantization mode of \c y inline void set_fix(fixmat &y, const mat &x, int n) { y.set_size(x.rows(), x.cols()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n); } //! Set y = x * pow2(n) using the specified quantization mode \c q inline void set_fix(fixmat &y, const mat &x, int n, q_mode q) { y.set_size(x.rows(), x.cols()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n, q); } //! Set y = x. Useful in templated code inline void set_fix(double &y, double x, int) {y = x;} //! Set y = x. Useful in templated code inline void set_fix(double &y, double x, int, q_mode) {y = x;} //! Set y = x. Useful in templated code inline void set_fix(vec &y, const vec &x, int) {y = x;} //! Set y = x. Useful in templated code inline void set_fix(vec &y, const vec &x, int, q_mode) {y = x;} //! Set y = x. Useful in templated code inline void set_fix(mat &y, const mat &x, int) {y = x;} //! Set y = x. Useful in templated code inline void set_fix(mat &y, const mat &x, int, q_mode) {y = x;} //! Set y = x * pow2(n) using the quantization mode of \c y inline void set_fix(CFix &y, std::complex x, int n) {y.set(x, n);} //! Set y = (real + i*imag) * pow2(n) using the quantization mode of \c y inline void set_fix(CFix &y, double real, double imag, int n) {y.set(real, imag, n);} //! Set y = x * pow2(n) using the specified quantization mode \c q inline void set_fix(CFix &y, std::complex x, int n, q_mode q) {y.set(x, n, q);} //! Set y = (real + i*imag) * pow2(n) using the specified quantization mode \c q inline void set_fix(CFix &y, double real, double imag, int n, q_mode q) {y.set(real, imag, n, q);} //! Set y = x * pow2(n) using the quantization mode of \c y inline void set_fix(cfixvec &y, const cvec &x, int n) { y.set_size(x.length()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n); } //! Set y = (real + i*imag) * pow2(n) using the quantization mode of \c y inline void set_fix(cfixvec &y, const vec &real, const vec &imag, int n) { it_assert_debug(real.length() == imag.length(), "set_fix: real and imag should have the same size"); y.set_size(real.length()); for (int i = 0; i < y.size(); i++) y(i).set(real(i), imag(i), n); } //! Set y = x * pow2(n) using the specified quantization mode \c q inline void set_fix(cfixvec &y, const cvec &x, int n, q_mode q) { y.set_size(x.length()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n, q); } //! Set y = (real + i*imag) * pow2(n) using the specified quantization mode \c q inline void set_fix(cfixvec &y, const vec &real, const vec &imag, int n, q_mode q) { it_assert_debug(real.length() == imag.length(), "set_fix: real and imag should have the same size"); y.set_size(real.length()); for (int i = 0; i < y.size(); i++) y(i).set(real(i), imag(i), n, q); } //! Set y = x * pow2(n) using the quantization mode of \c y inline void set_fix(cfixmat &y, const cmat &x, int n) { y.set_size(x.rows(), x.cols()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n); } //! Set y = (real + i*imag) * pow2(n) using the quantization mode of \c y inline void set_fix(cfixmat &y, const mat &real, const mat &imag, int n) { it_assert_debug(real.rows() == imag.rows() && real.cols() == imag.cols(), "set_fix: real and imag should have the same size"); y.set_size(real.rows(), real.cols()); for (int i = 0; i < y.size(); i++) y(i).set(real(i), imag(i), n); } //! Set y = x * pow2(n) using the specified quantization mode \c q inline void set_fix(cfixmat &y, const cmat &x, int n, q_mode q) { y.set_size(x.rows(), x.cols()); for (int i = 0; i < y.size(); i++) y(i).set(x(i), n, q); } //! Set y = (real + i*imag) * pow2(n) using the specified quantization mode \c q inline void set_fix(cfixmat &y, const mat &real, const mat &imag, int n, q_mode q) { it_assert_debug(real.rows() == imag.rows() && real.cols() == imag.cols(), "set_fix: real and imag should have the same size"); y.set_size(real.rows(), real.cols()); for (int i = 0; i < y.size(); i++) y(i).set(real(i), imag(i), n, q); } //! Set y = x. Useful in templated code inline void set_fix(std::complex &y, const std::complex &x, int) {y = x;} //! Set y = real + i*imag. Useful in templated code inline void set_fix(std::complex &y, double real, double imag, int) {y = std::complex(real, imag);} //! Set y = x. Useful in templated code inline void set_fix(std::complex &y, const std::complex &x, int, q_mode) {y = x;} //! Set y = real + i*imag. Useful in templated code inline void set_fix(std::complex &y, double real, double imag, int, q_mode) {y = std::complex(real, imag);} //! Set y = x. Useful in templated code inline void set_fix(cvec &y, const cvec &x, int) {y = x;} //! Set y = real + i*imag. Useful in templated code inline void set_fix(cvec &y, const vec &real, const vec &imag, int) {y = to_cvec(real, imag);} //! Set y = x. Useful in templated code inline void set_fix(cvec &y, const cvec &x, int, q_mode) {y = x;} //! Set y = real + i*imag. Useful in templated code inline void set_fix(cvec &y, const vec &real, const vec &imag, int, q_mode) {y = to_cvec(real, imag);} //! Set y = x. Useful in templated code inline void set_fix(cmat &y, const cmat &x, int) {y = x;} //! Set y = real + i*imag. Useful in templated code inline void set_fix(cmat &y, const mat &real, const mat &imag, int) {y = to_cmat(real, imag);} //! Set y = x. Useful in templated code inline void set_fix(cmat &y, const cmat &x, int, q_mode) {y = x;} //! Set y = real + i*imag. Useful in templated code inline void set_fix(cmat &y, const mat &real, const mat &imag, int, q_mode) {y = to_cmat(real, imag);} //! Call set_fix for each Array element template inline void set_fix(Array &y, const Array &x, int n) { y.set_size(x.size()); for (int i = 0; i < y.size(); i++) set_fix(y(i), x(i), n); } //! Call set_fix for each Array element template inline void set_fix(Array &y, const Array &real, const Array &imag, int n) { it_assert_debug(real.size() == imag.size(), "set_fix: real and imag should have the same size"); y.set_size(real.size()); for (int i = 0; i < y.size(); i++) set_fix(y(i), real(i), imag(i), n); } //! Call set_fix for each Array element template inline void set_fix(Array &y, const Array &x, int n, q_mode q) { y.set_size(x.size()); for (int i = 0; i < y.size(); i++) set_fix(y(i), x(i), n, q); } //! Call set_fix for each Array element template inline void set_fix(Array &y, const Array &real, const Array &imag, int n, q_mode q) { it_assert_debug(real.size() == imag.size(), "set_fix: real and imag should have the same size"); y.set_size(real.size()); for (int i = 0; i < y.size(); i++) set_fix(y(i), real(i), imag(i), n, q); } //! Left shift \c n bits inline void lshift_fix(Fix &y, int n) {y.lshift(n);} //! Right shift \c n bits using the quantization mode of \c y inline void rshift_fix(Fix &y, int n) {y.rshift(n);} //! Right shift \c n bits using the specified quantization mode \c q inline void rshift_fix(Fix &y, int n, q_mode q) {y.rshift(n, q);} //! Left shift \c n bits inline void lshift_fix(fixvec &y, int n) {for(int i = 0; i < y.size(); i++) y(i).lshift(n);} //! Right shift \c n bits using the quantization mode of \c y inline void rshift_fix(fixvec &y, int n) {for(int i = 0; i < y.size(); i++) y(i).rshift(n);} //! Right shift \c n bits using the specified quantization mode \c q inline void rshift_fix(fixvec &y, int n, q_mode q) {for(int i = 0; i < y.size(); i++) y(i).rshift(n, q);} //! Left shift \c n bits inline void lshift_fix(fixmat &y, int n) {for(int i = 0; i < y.size(); i++) y(i).lshift(n);} //! Right shift \c n bits using the quantization mode of \c y inline void rshift_fix(fixmat &y, int n) {for(int i = 0; i < y.size(); i++) y(i).rshift(n);} //! Right shift \c n bits using the specified quantization mode \c q inline void rshift_fix(fixmat &y, int n, q_mode q) {for(int i = 0; i < y.size(); i++) y(i).rshift(n, q);} //! Dummy function useful in templated code inline void lshift_fix(double &, int) {} //! Dummy function useful in templated code inline void rshift_fix(double &, int) {} //! Dummy function useful in templated code inline void rshift_fix(double &, int, q_mode) {} //! Dummy function useful in templated code inline void lshift_fix(vec &, int) {} //! Dummy function useful in templated code inline void rshift_fix(vec &, int) {} //! Dummy function useful in templated code inline void rshift_fix(vec &, int, q_mode) {} //! Dummy function useful in templated code inline void lshift_fix(mat &, int) {} //! Dummy function useful in templated code inline void rshift_fix(mat &, int) {} //! Dummy function useful in templated code inline void rshift_fix(mat &, int, q_mode) {} //! Left shift \c n bits inline void lshift_fix(CFix &y, int n) {y.lshift(n);} //! Right shift \c n bits using the quantization mode of \c y inline void rshift_fix(CFix &y, int n) {y.rshift(n);} //! Right shift \c n bits using the specified quantization mode \c q inline void rshift_fix(CFix &y, int n, q_mode q) {y.rshift(n, q);} //! Left shift \c n bits inline void lshift_fix(cfixvec &y, int n) {for(int i = 0; i < y.size(); i++) y(i).lshift(n);} //! Right shift \c n bits using the quantization mode of \c y inline void rshift_fix(cfixvec &y, int n) {for(int i = 0; i < y.size(); i++) y(i).rshift(n);} //! Right shift \c n bits using the specified quantization mode \c q inline void rshift_fix(cfixvec &y, int n, q_mode q) {for(int i = 0; i < y.size(); i++) y(i).rshift(n, q);} //! Left shift \c n bits inline void lshift_fix(cfixmat &y, int n) {for(int i = 0; i < y.size(); i++) y(i).lshift(n);} //! Right shift \c n bits using the quantization mode of \c y inline void rshift_fix(cfixmat &y, int n) {for(int i = 0; i < y.size(); i++) y(i).rshift(n);} //! Right shift \c n bits using the specified quantization mode \c q inline void rshift_fix(cfixmat &y, int n, q_mode q) {for(int i = 0; i < y.size(); i++) y(i).rshift(n, q);} //! Dummy function useful in templated code inline void lshift_fix(std::complex &, int) {} //! Dummy function useful in templated code inline void rshift_fix(std::complex &, int) {} //! Dummy function useful in templated code inline void rshift_fix(std::complex &, int, q_mode) {} //! Dummy function useful in templated code inline void lshift_fix(cvec &, int) {} //! Dummy function useful in templated code inline void rshift_fix(cvec &, int) {} //! Dummy function useful in templated code inline void rshift_fix(cvec &, int, q_mode) {} //! Dummy function useful in templated code inline void lshift_fix(cmat &, int) {} //! Dummy function useful in templated code inline void rshift_fix(cmat &, int) {} //! Dummy function useful in templated code inline void rshift_fix(cmat &, int, q_mode) {} //! Call lshift_fix for each Array element template inline void lshift_fix(Array &y, int n) {for(int i = 0; i < y.size(); i++) lshift_fix(y(i), n);} //! Call rshift_fix for each Array element template inline void rshift_fix(Array &y, int n) {for(int i = 0; i < y.size(); i++) rshift_fix(y(i), n);} //! Call rshift_fix for each Array element template inline void rshift_fix(Array &y, int n, q_mode q) {for(int i = 0; i < y.size(); i++) rshift_fix(y(i), n, q);} //! If x is a fixed-point variable, assert that x has the specified shift value, otherwise do nothing inline void assert_fixshift(double, int) {} //! If x is a fixed-point variable, assert that x has the specified shift value, otherwise do nothing inline void assert_fixshift(const std::complex &, int) {} //! If x is a fixed-point variable, assert that x has the specified shift value, otherwise do nothing inline void assert_fixshift(const Fix &x, int shift) {it_assert_debug(x.get_shift() == shift, "Shift should be " + to_str(shift) + " but it is " + to_str(x.get_shift()) + ".");} //! If x is a fixed-point variable, assert that x has the specified shift value, otherwise do nothing inline void assert_fixshift(const CFix &x, int shift) {it_assert_debug(x.get_shift() == shift, "Shift should be " + to_str(shift) + " but it is " + to_str(x.get_shift()) + ".");} //! Converts a fixvec to vec ITPP_EXPORT vec to_vec(const fixvec &v); //! Converts a cfixvec to cvec ITPP_EXPORT cvec to_cvec(const cfixvec &v); //! Converts a fixmat to mat ITPP_EXPORT mat to_mat(const fixmat &m); //! Converts a cfixmat to cmat ITPP_EXPORT cmat to_cmat(const cfixmat &m); //! \cond //! Help class used by the conversion function to(const Array<...> &x). To be merged with Convert? template class ConvertU2T { public: typedef T result; }; //! Template specialization for Array template class ConvertU2T > { public: typedef Array::result> result; // Recursive }; //! Template specialization for Vec template class ConvertU2T > { public: typedef Vec result; }; //! Template specialization for Mat template class ConvertU2T > { public: typedef Mat result; }; //! \endcond //! Convert double to T template inline T to(double x) {return T(x);} //! Convert Fix to T template inline T to(const Fix &x) {return T(x);} //! Convert std::complex to T template inline T to(const std::complex &x) {return T(x);} //! Convert CFix to T template inline T to(const CFix &x) {return T(x);} //! Convert double (real and imaginary parts) to T template inline T to(double real, double imag) {return T(real, imag);} //! Convert Fix (real and imaginary parts) to T template inline T to(const Fix &real, const Fix &imag) {return T(real, imag);} //! Convert Vec to Vec template Vec to(const Vec &x) { Vec y(x.length()); for (int i = 0; i < x.length(); i++) { y(i) = T(x(i)); } return y; } //! Convert vec to vec template<> inline vec to(const vec &x) {return x;} //! Convert cvec to cvec template<> inline cvec to >(const cvec &x) {return x;} //! Convert fixvec to fixvec template<> inline fixvec to(const fixvec &x) {return x;} //! Convert cfixvec to cfixvec template<> inline cfixvec to(const cfixvec &x) {return x;} //! Convert Vec (real and imaginary parts) to Vec template Vec to(const Vec &real, const Vec &imag) { it_assert_debug(real.length() == imag.length(), "to: real and imag should have the same size"); Vec y(real.length()); for (int i = 0; i < real.length(); i++) { y(i) = T(real(i), imag(i)); } return y; } //! Convert Mat to Mat template Mat to(const Mat &x) { Mat y(x.rows(), x.cols()); for (int i = 0; i < x.rows(); i++) { for (int j = 0; j < x.cols(); j++) { y(i, j) = T(x(i, j)); } } return y; } //! Convert mat to mat template<> inline mat to(const mat &x) {return x;} //! Convert cmat to cmat template<> inline cmat to >(const cmat &x) {return x;} //! Convert fixmat to fixmat template<> inline fixmat to(const fixmat &x) {return x;} //! Convert cfixmat to cfixmat template<> inline cfixmat to(const cfixmat &x) {return x;} //! Convert Mat (real and imaginary parts) to Mat template Mat to(const Mat &real, const Mat &imag) { it_assert_debug(real.rows() == imag.rows() && real.cols() == imag.cols(), "to: real and imag should have the same size"); Mat y(real.rows(), real.cols()); for (int i = 0; i < real.rows(); i++) { for (int j = 0; j < real.cols(); j++) { y(i, j) = T(real(i, j), imag(i, j)); } } return y; } //! Convert Array, where U can be an Array/Vec/Mat, to a corresponding Array with T elements template Array::result> to(const Array &x) { Array::result> y(x.size()); for (int i = 0; i < x.size(); i++) { y(i) = to(x(i)); } return y; } //! Convert Array (real and imaginary parts), where U can be an Array/Vec/Mat, to a corresponding Array with T elements template Array::result> to(const Array &real, const Array &imag) { it_assert_debug(real.size() == imag.size(), "to: real and imag should have the same size"); Array::result> y(real.size()); for (int i = 0; i < real.size(); i++) { y(i) = to(real(i), imag(i)); } return y; } //! Convert Fix to double by multiplying the bit representation with pow2(-shift) inline double unfix(const Fix &x) {return x.unfix();} //! Convert CFix to std::complex by multiplying the bit representation with pow2(-shift) inline std::complex unfix(const CFix &x) {return x.unfix();} //! Convert fixvec to vec by multiplying the bit representations with pow2(-shift) inline vec unfix(const fixvec &x) {return to_vec(x);} //! Convert cfixvec to cvec by multiplying the bit representations with pow2(-shift) inline cvec unfix(const cfixvec &x) {return to_cvec(x);} //! Convert fixmat to mat by multiplying the bit representations with pow2(-shift) inline mat unfix(const fixmat &x) {return to_mat(x);} //! Convert cfixmat to cmat by multiplying the bit representations with pow2(-shift) inline cmat unfix(const cfixmat &x) {return to_cmat(x);} //! Convert double to double i.e. do nothing inline double unfix(double x) {return x;} //! Convert std::complex to std::complex i.e. do nothing inline std::complex unfix(const std::complex &x) {return x;} //! Convert vec to vec i.e. do nothing inline vec unfix(const vec &x) {return x;} //! Convert cvec to cvec i.e. do nothing inline cvec unfix(const cvec &x) {return x;} //! Convert mat to mat i.e. do nothing inline mat unfix(const mat &x) {return x;} //! Convert cmat to cmat i.e. do nothing inline cmat unfix(const cmat &x) {return x;} //! \cond //! Help class used by the conversion function unfix(const Array &x) template class Convert { public: typedef double to_double; }; //! Template specialization for CFix template<> class Convert { public: typedef std::complex to_double; }; //! Template specialization for std::complex template class Convert > { public: typedef std::complex to_double; }; //! Template specialization for Array template class Convert > { public: typedef Array::to_double> to_double; // Recursive }; //! Template specialization for Vec template class Convert > { public: typedef Vec::to_double> to_double; // Recursive }; //! Template specialization for Mat template class Convert > { public: typedef Mat::to_double> to_double; // Recursive }; //! \endcond //! Convert floating- or fixed-point Array to floating-point Array template Array::to_double> unfix(const Array &x) { Array::to_double> y(x.size()); for (int i = 0; i < x.size(); i++) { y(i) = unfix(x(i)); } return y; } //! Absolute value ITPP_EXPORT Fix abs(const Fix &x); //! Real part of complex value ITPP_EXPORT Fix real(const CFix &x); //! Imaginary part of complex value ITPP_EXPORT Fix imag(const CFix &x); //! Conjugate of complex value ITPP_EXPORT CFix conj(const CFix &x); //!@} } // namespace itpp #endif // #ifndef FIX_FUNCTIONS_H itpp-4.3.1/itpp/fixed/fix_operators.cpp000066400000000000000000000252071216575753400201630ustar00rootroot00000000000000/*! * \file * \brief Implementation of a set of operators for Fix, Fixed, CFix and * CFixed classes * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { ///////////////////////////////// // Operators for Fix and Fixed // ///////////////////////////////// Fix operator+(const Fix &x, const Fix &y) { return Fix(x.get_re() + y.get_re(), assert_shifts(x, y), 0, 0); } Fix operator-(const Fix &x, const Fix &y) { return Fix(x.get_re() - y.get_re(), assert_shifts(x, y), 0, 0); } Fix operator*(const Fix &x, const Fix &y) { return Fix(x.get_re() * y.get_re(), x.get_shift() + y.get_shift(), 0, 0); } Fix operator/(const Fix &x, const Fix &y) { return Fix(x.get_re() / y.get_re(), x.get_shift() - y.get_shift(), 0, 0); } Fix operator+(const Fix &x, const int y) { return Fix(x.get_re() + y, assert_shifts(x, y), 0, 0); } Fix operator-(const Fix &x, const int y) { return Fix(x.get_re() - y, assert_shifts(x, y), 0, 0); } Fix operator*(const Fix &x, const int y) { return Fix(x.get_re() * y, x.get_shift(), 0, 0); } Fix operator/(const Fix &x, const int y) { return Fix(x.get_re() / y, x.get_shift(), 0, 0); } Fix operator+(const int x, const Fix &y) { return Fix(x + y.get_re(), assert_shifts(y, x), 0, 0); } Fix operator-(const int x, const Fix &y) { return Fix(x - y.get_re(), assert_shifts(y, x), 0, 0); } Fix operator*(const int x, const Fix &y) { return Fix(x * y.get_re(), y.get_shift(), 0, 0); } Fix operator/(const int x, const Fix &y) { return Fix(x / y.get_re(), -y.get_shift(), 0, 0); } fixvec operator+(const fixvec &a, const ivec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes do not match"); fixvec temp(a); for (int i = 0; i < a.size(); i++) { temp(i) += b(i); } return temp; } Fix operator*(const fixvec &a, const ivec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes do not match"); Fix temp(0); for (int i = 0; i < a.size(); i++) { temp += a(i) * b(i); } return temp; } fixmat operator+(const fixmat &a, const imat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes do not match"); fixmat temp(a); for (int i = 0; i < a.rows(); i++) { for (int j = 0; j < a.cols(); j++) { temp(i, j) += b(i, j); } } return temp; } fixmat operator*(const fixmat &a, const imat &b) { it_assert_debug(a.cols() == b.rows(), "operator*: wrong sizes"); fixmat r(a.rows(), b.cols()); Fix tmp; int i, j, k; Fix *tr = r._data(); const Fix *t1; const int *t2 = b._data(); for (i = 0; i < r.cols(); i++) { for (j = 0; j < r.rows(); j++) { tmp = Fix(0); t1 = a._data() + j; for (k = a.cols(); k > 0; k--) { tmp += *(t1) * *(t2++); t1 += a.rows(); } *(tr++) = tmp; t2 -= b.rows(); } t2 += b.rows(); } return r; } /////////////////////////////////// // Operators for CFix and CFixed // /////////////////////////////////// CFix operator+(const CFix &x, const CFix &y) { return CFix(x.get_re() + y.get_re(), x.get_im() + y.get_im(), assert_shifts(x, y), 0, 0); } CFix operator-(const CFix &x, const CFix &y) { return CFix(x.get_re() - y.get_re(), x.get_im() - y.get_im(), assert_shifts(x, y), 0, 0); } CFix operator*(const CFix &x, const CFix &y) { return CFix(x.get_re()*y.get_re() - x.get_im()*y.get_im(), x.get_re()*y.get_im() + x.get_im()*y.get_re(), x.get_shift() + y.get_shift(), 0, 0); } CFix operator/(const CFix &x, const CFix &y) { fixrep denominator = y.get_re() * y.get_re() + y.get_im() * y.get_im(); return CFix((x.get_re()*y.get_re() + x.get_im()*y.get_im()) / denominator, (x.get_im()*y.get_re() - x.get_re()*y.get_im()) / denominator, x.get_shift() - y.get_shift(), 0, 0); } CFix operator+(const CFix &x, const Fix &y) { return CFix(x.get_re() + y.get_re(), x.get_im(), assert_shifts(x, y), 0, 0); } CFix operator-(const CFix &x, const Fix &y) { return CFix(x.get_re() - y.get_re(), x.get_im(), assert_shifts(x, y), 0, 0); } CFix operator*(const CFix &x, const Fix &y) { return CFix(x.get_re() * y.get_re(), x.get_im() * y.get_re(), x.get_shift() + y.get_shift(), 0, 0); } CFix operator/(const CFix &x, const Fix &y) { return CFix(x.get_re() / y.get_re(), x.get_im() / y.get_re(), x.get_shift() - y.get_shift(), 0, 0); } CFix operator+(const Fix &x, const CFix &y) { return CFix(x.get_re() + y.get_re(), y.get_im(), assert_shifts(y, x), 0, 0); } CFix operator-(const Fix &x, const CFix &y) { return CFix(x.get_re() - y.get_re(), -y.get_im(), assert_shifts(y, x), 0, 0); } CFix operator*(const Fix &x, const CFix &y) { return CFix(x.get_re() * y.get_re(), x.get_re() * y.get_im(), x.get_shift() + y.get_shift(), 0, 0); } CFix operator/(const Fix &x, const CFix &y) { fixrep denominator = y.get_re() * y.get_re() + y.get_im() * y.get_im(); return CFix(x.get_re() * y.get_re() / denominator, -x.get_re() * y.get_im() / denominator, x.get_shift() - y.get_shift(), 0, 0); } CFix operator+(const CFix &x, const int y) { return CFix(x.get_re() + y, x.get_im(), assert_shifts(x, y), 0, 0); } CFix operator-(const CFix &x, const int y) { return CFix(x.get_re() - y, x.get_im(), assert_shifts(x, y), 0, 0); } CFix operator*(const CFix &x, const int y) { return CFix(x.get_re() * y, x.get_im() * y, x.get_shift(), 0, 0); } CFix operator/(const CFix &x, const int y) { return CFix(x.get_re() / y, x.get_im() / y, x.get_shift(), 0, 0); } CFix operator+(const int x, const CFix &y) { return CFix(x + y.get_re(), y.get_im(), assert_shifts(y, x), 0, 0); } CFix operator-(const int x, const CFix &y) { return CFix(x - y.get_re(), -y.get_im(), assert_shifts(y, x), 0, 0); } CFix operator*(const int x, const CFix &y) { return CFix(x * y.get_re(), x * y.get_im(), y.get_shift(), 0, 0); } CFix operator/(const int x, const CFix &y) { fixrep denominator = y.get_re() * y.get_re() + y.get_im() * y.get_im(); return CFix(x * y.get_re() / denominator, -x * y.get_im() / denominator, -y.get_shift(), 0, 0); } cfixvec operator+(const cfixvec &a, const fixvec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes do not match"); cfixvec temp(a); for (int i = 0; i < a.size(); i++) { temp(i) += b(i); } return temp; } CFix operator*(const cfixvec &a, const fixvec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes do not match"); CFix temp(0); for (int i = 0; i < a.size(); i++) { temp += a(i) * b(i); } return temp; } cfixmat operator+(const cfixmat &a, const fixmat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes do not match"); cfixmat temp(a); for (int i = 0; i < a.rows(); i++) { for (int j = 0; j < a.cols(); j++) { temp(i, j) += b(i, j); } } return temp; } cfixmat operator*(const cfixmat &a, const fixmat &b) { it_assert_debug(a.cols() == b.rows(), "operator*: wrong sizes"); cfixmat r(a.rows(), b.cols()); CFix tmp; int i, j, k; CFix *tr = r._data(); const CFix *t1; const Fix *t2 = b._data(); for (i = 0; i < r.cols(); i++) { for (j = 0; j < r.rows(); j++) { tmp = CFix(0); t1 = a._data() + j; for (k = a.cols(); k > 0; k--) { tmp += *(t1) * *(t2++); t1 += a.rows(); } *(tr++) = tmp; t2 -= b.rows(); } t2 += b.rows(); } return r; } cfixvec operator+(const cfixvec &a, const ivec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes do not match"); cfixvec temp(a); for (int i = 0; i < a.size(); i++) { temp(i) += b(i); } return temp; } CFix operator*(const cfixvec &a, const ivec &b) { it_assert_debug(a.size() == b.size(), "operator+(): sizes do not match"); CFix temp(0); for (int i = 0; i < a.size(); i++) { temp += a(i) * b(i); } return temp; } cfixmat operator+(const cfixmat &a, const imat &b) { it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(), "operator+(): sizes do not match"); cfixmat temp(a); for (int i = 0; i < a.rows(); i++) { for (int j = 0; j < a.cols(); j++) { temp(i, j) += b(i, j); } } return temp; } cfixmat operator*(const cfixmat &a, const imat &b) { it_assert_debug(a.cols() == b.rows(), "operator*: wrong sizes"); cfixmat r(a.rows(), b.cols()); CFix tmp; int i, j, k; CFix *tr = r._data(); const CFix *t1; const int *t2 = b._data(); for (i = 0; i < r.cols(); i++) { for (j = 0; j < r.rows(); j++) { tmp = CFix(0); t1 = a._data() + j; for (k = a.cols(); k > 0; k--) { tmp += *(t1) * *(t2++); t1 += a.rows(); } *(tr++) = tmp; t2 -= b.rows(); } t2 += b.rows(); } return r; } } // namespace itpp itpp-4.3.1/itpp/fixed/fix_operators.h000066400000000000000000000343461216575753400176340ustar00rootroot00000000000000/*! * \file * \brief Definitions of a set of operators for Fix, Fixed, CFix and * CFixed classes * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FIX_OPERATORS_H #define FIX_OPERATORS_H #include #include #include namespace itpp { //! \addtogroup fixed //!@{ ///////////////////////////////// // Operators for Fix and Fixed // ///////////////////////////////// //! Fix + Fix ITPP_EXPORT Fix operator+(const Fix &x, const Fix &y); //! Fix - Fix ITPP_EXPORT Fix operator-(const Fix &x, const Fix &y); //! Fix * Fix ITPP_EXPORT Fix operator*(const Fix &x, const Fix &y); //! Fix / Fix using quantization mode \c TRN ITPP_EXPORT Fix operator/(const Fix &x, const Fix &y); //! Fix + int ITPP_EXPORT Fix operator+(const Fix &x, const int y); //! Fix - int ITPP_EXPORT Fix operator-(const Fix &x, const int y); //! Fix * int ITPP_EXPORT Fix operator*(const Fix &x, const int y); //! Fix / int using quantization mode \c TRN ITPP_EXPORT Fix operator/(const Fix &x, const int y); //! int + Fix ITPP_EXPORT Fix operator+(const int x, const Fix &y); //! int - Fix ITPP_EXPORT Fix operator-(const int x, const Fix &y); //! int * Fix ITPP_EXPORT Fix operator*(const int x, const Fix &y); //! int / Fix using quantization mode \c TRN ITPP_EXPORT Fix operator/(const int x, const Fix &y); //! fixvec + int inline fixvec operator+(const fixvec &v, const int s) {return v + Fix(s);} //! int + fixvec inline fixvec operator+(const int s, const fixvec &v) {return Fix(s) + v;} //! fixvec - int inline fixvec operator-(const fixvec &v, const int s) {return v - Fix(s);} //! int - fixvec inline fixvec operator-(const int s, const fixvec &v) {return Fix(s) - v;} //! fixvec * int inline fixvec operator*(const fixvec &v, const int s) {return v * Fix(s);} //! int * fixvec inline fixvec operator*(const int s, const fixvec &v) {return Fix(s) * v;} //! fixvec / int using quantization mode \c TRN inline fixvec operator/(const fixvec &v, const int s) {return v / Fix(s);} //! fixmat + int inline fixmat operator+(const fixmat &v, const int s) {return v + Fix(s);} //! int + fixmat inline fixmat operator+(const int s, const fixmat &v) {return Fix(s) + v;} //! fixmat - int inline fixmat operator-(const fixmat &v, const int s) {return v - Fix(s);} //! int - fixmat inline fixmat operator-(const int s, const fixmat &v) {return Fix(s) - v;} //! fixmat * int inline fixmat operator*(const fixmat &v, const int s) {return v * Fix(s);} //! int * fixmat inline fixmat operator*(const int s, const fixmat &v) {return Fix(s) * v;} //! fixmat / int using quantization mode \c TRN inline fixmat operator/(const fixmat &v, const int s) {return v / Fix(s);} //! fixvec + ivec ITPP_EXPORT fixvec operator+(const fixvec &a, const ivec &b); //! ivec + fixvec inline fixvec operator+(const ivec &a, const fixvec &b) {return b + a;} //! fixvec - ivec inline fixvec operator-(const fixvec &a, const ivec &b) {return a + (-b);} //! ivec - fixvec inline fixvec operator-(const ivec &a, const fixvec &b) {return (-b) + a;} //! fixvec * ivec ITPP_EXPORT Fix operator*(const fixvec &a, const ivec &b); //! ivec * fixvec inline Fix operator*(const ivec &a, const fixvec &b) {return b*a;} //! fixmat + imat ITPP_EXPORT fixmat operator+(const fixmat &a, const imat &b); //! imat + fixmat inline fixmat operator+(const imat &a, const fixmat &b) {return b + a;} //! fixmat - imat inline fixmat operator-(const fixmat &a, const imat &b) {return a + (-b);} //! imat - fixmat inline fixmat operator-(const imat &a, const fixmat &b) {return (-b) + a;} //! fixmat * imat ITPP_EXPORT fixmat operator*(const fixmat &a, const imat &b); //! imat * fixmat inline fixmat operator*(const imat &a, const fixmat &b) {return b*a;} /////////////////////////////////// // Operators for CFix and CFixed // /////////////////////////////////// //! CFix + CFix ITPP_EXPORT CFix operator+(const CFix &x, const CFix &y); //! CFix - CFix ITPP_EXPORT CFix operator-(const CFix &x, const CFix &y); //! CFix * CFix ITPP_EXPORT CFix operator*(const CFix &x, const CFix &y); //! CFix / CFix using quantization mode \c TRN ITPP_EXPORT CFix operator/(const CFix &x, const CFix &y); //! CFix + Fix ITPP_EXPORT CFix operator+(const CFix &x, const Fix &y); //! CFix - Fix ITPP_EXPORT CFix operator-(const CFix &x, const Fix &y); //! CFix * Fix ITPP_EXPORT CFix operator*(const CFix &x, const Fix &y); //! CFix / Fix using quantization mode \c TRN ITPP_EXPORT CFix operator/(const CFix &x, const Fix &y); //! Fix + CFix ITPP_EXPORT CFix operator+(const Fix &x, const CFix &y); //! Fix - CFix ITPP_EXPORT CFix operator-(const Fix &x, const CFix &y); //! Fix * CFix ITPP_EXPORT CFix operator*(const Fix &x, const CFix &y); //! Fix / CFix using quantization mode \c TRN ITPP_EXPORT CFix operator/(const Fix &x, const CFix &y); //! CFix + int ITPP_EXPORT CFix operator+(const CFix &x, const int y); //! CFix - int ITPP_EXPORT CFix operator-(const CFix &x, const int y); //! CFix * int ITPP_EXPORT CFix operator*(const CFix &x, const int y); //! CFix / int using quantization mode \c TRN ITPP_EXPORT CFix operator/(const CFix &x, const int y); //! int + CFix ITPP_EXPORT CFix operator+(const int x, const CFix &y); //! int - CFix ITPP_EXPORT CFix operator-(const int x, const CFix &y); //! int * CFix ITPP_EXPORT CFix operator*(const int x, const CFix &y); //! int / CFix using quantization mode \c TRN ITPP_EXPORT CFix operator/(const int x, const CFix &y); //! fixvec + CFix inline cfixvec operator+(const fixvec &v, const CFix &s) {return to(v) + s;} //! CFix + fixvec inline cfixvec operator+(const CFix &s, const fixvec &v) {return s + to(v);} //! fixvec - CFix inline cfixvec operator-(const fixvec &v, const CFix &s) {return to(v) - s;} //! CFix - fixvec inline cfixvec operator-(const CFix &s, const fixvec &v) {return s - to(v);} //! fixvec * CFix inline cfixvec operator*(const fixvec &v, const CFix &s) {return to(v) * s;} //! CFix * fixvec inline cfixvec operator*(const CFix &s, const fixvec &v) {return s * to(v);} //! fixvec / CFix using quantization mode \c TRN inline cfixvec operator/(const fixvec &v, const CFix &s) {return to(v) / s;} //! fixmat + CFix inline cfixmat operator+(const fixmat &m, const CFix &s) {return to(m) + s;} //! CFix + fixmat inline cfixmat operator+(const CFix &s, const fixmat &m) {return s + to(m);} //! fixmat - CFix inline cfixmat operator-(const fixmat &m, const CFix &s) {return to(m) - s;} //! CFix - fixmat inline cfixmat operator-(const CFix &s, const fixmat &m) {return s - to(m);} //! fixmat * CFix inline cfixmat operator*(const fixmat &m, const CFix &s) {return to(m) * s;} //! CFix * fixmat inline cfixmat operator*(const CFix &s, const fixmat &m) {return s * to(m);} //! fixmat / CFix using quantization mode \c TRN inline cfixmat operator/(const fixmat &m, const CFix &s) {return to(m) / s;} //! ivec + CFix inline cfixvec operator+(const ivec &v, const CFix &s) {return to(to_vec(v)) + s;} //! CFix + ivec inline cfixvec operator+(const CFix &s, const ivec &v) {return s + to(to_vec(v));} //! ivec - CFix inline cfixvec operator-(const ivec &v, const CFix &s) {return to(to_vec(v)) - s;} //! CFix - ivec inline cfixvec operator-(const CFix &s, const ivec &v) {return s - to(to_vec(v));} //! ivec * CFix inline cfixvec operator*(const ivec &v, const CFix &s) {return to(to_vec(v)) * s;} //! CFix * ivec inline cfixvec operator*(const CFix &s, const ivec &v) {return s * to(to_vec(v));} //! ivec / CFix using quantization mode \c TRN inline cfixvec operator/(const ivec &v, const CFix &s) {return to(to_vec(v)) / s;} //! imat + CFix inline cfixmat operator+(const imat &m, const CFix &s) {return to(to_mat(m)) + s;} //! CFix + imat inline cfixmat operator+(const CFix &s, const imat &m) {return s + to(to_mat(m));} //! imat - CFix inline cfixmat operator-(const imat &m, const CFix &s) {return to(to_mat(m)) - s;} //! CFix - imat inline cfixmat operator-(const CFix &s, const imat &m) {return s - to(to_mat(m));} //! imat * CFix inline cfixmat operator*(const imat &m, const CFix &s) {return to(to_mat(m)) * s;} //! CFix * imat inline cfixmat operator*(const CFix &s, const imat &m) {return s * to(to_mat(m));} //! imat / CFix using quantization mode \c TRN inline cfixmat operator/(const imat &m, const CFix &s) {return to(to_mat(m)) / s;} //! cfixvec + Fix inline cfixvec operator+(const cfixvec &v, const Fix &s) {return v + CFix(s);} //! Fix + cfixvec inline cfixvec operator+(const Fix &s, const cfixvec &v) {return CFix(s) + v;} //! cfixvec - Fix inline cfixvec operator-(const cfixvec &v, const Fix &s) {return v - CFix(s);} //! Fix - cfixvec inline cfixvec operator-(const Fix &s, const cfixvec &v) {return CFix(s) - v;} //! cfixvec * Fix inline cfixvec operator*(const cfixvec &v, const Fix &s) {return v * CFix(s);} //! Fix * cfixvec inline cfixvec operator*(const Fix &s, const cfixvec &v) {return CFix(s) * v;} //! cfixvec / Fix using quantization mode \c TRN inline cfixvec operator/(const cfixvec &v, const Fix &s) {return v / CFix(s);} //! cfixmat + Fix inline cfixmat operator+(const cfixmat &m, const Fix &s) {return m + CFix(s);} //! Fix + cfixmat inline cfixmat operator+(const Fix &s, const cfixmat &m) {return CFix(s) + m;} //! cfixmat - Fix inline cfixmat operator-(const cfixmat &m, const Fix &s) {return m - CFix(s);} //! Fix - cfixmat inline cfixmat operator-(const Fix &s, const cfixmat &m) {return CFix(s) - m;} //! cfixmat * Fix inline cfixmat operator*(const cfixmat &m, const Fix &s) {return m * CFix(s);} //! Fix * cfixmat inline cfixmat operator*(const Fix &s, const cfixmat &m) {return CFix(s) * m;} //! cfixmat / Fix using quantization mode \c TRN inline cfixmat operator/(const cfixmat &m, const Fix &s) {return m / CFix(s);} //! cfixvec + int inline cfixvec operator+(const cfixvec &v, const int s) {return v + CFix(s);} //! int + cfixvec inline cfixvec operator+(const int s, const cfixvec &v) {return CFix(s) + v;} //! cfixvec - int inline cfixvec operator-(const cfixvec &v, const int s) {return v - CFix(s);} //! int - cfixvec inline cfixvec operator-(const int s, const cfixvec &v) {return CFix(s) - v;} //! cfixvec * int inline cfixvec operator*(const cfixvec &v, const int s) {return v * CFix(s);} //! int * cfixvec inline cfixvec operator*(const int s, const cfixvec &v) {return CFix(s) * v;} //! cfixvec / int using quantization mode \c TRN inline cfixvec operator/(const cfixvec &v, const int s) {return v / CFix(s);} //! cfixmat + int inline cfixmat operator+(const cfixmat &m, const int s) {return m + CFix(s);} //! int + cfixmat inline cfixmat operator+(const int s, const cfixmat &m) {return CFix(s) + m;} //! cfixmat - int inline cfixmat operator-(const cfixmat &m, const int s) {return m - CFix(s);} //! int - cfixmat inline cfixmat operator-(const int s, const cfixmat &m) {return CFix(s) - m;} //! cfixmat * int inline cfixmat operator*(const cfixmat &m, const int s) {return m * CFix(s);} //! int * cfixmat inline cfixmat operator*(const int s, const cfixmat &m) {return CFix(s) * m;} //! cfixmat / int using quantization mode \c TRN inline cfixmat operator/(const cfixmat &m, const int s) {return m / CFix(s);} //! cfixvec + fixvec ITPP_EXPORT cfixvec operator+(const cfixvec &a, const fixvec &b); //! fixvec + cfixvec inline cfixvec operator+(const fixvec &a, const cfixvec &b) {return b + a;} //! cfixvec - fixvec inline cfixvec operator-(const cfixvec &a, const fixvec &b) {return a + (-b);} //! fixvec - cfixvec inline cfixvec operator-(const fixvec &a, const cfixvec &b) {return (-b) + a;} //! cfixvec * fixvec ITPP_EXPORT CFix operator*(const cfixvec &a, const fixvec &b); //! fixvec * cfixvec inline CFix operator*(const fixvec &a, const cfixvec &b) {return b*a;} //! cfixmat + fixmat ITPP_EXPORT cfixmat operator+(const cfixmat &a, const fixmat &b); //! fixmat + cfixmat inline cfixmat operator+(const fixmat &a, const cfixmat &b) {return b + a;} //! cfixmat - fixmat inline cfixmat operator-(const cfixmat &a, const fixmat &b) {return a + (-b);} //! fixmat - cfixmat inline cfixmat operator-(const fixmat &a, const cfixmat &b) {return (-b) + a;} //! cfixmat * fixmat ITPP_EXPORT cfixmat operator*(const cfixmat &a, const fixmat &b); //! fixmat * cfixmat inline cfixmat operator*(const fixmat &a, const cfixmat &b) {return b*a;} //! cfixvec + ivec ITPP_EXPORT cfixvec operator+(const cfixvec &a, const ivec &b); //! ivec + cfixvec inline cfixvec operator+(const ivec &a, const cfixvec &b) {return b + a;} //! cfixvec - ivec inline cfixvec operator-(const cfixvec &a, const ivec &b) {return a + (-b);} //! ivec - cfixvec inline cfixvec operator-(const ivec &a, const cfixvec &b) {return (-b) + a;} //! cfixvec * ivec ITPP_EXPORT CFix operator*(const cfixvec &a, const ivec &b); //! ivec * cfixvec inline CFix operator*(const ivec &a, const cfixvec &b) {return b*a;} //! cfixmat + imat ITPP_EXPORT cfixmat operator+(const cfixmat &a, const imat &b); //! imat + cfixmat inline cfixmat operator+(const imat &a, const cfixmat &b) {return b + a;} //! cfixmat - imat inline cfixmat operator-(const cfixmat &a, const imat &b) {return a + (-b);} //! imat - cfixmat inline cfixmat operator-(const imat &a, const cfixmat &b) {return (-b) + a;} //! cfixmat * imat ITPP_EXPORT cfixmat operator*(const cfixmat &a, const imat &b); //! imat * cfixmat inline cfixmat operator*(const imat &a, const cfixmat &b) {return b*a;} //!@} } // namespace itpp #endif // #ifndef FIX_OPERATORS_H itpp-4.3.1/itpp/fixed/fixed.cpp000066400000000000000000000023511216575753400163710ustar00rootroot00000000000000/*! * \file * \brief Implementation of a fixed-point data type Fixed * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // Template instantiations template class ITPP_EXPORT Fixed<64, TC, WRAP>; } // namespace itpp itpp-4.3.1/itpp/fixed/fixed.h000066400000000000000000000277071216575753400160520ustar00rootroot00000000000000/*! * \file * \brief Definitions of a fixed-point data type Fixed * \author Johan Bergman * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FIXED_H #define FIXED_H #include #include namespace itpp { //! \addtogroup fixed //!@{ /*! \brief Templated fixed-point data type See the Detailed Description in the \ref fixed module. */ template < int w, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN > class Fixed : public Fix { public: //! Default constructor Fixed(double x = 0.0, int s = 0, Stat *ptr = 0) : Fix(x, s, w, e, o, q, ptr) {} //! Constructor explicit Fixed(Stat *ptr) : Fix(0.0, 0, w, e, o, q, ptr) {} //! Constructor Fixed(const Fix &x, Stat *ptr = 0) : Fix(x, w, e, o, q, ptr) {} //! Destructor virtual ~Fixed() {} //! Assignment from Fix Fixed& operator=(const Fix &x) { shift = x.shift; re = apply_o_mode(x.re); return *this; } //! Assignment from int Fixed& operator=(int x) { shift = 0; re = apply_o_mode(x); return *this; } protected: }; //!@} //! Typedefs for Fixed (fixed1, fixed2, ..., fixed64) typedef Fixed<1, TC, WRAP> fixed1; //! \cond typedef Fixed<2, TC, WRAP> fixed2; typedef Fixed<3, TC, WRAP> fixed3; typedef Fixed<4, TC, WRAP> fixed4; typedef Fixed<5, TC, WRAP> fixed5; typedef Fixed<6, TC, WRAP> fixed6; typedef Fixed<7, TC, WRAP> fixed7; typedef Fixed<8, TC, WRAP> fixed8; typedef Fixed<9, TC, WRAP> fixed9; typedef Fixed<10, TC, WRAP> fixed10; typedef Fixed<11, TC, WRAP> fixed11; typedef Fixed<12, TC, WRAP> fixed12; typedef Fixed<13, TC, WRAP> fixed13; typedef Fixed<14, TC, WRAP> fixed14; typedef Fixed<15, TC, WRAP> fixed15; typedef Fixed<16, TC, WRAP> fixed16; typedef Fixed<17, TC, WRAP> fixed17; typedef Fixed<18, TC, WRAP> fixed18; typedef Fixed<19, TC, WRAP> fixed19; typedef Fixed<20, TC, WRAP> fixed20; typedef Fixed<21, TC, WRAP> fixed21; typedef Fixed<22, TC, WRAP> fixed22; typedef Fixed<23, TC, WRAP> fixed23; typedef Fixed<24, TC, WRAP> fixed24; typedef Fixed<25, TC, WRAP> fixed25; typedef Fixed<26, TC, WRAP> fixed26; typedef Fixed<27, TC, WRAP> fixed27; typedef Fixed<28, TC, WRAP> fixed28; typedef Fixed<29, TC, WRAP> fixed29; typedef Fixed<30, TC, WRAP> fixed30; typedef Fixed<31, TC, WRAP> fixed31; typedef Fixed<32, TC, WRAP> fixed32; typedef Fixed<33, TC, WRAP> fixed33; typedef Fixed<34, TC, WRAP> fixed34; typedef Fixed<35, TC, WRAP> fixed35; typedef Fixed<36, TC, WRAP> fixed36; typedef Fixed<37, TC, WRAP> fixed37; typedef Fixed<38, TC, WRAP> fixed38; typedef Fixed<39, TC, WRAP> fixed39; typedef Fixed<40, TC, WRAP> fixed40; typedef Fixed<41, TC, WRAP> fixed41; typedef Fixed<42, TC, WRAP> fixed42; typedef Fixed<43, TC, WRAP> fixed43; typedef Fixed<44, TC, WRAP> fixed44; typedef Fixed<45, TC, WRAP> fixed45; typedef Fixed<46, TC, WRAP> fixed46; typedef Fixed<47, TC, WRAP> fixed47; typedef Fixed<48, TC, WRAP> fixed48; typedef Fixed<49, TC, WRAP> fixed49; typedef Fixed<50, TC, WRAP> fixed50; typedef Fixed<51, TC, WRAP> fixed51; typedef Fixed<52, TC, WRAP> fixed52; typedef Fixed<53, TC, WRAP> fixed53; typedef Fixed<54, TC, WRAP> fixed54; typedef Fixed<55, TC, WRAP> fixed55; typedef Fixed<56, TC, WRAP> fixed56; typedef Fixed<57, TC, WRAP> fixed57; typedef Fixed<58, TC, WRAP> fixed58; typedef Fixed<59, TC, WRAP> fixed59; typedef Fixed<60, TC, WRAP> fixed60; typedef Fixed<61, TC, WRAP> fixed61; typedef Fixed<62, TC, WRAP> fixed62; typedef Fixed<63, TC, WRAP> fixed63; typedef Fixed<64, TC, WRAP> fixed64; //! \endcond //! Typedefs for unsigned Fixed (ufixed1, ufixed2, ..., ufixed64) typedef Fixed<1, US, WRAP> ufixed1; //! \cond typedef Fixed<2, US, WRAP> ufixed2; typedef Fixed<3, US, WRAP> ufixed3; typedef Fixed<4, US, WRAP> ufixed4; typedef Fixed<5, US, WRAP> ufixed5; typedef Fixed<6, US, WRAP> ufixed6; typedef Fixed<7, US, WRAP> ufixed7; typedef Fixed<8, US, WRAP> ufixed8; typedef Fixed<9, US, WRAP> ufixed9; typedef Fixed<10, US, WRAP> ufixed10; typedef Fixed<11, US, WRAP> ufixed11; typedef Fixed<12, US, WRAP> ufixed12; typedef Fixed<13, US, WRAP> ufixed13; typedef Fixed<14, US, WRAP> ufixed14; typedef Fixed<15, US, WRAP> ufixed15; typedef Fixed<16, US, WRAP> ufixed16; typedef Fixed<17, US, WRAP> ufixed17; typedef Fixed<18, US, WRAP> ufixed18; typedef Fixed<19, US, WRAP> ufixed19; typedef Fixed<20, US, WRAP> ufixed20; typedef Fixed<21, US, WRAP> ufixed21; typedef Fixed<22, US, WRAP> ufixed22; typedef Fixed<23, US, WRAP> ufixed23; typedef Fixed<24, US, WRAP> ufixed24; typedef Fixed<25, US, WRAP> ufixed25; typedef Fixed<26, US, WRAP> ufixed26; typedef Fixed<27, US, WRAP> ufixed27; typedef Fixed<28, US, WRAP> ufixed28; typedef Fixed<29, US, WRAP> ufixed29; typedef Fixed<30, US, WRAP> ufixed30; typedef Fixed<31, US, WRAP> ufixed31; typedef Fixed<32, US, WRAP> ufixed32; typedef Fixed<33, US, WRAP> ufixed33; typedef Fixed<34, US, WRAP> ufixed34; typedef Fixed<35, US, WRAP> ufixed35; typedef Fixed<36, US, WRAP> ufixed36; typedef Fixed<37, US, WRAP> ufixed37; typedef Fixed<38, US, WRAP> ufixed38; typedef Fixed<39, US, WRAP> ufixed39; typedef Fixed<40, US, WRAP> ufixed40; typedef Fixed<41, US, WRAP> ufixed41; typedef Fixed<42, US, WRAP> ufixed42; typedef Fixed<43, US, WRAP> ufixed43; typedef Fixed<44, US, WRAP> ufixed44; typedef Fixed<45, US, WRAP> ufixed45; typedef Fixed<46, US, WRAP> ufixed46; typedef Fixed<47, US, WRAP> ufixed47; typedef Fixed<48, US, WRAP> ufixed48; typedef Fixed<49, US, WRAP> ufixed49; typedef Fixed<50, US, WRAP> ufixed50; typedef Fixed<51, US, WRAP> ufixed51; typedef Fixed<52, US, WRAP> ufixed52; typedef Fixed<53, US, WRAP> ufixed53; typedef Fixed<54, US, WRAP> ufixed54; typedef Fixed<55, US, WRAP> ufixed55; typedef Fixed<56, US, WRAP> ufixed56; typedef Fixed<57, US, WRAP> ufixed57; typedef Fixed<58, US, WRAP> ufixed58; typedef Fixed<59, US, WRAP> ufixed59; typedef Fixed<60, US, WRAP> ufixed60; typedef Fixed<61, US, WRAP> ufixed61; typedef Fixed<62, US, WRAP> ufixed62; typedef Fixed<63, US, WRAP> ufixed63; typedef Fixed<64, US, WRAP> ufixed64; //! \endcond //! Typedefs for saturated Fixed (sfixed1, sfixed2, ..., sfixed64) typedef Fixed<1, TC, SAT> sfixed1; //! \cond typedef Fixed<2, TC, SAT> sfixed2; typedef Fixed<3, TC, SAT> sfixed3; typedef Fixed<4, TC, SAT> sfixed4; typedef Fixed<5, TC, SAT> sfixed5; typedef Fixed<6, TC, SAT> sfixed6; typedef Fixed<7, TC, SAT> sfixed7; typedef Fixed<8, TC, SAT> sfixed8; typedef Fixed<9, TC, SAT> sfixed9; typedef Fixed<10, TC, SAT> sfixed10; typedef Fixed<11, TC, SAT> sfixed11; typedef Fixed<12, TC, SAT> sfixed12; typedef Fixed<13, TC, SAT> sfixed13; typedef Fixed<14, TC, SAT> sfixed14; typedef Fixed<15, TC, SAT> sfixed15; typedef Fixed<16, TC, SAT> sfixed16; typedef Fixed<17, TC, SAT> sfixed17; typedef Fixed<18, TC, SAT> sfixed18; typedef Fixed<19, TC, SAT> sfixed19; typedef Fixed<20, TC, SAT> sfixed20; typedef Fixed<21, TC, SAT> sfixed21; typedef Fixed<22, TC, SAT> sfixed22; typedef Fixed<23, TC, SAT> sfixed23; typedef Fixed<24, TC, SAT> sfixed24; typedef Fixed<25, TC, SAT> sfixed25; typedef Fixed<26, TC, SAT> sfixed26; typedef Fixed<27, TC, SAT> sfixed27; typedef Fixed<28, TC, SAT> sfixed28; typedef Fixed<29, TC, SAT> sfixed29; typedef Fixed<30, TC, SAT> sfixed30; typedef Fixed<31, TC, SAT> sfixed31; typedef Fixed<32, TC, SAT> sfixed32; typedef Fixed<33, TC, SAT> sfixed33; typedef Fixed<34, TC, SAT> sfixed34; typedef Fixed<35, TC, SAT> sfixed35; typedef Fixed<36, TC, SAT> sfixed36; typedef Fixed<37, TC, SAT> sfixed37; typedef Fixed<38, TC, SAT> sfixed38; typedef Fixed<39, TC, SAT> sfixed39; typedef Fixed<40, TC, SAT> sfixed40; typedef Fixed<41, TC, SAT> sfixed41; typedef Fixed<42, TC, SAT> sfixed42; typedef Fixed<43, TC, SAT> sfixed43; typedef Fixed<44, TC, SAT> sfixed44; typedef Fixed<45, TC, SAT> sfixed45; typedef Fixed<46, TC, SAT> sfixed46; typedef Fixed<47, TC, SAT> sfixed47; typedef Fixed<48, TC, SAT> sfixed48; typedef Fixed<49, TC, SAT> sfixed49; typedef Fixed<50, TC, SAT> sfixed50; typedef Fixed<51, TC, SAT> sfixed51; typedef Fixed<52, TC, SAT> sfixed52; typedef Fixed<53, TC, SAT> sfixed53; typedef Fixed<54, TC, SAT> sfixed54; typedef Fixed<55, TC, SAT> sfixed55; typedef Fixed<56, TC, SAT> sfixed56; typedef Fixed<57, TC, SAT> sfixed57; typedef Fixed<58, TC, SAT> sfixed58; typedef Fixed<59, TC, SAT> sfixed59; typedef Fixed<60, TC, SAT> sfixed60; typedef Fixed<61, TC, SAT> sfixed61; typedef Fixed<62, TC, SAT> sfixed62; typedef Fixed<63, TC, SAT> sfixed63; typedef Fixed<64, TC, SAT> sfixed64; //! \endcond //! Typedefs for saturated unsigned Fixed (sufixed1, sufixed2, ..., sufixed64) typedef Fixed<1, US, SAT> sufixed1; //! \cond typedef Fixed<2, US, SAT> sufixed2; typedef Fixed<3, US, SAT> sufixed3; typedef Fixed<4, US, SAT> sufixed4; typedef Fixed<5, US, SAT> sufixed5; typedef Fixed<6, US, SAT> sufixed6; typedef Fixed<7, US, SAT> sufixed7; typedef Fixed<8, US, SAT> sufixed8; typedef Fixed<9, US, SAT> sufixed9; typedef Fixed<10, US, SAT> sufixed10; typedef Fixed<11, US, SAT> sufixed11; typedef Fixed<12, US, SAT> sufixed12; typedef Fixed<13, US, SAT> sufixed13; typedef Fixed<14, US, SAT> sufixed14; typedef Fixed<15, US, SAT> sufixed15; typedef Fixed<16, US, SAT> sufixed16; typedef Fixed<17, US, SAT> sufixed17; typedef Fixed<18, US, SAT> sufixed18; typedef Fixed<19, US, SAT> sufixed19; typedef Fixed<20, US, SAT> sufixed20; typedef Fixed<21, US, SAT> sufixed21; typedef Fixed<22, US, SAT> sufixed22; typedef Fixed<23, US, SAT> sufixed23; typedef Fixed<24, US, SAT> sufixed24; typedef Fixed<25, US, SAT> sufixed25; typedef Fixed<26, US, SAT> sufixed26; typedef Fixed<27, US, SAT> sufixed27; typedef Fixed<28, US, SAT> sufixed28; typedef Fixed<29, US, SAT> sufixed29; typedef Fixed<30, US, SAT> sufixed30; typedef Fixed<31, US, SAT> sufixed31; typedef Fixed<32, US, SAT> sufixed32; typedef Fixed<33, US, SAT> sufixed33; typedef Fixed<34, US, SAT> sufixed34; typedef Fixed<35, US, SAT> sufixed35; typedef Fixed<36, US, SAT> sufixed36; typedef Fixed<37, US, SAT> sufixed37; typedef Fixed<38, US, SAT> sufixed38; typedef Fixed<39, US, SAT> sufixed39; typedef Fixed<40, US, SAT> sufixed40; typedef Fixed<41, US, SAT> sufixed41; typedef Fixed<42, US, SAT> sufixed42; typedef Fixed<43, US, SAT> sufixed43; typedef Fixed<44, US, SAT> sufixed44; typedef Fixed<45, US, SAT> sufixed45; typedef Fixed<46, US, SAT> sufixed46; typedef Fixed<47, US, SAT> sufixed47; typedef Fixed<48, US, SAT> sufixed48; typedef Fixed<49, US, SAT> sufixed49; typedef Fixed<50, US, SAT> sufixed50; typedef Fixed<51, US, SAT> sufixed51; typedef Fixed<52, US, SAT> sufixed52; typedef Fixed<53, US, SAT> sufixed53; typedef Fixed<54, US, SAT> sufixed54; typedef Fixed<55, US, SAT> sufixed55; typedef Fixed<56, US, SAT> sufixed56; typedef Fixed<57, US, SAT> sufixed57; typedef Fixed<58, US, SAT> sufixed58; typedef Fixed<59, US, SAT> sufixed59; typedef Fixed<60, US, SAT> sufixed60; typedef Fixed<61, US, SAT> sufixed61; typedef Fixed<62, US, SAT> sufixed62; typedef Fixed<63, US, SAT> sufixed63; typedef Fixed<64, US, SAT> sufixed64; // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Fixed<64, TC, WRAP>; //! \endcond } // namespace itpp #endif // #ifndef FIXED_H itpp-4.3.1/itpp/fixed/sources.mk000066400000000000000000000012451216575753400166030ustar00rootroot00000000000000h_fixed_sources = \ $(top_srcdir)/itpp/fixed/cfixed.h \ $(top_srcdir)/itpp/fixed/cfix.h \ $(top_srcdir)/itpp/fixed/fix_base.h \ $(top_srcdir)/itpp/fixed/fixed.h \ $(top_srcdir)/itpp/fixed/fix_factory.h \ $(top_srcdir)/itpp/fixed/fix_functions.h \ $(top_srcdir)/itpp/fixed/fix.h \ $(top_srcdir)/itpp/fixed/fix_operators.h cpp_fixed_sources = \ $(top_srcdir)/itpp/fixed/cfix.cpp \ $(top_srcdir)/itpp/fixed/cfixed.cpp \ $(top_srcdir)/itpp/fixed/fix_base.cpp \ $(top_srcdir)/itpp/fixed/fix.cpp \ $(top_srcdir)/itpp/fixed/fixed.cpp \ $(top_srcdir)/itpp/fixed/fix_factory.cpp \ $(top_srcdir)/itpp/fixed/fix_functions.cpp \ $(top_srcdir)/itpp/fixed/fix_operators.cpp itpp-4.3.1/itpp/itbase.h000066400000000000000000000073261216575753400151160ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ base module * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITBASE_H #define ITBASE_H /*! * \defgroup base Base Module * @{ */ //! \defgroup arr_vec_mat Array, Vector and Matrix Classes //! \defgroup parser Argument Parser /*! * \defgroup math Basic and Miscellaneous Math Functions * @{ */ //! \defgroup errorfunc Error Functions //! \defgroup hypfunc Hyperbolic Functions //! \defgroup logexpfunc Logarithmic and Exponential Functions //! \defgroup miscfunc Miscellaneous Functions //! \defgroup integration Numerical Integration //! \defgroup trifunc Trigonometric Functions /*! * @} end of math group */ //! \defgroup besselfunctions Bessel Functions //! \defgroup convertfunc Conversion Functions //! \defgroup diag Diagonal Matrices and Functions //! \defgroup errorhandlingfunc Error and Warning Handling //! \defgroup matrix_functions Functions on Matrices //! \defgroup itfile IT++ File Format /*! * \defgroup algebra Linear Algebra * @{ */ //! \defgroup determinant Determinant //! \defgroup inverse Inverse Matrix //! \defgroup matrixdecomp Matrix Decompositions //! \defgroup linearequations Solving Linear Equation Systems /*! * @} end of algebra group */ //! \defgroup randgen Random Number Generation //! \defgroup reshaping Reshaping of Vectors and Matrices //! \defgroup specmat Special Matrices //! \defgroup timers Timers /*! * @} end of base group */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif // #ifndef ITBASE_H itpp-4.3.1/itpp/itcomm.h000066400000000000000000000045421216575753400151340ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ communications module * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITCOMM_H #define ITCOMM_H /*! * \defgroup comm Communications Module * @{ */ //! \defgroup channels Channel Modeling //! \defgroup modulators Digital Modulation //! \defgroup fec Forward Error Correcting Codes //! \defgroup interl Interleavers //! \defgroup misccommfunc Miscellaneous Communications Functions //! \defgroup sequence Sequences /*! * @} */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif // #ifndef ITCOMM_H itpp-4.3.1/itpp/itexports.h.cmake000066400000000000000000000035041216575753400167610ustar00rootroot00000000000000/*! * \file * \brief Include file for exporting/importing IT++ library symbols * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITEXPORTS_H #define ITEXPORTS_H /*defined from cmake when using the shared version of IT++ library*/ #cmakedefine ITPP_SHARED_LIB /*needed to export shared library symbols on Windows*/ #if defined(ITPP_SHARED_LIB) && defined(_MSC_VER) #ifndef ITPP_EXPORT #if defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS) /*automatically defined by cmake*/ #define ITPP_EXPORT __declspec(dllexport) #else #define ITPP_EXPORT __declspec(dllimport) #endif #endif #endif #if (__GNUC__ >= 4) /*UNIX*/ #ifndef ITPP_EXPORT_TEMPLATE #define ITPP_EXPORT_TEMPLATE extern #endif #endif #ifndef ITPP_EXPORT #define ITPP_EXPORT #endif #ifndef ITPP_EXPORT_TEMPLATE #define ITPP_EXPORT_TEMPLATE #endif #endif itpp-4.3.1/itpp/itfixed.h000066400000000000000000000027721216575753400153030ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ fixed-point module * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITFIXED_H #define ITFIXED_H /*! * \defgroup fixed Fixed-point Module * @{ */ /*! * @} */ #include #include #include #include #include #include #include #include #include #endif // #ifndef ITFIXED_H itpp-4.3.1/itpp/itmex.h000066400000000000000000000666251216575753400150040ustar00rootroot00000000000000/*! * \file * \brief Conversion routines between IT++ and Matlab * \author Tony Ottosson and Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITMEX_H #define ITMEX_H #include #include namespace itpp { //-------------------------------------------------------- // mex -> it++ //-------------------------------------------------------- /*! \addtogroup mexfiles \brief Conversions between IT++ and Matlab for writing mex-files. \author Tony Ottosson and Pal Frenger These routines are used to help writng mex-files for speeding up matlab simulations. A simple mex-file that performs QPSK modulation is given below. \code #include #include using namespace itpp; void mexFunction(int n_output, mxArray *output[], int n_input, const mxArray *input[]) { // Check the number of inputs and output arguments if(n_output!=1) mexErrMsgTxt("Wrong number of output variables!"); if(n_input!=1) mexErrMsgTxt("Wrong number of input variables!"); // Convert input variables to IT++ format bvec input_bits = mxArray2bvec(input[0]); // ------------------ Start of routine --------------------------- cvec output_symbols; QPSK qpsk; output_symbols = qpsk.modulate_bits(input_bits); // ------------------ End of routine ----------------------------- // Create output vectors output[0] = mxCreateDoubleMatrix(1,output_symbols.size(), mxCOMPLEX); // Convert the IT++ format to Matlab format for output cvec2mxArray(output_symbols, output[0]); } \endcode */ /*! * \addtogroup mexfiles * @{ */ // -------------------------------------------------------- // mex -> IT++ // -------------------------------------------------------- //! Convert the matlab-format mxArray to bin bin mxArray2bin(const mxArray *in); //! Convert the matlab-format mxArray to short short mxArray2short(const mxArray *in); //! Convert the matlab-format mxArray to int int mxArray2int(const mxArray *in); //! Convert the matlab-format mxArray to double double mxArray2double(const mxArray *in); //! Convert the matlab-format mxArray to complex std::complex mxArray2double_complex(const mxArray *in); //! Convert the matlab-format mxArray to string std::string mxArray2string(const mxArray *in); //! Convert the matlab-format mxArray to bvec bvec mxArray2bvec(const mxArray *in); //! Convert the matlab-format mxArray to svec svec mxArray2svec(const mxArray *in); //! Convert the matlab-format mxArray to ivec ivec mxArray2ivec(const mxArray *in); //! Convert the matlab-format mxArray to vec vec mxArray2vec(const mxArray *in); //! Convert the matlab-format mxArray to cvec cvec mxArray2cvec(const mxArray *in); //! Convert the matlab-format mxArray to bmat bmat mxArray2bmat(const mxArray *in); //! Convert the matlab-format mxArray to smat smat mxArray2smat(const mxArray *in); //! Convert the matlab-format mxArray to imat imat mxArray2imat(const mxArray *in); //! Convert the matlab-format mxArray to mat mat mxArray2mat(const mxArray *in); //! Convert the matlab-format mxArray to cmat cmat mxArray2cmat(const mxArray *in); // -------------------------------------------------------- // IT++ -> mex // -------------------------------------------------------- //! Convert bin to the matlab-format mxArray void bin2mxArray(const bin &in, mxArray *out); //! Convert short to the matlab-format mxArray void short2mxArray(const short &in, mxArray *out); //! Convert int to the matlab-format mxArray void int2mxArray(const int &in, mxArray *out); //! Convert double to the matlab-format mxArray void double2mxArray(const double &in, mxArray *out); //! Convert complex to the matlab-format mxArray void double_complex2mxArray(const std::complex &in, mxArray *out); //! Convert string to the matlab-format mxArray void string2mxArray(const std::string &in, mxArray* &out); //! Convert bvec to the matlab-format mxArray void bvec2mxArray(const bvec &in, mxArray *out); //! Convert svec to the matlab-format mxArray void svec2mxArray(const svec &in, mxArray *out); //! Convert ivec to the matlab-format mxArray void ivec2mxArray(const ivec &in, mxArray *out); //! Convert vec to the matlab-format mxArray void vec2mxArray(const vec &in, mxArray *out); //! Convert cvec to the matlab-format mxArray void cvec2mxArray(const cvec &in, mxArray *out); //! Convert bmat to the matlab-format mxArray void bmat2mxArray(const bmat &in, mxArray *out); //! Convert smat to the matlab-format mxArray void smat2mxArray(const smat &in, mxArray *out); //! Convert imat to the matlab-format mxArray void imat2mxArray(const imat &in, mxArray *out); //! Convert mat to the matlab-format mxArray void mat2mxArray(const mat &in, mxArray *out); //! Convert cmat to the matlab-format mxArray void cmat2mxArray(const cmat &in, mxArray *out); // -------------------------------------------------------- // mex -> C // -------------------------------------------------------- //! Convert the matlab-format mxArray to C-format pointer to short void mxArray2Csvec(const mxArray *in, short *out); //! Convert the matlab-format mxArray to C-format pointer to int void mxArray2Civec(const mxArray *in, int *out); //! Convert the matlab-format mxArray to C-format pointer to double void mxArray2Cvec(const mxArray *in, double *out); //! Convert the matlab-format mxArray to C-format pointers to double (real and imaginary parts) void mxArray2Ccvec(const mxArray *in, double *out_real, double *out_imag); //! Convert the matlab-format mxArray to C-format pointer to pointer to short void mxArray2Csmat(const mxArray *in, short **out); //! Convert the matlab-format mxArray to C-format pointer to pointer to int void mxArray2Cimat(const mxArray *in, int **out); //! Convert the matlab-format mxArray to C-format pointer to pointer to double void mxArray2Cmat(const mxArray *in, double **out); //! Convert the matlab-format mxArray to C-format pointer to pointer to double (real and imaginary parts) void mxArray2Ccmat(const mxArray *in, double **out_real, double **out_imag); // -------------------------------------------------------- // C -> mex // -------------------------------------------------------- //! Convert C-format pointer to short to matlab-format mxArray void Csvec2mxArray(short *in, mxArray *out); //! Convert C-format pointer to int to matlab-format mxArray void Civec2mxArray(int *in, mxArray *out); //! Convert C-format pointer to double to matlab-format mxArray void Cvec2mxArray(double *in, mxArray *out); //! Convert C-format pointers to double (real and imaginary parts) to matlab-format mxArray void Ccvec2mxArray(double *in_real, double *in_imag, mxArray *out); //! Convert C-format pointer to pointer to short to matlab-format mxArray void Csmat2mxArray(short **in, mxArray *out); //! Convert C-format pointer to pointer to int to matlab-format mxArray void Cimat2mxArray(int **in, mxArray *out); //! Convert C-format pointer to pointer to double to matlab-format mxArray void Cmat2mxArray(double **in, mxArray *out); //! Convert C-format pointer to pointer to double (real and imaginary parts) to matlab-format mxArray void Ccmat2mxArray(double **in_real, double **in_imag, mxArray *out); /*! * @} */ bin mxArray2bin(const mxArray *in) { int size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2bin: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size != 1) mexErrMsgTxt("mxArray2bin: Size of data is not equal to one"); return (((*temp) > 0.0) ? bin(1) : bin(0)); } short mxArray2short(const mxArray *in) { int size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2short: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size != 1) mexErrMsgTxt("mxArray2short: Size of data is not equal to one"); return (short)(*temp); } int mxArray2int(const mxArray *in) { int size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2int: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size != 1) mexErrMsgTxt("mxArray2int: Size of data is not equal to one"); return (int)(*temp); } double mxArray2double(const mxArray *in) { int size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2double: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size != 1) mexErrMsgTxt("mxArray2double: Size of data is not equal to one"); return (*temp); } std::complex mxArray2double_complex(const mxArray *in) { int size; double* tempR = (double*) mxGetPr(in); double* tempI = (double*) mxGetPi(in); if ((tempR == 0) && (tempI == 0)) mexErrMsgTxt("mxArray2double_complex: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size != 1) mexErrMsgTxt("mxArray2double_complex: Size of data is not equal to one"); if (tempR == 0) { return std::complex(0.0 , (*tempI)); } else if (tempI == 0) { return std::complex((*tempR), 0.0); } else { return std::complex((*tempR), (*tempI)); } } std::string mxArray2string(const mxArray *in) { if (in == 0) mexErrMsgTxt("mxArray2string: Pointer to data is NULL"); std::string str = mxArrayToString(in); if (str.data() == 0) mexErrMsgTxt("mxArray2string: Could not convert mxArray to string"); return str; } bvec mxArray2bvec(const mxArray *in) { bvec out; int i, size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2bvec: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2bvec: Size of data is zero"); out.set_size(size, false); for (i = 0; i < size; i++) { out(i) = (((*temp++) > 1e-5) ? bin(1) : bin(0)); } return out; } svec mxArray2svec(const mxArray *in) { svec out; int i, size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2svec: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2svec: Size of data is zero"); out.set_size(size, false); for (i = 0; i < size; i++) { out(i) = (short)(*temp++); } return out; } ivec mxArray2ivec(const mxArray *in) { ivec out; int i, size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2ivec: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2ivec: Size of data is zero"); out.set_size(size, false); for (i = 0; i < size; i++) { out(i) = (int)(*temp++); } return out; } vec mxArray2vec(const mxArray *in) { vec out; int i, size; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2vec: Pointer to data is NULL"); size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2vec: Size of data is zero"); out.set_size(size, false); for (i = 0; i < size; i++) { out(i) = (*temp++); } return out; } cvec mxArray2cvec(const mxArray *in) { cvec out; int i, size; double* tempR = (double*) mxGetPr(in); double* tempI = (double*) mxGetPi(in); if ((tempR == 0) && (tempI == 0)) mexErrMsgTxt("mxArray2cvec: Pointer data is NULL"); size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2cvec: Size of data is zero"); out.set_size(size, false); if (tempR == 0) { for (i = 0; i < size; i++) { out(i) = std::complex(0.0, (*tempI++)); } } else if (tempI == 0) { for (i = 0; i < size; i++) { out(i) = std::complex((*tempR++), 0.0); } } else { for (i = 0; i < size; i++) { out(i) = std::complex((*tempR++), (*tempI++)); } } return out; } bmat mxArray2bmat(const mxArray *in) { bmat out; int r, c, rows, cols; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2bmat: Pointer to data is NULL"); rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2bmat: Data has zero rows"); cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2bmat: Data has zero columns"); out.set_size(rows, cols, false); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = (((*temp++) > 0.0) ? bin(1) : bin(0)); } } return out; } smat mxArray2smat(const mxArray *in) { smat out; int r, c, rows, cols; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2smat: Pointer to data is NULL"); rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2smat: Data has zero rows"); cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2smat: Data has zero columns"); out.set_size(rows, cols, false); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = (short)(*temp++); } } return out; } imat mxArray2imat(const mxArray *in) { imat out; int r, c, rows, cols; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2imat: Pointer to data is NULL"); rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2imat: Data has zero rows"); cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2imat: Data has zero columns"); out.set_size(rows, cols, false); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = (int)(*temp++); } } return out; } mat mxArray2mat(const mxArray *in) { mat out; int r, c, rows, cols; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2mat: Pointer to data is NULL"); rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2mat: Data has zero rows"); cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2mat: Data has zero columns"); out.set_size(rows, cols, false); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = (*temp++); } } return out; } cmat mxArray2cmat(const mxArray *in) { cmat out; int r, c, rows, cols; double* tempR = (double*) mxGetPr(in); double* tempI = (double*) mxGetPi(in); if ((tempR == 0) && (tempI == 0)) mexErrMsgTxt("mxArray2cmat: Pointer to data is NULL"); rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2cmat: Data has zero rows"); cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2cmat: Data has zero columns"); out.set_size(rows, cols, false); if (tempR == 0) { for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = std::complex(0.0 , (*tempI++)); } } } else if (tempI == 0) { for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = std::complex((*tempR++), 0.0); } } } else { for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out(r, c) = std::complex((*tempR++), (*tempI++)); } } } return out; } void double2mxArray(const double &in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("double2mxArray: Pointer to data is NULL"); *temp = (double) in; } void double_complex2mxArray(const std::complex &in, mxArray *out) { double* tempR = (double *) mxGetPr(out); double* tempI = (double *) mxGetPi(out); if (tempR == 0) mexErrMsgTxt("double_complex2mxArray: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("double_complex2mxArray: Pointer to imaginary valued part is NULL"); *tempR = (double) in.real(); *tempI = (double) in.imag(); } void string2mxArray(const std::string &in, mxArray* &out) { if (in.data() == 0) mexErrMsgTxt("string2mxArray: Pointer to string is NULL"); out = mxCreateString(in.data()); if (out == 0) mexErrMsgTxt("string2mxArray: Could not convert string to mxArray"); } void bvec2mxArray(const bvec &in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("bvec2mxArray: Pointer to data is NULL"); if (in.size() == 0) mexErrMsgTxt("bvec2mxArray: Size of data is zero"); for (int i = 0; i < in.size(); i++) { if (in(i)) *temp++ = 1.0; else *temp++ = 0.0; } } void ivec2mxArray(const ivec &in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("ivec2mxArray: Pointer to data is NULL"); if (in.size() == 0) mexErrMsgTxt("ivec2mxArray: Size of data is zero"); for (int i = 0; i < in.size(); i++) { *temp++ = (double) in(i); } } void vec2mxArray(const vec &in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("vec2mxArray: Pointer to data is NULL"); if (in.size() == 0) mexErrMsgTxt("vec2mxArray: Size of data is zero"); for (int i = 0; i < in.size(); i++) { *temp++ = (double) in(i); } } void cvec2mxArray(const cvec &in, mxArray *out) { double* tempR = (double *) mxGetPr(out); double* tempI = (double *) mxGetPi(out); if (tempR == 0) mexErrMsgTxt("cvec2mxArray: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("cvec2mxArray: Pointer to imaginary valued part is NULL"); if (in.size() == 0) mexErrMsgTxt("cvec2mxArray: Size of data is zero"); for (int i = 0; i < in.size(); i++) { *tempR++ = (double) in(i).real(); *tempI++ = (double) in(i).imag(); } } void bmat2mxArray(const bmat &in, mxArray *out) { int rows, cols, r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("bmat2mxArray: Pointer to data is NULL"); rows = in.rows(); cols = in.cols(); if (rows == 0) mexErrMsgTxt("bmat2mxArray: Data has zero rows"); if (cols == 0) mexErrMsgTxt("bmat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { if (in(r, c)) *temp++ = 1.0; else *temp++ = 0.0; } } } void smat2mxArray(const smat &in, mxArray *out) { int rows, cols, r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("smat2mxArray: Pointer to data is NULL"); rows = in.rows(); cols = in.cols(); if (rows == 0) mexErrMsgTxt("smat2mxArray: Data has zero rows"); if (cols == 0) mexErrMsgTxt("smat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *temp++ = (double) in(r, c); } } } void imat2mxArray(const imat &in, mxArray *out) { int rows, cols, r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("imat2mxArray: Pointer to data is NULL"); rows = in.rows(); cols = in.cols(); if (rows == 0) mexErrMsgTxt("imat2mxArray: Data has zero rows"); if (cols == 0) mexErrMsgTxt("imat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *temp++ = (double) in(r, c); } } } void mat2mxArray(const mat &in, mxArray *out) { int rows, cols, r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("mat2mxArray: Pointer to data is NULL"); rows = in.rows(); cols = in.cols(); if (rows == 0) mexErrMsgTxt("mat2mxArray: Data has zero rows"); if (cols == 0) mexErrMsgTxt("mat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *temp++ = in(r, c); } } } void cmat2mxArray(const cmat &in, mxArray *out) { int rows, cols, r, c; double* tempR = (double *) mxGetPr(out); double* tempI = (double *) mxGetPi(out); if (tempR == 0) mexErrMsgTxt("cvec2mxArray: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("cvec2mxArray: Pointer to imaginary valued part is NULL"); rows = in.rows(); cols = in.cols(); if (rows == 0) mexErrMsgTxt("cvec2mxArray: Data has zero rows"); if (cols == 0) mexErrMsgTxt("cvec2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *tempR++ = (double) in(r, c).real(); *tempI++ = (double) in(r, c).imag(); } } } void mxArray2Csvec(const mxArray *in, short *out) { double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2Csvec: Pointer to data is NULL"); int size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2Csvec: Size of data is zero"); for (int i = 0; i < size; i++) { out[i] = (short)(*temp++); } } void mxArray2Civec(const mxArray *in, int *out) { double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2Civec: Pointer to data is NULL"); int size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2Civec: Size of data is zero"); for (int i = 0; i < size; i++) { out[i] = (int)(*temp++); } } void mxArray2Cvec(const mxArray *in, double *out) { double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2Cvec: Pointer to data is NULL"); int size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2Cvec: Size of data is zero"); for (int i = 0; i < size; i++) { out[i] = (*temp++); } } void mxArray2Ccvec(const mxArray *in, double *out_real, double *out_imag) { double* tempR = (double*) mxGetPr(in); double* tempI = (double*) mxGetPi(in); if (tempR == 0) mexErrMsgTxt("mxArray2Ccvec: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("mxArray2Ccvec: Pointer to imaginary valued part is NULL"); int size = mxGetNumberOfElements(in); if (size == 0) mexErrMsgTxt("mxArray2Ccvec: Size of data is zero"); for (int i = 0; i < size; i++) { out_real[i] = (*tempR++); out_imag[i] = (*tempI++); } } void mxArray2Csmat(const mxArray *in, short **out) { int r, c; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2Csmat: Pointer to data is NULL"); int rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2Csmat: Data has zero rows"); int cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2Csmat: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out[r][c] = (short)(*temp++); } } } void mxArray2Cimat(const mxArray *in, int **out) { int r, c; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2Cimat: Pointer to data is NULL"); int rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2Cimat: Data has zero rows"); int cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2Cimat: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out[r][c] = (int)(*temp++); } } } void mxArray2Cmat(const mxArray *in, double **out) { int r, c; double* temp = (double*) mxGetPr(in); if (temp == 0) mexErrMsgTxt("mxArray2Cmat: Pointer to data is NULL"); int rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2Cmat: Data has zero rows"); int cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2Cmat: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out[r][c] = (*temp++); } } } void mxArray2Ccmat(const mxArray *in, double **out_real, double **out_imag) { int r, c; double* tempR = (double*) mxGetPr(in); double* tempI = (double*) mxGetPi(in); if (tempR == 0) mexErrMsgTxt("mxArray2Cmat: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("mxArray2Cmat: Pointer to imaginary valued part is NULL"); int rows = mxGetM(in); if (rows == 0) mexErrMsgTxt("mxArray2Cmat: Data has zero rows"); int cols = mxGetN(in); if (cols == 0) mexErrMsgTxt("mxArray2Cmat: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { out_real[r][c] = (*tempR++); out_imag[r][c] = (*tempI++); } } } void Csvec2mxArray(short *in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("Csvec2mxArray: Pointer to data is NULL"); int size = mxGetNumberOfElements(out); if (size == 0) mexErrMsgTxt("Csvec2mxArray: Size of data is zero"); for (int i = 0; i < size; i++) { *temp++ = (double) in[i]; } } void Civec2mxArray(int *in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("Civec2mxArray: Pointer to data is NULL"); int size = mxGetNumberOfElements(out); if (size == 0) mexErrMsgTxt("Civec2mxArray: Size of data is zero"); for (int i = 0; i < size; i++) { *temp++ = (double) in[i]; } } void Cvec2mxArray(double *in, mxArray *out) { double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("Cvec2mxArray: Pointer to data is NULL"); int size = mxGetNumberOfElements(out); if (size == 0) mexErrMsgTxt("Cvec2mxArray: Size of data is zero"); for (int i = 0; i < size; i++) { *temp++ = in[i]; } } void Ccvec2mxArray(double *in_real, double *in_imag, mxArray *out) { double* tempR = (double *) mxGetPr(out); double* tempI = (double *) mxGetPi(out); if (tempR == 0) mexErrMsgTxt("Ccvec2mxArray: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("Ccvec2mxArray: Pointer to imaginary valued part is NULL"); int size = mxGetNumberOfElements(out); if (size == 0) mexErrMsgTxt("Ccvec2mxArray: Size of data is zero"); for (int i = 0; i < size; i++) { *tempR++ = in_real[i]; *tempI++ = in_imag[i]; } } void Csmat2mxArray(short **in, mxArray *out) { int r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("Csmat2mxArray: Pointer to data is NULL"); int rows = mxGetM(out); if (rows == 0) mexErrMsgTxt("Csmat2mxArray: Data has zero rows"); int cols = mxGetN(out); if (cols == 0) mexErrMsgTxt("Csmat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *temp++ = (short) in[r][c]; } } } void Cimat2mxArray(int **in, mxArray *out) { int r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("Cimat2mxArray: Pointer to data is NULL"); int rows = mxGetM(out); if (rows == 0) mexErrMsgTxt("Cimat2mxArray: Data has zero rows"); int cols = mxGetN(out); if (cols == 0) mexErrMsgTxt("Cimat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *temp++ = (int) in[r][c]; } } } void Cmat2mxArray(double **in, mxArray *out) { int r, c; double* temp = (double *) mxGetPr(out); if (temp == 0) mexErrMsgTxt("Cmat2mxArray: Pointer to data is NULL"); int rows = mxGetM(out); if (rows == 0) mexErrMsgTxt("Cmat2mxArray: Data has zero rows"); int cols = mxGetN(out); if (cols == 0) mexErrMsgTxt("Cmat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *temp++ = in[r][c]; } } } void Ccmat2mxArray(double **in_real, double **in_imag, mxArray *out) { int r, c; double* tempR = (double *) mxGetPr(out); double* tempI = (double *) mxGetPi(out); if (tempR == 0) mexErrMsgTxt("Ccmat2mxArray: Pointer to real valued part is NULL"); if (tempI == 0) mexErrMsgTxt("Ccmat2mxArray: Pointer to imaginary valued part is NULL"); int rows = mxGetM(out); if (rows == 0) mexErrMsgTxt("Ccmat2mxArray: Data has zero rows"); int cols = mxGetN(out); if (cols == 0) mexErrMsgTxt("Ccmat2mxArray: Data has zero columns"); for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { *tempR++ = in_real[r][c]; *tempI++ = in_imag[r][c]; } } } } // namespace itpp #endif // #ifndef ITMEX_H itpp-4.3.1/itpp/itoptim.h000066400000000000000000000024551216575753400153320ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ optimization module * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITOPTIM_H #define ITOPTIM_H /*! * \defgroup optimization Numerical Optimization Module * @{ */ /*! * @} */ #include #include #endif // #ifndef ITOPTIM_H itpp-4.3.1/itpp/itprotocol.h000066400000000000000000000031421216575753400160350ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ protocols module * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITPROTOCOL_H #define ITPROTOCOL_H /*! * \defgroup protocol Protocols Module * @{ */ /*! * @} */ #include #include #include #include #include #include #include #include #include #include #endif // #ifndef ITPROTOCOL_H itpp-4.3.1/itpp/itsignal.h000066400000000000000000000041371216575753400154560ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ signal-processing module * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITSIGNAL_H #define ITSIGNAL_H /*! * \defgroup signal Signal Processing (SP) Module * @{ */ //! \defgroup detsource Deterministic Sources //! \defgroup fastica Fast Independent Component Analysis //! \defgroup filters Filtering //! \defgroup poly Polynomial Functions //! \defgroup resampling Resampling Functions //! \defgroup sigproc Miscellaneous SP Functions /*! * \defgroup transforms Transforms * @{ */ //! \defgroup dct Discrete Cosine Transform (DCT) //! \defgroup fft Fast Fourier Transform (FFT) //! \defgroup fht Fast Hadamard Transform (FHT) /*! * @} */ //! \defgroup windfunc Windowing /*! * @} */ #include #include #include #include #include #include #include #include #include #include #include #endif // #ifndef ITSIGNAL_H itpp-4.3.1/itpp/itsrccode.h000066400000000000000000000031501216575753400156150ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ source coding module * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITSRCCODE_H #define ITSRCCODE_H /*! * \defgroup srccode Source Coding Module * @{ */ //! \defgroup audio Audio //! \defgroup image Image Functions and Classes //! \defgroup lpc LPC-related Functions //! \defgroup sourcecoding Source Coding Routines /*! * @} */ #include #include #include #include #include #include #include #endif // #ifndef ITSRCCODE_H itpp-4.3.1/itpp/itstat.h000066400000000000000000000045401216575753400151520ustar00rootroot00000000000000/*! * \file * \brief Include file for the IT++ statistics module * \author Adam Piatyszek and Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef ITSTAT_H #define ITSTAT_H /*! * \defgroup stat Statistics Module * @{ */ //! \defgroup histogram Histogram //! \defgroup statistics Miscellaneous Statistics Functions /*! \defgroup MOG Mixture of Gaussians (MOG) \brief Classes and functions for modelling multivariate data as a Mixture of Gaussians \author Conrad Sanderson The following example shows how to model data: \code Array X; // ... fill X with vectors ... int K = 3; // specify the number of Gaussians int D = 10; // specify the dimensionality of vectors MOG_diag model(K,D); MOG_diag_kmeans(model, X, 10, 0.5, true, true); // initial optimisation using 10 iterations of k-means MOG_diag_ML(model, X, 10, 0.0, 0.0, true); // final optimisation using 10 iterations of ML version of EM double avg = model.avg_log_lhood(X); // find the average log likelihood of X \endcode See also the tutorial section for a more elaborate example. */ /*! * @} */ #include #include #include #include #include #include #include #endif // #ifndef ITSTAT_H itpp-4.3.1/itpp/optim/000077500000000000000000000000001216575753400146165ustar00rootroot00000000000000itpp-4.3.1/itpp/optim/Makefile.am000066400000000000000000000007261216575753400166570ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = liboptim.la if ENABLE_DEBUG noinst_LTLIBRARIES += liboptim_debug.la endif liboptim_la_SOURCES = $(h_optim_sources) $(cpp_optim_sources) liboptim_la_CXXFLAGS = $(CXXFLAGS_OPT) liboptim_debug_la_SOURCES = $(h_optim_sources) $(cpp_optim_sources) liboptim_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/optim pkginclude_HEADERS = $(h_optim_sources) itpp-4.3.1/itpp/optim/Makefile.in000066400000000000000000000521271216575753400166720ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = liboptim_debug.la subdir = itpp/optim ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) liboptim_la_LIBADD = am__objects_1 = am__objects_2 = liboptim_la-newton_search.lo am_liboptim_la_OBJECTS = $(am__objects_1) $(am__objects_2) liboptim_la_OBJECTS = $(am_liboptim_la_OBJECTS) liboptim_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(liboptim_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ liboptim_debug_la_LIBADD = am__objects_3 = liboptim_debug_la-newton_search.lo am_liboptim_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) liboptim_debug_la_OBJECTS = $(am_liboptim_debug_la_OBJECTS) liboptim_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(liboptim_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_liboptim_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(liboptim_la_SOURCES) $(liboptim_debug_la_SOURCES) DIST_SOURCES = $(liboptim_la_SOURCES) $(liboptim_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/optim ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_optim_sources = \ $(top_srcdir)/itpp/optim/newton_search.h cpp_optim_sources = \ $(top_srcdir)/itpp/optim/newton_search.cpp noinst_LTLIBRARIES = liboptim.la $(am__append_1) liboptim_la_SOURCES = $(h_optim_sources) $(cpp_optim_sources) liboptim_la_CXXFLAGS = $(CXXFLAGS_OPT) liboptim_debug_la_SOURCES = $(h_optim_sources) $(cpp_optim_sources) liboptim_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_optim_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/optim/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/optim/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done liboptim.la: $(liboptim_la_OBJECTS) $(liboptim_la_DEPENDENCIES) $(liboptim_la_LINK) $(liboptim_la_OBJECTS) $(liboptim_la_LIBADD) $(LIBS) liboptim_debug.la: $(liboptim_debug_la_OBJECTS) $(liboptim_debug_la_DEPENDENCIES) $(liboptim_debug_la_LINK) $(am_liboptim_debug_la_rpath) $(liboptim_debug_la_OBJECTS) $(liboptim_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboptim_debug_la-newton_search.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboptim_la-newton_search.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< liboptim_la-newton_search.lo: $(top_srcdir)/itpp/optim/newton_search.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboptim_la_CXXFLAGS) $(CXXFLAGS) -MT liboptim_la-newton_search.lo -MD -MP -MF $(DEPDIR)/liboptim_la-newton_search.Tpo -c -o liboptim_la-newton_search.lo `test -f '$(top_srcdir)/itpp/optim/newton_search.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/optim/newton_search.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboptim_la-newton_search.Tpo $(DEPDIR)/liboptim_la-newton_search.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/optim/newton_search.cpp' object='liboptim_la-newton_search.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboptim_la_CXXFLAGS) $(CXXFLAGS) -c -o liboptim_la-newton_search.lo `test -f '$(top_srcdir)/itpp/optim/newton_search.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/optim/newton_search.cpp liboptim_debug_la-newton_search.lo: $(top_srcdir)/itpp/optim/newton_search.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboptim_debug_la_CXXFLAGS) $(CXXFLAGS) -MT liboptim_debug_la-newton_search.lo -MD -MP -MF $(DEPDIR)/liboptim_debug_la-newton_search.Tpo -c -o liboptim_debug_la-newton_search.lo `test -f '$(top_srcdir)/itpp/optim/newton_search.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/optim/newton_search.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboptim_debug_la-newton_search.Tpo $(DEPDIR)/liboptim_debug_la-newton_search.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/optim/newton_search.cpp' object='liboptim_debug_la-newton_search.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboptim_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o liboptim_debug_la-newton_search.lo `test -f '$(top_srcdir)/itpp/optim/newton_search.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/optim/newton_search.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/optim/newton_search.cpp000066400000000000000000000366641216575753400202000ustar00rootroot00000000000000/*! * \file * \brief Newton Search optimization algorithms - source file * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { Newton_Search::Newton_Search() { method = BFGS; initial_stepsize = 1.0; stop_epsilon_1 = 1e-4; stop_epsilon_2 = 1e-8; max_evaluations = 100; f = NULL; df_dx = NULL; no_feval = 0; init = false; finished = false; trace = false; } void Newton_Search::set_function(double(*function)(const vec&)) { // Add checks to see that function is OK??? f = function; } void Newton_Search::set_gradient(vec(*gradient)(const vec&)) { // Add checks to see that function is OK??? df_dx = gradient; } void Newton_Search::set_start_point(const vec &x, const mat &D) { // check that parameters are valid??? x_start = x; n = x.size(); D_start = D; finished = false; init = true; } void Newton_Search::set_start_point(const vec &x) { // check that parameters are valid??? x_start = x; n = x.size(); D_start = eye(n); finished = false; init = true; } bool Newton_Search::search() { // Check parameters and function call ??? // check that x_start is a valid point, not a NaN and that norm(x0) is not inf it_assert(f != NULL, "Newton_Search: Function pointer is not set"); it_assert(df_dx != NULL, "Newton_Search: Gradient function pointer is not set"); it_assert(init, "Newton_Search: Starting point is not set"); F = f(x_start); // function initial value vec g = df_dx(x_start); // gradient initial value vec x = x_start; no_feval++; finished = false; // Initial inverse Hessian, D mat D = D_start; bool fst = true; // what is this??? bool stop = false; // Finish initialization no_iter = 0; ng = max(abs(g)); // norm(g,inf) double Delta = initial_stepsize; nh = 0; // what is this??? vec h; if (trace) { // prepare structures to store trace data x_values.set_size(max_evaluations); F_values.set_size(max_evaluations); ng_values.set_size(max_evaluations); Delta_values.set_size(max_evaluations); } Line_Search ls; ls.set_functions(f, df_dx); if (ng <= stop_epsilon_1) stop = true; else { h = zeros(n); nh = 0; ls.set_stop_values(0.05, 0.99); ls.set_max_iterations(5); ls.set_max_stepsize(2); } bool more = true; //??? while (!stop && more) { vec h, w, y, v; double yh, yv, a; // Previous values vec xp = x, gp = g; // double Fp = F; ### 2006-02-03 by ediap: Unused variable! double nx = norm(x); h = D * (-g); nh = norm(h); bool red = false; if (nh <= stop_epsilon_2*(stop_epsilon_2 + nx)) // stop criterion stop = true; else { if (fst || nh > Delta) { // Scale to ||h|| = Delta h = (Delta / nh) * h; nh = Delta; fst = false; red = true; } // Line search ls.set_start_point(x, F, g, h); more = ls.search(x, F, g); no_feval = no_feval + ls.get_no_function_evaluations(); if (more == false) { // something wrong in linesearch? x_end = x; return false; } else { if (ls.get_alpha() < 1) // Reduce Delta Delta = .35 * Delta; else if (red && (ls.get_slope_ratio() > .7)) // Increase Delta Delta = 3 * Delta; // Update ||g|| ng = max(abs(g)); // norm(g,inf); if (trace) { // store trace x_values(no_iter) = x; F_values(no_iter) = F; ng_values(no_iter) = ng; Delta_values(no_iter) = Delta; } no_iter++; h = x - xp; nh = norm(h); //if (nh == 0) // found = 4; //else { y = g - gp; yh = dot(y, h); if (yh > std::sqrt(eps) * nh * norm(y)) { // Update D v = D * y; yv = dot(y, v); a = (1 + yv / yh) / yh; w = (a / 2) * h - v / yh; D += outer_product(w, h) + outer_product(h, w); //D = D + w*h' + h*w'; } // update D // Check stopping criteria double thrx = stop_epsilon_2 * (stop_epsilon_2 + norm(x)); if (ng <= stop_epsilon_1) stop = true; // stop = 1, stop by small gradient else if (nh <= thrx) stop = true; // stop = 2, stop by small x-step else if (no_feval >= max_evaluations) stop = true; // stop = 3, number of function evaluations exeeded else Delta = std::max(Delta, 2 * thrx); //} found =4 } // Nonzero h } // nofail } // iteration // Set return values x_end = x; finished = true; if (trace) { // trim size of trace output x_values.set_size(no_iter, true); F_values.set_size(no_iter, true); ng_values.set_size(no_iter, true); Delta_values.set_size(no_iter, true); } return true; } bool Newton_Search::search(vec &xn) { bool state = search(); xn = get_solution(); return state; } bool Newton_Search::search(const vec &x0, vec &xn) { set_start_point(x0); bool state = search(); xn = get_solution(); return state; } vec Newton_Search::get_solution() { it_assert(finished, "Newton_Search: search is not run yet"); return x_end; } double Newton_Search::get_function_value() { if (finished) return F; else it_warning("Newton_Search::get_function_value, search has not been run"); return 0.0; } double Newton_Search::get_stop_1() { if (finished) return ng; else it_warning("Newton_Search::get_stop_1, search has not been run"); return 0.0; } double Newton_Search::get_stop_2() { if (finished) return nh; else it_warning("Newton_Search::get_stop_2, search has not been run"); return 0.0; } int Newton_Search::get_no_iterations() { if (finished) return no_iter; else it_warning("Newton_Search::get_no_iterations, search has not been run"); return 0; } int Newton_Search::get_no_function_evaluations() { if (finished) return no_feval; else it_warning("Newton_Search::get_no_function_evaluations, search has not been run"); return 0; } void Newton_Search::get_trace(Array & xvalues, vec &Fvalues, vec &ngvalues, vec &dvalues) { if (finished) { if (trace) { // trim size of trace output xvalues = x_values; Fvalues = F_values; ngvalues = ng_values; dvalues = Delta_values; } else it_warning("Newton_Search::get_trace, trace is not enabled"); } else it_warning("Newton_Search::get_trace, search has not been run"); } //================================== Line_Search ============================================= Line_Search::Line_Search() { method = Soft; if (method == Soft) { stop_rho = 1e-3; stop_beta = 0.99; } max_iterations = 10; max_stepsize = 10; f = NULL; df_dx = NULL; no_feval = 0; init = false; finished = false; trace = false; } void Line_Search::set_function(double(*function)(const vec&)) { // Add checks to see that function is OK??? f = function; } void Line_Search::set_gradient(vec(*gradient)(const vec&)) { // Add checks to see that function is OK??? df_dx = gradient; } void Line_Search::set_stop_values(double rho, double beta) { // test input values??? stop_rho = rho; stop_beta = beta; } void Line_Search::set_start_point(const vec &x, double F, const vec &g, const vec &h) { // check values ??? x_start = x; F_start = F; g_start = g; h_start = h; n = x.size(); finished = false; init = true; } void Line_Search::get_solution(vec &xn, double &Fn, vec &gn) { it_assert(finished, "Line_Search: search is not run yet"); xn = x_end; Fn = F_end; gn = g_end; } bool Line_Search::search() { it_assert(f != NULL, "Line_Search: Function pointer is not set"); it_assert(df_dx != NULL, "Line_Search: Gradient function pointer is not set"); it_assert(init, "Line_search: Starting point is not set"); // Default return values and simple checks x_end = x_start; F_end = F_start; g_end = g_start; // add some checks??? finished = false; vec g; // return parameters no_feval = 0; slope_ratio = 1; // Check descent condition double dF0 = dot(h_start, g_end); if (trace) { // prepare structures to store trace data alpha_values.set_size(max_iterations); F_values.set_size(max_iterations); dF_values.set_size(max_iterations); alpha_values(0) = 0; F_values(0) = F_end; dF_values(0) = dF0; } if (dF0 >= -10*eps*norm(h_start)*norm(g_end)) { // not significantly downhill if (trace) { // store trace alpha_values.set_size(1, true); F_values.set_size(1, true); dF_values.set_size(1, true); } return false; } // Finish initialization double F0 = F_start, slope0, slopethr; if (method == Soft) { slope0 = stop_rho * dF0; slopethr = stop_beta * dF0; } else { // exact line search slope0 = 0; slopethr = stop_rho * std::abs(dF0); } // Get an initial interval for am double a = 0, Fa = F_end, dFa = dF0; bool stop = false; double b = std::min(1.0, max_stepsize), Fb = 0, dFb = 0; while (!stop) { Fb = f(x_start + b * h_start); g = df_dx(x_start + b * h_start); // check if these values are OK if not return false??? no_feval++; dFb = dot(g, h_start); if (trace) { // store trace alpha_values(no_feval) = b; F_values(no_feval) = Fb; dF_values(no_feval) = dFb; } if (Fb < F0 + slope0*b) { // new lower bound alpha = b; slope_ratio = dFb / dF0; // info(2); if (method == Soft) { a = b; Fa = Fb; dFa = dFb; } x_end = x_start + b * h_start; F_end = Fb; g_end = g; if ((dFb < std::min(slopethr, 0.0)) && (no_feval < max_iterations) && (b < max_stepsize)) { // Augment right hand end if (method == Exact) { a = b; Fa = Fb; dFa = dFb; } if (2.5*b >= max_stepsize) b = max_stepsize; else b = 2 * b; } else stop = true; } else stop = true; } // phase 1: expand interval if (stop) // OK so far. Check stopping criteria stop = (no_feval >= max_iterations) || (b >= max_stepsize && dFb < slopethr) || (a > 0 && dFb >= slopethr); // Commented by ediap 2006-07-17: redundant check // || ( (method == Soft) && (a > 0 & dFb >= slopethr) ); // OK if (stop && trace) { alpha_values.set_size(no_feval, true); F_values.set_size(no_feval, true); dF_values.set_size(no_feval, true); } // Refine interval while (!stop) { double c, Fc, dFc; //c = interpolate(xfd,n); double C = Fb - Fa - (b - a) * dFa; if (C >= 5*n*eps*b) { double A = a - 0.5 * dFa * (sqr(b - a) / C); c = std::min(std::max(a + 0.1 * (b - a), A), b - 0.1 * (b - a)); // % Ensure significant resuction } else c = (a + b) / 2; Fc = f(x_start + c * h_start); g = df_dx(x_start + c * h_start); dFc = dot(g, h_start); // check these values??? no_feval++; if (trace) { // store trace alpha_values(no_feval) = c; F_values(no_feval) = Fc; dF_values(no_feval) = dFc; } if (method == Soft) { // soft line method if (Fc < F0 + slope0*c) { // new lower bound alpha = c; slope_ratio = dFc / dF0; x_end = x_start + c * h_start; F_end = Fc; g_end = g; a = c; Fa = Fc; dFa = dFc; // xfd(:,1) = xfd(:,3); stop = (dFc > slopethr); } else { // new upper bound b = c; Fb = Fc; dFb = dFc; // xfd(:,2) = xfd(:,3); } } else { // Exact line search if (Fc < F_end) { // better approximant alpha = c; slope_ratio = dFc / dF0; x_end = x_start + c * h_start; F_end = Fc; g_end = g; } if (dFc < 0) { // new lower bound a = c; Fa = Fc; dFa = dFc; // xfd(:,1) = xfd(:,3); } else { //new upper bound b = c; Fb = Fc; dFb = dFc; // xfd(:,2) = xfd(:,3); } stop = (std::abs(dFc) <= slopethr) | ((b - a) < stop_beta * b); } stop = (stop | (no_feval >= max_iterations)); } // refine finished = true; if (trace) { // store trace alpha_values.set_size(no_feval + 1, true); F_values.set_size(no_feval + 1, true); dF_values.set_size(no_feval + 1, true); } return true; } bool Line_Search::search(vec &xn, double &Fn, vec &gn) { bool state = search(); get_solution(xn, Fn, gn); return state; } bool Line_Search::search(const vec &x, double F, const vec &g, const vec &h, vec &xn, double &Fn, vec &gn) { set_start_point(x, F, g, h); bool state = search(); get_solution(xn, Fn, gn); return state; } double Line_Search::get_alpha() { if (finished) return alpha; else it_warning("Line_Search::get_alpha, search has not been run"); return 0.0; } double Line_Search::get_slope_ratio() { if (finished) return slope_ratio; else it_warning("Line_Search::get_slope_raio, search has not been run"); return 0.0; } int Line_Search::get_no_function_evaluations() { if (finished) return no_feval; else it_warning("Line_Search::get_no_function_evaluations, search has not been run"); return 0; } void Line_Search::set_max_iterations(int value) { it_assert(value > 0, "Line_Search, max iterations must be > 0"); max_iterations = value; } void Line_Search::set_max_stepsize(double value) { it_assert(value > 0, "Line_Search, max stepsize must be > 0"); max_stepsize = value; } void Line_Search::set_method(const Line_Search_Method &search_method) { method = search_method; if (method == Soft) { stop_rho = 1e-3; stop_beta = 0.99; } else { // exact line search method = Exact; stop_rho = 1e-3; stop_beta = 1e-3; } } void Line_Search::get_trace(vec &alphavalues, vec &Fvalues, vec &dFvalues) { if (finished) { if (trace) { // trim size of trace output alphavalues = alpha_values; Fvalues = F_values; dFvalues = dF_values; } else it_warning("Line_Search::get_trace, trace is not enabled"); } else it_warning("Line_Search::get_trace, search has not been run"); } // =========================== functions ============================================== vec fminunc(double(*function)(const vec&), vec(*gradient)(const vec&), const vec &x0) { Newton_Search newton; newton.set_functions(function, gradient); vec xn; newton.search(x0, xn); return xn; } } // namespace itpp itpp-4.3.1/itpp/optim/newton_search.h000066400000000000000000000246511216575753400176360ustar00rootroot00000000000000/*! * \file * \brief Newton Search optimization algorithms - header file * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef NEWTON_SEARCH_H #define NEWTON_SEARCH_H #include #include #include #include #include namespace itpp { /*! \brief Numerical optimization routines \addtogroup optimization */ //@{ //! Newton Search method enum Newton_Search_Method {BFGS}; /*! \brief Newton Search Newton or Quasi-Newton optimization method that try to minimize the objective function \f$f(\mathbf{x})\f$ given an initial guess \f$\mathbf{x}\f$. The search is stopped when either criterion 1: \f[ \left\| \mathbf{f}'(\mathbf{x})\right\|_{\infty} \leq \varepsilon_1 \f] or criterion 2: \f[ \left\| d\mathbf{x}\right\|_{2} \leq \varepsilon_2 (\varepsilon_2 + \| \mathbf{x} \|_{2} ) \f] is fulfilled. Another possibility is that the search is stopped when the number of function evaluations exceeds a threshold (100 per default). The default update rule for the inverse of the Hessian matrix is the BFGS algorithm with \f$\varepsilon_1 = 10^{-4}\f$ an \f$\varepsilon_2 = 10^{-8}\f$. */ class ITPP_EXPORT Newton_Search { public: //! Default constructor Newton_Search(); //! Destructor ~Newton_Search() {}; //! Set function pointer void set_function(double(*function)(const vec&)); //! Set gradient function pointer void set_gradient(vec(*gradient)(const vec&)); //! Set both function and gradient function pointers void set_functions(double(*function)(const vec&), vec(*gradient)(const vec&)) { set_function(function); set_gradient(gradient); } //! Set start point \c x for search and approx inverse Hessian at \c x void set_start_point(const vec &x, const mat &D); //! Set start point \c x for search void set_start_point(const vec &x); //! Get solution, function value and gradient at solution point vec get_solution(); //! Do the line search bool search(); //! Do the line search and return solution bool search(vec &xn); //! Set starting point, do the Newton search, and return the solution bool search(const vec &x0, vec &xn); //! Set stop criterion values void set_stop_values(double epsilon_1, double epsilon_2); //! Return stop value rho double get_epsilon_1() { return stop_epsilon_1; } //! Return stop value beta double get_epsilon_2() { return stop_epsilon_2; } //! Set max number of function evaluations void set_max_evaluations(int value); //! Return max number of function evaluations int get_max_evaluations() { return max_evaluations; } //! Set max stepsize void set_initial_stepsize(double value); //! Return max number of iterations double get_initial_stepsize() { return initial_stepsize; } //! Set Line search method void set_method(const Newton_Search_Method &method); //! get function value at solution point double get_function_value(); //! get value of stop criterion 1 at solution point double get_stop_1(); //! get value of stop criterion 2 at solution point double get_stop_2(); //! get number of iterations used to reach solution int get_no_iterations(); //! get number of function evaluations used to reach solution int get_no_function_evaluations(); //! enable trace mode void enable_trace() { trace = true; } //! disable trace void disable_trace() { trace = false; } /*! get trace outputs \c xvalues are the solutions of every iteration \c Fvalues are the function values \c ngvalues are the norm(gradient,inf) values \c dvalues are the delta values */ void get_trace(Array & xvalues, vec &Fvalues, vec &ngvalues, vec &dvalues); private: int n; // dimension of problem, size(x) double(*f)(const vec&); // function to minimize vec(*df_dx)(const vec&); // df/dx, gradient of f // start variables vec x_start; mat D_start; // solution variables vec x_end; // trace variables Array x_values; vec F_values, ng_values, Delta_values; Newton_Search_Method method; // Parameters double initial_stepsize; // opts(1) double stop_epsilon_1; // opts(2) double stop_epsilon_2; // opt(3) int max_evaluations; // opts(4) // output parameters int no_feval; // number of function evaluations int no_iter; // number of iterations double F, ng, nh; // function value, stop_1, stop_2 values at solution point bool init, finished, trace; }; //! Line Search method enum Line_Search_Method {Soft, Exact}; /*! \brief Line Search The line search try to minimize the objective function \f$f(\mathbf{x})\f$ along the direction \f$\mathbf{h}\f$ from the current position \f$\mathbf{x}\f$. Hence we look at \f[ \varphi(\alpha) = f(\mathbf{x} + \alpha \mathbf{h}) \f] and try to find an \f$\alpha_s\f$ that minimizes \f$f\f$. Two variants are used. Either the soft line search (default) or the exact line search. The soft line search stops when a point in the acceptable region is found, i.e. \f[ \phi(\alpha_s) \leq \varphi(0) + \alpha_s \rho \varphi'(0) \f] and \f[ \varphi'(\alpha_s) \geq \beta \varphi'(0),\: \rho < \beta \f] Default vales are \f$\rho = 10^{-3}\f$ and \f$\beta = 0.99\f$. The exact line search \f[ \| \varphi(\alpha_s)\| \leq \rho \| \varphi'(0) \| \f] and \f[ b-a \leq \beta b, \f] where \f$\left[a,b\right]\f$ is the current interval for \f$\alpha_s\f$. Default vales are \f$\rho = 10^{-3}\f$ and \f$\beta = 10^{-3}\f$. The exact line search can at least in theory give the exact resutl, but it may require many extra function evaluations compared to soft line search. */ class ITPP_EXPORT Line_Search { public: //! Default constructor Line_Search(); //! Destructor ~Line_Search() {}; //! Set function pointer void set_function(double(*function)(const vec&)); //! Set gradient function pointer void set_gradient(vec(*gradient)(const vec&)); //! Set both function and gradient function pointers void set_functions(double(*function)(const vec&), vec(*gradient)(const vec&)) { set_function(function); set_gradient(gradient); } //! Set start point for search void set_start_point(const vec &x, double F, const vec &g, const vec &h); //! Get solution, function value and gradient at solution point void get_solution(vec &xn, double &Fn, vec &gn); //! Do the line search bool search(); //! Do the line search and return solution bool search(vec &xn, double &Fn, vec &gn); //! Set starting point, do the line search, and return the solution bool search(const vec &x, double F, const vec &g, const vec &h, vec &xn, double &Fn, vec &gn); //! return alpha at solution point, xn = x + alpha h double get_alpha(); //! return the slope ratio at solution poin, xn double get_slope_ratio(); //! return number of function evaluations used in search int get_no_function_evaluations(); //! Set stop criterion values void set_stop_values(double rho, double beta); //! Return stop value rho double get_rho() { return stop_rho; } //! Return stop value beta double get_beta() { return stop_beta; } //! Set max number of iterations void set_max_iterations(int value); //! Return max number of iterations int get_max_iterations() { return max_iterations; } //! Set max stepsize void set_max_stepsize(double value); //! Return max number of iterations double get_max_stepsize() { return max_stepsize; } //! Set Line search method void set_method(const Line_Search_Method &method); //! enable trace mode void enable_trace() { trace = true; } //! disable trace void disable_trace() { trace = false; } /*! get trace outputs \c alphavalues are the solutions of every iteration \c Fvalues are the function values \c dFvalues */ void get_trace(vec &alphavalues, vec &Fvalues, vec &dFvalues); private: int n; // dimension of problem, size(x) double(*f)(const vec&); // function to minimize vec(*df_dx)(const vec&); // df/dx, gradient of f // start variables vec x_start, g_start, h_start; double F_start; // solution variables vec x_end, g_end; double F_end; // trace variables vec alpha_values, F_values, dF_values; bool init; // true if functions and starting points are set bool finished; // true if functions and starting points are set bool trace; // true if trace is enabled // Parameters Line_Search_Method method; double stop_rho; // opts(2) double stop_beta; // opts(3) int max_iterations; // opts(4) double max_stepsize; // opts(5) // output parameters double alpha; // end value of alpha, info(1) double slope_ratio; // slope ratio at xn, info(2) int no_feval; // info(3) }; /*! \brief Unconstrained minimization Unconstrained minimization using a Newton or Quasi-Newton optimization method that try to minimize the objective function \f$f(\mathbf{x})\f$ given an initial guess \f$\mathbf{x}\f$. The function and the gradient need to be known and supplied. The default algorithm is a Quasi-Newton search using BFGS updates of the inverse Hessian matrix. */ ITPP_EXPORT vec fminunc(double(*function)(const vec&), vec(*gradient)(const vec&), const vec &x0); //@} } // namespace itpp #endif // #ifndef NEWTON_SEARCH_H itpp-4.3.1/itpp/optim/sources.mk000066400000000000000000000002011216575753400166230ustar00rootroot00000000000000h_optim_sources = \ $(top_srcdir)/itpp/optim/newton_search.h cpp_optim_sources = \ $(top_srcdir)/itpp/optim/newton_search.cpp itpp-4.3.1/itpp/protocol/000077500000000000000000000000001216575753400153275ustar00rootroot00000000000000itpp-4.3.1/itpp/protocol/Makefile.am000066400000000000000000000007721216575753400173710ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libprotocol.la if ENABLE_DEBUG noinst_LTLIBRARIES += libprotocol_debug.la endif libprotocol_la_SOURCES = $(h_protocol_sources) $(cpp_protocol_sources) libprotocol_la_CXXFLAGS = $(CXXFLAGS_OPT) libprotocol_debug_la_SOURCES = $(h_protocol_sources) $(cpp_protocol_sources) libprotocol_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/protocol pkginclude_HEADERS = $(h_protocol_sources) itpp-4.3.1/itpp/protocol/Makefile.in000066400000000000000000001075211216575753400174020ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libprotocol_debug.la subdir = itpp/protocol ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libprotocol_la_LIBADD = am__objects_1 = am__objects_2 = libprotocol_la-events.lo \ libprotocol_la-front_drop_queue.lo \ libprotocol_la-packet_channel.lo \ libprotocol_la-packet_generator.lo \ libprotocol_la-selective_repeat.lo libprotocol_la-tcp.lo am_libprotocol_la_OBJECTS = $(am__objects_1) $(am__objects_2) libprotocol_la_OBJECTS = $(am_libprotocol_la_OBJECTS) libprotocol_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ libprotocol_debug_la_LIBADD = am__objects_3 = libprotocol_debug_la-events.lo \ libprotocol_debug_la-front_drop_queue.lo \ libprotocol_debug_la-packet_channel.lo \ libprotocol_debug_la-packet_generator.lo \ libprotocol_debug_la-selective_repeat.lo \ libprotocol_debug_la-tcp.lo am_libprotocol_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libprotocol_debug_la_OBJECTS = $(am_libprotocol_debug_la_OBJECTS) libprotocol_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libprotocol_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libprotocol_la_SOURCES) $(libprotocol_debug_la_SOURCES) DIST_SOURCES = $(libprotocol_la_SOURCES) \ $(libprotocol_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/protocol ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_protocol_sources = \ $(top_srcdir)/itpp/protocol/events.h \ $(top_srcdir)/itpp/protocol/front_drop_queue.h \ $(top_srcdir)/itpp/protocol/packet_channel.h \ $(top_srcdir)/itpp/protocol/packet_generator.h \ $(top_srcdir)/itpp/protocol/packet.h \ $(top_srcdir)/itpp/protocol/selective_repeat.h \ $(top_srcdir)/itpp/protocol/signals_slots.h \ $(top_srcdir)/itpp/protocol/tcp_client_server.h \ $(top_srcdir)/itpp/protocol/tcp.h cpp_protocol_sources = \ $(top_srcdir)/itpp/protocol/events.cpp \ $(top_srcdir)/itpp/protocol/front_drop_queue.cpp \ $(top_srcdir)/itpp/protocol/packet_channel.cpp \ $(top_srcdir)/itpp/protocol/packet_generator.cpp \ $(top_srcdir)/itpp/protocol/selective_repeat.cpp \ $(top_srcdir)/itpp/protocol/tcp.cpp noinst_LTLIBRARIES = libprotocol.la $(am__append_1) libprotocol_la_SOURCES = $(h_protocol_sources) $(cpp_protocol_sources) libprotocol_la_CXXFLAGS = $(CXXFLAGS_OPT) libprotocol_debug_la_SOURCES = $(h_protocol_sources) $(cpp_protocol_sources) libprotocol_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_protocol_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/protocol/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/protocol/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libprotocol.la: $(libprotocol_la_OBJECTS) $(libprotocol_la_DEPENDENCIES) $(libprotocol_la_LINK) $(libprotocol_la_OBJECTS) $(libprotocol_la_LIBADD) $(LIBS) libprotocol_debug.la: $(libprotocol_debug_la_OBJECTS) $(libprotocol_debug_la_DEPENDENCIES) $(libprotocol_debug_la_LINK) $(am_libprotocol_debug_la_rpath) $(libprotocol_debug_la_OBJECTS) $(libprotocol_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_debug_la-events.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_debug_la-front_drop_queue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_debug_la-packet_channel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_debug_la-packet_generator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_debug_la-selective_repeat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_debug_la-tcp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-events.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-front_drop_queue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-packet_channel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-packet_generator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-selective_repeat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-tcp.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libprotocol_la-events.lo: $(top_srcdir)/itpp/protocol/events.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_la-events.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-events.Tpo -c -o libprotocol_la-events.lo `test -f '$(top_srcdir)/itpp/protocol/events.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/events.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_la-events.Tpo $(DEPDIR)/libprotocol_la-events.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/events.cpp' object='libprotocol_la-events.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_la-events.lo `test -f '$(top_srcdir)/itpp/protocol/events.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/events.cpp libprotocol_la-front_drop_queue.lo: $(top_srcdir)/itpp/protocol/front_drop_queue.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_la-front_drop_queue.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-front_drop_queue.Tpo -c -o libprotocol_la-front_drop_queue.lo `test -f '$(top_srcdir)/itpp/protocol/front_drop_queue.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/front_drop_queue.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_la-front_drop_queue.Tpo $(DEPDIR)/libprotocol_la-front_drop_queue.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/front_drop_queue.cpp' object='libprotocol_la-front_drop_queue.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_la-front_drop_queue.lo `test -f '$(top_srcdir)/itpp/protocol/front_drop_queue.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/front_drop_queue.cpp libprotocol_la-packet_channel.lo: $(top_srcdir)/itpp/protocol/packet_channel.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_la-packet_channel.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-packet_channel.Tpo -c -o libprotocol_la-packet_channel.lo `test -f '$(top_srcdir)/itpp/protocol/packet_channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_channel.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_la-packet_channel.Tpo $(DEPDIR)/libprotocol_la-packet_channel.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/packet_channel.cpp' object='libprotocol_la-packet_channel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_la-packet_channel.lo `test -f '$(top_srcdir)/itpp/protocol/packet_channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_channel.cpp libprotocol_la-packet_generator.lo: $(top_srcdir)/itpp/protocol/packet_generator.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_la-packet_generator.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-packet_generator.Tpo -c -o libprotocol_la-packet_generator.lo `test -f '$(top_srcdir)/itpp/protocol/packet_generator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_generator.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_la-packet_generator.Tpo $(DEPDIR)/libprotocol_la-packet_generator.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/packet_generator.cpp' object='libprotocol_la-packet_generator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_la-packet_generator.lo `test -f '$(top_srcdir)/itpp/protocol/packet_generator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_generator.cpp libprotocol_la-selective_repeat.lo: $(top_srcdir)/itpp/protocol/selective_repeat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_la-selective_repeat.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-selective_repeat.Tpo -c -o libprotocol_la-selective_repeat.lo `test -f '$(top_srcdir)/itpp/protocol/selective_repeat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/selective_repeat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_la-selective_repeat.Tpo $(DEPDIR)/libprotocol_la-selective_repeat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/selective_repeat.cpp' object='libprotocol_la-selective_repeat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_la-selective_repeat.lo `test -f '$(top_srcdir)/itpp/protocol/selective_repeat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/selective_repeat.cpp libprotocol_la-tcp.lo: $(top_srcdir)/itpp/protocol/tcp.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_la-tcp.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-tcp.Tpo -c -o libprotocol_la-tcp.lo `test -f '$(top_srcdir)/itpp/protocol/tcp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/tcp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_la-tcp.Tpo $(DEPDIR)/libprotocol_la-tcp.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/tcp.cpp' object='libprotocol_la-tcp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_la-tcp.lo `test -f '$(top_srcdir)/itpp/protocol/tcp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/tcp.cpp libprotocol_debug_la-events.lo: $(top_srcdir)/itpp/protocol/events.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_debug_la-events.lo -MD -MP -MF $(DEPDIR)/libprotocol_debug_la-events.Tpo -c -o libprotocol_debug_la-events.lo `test -f '$(top_srcdir)/itpp/protocol/events.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/events.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_debug_la-events.Tpo $(DEPDIR)/libprotocol_debug_la-events.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/events.cpp' object='libprotocol_debug_la-events.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_debug_la-events.lo `test -f '$(top_srcdir)/itpp/protocol/events.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/events.cpp libprotocol_debug_la-front_drop_queue.lo: $(top_srcdir)/itpp/protocol/front_drop_queue.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_debug_la-front_drop_queue.lo -MD -MP -MF $(DEPDIR)/libprotocol_debug_la-front_drop_queue.Tpo -c -o libprotocol_debug_la-front_drop_queue.lo `test -f '$(top_srcdir)/itpp/protocol/front_drop_queue.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/front_drop_queue.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_debug_la-front_drop_queue.Tpo $(DEPDIR)/libprotocol_debug_la-front_drop_queue.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/front_drop_queue.cpp' object='libprotocol_debug_la-front_drop_queue.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_debug_la-front_drop_queue.lo `test -f '$(top_srcdir)/itpp/protocol/front_drop_queue.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/front_drop_queue.cpp libprotocol_debug_la-packet_channel.lo: $(top_srcdir)/itpp/protocol/packet_channel.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_debug_la-packet_channel.lo -MD -MP -MF $(DEPDIR)/libprotocol_debug_la-packet_channel.Tpo -c -o libprotocol_debug_la-packet_channel.lo `test -f '$(top_srcdir)/itpp/protocol/packet_channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_channel.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_debug_la-packet_channel.Tpo $(DEPDIR)/libprotocol_debug_la-packet_channel.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/packet_channel.cpp' object='libprotocol_debug_la-packet_channel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_debug_la-packet_channel.lo `test -f '$(top_srcdir)/itpp/protocol/packet_channel.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_channel.cpp libprotocol_debug_la-packet_generator.lo: $(top_srcdir)/itpp/protocol/packet_generator.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_debug_la-packet_generator.lo -MD -MP -MF $(DEPDIR)/libprotocol_debug_la-packet_generator.Tpo -c -o libprotocol_debug_la-packet_generator.lo `test -f '$(top_srcdir)/itpp/protocol/packet_generator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_generator.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_debug_la-packet_generator.Tpo $(DEPDIR)/libprotocol_debug_la-packet_generator.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/packet_generator.cpp' object='libprotocol_debug_la-packet_generator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_debug_la-packet_generator.lo `test -f '$(top_srcdir)/itpp/protocol/packet_generator.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/packet_generator.cpp libprotocol_debug_la-selective_repeat.lo: $(top_srcdir)/itpp/protocol/selective_repeat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_debug_la-selective_repeat.lo -MD -MP -MF $(DEPDIR)/libprotocol_debug_la-selective_repeat.Tpo -c -o libprotocol_debug_la-selective_repeat.lo `test -f '$(top_srcdir)/itpp/protocol/selective_repeat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/selective_repeat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_debug_la-selective_repeat.Tpo $(DEPDIR)/libprotocol_debug_la-selective_repeat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/selective_repeat.cpp' object='libprotocol_debug_la-selective_repeat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_debug_la-selective_repeat.lo `test -f '$(top_srcdir)/itpp/protocol/selective_repeat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/selective_repeat.cpp libprotocol_debug_la-tcp.lo: $(top_srcdir)/itpp/protocol/tcp.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libprotocol_debug_la-tcp.lo -MD -MP -MF $(DEPDIR)/libprotocol_debug_la-tcp.Tpo -c -o libprotocol_debug_la-tcp.lo `test -f '$(top_srcdir)/itpp/protocol/tcp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/tcp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libprotocol_debug_la-tcp.Tpo $(DEPDIR)/libprotocol_debug_la-tcp.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/protocol/tcp.cpp' object='libprotocol_debug_la-tcp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libprotocol_debug_la-tcp.lo `test -f '$(top_srcdir)/itpp/protocol/tcp.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/protocol/tcp.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/protocol/events.cpp000066400000000000000000000043331216575753400173420ustar00rootroot00000000000000/*! * \file * \brief Implementation of an event-based simulation class * \author Anders Persson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { Ttype Event_Queue::t = 0; unsigned long long int Base_Event::global_id = 0; std::priority_queue < Base_Event*, std::deque >, Compare_Base_Event_Times > Event_Queue::event_queue; bool Event_Queue::keep_running = false; void Event_Queue::add(Base_Event *e) { e->expire_t = t + e->delta_t; event_queue.push(e); } void Event_Queue::_run() { while (!event_queue.empty() && keep_running) { Base_Event* e = event_queue.top(); // Next event to process. event_queue.pop(); // Remove event. if (e->active) { // Only process active events. t = e->expire_t; // Update current time. e->exec(); // Execute the event. } delete e; // This event is history! } } void Event_Queue::start() { keep_running = true; _run(); } void Event_Queue::stop() { keep_running = false; } void Event_Queue::clear() { stop(); Base_Event* e; while (!event_queue.empty()) { e = event_queue.top(); delete e; event_queue.pop(); } t = 0; } // void Event_Queue::cancel_all(BaseSignal *s){ // } } // namespace itpp itpp-4.3.1/itpp/protocol/events.h000066400000000000000000000151601216575753400170070ustar00rootroot00000000000000/*! * \file * \brief Definitions of an event-based simulation class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef EVENTS_H #define EVENTS_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include #include namespace itpp { //! \addtogroup protocol //@{ // typedef long double Ttype; //!< 128-bit floating point time typedef double Ttype; //!< 64-bit floating point time // typedef long unsigned int Ttype; //!< 64-bit unsigned integer time class Event_Queue; class Base_Event; class Base_Signal; /*! \brief Base Event Class An abstract Base class of Events that can be used to derive new events. All Event classes need to define the exec() function which is called when the event expires. An event has an execution time and an id. */ class Base_Event { public: friend class Base_Signal; friend class Event_Queue; friend struct Compare_Base_Event_Times; //! Schedule an event at time \c delta_time from now Base_Event(const Ttype delta_time) { // The event will occur in 'delta_time' time units from now! it_assert(delta_time >= 0, "Only causal simulations are possible"); active = true; delta_t = delta_time; expire_t = 0; // Will be set correctly upon calling Event_Queue::add(). id = global_id++; } //! Destructor virtual ~Base_Event() {} //! Cancel an event void cancel() { active = false; } protected: //! ADD DOCUMENTATION HERE virtual void exec(void) = 0; //! ADD DOCUMENTATION HERE Ttype delta_t; //! ADD DOCUMENTATION HERE Ttype expire_t; //! ADD DOCUMENTATION HERE bool active; //! ADD DOCUMENTATION HERE unsigned long long int id; //! ADD DOCUMENTATION HERE static unsigned long long int global_id; }; //! Compare to events, Returns true if expire time of event1 is larger than the expire time of event2 struct Compare_Base_Event_Times { //! ADD DOCUMENTATION HERE bool operator()(Base_Event *event1, Base_Event *event2) { if (event1->expire_t == event2->expire_t) // Equal expire times. return (event1->id > event2->id); // Base comparison on the event id. else return (event1->expire_t > event2->expire_t); // Different expire times. Regular comparison. } }; /*! \brief Event Queue class A class for storing and executing events. Events can be added to the queue and when the start() is called all events will be executed. Observe that Events need to be created before they are added to the queue by calling an appropriate constructor. However, expired events are destroyed automatically (the destructor is called). */ class Event_Queue { public: friend class Base_Signal; //! Constructor Event_Queue() {} //! Destructor ~Event_Queue() {} //! Add event to Queue static void add(Base_Event *e); //! Return current time static Ttype now() {return t;} //! Start executing events static void start(); //! Stop execution of events static void stop(); //! Remove all events static void clear(); protected: //static void cancel_all(Base_Signal *s); private: typedef std::deque >::iterator Base_Event_Iterator; static void _run(); static bool keep_running; static Ttype t; // Current time. static std::priority_queue < Base_Event*, std::deque >, Compare_Base_Event_Times > event_queue; // Queue for the Events. }; /*! \brief An Event class that executes a function when the event expires. Since Events are objects you need supply both a pointer to the object and the function pointer to create the Event */ template class Event : public Base_Event { public: //! Construct an Event to expire delta_time from now by calling the function (*object_pointer.*object_function_pointer)() Event(ObjectType *object_pointer, void (ObjectType::*object_function_pointer)(), const Ttype delta_time) : Base_Event(delta_time) { po = object_pointer; pm = object_function_pointer; } //! Destructor virtual ~Event() {} //! Execute (call) the assigned function virtual void exec(void) {(*po.*pm)(); } private: void (ObjectType::*pm)(); // Pointer to class member function to be executed on event expire. ObjectType *po; // Pointer to object who's member function is to be executed on event expire. }; /*! \brief An Event class that executes a function with some data as input when the event expires. Since Events are objects you need supply both a pointer to the object and the function pointer to create the Event */ template class Data_Event : public Base_Event { public: //! Construct an Event to expire delta_time from now by calling the function (*object_pointer.*object_function_pointer)(data) Data_Event(ObjectType *object_pointer, void (ObjectType::*object_function_pointer)(DataType data), DataType data, const Ttype delta_time) : Base_Event(delta_time) { po = object_pointer; pm = object_function_pointer; u = data; } //! Destructor virtual ~Data_Event() {} //! Execute (call) the assigned function with user data. virtual void exec(void) { (*po.*pm)(u); } private: void (ObjectType::*pm)(DataType data); // Pointer to class member function to be executed on event expire. ObjectType* po; // Pointer to object who's member function is to be executed on event expire. DataType u; // User data. }; //@} } // namespace itpp #endif #endif // #ifndef EVENTS_H itpp-4.3.1/itpp/protocol/front_drop_queue.cpp000066400000000000000000000046071216575753400214220ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Front Drop Queue class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { void Front_Drop_Queue::push(Packet *packet) { if (debug) { std::cout << "Front_Drop_Queue::push_packet" // << " byte_size=" << packet->bit_size()/8 << " ptr=" << packet << " time=" << Event_Queue::now() << std::endl; } Packet *hol_packet; while ((!std::queue::empty()) && ((8*bytes_in_queue + packet->bit_size()) > 8*max_bytes_in_queue)) { hol_packet = std::queue::front(); Front_Drop_Queue::pop(); delete hol_packet; // TTCPPacket *tcp_packet = (TTCPPacket *) hol_packet; // delete tcp_packet; if (debug) { std::cout << "Link_With_Input_Q::received_packet, " << "Packet Dropped, buffer overflow." << std::endl; } } bytes_in_queue += packet->bit_size() / 8; std::queue::push(packet); } void Front_Drop_Queue::pop() { Packet *hol_packet; hol_packet = std::queue::front(); bytes_in_queue -= (hol_packet->bit_size() / 8); if (debug) { std::cout << "Front_Drop_Queue::pop_packet" << " ptr=" << hol_packet << " time=" << Event_Queue::now() << std::endl; } std::queue::pop(); } } // namespace itpp itpp-4.3.1/itpp/protocol/front_drop_queue.h000066400000000000000000000050731216575753400210650ustar00rootroot00000000000000/*! * \file * \brief Definitions of a Front Drop Queue class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FRONT_DROP_QUEUE_H #define FRONT_DROP_QUEUE_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include #include namespace itpp { //! \addtogroup protocol //@{ //! ADD DOCUMENTATION HERE #define DEFAULT_MAX_BYTES_IN_QUEUE 24000 //! ADD DOCUMENTATION HERE class Front_Drop_Queue : public virtual std::queue { public: //! ADD DOCUMENTATION HERE Front_Drop_Queue(const int max_bytes = DEFAULT_MAX_BYTES_IN_QUEUE) { max_bytes_in_queue = max_bytes; bytes_in_queue = 0; debug = false; } // TODO destructor // ~FrontDropQueue() { } //! ADD DOCUMENTATION HERE void set_debug(const bool enable_debug = true) { debug = enable_debug; } //! ADD DOCUMENTATION HERE void push(Packet *packet); //! ADD DOCUMENTATION HERE void pop(); //! ADD DOCUMENTATION HERE void set_max_byte_size(int max_bytes) { max_bytes_in_queue = max_bytes; } //! ADD DOCUMENTATION HERE int max_byte_size() { return max_bytes_in_queue; } //! ADD DOCUMENTATION HERE int byte_size() { return bytes_in_queue; } private: int max_bytes_in_queue; int bytes_in_queue; int debug; }; //@} } // namespace itpp #endif #endif // #ifndef FRONT_DROP_QUEUE_H itpp-4.3.1/itpp/protocol/packet.h000066400000000000000000000062471216575753400167600ustar00rootroot00000000000000/*! * \file * \brief Definition of a Packet class * \author Krister Norlund, Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PACKET_H #define PACKET_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include namespace itpp { //! \addtogroup protocol //@{ /*! ADD DOCUMENTATION HERE */ class Packet { public: //! ADD DOCUMENTATION HERE Packet(const int packet_size = 0) { set_bit_size(packet_size); } //! ADD DOCUMENTATION HERE virtual ~Packet() {} //! set size of packet in bits void set_bit_size(int packet_size) { it_assert(packet_size >= 0, "Packet size must be positive"); size_bits = packet_size; } //! get size of packet in bits int bit_size() { return size_bits; } private: int size_bits; // size of packet in bits }; /*! ADD DOCUMENTATION HERE */ class L3_Packet_Info { public: //! ADD DOCUMENTATION HERE L3_Packet_Info(Packet *packet) { timestamp = 0; pkt_pointer = packet; } //! ADD DOCUMENTATION HERE ~L3_Packet_Info() {} //! ADD DOCUMENTATION HERE Ttype timestamp; //! ADD DOCUMENTATION HERE Packet *pkt_pointer; }; /*! ADD DOCUMENTATION HERE */ class Link_Packet : public Packet { public: //! ADD DOCUMENTATION HERE Link_Packet(const int Seq_no, const unsigned long int Link_packet_id, L3_Packet_Info *Cp) { seq_no = Seq_no; link_packet_id = Link_packet_id; l3_pkt_info_p = Cp; } //! ADD DOCUMENTATION HERE ~Link_Packet() {} //! ADD DOCUMENTATION HERE unsigned long int link_packet_id; //! ADD DOCUMENTATION HERE int seq_no; //! ADD DOCUMENTATION HERE L3_Packet_Info *l3_pkt_info_p; }; /*! ADD DOCUMENTATION HERE */ class ACK : public Packet { public: //! ADD DOCUMENTATION HERE ACK(const int Seq_no = -1, const int Id = 0) { seq_no = Seq_no; id = Id; } //! ADD DOCUMENTATION HERE ~ACK() {} //! ADD DOCUMENTATION HERE int id; //! ADD DOCUMENTATION HERE int seq_no; }; //@} } // namespace itpp #endif #endif // #ifndef PACKET_H itpp-4.3.1/itpp/protocol/packet_channel.cpp000066400000000000000000000117631216575753400210020ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Packet channel class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { Packet_Channel::Packet_Channel() { parameters_ok = false; keep_running = false; } Packet_Channel::Packet_Channel(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots) { set_parameters(Pr, Delay, Block_rate, Max_slots); } Packet_Channel::~Packet_Channel() {} void Packet_Channel::set_parameters(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots) { it_assert(Delay >= 0, "Packet_Channel::set_parameters(): "); it_assert(Pr >= 0.0 && Pr <= 1.0, "Packet_Channel::set_parameters(): "); it_assert(Block_rate > 0, "Packet_Channel::set_parameters(): "); it_assert(Max_slots >= 0, "Packet_Channel::set_parameters(): "); delay = Delay; pr = Pr; block_time = 1.0 / Block_rate; max_slots = Max_slots; input.forward(this, &Packet_Channel::handle_input); nof_inputs.forward(this, &Packet_Channel::handle_nof_inputs); start.forward(this, &Packet_Channel::handle_start); keep_running = false; explicit_errors = false; K = 0; k = 0; parameters_ok = true; } void Packet_Channel::handle_input(Link_Packet* M) { it_assert(parameters_ok, "Packet_Channel::handle_input(): "); it_assert(M != NULL, "Packet_Channel::handle_input(): "); if (explicit_errors) { if (k < L) { lose = lost(k) == K; if (lose) k++; } K++; } else lose = randu() < pr; if (lose) { delete M; } else output(M, delay); lose = false; } void Packet_Channel::block_rate_loop() { it_assert(parameters_ok, "Packet_Channel::block_rate_loop(): "); get_nof_inputs(NULL); if (keep_running) Event_Queue::add(new Event(this, &Packet_Channel::block_rate_loop, block_time)); } void Packet_Channel::handle_start(const bool run) { it_assert(parameters_ok, "Packet_Channel::handle_start(): "); if (run && !keep_running)// Channel is in 'stop' state. Start it and keep running. Event_Queue::add(new Event(this, &Packet_Channel::block_rate_loop, block_time)); keep_running = run; } void Packet_Channel::handle_nof_inputs(const int Nof_ready_messages) { it_assert(Nof_ready_messages >= 0, "Packet_Channel::handle_nof_inputs(): "); int L = 0; if (max_slots > 0) L = std::min(Nof_ready_messages, round_i(randu() * max_slots)); else L = std::min(Nof_ready_messages, 1); if (L > 0) input_request(L); } void Packet_Channel::set_errors(const ivec &Lost) { L = Lost.length(); if (L > 0) { it_assert(min(Lost) >= 0, "Packet_Channel::set_errors(): "); lost = Lost; sort(lost); explicit_errors = true; } } // ----------------------------- Ack_Channel -------------------------------- ACK_Channel::ACK_Channel() { parameters_ok = false; } ACK_Channel::ACK_Channel(const double Pr, const Ttype Delay) { set_parameters(Pr, Delay); } ACK_Channel::~ACK_Channel() {} void ACK_Channel::set_parameters(const double Pr, const Ttype Delay) { it_assert(Delay >= 0, "ACK_Channel::set_parameters(): "); it_assert(Pr >= 0.0 && Pr <= 1.0, "ACK_Channel::set_parameters(): "); delay = Delay; pr = Pr; input.forward(this, &ACK_Channel::handle_input); explicit_errors = false; K = 0; k = 0; parameters_ok = true; } void ACK_Channel::handle_input(ACK* M) { it_assert(parameters_ok, "ACK_Channel::handle_input(): "); it_assert(M != NULL, "ACK_Channel::handle_input(): "); if (explicit_errors) { if (k < L) { lose = lost(k) == K; if (lose) k++; } K++; } else lose = randu() < pr; if (lose) delete M; else output(M, delay); lose = false; } void ACK_Channel::set_errors(const ivec& Lost) { L = Lost.length(); if (L > 0) { it_assert(min(Lost) >= 0, "ACK_Channel::set_errors(): "); lost = Lost; sort(lost); explicit_errors = true; } } } // namespace itpp itpp-4.3.1/itpp/protocol/packet_channel.h000066400000000000000000000067751216575753400204560ustar00rootroot00000000000000/*! * \file * \brief Definition of a Packet channel class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PACKET_CHANNEL_H #define PACKET_CHANNEL_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include namespace itpp { //! \addtogroup protocol //@{ //! ADD DOCUMENTATION HERE class Packet_Channel { public: //! ADD DOCUMENTATION HERE Packet_Channel(); //! ADD DOCUMENTATION HERE Packet_Channel(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots = 0); //! ADD DOCUMENTATION HERE ~Packet_Channel(); // -- Slots -- // //! ADD DOCUMENTATION HERE Slot start; //! ADD DOCUMENTATION HERE Slot input; //! ADD DOCUMENTATION HERE Slot nof_inputs; // -- Signals -- // //! ADD DOCUMENTATION HERE Signal output; //! ADD DOCUMENTATION HERE Signal input_request; //! ADD DOCUMENTATION HERE Signal get_nof_inputs; //! ADD DOCUMENTATION HERE void set_parameters(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots); //! ADD DOCUMENTATION HERE void set_errors(const ivec &Lost); private: void block_rate_loop(); void handle_input(Link_Packet* M); void handle_start(const bool start); void handle_nof_inputs(const int N); bool keep_running; bool parameters_ok; bool explicit_errors; bool lose; double pr; Ttype delay; double block_time; int max_slots; ivec lost; int k, K, L; }; //! ADD DOCUMENTATION HERE class ACK_Channel { public: //! ADD DOCUMENTATION HERE ACK_Channel(); //! ADD DOCUMENTATION HERE ACK_Channel(const double Pr, const Ttype Delay); //! ADD DOCUMENTATION HERE ~ACK_Channel(); // -- Slots -- // //! ADD DOCUMENTATION HERE Slot input; // -- Signals -- // //! ADD DOCUMENTATION HERE Signal output; //! ADD DOCUMENTATION HERE void set_parameters(const double Pr, const Ttype Delay); //! ADD DOCUMENTATION HERE void set_errors(const ivec& Lost); private: void handle_input(ACK* M); bool parameters_ok; bool explicit_errors; bool lose; double pr; Ttype delay; ivec lost; int k, K, L; }; //@} } // namespace itpp #endif #endif // #ifndef PACKET_CHANNEL_H itpp-4.3.1/itpp/protocol/packet_generator.cpp000066400000000000000000000131161216575753400213520ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Packet generator class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { Packet_Generator::Packet_Generator(const int Packet_size, const unsigned long int Max_packets) { keep_running = false; start.forward(this, &Packet_Generator::handle_start); next.forward(this, &Packet_Generator::handle_next); output.connect(&next); set_parameters(Packet_size, Max_packets); } Packet_Generator::~Packet_Generator() { } void Packet_Generator::set_parameters(const int Packet_size, const unsigned long int Max_packets) { it_assert(Packet_size > 0, "Packet_Generator::set_parameters(): "); packet_size = Packet_size; max_packets = Max_packets; id = 0; } int Packet_Generator::get_packet_size() { return packet_size; } int Packet_Generator::get_max_packets() { return max_packets; } void Packet_Generator::handle_next(Packet*) { if (keep_running) { output(new Packet(8*packet_size), delta_t()); id++; if (max_packets && id >= max_packets) start(false); } } void Packet_Generator::handle_start(const bool run) { if (run && !keep_running) { keep_running = run; handle_next(NULL); } keep_running = run; } // ---------------------------- Poisson_Packet_Generator ------------------------------------------------- Poisson_Packet_Generator::Poisson_Packet_Generator(const double Avg_bit_rate, const int Packet_size, const unsigned long int Max_packets): Packet_Generator(Packet_size, Max_packets) { set_parameters(Avg_bit_rate, Packet_size, Max_packets); } Poisson_Packet_Generator::~Poisson_Packet_Generator() {} void Poisson_Packet_Generator::set_parameters(const double Avg_bit_rate, const int Packet_size, const unsigned long int Max_packets) { Packet_Generator::set_parameters(Packet_size, Max_packets); it_assert(Avg_bit_rate > 0.0, "Packet_Generator::set_parameters(): "); avg_bit_rate = Avg_bit_rate; avg_delta_t = 8.0 * get_packet_size() / avg_bit_rate; ee.setup(1.0); } double Poisson_Packet_Generator::get_avg_bit_rate() { return avg_bit_rate; } Ttype Poisson_Packet_Generator::delta_t() { return ee()*avg_delta_t; } // ---------------------------- Constant_Rate_Packet_Generator ------------------------------------------------- Constant_Rate_Packet_Generator::Constant_Rate_Packet_Generator(const double Avg_rate, const int Packet_size, const unsigned long int Max_packets): Poisson_Packet_Generator(Avg_rate, Packet_size, Max_packets) {} Constant_Rate_Packet_Generator::~Constant_Rate_Packet_Generator() {} Ttype Constant_Rate_Packet_Generator::delta_t() { return avg_delta_t; } // ---------------------------- Burst_WWW_Packet_Generator ------------------------------------------------- Burst_WWW_Packet_Generator::Burst_WWW_Packet_Generator(const double Avg_bit_rate, const int Packet_size, const int Max_packets): Poisson_Packet_Generator(Avg_bit_rate, Packet_size, Max_packets) { Navg = 50; // Average number of packets per burst [packets]. Ti = 1.1960e-4; // Average inter-arrival time between packets in burst [s]. Tr = Navg * Packet_size * 8.0 / Avg_bit_rate - Ti * (Navg - 1); // Average time between bursts. N = 0; } Burst_WWW_Packet_Generator::~Burst_WWW_Packet_Generator() { } Ttype Burst_WWW_Packet_Generator::delta_t() { if (N == 0) { // Start of a new burst. N = Navg; N--; // First packet is triggered at ... return ee()*Tr; // ... start time of next burst. } else { // Within a burst. N--; // One packet less in the burst ... return ee()*Ti; // ... arrival time for next packet within the burst. } } // ----------------------------Sink ------------------------------------------------- Sink::Sink(const unsigned long int Max_packets) { it_assert(Max_packets > 0, "Sink::Sink(): "); max_packets = Max_packets; Ncp = 0; Nbytes = 0; packet_input.forward(this, &Sink::handle_packet_input); start_time = Event_Queue::now(); } Sink::~Sink() { std::cout << "Time = " << Event_Queue::now() << ", Sink : " << std::endl; std::cout << "Received " << Ncp << " packets in sequence." << std::endl; std::cout << "Receive average bit rate = " << Nbytes*8.0 / (Event_Queue::now() - start_time) << " [bits/second]." << std::endl; } void Sink::handle_packet_input(Packet *P) { it_assert(P != NULL, "Sink::handle_packet_input(): "); Ncp++; Nbytes += (P->bit_size() / 8); delete P; if (Ncp >= max_packets) { std::cout << "Time = " << Event_Queue::now() << ", Sink : " << std::endl; std::cout << "Simulation stopped because : Ncp > max_packets" << std::endl; Event_Queue::stop(); } } } // namespace itpp itpp-4.3.1/itpp/protocol/packet_generator.h000066400000000000000000000110741216575753400210200ustar00rootroot00000000000000/*! * \file * \brief Definition of a Packet generator class * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PACKET_GENERATOR_H #define PACKET_GENERATOR_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include namespace itpp { //! \addtogroup protocol //@{ /*! ADD DOCUMENTATION HERE */ class Packet_Generator { public: //! ADD DOCUMENTATION HERE Packet_Generator(const int Packet_size = 150, const unsigned long int Max_packets = 0); //! ADD DOCUMENTATION HERE virtual ~Packet_Generator(); //! ADD DOCUMENTATION HERE Signal output; //! ADD DOCUMENTATION HERE Slot start; //! ADD DOCUMENTATION HERE void set_parameters(const int Packet_size, const unsigned long int Max_packets); //! ADD DOCUMENTATION HERE int get_packet_size(); //! ADD DOCUMENTATION HERE int get_max_packets(); protected: //! ADD DOCUMENTATION HERE virtual Ttype delta_t() = 0; private: Slot next; void handle_next(Packet*); void handle_start(const bool run); bool keep_running; unsigned long int id; int packet_size; unsigned long int max_packets; }; /*! ADD DOCUMENTATION HERE */ class Poisson_Packet_Generator : public Packet_Generator { public: //! ADD DOCUMENTATION HERE Poisson_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const unsigned long int Max_packets = 0); //! ADD DOCUMENTATION HERE virtual ~Poisson_Packet_Generator(); //! ADD DOCUMENTATION HERE void set_parameters(const double Avg_bit_rate, const int Packet_size, const unsigned long int Max_packets); //! ADD DOCUMENTATION HERE double get_avg_bit_rate(); protected: //! ADD DOCUMENTATION HERE virtual Ttype delta_t(); //! ADD DOCUMENTATION HERE double avg_delta_t; //! ADD DOCUMENTATION HERE double avg_bit_rate; //! ADD DOCUMENTATION HERE Exponential_RNG ee; }; /*! ADD DOCUMENTATION HERE */ class Constant_Rate_Packet_Generator : public Poisson_Packet_Generator { public: //! ADD DOCUMENTATION HERE Constant_Rate_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const unsigned long int Max_packets = 0); //! ADD DOCUMENTATION HERE virtual ~Constant_Rate_Packet_Generator(); protected: //! ADD DOCUMENTATION HERE virtual Ttype delta_t(); }; /*! ADD DOCUMENTATION HERE */ class Burst_WWW_Packet_Generator : public Poisson_Packet_Generator { public: //! ADD DOCUMENTATION HERE Burst_WWW_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const int Max_packets = 0); //! ADD DOCUMENTATION HERE virtual ~Burst_WWW_Packet_Generator(); protected: //! ADD DOCUMENTATION HERE virtual Ttype delta_t(); //! ADD DOCUMENTATION HERE int N; //! ADD DOCUMENTATION HERE int Navg; //! ADD DOCUMENTATION HERE double Ti; //! ADD DOCUMENTATION HERE double Tr; }; /*! ADD DOCUMENTATION HERE */ class Sink { public: //! ADD DOCUMENTATION HERE Sink(const unsigned long int Max_packets = 1000); //! ADD DOCUMENTATION HERE ~Sink(); // -- Slots -- // //! ADD DOCUMENTATION HERE Slot packet_input; private: void handle_packet_input(Packet* packet); unsigned long int Ncp; unsigned long int Nbytes; unsigned long int max_packets; Ttype start_time; }; //@} } // namespace itpp #endif #endif // #ifndef PACKET_GENERATOR_H itpp-4.3.1/itpp/protocol/selective_repeat.cpp000066400000000000000000000365731216575753400213740ustar00rootroot00000000000000/*! * \file * \brief Implementation of Selective Repeat ARQ classes * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include //! \cond namespace itpp { bool in_sequence(const int a, const int b, const int L) { it_assert(a >= 0 && a < L, "in_sequence(): "); it_assert(b >= 0 && b < L, "in_sequence(): "); return ((b - a + L) % L) < L / 2; } Selective_Repeat_ARQ_Sender::Selective_Repeat_ARQ_Sender() { parameters_ok = false; packet_input.set_name("Selective_Repeat_ARQ_Sender packet_input Slot"); packet_input.forward(this, &Selective_Repeat_ARQ_Sender::handle_packet_input); ack_input.set_name("Selective_Repeat_ARQ_Sender ack_input Slot"); ack_input.forward(this, &Selective_Repeat_ARQ_Sender::handle_ack_input); query_nof_ready_packets.set_name("Selective_Repeat_ARQ_Sender query_nof_ready_packets Slot"); query_nof_ready_packets.forward(this, &Selective_Repeat_ARQ_Sender::handle_query_nof_ready_packets); packet_output_request.set_name("Selective_Repeat_ARQ_Sender packet_output_request Slot"); packet_output_request.forward(this, &Selective_Repeat_ARQ_Sender::handle_packet_output_request); } Selective_Repeat_ARQ_Sender::Selective_Repeat_ARQ_Sender(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out) { set_parameters(Seq_no_size, Buffer_size_factor, Link_packet_size, Time_out); packet_input.set_name("Selective_Repeat_ARQ_Sender packet_input Slot"); packet_input.forward(this, &Selective_Repeat_ARQ_Sender::handle_packet_input); ack_input.set_name("Selective_Repeat_ARQ_Sender ack_input Slot"); ack_input.forward(this, &Selective_Repeat_ARQ_Sender::handle_ack_input); query_nof_ready_packets.set_name("Selective_Repeat_ARQ_Sender query_nof_ready_packets Slot"); query_nof_ready_packets.forward(this, &Selective_Repeat_ARQ_Sender::handle_query_nof_ready_packets); packet_output_request.set_name("Selective_Repeat_ARQ_Sender packet_output_request Slot"); packet_output_request.forward(this, &Selective_Repeat_ARQ_Sender::handle_packet_output_request); } Selective_Repeat_ARQ_Sender::~Selective_Repeat_ARQ_Sender() { std::cout << "no_retransmit = " << no_retransmit << std::endl; } void Selective_Repeat_ARQ_Sender::set_parameters(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out) { it_assert((0 < Seq_no_size) && (Seq_no_size <= 30), "Selective_Repeat_ARQ_Sender::set_parameters(): "); it_assert((0 < Buffer_size_factor) && (Buffer_size_factor <= 10), "Selective_Repeat_ARQ_Sender::set_parameters(): "); it_assert(Link_packet_size > 0, "Selective_Repeat_ARQ_Sender::set_parameters(): "); it_assert(Time_out > 0, "Selective_Repeat_ARQ_Sender::set_parameters(): "); seq_no_size = Seq_no_size; link_packet_size = Link_packet_size; seq_no_max = 1 << Seq_no_size; input_buffer_size = seq_no_max * Buffer_size_factor; input_buffer.set_size(input_buffer_size); for (int l = 0; l < input_buffer_size; input_buffer(l++) = NULL); input_free_space = input_buffer_size; input_next = 0; tx_next = 0; tx_last = 0; time_out = Time_out; timer.set_size(seq_no_max); for (int l = 0; l < seq_no_max; timer(l++).forward(this, &Selective_Repeat_ARQ_Sender::retransmit)); outstanding = 0; seq_no = 0; output_indexes.set_size(seq_no_max); output_indexes.ones(); output_indexes *= -1; retransmission_indexes.set_size(seq_no_max); retransmission_indexes.ones(); retransmission_indexes *= -1; rd_pos = 0; rt_pos = 0; scheduled_total = 0; scheduled_retransmissions = 0; no_retransmit = 0; parameters_ok = true; ip_pkt_queue.set_max_byte_size(1500*32); id = 0; } void Selective_Repeat_ARQ_Sender::handle_ack_input(Array packet_array) { Packet *packet = packet_array(0); ACK *A = (ACK *) packet; it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::handle_ack_input(): "); it_assert(A, "Selective_Repeat_ARQ_Sender::handle_ack_input(): "); it_assert(A->seq_no >= 0 && A->seq_no < seq_no_max, "Selective_Repeat_ARQ_Sender::handle_ack_input(): "); if (outstanding) { if (in_sequence(tx_last % seq_no_max, A->seq_no, seq_no_max)) remove(A->seq_no); while (!input_buffer(tx_last) && outstanding) { outstanding--; input_free_space++; tx_last = (tx_last + 1) % input_buffer_size; } } delete A; fill_output(); } void Selective_Repeat_ARQ_Sender::handle_packet_input(Packet *packet) { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::handle_packet_input(): "); it_assert(packet, "Selective_Repeat_ARQ_Sender::handle_packet_input(): "); ip_pkt_queue.push(packet); } // The number of blocks in the ip_pkt_queue that can be scheduled to be // transmitted (in the tx buffer) int Selective_Repeat_ARQ_Sender::feasable_blocks() { div_t q = div(ip_pkt_queue.byte_size(), link_packet_size); int blocks_in_ip_queue = (q.rem) ? q.quot + 1 : q.quot; return std::min(free_sequence_numbers(), buffered_non_outstanding() + std::min(blocks_in_ip_queue, input_free_space)); } void Selective_Repeat_ARQ_Sender::handle_query_nof_ready_packets(void*) { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::handle_query_nof_ready_packets(): "); nof_ready_packets(scheduled_total + feasable_blocks()); } void Selective_Repeat_ARQ_Sender::handle_packet_output_request(const int nbr_blocks_requested) { int nbr_blocks_to_tx; int feasable_blks = feasable_blocks(); if (nbr_blocks_requested <= scheduled_total + feasable_blks) { nbr_blocks_to_tx = nbr_blocks_requested; } else { it_warning("Number of requested blocks is more than what is possible to transmitt"); nbr_blocks_to_tx = scheduled_total + feasable_blks; } //int nbr_ip_pkts_in_q = ip_pkt_queue.size(); while (nbr_blocks_to_tx > scheduled_total) { it_assert(!ip_pkt_queue.empty(), "Selective_Repeat_ARQ_Sender::handle_packet_output_request(): "); Packet *packet = ip_pkt_queue.front(); ip_pkt_queue.pop(); push_packet_on_tx_buffer(packet); } Array tmp; get_link_packets(nbr_blocks_requested, tmp); packet_output(tmp); } void Selective_Repeat_ARQ_Sender::push_packet_on_tx_buffer(Packet *packet) { L3_Packet_Info *pkt_info = new L3_Packet_Info(packet); int packet_byte_size = pkt_info->pkt_pointer->bit_size() / 8; int nbr_blocks = packet_byte_size / link_packet_size; if (nbr_blocks*link_packet_size != packet_byte_size) nbr_blocks++; if (input_free_space >= nbr_blocks) { pkt_info->timestamp = Event_Queue::now(); for (int n = nbr_blocks - 1; n >= 0; n--) { input_buffer(input_next) = new Link_Packet(-1, n, pkt_info); input_free_space--; input_next = (input_next + 1) % input_buffer_size; } } else { buffer_overflow(0); it_error("Selective_Repeat_ARQ_Sender::push_packet_on_tx_buffer(): " "Stopped due to buffer overflow"); } fill_output(); } void Selective_Repeat_ARQ_Sender::fill_output() { int packets_2_output = std::min(free_sequence_numbers(), buffered_non_outstanding()); while (packets_2_output) { input_buffer(tx_next)->seq_no = seq_no; outstanding++; schedule_output(tx_next, seq_no, false); seq_no = (seq_no + 1) % seq_no_max; tx_next = (tx_next + 1) % input_buffer_size; packets_2_output--; } } void Selective_Repeat_ARQ_Sender::schedule_output(const int Buffer_index, const int Sequence_number, const bool Retransmission) { it_assert(input_buffer(Buffer_index) != NULL, "Selective_Repeat_ARQ_Sender::schedule_output(): "); if (output_indexes(Sequence_number) == -1) scheduled_total++; output_indexes(Sequence_number) = Buffer_index; if (Retransmission) { if (retransmission_indexes(Sequence_number) != 1) // This is a new retransmission. scheduled_retransmissions++; retransmission_indexes(Sequence_number) = 1; // Mark packet (index) for retransmission. } else // Mark packet (index) for first time transmission. retransmission_indexes(Sequence_number) = 0; } void Selective_Repeat_ARQ_Sender::get_link_packets(const int K, Array &pa) { int packets_2_retransmit = std::min(K, scheduled_retransmissions); int new_packets_2_transmit = std::min(K, scheduled_total) - packets_2_retransmit; scheduled_retransmissions -= packets_2_retransmit; scheduled_total -= packets_2_retransmit + new_packets_2_transmit; pa.set_size(packets_2_retransmit + new_packets_2_transmit); int l = 0; while (packets_2_retransmit) { // Retransmissions have priority over ... if (retransmission_indexes(rt_pos) == 1) { timer(rt_pos).set(rt_pos, time_out); pa(l++) = (Packet *) new Link_Packet(*input_buffer(output_indexes(rt_pos))); output_indexes(rt_pos) = -1; retransmission_indexes(rt_pos) = -1; packets_2_retransmit--; } rt_pos = (rt_pos + 1) % seq_no_max; } while (new_packets_2_transmit) { // new packets. if (output_indexes(rd_pos) != -1) { timer(rd_pos).set(rd_pos, time_out); pa(l++) = (Packet *) new Link_Packet(*input_buffer(output_indexes(rd_pos))); output_indexes(rd_pos) = -1; new_packets_2_transmit--; } rd_pos = (rd_pos + 1) % seq_no_max; } } void Selective_Repeat_ARQ_Sender::remove(const int Sequence_number) { if (output_indexes(Sequence_number) != -1) { output_indexes(Sequence_number) = -1; scheduled_total--; if (retransmission_indexes(Sequence_number) == 1) scheduled_retransmissions--; retransmission_indexes(Sequence_number) = -1; } const int i = sequence_number_2_buffer_index(Sequence_number); if (input_buffer(i)) { timer(Sequence_number).cancel(); // Cancel the retransmission timer. it_assert(input_buffer(i)->seq_no == Sequence_number, "Selective_Repeat_ARQ_Sender::remove(): "); delete input_buffer(i); input_buffer(i) = NULL; } } void Selective_Repeat_ARQ_Sender::retransmit(const int Sequence_number) { no_retransmit++; const int buffer_index = sequence_number_2_buffer_index(Sequence_number); schedule_output(buffer_index, Sequence_number, true); } int Selective_Repeat_ARQ_Sender::buffered_non_outstanding() { return input_buffer_size - input_free_space - outstanding; } int Selective_Repeat_ARQ_Sender::free_sequence_numbers() { return seq_no_max / 2 - outstanding; } int Selective_Repeat_ARQ_Sender::sequence_number_2_buffer_index(const int Sequence_number) { it_assert(input_buffer(tx_last), "Selective_Repeat_ARQ_Sender::sequence_number_2_buffer_index(): "); it_assert(input_buffer(tx_last)->seq_no != -1, "Selective_Repeat_ARQ_Sender::sequence_number_2_buffer_index(): "); return (tx_last + (Sequence_number - input_buffer(tx_last)->seq_no + seq_no_max) % seq_no_max) % input_buffer_size; } int Selective_Repeat_ARQ_Sender::link_packets_buffered() { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::link_packets_buffered(): "); return input_buffer_size - input_free_space; } int Selective_Repeat_ARQ_Sender::nof_ready_link_packets() { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::nof_ready_link_packets(): "); return scheduled_total + feasable_blocks(); } int Selective_Repeat_ARQ_Sender::link_packets_queued_waiting_for_transmission() { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::link_packets_queued_waiting_for_transmission(): "); div_t q = div(ip_pkt_queue.byte_size(), link_packet_size); int blocks_in_ip_queue = (q.rem) ? q.quot + 1 : q.quot; return buffered_non_outstanding() + scheduled_total + blocks_in_ip_queue; } // int Selective_Repeat_ARQ_Sender::time_stamp_HOL_packet(){ // assert(parameters_ok); // return buffered_non_outstanding()+feasable_blocks(); // } int Selective_Repeat_ARQ_Sender::buffer_size() { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::buffer_size(): "); return input_buffer_size; } Ttype Selective_Repeat_ARQ_Sender::link_packets_max_queuing_time() { it_assert(parameters_ok, "Selective_Repeat_ARQ_Sender::link_packets_max_queuing_time(): "); it_assert(input_buffer(tx_last), "Selective_Repeat_ARQ_Sender::link_packets_max_queuing_time(): "); return Event_Queue::now() - input_buffer(tx_last)->l3_pkt_info_p->timestamp; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Selective_Repeat_ARQ_Receiver::Selective_Repeat_ARQ_Receiver() { parameters_ok = false; packet_input.forward(this, &Selective_Repeat_ARQ_Receiver::handle_packet_input); packet_input.set_name("Selective_Repeat_ARQ_Receiver packet_input Slot"); } Selective_Repeat_ARQ_Receiver::Selective_Repeat_ARQ_Receiver(const int Seq_no_size) { set_parameters(Seq_no_size); packet_input.forward(this, &Selective_Repeat_ARQ_Receiver::handle_packet_input); packet_input.set_name("Selective_Repeat_ARQ_Receiver packet_input Slot"); } Selective_Repeat_ARQ_Receiver::~Selective_Repeat_ARQ_Receiver() {} void Selective_Repeat_ARQ_Receiver::set_parameters(const int Seq_no_size) { seq_no_size = Seq_no_size; seq_no_max = 1 << seq_no_size; rx_buffer.set_size(seq_no_max); for (int l = 0; l < seq_no_max; rx_buffer(l++) = NULL); Rnext = 0; id = 0; parameters_ok = true; } void Selective_Repeat_ARQ_Receiver::handle_packet_input(Array packet_array) { it_assert(parameters_ok, "Selective_Repeat_ARQ_Receiver::handle_packet_input(): "); int nbr_pkts = packet_array.length(); Link_Packet *packet; for (int i = 0;i < nbr_pkts;i++) { packet = (Link_Packet *) packet_array(i); it_assert(packet, "Selective_Repeat_ARQ_Receiver::handle_packet_input(): "); it_assert(packet->seq_no >= 0 && packet->seq_no < seq_no_max, "Selective_Repeat_ARQ_Receiver::handle_packet_input(): "); Array ack_pkt; ack_pkt.set_size(1); ack_pkt(0) = (Packet *) new ACK(packet->seq_no, id++); ack_output(ack_pkt); // Acknowledge the receipt of this packet. if (in_sequence(Rnext, packet->seq_no, seq_no_max) && !rx_buffer(packet->seq_no)) // Is this a new packet in-sequence packet? rx_buffer(packet->seq_no) = packet; // This is a new in-sequence packet. else // This either is a duplicate packet or an out-of-sequence packet. delete packet; while (rx_buffer(Rnext)) { // Is there an unbroken sequence of packets that we can output? if (rx_buffer(Rnext)->link_packet_id == 0) { packet_output(rx_buffer(Rnext)->l3_pkt_info_p->pkt_pointer); delete rx_buffer(Rnext)->l3_pkt_info_p; } delete rx_buffer(Rnext); rx_buffer(Rnext) = NULL; Rnext = (Rnext + 1) % seq_no_max; } } } } //namespace itpp //! \endcond itpp-4.3.1/itpp/protocol/selective_repeat.h000066400000000000000000000135431216575753400210310ustar00rootroot00000000000000/*! * \file * \brief Definitions of Selective Repeat ARQ classes * \author Anders Persson and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SELECTIVE_REPEAT_H #define SELECTIVE_REPEAT_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include #include #include namespace itpp { //! \addtogroup protocol //@{ /*! ADD DOCUMENTATION HERE */ class Selective_Repeat_ARQ_Sender { public: //! ADD DOCUMENTATION HERE Selective_Repeat_ARQ_Sender(); //! ADD DOCUMENTATION HERE Selective_Repeat_ARQ_Sender(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out); //! ADD DOCUMENTATION HERE ~Selective_Repeat_ARQ_Sender(); //! ADD DOCUMENTATION HERE void set_parameters(const int Seq_no_size, // # bits in sequence no. const int Buffer_size_factor, // Link-packet buffer size = 2^(Seq_no_size)*Buffer_size_factor. const int Link_packet_size, // Size of the link packets in bytes. const Ttype Time_out); // Idle time before retransmission. // -- Slots -- // Slot packet_input; //!< Receives incoming packets. Slot > ack_input; //!< Receives incoming ack/nacks. Slot query_nof_ready_packets; //!< Receives incoming query for number of packets ready to transmit. Slot packet_output_request; //!< Receives incoming packet output requests. // -- Signals -- // Signal > packet_output; //!< Delivers transmitted packets. Signal nof_ready_packets; //!< Delivers no ready packets. Signal buffer_overflow; //!< Signals buffer overflows. //! ADD DOCUMENTATION HERE int buffer_size(); //! ADD DOCUMENTATION HERE int link_packets_buffered(); //! ADD DOCUMENTATION HERE int nof_ready_link_packets(); //! ADD DOCUMENTATION HERE int link_packets_queued_waiting_for_transmission(); //! ADD DOCUMENTATION HERE Ttype link_packets_max_queuing_time(); //! ADD DOCUMENTATION HERE void get_link_packets(const int K, Array &pa); private: void handle_ack_input(Array packet_array); // Take care of incomming ack/nacks. void handle_packet_input(Packet *P); // Take care of incomming packets. void handle_packet_output_request(int K); // Take care of incomming packet requests. void handle_query_nof_ready_packets(void*); // Take care of incomming query for number of packets ready to transmit. void retransmit(int Sequence_number); // Take care of incomming query for number of packets ready to transmit. void remove(const int Sequence_number); void push_packet_on_tx_buffer(Packet *packet); int buffered_non_outstanding(); int free_sequence_numbers(); int sequence_number_2_buffer_index(const int Sequence_number); void schedule_output(const int Buffer_index, const int Sequence_number, const bool Retransmission); void cancel_output(const int Sequence_number); void fill_output(); int feasable_blocks(); bool parameters_ok; Front_Drop_Queue ip_pkt_queue; Array input_buffer; int input_buffer_size; int input_next; int input_free_space; int seq_no_size; int seq_no; int seq_no_max; int tx_next; int tx_last; int outstanding; int id; Ttype time_out; Array > timer; ivec output_indexes; ivec retransmission_indexes; int rd_pos; int rt_pos; int scheduled_total; int scheduled_retransmissions; int no_retransmit; int link_packet_size; }; /*! ADD DOCUMENTATION HERE */ class Selective_Repeat_ARQ_Receiver { public: //! ADD DOCUMENTATION HERE Selective_Repeat_ARQ_Receiver(); //! ADD DOCUMENTATION HERE Selective_Repeat_ARQ_Receiver(const int Seq_no_size); //! ADD DOCUMENTATION HERE ~Selective_Repeat_ARQ_Receiver(); // -- Slots -- // Slot > packet_input; //!< Receives incoming packets. // -- Signals -- // Signal > ack_output; //!< Delivers ack. Signal packet_output; //!< Delivers received packets. //! ADD DOCUMENTATION HERE void set_parameters(const int Seq_no_size); // # bits in sequence no. private: bool greater_modulo_L(const int a, const int b); void handle_packet_input(Array); // Take care of incomming packets. int seq_no_size; int seq_no_max; Array rx_buffer; int Rnext; int id; bool parameters_ok; }; //@} } // namespace itpp #endif #endif // #ifndef SELECTIVE_REPEAT_H itpp-4.3.1/itpp/protocol/signals_slots.h000066400000000000000000000356631216575753400204010ustar00rootroot00000000000000/*! * \file * \brief Definitions of Signals and Slots classes * \author Anders Persson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SIGNAL_SLOT_H #define SIGNAL_SLOT_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include #include #include namespace itpp { //! \addtogroup protocol //@{ class Base_Signal; template class Signal; template class Base_Slot; template class Slot; /*! \brief Signals and slots A simple example where to objects A and B are communicating through signals and slots. Each object has one signal and one slot. The A_signal is used to send a signal to the B_slot and vice versa. When a signal is received by the B_slot it is forwarded to the function forward(). The class definition includes the definition of the signals, slots and forward functions including a name and the type of data to transmit. \code #include "signals_slots.h" class A; class B; class A { public: A(){ A_slot.forward(this, &A::member); A_signal.set_name("A_signal"); A_signal.set_debug(true); A_slot.set_name("A_slot"); N = 10; } Signal A_signal; Slot A_slot; private: int N; void member(const double x) { if(N) A_signal.arm(3.4, N--); } }; class B { public: B(){ B_slot.forward(this, &B::member); B_signal.set_name("B_signal"); B_signal.set_debug(); B_slot.set_name("B_slot"); } Signal B_signal; Slot B_slot; private: void member(const int k){ B_signal.arm(23.2, M_PI); } }; int main(){ A a; // class A does not know anything about class B. B b; // class B does not know anything about class A. a.A_signal.connect(&b.B_slot); // Connect a to b. b.B_signal.connect(&a.A_slot); // Connect b to a. a.A_signal.arm(56.2, 3); // First event in 56.2 seconds carrying data = 3 Event_Queue::start(); // start the event-based simulation } \endcode */ template class Signal { public: friend class Base_Slot; //! Default constructor Signal(const std::string signal_name = "Unamed Signal", const bool single_shot = false, const bool enable_debug = false); // Signal(const std::string signal_name = "Unamed Signal", const bool single_shot = false, const bool enable_debug = true); //! Destructor ~Signal(); //! Connect a slot to the signal void connect(Base_Slot* slot); //! Disconnect the slot from the signal void disconnect(Base_Slot* slot = NULL); // Base_Event* arm(const Ttype delta_time, DataType signal); // Signal will trigger in 'delta_time' time units carrying data signal. //! Issue a signal Base_Event* operator()(DataType signal, const Ttype delta_time = 0); //! cancel signal void cancel(); //! set name of signal void set_name(const std::string &signal_name); //! Set debug mode. If true all signals are printed to stdout void set_debug(const bool enable_debug = true); //! ADD DOCUMENTATION HERE void trigger(DataType u); protected: //! ADD DOCUMENTATION HERE typedef typename std::list*, std::allocator< Base_Slot* > >::iterator Base_Slot_Iterator; //! ADD DOCUMENTATION HERE void _disconnect(Base_Slot* slot); //! ADD DOCUMENTATION HERE std::list*, std::allocator* > > connected_slots; //! ADD DOCUMENTATION HERE std::string name; private: bool armed; bool debug; bool single; Data_Event *e; }; /*! \brief Base Slot class */ template class Base_Slot { public: friend class Signal; //! Default Constructor Base_Slot(const std::string slot_name = "Unamed Base_Slot"); //! Desctuctor virtual ~Base_Slot(); //! set slot name void set_name(const std::string &slot_name); //! ADD DOCUMENTATION HERE virtual void operator()(DataType signal) = 0; protected: // virtual void exec(DataType signal) = 0; //! ADD DOCUMENTATION HERE typedef typename std::list*, std::allocator< Signal* > >::iterator Signal_Iterator; //! ADD DOCUMENTATION HERE std::string name; //! ADD DOCUMENTATION HERE void _connect(Signal* signal); //! ADD DOCUMENTATION HERE void _disconnect(Signal* signal); //! ADD DOCUMENTATION HERE std::list*, std::allocator* > > connected_signals; }; /*! \brief Slot Class */ template class Slot : public Base_Slot { public: //! Default constructor Slot(const std::string _name = "Unamed Slot"); //! ADD DOCUMENTATION HERE void forward(ObjectType *object_pointer, void(ObjectType::*object_function_pointer)(DataType u)); //! Destructor ~Slot(); //! ADD DOCUMENTATION HERE void operator()(DataType u); //void exec(DataType signal); private: ObjectType *po; void(ObjectType::*pm)(DataType signal); }; /*! */ template class ATimer { public: //! Default constructor ATimer(const std::string Name = "Unamed ATimer") { time_out_signal = new Signal(Name, true); time_out_slot = new Slot(Name); time_out_signal->connect(time_out_slot); set_name(Name); } //! ADD DOCUMENTATION HERE void forward(ObjectType *po, void(ObjectType::*pm)(DataType u)) { time_out_slot->forward(po, pm); } //! ADD DOCUMENTATION HERE void set(DataType u, const Ttype delta_t) { time_out_signal->operator()(u, delta_t); } //! ADD DOCUMENTATION HERE void cancel() { time_out_signal->cancel(); } //! ADD DOCUMENTATION HERE void set_name(const std::string Name) { name = Name; time_out_signal->set_name(name); time_out_slot->set_name(name); } protected: //! ADD DOCUMENTATION HERE std::string name; private: Signal *time_out_signal; Slot *time_out_slot; }; /*! TTimer is a class that can be set in order to be remembered at a future instance of time. The difference to "generic event" is the easy usage that already take care about posting and canceling events @ingroup EventHandling */ template class TTimer { public: //! Default constructor TTimer(THandler & handler, void (THandler::*handlerFunction)(Ttype time)) : signal("timer_signal", true) { fPending = false; fExpirationTime = 0; registered_handler = &handler; registered_handler_function = handlerFunction; slot.forward(this, &TTimer::HandleProcessEvent); slot.set_name("timer_slot"); signal.set_debug(false); signal.connect(&slot); } //! Destructor virtual ~TTimer() { if (fPending) signal.cancel(); } //! ADD DOCUMENTATION HERE void Set(Ttype time, bool relative = true) { if (fPending) signal.cancel(); fPending = true; double current_time = Event_Queue::now(); double delta_time; if (relative) { fExpirationTime = current_time + time; delta_time = time; } else { fExpirationTime = time; delta_time = time - current_time; } signal(fExpirationTime, delta_time); } //! ADD DOCUMENTATION HERE void Reset() { if (fPending) { signal.cancel(); fPending = false; // TODO: Added this myself. Didn't work otherwise. } } //! ADD DOCUMENTATION HERE Ttype ExpirationTime() const { it_assert(fPending, "TTimer<>::ExpirationTime: timer not set"); return fExpirationTime; } //! ADD DOCUMENTATION HERE bool IsPending() const { return fPending; } protected: //! ADD DOCUMENTATION HERE virtual void HandleProcessEvent(Ttype currentTime) { fPending = false; (*registered_handler.*registered_handler_function)(currentTime); } //! ADD DOCUMENTATION HERE virtual void HandleCancelEvent(Ttype) { if (fPending) signal.cancel(); fPending = false; } //! Flag denoting if timer is set bool fPending; //! ADD DOCUMENTATION HERE Ttype fExpirationTime; private: THandler *registered_handler; void(THandler::*registered_handler_function)(Ttype expiry_time); Signal signal; // Used internally Slot slot; // Used internally }; // ----------------------------------------------------------------------------------------------- template Signal::Signal(const std::string signal_name, const bool single_shot, const bool enable_debug) { armed = false; e = NULL; single = single_shot; set_name(signal_name); set_debug(enable_debug); } template Signal::~Signal() { Base_Slot_Iterator begin = connected_slots.begin(), end = connected_slots.end(), i; for (i = begin; i != end; i++) (*i)->_disconnect(this); connected_slots.clear(); if (e != NULL) // Cancel a possibly pending event since we are about to die! e->cancel(); } template void Signal::set_name(const std::string &signal_name) { name = signal_name; } template void Signal::set_debug(const bool enable_debug) { debug = enable_debug; } template void Signal::connect(Base_Slot* slot) { Base_Slot_Iterator begin = connected_slots.begin(), end = connected_slots.end(), i; bool is_already_connected = false; for (i = begin; i != end; i++) if ((*i) == slot) is_already_connected = true; if (!is_already_connected) { // Multiple connections is meaningless. connected_slots.push_back(slot); slot->_connect(this); // Needed if a connected slot is deleted during run time. } else { std::cout << "Signal '" << name << "' and Slot '" << slot->name << "' are already connected. Multiple connections have no effect!" << std::endl; } } template void Signal::disconnect(Base_Slot* slot) { Base_Slot_Iterator begin = connected_slots.begin(), end = connected_slots.end(), i; for (i = begin; i != end; i++) if ((*i) == slot) { (*i)->_disconnect(this); connected_slots.erase(i); break; } } template Base_Event* Signal::operator()(DataType signal, const Ttype delta_time) { // Signal will trigger in 'delta_time' time units. if (single) { // We are operating in single-shot mode. if (armed) { // Cancel and schedule again with the new 'delta_time'. if (debug) std::cout << "Warning: Changing time for Signal '" << name << "'." << std::endl; cancel(); operator()(signal, delta_time); } else { e = new Data_Event(this, &Signal::trigger, signal, delta_time); armed = true; Event_Queue::add(e); } } else { // Continious mode (cancel() has no effect). e = new Data_Event(this, &Signal::trigger, signal, delta_time); armed = true; Event_Queue::add(e); } return e; } template void Signal::cancel() { if (armed && single) { e->cancel(); e = NULL; armed = false; } } template void Signal::trigger(DataType u) { armed = false; e = NULL; Base_Slot_Iterator begin = connected_slots.begin(), end = connected_slots.end(), i; for (i = begin; i != end; i++) { // Execute all the functions of the connected slots. if (debug) std::cout << "Time = " << Event_Queue::now() << ". Signal '" << name << "' was sent to Slot '" << (*i)->name << "'." << std::endl; (*i)->operator()(u); } } template void Signal::_disconnect(Base_Slot* slot) { Base_Slot_Iterator begin = connected_slots.begin(), end = connected_slots.end(), i; for (i = begin; i != end; i++) if ((*i) == slot) { connected_slots.erase(i); break; } } template Base_Slot::Base_Slot(const std::string slot_name) { set_name(slot_name); } template void Base_Slot::set_name(const std::string &slot_name) { name = slot_name; } template Base_Slot::~Base_Slot() { // Notify all signals connect that we are being deleted ... Signal_Iterator begin = connected_signals.begin(), end = connected_signals.end(), i; for (i = begin; i != end; i++) (*i)->_disconnect(this); connected_signals.clear(); } template void Base_Slot::_connect(Signal* signal) { // A signal is being connected to us. connected_signals.push_back(signal); } template void Base_Slot::_disconnect(Signal* signal) { // A signal is being disconnected from us. Signal_Iterator begin = connected_signals.begin(), end = connected_signals.end(), i; for (i = begin; i != end; i++) if ((*i) == signal) { connected_signals.erase(i); break; } } template Slot::Slot(const std::string slot_name) : Base_Slot(slot_name) { pm = NULL; po = NULL; } template Slot::~Slot() {} template void Slot::forward(ObjectType *object_pointer, void(ObjectType::*object_function_pointer)(DataType u)) { pm = object_function_pointer; po = object_pointer; } // template // void Slot::exec(DataType signal){ // if(pm&&po) // (*po.*pm)(signal); // } template void Slot::operator()(DataType signal) { if (pm&&po) (*po.*pm)(signal); } //@} } // namespace itpp #endif #endif // #ifndef SIGNAL_SLOT_H itpp-4.3.1/itpp/protocol/sources.mk000066400000000000000000000013511216575753400173430ustar00rootroot00000000000000h_protocol_sources = \ $(top_srcdir)/itpp/protocol/events.h \ $(top_srcdir)/itpp/protocol/front_drop_queue.h \ $(top_srcdir)/itpp/protocol/packet_channel.h \ $(top_srcdir)/itpp/protocol/packet_generator.h \ $(top_srcdir)/itpp/protocol/packet.h \ $(top_srcdir)/itpp/protocol/selective_repeat.h \ $(top_srcdir)/itpp/protocol/signals_slots.h \ $(top_srcdir)/itpp/protocol/tcp_client_server.h \ $(top_srcdir)/itpp/protocol/tcp.h cpp_protocol_sources = \ $(top_srcdir)/itpp/protocol/events.cpp \ $(top_srcdir)/itpp/protocol/front_drop_queue.cpp \ $(top_srcdir)/itpp/protocol/packet_channel.cpp \ $(top_srcdir)/itpp/protocol/packet_generator.cpp \ $(top_srcdir)/itpp/protocol/selective_repeat.cpp \ $(top_srcdir)/itpp/protocol/tcp.cpp itpp-4.3.1/itpp/protocol/tcp.cpp000066400000000000000000001501171216575753400166260ustar00rootroot00000000000000/*! * \file * \brief Implementation of Transport Control Protocol (TCP) * \author Krister Norlund * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * Copyright (c) 2000-2004 IKR (formerly IND), University of Stuttgart * This file is part of the IKR (formerly IND) TCP Library. */ #include #include #include #include #include //! \cond #ifdef _MSC_VER #pragma warning(disable:4355) #endif namespace itpp { // -------------------- Default parameters ---------------------------------- // TCP sender and receiver #define TCP_HEADERLENGTH 40 // TCP sender #define TCP_VERSION kReno #define TCP_SMSS 1460 #define TCP_INITIALCWNDREL 2 // related to MSS #define TCP_INITIALSSTHRESHREL 1 // related to MaxCWnd #define TCP_MAXCWNDREL 32 // related to MSS #define TCP_DUPACKS 3 #define TCP_INITIALRTT 1 const double TCP_STIMERGRAN = 0.2; const double TCP_SWSATIMERVALUE = 0.2; #define TCP_MAXBACKOFF 64 const double TCP_MAXRTO = std::numeric_limits::max(); #define TCP_IMMEDIATEBACKOFFRESET false #define TCP_TIMESTAMPS false #define TCP_KARN true #define TCP_NAGLE false #define TCP_GOBACKN true #define TCP_FLIGHTSIZERECOVERY false #define TCP_RENOCONSERVATION true #define TCP_CAREFULSSTHRESHREDUCTION true #define TCP_IGNOREDUPACKONTORECOVERY true #define TCP_CAREFULMULFASTRTXAVOIDANCE true #define TCP_RESTARTAFTERIDLE true // TCP receiver #define TCP_RMSS 1460 const int TCP_BUFFERSIZE = std::numeric_limits::max() / 4; #define TCP_DELAYEDACK true const double TCP_ACKDELAYTIME = 0.2; #define TCP_SENDPERIODICACKS false #define TCP_STRICTPERIODICACKS false #define TCP_PERIODICACKINTERVAL 1 #define TCP_ACKSCHEDULINGDELAY 0 #define TCP_ACKBUFFERWRITE false #define TCP_ACKBUFFERREAD true const int TCP_MAXUSERBLOCKSIZE = std::numeric_limits::max() / 4; #define TCP_MINUSERBLOCKSIZE 1 #define TCP_USERBLOCKPROCDELAY 0 // TCP generator #define TCPGEN_BLOCKSIZE 1460 // TCP applications #define TCPAPP_MAXNOOFACTIVEAPPS 500 #define TCPAPP_DISTSTATARRAYSIZE 100 #define TCPAPP_DISTSTATMAXGOODPUT 1000 #define TCPAPP_DISTSTATMAXTRANSFERTIME 10000 #define TCPAPP_CONDMEANSTATARRAYSIZE 100 #define TCPAPP_CONDMEANSTATMAXREQSIZE 100000 inline int min(int opd1, int opd2) { return (opd1 < opd2) ? opd1 : opd2; } inline int max(int opd1, int opd2) { return (opd1 > opd2) ? opd1 : opd2; } // round is used to map a double value (e.g. RTO in TTCPSender) to the // next higher value of a certain granularity (e.g. timer granularity). inline double round(const double value, const double granularity) { return (std::ceil(value / granularity) * granularity); } // -------------------- TCP_Segment ---------------------------------------- TCP_Segment::TCP_Segment() : seq_begin(), seq_end() { } TCP_Segment::TCP_Segment(const Sequence_Number &sn_begin, const Sequence_Number &sn_end) : seq_begin(sn_begin), seq_end(sn_end) { it_assert(seq_begin <= seq_end, "TCP_Segment::TCP_Segment, end byte " + to_str(seq_end.value()) + " < begin byte " + to_str(seq_begin.value())); } TCP_Segment::TCP_Segment(const TCP_Segment &segment) : seq_begin(segment.seq_begin), seq_end(segment.seq_end) { } TCP_Segment &TCP_Segment::operator=(const TCP_Segment &segment) { this->seq_begin = segment.seq_begin; this->seq_end = segment.seq_end; return *this; } void TCP_Segment::combine(const TCP_Segment &segment) { it_assert(can_be_combined(segment), "TCP_Segment::CombineWith, segments cannot be combined"); seq_begin = min(seq_begin, segment.seq_begin); seq_end = max(seq_end, segment.seq_end); } std::ostream & operator<<(std::ostream &os, const TCP_Segment &segment) { os << "(" << segment.seq_begin << "," << segment.seq_end << ")"; return os; } // -------------------- TCP_Packet ---------------------------------------- TCP_Packet::TCP_Packet() : fSegment(), fACK(), fWnd(0), fSessionId(0), fInfo(0) { } TCP_Packet::TCP_Packet(const TCP_Packet &packet) : fSegment(packet.fSegment), fACK(packet.fACK), fWnd(packet.fWnd), fSessionId(packet.fSessionId), fInfo(0) { std::cout << "TCP_Packet::TCP_Packet ############" << " "; if (packet.fInfo != 0) { std::cout << "TCP_Packet::TCP_Packet rhs.fInfo ###########" << " "; fInfo = new TDebugInfo(*packet.fInfo); } } TCP_Packet::~TCP_Packet() { delete fInfo; } TCP_Packet & TCP_Packet::clone() const { return *new TCP_Packet(*this); } void TCP_Packet::set_info(unsigned ssThresh, unsigned recWnd, unsigned cWnd, double estRTT, Sequence_Number sndUna, Sequence_Number sndNxt, bool isRtx) { if (fInfo == 0) { fInfo = new TDebugInfo; } fInfo->fSSThresh = ssThresh; fInfo->fRecWnd = recWnd; fInfo->fCWnd = cWnd; fInfo->fRTTEstimate = estRTT; fInfo->fSndUna = sndUna; fInfo->fSndNxt = sndNxt; fInfo->fRtxFlag = isRtx; } void TCP_Packet::print_header(std::ostream &) const { std::cout << "Hello!\n"; std::cout << "Ses = " << get_session_id() << " "; std::cout << "Segment = " << get_segment() << " " << "ACK = " << get_ACK() << " " << "Wnd = " << get_wnd() << " "; std::cout << "DestPort = " << fDestinationPort << " " << "SourcePort = " << fSourcePort << " "; if (fInfo != 0) { std::cout << "SndSSThresh = " << fInfo->fSSThresh << " "; std::cout << "RecWnd = " << fInfo->fRecWnd << " "; std::cout << "SndCWnd = " << fInfo->fCWnd << " "; std::cout << "RTTEstimate = " << fInfo->fRTTEstimate << " "; std::cout << "RtxFlag = " << fInfo->fRtxFlag; } else std::cout << "fInfo = " << fInfo << " "; std::cout << std::endl; } std::ostream & operator<<(std::ostream & out, TCP_Packet & msg) { msg.print_header(out); return out; } // -------------------- TCP_Sender ---------------------------------------- TCP_Sender::TCP_Sender(int label) : fLabel(label), fTCPVersion(TCP_VERSION), fMSS(TCP_SMSS), fTCPIPHeaderLength(TCP_HEADERLENGTH), fInitialRTT(TCP_INITIALRTT), fInitialCWnd(0), // default initialization see below fInitialSSThresh(0), // default initialization see below fMaxCWnd(0), // default initialization see below fDupACKThreshold(TCP_DUPACKS), fTimerGranularity(TCP_STIMERGRAN), fMaxRTO(TCP_MAXRTO), fMaxBackoff(TCP_MAXBACKOFF), fImmediateBackoffReset(TCP_IMMEDIATEBACKOFFRESET), fKarn(TCP_KARN), fGoBackN(TCP_GOBACKN), fFlightSizeRecovery(TCP_FLIGHTSIZERECOVERY), fRenoConservation(TCP_RENOCONSERVATION), fCarefulSSThreshReduction(TCP_CAREFULSSTHRESHREDUCTION), fIgnoreDupACKOnTORecovery(TCP_IGNOREDUPACKONTORECOVERY), fCarefulMulFastRtxAvoidance(TCP_CAREFULMULFASTRTXAVOIDANCE), fNagle(TCP_NAGLE), fSWSATimerValue(TCP_SWSATIMERVALUE), fRestartAfterIdle(TCP_RESTARTAFTERIDLE), fDebug(false), fTrace(false), fSessionId(0), fRtxTimer(*this, &TCP_Sender::HandleRtxTimeout), fSWSATimer(*this, &TCP_Sender::HandleSWSATimeout)/*,*/ { // default values and parameter check for MaxCWND, InitCWND, InitSSThresh if (fMaxCWnd == 0) { fMaxCWnd = (unsigned)(TCP_MAXCWNDREL * fMSS); } else if (fMaxCWnd < fMSS) { // throw (UL_CException("TCP_Sender::TCP_Sender", // "MaxCWnd must be >= MSS")); } if (fInitialCWnd == 0) { fInitialCWnd = (unsigned)(TCP_INITIALCWNDREL * fMSS); } else if ((fInitialCWnd < fMSS) || (fInitialCWnd > fMaxCWnd)) { // throw (UL_CException("TCP_Sender::TCP_Sender", // "initial CWnd must be >= MSS and <= MaxCWnd")); } if ((fInitialSSThresh == 0) && (fMaxCWnd >= 2 * fMSS)) { fInitialSSThresh = (unsigned)(TCP_INITIALSSTHRESHREL * fMaxCWnd); } else if ((fInitialSSThresh < 2*fMSS) || (fInitialCWnd > fMaxCWnd)) { // throw (UL_CException("TCP_Sender::TCP_Sender", // "initial CWnd must be >= 2*MSS and <= MaxCWnd")); } setup(); InitStatistics(); tcp_send.set_name("TCP Send"); tcp_receive_ack.forward(this, &TCP_Sender::ReceiveMessageFromNet); tcp_receive_ack.set_name("TCP ACK"); tcp_socket_write.forward(this, &TCP_Sender::HandleUserMessageIndication); tcp_socket_write.set_name("SocketWrite"); tcp_release.forward(this, &TCP_Sender::release); tcp_release.set_name("Release"); } TCP_Sender::~TCP_Sender() { } void TCP_Sender::set_debug(const bool enable_debug) { fDebug = enable_debug; tcp_send.set_debug(enable_debug); } void TCP_Sender::set_debug(bool enable_debug, bool enable_signal_debug) { fDebug = enable_debug; tcp_send.set_debug(enable_signal_debug); } void TCP_Sender::set_trace(const bool enable_trace) { fTrace = enable_trace; } void TCP_Sender::set_label(int label) { fLabel = label; } void TCP_Sender::setup() { fSndUna = 0; fSndNxt = 0; fSndMax = 0; fMaxRecWnd = 0; fRecWnd = fMaxCWnd; fUserNxt = 0; fCWnd = fInitialCWnd; fSSThresh = fInitialSSThresh; fRecoveryDupACK = 0; fRecoveryTO = 0; fDupACKCnt = 0; // timers fBackoff = 1; fPendingBackoffReset = false; fLastSendTime = Event_Queue::now(); // RTT measurement fTimUna = 0; fSRTT = 0; fRTTVar = 0; fRTTEstimate = fInitialRTT; fRTTMPending = false; fRTTMByte = 0; CWnd_val.set_size(1000); CWnd_val.zeros(); CWnd_time.set_size(1000); CWnd_time.zeros(); CWnd_val(0) = fInitialCWnd; CWnd_time(0) = 0; CWnd_index = 1; SSThresh_val.set_size(1000); SSThresh_val.zeros(); SSThresh_time.set_size(1000); SSThresh_time.zeros(); SSThresh_val(0) = fInitialSSThresh; SSThresh_time(0) = 0; SSThresh_index = 1; sent_seq_num_val.set_size(1000); sent_seq_num_val.zeros(); sent_seq_num_time.set_size(1000); sent_seq_num_time.zeros(); sent_seq_num_val(0) = 0; sent_seq_num_time(0) = 0; sent_seq_num_index = 1; sender_recv_ack_seq_num_val.set_size(1000); sender_recv_ack_seq_num_val.zeros(); sender_recv_ack_seq_num_time.set_size(1000); sender_recv_ack_seq_num_time.zeros(); sender_recv_ack_seq_num_val(0) = 0; sender_recv_ack_seq_num_time(0) = 0; sender_recv_ack_seq_num_index = 1; RTTEstimate_val.set_size(1000); RTTEstimate_val.zeros(); RTTEstimate_time.set_size(1000); RTTEstimate_time.zeros(); RTTEstimate_val(0) = fInitialRTT; RTTEstimate_time(0) = 0; RTTEstimate_index = 1; RTTsample_val.set_size(1000); RTTsample_val.zeros(); RTTsample_time.set_size(1000); RTTsample_time.zeros(); RTTsample_val(0) = 0; RTTsample_time(0) = 0; RTTsample_index = 1; } std::string TCP_Sender::GenerateFilename() { time_t rawtime; #ifndef _MSC_VER struct tm *timeinfo; timeinfo = localtime(&rawtime); #else time(&rawtime); struct tm _timeinfo; struct tm *timeinfo = &_timeinfo; localtime_s(timeinfo, &rawtime); #endif std::ostringstream filename_stream; filename_stream << "trace_tcp_sender_u" << fLabel << "_" << 1900 + timeinfo->tm_year << "_" << timeinfo->tm_mon << "_" << timeinfo->tm_mday << "__" << timeinfo->tm_hour << "_" << timeinfo->tm_min << "_" << timeinfo->tm_sec << "_.it"; return filename_stream.str(); } void TCP_Sender::release(std::string file) { std::string filename; fSessionId++; fRtxTimer.Reset(); fSWSATimer.Reset(); if (fTrace) { if (file == "") filename = GenerateFilename(); else filename = file; save_trace(filename); } } void TCP_Sender::InitStatistics() { fNumberOfTimeouts = 0; fNumberOfIdleTimeouts = 0; fNumberOfFastRetransmits = 0; fNumberOfRTTMeasurements = 0; fNumberOfReceivedACKs = 0; } void TCP_Sender::StopTransientPhase() { InitStatistics(); } void TCP_Sender::HandleUserMessageIndication(itpp::Packet *user_data_p) { if (fDebug) { std::cout << "TCP_Sender::HandleUserMessageIndication" << " byte_size=" << user_data_p->bit_size() / 8 << " ptr=" << user_data_p << " time=" << Event_Queue::now() << std::endl; } SocketWriteQueue.push(user_data_p); SendNewData(); // will call GetMessage (via GetNextSegmentSize) // if new data can be sent } void TCP_Sender::ReceiveMessageFromNet(itpp::Packet *msg) { TCP_Packet & packet = (TCP_Packet &) * msg; if (fDebug) { std::cout << "TCP_Sender::ReceiveMessageFromNet" << " byte_size=" << msg->bit_size() / 8 << " ptr=" << msg << " time=" << Event_Queue::now() << std::endl; } if ((packet.get_session_id() == fSessionId) && // ACK of current session (packet.get_ACK() >= fSndUna)) { // ACK is OK HandleACK(packet); } delete &packet; } void TCP_Sender::HandleACK(TCP_Packet &msg) { it_assert(msg.get_ACK() <= fSndMax, "TCP_Sender::HandleACK, received ACK > SndMax at "); fNumberOfReceivedACKs++; if (fTrace) { TraceACKedSeqNo(msg.get_ACK()); } if (fDebug) { std::cout << "sender " << fLabel << ": " << "receive ACK: " << " t = " << Event_Queue::now() << ", " << msg << std::endl; } // update receiver advertised window size fRecWnd = msg.get_wnd(); fMaxRecWnd = max(fRecWnd, fMaxRecWnd); if (msg.get_ACK() == fSndUna) { // duplicate ACK bool ignoreDupACK = (fSndMax == fSndUna); // no outstanding data if (fIgnoreDupACKOnTORecovery) { // don't count dupacks during TO recovery! if (fCarefulMulFastRtxAvoidance) { // see RFC 2582, Section 5 // like in Solaris ignoreDupACK = ignoreDupACK || (fSndUna <= fRecoveryTO); } else { // like in ns ignoreDupACK = ignoreDupACK || (fSndUna < fRecoveryTO); } } if (!ignoreDupACK) { fDupACKCnt++; // count the number of duplicate ACKs if (fDupACKCnt == fDupACKThreshold) { // dupack threshold is reached fNumberOfFastRetransmits++; fRecoveryDupACK = fSndMax; ReduceSSThresh(); // halve ssthresh (in most cases) if ((fTCPVersion == kReno) || (fTCPVersion == kNewReno)) { fCWnd = fSSThresh; } else if (fTCPVersion == kTahoe) { fCWnd = fMSS; } if (fTCPVersion == kReno || fTCPVersion == kNewReno) { // conservation of packets: if (fRenoConservation) { fCWnd += fDupACKThreshold * fMSS; } } else if (fTCPVersion == kTahoe) { if (fGoBackN) { fSndNxt = fSndUna; // Go-Back-N (like in ns) } } UnaRetransmit(); // initiate retransmission } else if (fDupACKCnt > fDupACKThreshold) { if (fTCPVersion == kReno || fTCPVersion == kNewReno) { // conservation of packets // CWnd may exceed MaxCWnd during fast recovery, // however, the result of SendWindow() is always <= MaxCwnd if (fRenoConservation) { fCWnd += fMSS; } } } } } else { // new ACK Sequence_Number oldSndUna = fSndUna; // required for NewReno partial ACK fSndUna = msg.get_ACK(); fSndNxt = max(fSndNxt, fSndUna); // required in case of "Go-Back-N" // reset retransmission timer if ((fSndUna > fTimUna) && fRtxTimer.IsPending()) { // seq. no. for which rtx timer is running has been received fRtxTimer.Reset(); } // backoff reset if (fImmediateBackoffReset) { fBackoff = 1; } else { if (fPendingBackoffReset) { fBackoff = 1; fPendingBackoffReset = false; } else if (fBackoff > 1) { // reset backoff counter only on next new ACK (this is probably // the way to operate intended by Karn) fPendingBackoffReset = true; } } // RTT measurement if ((fSndUna > fRTTMByte) && fRTTMPending) { UpdateRTTVariables(Event_Queue::now() - fRTTMStartTime); fRTTMPending = false; } // update CWnd and reset dupack counter if (fDupACKCnt >= fDupACKThreshold) { // we are in fast recovery if (fTCPVersion == kNewReno && fSndUna < fRecoveryDupACK) { // New Reno partial ACK handling if (fRenoConservation) { fCWnd = max(fMSS, fCWnd - (fSndUna - oldSndUna) + fMSS); } UnaRetransmit(); // start retransmit immediately } else { FinishFastRecovery(); } } else { // no fast recovery fDupACKCnt = 0; if (fCWnd < fSSThresh) { // slow start phase fCWnd = min(fCWnd + fMSS, fMaxCWnd); } else { // congestion avoidance phase fCWnd += max(fMSS * fMSS / fCWnd, 1); // RFC 2581 fCWnd = min(fCWnd, fMaxCWnd); } } } // new ACK SendNewData(); // try to send new data (even in the case that a retransmit // had to be performed) if (fTrace) { TraceCWnd(); } } void TCP_Sender::SendNewData(bool skipSWSA) { unsigned nextSegmentSize; it_assert(fSndUna <= fSndNxt, "TCP_Sender::SendNewData, SndUna > SndNxt in sender " + to_str(fLabel) + "!"); if (fRestartAfterIdle) { IdleCheck(); } bool sillyWindowAvoidanceFailed = false; while (!sillyWindowAvoidanceFailed && ((nextSegmentSize = GetNextSegmentSize(fSndNxt)) > 0)) { // there is new data to send and window is large enough // SWSA and Nagle (RFC 1122): assume PUSH to be set unsigned queuedUnsent = fUserNxt - fSndNxt; unsigned usableWindow = max(0, (fSndUna + SendWindow()) - fSndNxt); if (((unsigned)min(queuedUnsent, usableWindow) >= fMSS) || ((!fNagle || (fSndUna == fSndNxt)) && ((queuedUnsent <= usableWindow) || // Silly W. A. ((unsigned)min(queuedUnsent, usableWindow) >= fMaxRecWnd / 2) ) ) || skipSWSA ) { // Silly Window Syndrome Avoidance (SWSA) and Nagle passed TCP_Segment nextSegment(fSndNxt, fSndNxt + nextSegmentSize); TCP_Packet & msg = * new TCP_Packet(); msg.set_segment(nextSegment); msg.set_session_id(fSessionId); msg.set_destination_port(fLabel); // The dest and src port are set to the same msg.set_source_port(fLabel); // number for simplicity. msg.set_bit_size(8 * (nextSegmentSize + fTCPIPHeaderLength)); if (fDebug) { std::cout << "TCP_Sender::SendNewData," << " nextSegmentSize=" << nextSegmentSize << " fTCPIPHeaderLength=" << fTCPIPHeaderLength << " byte_size=" << msg.bit_size() / 8 << " ptr=" << &msg << " time=" << Event_Queue::now() << std::endl; } // no RTT measurement for retransmitted segments // changes on Dec. 13. 2002 (Ga, Bo, Scharf) if (!fRTTMPending && fSndNxt >= fSndMax) { // ##Bo## fRTTMStartTime = Event_Queue::now(); fRTTMByte = nextSegment.begin(); fRTTMPending = true; } fSndNxt += nextSegmentSize; fSndMax = max(fSndNxt, fSndMax); // reset SWSA timer if necessary if (skipSWSA) { skipSWSA = false; } else if (fSWSATimer.IsPending()) { fSWSATimer.Reset(); } // set rtx timer if necessary if (!fRtxTimer.IsPending()) { SetRtxTimer(); } if (fDebug) { msg.set_info(fSSThresh, fRecWnd, fCWnd, fRTTEstimate, fSndUna, fSndNxt, false); std::cout << "sender " << fLabel << ": send new data: " << " t = " << Event_Queue::now() << ", " << msg << std::endl; } SendMsg(msg); } else { sillyWindowAvoidanceFailed = true; // set SWSA timer if (!fSWSATimer.IsPending()) { fSWSATimer.Set(fSWSATimerValue); } } } // set timers in case that no new data could have been sent if (!fRtxTimer.IsPending()) { if (fSndMax > fSndUna) { // there is outstanding data if (!fImmediateBackoffReset && fPendingBackoffReset) { // backoff is reset if no new data could have been sent since last // (successfull) retransmission; this is useful in case of // Reno recovery and multiple losses to avoid that in // the (unavoidable) series of timeouts the timer value // increases exponentially as this is not the intention // of the delayed backoff reset in Karn's algorithm fBackoff = 1; fPendingBackoffReset = false; } SetRtxTimer(); } } } void TCP_Sender::UnaRetransmit() { // resend after timeout or fast retransmit unsigned nextSegmentSize = GetNextSegmentSize(fSndUna); if (nextSegmentSize > 0) { TCP_Segment nextSegment(fSndUna, fSndUna + nextSegmentSize); TCP_Packet & msg = *new TCP_Packet(); msg.set_segment(nextSegment); msg.set_session_id(fSessionId); msg.set_destination_port(fLabel); // The dest and src port are set to the same msg.set_source_port(fLabel); // number for simplicity. msg.set_bit_size(8 * (nextSegmentSize + fTCPIPHeaderLength)); fSndNxt = max(fSndNxt, fSndUna + nextSegmentSize); fSndMax = max(fSndNxt, fSndMax); // The RTT measurement is cancelled if the RTTM byte has a sequence // number higher or equal than the first retransmitted byte as // the ACK for the RTTM byte will be delayed by the rtx for at least // one round if (fKarn && (nextSegment.begin() <= fRTTMByte) && fRTTMPending) { fRTTMPending = false; } SetRtxTimer(); if (fDebug) { msg.set_info(fSSThresh, fRecWnd, fCWnd, fRTTEstimate, fSndUna, fSndNxt, true); std::cout << "sender " << fLabel; if (fDupACKCnt >= fDupACKThreshold) { std::cout << ": fast rtx: "; } else { std::cout << ": TO rtx: "; } std::cout << " t = " << Event_Queue::now() << ", " << msg << std::endl; } SendMsg(msg); } else { // throw(UL_CException("TCP_Sender::UnaRetransmit", "no bytes to send")); } } void TCP_Sender::FinishFastRecovery() { if (fTCPVersion == kTahoe) { fDupACKCnt = 0; } else if (fTCPVersion == kReno) { // Reno fast recovery fDupACKCnt = 0; if (fFlightSizeRecovery) { fCWnd = min(fSndMax - fSndUna + fMSS, fSSThresh); } else { fCWnd = fSSThresh; } } else if (fTCPVersion == kNewReno) { // New Reno fast recovery // "Set CWnd to ... min (ssthresh, FlightSize + MSS) // ... or ssthresh" (RFC 2582) if (fFlightSizeRecovery) { fCWnd = min(fSndMax - fSndUna + fMSS, fSSThresh); } else { fCWnd = fSSThresh; } fDupACKCnt = 0; } } void TCP_Sender::ReduceSSThresh() { if (fCarefulSSThreshReduction) { // If Reno conservation is enabled the amount of // outstanding data ("flight size") might be rather large // and even larger than twice the old ssthresh value; // so this corresponds more to the ns behaviour where always cwnd is // taken instead of flight size. fSSThresh = max(2 * fMSS, min(min(fCWnd, fSndMax - fSndUna), fRecWnd) / 2); } else { // use filght size / 2 as recommended in RFC 2581 fSSThresh = max(2 * fMSS, min(fSndMax - fSndUna, fRecWnd) / 2); } it_assert(fSSThresh <= fMaxCWnd, "TCP_Sender::HandleACK, internal error: SndSSThresh is > MaxCWnd"); if (fTrace) { TraceSSThresh(); } } void TCP_Sender::SendMsg(TCP_Packet &msg) { if (fTrace) { TraceSentSeqNo(msg.get_segment().end()); } if (fRestartAfterIdle) { fLastSendTime = Event_Queue::now(); // needed for idle detection } tcp_send(&msg); } void TCP_Sender::IdleCheck() { // idle detection according to Jacobson, SIGCOMM, 1988: // sender is currently idle and nothing has been send since RTO if (fSndMax == fSndUna && Event_Queue::now() - fLastSendTime > CalcRTOValue()) { fCWnd = fInitialCWnd; // see RFC2581 fNumberOfIdleTimeouts++; if (fTrace) { TraceCWnd(); } if (fDebug) { std::cout << "sender " << fLabel << ": idle timeout: " << "t = " << Event_Queue::now() << ", SndNxt = " << fSndNxt << ", SndUna = " << fSndUna << ", Backoff = " << fBackoff << std::endl; } } } void TCP_Sender::HandleRtxTimeout(Ttype) { fNumberOfTimeouts++; // update backoff fBackoff = min(fMaxBackoff, fBackoff * 2); if (!fImmediateBackoffReset) { fPendingBackoffReset = false; } if (fDupACKCnt >= fDupACKThreshold) { FinishFastRecovery(); // reset dup ACK cnt and CWnd } else if (fDupACKCnt > 0) { fDupACKCnt = 0; // don't allow dupack action during TO recovery } // update CWnd and SSThresh ReduceSSThresh(); // halve ssthresh (in most cases) fCWnd = fMSS; // not initial CWnd, see RFC 2581 it_assert(fSSThresh <= fMaxCWnd, "TCP_Sender::HandleRtxTimeout, internal error: SndSSThresh is > MaxCWnd"); fRecoveryTO = fSndMax; if (fGoBackN) { // go back N is mainly relevant in the case of multiple losses // which would lead to a series of timeouts without resetting sndnxt fSndNxt = fSndUna; } if (fDebug) { std::cout << "sender " << fLabel << ": rtx timeout: " << "t = " << Event_Queue::now() << ", SndNxt = " << fSndNxt << ", SndUna = " << fSndUna << std::endl; } if (fTrace) { TraceCWnd(); } UnaRetransmit(); // initiate retransmission } void TCP_Sender::HandleSWSATimeout(Ttype) { SendNewData(true); } unsigned TCP_Sender::GetNextSegmentSize(const Sequence_Number & begin) { // try to get new user messages if available and necessary while ((fUserNxt < begin + fMSS) && (!SocketWriteQueue.empty())) { itpp::Packet *packet_p = SocketWriteQueue.front(); SocketWriteQueue.pop(); fUserNxt += (unsigned) packet_p->bit_size() / 8; delete packet_p; } Sequence_Number end = min(min(fUserNxt, begin + fMSS), fSndUna + SendWindow()); if (fDebug) { std::cout << "TCP_Sender::GetNextSegmentSize," << " fUserNxt=" << fUserNxt << " begin_seq_num=" << begin << " fMSS=" << fMSS << " fSndUna=" << fSndUna << " SendWindow()=" << SendWindow() << " end_seq_num=" << end << " time=" << Event_Queue::now() << std::endl; } return max(0, end - begin); } unsigned TCP_Sender::SendWindow() const { return min(fRecWnd, min(fMaxCWnd, fCWnd)); } double TCP_Sender::CalcRTOValue() const { static const double factor = 1 + 1e-8; // to avoid "simultaneous" TO/receive ACK events in case of const. RTT double rto = fBackoff * fRTTEstimate * factor; if (rto > fMaxRTO) { rto = fMaxRTO; } return rto; } void TCP_Sender::SetRtxTimer() { double rto = CalcRTOValue(); fRtxTimer.Set(rto); fTimUna = fSndUna; if (fDebug) { std::cout << "sender " << fLabel << ": set rtx timer: " << "t = " << Event_Queue::now() << ", RTO = " << rto << ", Backoff = " << fBackoff << ", TimUna = " << fTimUna << std::endl; } } void TCP_Sender::UpdateRTTVariables(double sampleRTT) { if (fSRTT == 0) { fSRTT = sampleRTT; fRTTVar = sampleRTT / 2; } else { // see, e.g., Comer for the values used as weights fSRTT = 0.875 * fSRTT + 0.125 * sampleRTT; fRTTVar = 0.75 * fRTTVar + 0.25 * fabs(sampleRTT - fSRTT); } fRTTEstimate = round(fSRTT + 4 * fRTTVar, fTimerGranularity); if (fTrace) { TraceRTTVariables(sampleRTT); } fNumberOfRTTMeasurements++; } void TCP_Sender::TraceRTTVariables(double sampleRTT) { if (fDebug) { std::cout << "sender " << fLabel << ": RTT update: " << "t = " << Event_Queue::now() << ", sample = " << sampleRTT << ", SRTT = " << fSRTT << ", RTTVar = " << fRTTVar << ", RTTEstimate = " << fRTTEstimate << std::endl; } if (RTTsample_index >= RTTsample_time.size()) { RTTsample_time.set_size(2*RTTsample_time.size(), true); RTTsample_val.set_size(2*RTTsample_val.size(), true); } RTTsample_val(RTTsample_index) = sampleRTT; RTTsample_time(RTTsample_index) = Event_Queue::now(); RTTsample_index++; if (RTTEstimate_index >= RTTEstimate_time.size()) { RTTEstimate_time.set_size(2*RTTEstimate_time.size(), true); RTTEstimate_val.set_size(2*RTTEstimate_val.size(), true); } RTTEstimate_val(RTTEstimate_index) = fRTTEstimate; RTTEstimate_time(RTTEstimate_index) = Event_Queue::now(); RTTEstimate_index++; } void TCP_Sender::TraceCWnd() { if (fDebug) { std::cout << "sender " << fLabel << " t = " << Event_Queue::now() << " cwnd = " << fCWnd << std::endl; } if (CWnd_index >= CWnd_time.size()) { CWnd_time.set_size(2*CWnd_time.size(), true); CWnd_val.set_size(2*CWnd_val.size(), true); } CWnd_val(CWnd_index) = fCWnd; CWnd_time(CWnd_index) = Event_Queue::now(); CWnd_index++; } void TCP_Sender::TraceSSThresh() { if (fDebug) { std::cout << "sender " << fLabel << " t = " << Event_Queue::now() << " cwnd = " << fSSThresh << std::endl; } if (SSThresh_index >= SSThresh_time.size()) { SSThresh_time.set_size(2*SSThresh_time.size(), true); SSThresh_val.set_size(2*SSThresh_val.size(), true); } SSThresh_val(SSThresh_index) = fSSThresh; SSThresh_time(SSThresh_index) = Event_Queue::now(); SSThresh_index++; } void TCP_Sender::TraceSentSeqNo(const Sequence_Number sn) { //// UL_TEST_MAGIC; if (fDebug) { std::cout << "sender " << fLabel << " t = " << Event_Queue::now() << " sent = " << sn << std::endl; } if (sent_seq_num_index >= sent_seq_num_time.size()) { sent_seq_num_time.set_size(2*sent_seq_num_time.size(), true); sent_seq_num_val.set_size(2*sent_seq_num_val.size(), true); } sent_seq_num_val(sent_seq_num_index) = sn.value(); sent_seq_num_time(sent_seq_num_index) = Event_Queue::now(); sent_seq_num_index++; } void TCP_Sender::TraceACKedSeqNo(const Sequence_Number sn) { if (fDebug) { std::cout << "sender " << fLabel << " t = " << Event_Queue::now() << " ACK = " << sn << std::endl; } if (sender_recv_ack_seq_num_index >= sender_recv_ack_seq_num_time.size()) { sender_recv_ack_seq_num_time.set_size(2*sender_recv_ack_seq_num_time.size(), true); sender_recv_ack_seq_num_val.set_size(2*sender_recv_ack_seq_num_val.size(), true); } sender_recv_ack_seq_num_val(sender_recv_ack_seq_num_index) = sn.value(); sender_recv_ack_seq_num_time(sender_recv_ack_seq_num_index) = Event_Queue::now(); sender_recv_ack_seq_num_index++; } void TCP_Sender::save_trace(std::string filename) { CWnd_val.set_size(CWnd_index, true); CWnd_time.set_size(CWnd_index, true); SSThresh_val.set_size(SSThresh_index, true); SSThresh_time.set_size(SSThresh_index, true); sent_seq_num_val.set_size(sent_seq_num_index, true); sent_seq_num_time.set_size(sent_seq_num_index, true); sender_recv_ack_seq_num_val.set_size(sender_recv_ack_seq_num_index, true); sender_recv_ack_seq_num_time.set_size(sender_recv_ack_seq_num_index, true); RTTEstimate_val.set_size(RTTEstimate_index, true); RTTEstimate_time.set_size(RTTEstimate_index, true); RTTsample_val.set_size(RTTsample_index, true); RTTsample_time.set_size(RTTsample_index, true); if (fDebug) { std::cout << "CWnd_val" << CWnd_val << std::endl; std::cout << "CWnd_time" << CWnd_time << std::endl; std::cout << "CWnd_index" << CWnd_index << std::endl; std::cout << "SSThresh_val" << SSThresh_val << std::endl; std::cout << "SSThresh_time" << SSThresh_time << std::endl; std::cout << "SSThresh_index" << SSThresh_index << std::endl; std::cout << "sent_seq_num_val" << sent_seq_num_val << std::endl; std::cout << "sent_seq_num_time" << sent_seq_num_time << std::endl; std::cout << "sent_seq_num_index" << sent_seq_num_index << std::endl; std::cout << "sender_recv_ack_seq_num_val" << sender_recv_ack_seq_num_val << std::endl; std::cout << "sender_recv_ack_seq_num_time" << sender_recv_ack_seq_num_time << std::endl; std::cout << "sender_recv_ack_seq_num_index" << sender_recv_ack_seq_num_index << std::endl; std::cout << "RTTEstimate_val" << RTTEstimate_val << std::endl; std::cout << "RTTEstimate_time" << RTTEstimate_time << std::endl; std::cout << "RTTEstimate_index" << RTTEstimate_index << std::endl; std::cout << "RTTsample_val" << RTTsample_val << std::endl; std::cout << "RTTsample_time" << RTTsample_time << std::endl; std::cout << "RTTsample_index" << RTTsample_index << std::endl; std::cout << "TCP_Sender::saving to file: " << filename << std::endl; } it_file ff2; ff2.open(filename); ff2 << Name("CWnd_val") << CWnd_val; ff2 << Name("CWnd_time") << CWnd_time; ff2 << Name("CWnd_index") << CWnd_index; ff2 << Name("SSThresh_val") << SSThresh_val; ff2 << Name("SSThresh_time") << SSThresh_time; ff2 << Name("SSThresh_index") << SSThresh_index; ff2 << Name("sent_seq_num_val") << sent_seq_num_val; ff2 << Name("sent_seq_num_time") << sent_seq_num_time; ff2 << Name("sent_seq_num_index") << sent_seq_num_index; ff2 << Name("sender_recv_ack_seq_num_val") << sender_recv_ack_seq_num_val; ff2 << Name("sender_recv_ack_seq_num_time") << sender_recv_ack_seq_num_time; ff2 << Name("sender_recv_ack_seq_num_index") << sender_recv_ack_seq_num_index; ff2 << Name("RTTEstimate_val") << RTTEstimate_val; ff2 << Name("RTTEstimate_time") << RTTEstimate_time; ff2 << Name("RTTEstimate_index") << RTTEstimate_index; ff2 << Name("RTTsample_val") << RTTsample_val; ff2 << Name("RTTsample_time") << RTTsample_time; ff2 << Name("RTTsample_index") << RTTsample_index; ff2.flush(); ff2.close(); } void TCP_Sender::print_item(std::ostream &, const std::string & keyword) { if (keyword == "Label") { std::cout << fLabel; } else if (keyword == "CWnd") { std::cout << fCWnd; } else if (keyword == "SSThresh") { std::cout << fSSThresh; } else if (keyword == "SRTT") { std::cout << fSRTT; } else if (keyword == "RTTvar") { std::cout << fRTTVar; } else if (keyword == "Backoff") { std::cout << fBackoff; } else if (keyword == "RTO") { std::cout << CalcRTOValue(); } else if (keyword == "NoOfFastRets") { std::cout << fNumberOfFastRetransmits; } else if (keyword == "NoOfRetTOs") { std::cout << fNumberOfTimeouts; } else if (keyword == "NoOfIdleTOs") { std::cout << fNumberOfIdleTimeouts; } else if (keyword == "NoOfRTTMs") { std::cout << fNumberOfRTTMeasurements; } else if (keyword == "NoOfRecACKs") { std::cout << fNumberOfReceivedACKs; } else { } } // -------------------- TCP_Receiver_Buffer ---------------------------------------- TCP_Receiver_Buffer::TCP_Receiver_Buffer() : fFirstByte() { } TCP_Receiver_Buffer::TCP_Receiver_Buffer(const TCP_Receiver_Buffer & rhs) : fFirstByte(rhs.fFirstByte), fBufList(rhs.fBufList) { } void TCP_Receiver_Buffer::reset() { fBufList.clear(); fFirstByte = 0; } TCP_Receiver_Buffer::~TCP_Receiver_Buffer() { } void TCP_Receiver_Buffer::write(TCP_Segment newBlock) { // error cases it_assert(newBlock.begin() <= newBlock.end(), "TCP_Receiver_Buffer::Write, no valid segment"); // cut blocks beginning before fFirstByte if (newBlock.begin() < fFirstByte) { if (newBlock.end() > fFirstByte) { newBlock.set_begin(fFirstByte); } else { return; //// TODO: Is this strange? } } if (newBlock.length() == 0) { // empty block, nothing to do return; } if (fBufList.empty() || (newBlock.begin() > fBufList.back().end())) { // new block is behind last block in buffer fBufList.push_back(newBlock); } else { // skip list entries if beginning of newBlock > end of current one // (search for correct list position) std::list::iterator iter; iter = fBufList.begin(); while (newBlock.begin() > iter->end()) { iter++; it_assert(iter != fBufList.end(), "TCP_Receiver_Buffer::Write, internal error"); } TCP_Segment & exBlock = *iter; if (exBlock.can_be_combined(newBlock)) { // overlapping or contiguous blocks -> combine exBlock.combine(newBlock); // check following blocks iter++; while ((iter != fBufList.end()) && exBlock.can_be_combined(*iter)) { exBlock.combine(*iter); iter = fBufList.erase(iter); } } else { // no overlap, newBlock lies between two existing list entries // new list entry has to be created fBufList.insert(iter, newBlock); } } it_assert(!fBufList.empty() && fBufList.front().begin() >= fFirstByte, "TCP_Receiver_Buffer::Write, internal error"); } // The amount of data read from the buffer is given as parameter. It has // to be less than or equal to the size of the first block stored. This // mean the caller of Read should first check how much data is available // by calling FirstBlockSize. void TCP_Receiver_Buffer::read(unsigned noOfBytes) { it_assert(first_block_size() > 0, "TCP_Receiver_Buffer::Read, No block to read"); it_assert(noOfBytes <= first_block_size(), "TCP_Receiver_Buffer::Read, submitted block size not valid"); if (noOfBytes < first_block_size()) { fBufList.front().set_begin(fBufList.front().begin() + noOfBytes); } else { // first block will be read completely fBufList.pop_front(); } fFirstByte += noOfBytes; it_assert(fBufList.empty() || fBufList.front().begin() >= fFirstByte, "TCP_Receiver_Buffer::Read, internal error"); } // FirstBlockSize returns the size of the first block stored in the // buffer or 0 if the buffer is empty unsigned TCP_Receiver_Buffer::first_block_size() const { if (!fBufList.empty() && (fBufList.front().begin() == fFirstByte)) { return fBufList.front().length(); } else { return 0; } } std::ostream & TCP_Receiver_Buffer::info(std::ostream &os, int detail) const { os << "receiver buffer information" << std::endl << "number of blocks: " << fBufList.size() << std::endl << "first byte stored: " << fFirstByte << std::endl << "last byte stored +1: " << last_byte() << std::endl << "next byte expected: " << next_expected() << std::endl; if (detail > 0) { os << "segments in receiver buffer:" << std::endl; typedef std::list::const_iterator LI; for (LI i = fBufList.begin(); i != fBufList.end(); ++i) { const TCP_Segment & block = *i; os << ". segment: " << block << std::endl; } } return os; } // -------------------- TCP_Receiver ---------------------------------------- TCP_Receiver::TCP_Receiver(int label) : fReceiverBuffer(), fLabel(label), fTCPIPHeaderLength(TCP_HEADERLENGTH), fMSS(TCP_RMSS), fBufferSize(TCP_BUFFERSIZE), fDelayedACK(TCP_DELAYEDACK), fACKDelayTime(TCP_ACKDELAYTIME), fSendPeriodicACKs(TCP_SENDPERIODICACKS), fStrictPeriodicACKs(TCP_STRICTPERIODICACKS), fPeriodicACKInterval(TCP_PERIODICACKINTERVAL), fACKSchedulingDelay(TCP_ACKSCHEDULINGDELAY), fACKOnBufferWrite(TCP_ACKBUFFERWRITE), fACKOnBufferRead(TCP_ACKBUFFERREAD), fMaxUserBlockSize(TCP_MAXUSERBLOCKSIZE), fMinUserBlockSize(TCP_MINUSERBLOCKSIZE), fUserBlockProcDelay(TCP_USERBLOCKPROCDELAY), fTrace(false), fDebug(false), fSessionId(0), fDelayedACKTimer(*this, &TCP_Receiver::DelayedACKHandler), fPeriodicACKTimer(*this, &TCP_Receiver::PeriodicACKHandler), fACKSchedulingTimer(*this, &TCP_Receiver::SendACKMessage), fWaitingACKMsg(0), fUserBlockProcTimer(*this, &TCP_Receiver::HandleEndOfProcessing) { fUserMessage = NULL; if (!fACKOnBufferRead && !fACKOnBufferWrite) { // throw(UL_CException("TCP_Receiver::TCP_Receiver", // "ACKs must be sent on buffer read or write or both")); } setup(); tcp_receive.forward(this, &TCP_Receiver::ReceiveMessageFromNet); tcp_receive.set_name("TCP Receive"); tcp_send_ack.set_name("TCP send ACK"); tcp_new_data.set_name("TCP New Data"); tcp_release.forward(this, &TCP_Receiver::release); tcp_release.set_name("TCP Release"); } TCP_Receiver::~TCP_Receiver() { delete fWaitingACKMsg; delete fUserMessage; } void TCP_Receiver::set_debug(const bool enable_debug) { fDebug = enable_debug; tcp_send_ack.set_debug(enable_debug); tcp_new_data.set_debug(); } void TCP_Receiver::set_debug(bool enable_debug, bool enable_signal_debug) { fDebug = enable_debug; tcp_send_ack.set_debug(enable_signal_debug); tcp_new_data.set_debug(); } void TCP_Receiver::set_trace(const bool enable_trace) { fTrace = enable_trace; } void TCP_Receiver::setup() { fAdvRcvWnd = 0; fAdvRcvNxt = 0; if (fSendPeriodicACKs) { fPeriodicACKTimer.Set(fPeriodicACKInterval); } fReceiverBuffer.reset(); received_seq_num_val.set_size(1000); received_seq_num_val.zeros(); received_seq_num_time.set_size(1000); received_seq_num_time.zeros(); received_seq_num_val(0) = 0; received_seq_num_time(0) = 0; received_seq_num_index = 1; } std::string TCP_Receiver::GenerateFilename() { time_t rawtime; #ifndef _MSC_VER struct tm *timeinfo; timeinfo = localtime(&rawtime); #else time(&rawtime); struct tm _timeinfo; struct tm *timeinfo = &_timeinfo; localtime_s(timeinfo, &rawtime); #endif std::ostringstream filename_stream; filename_stream << "trace_tcp_receiver_u" << fLabel << "_" << 1900 + timeinfo->tm_year << "_" << timeinfo->tm_mon << "_" << timeinfo->tm_mday << "__" << timeinfo->tm_hour << "_" << timeinfo->tm_min << "_" << timeinfo->tm_sec << "_.it"; return filename_stream.str(); } void TCP_Receiver::release(std::string file) { std::string filename; fSessionId++; if (fWaitingACKMsg != 0) { delete fWaitingACKMsg; fWaitingACKMsg = 0; } if (fUserMessage != 0) { delete fUserMessage; fUserMessage = 0; } fUserBlockProcTimer.Reset(); fDelayedACKTimer.Reset(); fPeriodicACKTimer.Reset(); fACKSchedulingTimer.Reset(); if (fTrace) { if (file == "") filename = GenerateFilename(); else filename = file; save_trace(filename); } } void TCP_Receiver::ReceiveMessageFromNet(itpp::Packet *msg) { TCP_Packet & packet = (TCP_Packet &) * msg; if (packet.get_destination_port() == fLabel) { if (packet.get_session_id() == fSessionId) { ReceiveDataPacket(packet); } else { it_warning("Received a TCP packet with wrong SessionId"); std::cout << "TCP_Receiver::ReceiveMessageFromNet, " << "fLabel= " << fLabel << "fSessionId= " << fSessionId << std::endl; std::cout << "packet=" << packet << ", next exp. = " << fReceiverBuffer.next_expected() << std::endl; exit(0); } } else { it_warning("Received a TCP packet with label"); exit(0); } } void TCP_Receiver::ReceiveDataPacket(TCP_Packet &msg) { TCP_Segment segment = msg.get_segment(); bool isOutOfOrder = (segment.begin() > fReceiverBuffer.next_expected()) || (segment.end() <= fReceiverBuffer.next_expected()); if (fDebug) { std::cout << "TCP_Receiver::ReceiveDataPacket receiver: " << fLabel << ": " << "receive msg: " << "t = " << Event_Queue::now() << ", next exp. = " << fReceiverBuffer.next_expected() << ", " << msg << std::endl; } if (fTrace) { TraceReceivedSeqNo(segment.end()); } it_assert(segment.end() <= fReceiverBuffer.first_byte() + fBufferSize, "TCP_Receiver::ReceiveTCPPacket, packet exceeds window at "); it_assert(segment.begin() < segment.end(), "TCP_Receiver::ReceiveTCPPacket, silly packet received at "); fReceiverBuffer.write(segment); if (isOutOfOrder) { SendACK(true); // create dupack conditionless } else { if (fACKOnBufferWrite) { SendACK(false); } IndicateUserMessage(); } delete &msg; } void TCP_Receiver::IndicateUserMessage() { if (fUserMessage == 0) { // receive a block unsigned noOfBytes = min(fReceiverBuffer.first_block_size(), fMaxUserBlockSize); if (fDebug) { std::cout << "TCP_Receiver::IndicateUserMessage " << "t = " << Event_Queue::now() << " noOfBytes = " << noOfBytes << " firstBlock = " << fReceiverBuffer.first_block_size() << std::endl; } if (noOfBytes >= fMinUserBlockSize) { fUserMessage = new Packet(); fUserMessage->set_bit_size(8*noOfBytes); fUserBlockProcTimer.Set(fUserBlockProcDelay); } } } bool TCP_Receiver::is_user_message_available() { if (fUserMessage != 0) { return true; } unsigned noOfBytes = min(fReceiverBuffer.first_block_size(), fMaxUserBlockSize); if (noOfBytes >= fMinUserBlockSize) { fUserMessage = new Packet(); fUserMessage->set_bit_size(8*noOfBytes); return true; } else { return false; } } itpp::Packet & TCP_Receiver::get_user_message() { it_assert(fUserMessage != 0, "TCP_Receiver::GetUserMessage, no message available"); if (fDebug) { std::cout << "TCP_Receiver::GetUserMessage " << "receiver: " << fLabel << ": " << "read from buffer: " << "t = " << Event_Queue::now() << ", user msg length = " << (fUserMessage->bit_size() / 8) << ", first byte = " << fReceiverBuffer.first_byte() << ", first block size = " << fReceiverBuffer.first_block_size() << std::endl; } fReceiverBuffer.read(fUserMessage->bit_size() / 8); if (fACKOnBufferRead) { SendACK(false); // send acknowledgement } itpp::Packet & msg = *fUserMessage; fUserMessage = 0; if (fReceiverBuffer.first_block_size() > 0) { IndicateUserMessage(); } return msg; } void TCP_Receiver::HandleEndOfProcessing(Ttype) { it_assert(fUserMessage != 0, "TCP_Receiver::HandleEndOfProcessing, no message available"); tcp_new_data(fLabel); } void TCP_Receiver::DelayedACKHandler(Ttype) { if (fDebug) { std::cout << "TCP_Receiver::DelayedACKHandler " << "receiver " << fLabel << ": delACK TO: " << "t = " << Event_Queue::now() << std::endl; } SendACK(true); } void TCP_Receiver::PeriodicACKHandler(Ttype) { if (fDebug) { std::cout << "TCP_Receiver::PeriodicACKHandler" << "receiver " << fLabel << ": periodicACK TO: " << "t = " << Event_Queue::now() << std::endl; } SendACK(true); } void TCP_Receiver::SendACK(bool sendConditionless) { // sendConditionless is set // ... if packet was received out of order or // ... if delayed ACK timer has expired // Bei eingeschaltetem "delayed ACK" wird ein ACK nur // gesendet, wenn das Fenster um 2MSS oder 35% der // maximalen Fenstergroesse verschoben worden ist // ... oder nach delayed ACK Timeout // ... oder wenn es das ACK fur ein Out of Order Segment ist // ... oder (in der Realitat), wenn ich auch was zu senden habe. if (sendConditionless || !fDelayedACK || (fReceiverBuffer.next_expected() - fAdvRcvNxt >= (int)(2 * fMSS)) || (fReceiverBuffer.next_expected() - fAdvRcvNxt >= (int)(0.35 * fBufferSize))) { // Remark: RFC2581 recommends to acknowledge every second // packet conditionless (without setting this as a requirement) // in order to avoid excessive ack delays when the receiver MSS // is larger than the sender MSS. In this uni-directional // implementation, the receiver's MSS is not actively // used for sending but only for deciding when acknowledgments // have to be returned. Thus, the best solution to account for // RFC2581 is to set the receiver's MSS always equal to the // sender's MSS. // Receiver Silly Window Syndrome Avoidance: if (fAdvRcvNxt + fAdvRcvWnd + min(fBufferSize / 2, fMSS) <= fReceiverBuffer.first_byte() + fBufferSize) { // Die rechte Grenze des Empfangerfensters wird nur anders angezeigt // als beim letzten ACK, wenn sie sich seither um mindestens // min (BufferSize/ 2, MSS) geandert hat. fAdvRcvWnd = fBufferSize - fReceiverBuffer.first_block_size(); } else { fAdvRcvWnd = fAdvRcvNxt + fAdvRcvWnd - fReceiverBuffer.next_expected(); } fAdvRcvNxt = fReceiverBuffer.next_expected(); if (fSendPeriodicACKs && (!fStrictPeriodicACKs || !fPeriodicACKTimer.IsPending())) { fPeriodicACKTimer.Set(fPeriodicACKInterval); } if (fDelayedACK && fDelayedACKTimer.IsPending()) { fDelayedACKTimer.Reset(); } ScheduleACKMessage(); } else { if (!fDelayedACKTimer.IsPending()) { fDelayedACKTimer.Set(fACKDelayTime); if (fDebug) { std::cout << "TCP_Receiver::SendACK" << "receiver " << fLabel << ": set delACK timer: " << "t = " << Event_Queue::now() << std::endl; } } } } void TCP_Receiver::ScheduleACKMessage() { if (fWaitingACKMsg == 0) { fWaitingACKMsg = new TCP_Packet; } fWaitingACKMsg->set_ACK(fAdvRcvNxt); fWaitingACKMsg->set_wnd(fAdvRcvWnd); fWaitingACKMsg->set_session_id(fSessionId); fWaitingACKMsg->set_destination_port(fLabel); fWaitingACKMsg->set_source_port(fLabel); fWaitingACKMsg->set_bit_size(8*fTCPIPHeaderLength); if (fACKSchedulingDelay > 0) { if (!fACKSchedulingTimer.IsPending()) { fACKSchedulingTimer.Set(fACKSchedulingDelay); } } else { SendACKMessage(Event_Queue::now()); } } void TCP_Receiver::SendACKMessage(Ttype) { it_assert(fWaitingACKMsg != 0, "TCP_Receiver::SendACKMessage, no ACK message waiting"); if (fDebug) { std::cout << "TCP_Receiver::SendACKMessage Ack sent" << "receiver " << fLabel << ": send ACK: " << "t = " << Event_Queue::now() << ", " << (*fWaitingACKMsg) << " byte_size=" << fWaitingACKMsg->bit_size() / 8 << " ptr=" << fWaitingACKMsg << std::endl; } tcp_send_ack(fWaitingACKMsg); fWaitingACKMsg = 0; } void TCP_Receiver::TraceReceivedSeqNo(const Sequence_Number &sn) { if (fDebug) { std::cout << "TCP_Receiver::TraceReceivedSeqNo " << "receiver " << fLabel << " t = " << Event_Queue::now() << " sn = " << sn << std::endl; } if (received_seq_num_index >= received_seq_num_time.size()) { received_seq_num_time.set_size(2*received_seq_num_time.size(), true); received_seq_num_val.set_size(2*received_seq_num_val.size(), true); } received_seq_num_val(received_seq_num_index) = sn.value(); received_seq_num_time(received_seq_num_index) = Event_Queue::now(); received_seq_num_index++; } void TCP_Receiver::save_trace(std::string filename) { received_seq_num_val.set_size(received_seq_num_index, true); received_seq_num_time.set_size(received_seq_num_index, true); if (fDebug) { std::cout << "received_seq_num_val" << received_seq_num_val << std::endl; std::cout << "received_seq_num_time" << received_seq_num_time << std::endl; std::cout << "received_seq_num_index" << received_seq_num_index << std::endl; std::cout << "TCP_Receiver::saving to file: " << filename << std::endl; } it_file ff2; ff2.open(filename); ff2 << Name("received_seq_num_val") << received_seq_num_val; ff2 << Name("received_seq_num_time") << received_seq_num_time; ff2 << Name("received_seq_num_index") << received_seq_num_index; ff2.flush(); ff2.close(); } } //namespace itpp #ifdef _MSC_VER #pragma warning(default:4355) #endif //! \endcond itpp-4.3.1/itpp/protocol/tcp.h000066400000000000000000000716641216575753400163040ustar00rootroot00000000000000/*! * \file * \brief Definition of Transport Control Protocol (TCP) * \author Krister Norlund * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * Copyright (c) 2000-2004 IKR (formerly IND), University of Stuttgart * This file is part of the IKR (formerly IND) TCP Library. */ #ifndef TCP_H #define TCP_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include #include #include namespace itpp { //! \addtogroup protocol //@{ /*! TSequenceNumber represents a sequence number in a byte stream. As simulations may get quite long sequence numbers based on 32 bit integers may overflow. This is not a major problem as long as this overflow is considered when comparing sequence numbers. TSequenceNumber defines relational operators base on subtraction instead of using built-in int relational operators. This approach works well for arbitrary long simulations as long as the "real" sequence numbers (i.e. the numbers seen without overflow) compared to each other do not differ by more than 2^31-1 (INT_MAX) which is not a serious restriction in a realistic TCP scenario.

      @sa TTCPSegment @author Bodamer */ class Sequence_Number { public: //! Default constructor Sequence_Number() : seq(0) { } //! ADD DOCUMENTATION HERE Sequence_Number(const Sequence_Number &n) : seq(n.seq) { } //! ADD DOCUMENTATION HERE Sequence_Number &operator=(const Sequence_Number &n) { seq = n.seq; return *this; } //! ADD DOCUMENTATION HERE Sequence_Number &operator=(const int &rep) { seq = rep; return *this; } //relational operators //! ADD DOCUMENTATION HERE bool operator==(const Sequence_Number &n) const { return seq == n.seq; } //! ADD DOCUMENTATION HERE bool operator!=(const Sequence_Number &n) const { return seq != n.seq; } //! ADD DOCUMENTATION HERE bool operator>(const Sequence_Number &n) const { return (seq - n.seq) > 0; } //! ADD DOCUMENTATION HERE bool operator>=(const Sequence_Number &n) const { return (seq - n.seq) >= 0; } //! ADD DOCUMENTATION HERE bool operator<(const Sequence_Number &n) const { return (seq - n.seq) < 0; } //! ADD DOCUMENTATION HERE bool operator<=(const Sequence_Number &n) const { return (seq - n.seq) <= 0; } //addition and subtraction //! ADD DOCUMENTATION HERE Sequence_Number operator+(const int n) const { return Sequence_Number(seq + n); } //! ADD DOCUMENTATION HERE Sequence_Number &operator+=(const int n) { seq += n; return *this; } //! ADD DOCUMENTATION HERE Sequence_Number operator-(const int n) const { return Sequence_Number(seq - n); } //! ADD DOCUMENTATION HERE Sequence_Number &operator-=(const int n) { seq -= n; return *this; } //! ADD DOCUMENTATION HERE int operator-(const Sequence_Number &n) const { return seq - n.seq; } //! Access to internal representation int value() const { return seq; } //! ADD DOCUMENTATION HERE friend Sequence_Number operator+(const int n1, const Sequence_Number &n2) { return Sequence_Number(n1 + n2.seq); } //! ADD DOCUMENTATION HERE friend std::ostream &operator<<(std::ostream &os, const Sequence_Number &n) { os << n.seq; return os; } protected: //! ADD DOCUMENTATION HERE Sequence_Number(int n) : seq(n) {} //! ADD DOCUMENTATION HERE int seq; }; //! ADD DOCUMENTATION HERE inline const Sequence_Number & min(const Sequence_Number &n1, const Sequence_Number &n2) { return (n1 < n2) ? n1 : n2; } //! ADD DOCUMENTATION HERE inline const Sequence_Number & max(const Sequence_Number &n1, const Sequence_Number &n2) { return (n1 > n2) ? n1 : n2; } /*! TCP is a byte oriented protcol. Parts of the byte stream that is transmitted are called segments. They are identified by sequence numbers TCP_Segment contains fileds for the beginning sequence number and the sequence number of the first byte in the following segment (i.e. the sequence number of the last byte + 1). TCP_Segment provides several const methods to compare segments and to check whether they overlap. TCP_Segment is, e.g., used in TTCPPacket and TTCPReceiverBuffer.

      @sa Sequence_Number @sa TTCPPacket @sa TTCPReceiverBuffer @author Lorang @author Bodamer */ class TCP_Segment { public: //! ADD DOCUMENTATION HERE TCP_Segment(); //! ADD DOCUMENTATION HERE TCP_Segment(const Sequence_Number &sn_begin, const Sequence_Number &sn_end); //! ADD DOCUMENTATION HERE TCP_Segment(const TCP_Segment &segment); //modification //! ADD DOCUMENTATION HERE TCP_Segment &operator=(const TCP_Segment &segment); //! ADD DOCUMENTATION HERE void set_begin(const Sequence_Number &sn); //! ADD DOCUMENTATION HERE void set_end(const Sequence_Number &sn); //! ADD DOCUMENTATION HERE void combine(const TCP_Segment &segment); //query //! ADD DOCUMENTATION HERE bool operator==(const TCP_Segment &segment) const; //! ADD DOCUMENTATION HERE bool operator!=(const TCP_Segment &segment) const; //! ADD DOCUMENTATION HERE bool can_be_combined(const TCP_Segment &segment) const; //! ADD DOCUMENTATION HERE bool is_contained(const TCP_Segment &segment) const; //! ADD DOCUMENTATION HERE unsigned length() const; //! ADD DOCUMENTATION HERE Sequence_Number begin() const { return seq_begin; } //! ADD DOCUMENTATION HERE Sequence_Number end() const { return seq_end; } //! ADD DOCUMENTATION HERE friend std::ostream & operator<<(std::ostream &os, const TCP_Segment &segment); protected: Sequence_Number seq_begin; /**< \brief no. of first byte of segment */ Sequence_Number seq_end; /**< \brief no. of last byte of segment + 1 */ }; /*! TCP_Packet is an IP packet with additional TCP header fields. Messages of this type are used for communication between TCP sender and receiver (data and ACKs).

      The class contains a segment of type TCP_Segment with sequence numbers for begin and end of the segment. This is only used in data packets (i.e. from sender to receiver) while there are also fields containing sequence number for the next expected segment (used to ACK data packets, i.e. from receiver to sender) and for the advertised receiver window.

      TCP_Packet has an additional field for the session id which my be compared with the pair (source port, destination port) in a real world TCP/IP packet.

      Furthermore, some debug info containing state information for TCP sender or receiver may be attached to the message.

      @sa TCP_Segment @sa TCP_Packet::TDebugInfo @author Grevent @author Lorang @author Bodamer */ class TCP_Packet : public itpp::Packet { public: //! ADD DOCUMENTATION HERE TCP_Packet(); //! ADD DOCUMENTATION HERE TCP_Packet(const TCP_Packet &packet); //! ADD DOCUMENTATION HERE virtual ~TCP_Packet(); //! ADD DOCUMENTATION HERE virtual TCP_Packet &clone() const; //TCP window mechanism //! ADD DOCUMENTATION HERE void set_segment(const TCP_Segment &seg) { fSegment = seg; } //! ADD DOCUMENTATION HERE TCP_Segment get_segment() const { return fSegment; } //! ADD DOCUMENTATION HERE void set_wnd(unsigned val) { fWnd = val; } //! ADD DOCUMENTATION HERE unsigned get_wnd() const { return fWnd; } //! ADD DOCUMENTATION HERE void set_ACK(Sequence_Number val) { fACK = val; } //! ADD DOCUMENTATION HERE Sequence_Number get_ACK() const { return fACK; } //session control //! ADD DOCUMENTATION HERE void set_session_id(int val) { fSessionId = val; } //! ADD DOCUMENTATION HERE int get_session_id() const { return fSessionId; } //debugging support //! ADD DOCUMENTATION HERE void set_destination_port(unsigned val) { fDestinationPort = val; } //! ADD DOCUMENTATION HERE unsigned get_destination_port() const { return fDestinationPort; } //! ADD DOCUMENTATION HERE void set_source_port(unsigned val) { fSourcePort = val; } //! ADD DOCUMENTATION HERE unsigned get_source_port() const { return fSourcePort; } //! ADD DOCUMENTATION HERE void set_info(unsigned ssThresh, unsigned recWnd, unsigned cWnd, double estRTT, Sequence_Number sndUna, Sequence_Number sndNxt, bool isRtx); //! ADD DOCUMENTATION HERE virtual void print_header(std::ostream &) const; protected: //! ADD DOCUMENTATION HERE unsigned fDestinationPort; //! ADD DOCUMENTATION HERE unsigned fSourcePort; TCP_Segment fSegment; /**< \brief data segment to be transmitted */ Sequence_Number fACK; /**< \brief acknowledgment (next expected sn) */ unsigned fWnd; /**< \brief window size (advertised by receiver) */ int fSessionId; /**< \brief session identifier */ //Tracing //! ADD DOCUMENTATION HERE struct TDebugInfo { unsigned fSSThresh; //!< ADD DOCUMENTATION HERE unsigned fRecWnd; //!< ADD DOCUMENTATION HERE unsigned fCWnd; //!< ADD DOCUMENTATION HERE double fRTTEstimate; //!< ADD DOCUMENTATION HERE Sequence_Number fSndUna; //!< ADD DOCUMENTATION HERE Sequence_Number fSndNxt; //!< ADD DOCUMENTATION HERE bool fRtxFlag; //!< ADD DOCUMENTATION HERE }; //! ADD DOCUMENTATION HERE TDebugInfo *fInfo; //! ADD DOCUMENTATION HERE friend std::ostream & operator<<(std::ostream &, TCP_Packet &); }; /*! TTCPSender is an entity that models TCP flow and congestion control at the sender side. It is one of the key components of the TCP module.

      TTCPSender communicates with its environment via three ports:

      • "input": receive messages from a generator/application
      • "output": send TCP packets into the network
      • "ackinput": receive TCP ACK packets from the network originated by the TCP receiver

      The sender is activated when the user entity (e.g. a generator) offers a message, whose length indicates the amount of data to be transferred, or when an ACK is received from the network. In both cases data is only sent if there is any unsent data available, the sending window (determined by the congestion window and by the receiver advertised window) is large enough and the silly window syndrome avoidance algorithm is passed. Data that has been sent remains in the sender buffer, which is modelled in a virtual manner, until it is acknowledged. If data has been ACKed it is erased in the sender buffer and the TCP sender tries to get new data and send it.

      TTCPSender can be used with different versions of congestion control: Tahoe, Reno, and New Reno. Moreover, various options (e.g. usage of Nagle/Karn/Go-Back-N algorithms) and parameters (e.g. mss, max cwnd, initial values, timer granularity) can be defined in the input file.

      The class provides a simplified connection control via methods Setup and Release. Those methods are only used to reset internal state variables. No control messages are sent over the network, i.e. the sender assumes that the corresponding methods at the receiver side are called as well.

      @sa TTCPSenderSet @sa TTCPReceiver @author Grevent @author Lorang @author Bodamer */ class TCP_Sender { public: //! ADD DOCUMENTATION HERE TCP_Sender(int label); //! ADD DOCUMENTATION HERE virtual ~TCP_Sender(); //connection control //! ADD DOCUMENTATION HERE virtual void setup(); //! ADD DOCUMENTATION HERE virtual void release(std::string trace_filename = ""); //! Print support virtual void print_item(std::ostream &, const std::string &); //! ADD DOCUMENTATION HERE virtual void set_debug(const bool enable_debug = true); //! ADD DOCUMENTATION HERE virtual void set_debug(bool enable_debug, bool enable_signal_debug); //! ADD DOCUMENTATION HERE virtual void set_trace(const bool enable_trace = true); //! ADD DOCUMENTATION HERE virtual void save_trace(std::string filename); //! ADD DOCUMENTATION HERE Signal tcp_send; //! ADD DOCUMENTATION HERE Slot tcp_receive_ack; //! ADD DOCUMENTATION HERE Slot tcp_socket_write; //! ADD DOCUMENTATION HERE Slot tcp_release; //Signal TcpSendSignal; //Slot TcpRecvAckSlot; //Slot SocketWriteSlot; //Slot ReleaseSlot; private: std::queue SocketWriteQueue; virtual void InitStatistics(); /**< \brief reset statistic counters */ virtual void HandleACK(TCP_Packet &); /**< \brief process incoming ACK */ virtual void SendNewData(bool skipSWSA = false); /**< \brief send new data */ virtual void UnaRetransmit(); /**< \brief TO or fast retransmit */ virtual void FinishFastRecovery(); /**< \brief actions at end of fast recovery */ virtual void ReduceSSThresh(); /**< \brief halving on dup ACK or TO */ virtual void SendMsg(TCP_Packet & msg); /**< \brief access to network */ virtual void HandleRtxTimeout(Ttype); /**< \brief what to do after Timeout */ virtual void IdleCheck(); /**< \brief check whether SSR after idle is done */ virtual void HandleSWSATimeout(Ttype); /**< \brief handler for SWSA/Nagle timer */ virtual unsigned GetNextSegmentSize(const Sequence_Number & begin); virtual unsigned SendWindow() const; /**< \brief min of CWnd, MaxCWnd and RecWnd */ virtual double CalcRTOValue() const; /**< \brief value for rtx timer */ virtual void SetRtxTimer(); virtual void UpdateRTTVariables(double sampleRTT); /**< \brief evaluate RTT measuremnt */ virtual void TraceCWnd(); virtual void TraceSentSeqNo(const Sequence_Number sn); virtual void TraceACKedSeqNo(const Sequence_Number sn); virtual void TraceRTTVariables(double sampleRTT); virtual void TraceSSThresh(); virtual std::string GenerateFilename(); void StopTransientPhase(); /**< \brief reset statistic counters */ enum eTCPVersion {kTahoe, kReno, kNewReno}; virtual void set_label(int label); //socket variables unsigned fLabel; // end point identification also used at receiver //message handling virtual void HandleUserMessageIndication(itpp::Packet *user_data); virtual void ReceiveMessageFromNet(itpp::Packet *msg); //parameters parsed from input file eTCPVersion fTCPVersion; // one of Reno, Tahoe, NewReno unsigned fMSS; // maximum segment size unsigned fTCPIPHeaderLength; /**< \brief additional msg length (normally 40 bytes) */ double fInitialRTT; /**< \brief RTT assumed before first measurement */ unsigned fInitialCWnd; /**< \brief initial congestion window -> RFC 2581 */ unsigned fInitialSSThresh; /**< \brief initial ssthresh -> RFC 2581 */ unsigned fMaxCWnd; /**< \brief congestion window boundary */ unsigned fDupACKThreshold; /**< \brief duplicate ACK threshold */ double fTimerGranularity; /**< \brief granularity for rtx/idle timer values */ double fMaxRTO; // max value of retransmission TO unsigned fMaxBackoff; /**< \brief max value of backoff value (Karn) */ bool fImmediateBackoffReset; /**< \brief reset backoff on first new ACK */ bool fKarn; /**< \brief exclude rtx packets from RTTM */ bool fGoBackN; /**< \brief use go-back-N on TO rtx */ bool fFlightSizeRecovery;// use flight size on fast rec. exit bool fRenoConservation; /**< \brief use cons. of packets on fast rec. (std.) */ bool fCarefulSSThreshReduction; /**< \brief use min(cwnd, flight size)/2 */ bool fIgnoreDupACKOnTORecovery; /**< \brief avoid fast rtx during TO recovery */ bool fCarefulMulFastRtxAvoidance; /**< \brief see RFC 2582, Section 5 */ bool fNagle; /**< \brief use Nagle algorithm */ double fSWSATimerValue; /**< \brief timer for silly wind. synd. avoidance */ bool fRestartAfterIdle; /**< \brief perform SSR after idle period */ bool fTraceCWnd; // print CWnd trace to cout bool fTraceSentSeqNo; /**< \brief print trace of sent SNs to cout */ bool fTraceACKedSeqNo; /**< \brief print trace of received ACKs to cout */ bool fDebug; // print additional information to cout bool fTrace; // store trace info in vectors //session identification int fSessionId; /**< \brief is increased when Release is called */ //TCP flow control (RFC 793) Sequence_Number fSndUna; // lowest unacknowledged sn Sequence_Number fSndNxt; // next byte to be sent Sequence_Number fSndMax; /**< \brief highest byte that has been sent +1 */ unsigned fRecWnd; // receiver advertised window unsigned fMaxRecWnd; /**< \brief maximum observed rec. window */ Sequence_Number fUserNxt; // next byte to be received from user //TCP congestion avoidance (RFC 2581, RFC 2001, RFC 2582) unsigned fCWnd; // congestion window unsigned fSSThresh; /**< \brief threshold between slow start and cong. avoid. */ unsigned fDupACKCnt; /**< \brief counter for duplicate ACKs */ Sequence_Number fRecoveryDupACK; /**< \brief sndmax on 3rd dup ACK (see RFC 2582) */ Sequence_Number fRecoveryTO; /**< \brief sndmax on TO (see RFC 2582) */ //TCP timers TTimer fRtxTimer; /**< \brief retransmission timer */ Sequence_Number fTimUna; /**< \brief byte rtx timer is running for */ TTimer fSWSATimer; /**< \brief SWSA/Nagle timer */ int fBackoff; /**< \brief backoff for rtx timer */ bool fPendingBackoffReset; /**< \brief reset backoff on next new ACK */ Ttype fLastSendTime; /**< \brief idle detection for SSR */ //round trip time measurement (RTTM) double fSRTT; /**< \brief smoothed mean round trip time */ double fRTTVar; /**< \brief variance of RTT time */ double fRTTEstimate; /**< \brief created from SRTT, RTTVar and gran. */ Sequence_Number fRTTMByte; /**< \brief byte for which RTTM is running */ bool fRTTMPending; /**< \brief is currently RTTN running? */ double fRTTMStartTime; /**< \brief beginning of a measurement */ //statistic counters unsigned long fNumberOfTimeouts; unsigned long fNumberOfFastRetransmits; unsigned long fNumberOfRTTMeasurements; unsigned long fNumberOfReceivedACKs; unsigned long fNumberOfIdleTimeouts; vec CWnd_val; vec CWnd_time; int CWnd_index; vec SSThresh_val; vec SSThresh_time; int SSThresh_index; ivec sent_seq_num_val; vec sent_seq_num_time; int sent_seq_num_index; ivec sender_recv_ack_seq_num_val; vec sender_recv_ack_seq_num_time; int sender_recv_ack_seq_num_index; vec RTTEstimate_val; vec RTTEstimate_time; int RTTEstimate_index; vec RTTsample_val; vec RTTsample_time; int RTTsample_index; }; /*! TTCPReceiverBuffer is an important part of TTCPReceiver. It is much more complex than the buffer model at the sender side as it has to keep track of out of order segments. The segments received are combined if possible and the resulting non-contiguous segments are stored in a linked list. Moreover TTCPReceiverBuffer stores the smallest sequence number that has not (yet) been read out by the TCP receiver ("first byte").

      Data is written to the buffer by TTCPReceiver using method Write and read out using method Read. Before reading data the TCP receiver has to check whether a data block in the stream is available by calling FirstBlockSize.

      Furthermore, TTCPReceiver requires information from TTCPReceiverBuffer, e.g. about the next sequence number that is missing in the stream (NextExpected) or the receiver window that can be advertised to the sender (Window).

      @sa TTCPReceiver @author Bodamer @author Kutter */ class TCP_Receiver_Buffer { public: //! ADD DOCUMENTATION HERE TCP_Receiver_Buffer(); //! ADD DOCUMENTATION HERE TCP_Receiver_Buffer(const TCP_Receiver_Buffer &); //! ADD DOCUMENTATION HERE ~TCP_Receiver_Buffer(); void reset(); /**< \brief clears internal list structure */ void write(TCP_Segment newBlock); /**< \brief add segment to the queue */ void read(unsigned noOfBytes); /**< \brief read up to "noOfBytes" bytes from queue */ unsigned first_block_size() const; /**< \brief size of first complete block */ Sequence_Number first_byte() const; /**< \brief first byte stored or missing */ Sequence_Number last_byte() const; /**< \brief highest byte received (+1) */ Sequence_Number next_expected() const; /**< \brief first byte missing */ //! ADD DOCUMENTATION HERE unsigned window() const; std::ostream &info(std::ostream &os, int detail = 0) const; /**< \brief print info */ protected: Sequence_Number fFirstByte; /**< \brief first byte stored or missing */ //! ADD DOCUMENTATION HERE std::list fBufList; }; /*! The TCP receiver models the receiver side of a TCP connection. It is connected to the network via ports "input" and "ackoutput" and to an entity modelling higher layers (e.g. a sink) via port "output".

      Incoming TCP messages are used to update the receiver buffer and as a trigger to send an ACK message back to the TCP sender. If the "DelayedACK" option is used ACKs are only sent for every second packet (unless in the case of out of order packets). If the received packet is not out of order (i.e. the next expected sequence number in the byte stream has increased) new data is delivered to the higher layer. This delivery may be delayed in the receiver itself (user block processing delay) or by the subsequent entity if it blocks on incoming message indications.

      A couple of parameters can be specified in the input file including delayed ACK timer value and timer granularity. The value of MSS should be equal to the one specified at the receiver side although it is only required for delayed ACK and receiver SWSA algorithms.

      Like the TCP sender TTCPReceiver provides a simplified connection control via methods Setup and Release. Those methods are only used to reset internal state variables. No control messages are sent over the network, i.e. the receiver assumes that the corresponding methods at the sender side are called as well.

      @sa TTCPReceiverSet @sa TTCPReceiverBuffer @sa TCP_Sender @author Grevent @author Lorang @author Bodamer */ class TCP_Receiver { public: //! ADD DOCUMENTATION HERE TCP_Receiver(int label); //! ADD DOCUMENTATION HERE virtual ~TCP_Receiver(); //name connection control //! ADD DOCUMENTATION HERE virtual void setup(); //! ADD DOCUMENTATION HERE virtual void release(std::string trace_filename = ""); //message handling itpp::Packet & get_user_message(); /**< \brief called by higher layer */ bool is_user_message_available(); /**< \brief called by higher layer */ //! ADD DOCUMENTATION HERE virtual void set_debug(const bool enable_debug = true); //! ADD DOCUMENTATION HERE virtual void set_debug(bool enable_debug, bool enable_signal_debug); //! ADD DOCUMENTATION HERE virtual void set_trace(const bool enable_trace = true); //! ADD DOCUMENTATION HERE virtual void save_trace(std::string filename); //! ADD DOCUMENTATION HERE Signal tcp_send_ack; //! ADD DOCUMENTATION HERE Slot tcp_receive; Signal tcp_new_data; /**< \brief indicate new data to higher layer */ //! ADD DOCUMENTATION HERE Slot tcp_release; private: void IndicateUserMessage(); /**< \brief indicate new data to higher layer */ virtual void ReceiveMessageFromNet(itpp::Packet* msg); /**< \brief receive from network */ virtual void ReceiveDataPacket(TCP_Packet & packet); /**< \brief receive TCP packet */ virtual void SendACK(bool); /**< \brief send an ACK if necessary or enforced */ virtual void ScheduleACKMessage(); /**< \brief prepare ACK message for sending */ virtual void SendACKMessage(Ttype); /**< \brief called by ACK scheduling timer */ virtual void DelayedACKHandler(Ttype); /**< \brief handler for delayed ACK timer */ virtual void PeriodicACKHandler(Ttype); /**< \brief handler for periodic ACK timer */ virtual void HandleEndOfProcessing(Ttype); /**< \brief handler for user msg proc. */ virtual void TraceReceivedSeqNo(const Sequence_Number &sn); virtual std::string GenerateFilename(); //basic variables TCP_Receiver_Buffer fReceiverBuffer; unsigned fLabel; //parameters read by the parser unsigned fTCPIPHeaderLength; /**< \brief overhead by TCP/IP headers */ unsigned fMSS; /**< \brief maximum segment size */ unsigned fBufferSize; /**< \brief size of receiver buffer */ bool fDelayedACK; /**< \brief if true, use delayed ACK */ Ttype fACKDelayTime; /**< \brief maximum time for delaying ACKs */ bool fSendPeriodicACKs; /**< \brief repeat ACKs if no data has been received */ bool fStrictPeriodicACKs; /**< \brief repeat ACKs independent of data received */ Ttype fPeriodicACKInterval;// interval after which an ACK is repeated Ttype fACKSchedulingDelay; /**< \brief ACK delay due to proc. scheduling */ bool fACKOnBufferWrite; /**< \brief send ACK after segment has been written */ bool fACKOnBufferRead; /**< \brief send ACK when segment is read by user */ unsigned fMaxUserBlockSize; /**< \brief max size of a user read block */ unsigned fMinUserBlockSize; /**< \brief min size of a user read block */ double fUserBlockProcDelay; /**< \brief time to read data from buffer + forward */ bool fTrace; /**< \brief trace end bytes of received packets */ bool fDebug; /**< \brief print additional information */ //specific TCP variables Sequence_Number fAdvRcvNxt; /**< \brief advertised next expected byte (ACK) */ unsigned fAdvRcvWnd; /**< \brief advertised receiver window */ //session management int fSessionId; /**< \brief increased by 1 on connection release */ //ACK timers TTimer fDelayedACKTimer; /**< \brief timer for delayed ACK */ TTimer fPeriodicACKTimer; /**< \brief timer for periodic ACKs */ TTimer fACKSchedulingTimer; TCP_Packet * fWaitingACKMsg; //user data delivery Packet * fUserMessage; TTimer fUserBlockProcTimer; //statistic counters ivec received_seq_num_val; vec received_seq_num_time; int received_seq_num_index; }; // ------------------------------- Inline definitions --------------------------------------------- inline Sequence_Number TCP_Receiver_Buffer::first_byte() const { return fFirstByte; } inline Sequence_Number TCP_Receiver_Buffer::last_byte() const { if (fBufList.empty()) { return fFirstByte; } else { return fBufList.back().end(); } } inline Sequence_Number TCP_Receiver_Buffer::next_expected() const { return fFirstByte + first_block_size(); } inline void TCP_Segment::set_begin(const Sequence_Number &sn) { seq_begin = sn; it_assert(seq_begin <= seq_end, "TCP_Segment::begin, end byte " + to_str(seq_end.value()) + " < begin byte " + to_str(seq_begin.value())); } inline void TCP_Segment::set_end(const Sequence_Number &sn) { seq_end = sn; it_assert(seq_begin <= seq_end, "TCP_Segment::set_begin, end byte " + to_str(seq_end.value()) + " < begin byte " + to_str(seq_begin.value())); } inline bool TCP_Segment::operator==(const TCP_Segment &segment) const { return (this->seq_begin == segment.seq_begin) && (this->seq_end == segment.seq_end); } inline bool TCP_Segment::operator!=(const TCP_Segment &segment) const { return (this->seq_begin != segment.seq_begin) || (this->seq_end != segment.seq_end); } inline bool TCP_Segment::can_be_combined(const TCP_Segment &segment) const { return (this->seq_begin <= segment.seq_end) && (segment.seq_begin <= this->seq_end); } inline bool TCP_Segment::is_contained(const TCP_Segment &segment) const { return (segment.seq_begin <= this->seq_begin) && (this->seq_end <= segment.seq_end); } inline unsigned TCP_Segment::length() const { return seq_end - seq_begin; } //@} } // namespace itpp #endif #endif // #ifndef TCP_H itpp-4.3.1/itpp/protocol/tcp_client_server.h000066400000000000000000000111071216575753400212120ustar00rootroot00000000000000/*! * \file * \brief Definitions of TCP Client and Server Applications * \author Krister Norlund * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef TCP_CLIENT_SERVER_H #define TCP_CLIENT_SERVER_H #include #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !defined(itpp_EXPORTS)) #ifndef ITPP_PROTOCOL_EXCLUDED #define ITPP_PROTOCOL_EXCLUDED #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) #endif #else #include namespace itpp { //! \addtogroup protocol //@{ /*! ADD DOCUMENTATION HERE */ class TCP_Server_Application { public: //! Default constructor TCP_Server_Application() { write.set_name("TcpServerApplicationWriteSignal"); write.set_debug(); } //! Destructor ~TCP_Server_Application() { } //! ADD DOCUMENTATION HERE Signal write; //! ADD DOCUMENTATION HERE void write_to_net(unsigned byte_size, double delta_time) { itpp::Packet *packet = new Packet(8*byte_size); write(packet, delta_time); std::cout << "TcpServerApplication::write_to_net," << " byte_size=" << packet->bit_size() / 8 << " ptr=" << packet << " time=" << Event_Queue::now() << std::endl; } }; /*! ADD DOCUMENTATION HERE */ class TCP_Client_Application { public: //! Default constructor TCP_Client_Application(TCP_Sender *tcp_snd_p, TCP_Receiver *tcp_recv_p) { tcp_receiver_p = tcp_recv_p; tcp_sender_p = tcp_snd_p; nbr_bytes_received = 0; select.forward(this, &TCP_Client_Application::received_packet_indication); select.set_name("TcpClientApplicationSelectSlot"); seq_num_index = 0; } //! Destructor ~TCP_Client_Application() { } //! ADD DOCUMENTATION HERE Slot select; //! ADD DOCUMENTATION HERE void read_from_net(unsigned byte_size) { nbr_bytes_to_receive = byte_size; seq_num_val.set_size(10 + byte_size / 1460); seq_num_val.zeros(); seq_num_time.set_size(10 + byte_size / 1460); seq_num_time.zeros(); seq_num_val(0) = 0; seq_num_time(0) = 0; seq_num_index = 1; }; private: TCP_Receiver *tcp_receiver_p; TCP_Sender *tcp_sender_p; unsigned nbr_bytes_received; unsigned nbr_bytes_to_receive; vec seq_num_val; vec seq_num_time; int seq_num_index; void TCP_Client_Application::received_packet_indication(int label) { itpp::Packet &packet = tcp_receiver_p->get_user_message(); nbr_bytes_received = nbr_bytes_received + packet.bit_size() / 8; delete &packet; if (seq_num_index >= seq_num_time.size()) { seq_num_time.set_size(2*seq_num_time.size(), true); seq_num_val.set_size(2*seq_num_val.size(), true); } seq_num_val(seq_num_index) = nbr_bytes_received; seq_num_time(seq_num_index) = Event_Queue::now(); seq_num_index++; std::cout << "### sequence number: " << nbr_bytes_received << " ### time:" << Event_Queue::now() << std::endl; if (nbr_bytes_received >= nbr_bytes_to_receive) { std::cout << "###### Stop sender and receiver" << std::endl; tcp_receiver_p->release(); tcp_sender_p->release(); tcp_sender_p->save_trace("seq_num.it"); seq_num_val.set_size(seq_num_index, true); seq_num_time.set_size(seq_num_index, true); save_to_file("seq_num.it"); } } void TCP_Client_Application::save_to_file(string file) { it_file ff2(file); ff2 << Name("seq_num_val") << seq_num_val; ff2 << Name("seq_num_time") << seq_num_time; ff2 << Name("seq_num_index") << seq_num_index; ff2.flush(); ff2.close(); } }; //@} } // namespace itpp #endif #endif //TCP_CLIENT_SERVER_H itpp-4.3.1/itpp/signal/000077500000000000000000000000001216575753400147435ustar00rootroot00000000000000itpp-4.3.1/itpp/signal/Makefile.am000066400000000000000000000007421216575753400170020ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libsignal.la if ENABLE_DEBUG noinst_LTLIBRARIES += libsignal_debug.la endif libsignal_la_SOURCES = $(h_signal_sources) $(cpp_signal_sources) libsignal_la_CXXFLAGS = $(CXXFLAGS_OPT) libsignal_debug_la_SOURCES = $(h_signal_sources) $(cpp_signal_sources) libsignal_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/signal pkginclude_HEADERS = $(h_signal_sources) itpp-4.3.1/itpp/signal/Makefile.in000066400000000000000000001317471216575753400170250ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libsignal_debug.la subdir = itpp/signal ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libsignal_la_LIBADD = am__objects_1 = am__objects_2 = libsignal_la-fastica.lo libsignal_la-filter_design.lo \ libsignal_la-filter.lo libsignal_la-freq_filt.lo \ libsignal_la-poly.lo libsignal_la-resampling.lo \ libsignal_la-sigfun.lo libsignal_la-source.lo \ libsignal_la-transforms.lo libsignal_la-window.lo am_libsignal_la_OBJECTS = $(am__objects_1) $(am__objects_2) libsignal_la_OBJECTS = $(am_libsignal_la_OBJECTS) libsignal_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libsignal_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libsignal_debug_la_LIBADD = am__objects_3 = libsignal_debug_la-fastica.lo \ libsignal_debug_la-filter_design.lo \ libsignal_debug_la-filter.lo libsignal_debug_la-freq_filt.lo \ libsignal_debug_la-poly.lo libsignal_debug_la-resampling.lo \ libsignal_debug_la-sigfun.lo libsignal_debug_la-source.lo \ libsignal_debug_la-transforms.lo libsignal_debug_la-window.lo am_libsignal_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libsignal_debug_la_OBJECTS = $(am_libsignal_debug_la_OBJECTS) libsignal_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libsignal_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libsignal_la_SOURCES) $(libsignal_debug_la_SOURCES) DIST_SOURCES = $(libsignal_la_SOURCES) $(libsignal_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/signal ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_signal_sources = \ $(top_srcdir)/itpp/signal/fastica.h \ $(top_srcdir)/itpp/signal/filter_design.h \ $(top_srcdir)/itpp/signal/filter.h \ $(top_srcdir)/itpp/signal/freq_filt.h \ $(top_srcdir)/itpp/signal/poly.h \ $(top_srcdir)/itpp/signal/resampling.h \ $(top_srcdir)/itpp/signal/sigfun.h \ $(top_srcdir)/itpp/signal/source.h \ $(top_srcdir)/itpp/signal/transforms.h \ $(top_srcdir)/itpp/signal/window.h cpp_signal_sources = \ $(top_srcdir)/itpp/signal/fastica.cpp \ $(top_srcdir)/itpp/signal/filter_design.cpp \ $(top_srcdir)/itpp/signal/filter.cpp \ $(top_srcdir)/itpp/signal/freq_filt.cpp \ $(top_srcdir)/itpp/signal/poly.cpp \ $(top_srcdir)/itpp/signal/resampling.cpp \ $(top_srcdir)/itpp/signal/sigfun.cpp \ $(top_srcdir)/itpp/signal/source.cpp \ $(top_srcdir)/itpp/signal/transforms.cpp \ $(top_srcdir)/itpp/signal/window.cpp noinst_LTLIBRARIES = libsignal.la $(am__append_1) libsignal_la_SOURCES = $(h_signal_sources) $(cpp_signal_sources) libsignal_la_CXXFLAGS = $(CXXFLAGS_OPT) libsignal_debug_la_SOURCES = $(h_signal_sources) $(cpp_signal_sources) libsignal_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_signal_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/signal/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/signal/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libsignal.la: $(libsignal_la_OBJECTS) $(libsignal_la_DEPENDENCIES) $(libsignal_la_LINK) $(libsignal_la_OBJECTS) $(libsignal_la_LIBADD) $(LIBS) libsignal_debug.la: $(libsignal_debug_la_OBJECTS) $(libsignal_debug_la_DEPENDENCIES) $(libsignal_debug_la_LINK) $(am_libsignal_debug_la_rpath) $(libsignal_debug_la_OBJECTS) $(libsignal_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-fastica.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-filter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-filter_design.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-freq_filt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-poly.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-resampling.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-sigfun.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-source.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-transforms.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_debug_la-window.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-fastica.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-filter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-filter_design.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-freq_filt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-poly.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-resampling.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-sigfun.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-source.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-transforms.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsignal_la-window.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libsignal_la-fastica.lo: $(top_srcdir)/itpp/signal/fastica.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-fastica.lo -MD -MP -MF $(DEPDIR)/libsignal_la-fastica.Tpo -c -o libsignal_la-fastica.lo `test -f '$(top_srcdir)/itpp/signal/fastica.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/fastica.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-fastica.Tpo $(DEPDIR)/libsignal_la-fastica.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/fastica.cpp' object='libsignal_la-fastica.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-fastica.lo `test -f '$(top_srcdir)/itpp/signal/fastica.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/fastica.cpp libsignal_la-filter_design.lo: $(top_srcdir)/itpp/signal/filter_design.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-filter_design.lo -MD -MP -MF $(DEPDIR)/libsignal_la-filter_design.Tpo -c -o libsignal_la-filter_design.lo `test -f '$(top_srcdir)/itpp/signal/filter_design.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter_design.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-filter_design.Tpo $(DEPDIR)/libsignal_la-filter_design.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/filter_design.cpp' object='libsignal_la-filter_design.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-filter_design.lo `test -f '$(top_srcdir)/itpp/signal/filter_design.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter_design.cpp libsignal_la-filter.lo: $(top_srcdir)/itpp/signal/filter.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-filter.lo -MD -MP -MF $(DEPDIR)/libsignal_la-filter.Tpo -c -o libsignal_la-filter.lo `test -f '$(top_srcdir)/itpp/signal/filter.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-filter.Tpo $(DEPDIR)/libsignal_la-filter.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/filter.cpp' object='libsignal_la-filter.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-filter.lo `test -f '$(top_srcdir)/itpp/signal/filter.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter.cpp libsignal_la-freq_filt.lo: $(top_srcdir)/itpp/signal/freq_filt.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-freq_filt.lo -MD -MP -MF $(DEPDIR)/libsignal_la-freq_filt.Tpo -c -o libsignal_la-freq_filt.lo `test -f '$(top_srcdir)/itpp/signal/freq_filt.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/freq_filt.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-freq_filt.Tpo $(DEPDIR)/libsignal_la-freq_filt.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/freq_filt.cpp' object='libsignal_la-freq_filt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-freq_filt.lo `test -f '$(top_srcdir)/itpp/signal/freq_filt.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/freq_filt.cpp libsignal_la-poly.lo: $(top_srcdir)/itpp/signal/poly.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-poly.lo -MD -MP -MF $(DEPDIR)/libsignal_la-poly.Tpo -c -o libsignal_la-poly.lo `test -f '$(top_srcdir)/itpp/signal/poly.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/poly.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-poly.Tpo $(DEPDIR)/libsignal_la-poly.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/poly.cpp' object='libsignal_la-poly.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-poly.lo `test -f '$(top_srcdir)/itpp/signal/poly.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/poly.cpp libsignal_la-resampling.lo: $(top_srcdir)/itpp/signal/resampling.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-resampling.lo -MD -MP -MF $(DEPDIR)/libsignal_la-resampling.Tpo -c -o libsignal_la-resampling.lo `test -f '$(top_srcdir)/itpp/signal/resampling.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/resampling.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-resampling.Tpo $(DEPDIR)/libsignal_la-resampling.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/resampling.cpp' object='libsignal_la-resampling.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-resampling.lo `test -f '$(top_srcdir)/itpp/signal/resampling.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/resampling.cpp libsignal_la-sigfun.lo: $(top_srcdir)/itpp/signal/sigfun.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-sigfun.lo -MD -MP -MF $(DEPDIR)/libsignal_la-sigfun.Tpo -c -o libsignal_la-sigfun.lo `test -f '$(top_srcdir)/itpp/signal/sigfun.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/sigfun.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-sigfun.Tpo $(DEPDIR)/libsignal_la-sigfun.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/sigfun.cpp' object='libsignal_la-sigfun.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-sigfun.lo `test -f '$(top_srcdir)/itpp/signal/sigfun.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/sigfun.cpp libsignal_la-source.lo: $(top_srcdir)/itpp/signal/source.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-source.lo -MD -MP -MF $(DEPDIR)/libsignal_la-source.Tpo -c -o libsignal_la-source.lo `test -f '$(top_srcdir)/itpp/signal/source.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/source.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-source.Tpo $(DEPDIR)/libsignal_la-source.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/source.cpp' object='libsignal_la-source.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-source.lo `test -f '$(top_srcdir)/itpp/signal/source.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/source.cpp libsignal_la-transforms.lo: $(top_srcdir)/itpp/signal/transforms.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-transforms.lo -MD -MP -MF $(DEPDIR)/libsignal_la-transforms.Tpo -c -o libsignal_la-transforms.lo `test -f '$(top_srcdir)/itpp/signal/transforms.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/transforms.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-transforms.Tpo $(DEPDIR)/libsignal_la-transforms.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/transforms.cpp' object='libsignal_la-transforms.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-transforms.lo `test -f '$(top_srcdir)/itpp/signal/transforms.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/transforms.cpp libsignal_la-window.lo: $(top_srcdir)/itpp/signal/window.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_la-window.lo -MD -MP -MF $(DEPDIR)/libsignal_la-window.Tpo -c -o libsignal_la-window.lo `test -f '$(top_srcdir)/itpp/signal/window.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/window.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_la-window.Tpo $(DEPDIR)/libsignal_la-window.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/window.cpp' object='libsignal_la-window.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_la-window.lo `test -f '$(top_srcdir)/itpp/signal/window.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/window.cpp libsignal_debug_la-fastica.lo: $(top_srcdir)/itpp/signal/fastica.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-fastica.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-fastica.Tpo -c -o libsignal_debug_la-fastica.lo `test -f '$(top_srcdir)/itpp/signal/fastica.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/fastica.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-fastica.Tpo $(DEPDIR)/libsignal_debug_la-fastica.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/fastica.cpp' object='libsignal_debug_la-fastica.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-fastica.lo `test -f '$(top_srcdir)/itpp/signal/fastica.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/fastica.cpp libsignal_debug_la-filter_design.lo: $(top_srcdir)/itpp/signal/filter_design.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-filter_design.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-filter_design.Tpo -c -o libsignal_debug_la-filter_design.lo `test -f '$(top_srcdir)/itpp/signal/filter_design.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter_design.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-filter_design.Tpo $(DEPDIR)/libsignal_debug_la-filter_design.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/filter_design.cpp' object='libsignal_debug_la-filter_design.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-filter_design.lo `test -f '$(top_srcdir)/itpp/signal/filter_design.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter_design.cpp libsignal_debug_la-filter.lo: $(top_srcdir)/itpp/signal/filter.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-filter.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-filter.Tpo -c -o libsignal_debug_la-filter.lo `test -f '$(top_srcdir)/itpp/signal/filter.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-filter.Tpo $(DEPDIR)/libsignal_debug_la-filter.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/filter.cpp' object='libsignal_debug_la-filter.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-filter.lo `test -f '$(top_srcdir)/itpp/signal/filter.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/filter.cpp libsignal_debug_la-freq_filt.lo: $(top_srcdir)/itpp/signal/freq_filt.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-freq_filt.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-freq_filt.Tpo -c -o libsignal_debug_la-freq_filt.lo `test -f '$(top_srcdir)/itpp/signal/freq_filt.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/freq_filt.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-freq_filt.Tpo $(DEPDIR)/libsignal_debug_la-freq_filt.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/freq_filt.cpp' object='libsignal_debug_la-freq_filt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-freq_filt.lo `test -f '$(top_srcdir)/itpp/signal/freq_filt.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/freq_filt.cpp libsignal_debug_la-poly.lo: $(top_srcdir)/itpp/signal/poly.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-poly.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-poly.Tpo -c -o libsignal_debug_la-poly.lo `test -f '$(top_srcdir)/itpp/signal/poly.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/poly.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-poly.Tpo $(DEPDIR)/libsignal_debug_la-poly.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/poly.cpp' object='libsignal_debug_la-poly.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-poly.lo `test -f '$(top_srcdir)/itpp/signal/poly.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/poly.cpp libsignal_debug_la-resampling.lo: $(top_srcdir)/itpp/signal/resampling.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-resampling.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-resampling.Tpo -c -o libsignal_debug_la-resampling.lo `test -f '$(top_srcdir)/itpp/signal/resampling.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/resampling.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-resampling.Tpo $(DEPDIR)/libsignal_debug_la-resampling.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/resampling.cpp' object='libsignal_debug_la-resampling.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-resampling.lo `test -f '$(top_srcdir)/itpp/signal/resampling.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/resampling.cpp libsignal_debug_la-sigfun.lo: $(top_srcdir)/itpp/signal/sigfun.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-sigfun.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-sigfun.Tpo -c -o libsignal_debug_la-sigfun.lo `test -f '$(top_srcdir)/itpp/signal/sigfun.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/sigfun.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-sigfun.Tpo $(DEPDIR)/libsignal_debug_la-sigfun.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/sigfun.cpp' object='libsignal_debug_la-sigfun.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-sigfun.lo `test -f '$(top_srcdir)/itpp/signal/sigfun.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/sigfun.cpp libsignal_debug_la-source.lo: $(top_srcdir)/itpp/signal/source.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-source.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-source.Tpo -c -o libsignal_debug_la-source.lo `test -f '$(top_srcdir)/itpp/signal/source.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/source.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-source.Tpo $(DEPDIR)/libsignal_debug_la-source.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/source.cpp' object='libsignal_debug_la-source.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-source.lo `test -f '$(top_srcdir)/itpp/signal/source.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/source.cpp libsignal_debug_la-transforms.lo: $(top_srcdir)/itpp/signal/transforms.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-transforms.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-transforms.Tpo -c -o libsignal_debug_la-transforms.lo `test -f '$(top_srcdir)/itpp/signal/transforms.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/transforms.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-transforms.Tpo $(DEPDIR)/libsignal_debug_la-transforms.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/transforms.cpp' object='libsignal_debug_la-transforms.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-transforms.lo `test -f '$(top_srcdir)/itpp/signal/transforms.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/transforms.cpp libsignal_debug_la-window.lo: $(top_srcdir)/itpp/signal/window.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsignal_debug_la-window.lo -MD -MP -MF $(DEPDIR)/libsignal_debug_la-window.Tpo -c -o libsignal_debug_la-window.lo `test -f '$(top_srcdir)/itpp/signal/window.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/window.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsignal_debug_la-window.Tpo $(DEPDIR)/libsignal_debug_la-window.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/signal/window.cpp' object='libsignal_debug_la-window.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsignal_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsignal_debug_la-window.lo `test -f '$(top_srcdir)/itpp/signal/window.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/signal/window.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/signal/fastica.cpp000066400000000000000000000673771216575753400171050ustar00rootroot00000000000000/*! * \file * \brief Implementation of FastICA (Independent Component Analysis) for IT++ * \author Francois Cayre and Teddy Furon * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is IT++ implementation of the original Matlab package FastICA. * * This code is Copyright (C) 2004 by: * Francois CAYRE and Teddy FURON * TEMICS Project * INRIA/Rennes (IRISA) * Campus Universitaire de Beaulieu * 35042 RENNES cedex FRANCE * * Email : firstname.lastname@irisa.fr * * Matlab package is Copyright (C) 1998 by: * Jarmo HURRI, Hugo GAVERT, Jaakko SARELA and Aapo HYVARINEN * Laboratory of Information and Computer Science * Helsinki University of Technology * * * URL : http://www.cis.hut.fi/projects/ica/fastica/about.shtml * * If you use results given by this FastICA software in an article for * a scientific journal, conference proceedings or similar, please * include the following original reference in the bibliography : * * A. Hyvarinen, Fast and Robust Fixed-Point Algorithms for * Independent Component Analysis, IEEE Transactions on Neural * Networks 10(3):626-634, 1999 * * Differences with the original Matlab implementation: * - no GUI * - return something even in the case of a convergence problem * - optimization of SVD decomposition (performed 2 times in Matlab, * only 1 time in IT++) * - default approach is SYMM with non-linearity POW3 */ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace itpp; /*! \brief Local functions for FastICA @{ */ static void selcol(const mat oldMatrix, const vec maskVector, mat & newMatrix); static int pcamat(const mat vectors, const int numOfIC, int firstEig, int lastEig, mat & Es, vec & Ds); static void remmean(mat inVectors, mat & outVectors, vec & meanValue); static void whitenv(const mat vectors, const mat E, const mat D, mat & newVectors, mat & whiteningMatrix, mat & dewhiteningMatrix); static mat orth(const mat A); static mat mpower(const mat A, const double y); static ivec getSamples(const int max, const double percentage); static vec sumcol(const mat A); static bool fpica(const mat X, const mat whiteningMatrix, const mat dewhiteningMatrix, const int approach, const int numOfIC, const int g, const int finetune, const double a1, const double a2, double myy, const int stabilization, const double epsilon, const int maxNumIterations, const int maxFinetune, const int initState, mat guess, double sampleSize, mat & A, mat & W); /*! @} */ namespace itpp { // Constructor, init default values Fast_ICA::Fast_ICA(mat ma_mixedSig) { // Init default values approach = FICA_APPROACH_SYMM; g = FICA_NONLIN_POW3; finetune = true; a1 = 1.0; a2 = 1.0; mu = 1.0; epsilon = 0.0001; sampleSize = 1.0; stabilization = false; maxNumIterations = 100000; maxFineTune = 100; firstEig = 1; mixedSig = ma_mixedSig; lastEig = mixedSig.rows(); numOfIC = mixedSig.rows(); PCAonly = false; initState = FICA_INIT_RAND; } // Call main function bool Fast_ICA::separate(void) { int Dim = numOfIC; mat mixedSigC; vec mixedMean; mat guess; if (initState == FICA_INIT_RAND) guess = zeros(Dim, Dim); else guess = mat(initGuess); VecPr = zeros(mixedSig.rows(), numOfIC); icasig = zeros(numOfIC, mixedSig.cols()); remmean(mixedSig, mixedSigC, mixedMean); if (pcamat(mixedSigC, numOfIC, firstEig, lastEig, E, D) < 1) { // no principal components could be found (e.g. all-zero data): return the unchanged input icasig = mixedSig; return false; } whitenv(mixedSigC, E, diag(D), whitesig, whiteningMatrix, dewhiteningMatrix); Dim = whitesig.rows(); if (numOfIC > Dim) numOfIC = Dim; ivec NcFirst = to_ivec(zeros(numOfIC)); vec NcVp = D; for (int i = 0; i < NcFirst.size(); i++) { NcFirst(i) = max_index(NcVp); NcVp(NcFirst(i)) = 0.0; VecPr.set_col(i, dewhiteningMatrix.get_col(i)); } bool result = true; if (PCAonly == false) { result = fpica(whitesig, whiteningMatrix, dewhiteningMatrix, approach, numOfIC, g, finetune, a1, a2, mu, stabilization, epsilon, maxNumIterations, maxFineTune, initState, guess, sampleSize, A, W); icasig = W * mixedSig; } else { // PCA only : returns E as IcaSig icasig = VecPr; } return result; } void Fast_ICA::set_approach(int in_approach) { approach = in_approach; if (approach == FICA_APPROACH_DEFL) finetune = true; } void Fast_ICA::set_nrof_independent_components(int in_nrIC) { numOfIC = in_nrIC; } void Fast_ICA::set_non_linearity(int in_g) { g = in_g; } void Fast_ICA::set_fine_tune(bool in_finetune) { finetune = in_finetune; } void Fast_ICA::set_a1(double fl_a1) { a1 = fl_a1; } void Fast_ICA::set_a2(double fl_a2) { a2 = fl_a2; } void Fast_ICA::set_mu(double fl_mu) { mu = fl_mu; } void Fast_ICA::set_epsilon(double fl_epsilon) { epsilon = fl_epsilon; } void Fast_ICA::set_sample_size(double fl_sampleSize) { sampleSize = fl_sampleSize; } void Fast_ICA::set_stabilization(bool in_stabilization) { stabilization = in_stabilization; } void Fast_ICA::set_max_num_iterations(int in_maxNumIterations) { maxNumIterations = in_maxNumIterations; } void Fast_ICA::set_max_fine_tune(int in_maxFineTune) { maxFineTune = in_maxFineTune; } void Fast_ICA::set_first_eig(int in_firstEig) { firstEig = in_firstEig; } void Fast_ICA::set_last_eig(int in_lastEig) { lastEig = in_lastEig; } void Fast_ICA::set_pca_only(bool in_PCAonly) { PCAonly = in_PCAonly; } void Fast_ICA::set_init_guess(mat ma_initGuess) { initGuess = ma_initGuess; initState = FICA_INIT_GUESS; } mat Fast_ICA::get_mixing_matrix() { if (PCAonly) { it_warning("No ICA performed."); return (zeros(1, 1));} else return A; } mat Fast_ICA::get_separating_matrix() { if (PCAonly) { it_warning("No ICA performed."); return(zeros(1, 1)); } else return W; } mat Fast_ICA::get_independent_components() { if (PCAonly) { it_warning("No ICA performed."); return(zeros(1, 1)); } else return icasig; } int Fast_ICA::get_nrof_independent_components() { return numOfIC; } mat Fast_ICA::get_principal_eigenvectors() { return VecPr; } mat Fast_ICA::get_whitening_matrix() { return whiteningMatrix; } mat Fast_ICA::get_dewhitening_matrix() { return dewhiteningMatrix; } mat Fast_ICA::get_white_sig() { return whitesig; } } // namespace itpp static void selcol(const mat oldMatrix, const vec maskVector, mat & newMatrix) { int numTaken = 0; for (int i = 0; i < size(maskVector); i++) if (maskVector(i) == 1) numTaken++; newMatrix = zeros(oldMatrix.rows(), numTaken); numTaken = 0; for (int i = 0; i < size(maskVector); i++) { if (maskVector(i) == 1) { newMatrix.set_col(numTaken, oldMatrix.get_col(i)); numTaken++; } } return; } static int pcamat(const mat vectors, const int numOfIC, int firstEig, int lastEig, mat & Es, vec & Ds) { mat Et; vec Dt; cmat Ec; cvec Dc; double lowerLimitValue = 0.0, higherLimitValue = 0.0; int oldDimension = vectors.rows(); mat covarianceMatrix = cov(transpose(vectors), 0); eig_sym(covarianceMatrix, Dt, Et); int maxLastEig = 0; // Compute rank for (int i = 0; i < Dt.length(); i++) if (Dt(i) > FICA_TOL) maxLastEig++; if (maxLastEig < 1) return 0; // Force numOfIC components if (maxLastEig > numOfIC) maxLastEig = numOfIC; vec eigenvalues = zeros(size(Dt)); vec eigenvalues2 = zeros(size(Dt)); eigenvalues2 = Dt; sort(eigenvalues2); vec lowerColumns = zeros(size(Dt)); for (int i = 0; i < size(Dt); i++) eigenvalues(i) = eigenvalues2(size(Dt) - i - 1); if (lastEig > maxLastEig) lastEig = maxLastEig; if (lastEig < oldDimension) lowerLimitValue = (eigenvalues(lastEig - 1) + eigenvalues(lastEig)) / 2; else lowerLimitValue = eigenvalues(oldDimension - 1) - 1; for (int i = 0; i < size(Dt); i++) if (Dt(i) > lowerLimitValue) lowerColumns(i) = 1; if (firstEig > 1) higherLimitValue = (eigenvalues(firstEig - 2) + eigenvalues(firstEig - 1)) / 2; else higherLimitValue = eigenvalues(0) + 1; vec higherColumns = zeros(size(Dt)); for (int i = 0; i < size(Dt); i++) if (Dt(i) < higherLimitValue) higherColumns(i) = 1; vec selectedColumns = zeros(size(Dt)); for (int i = 0; i < size(Dt); i++) selectedColumns(i) = (lowerColumns(i) == 1 && higherColumns(i) == 1) ? 1 : 0; selcol(Et, selectedColumns, Es); int numTaken = 0; for (int i = 0; i < size(selectedColumns); i++) if (selectedColumns(i) == 1) numTaken++; Ds = zeros(numTaken); numTaken = 0; for (int i = 0; i < size(Dt); i++) if (selectedColumns(i) == 1) { Ds(numTaken) = Dt(i); numTaken++; } return lastEig; } static void remmean(mat inVectors, mat & outVectors, vec & meanValue) { outVectors = zeros(inVectors.rows(), inVectors.cols()); meanValue = zeros(inVectors.rows()); for (int i = 0; i < inVectors.rows(); i++) { meanValue(i) = mean(inVectors.get_row(i)); for (int j = 0; j < inVectors.cols(); j++) outVectors(i, j) = inVectors(i, j) - meanValue(i); } } static void whitenv(const mat vectors, const mat E, const mat D, mat & newVectors, mat & whiteningMatrix, mat & dewhiteningMatrix) { whiteningMatrix = zeros(E.cols(), E.rows()); dewhiteningMatrix = zeros(E.rows(), E.cols()); for (int i = 0; i < D.cols(); i++) { whiteningMatrix.set_row(i, std::pow(std::sqrt(D(i, i)), -1)*E.get_col(i)); dewhiteningMatrix.set_col(i, std::sqrt(D(i, i))*E.get_col(i)); } newVectors = whiteningMatrix * vectors; return; } static mat orth(const mat A) { mat Q; mat U, V; vec S; double eps = 2.2e-16; double tol = 0.0; int mmax = 0; int r = 0; svd(A, U, S, V); if (A.rows() > A.cols()) { U = U(0, U.rows() - 1, 0, A.cols() - 1); S = S(0, A.cols() - 1); } mmax = (A.rows() > A.cols()) ? A.rows() : A.cols(); tol = mmax * eps * max(S); for (int i = 0; i < size(S); i++) if (S(i) > tol) r++; Q = U(0, U.rows() - 1, 0, r - 1); return (Q); } static mat mpower(const mat A, const double y) { mat T = zeros(A.rows(), A.cols()); mat dd = zeros(A.rows(), A.cols()); vec d = zeros(A.rows()); vec dOut = zeros(A.rows()); eig_sym(A, d, T); dOut = pow(d, y); diag(dOut, dd); for (int i = 0; i < T.cols(); i++) T.set_col(i, T.get_col(i) / norm(T.get_col(i))); return (T*dd*transpose(T)); } static ivec getSamples(const int max, const double percentage) { vec rd = randu(max); sparse_vec sV; ivec out; int sZ = 0; for (int i = 0; i < max; i++) if (rd(i) < percentage) { sV.add_elem(sZ, i); sZ++; } out = to_ivec(full(sV)); return (out); } static vec sumcol(const mat A) { vec out = zeros(A.cols()); for (int i = 0; i < A.cols(); i++) { out(i) = sum(A.get_col(i)); } return (out); } static bool fpica(const mat X, const mat whiteningMatrix, const mat dewhiteningMatrix, const int approach, const int numOfIC, const int g, const int finetune, const double a1, const double a2, double myy, const int stabilization, const double epsilon, const int maxNumIterations, const int maxFinetune, const int initState, mat guess, double sampleSize, mat & A, mat & W) { int vectorSize = X.rows(); int numSamples = X.cols(); int gOrig = g; int gFine = finetune + 1; double myyOrig = myy; double myyK = 0.01; int failureLimit = 5; int usedNlinearity = 0; double stroke = 0.0; int notFine = 1; int loong = 0; int initialStateMode = initState; double minAbsCos = 0.0, minAbsCos2 = 0.0; if (sampleSize * numSamples < 1000) sampleSize = (1000 / (double)numSamples < 1.0) ? 1000 / (double)numSamples : 1.0; if (sampleSize != 1.0) gOrig += 2; if (myy != 1.0) gOrig += 1; int fineTuningEnabled = 1; if (!finetune) { if (myy != 1.0) gFine = gOrig; else gFine = gOrig + 1; fineTuningEnabled = 0; } int stabilizationEnabled = stabilization; if (!stabilization && myy != 1.0) stabilizationEnabled = true; usedNlinearity = gOrig; if (initState == FICA_INIT_GUESS && guess.rows() != whiteningMatrix.cols()) { initialStateMode = 0; } else if (guess.cols() < numOfIC) { mat guess2 = randu(guess.rows(), numOfIC - guess.cols()) - 0.5; guess = concat_horizontal(guess, guess2); } else if (guess.cols() > numOfIC) guess = guess(0, guess.rows() - 1, 0, numOfIC - 1); if (approach == FICA_APPROACH_SYMM) { usedNlinearity = gOrig; stroke = 0; notFine = 1; loong = 0; A = zeros(vectorSize, numOfIC); mat B = zeros(vectorSize, numOfIC); if (initialStateMode == 0) B = orth(randu(vectorSize, numOfIC) - 0.5); else B = whiteningMatrix * guess; mat BOld = zeros(B.rows(), B.cols()); mat BOld2 = zeros(B.rows(), B.cols()); for (int round = 0; round < maxNumIterations; round++) { if (round == maxNumIterations - 1) { // If there is a convergence problem, // we still want ot return something. // This is difference with original // Matlab implementation. A = dewhiteningMatrix * B; W = transpose(B) * whiteningMatrix; return false; } B = B * mpower(transpose(B) * B , -0.5); minAbsCos = min(abs(diag(transpose(B) * BOld))); minAbsCos2 = min(abs(diag(transpose(B) * BOld2))); if (1 - minAbsCos < epsilon) { if (fineTuningEnabled && notFine) { notFine = 0; usedNlinearity = gFine; myy = myyK * myyOrig; BOld = zeros(B.rows(), B.cols()); BOld2 = zeros(B.rows(), B.cols()); } else { A = dewhiteningMatrix * B; break; } } // IF epsilon else if (stabilizationEnabled) { if (!stroke && (1 - minAbsCos2 < epsilon)) { stroke = myy; myy /= 2; if (mod(usedNlinearity, 2) == 0) usedNlinearity += 1 ; } else if (stroke) { myy = stroke; stroke = 0; if (myy == 1 && mod(usedNlinearity, 2) != 0) usedNlinearity -= 1; } else if (!loong && (round > maxNumIterations / 2)) { loong = 1; myy /= 2; if (mod(usedNlinearity, 2) == 0) usedNlinearity += 1; } } // stabilizationEnabled BOld2 = BOld; BOld = B; switch (usedNlinearity) { // pow3 case FICA_NONLIN_POW3 : { B = (X * pow(transpose(X) * B, 3)) / numSamples - 3 * B; break; } case(FICA_NONLIN_POW3+1) : { mat Y = transpose(X) * B; mat Gpow3 = pow(Y, 3); vec Beta = sumcol(pow(Y, 4)); mat D = diag(pow(Beta - 3 * numSamples , -1)); B = B + myy * B * (transpose(Y) * Gpow3 - diag(Beta)) * D; break; } case(FICA_NONLIN_POW3+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); B = (Xsub * pow(transpose(Xsub) * B, 3)) / Xsub.cols() - 3 * B; break; } case(FICA_NONLIN_POW3+3) : { mat Ysub = transpose(X.get_cols(getSamples(numSamples, sampleSize))) * B; mat Gpow3 = pow(Ysub, 3); vec Beta = sumcol(pow(Ysub, 4)); mat D = diag(pow(Beta - 3 * Ysub.rows() , -1)); B = B + myy * B * (transpose(Ysub) * Gpow3 - diag(Beta)) * D; break; } // TANH case FICA_NONLIN_TANH : { mat hypTan = tanh(a1 * transpose(X) * B); B = (X * hypTan) / numSamples - elem_mult(reshape(repeat(sumcol(1 - pow(hypTan, 2)), B.rows()), B.rows(), B.cols()), B) / numSamples * a1; break; } case(FICA_NONLIN_TANH+1) : { mat Y = transpose(X) * B; mat hypTan = tanh(a1 * Y); vec Beta = sumcol(elem_mult(Y, hypTan)); vec Beta2 = sumcol(1 - pow(hypTan, 2)); mat D = diag(pow(Beta - a1 * Beta2 , -1)); B = B + myy * B * (transpose(Y) * hypTan - diag(Beta)) * D; break; } case(FICA_NONLIN_TANH+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); mat hypTan = tanh(a1 * transpose(Xsub) * B); B = (Xsub * hypTan) / Xsub.cols() - elem_mult(reshape(repeat(sumcol(1 - pow(hypTan, 2)), B.rows()), B.rows(), B.cols()), B) / Xsub.cols() * a1; break; } case(FICA_NONLIN_TANH+3) : { mat Ysub = transpose(X.get_cols(getSamples(numSamples, sampleSize))) * B; mat hypTan = tanh(a1 * Ysub); vec Beta = sumcol(elem_mult(Ysub, hypTan)); vec Beta2 = sumcol(1 - pow(hypTan, 2)); mat D = diag(pow(Beta - a1 * Beta2 , -1)); B = B + myy * B * (transpose(Ysub) * hypTan - diag(Beta)) * D; break; } // GAUSS case FICA_NONLIN_GAUSS : { mat U = transpose(X) * B; mat Usquared = pow(U, 2); mat ex = exp(-a2 * Usquared / 2); mat gauss = elem_mult(U, ex); mat dGauss = elem_mult(1 - a2 * Usquared, ex); B = (X * gauss) / numSamples - elem_mult(reshape(repeat(sumcol(dGauss), B.rows()), B.rows(), B.cols()), B) / numSamples; break; } case(FICA_NONLIN_GAUSS+1) : { mat Y = transpose(X) * B; mat ex = exp(-a2 * pow(Y, 2) / 2); mat gauss = elem_mult(Y, ex); vec Beta = sumcol(elem_mult(Y, gauss)); vec Beta2 = sumcol(elem_mult(1 - a2 * pow(Y, 2), ex)); mat D = diag(pow(Beta - Beta2 , -1)); B = B + myy * B * (transpose(Y) * gauss - diag(Beta)) * D; break; } case(FICA_NONLIN_GAUSS+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); mat U = transpose(Xsub) * B; mat Usquared = pow(U, 2); mat ex = exp(-a2 * Usquared / 2); mat gauss = elem_mult(U, ex); mat dGauss = elem_mult(1 - a2 * Usquared, ex); B = (Xsub * gauss) / Xsub.cols() - elem_mult(reshape(repeat(sumcol(dGauss), B.rows()), B.rows(), B.cols()), B) / Xsub.cols(); break; } case(FICA_NONLIN_GAUSS+3) : { mat Ysub = transpose(X.get_cols(getSamples(numSamples, sampleSize))) * B; mat ex = exp(-a2 * pow(Ysub, 2) / 2); mat gauss = elem_mult(Ysub, ex); vec Beta = sumcol(elem_mult(Ysub, gauss)); vec Beta2 = sumcol(elem_mult(1 - a2 * pow(Ysub, 2), ex)); mat D = diag(pow(Beta - Beta2 , -1)); B = B + myy * B * (transpose(Ysub) * gauss - diag(Beta)) * D; break; } // SKEW case FICA_NONLIN_SKEW : { B = (X * (pow(transpose(X) * B, 2))) / numSamples; break; } case(FICA_NONLIN_SKEW+1) : { mat Y = transpose(X) * B; mat Gskew = pow(Y, 2); vec Beta = sumcol(elem_mult(Y, Gskew)); mat D = diag(pow(Beta , -1)); B = B + myy * B * (transpose(Y) * Gskew - diag(Beta)) * D; break; } case(FICA_NONLIN_SKEW+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); B = (Xsub * (pow(transpose(Xsub) * B, 2))) / Xsub.cols(); break; } case(FICA_NONLIN_SKEW+3) : { mat Ysub = transpose(X.get_cols(getSamples(numSamples, sampleSize))) * B; mat Gskew = pow(Ysub, 2); vec Beta = sumcol(elem_mult(Ysub, Gskew)); mat D = diag(pow(Beta , -1)); B = B + myy * B * (transpose(Ysub) * Gskew - diag(Beta)) * D; break; } } // SWITCH usedNlinearity } // FOR maxIterations W = transpose(B) * whiteningMatrix; } // IF FICA_APPROACH_SYMM APPROACH // DEFLATION else { // FC 01/12/05 A = zeros(whiteningMatrix.cols(), numOfIC); // A = zeros( vectorSize, numOfIC ); mat B = zeros(vectorSize, numOfIC); W = transpose(B) * whiteningMatrix; int round = 1; int numFailures = 0; while (round <= numOfIC) { myy = myyOrig; usedNlinearity = gOrig; stroke = 0; notFine = 1; loong = 0; int endFinetuning = 0; vec w = zeros(vectorSize); if (initialStateMode == 0) w = randu(vectorSize) - 0.5; else w = whiteningMatrix * guess.get_col(round); w = w - B * transpose(B) * w; w /= norm(w); vec wOld = zeros(vectorSize); vec wOld2 = zeros(vectorSize); int i = 1; int gabba = 1; while (i <= maxNumIterations + gabba) { w = w - B * transpose(B) * w; w /= norm(w); if (notFine) { if (i == maxNumIterations + 1) { round--; numFailures++; if (numFailures > failureLimit) { if (round == 0) { A = dewhiteningMatrix * B; W = transpose(B) * whiteningMatrix; } // IF round return false; } // IF numFailures > failureLimit break; } // IF i == maxNumIterations+1 } // IF NOTFINE else if (i >= endFinetuning) wOld = w; if (norm(w - wOld) < epsilon || norm(w + wOld) < epsilon) { if (fineTuningEnabled && notFine) { notFine = 0; gabba = maxFinetune; wOld = zeros(vectorSize); wOld2 = zeros(vectorSize); usedNlinearity = gFine; myy = myyK * myyOrig; endFinetuning = maxFinetune + i; } // IF finetuning else { numFailures = 0; B.set_col(round - 1, w); A.set_col(round - 1, dewhiteningMatrix*w); W.set_row(round - 1, transpose(whiteningMatrix)*w); break; } // ELSE finetuning } // IF epsilon else if (stabilizationEnabled) { if (stroke == 0.0 && (norm(w - wOld2) < epsilon || norm(w + wOld2) < epsilon)) { stroke = myy; myy /= 2.0 ; if (mod(usedNlinearity, 2) == 0) { usedNlinearity++; } // IF MOD }// IF !stroke else if (stroke != 0.0) { myy = stroke; stroke = 0.0; if (myy == 1 && mod(usedNlinearity, 2) != 0) { usedNlinearity--; } } // IF Stroke else if (notFine && !loong && i > maxNumIterations / 2) { loong = 1; myy /= 2.0; if (mod(usedNlinearity, 2) == 0) { usedNlinearity++; } // IF MOD } // IF notFine } // IF stabilization wOld2 = wOld; wOld = w; switch (usedNlinearity) { // pow3 case FICA_NONLIN_POW3 : { w = (X * pow(transpose(X) * w, 3)) / numSamples - 3 * w; break; } case(FICA_NONLIN_POW3+1) : { vec Y = transpose(X) * w; vec Gpow3 = X * pow(Y, 3) / numSamples; double Beta = dot(w, Gpow3); w = w - myy * (Gpow3 - Beta * w) / (3 - Beta); break; } case(FICA_NONLIN_POW3+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); w = (Xsub * pow(transpose(Xsub) * w, 3)) / Xsub.cols() - 3 * w; break; } case(FICA_NONLIN_POW3+3) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); vec Gpow3 = Xsub * pow(transpose(Xsub) * w, 3) / (Xsub.cols()); double Beta = dot(w, Gpow3); w = w - myy * (Gpow3 - Beta * w) / (3 - Beta); break; } // TANH case FICA_NONLIN_TANH : { vec hypTan = tanh(a1 * transpose(X) * w); w = (X * hypTan - a1 * sum(1 - pow(hypTan, 2)) * w) / numSamples; break; } case(FICA_NONLIN_TANH+1) : { vec Y = transpose(X) * w; vec hypTan = tanh(a1 * Y); double Beta = dot(w, X * hypTan); w = w - myy * ((X * hypTan - Beta * w) / (a1 * sum(1 - pow(hypTan, 2)) - Beta)); break; } case(FICA_NONLIN_TANH+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); vec hypTan = tanh(a1 * transpose(Xsub) * w); w = (Xsub * hypTan - a1 * sum(1 - pow(hypTan, 2)) * w) / Xsub.cols(); break; } case(FICA_NONLIN_TANH+3) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); vec hypTan = tanh(a1 * transpose(Xsub) * w); double Beta = dot(w, Xsub * hypTan); w = w - myy * ((Xsub * hypTan - Beta * w) / (a1 * sum(1 - pow(hypTan, 2)) - Beta)); break; } // GAUSS case FICA_NONLIN_GAUSS : { vec u = transpose(X) * w; vec Usquared = pow(u, 2); vec ex = exp(-a2 * Usquared / 2); vec gauss = elem_mult(u, ex); vec dGauss = elem_mult(1 - a2 * Usquared, ex); w = (X * gauss - sum(dGauss) * w) / numSamples; break; } case(FICA_NONLIN_GAUSS+1) : { vec u = transpose(X) * w; vec Usquared = pow(u, 2); vec ex = exp(-a2 * Usquared / 2); vec gauss = elem_mult(u, ex); vec dGauss = elem_mult(1 - a2 * Usquared, ex); double Beta = dot(w, X * gauss); w = w - myy * ((X * gauss - Beta * w) / (sum(dGauss) - Beta)); break; } case(FICA_NONLIN_GAUSS+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); vec u = transpose(Xsub) * w; vec Usquared = pow(u, 2); vec ex = exp(-a2 * Usquared / 2); vec gauss = elem_mult(u, ex); vec dGauss = elem_mult(1 - a2 * Usquared, ex); w = (Xsub * gauss - sum(dGauss) * w) / Xsub.cols(); break; } case(FICA_NONLIN_GAUSS+3) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); vec u = transpose(Xsub) * w; vec Usquared = pow(u, 2); vec ex = exp(-a2 * Usquared / 2); vec gauss = elem_mult(u, ex); vec dGauss = elem_mult(1 - a2 * Usquared, ex); double Beta = dot(w, Xsub * gauss); w = w - myy * ((Xsub * gauss - Beta * w) / (sum(dGauss) - Beta)); break; } // SKEW case FICA_NONLIN_SKEW : { w = (X * (pow(transpose(X) * w, 2))) / numSamples; break; } case(FICA_NONLIN_SKEW+1) : { vec Y = transpose(X) * w; vec Gskew = X * pow(Y, 2) / numSamples; double Beta = dot(w, Gskew); w = w - myy * (Gskew - Beta * w / (-Beta)); break; } case(FICA_NONLIN_SKEW+2) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); w = (Xsub * (pow(transpose(Xsub) * w, 2))) / Xsub.cols(); break; } case(FICA_NONLIN_SKEW+3) : { mat Xsub = X.get_cols(getSamples(numSamples, sampleSize)); vec Gskew = Xsub * pow(transpose(Xsub) * w, 2) / Xsub.cols(); double Beta = dot(w, Gskew); w = w - myy * (Gskew - Beta * w) / (-Beta); break; } } // SWITCH nonLinearity w /= norm(w); i++; } // WHILE i<= maxNumIterations+gabba round++; } // While round <= numOfIC } // ELSE Deflation return true; } // FPICA itpp-4.3.1/itpp/signal/fastica.h000066400000000000000000000227451216575753400165400ustar00rootroot00000000000000/*! * \file * \brief Definition of FastICA (Independent Component Analysis) for IT++ * \author Francois Cayre and Teddy Furon * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * * This is IT++ implementation of the original Matlab package FastICA. * * This code is Copyright (C) 2004 by: * Francois CAYRE and Teddy FURON * TEMICS Project * INRIA/Rennes (IRISA) * Campus Universitaire de Beaulieu * 35042 RENNES cedex FRANCE * * Email: firstname.lastname@irisa.fr * * Matlab package is Copyright (C) 1998 by: * Jarmo HURRI, Hugo GAVERT, Jaakko SARELA and Aapo HYVARINEN * Laboratory of Information and Computer Science * Helsinki University of Technology * * URL: http://www.cis.hut.fi/projects/ica/fastica/about.shtml * * If you use results given by this FastICA software in an article for * a scientific journal, conference proceedings or similar, please * include the following original reference in the bibliography: * * A. Hyvarinen, Fast and Robust Fixed-Point Algorithms for * Independent Component Analysis, IEEE Transactions on Neural * Networks 10(3):626-634, 1999 * * Differences with the original Matlab implementation: * - no GUI * - return something even in the case of a convergence problem * - optimization of SVD decomposition (performed 2 times in Matlab, * only 1 time in IT++) * - default approach is SYMM with non-linearity POW3 */ #ifndef FASTICA_H #define FASTICA_H #include #include //! Use deflation approach : compute IC one-by-one in a Gram-Schmidt-like fashion #define FICA_APPROACH_DEFL 2 //! Use symmetric approach : compute all ICs at a time #define FICA_APPROACH_SYMM 1 //! Use x^3 non-linearity #define FICA_NONLIN_POW3 10 //! Use tanh(x) non-linearity #define FICA_NONLIN_TANH 20 //! Use Gaussian non-linearity #define FICA_NONLIN_GAUSS 30 //! Use skew non-linearity #define FICA_NONLIN_SKEW 40 //! Set random start for Fast_ICA #define FICA_INIT_RAND 0 //! Set predefined start for Fast_ICA #define FICA_INIT_GUESS 1 //! Eigenvalues of the covariance matrix lower than FICA_TOL are discarded for analysis #define FICA_TOL 1e-9 namespace itpp { /*! \addtogroup fastica */ //---------------------- FastICA -------------------------------------- /*! \brief Fast_ICA Fast Independent Component Analysis (Fast ICA) \ingroup fastica The software is based upon original FastICA for Matlab from A. Hyvarinen. Fast and Robust Fixed-Point Algorithms for Independent Component Analysis. IEEE Transactions on Neural Networks, 10(3), pp. 626-634, 1999. Example: \code FastICA fastica(sources); fastica.set_nrof_independent_components(sources.rows()); fastica.set_non_linearity( FICA_NONLIN_TANH ); fastica.set_approach( FICA_APPROACH_DEFL ); fastica.separate(); mat ICs = fastica.get_independent_components(); \endcode */ class ITPP_EXPORT Fast_ICA { public: /*! \brief Constructor Construct a Fast_ICA object with mixed signals to separate. \param ma_mixed_sig (Input) Mixed signals to separate */ Fast_ICA(mat ma_mixed_sig); /*! \brief Explicit launch of main FastICA function Explicit launch of the Fast_ICA algorithm. \returns true if algorithm converged and false otherwise */ bool separate(void); /*! \brief Set approach : FICA_APPROACH_DEFL or FICA_APPROACH_SYMM (default) Set approach to use : FICA_APPROACH_SYMM (symmetric) or FICA_APPROACH_DEFL (deflation). The symmetric approach computes all ICs at a time, whereas the deflation approach computes them one by one. \param in_approach (Input) Type of approach to use */ void set_approach(int in_approach); /*! \brief Set number of independent components to separate Set the number of ICs to compute. \param in_nrIC (Input) Number of ICs to compute */ void set_nrof_independent_components(int in_nrIC); /*! \brief Set non-linearity Set non-linearity to use : FICA_NONLIN_POW3 (default), FICA_NONLIN_TANH, FICA_NONLIN_GAUSS, FICA_NONLIN_SKEW \param in_g (Input) Non-linearity. Can be selected from FICA_NONLIN_POW3, FICA_NONLIN_TANH, FICA_NONLIN_GAUSS or FICA_NONLIN_SKEW */ void set_non_linearity(int in_g); /*! \brief Set fine tuning Set fine tuning true or false. \param in_finetune (Input) Boolean (true or false) */ void set_fine_tune(bool in_finetune); /*! \brief Set \f$a_1\f$ parameter Set internal parameter \f$a_1\f$ of Fast_ICA (See reference paper). \param fl_a1 (Input) Parameter \f$a_1\f$ from reference paper */ void set_a1(double fl_a1); /*! \brief Set \f$a_2\f$ parameter Set internal parameter \f$a_2\f$ of Fast_ICA (See reference paper). \param fl_a2 (Input) Parameter \f$a_2\f$ from reference paper */ void set_a2(double fl_a2); /*! \brief Set \f$\mu\f$ parameter Set internal parameter \f$\mu\f$ of Fast_ICA (See reference paper). \param fl_mu (Input) Parameter \f$\mu\f$ from reference paper */ void set_mu(double fl_mu); /*! \brief Set convergence parameter \f$\epsilon\f$ Set \f$\epsilon\f$ parameter for convergence precision. \param fl_epsilon (Input) \f$\epsilon\f$ is convergence precision */ void set_epsilon(double fl_epsilon); /*! \brief Set sample size Set the percentage of samples to take into account at every iteration. \param fl_sampleSize (Input) Percentage of data to take into account at every iteration */ void set_sample_size(double fl_sampleSize); /*! \brief Set stabilization mode true or off Set stabilization mode. \param in_stabilization (Input) Set stabilization true or false */ void set_stabilization(bool in_stabilization); /*! \brief Set maximum number of iterations Set maximum number of iterations for Fast_ICA. \param in_maxNumIterations (Input) Maximum number of iterations to go through */ void set_max_num_iterations(int in_maxNumIterations); /*! \brief Set maximum number of iterations for fine tuning Set maximum numberr of iterations for fine tuning. \param in_maxFineTune (Input) Maximum number of iterations for fine tuning stage */ void set_max_fine_tune(int in_maxFineTune); /*! \brief Set first eigenvalue index to take into account Set first eigenvalue index to take into account. \param in_firstEig (Input) First eigenvalue index to take into account */ void set_first_eig(int in_firstEig); /*! \brief Set last eigenvalue index to take into account Set last eigenvalue index to take into account. \param in_lastEig (Input) Last eigenvalue index to take into account */ void set_last_eig(int in_lastEig); /*! \brief If true, only perform Principal Component Analysis (default = false) Wether to perform PCA only or PCA+ICA. \param in_PCAonly (Input) True = PCA only, false = PCA+ICA (default) */ void set_pca_only(bool in_PCAonly); /*! \brief Set initial guess matrix instead of random (default) Set initial matrix instead of random matrix. \param ma_initGuess (Input) Initial guess matrix */ void set_init_guess(mat ma_initGuess); /*! \brief Get mixing matrix Return mixing matrix. \return Mixing matrix */ mat get_mixing_matrix(); /*! \brief Get separating matrix Return separating matrix. \return Separating matrix */ mat get_separating_matrix(); /*! \brief Get separated signals Return separated signals (Independent Components). \return ICs */ mat get_independent_components(); /*! \brief Get number of independent components Return number of ICs. \return Number of ICs */ int get_nrof_independent_components(); /*! \brief Get nrIC first columns of the de-whitening matrix Return principal eigenvectors. \return Principal eigenvectors */ mat get_principal_eigenvectors(); /*! \brief Get the whitening matrix Return whitening matrix. \return Whitening matrix */ mat get_whitening_matrix(); /*! \brief Get the de-whitening matrix Return dewhitening matrix. \return Dewhitening matrix */ mat get_dewhitening_matrix(); /*! \brief Get whitened signals Return whitened signals. \return Whitened signals */ mat get_white_sig(); private: int approach, numOfIC, g, initState; bool finetune, stabilization, PCAonly; double a1, a2, mu, epsilon, sampleSize; int maxNumIterations, maxFineTune; int firstEig, lastEig; mat initGuess; mat mixedSig, A, W, icasig; mat whiteningMatrix; mat dewhiteningMatrix; mat whitesig; mat E, VecPr; vec D; }; // class Fast_ICA } // namespace itpp #endif // #ifndef FASTICA_H itpp-4.3.1/itpp/signal/filter.cpp000066400000000000000000000205361216575753400167420ustar00rootroot00000000000000/*! * \file * \brief Implementation of Filter classes and functions * \author Hakan Eriksson, Thomas Eriksson, Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include namespace itpp { vec filter(const vec &b, const vec &a, const vec &input) { ARMA_Filter f(b, a); return f(input); } cvec filter(const vec &b, const vec &a, const cvec &input) { ARMA_Filter, double, std::complex > f(b, a); return f(input); } cvec filter(const cvec &b, const cvec &a, const cvec &input) { ARMA_Filter, std::complex, std::complex > f(b, a); return f(input); } cvec filter(const cvec &b, const cvec &a, const vec &input) { ARMA_Filter, std::complex > f(b, a); return f(input); } vec filter(const vec &b, const int one, const vec &input) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter f(b); return f(input); } cvec filter(const vec &b, const int one, const cvec &input) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter, double, std::complex > f(b); return f(input); } cvec filter(const cvec &b, const int one, const cvec &input) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter, std::complex, std::complex > f(b); return f(input); } cvec filter(const cvec &b, const int one, const vec &input) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter, std::complex > f(b); return f(input); } vec filter(const int one, const vec &a, const vec &input) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter f(a); return f(input); } cvec filter(const int one, const vec &a, const cvec &input) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter, double, std::complex > f(a); return f(input); } cvec filter(const int one, const cvec &a, const cvec &input) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter, std::complex, std::complex > f(a); return f(input); } cvec filter(const int one, const cvec &a, const vec &input) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter, std::complex > f(a); return f(input); } vec filter(const vec &b, const vec &a, const vec &input, const vec &state_in, vec &state_out) { ARMA_Filter f(b, a); f.set_state(state_in); vec output = f(input); state_out = f.get_state(); return output; } cvec filter(const vec &b, const vec &a, const cvec &input, const cvec &state_in, cvec &state_out) { ARMA_Filter, double, std::complex > f(b, a); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } cvec filter(const cvec &b, const cvec &a, const cvec &input, const cvec &state_in, cvec &state_out) { ARMA_Filter, std::complex, std::complex > f(b, a); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } cvec filter(const cvec &b, const cvec &a, const vec &input, const cvec &state_in, cvec &state_out) { ARMA_Filter, std::complex > f(b, a); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } vec filter(const vec &b, const int one, const vec &input, const vec &state_in, vec &state_out) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter f(b); f.set_state(state_in); vec output = f(input); state_out = f.get_state(); return output; } cvec filter(const vec &b, const int one, const cvec &input, const cvec &state_in, cvec &state_out) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter, double, std::complex > f(b); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } cvec filter(const cvec &b, const int one, const cvec &input, const cvec &state_in, cvec &state_out) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter, std::complex, std::complex > f(b); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } cvec filter(const cvec &b, const int one, const vec &input, const cvec &state_in, cvec &state_out) { it_assert(one == 1, "filter(): in a MA filter a=1"); MA_Filter, std::complex > f(b); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } vec filter(const int one, const vec &a, const vec &input, const vec &state_in, vec &state_out) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter f(a); f.set_state(state_in); vec output = f(input); state_out = f.get_state(); return output; } cvec filter(const int one, const vec &a, const cvec &input, const cvec &state_in, cvec &state_out) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter, double, std::complex > f(a); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } cvec filter(const int one, const cvec &a, const cvec &input, const cvec &state_in, cvec &state_out) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter, std::complex, std::complex > f(a); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } cvec filter(const int one, const cvec &a, const vec &input, const cvec &state_in, cvec &state_out) { it_assert(one == 1, "filter(): in a AR filter b=1"); AR_Filter, std::complex > f(a); f.set_state(state_in); cvec output = f(input); state_out = f.get_state(); return output; } vec fir1(int N, double cutoff) { vec a(N + 1), h = hamming(N + 1); for (int i = 0;i < length(a);i++) { a[i] = h[i] * sinc(cutoff * (i - N / 2.0)); } a /= sum(a); return a; } template class ITPP_EXPORT MA_Filter; template class ITPP_EXPORT MA_Filter < double, std::complex, std::complex >; template class ITPP_EXPORT MA_Filter, double, std::complex >; template class ITPP_EXPORT MA_Filter < std::complex, std::complex, std::complex >; template class ITPP_EXPORT AR_Filter; template class ITPP_EXPORT AR_Filter < double, std::complex, std::complex >; template class ITPP_EXPORT AR_Filter < std::complex, double, std::complex >; template class ITPP_EXPORT AR_Filter < std::complex, std::complex, std::complex >; template class ITPP_EXPORT ARMA_Filter; template class ITPP_EXPORT ARMA_Filter < double, std::complex, std::complex >; template class ITPP_EXPORT ARMA_Filter < std::complex, double, std::complex >; template class ITPP_EXPORT ARMA_Filter < std::complex, std::complex, std::complex >; } // namespace itpp itpp-4.3.1/itpp/signal/filter.h000066400000000000000000000426371216575753400164150ustar00rootroot00000000000000/*! * \file * \brief Definitions of Filter classes and functions * \author Hakan Eriksson, Thomas Eriksson, Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FILTER_H #define FILTER_H #include #include namespace itpp { /*! \addtogroup filters */ /*! \brief Virtual Filter Base Class. \ingroup filters The class is templated as follows:

      • \c T1 is the type of the input samples
      • \c T2 is the type of the filter coefficients
      • \c T3 is the type of the output samples
      */ template class Filter { public: //! Default constructor Filter() {} //! Filter a single sample. virtual T3 operator()(const T1 Sample) { return filter(Sample); } //! Filter a vector. virtual Vec operator()(const Vec &v); //! Virtual destructor. virtual ~Filter() {} protected: /*! \brief Pure virtual filter function. This is where the real filtering is done. Implement this function to create a new filter. */ virtual T3 filter(const T1 Sample) = 0; }; /*! \brief Moving Average Filter Base Class. \ingroup filters This class implements a moving average (MA) filter according to \f[ y(n) = b(0)*x(n) + b(1)*x(n-1) + ... + b(N)*x(n-N) \f] where \a b is the filter coefficients, \a x is the input and \a y is the output. When filtering a vector, the length of the output vector equals the length of the input vector. Internal states are kept in a filter memory. The first time the filter is used the internal states have been set to zero. The class is templated as follows:
      • \c T1 is the type of the input samples
      • \c T2 is the type of the filter coefficients
      • \c T3 is the type of the output samples
      */ template class MA_Filter : public Filter { public: //! Class default constructor explicit MA_Filter(); //! Class constructor setting the coefficients in the filter explicit MA_Filter(const Vec &b); //! Class destructor virtual ~MA_Filter() { } //! Filter coefficient access function Vec get_coeffs() const { return coeffs; } //! Set the filter coefficients void set_coeffs(const Vec &b); //! Clears the filter memory void clear() { mem.clear(); } //! Get state of filter Vec get_state() const; //! Set state of filter void set_state(const Vec &state); private: virtual T3 filter(const T1 Sample); Vec mem; Vec coeffs; int inptr; bool init; }; /*! \brief Autoregressive (AR) Filter Base Class. \ingroup filters This class implements a autoregressive (AR) filter according to \f[ a(0)*y(n) = x(n) - a(1)*y(n-1) - ... - a(N)*y(n-N) \f] where \a a is the filter coefficients, \a x is the input and \a y is the output. When filtering a vector, the length of the output vector equals the length of the input vector. Internal states are kept in a filter memory. The first time the filter is used the internal states have been set to zero. The class is templated as follows:
      • \c T1 is the type of the input samples
      • \c T2 is the type of the filter coefficients
      • \c T3 is the type of the output samples
      */ template class AR_Filter : public Filter { public: //! Class constructor explicit AR_Filter(); //! Class constructor setting the coefficients in the filter explicit AR_Filter(const Vec &a); //! Class destructor virtual ~AR_Filter() { } //! Filter coefficient access function Vec get_coeffs() const { return coeffs; } //! Set the filter coefficients (and order) void set_coeffs(const Vec &a); //! Clears the filter memory void clear() { mem.clear(); } //! Get state of filter Vec get_state() const; //! Set state of filter void set_state(const Vec &state); private: virtual T3 filter(const T1 Sample); Vec mem; Vec coeffs; Vec a0; int inptr; bool init; }; /*! \brief Autoregressive Moving Average (ARMA) Filter Base Class. \ingroup filters This class implements a autoregressive moving average (ARMA) filter according to \f[ a(0)*y(n) = b(0)*x(n) + b(1)*x(n-1) + \ldots + b(N_b)*x(n-N_b) - a(1)*y(n-1) - \ldots - a(N_a)*y(n-N_a) \f] where \a a and \a b are the filter coefficients, \a x is the input and \a y is the output. When filtering a vector, the length of the output vector equals the length of the input vector. Internal states are kept in a filter memory. The first time the filter is used the internal states have been set to zero. The class is templated as follows:
      • \c T1 is the type of the input samples
      • \c T2 is the type of the filter coefficients
      • \c T3 is the type of the output samples
      */ template class ARMA_Filter : public Filter { public: //! Class constructor explicit ARMA_Filter(); //! Class constructor setting the coefficients in the filter explicit ARMA_Filter(const Vec &b, const Vec &a); //! Class destructor virtual ~ARMA_Filter() { } //! Filter \a a coefficient access function Vec get_coeffs_a() const { return acoeffs; } //! Filter \a b coefficient access function Vec get_coeffs_b() const { return bcoeffs; } //! Filter coefficient access function void get_coeffs(Vec &b, Vec &a) const { b = bcoeffs; a = acoeffs; } //! Set the filter coefficients (and order) void set_coeffs(const Vec &b, const Vec &a); //! Clears the filter memory void clear() { mem.clear(); } //! Get state of filter Vec get_state() const; //! Set state of filter void set_state(const Vec &state); private: virtual T3 filter(const T1 Sample); Vec mem; Vec acoeffs, bcoeffs; int inptr; bool init; }; /*! \brief ARMA filter function \ingroup filters These functions implements a autoregressive moving average (ARMA) filter according to \f[ a(0)*y(n) = b(0)*x(n) + b(1)*x(n-1) + \ldots + b(N_b)*x(n-N_b) - a(1)*y(n-1) - \ldots - a(N_a)*y(n-N_a) \f] where \a a and \a b are the filter coefficients, \a x is the input and \a y is the output. Setting a=1 gives a MA filter and b=1 gives a AR filter. The length of the output vector equals the length of the input vector. The state vectors \a state_in and \a state_out is of length \f$max(N_a, n_b) - 1\f$. If no start state \a state_in is given it is set to zero. @{ */ ITPP_EXPORT vec filter(const vec &b, const vec &a, const vec &input); ITPP_EXPORT cvec filter(const vec &b, const vec &a, const cvec &input); ITPP_EXPORT cvec filter(const cvec &b, const cvec &a, const cvec &input); ITPP_EXPORT cvec filter(const cvec &b, const cvec &a, const vec &input); ITPP_EXPORT vec filter(const vec &b, const int one, const vec &input); ITPP_EXPORT cvec filter(const vec &b, const int one, const cvec &input); ITPP_EXPORT cvec filter(const cvec &b, const int one, const cvec &input); ITPP_EXPORT cvec filter(const cvec &b, const int one, const vec &input); ITPP_EXPORT vec filter(const int one, const vec &a, const vec &input); ITPP_EXPORT cvec filter(const int one, const vec &a, const cvec &input); ITPP_EXPORT cvec filter(const int one, const cvec &a, const cvec &input); ITPP_EXPORT cvec filter(const int one, const cvec &a, const vec &input); ITPP_EXPORT vec filter(const vec &b, const vec &a, const vec &input, const vec &state_in, vec &state_out); ITPP_EXPORT cvec filter(const vec &b, const vec &a, const cvec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT cvec filter(const cvec &b, const cvec &a, const cvec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT cvec filter(const cvec &b, const cvec &a, const vec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT vec filter(const vec &b, const int one, const vec &input, const vec &state_in, vec &state_out); ITPP_EXPORT cvec filter(const vec &b, const int one, const cvec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT cvec filter(const cvec &b, const int one, const cvec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT cvec filter(const cvec &b, const int one, const vec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT vec filter(const int one, const vec &a, const vec &input, const vec &state_in, vec &state_out); ITPP_EXPORT cvec filter(const int one, const vec &a, const cvec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT cvec filter(const int one, const cvec &a, const cvec &input, const cvec &state_in, cvec &state_out); ITPP_EXPORT cvec filter(const int one, const cvec &a, const vec &input, const cvec &state_in, cvec &state_out); /*! @} */ /*! \brief Design a Nth order FIR filter with cut-off frequency \c cutoff using the window method. \ingroup filters */ ITPP_EXPORT vec fir1(int N, double cutoff); //---------------------------------------------------------------------------- // Implementation of templated functions starts here //---------------------------------------------------------------------------- //---------------------- class Filter ---------------------------- template Vec Filter::operator()(const Vec &x) { Vec y(x.length()); for (int i = 0; i < x.length(); i++) { y[i] = filter(x[i]); } return y; } //-------------------------- class MA_Filter --------------------------------- template MA_Filter::MA_Filter() : Filter() { inptr = 0; init = false; } template MA_Filter::MA_Filter(const Vec &b) : Filter() { set_coeffs(b); } template void MA_Filter::set_coeffs(const Vec &b) { it_assert(b.size() > 0, "MA_Filter: size of filter is 0!"); coeffs = b; mem.set_size(coeffs.size(), false); mem.clear(); inptr = 0; init = true; } template Vec MA_Filter::get_state() const { it_assert(init == true, "MA_Filter: filter coefficients are not set!"); int offset = inptr; Vec state(mem.size()); for (int n = 0; n < mem.size(); n++) { state(n) = mem(offset); offset = (offset + 1) % mem.size(); } return state; } template void MA_Filter::set_state(const Vec &state) { it_assert(init == true, "MA_Filter: filter coefficients are not set!"); it_assert(state.size() == mem.size(), "MA_Filter: Invalid state vector!"); mem = state; inptr = 0; } template T3 MA_Filter::filter(const T1 Sample) { it_assert(init == true, "MA_Filter: Filter coefficients are not set!"); T3 s = 0; mem(inptr) = Sample; int L = mem.length() - inptr; for (int i = 0; i < L; i++) { s += coeffs(i) * mem(inptr + i); } for (int i = 0; i < inptr; i++) { s += coeffs(L + i) * mem(i); } inptr--; if (inptr < 0) inptr += mem.length(); return s; } //---------------------- class AR_Filter ---------------------------------- template AR_Filter::AR_Filter() : Filter() { inptr = 0; init = false; } template AR_Filter::AR_Filter(const Vec &a) : Filter() { set_coeffs(a); } template void AR_Filter::set_coeffs(const Vec &a) { it_assert(a.size() > 0, "AR_Filter: size of filter is 0!"); it_assert(a(0) != T2(0), "AR_Filter: a(0) cannot be 0!"); a0.set_size(1);//needed to keep the first coefficient for future reuse a0(0) = a(0); coeffs = a / a0(0); mem.set_size(coeffs.size() - 1, false); mem.clear(); inptr = 0; init = true; } template Vec AR_Filter::get_state() const { it_assert(init == true, "AR_Filter: filter coefficients are not set!"); int offset = inptr; Vec state(mem.size()); for (int n = 0; n < mem.size(); n++) { state(n) = mem(offset); offset = (offset + 1) % mem.size(); } return state; } template void AR_Filter::set_state(const Vec &state) { it_assert(init == true, "AR_Filter: filter coefficients are not set!"); it_assert(state.size() == mem.size(), "AR_Filter: Invalid state vector!"); mem = state; inptr = 0; } template T3 AR_Filter::filter(const T1 Sample) { it_assert(init == true, "AR_Filter: Filter coefficients are not set!"); T3 s = Sample; if (mem.size() == 0) return (s / a0(0)); int L = mem.size() - inptr; for (int i = 0; i < L; i++) { s -= mem(i + inptr) * coeffs(i + 1); // All coeffs except a(0) } for (int i = 0; i < inptr; i++) { s -= mem(i) * coeffs(L + i + 1); // All coeffs except a(0) } inptr--; if (inptr < 0) inptr += mem.size(); mem(inptr) = s; return (s / a0(0)); } //---------------------- class ARMA_Filter ---------------------------------- template ARMA_Filter::ARMA_Filter() : Filter() { inptr = 0; init = false; } template ARMA_Filter::ARMA_Filter(const Vec &b, const Vec &a) : Filter() { set_coeffs(b, a); } template void ARMA_Filter::set_coeffs(const Vec &b, const Vec &a) { it_assert(a.size() > 0 && b.size() > 0, "ARMA_Filter: size of filter is 0!"); it_assert(a(0) != T2(0), "ARMA_Filter: a(0) cannot be 0!"); acoeffs = a / a(0); bcoeffs = b / a(0); mem.set_size(std::max(a.size(), b.size()) - 1, false); mem.clear(); inptr = 0; init = true; } template Vec ARMA_Filter::get_state() const { it_assert(init == true, "ARMA_Filter: filter coefficients are not set!"); int offset = inptr; Vec state(mem.size()); for (int n = 0; n < mem.size(); n++) { state(n) = mem(offset); offset = (offset + 1) % mem.size(); } return state; } template void ARMA_Filter::set_state(const Vec &state) { it_assert(init == true, "ARMA_Filter: filter coefficients are not set!"); it_assert(state.size() == mem.size(), "ARMA_Filter: Invalid state vector!"); mem = state; inptr = 0; } template T3 ARMA_Filter::filter(const T1 Sample) { it_assert(init == true, "ARMA_Filter: Filter coefficients are not set!"); T3 z = Sample; T3 s; for (int i = 0; i < acoeffs.size() - 1; i++) { // All AR-coeff except a(0). z -= mem((i + inptr) % mem.size()) * acoeffs(i + 1); } s = z * bcoeffs(0); for (int i = 0; i < bcoeffs.size() - 1; i++) { // All MA-coeff except b(0). s += mem((i + inptr) % mem.size()) * bcoeffs(i + 1); } inptr--; if (inptr < 0) inptr += mem.size(); mem(inptr) = z; mem(inptr) = z; // Store in the internal state. return s; } //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT MA_Filter; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT MA_Filter< double, std::complex, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT MA_Filter< std::complex, double, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT MA_Filter< std::complex, std::complex, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT AR_Filter; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT AR_Filter< double, std::complex, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT AR_Filter< std::complex, double, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT AR_Filter< std::complex, std::complex, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT ARMA_Filter; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT ARMA_Filter< double, std::complex, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT ARMA_Filter< std::complex, double, std::complex >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT ARMA_Filter< std::complex, std::complex, std::complex >; //! \endcond } // namespace itpp #endif // #ifndef FILTER_H itpp-4.3.1/itpp/signal/filter_design.cpp000066400000000000000000000172671216575753400203020ustar00rootroot00000000000000/*! * \file * \brief Filter design functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #include #include namespace itpp { void polystab(const vec &a, vec &out) { cvec r; roots(a, r); for (int i = 0; i < r.size(); i++) { if (abs(r(i)) > 1) r(i) = std::complex(1.0) / conj(r(i)); } out = real(std::complex(a(0)) * poly(r)); } void polystab(const cvec &a, cvec &out) { cvec r; roots(a, r); for (int i = 0; i < r.size(); i++) { if (abs(r(i)) > 1) r(i) = std::complex(1.0) / conj(r(i)); } out = a(0) * poly(r); } // ----------------------- freqz() --------------------------------------------------------- void freqz(const cvec &b, const cvec &a, const int N, cvec &h, vec &w) { w = pi * linspace(0, N - 1, N) / double(N); cvec ha, hb; hb = fft(b, 2 * N); hb = hb(0, N - 1); ha = fft(a, 2 * N); ha = ha(0, N - 1); h = elem_div(hb, ha); } cvec freqz(const cvec &b, const cvec &a, const int N) { cvec h; vec w; freqz(b, a, N, h, w); return h; } cvec freqz(const cvec &b, const cvec &a, const vec &w) { int la = a.size(), lb = b.size(), k = std::max(la, lb); cvec h, ha, hb; // Evaluate the nominator and denominator at the given frequencies hb = polyval(zero_pad(b, k), to_cvec(cos(w), sin(w))); ha = polyval(zero_pad(a, k), to_cvec(cos(w), sin(w))); h = elem_div(hb, ha); return h; } void freqz(const vec &b, const vec &a, const int N, cvec &h, vec &w) { w = pi * linspace(0, N - 1, N) / double(N); cvec ha, hb; hb = fft_real(b, 2 * N); hb = hb(0, N - 1); ha = fft_real(a, 2 * N); ha = ha(0, N - 1); h = elem_div(hb, ha); } cvec freqz(const vec &b, const vec &a, const int N) { cvec h; vec w; freqz(b, a, N, h, w); return h; } cvec freqz(const vec &b, const vec &a, const vec &w) { int la = a.size(), lb = b.size(), k = std::max(la, lb); cvec h, ha, hb; // Evaluate the nominator and denominator at the given frequencies hb = polyval(zero_pad(b, k), to_cvec(cos(w), sin(w))); ha = polyval(zero_pad(a, k), to_cvec(cos(w), sin(w))); h = elem_div(hb, ha); return h; } void filter_design_autocorrelation(const int N, const vec &f, const vec &m, vec &R) { it_assert(f.size() == m.size(), "filter_design_autocorrelation: size of f and m vectors does not agree"); int N_f = f.size(); it_assert(f(0) == 0.0, "filter_design_autocorrelation: first frequency must be 0.0"); it_assert(f(N_f - 1) == 1.0, "filter_design_autocorrelation: last frequency must be 1.0"); // interpolate frequency-response int N_fft = 512; vec m_interp(N_fft + 1); // unused variable: // double df_interp = 1.0/double(N_fft); m_interp(0) = m(0); double inc; int jstart = 0, jstop; for (int i = 0; i < N_f - 1; i++) { // calculate number of points to the next frequency jstop = floor_i(f(i + 1) * (N_fft + 1)) - 1; //std::cout << "jstart=" << jstart << "jstop=" << jstop << std::endl; for (int j = jstart; j <= jstop; j++) { inc = double(j - jstart) / double(jstop - jstart); m_interp(j) = m(i) * (1 - inc) + m(i + 1) * inc; } jstart = jstop + 1; } vec S = sqr(concat(m_interp, reverse(m_interp(2, N_fft)))); // create a complete frequency response with also negative frequencies R = ifft_real(to_cvec(S)); // calculate correlation R = R.left(N); } // Calculate the AR coefficients of order \c n of the ARMA-process defined by the autocorrelation R // using the deternined modified Yule-Walker method // maxlag determines the size of the system to solve N>= n. // If N>m then the system is overdetermined and a least squares solution is used. // as a rule of thumb use N = 4*n void modified_yule_walker(const int m, const int n, const int N, const vec &R, vec &a) { it_assert(m > 0, "modified_yule_walker: m must be > 0"); it_assert(n > 0, "modified_yule_walker: n must be > 0"); it_assert(N <= R.size(), "modified_yule_walker: autocorrelation function too short"); // create the modified Yule-Walker equations Rm * a = - rh // see eq. (3.7.1) in Stoica and Moses, Introduction to spectral analysis int M = N - m - 1; mat Rm; if (m - n + 1 < 0) Rm = toeplitz(R(m, m + M - 1), reverse(concat(R(1, std::abs(m - n + 1)), R(0, m)))); else Rm = toeplitz(R(m, m + M - 1), reverse(R(m - n + 1, m))); vec rh = - R(m + 1, m + M); // solve overdetermined system a = backslash(Rm, rh); // prepend a_0 = 1 a = concat(1.0, a); // stabilize polynomial a = polystab(a); } void arma_estimator(const int m, const int n, const vec &R, vec &b, vec &a) { it_assert(m > 0, "arma_estimator: m must be > 0"); it_assert(n > 0, "arma_estimator: n must be > 0"); it_assert(2*(m + n) <= R.size(), "arma_estimator: autocorrelation function too short"); // windowing the autocorrelation int N = 2 * (m + n); vec Rwindow = elem_mult(R.left(N), 0.54 + 0.46 * cos(pi * linspace(0.0, double(N - 1), N) / double(N - 1))); // Hamming windowing // calculate the AR part using the overdetmined Yule-Walker equations modified_yule_walker(m, n, N, Rwindow, a); // --------------- Calculate MA part -------------------------------------- // use method in ref [2] section VII. vec r_causal = Rwindow; r_causal(0) *= 0.5; vec h_inv_a = filter(1, a, concat(1.0, zeros(N - 1))); // see eq (50) of [2] mat H_inv_a = toeplitz(h_inv_a, concat(1.0, zeros(m))); vec b_causal = backslash(H_inv_a, r_causal); // calculate the double-sided spectrum int N_fft = 256; vec H = 2.0 * real(elem_div(fft_real(b_causal, N_fft), fft_real(a, N_fft))); // calculate spectrum // Do weighting and windowing in cepstrum domain cvec cepstrum = log(to_cvec(H)); cvec q = ifft(cepstrum); // keep only causal part of spectrum (windowing) q.set_subvector(N_fft / 2, zeros_c(N_fft / 2)); q(0) *= 0.5; cvec h = ifft(exp(fft(q))); // convert back to frequency domain, from cepstrum and do inverse transform to calculate impulse response b = real(backslash(to_cmat(H_inv_a), h(0, N - 1))); // use Shank's method to calculate b coefficients } void yulewalk(const int N, const vec &f, const vec &m, vec &b, vec &a) { it_assert(f.size() == m.size(), "yulewalk: size of f and m vectors does not agree"); int N_f = f.size(); it_assert(f(0) == 0.0, "yulewalk: first frequency must be 0.0"); it_assert(f(N_f - 1) == 1.0, "yulewalk: last frequency must be 1.0"); vec R; filter_design_autocorrelation(4*N, f, m, R); arma_estimator(N, N, R, b, a); } } // namespace itpp itpp-4.3.1/itpp/signal/filter_design.h000066400000000000000000000135341216575753400177400ustar00rootroot00000000000000/*! * \file * \brief Filter design functions * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FILTER_DESIGN_H #define FILTER_DESIGN_H #include #include namespace itpp { /*! \addtogroup filters */ /*! \brief Polynomial Stabilization \ingroup filters \author Tony Ottosson Stabilizes the polynomial transfer function by replacing all roots outside the unit cirlce with their reflection inside the unit circle. @{ */ ITPP_EXPORT void polystab(const vec &a, vec &out); inline vec polystab(const vec &a) { vec temp; polystab(a, temp); return temp; } ITPP_EXPORT void polystab(const cvec &a, cvec &out); inline cvec polystab(const cvec &a) { cvec temp; polystab(a, temp); return temp; } /*! @} */ /*! \brief Frequency response of filter \ingroup filters \author Tony Ottosson Calculates the N-point frequency response of the supplied digital filter over the frequencies w. If w is not given the response is evaluated over the range 0 to \f$\pi\f$ with N values. The default value of N is 512. If \c w is supplied polyval() is used. Otherwise the calculation is based on the fft. @{ */ ITPP_EXPORT void freqz(const cvec &b, const cvec& a, const int N, cvec &h, vec &w); ITPP_EXPORT cvec freqz(const cvec &b, const cvec& a, const int N = 512); ITPP_EXPORT cvec freqz(const cvec &b, const cvec& a, const vec &w); ITPP_EXPORT void freqz(const vec &b, const vec& a, const int N, cvec &h, vec &w); ITPP_EXPORT cvec freqz(const vec &b, const vec& a, const int N = 512); ITPP_EXPORT cvec freqz(const vec &b, const vec& a, const vec &w); /*! @} */ /*! \brief Calculate autocorrelation from the specified frequency-response (suitable for filter design) \ingroup filters \author Tony Ottosson Calculates the autocorrelation function of size \c N corresponding to the specified frequency response. Useful as a first step in designing filters. The vectors \c f and \c m is the frequency response. The frequencies should be between 0 and 1.0 (equal to half the sample rate) in increasing order. Both 0.0 and 1.0 must be included. The frequency response is upsampled to 512 points and the autocorrelation is ifft of the power magnitude response of the upsampled frequency response. */ ITPP_EXPORT void filter_design_autocorrelation(const int N, const vec &f, const vec &m, vec &R); /*! \brief Estimation of AR-part in an ARMA model given the autocorrelation \ingroup filters \author Tony Ottosson Estimates the AR-part of an ARMA model from the given autocorrelation. The AR part is of order \c n. The overdetermined modified Yule-Walker equations are used. If \f$N>n\f$ then the system is overdetermined and a least squares solution is used. As a rule of thumb use \f$N = 4 n\f$ The parameter \c m is the order of the MA-part such that \f$R(k) = 0, \forall \|k\| > m\f$. The supplied autocorrelation should at least be of size \c N. References: Stoica and Moses, Introduction to spectral analysis, Prentice Hall, 1997. */ ITPP_EXPORT void modified_yule_walker(const int m, const int n, const int N, const vec &R, vec &a); /*! \brief Estimation of ARMA model given the autocorrelation \ingroup filters \author Tony Ottosson Estimates an ARMA model from the given autocorrelation. The AR part is of order \c n and the MA part is of order \c m. The AR part (the denominator) is calcuated using the modified Yule-Walker equations. The the MA part (the nominator) is calculated by calculating the inverse magnitude spectrum using FFTs of size 512 which is an AR-system. This AR-system is then solved using the Levinson-Durbin algorithm. The supplied autocorrelation is windowed using a Hamming window of size \f$2(m+n)\f$ and hence should at least be of that size. References: [1] Stoica and Moses, Introduction to spectral analysis, Prentice Hall, 1997. [2] B. Friedlander and B. Porat, The modified Yule-Walker method of ARMA spectral estimation, IEEE Trans. Aerospace and Electronic Systems, Vol. AES-20, No. 2, pp. 158--173, March 1984. */ ITPP_EXPORT void arma_estimator(const int m, const int n, const vec &R, vec &b, vec &a); /*! \brief ARMA filter design using a least-squares fit to the specified frequency-response \ingroup filters \author Tony Ottosson The arma_estimator() function is used to calculate the a and b coefficients. The vectors \c f and \c m is the frequency response. The frequencies should be between 0 and 1.0 (equal to half the sample rate) in increasing order. Both 0.0 and 1.0 must be included. The filter_design_autocorrelation() fucnction is used to interpolate the frequency response and calculate the corresponding autocorrelation. Observe: this function will not always give exactly the same result as the matlab yulewalk function. */ ITPP_EXPORT void yulewalk(const int N, const vec &f, const vec &m, vec &b, vec &a); } // namespace itpp #endif // #ifndef FILTER_DESIGN_H itpp-4.3.1/itpp/signal/freq_filt.cpp000066400000000000000000000030361216575753400174240ustar00rootroot00000000000000/*! * \file * \brief Implementation of Freq_Filt Class * \author Simon Wood * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include //! \cond namespace itpp { template class ITPP_EXPORT Vec; template class ITPP_EXPORT Vec; template class ITPP_EXPORT Vec; template class ITPP_EXPORT Vec >; template class ITPP_EXPORT Freq_Filt; template class ITPP_EXPORT Freq_Filt >; template class ITPP_EXPORT Freq_Filt; template class ITPP_EXPORT Freq_Filt; } // namespace itpp //! \endcond itpp-4.3.1/itpp/signal/freq_filt.h000066400000000000000000000220411216575753400170660ustar00rootroot00000000000000/*! * \file * \brief Definition of frequency domain filter class * \author Simon Wood * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef FREQ_FILT_H #define FREQ_FILT_H #include #include #include #include #include #include #include #include #include namespace itpp { /*! \brief Freq_Filt Frequency domain filtering using the overlap-add technique \ingroup filters The Freq_Filt class implements an FFT based filter using the overlap-add technique. The data is filtered by first transforming the input sequence into the frequency domain with an efficient FFT implementation (i.e. FFTW) and then multiplied with a Fourier transformed version of the impulse response. The resulting data is then inversed Fourier transformed to return a filtered time domain signal. Freq_Filt is a templated class. The template paramter \c Num_T defines the data type for the impulse response \c b, input data \c x and output data \c y. The class constructor chooses an optimal FFT length and data block size that minimizes execution time. For example, \code vec b = "1 2 3 4"; Freq_Filt FF(b,8000); \endcode where 8000 corresponds to the expected vector length of the data to be filtered. The actual number of elements does not have to be exact, but it should be close. Here is a complete example: \code vec b = "1 2 3 4"; vec x(20); x(0) = 1; // Define a filter object for doubles Freq_Filt FF(b,x.length()); // Filter the data vec y = FF.filter(x); // Check the FFT and block sizes that were used int fftsize = FF.getFFTSize(); int blk = FF.getBlkSize(); \endcode To facilitate large data sets the Freq_Filt class has a streaming option. In this mode of operation data history is internally stored. This allows the class to be used for large data sets that are read from disk or streamed in real-time. \code bool stream = true; vec b = "1 2 3 4"; Freq_Filt FF(b,1000); vec x,y; while(!EOF) { x = "read buffer of data"; y = FF.filter(x,stream); cout << << endl; } \endcode */ template class Freq_Filt { public: /*! \brief Constructor The empty constructor makes it possible to have other container objects of the Freq_Filt class */ Freq_Filt() {} /*! \brief Constructor with initialization of the impulse response \b b. Create a filter object with impulse response \b b. The FFT size and data block size are also initialized. \code vec b = "1 2 3 4"; vec x(20); Freq_Filt FF(b,x.length()); \endcode */ Freq_Filt(const Vec &b, const int xlength) {init(b, xlength);} /*! \brief Filter data in the input vector \b x Filters data in batch mode or streaming mode \code FF.filter(x); // Filters data in batch mode FF.filter(x,1); // Filters data in streaming mode \endcode */ Vec filter(const Vec &x, const int strm = 0); //! Return FFT size int get_fft_size() { return fftsize; } //! Return the data block size int get_blk_size() { return blksize; } //! Destructor ~Freq_Filt() {} private: int fftsize, blksize; cvec B; // FFT of impulse vector Vec impulse; Vec old_data; cvec zfinal; void init(const Vec &b, const int xlength); vec overlap_add(const vec &x); svec overlap_add(const svec &x); ivec overlap_add(const ivec &x); cvec overlap_add(const cvec &x); void overlap_add(const cvec &x, cvec &y); }; // Initialize impulse rsponse, FFT size and block size template void Freq_Filt::init(const Vec &b, const int xlength) { // Set the impulse response impulse = b; // Get the length of the impulse response int num_elements = impulse.length(); // Initizlize old data old_data.set_size(0, false); // Initialize the final state zfinal.set_size(num_elements - 1, false); zfinal.zeros(); vec Lvec; /* * Compute the FFT size and the data block size to use. * The FFT size is N = L + M -1, where L corresponds to * the block size (to be determined) and M corresponds * to the impulse length. The method used here is designed * to minimize the (number of blocks) * (number of flops per FFT) * Use the FFTW flop computation of 5*N*log2(N). */ vec n = linspace(1, 20, 20); n = pow(2.0, n); ivec fftflops = to_ivec(elem_mult(5.0 * n, log2(n))); // Find where the FFT sizes are > (num_elements-1) //ivec index = find(n,">", static_cast(num_elements-1)); ivec index(n.length()); int cnt = 0; for (int ii = 0; ii < n.length(); ii++) { if (n(ii) > (num_elements - 1)) { index(cnt) = ii; cnt += 1; } } index.set_size(cnt, true); fftflops = fftflops(index); n = n(index); // Minimize number of blocks * number of flops per FFT Lvec = n - (double)(num_elements - 1); int min_ind = min_index(elem_mult(ceil((double)xlength / Lvec), to_vec(fftflops))); fftsize = static_cast(n(min_ind)); blksize = static_cast(Lvec(min_ind)); // Finally, compute the FFT of the impulse response B = fft(to_cvec(impulse), fftsize); } // Filter data template Vec Freq_Filt::filter(const Vec &input, const int strm) { Vec x, tempv; Vec output; /* * If we are not in streaming mode we want to process all of the data. * However, if we are in streaming mode we want to process the data in * blocks that are commensurate with the designed 'blksize' parameter. * So, we do a little book keeping to divide the iinput vector into the * correct size. */ if (!strm) { x = input; zfinal.zeros(); old_data.set_size(0, false); } else { // we are in streaming mode tempv = concat(old_data, input); if (tempv.length() <= blksize) { x = tempv; old_data.set_size(0, false); } else { int end = tempv.length(); int numblks = end / blksize; if ((end % blksize)) { x = tempv(0, blksize * numblks - 1); old_data = tempv(blksize * numblks, end - 1); } else { x = tempv(0, blksize * numblks - 1); old_data.set_size(0, false); } } } output = overlap_add(x); return output; } // Overlap-add routine template void Freq_Filt::overlap_add(const cvec&x, cvec &y) { int nb = impulse.length(); int nx = x.length(); y.set_size(nx, false); y.zeros(); cvec X, Y; int istart = 0; int L = blksize; while (istart < nx) { int iend = std::min(istart + L - 1, nx - 1); X = fft(x(istart, iend), fftsize); Y = ifft(elem_mult(X, B)); Y.set_subvector(0, Y(0, nb - 2) + zfinal); int yend = std::min(nx - 1, istart + fftsize - 1); y.set_subvector(istart, Y(0, yend - istart)); zfinal = Y(fftsize - (nb - 1), fftsize - 1); istart += L; } } template vec Freq_Filt::overlap_add(const vec &x) { cvec y; // Size of y is set later overlap_add(to_cvec(x), y); return real(y); } template svec Freq_Filt::overlap_add(const svec &x) { cvec y; // Size of y is set later overlap_add(to_cvec(x), y); return to_svec(real(y)); } template ivec Freq_Filt::overlap_add(const ivec &x) { cvec y; // Size of y is set later overlap_add(to_cvec(x), y); return to_ivec(real(y)); } template cvec Freq_Filt::overlap_add(const cvec &x) { cvec y; // Size of y is set later overlap_add(x, y); return y; } //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Freq_Filt; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Freq_Filt >; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Freq_Filt; ITPP_EXPORT_TEMPLATE template class ITPP_EXPORT Freq_Filt; //! \endcond } // namespace itpp #endif // #ifndef FREQ_FILT_H itpp-4.3.1/itpp/signal/poly.cpp000066400000000000000000000116711216575753400164400ustar00rootroot00000000000000/*! * \file * \brief Polynomial functions * \author Tony Ottosson, Kumar Appaiah and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include namespace itpp { void poly(const vec &r, vec &p) { int n = r.size(); p.set_size(n + 1, false); p.zeros(); p(0) = 1.0; for (int i = 0; i < n; i++) p.set_subvector(1, p(1, i + 1) - r(i)*p(0, i)); } void poly(const cvec &r, cvec &p) { int n = r.size(); p.set_size(n + 1, false); p.zeros(); p(0) = 1.0; for (int i = 0; i < n; i++) p.set_subvector(1, p(1, i + 1) - r(i)*p(0, i)); } void roots(const vec &p, cvec &r) { int n = p.size(), m, l; ivec f = find(p != 0.0); m = f.size(); vec v = p; mat A; if (m > 0 && n > 1) { v = v(f(0), f(m - 1)); l = v.size(); if (l > 1) { A = diag(ones(l - 2), -1); A.set_row(0, -v(1, l - 1) / v(0)); r = eig(A); cvec d; cmat V; eig(A, d , V); if (f(m - 1) < n) r = concat(r, zeros_c(n - f(m - 1) - 1)); } else { r.set_size(n - f(m - 1) - 1, false); r.zeros(); } } else r.set_size(0, false); } void roots(const cvec &p, cvec &r) { int n = p.size(), m, l; ivec f; // find all non-zero elements for (int i = 0; i < n; i++) if (p(i) != 0.0) f = concat(f, i); m = f.size(); cvec v = p; cmat A; if (m > 0 && n > 1) { v = v(f(0), f(m - 1)); l = v.size(); if (l > 1) { A = diag(ones_c(l - 2), -1); A.set_row(0, -v(1, l - 1) / v(0)); r = eig(A); if (f(m - 1) < n) r = concat(r, zeros_c(n - f(m - 1) - 1)); } else { r.set_size(n - f(m - 1) - 1, false); r.zeros(); } } else r.set_size(0, false); } vec polyval(const vec &p, const vec &x) { it_error_if(p.size() == 0, "polyval: size of polynomial is zero"); it_error_if(x.size() == 0, "polyval: size of input value vector is zero"); vec out(x.size()); out = p(0); for (int i = 1; i < p.size(); i++) out = p(i) + elem_mult(x, out); return out; } cvec polyval(const vec &p, const cvec &x) { it_error_if(p.size() == 0, "polyval: size of polynomial is zero"); it_error_if(x.size() == 0, "polyval: size of input value vector is zero"); cvec out(x.size()); out = p(0); for (int i = 1; i < p.size(); i++) out = std::complex(p(i)) + elem_mult(x, out); return out; } cvec polyval(const cvec &p, const vec &x) { it_error_if(p.size() == 0, "polyval: size of polynomial is zero"); it_error_if(x.size() == 0, "polyval: size of input value vector is zero"); cvec out(x.size()); out = p(0); for (int i = 1; i < p.size(); i++) out = std::complex(p(i)) + elem_mult(to_cvec(x), out); return out; } cvec polyval(const cvec &p, const cvec &x) { it_error_if(p.size() == 0, "polyval: size of polynomial is zero"); it_error_if(x.size() == 0, "polyval: size of input value vector is zero"); cvec out(x.size()); out = p(0); for (int i = 1; i < p.size(); i++) out = p(i) + elem_mult(x, out); return out; } double cheb(int n, double x) { it_assert((n >= 0), "cheb(): need a non-negative order n!"); if (x < 1.0 && x > -1.0) { return std::cos(n * std::acos(x)); } else if (x <= -1) { return (is_even(n) ? std::cosh(n * ::acosh(-x)) : -std::cosh(n * ::acosh(-x))); } return std::cosh(n * ::acosh(x)); } vec cheb(int n, const vec &x) { it_assert_debug(x.size() > 0, "cheb(): empty vector"); vec out(x.size()); for (int i = 0; i < x.size(); ++i) { out(i) = cheb(n, x(i)); } return out; } mat cheb(int n, const mat &x) { it_assert_debug((x.rows() > 0) && (x.cols() > 0), "cheb(): empty matrix"); mat out(x.rows(), x.cols()); for (int i = 0; i < x.rows(); ++i) { for (int j = 0; j < x.cols(); ++j) { out(i, j) = cheb(n, x(i, j)); } } return out; } } // namespace itpp itpp-4.3.1/itpp/signal/poly.h000066400000000000000000000103441216575753400161010ustar00rootroot00000000000000/*! * \file * \brief Polynomial functions * \author Tony Ottosson, Kumar Appaiah and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef POLY_H #define POLY_H #include #include namespace itpp { /*! \brief Create a polynomial of the given roots \ingroup poly Create a polynomial \c p with roots \c r @{ */ ITPP_EXPORT void poly(const vec &r, vec &p); inline vec poly(const vec &r) { vec temp; poly(r, temp); return temp; } ITPP_EXPORT void poly(const cvec &r, cvec &p); inline cvec poly(const cvec &r) { cvec temp; poly(r, temp); return temp; } /*! @} */ /*! \brief Calculate the roots of the polynomial \ingroup poly Calculate the roots \c r of the polynomial \c p @{ */ ITPP_EXPORT void roots(const vec &p, cvec &r); inline cvec roots(const vec &p) { cvec temp; roots(p, temp); return temp; } ITPP_EXPORT void roots(const cvec &p, cvec &r); inline cvec roots(const cvec &p) { cvec temp; roots(p, temp); return temp; } /*! @} */ /*! \brief Evaluate polynomial \ingroup poly Evaluate the polynomial \c p (of length \f$N+1\f$ at the points \c x The output is given by \f[ p_0 x^N + p_1 x^{N-1} + \ldots + p_{N-1} x + p_N \f] @{ */ ITPP_EXPORT vec polyval(const vec &p, const vec &x); ITPP_EXPORT cvec polyval(const vec &p, const cvec &x); ITPP_EXPORT cvec polyval(const cvec &p, const vec &x); ITPP_EXPORT cvec polyval(const cvec &p, const cvec &x); /*! @} */ /*! \brief Chebyshev polynomial of the first kind \ingroup poly Chebyshev polynomials of the first kind can be defined as follows: \f[ T(x) = \left\{ \begin{array}{ll} \cos(n\arccos(x)),& |x| \leq 0 \\ \cosh(n\mathrm{arccosh}(x)),& x > 1 \\ (-1)^n \cosh(n\mathrm{arccosh}(-x)),& x < -1 \end{array} \right. \f] \param n order of the Chebyshev polynomial \param x value at which the Chebyshev polynomial is to be evaluated \author Kumar Appaiah, Adam Piatyszek (code review) */ ITPP_EXPORT double cheb(int n, double x); /*! \brief Chebyshev polynomial of the first kind \ingroup poly Chebyshev polynomials of the first kind can be defined as follows: \f[ T(x) = \left\{ \begin{array}{ll} \cos(n\arccos(x)),& |x| \leq 0 \\ \cosh(n\mathrm{arccosh}(x)),& x > 1 \\ (-1)^n \cosh(n\mathrm{arccosh}(-x)),& x < -1 \end{array} \right. \f] \param n order of the Chebyshev polynomial \param x vector of values at which the Chebyshev polynomial is to be evaluated \return values of the Chebyshev polynomial evaluated for each element of \c x \author Kumar Appaiah, Adam Piatyszek (code review) */ ITPP_EXPORT vec cheb(int n, const vec &x); /*! \brief Chebyshev polynomial of the first kind \ingroup poly Chebyshev polynomials of the first kind can be defined as follows: \f[ T(x) = \left\{ \begin{array}{ll} \cos(n\arccos(x)),& |x| \leq 0 \\ \cosh(n\mathrm{arccosh}(x)),& x > 1 \\ (-1)^n \cosh(n\mathrm{arccosh}(-x)),& x < -1 \end{array} \right. \f] \param n order of the Chebyshev polynomial \param x matrix of values at which the Chebyshev polynomial is to be evaluated \return values of the Chebyshev polynomial evaluated for each element in \c x. \author Kumar Appaiah, Adam Piatyszek (code review) */ ITPP_EXPORT mat cheb(int n, const mat &x); } // namespace itpp #endif // #ifndef POLY_H itpp-4.3.1/itpp/signal/resampling.cpp000066400000000000000000000103021216575753400176040ustar00rootroot00000000000000/*! * \file * \brief Resampling functions - source file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- template ITPP_EXPORT vec repeat(const vec &v, int norepeats); template ITPP_EXPORT cvec repeat(const cvec &v, int norepeats); template ITPP_EXPORT svec repeat(const svec &v, int norepeats); template ITPP_EXPORT ivec repeat(const ivec &v, int norepeats); template ITPP_EXPORT bvec repeat(const bvec &v, int norepeats); template ITPP_EXPORT mat repeat(const mat &m, int norepeats); template ITPP_EXPORT cmat repeat(const cmat &m, int norepeats); template ITPP_EXPORT smat repeat(const smat &m, int norepeats); template ITPP_EXPORT imat repeat(const imat &m, int norepeats); template ITPP_EXPORT bmat repeat(const bmat &m, int norepeats); template ITPP_EXPORT vec upsample(const vec &v, int usf); template ITPP_EXPORT cvec upsample(const cvec &v, int usf); template ITPP_EXPORT svec upsample(const svec &v, int usf); template ITPP_EXPORT ivec upsample(const ivec &v, int usf); template ITPP_EXPORT bvec upsample(const bvec &v, int usf); template ITPP_EXPORT mat upsample(const mat &v, int usf); template ITPP_EXPORT cmat upsample(const cmat &v, int usf); template ITPP_EXPORT smat upsample(const smat &v, int usf); template ITPP_EXPORT imat upsample(const imat &v, int usf); template ITPP_EXPORT bmat upsample(const bmat &v, int usf); template ITPP_EXPORT void upsample(const vec &v, int usf, vec & u); template ITPP_EXPORT void upsample(const cvec &v, int usf, cvec & u); template ITPP_EXPORT void upsample(const svec &v, int usf, svec & u); template ITPP_EXPORT void upsample(const ivec &v, int usf, ivec & u); template ITPP_EXPORT void upsample(const bvec &v, int usf, bvec & u); template ITPP_EXPORT void upsample(const mat &v, int usf, mat & u); template ITPP_EXPORT void upsample(const cmat &v, int usf, cmat & u); template ITPP_EXPORT void upsample(const smat &v, int usf, smat & u); template ITPP_EXPORT void upsample(const imat &v, int usf, imat & u); template ITPP_EXPORT void upsample(const bmat &v, int usf, bmat & u); template ITPP_EXPORT vec lininterp(const vec &v, int usf); template ITPP_EXPORT cvec lininterp(const cvec &v, int usf); template ITPP_EXPORT mat lininterp(const mat &v, int usf); template ITPP_EXPORT cmat lininterp(const cmat &v, int usf); template ITPP_EXPORT void lininterp(const vec &v, int usf, vec & u); template ITPP_EXPORT void lininterp(const cvec &v, int usf, cvec & u); template ITPP_EXPORT void lininterp(const mat &v, int usf, mat & u); template ITPP_EXPORT void lininterp(const cmat &v, int usf, cmat & u); template ITPP_EXPORT mat lininterp(const mat &m, double f_base, double f_ups, int nrof_samples, double t_start); template ITPP_EXPORT cmat lininterp(const cmat &m, double f_base, double f_ups, int nrof_samples, double t_start); template ITPP_EXPORT vec lininterp(const vec &v, double f_base, double f_ups, int nrof_samples, double t_start); template ITPP_EXPORT cvec lininterp(const cvec &v, double f_base, double f_ups, int nrof_samples, double t_start); } // namespace itpp itpp-4.3.1/itpp/signal/resampling.h000066400000000000000000000313621216575753400172620ustar00rootroot00000000000000/*! * \file * \brief Resampling functions - header file * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef RESAMPLING_H #define RESAMPLING_H #include #include namespace itpp { /*! * \addtogroup resampling * @{ */ //! Repeat each element in the vector \a norepeats times in sequence template Vec repeat(const Vec &v, int norepeats) { Vec temp(v.length()*norepeats); for (int i = 0; i < v.length(); i++) { for (int j = 0;j < norepeats;j++) temp(i*norepeats + j) = v(i); } return temp; } //! Repeats each column \a norepeats times in sequence template Mat repeat(const Mat &m, int norepeats) { Mat temp(m.rows(), m.cols()*norepeats); for (int j = 0; j < m.cols(); j++) { for (int i = 0;i < norepeats;i++) { temp.set_col(j*norepeats + i, m.get_col(j)); } } return temp; } //! Upsample a vector by inserting \a (usf-1) zeros after each sample template void upsample(const Vec &v, int usf, Vec &u) { it_assert_debug(usf >= 1, "upsample: upsampling factor must be equal or greater than one"); u.set_size(v.length()*usf); u.clear(); for (int i = 0;i < v.length();i++) u(i*usf) = v(i); } //! Upsample a vector by inserting \a (usf-1) zeros after each sample template Vec upsample(const Vec &v, int usf) { Vec u; upsample(v, usf, u); return u; } //! Upsample each column by inserting \a (usf-1) zeros after each column template void upsample(const Mat &v, int usf, Mat &u) { it_assert_debug(usf >= 1, "upsample: upsampling factor must be equal or greater than one"); u.set_size(v.rows(), v.cols()*usf); u.clear(); for (int j = 0;j < v.cols();j++) u.set_col(j*usf, v.get_col(j)); } //! Upsample each column by inserting \a (usf-1) zeros after each column template Mat upsample(const Mat &v, int usf) { Mat u; upsample(v, usf, u); return u; } //! Upsample each column by a factor of \a (usf-1) by linear interpolation template void lininterp(const Mat &m, int usf, Mat &u) { it_assert_debug(usf >= 1, "lininterp: upsampling factor must be equal or greater than one"); int L = (m.cols() - 1) * usf + 1; u.set_size(m.rows(), L); for (int i = 0; i < m.rows(); i++) { for (int j = 0; j < L - 1; j++) u(i, j) = (m(i, j / usf) + (j % usf) / ((double)usf) * (m(i, (j + usf) / usf) - m(i, j / usf))); u(i, L - 1) = m(i, m.cols() - 1); } } /*! * \brief Upsample each column of matrix \a m to achieve \a f_ups * frequency using linear interpolation * \author Adam Piatyszek * * This function performs upsampling of matrix \a m to achieve * \a nrof_samples samples at \a f_ups frequency starting from the sample * at \a t_start time. The frequency of input samples stored in the matrix * \a m is defined by the \a f_base parameter. */ template Mat lininterp(const Mat &m, double f_base, double f_ups, int nrof_samples, double t_start = 0) { double t_base = 1 / f_base; double t_ups = 1 / f_ups; int rows = m.rows(); int cols = m.cols(); it_assert_debug(f_ups > f_base, "lininterp(): upsampled frequency must be greater than base frequency"); it_assert_debug((t_start >= 0) && (t_start < cols * t_base), "lininterp(): incorrect start time offset"); it_assert_debug((nrof_samples * t_ups + t_start) <= (cols * t_base), "lininterp(): too many samples required or input data to short"); Mat u(rows, nrof_samples); double curr_time = t_start; int i = 0; int k = 0; while (i < cols - 1) { while ((curr_time < (i + 1) * t_base) && (k < nrof_samples)) { for (int j = 0; j < rows; j++) { u(j, k) = (m(j, i) * ((i + 1) * t_base - curr_time) - m(j, i + 1) * (i * t_base - curr_time)) / t_base; } k++; curr_time += t_ups; } i++; } return u; } //! Upsample each column by a factor of \a (usf-1) by linear interpolation template Mat lininterp(const Mat &m, int usf) { Mat u; lininterp(m, usf, u); return u; } //! Upsample by a factor of \a (usf-1) by linear interpolation template void lininterp(const Vec &v, int usf, Vec &u) { it_assert_debug(usf >= 1, "lininterp(): upsampling factor must be equal or greater than one"); int L = (v.length() - 1) * usf + 1; u.set_size(L); for (int j = 0; j < L - 1; j++) { u(j) = (v(j / usf) + (j % usf) / ((double)usf) * (v((j + usf) / usf) - v(j / usf))); } u(L - 1) = v(v.length() - 1); } //! Upsample by a factor of \a (usf-1) by linear interpolation template Vec lininterp(const Vec &v, int usf) { Vec u; lininterp(v, usf, u); return u; } /*! * \brief Upsample vector \a v to achieve \a f_ups frequency using linear * interpolation * \author Adam Piatyszek * * This function performs upsampling of vector \a v to achieve * \a nrof_samples samples at \a f_ups frequency starting from the sample * at \a t_start time. The frequency of input samples stored in the vector * \a v is defined by the \a f_base parameter. */ template Vec lininterp(const Vec &v, double f_base, double f_ups, int nrof_samples, double t_start = 0) { double t_base = 1 / f_base; double t_ups = 1 / f_ups; int len = v.length(); it_assert_debug(f_ups > f_base, "lininterp(): upsampled frequency must be greater than base frequency"); it_assert_debug((t_start >= 0) && (t_start < len * t_base), "lininterp(): incorrect start time offset"); it_assert_debug((nrof_samples * t_ups + t_start) <= (len * t_base), "lininterp(): too many samples required or input data to short"); Vec u(nrof_samples); double curr_time = t_start; int i = 0; int k = 0; while (i < len - 1) { while ((curr_time < (i + 1) * t_base) && (k < nrof_samples)) { u(k) = (v(i) * ((i + 1) * t_base - curr_time) - v(i + 1) * (i * t_base - curr_time)) / t_base; k++; curr_time += t_ups; } i++; } return u; } /*! * @} */ //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec repeat(const vec &v, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec repeat(const cvec &v, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec repeat(const svec &v, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec repeat(const ivec &v, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec repeat(const bvec &v, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat repeat(const mat &m, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat repeat(const cmat &m, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat repeat(const smat &m, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat repeat(const imat &m, int norepeats); //! Extern Template instantiation of repeat ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat repeat(const bmat &m, int norepeats); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec upsample(const vec &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec upsample(const cvec &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT svec upsample(const svec &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT ivec upsample(const ivec &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bvec upsample(const bvec &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat upsample(const mat &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat upsample(const cmat &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT smat upsample(const smat &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT imat upsample(const imat &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT bmat upsample(const bmat &v, int usf); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const vec &v, int usf, vec &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const cvec &v, int usf, cvec &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const svec &v, int usf, svec &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const ivec &v, int usf, ivec &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const bvec &v, int usf, bvec &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const mat &v, int usf, mat &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const cmat &v, int usf, cmat &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const smat &v, int usf, smat &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const imat &v, int usf, imat &u); //! Extern Template instantiation of upsample ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void upsample(const bmat &v, int usf, bmat &u); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec lininterp(const vec &v, int usf); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec lininterp(const cvec &v, int usf); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat lininterp(const mat &v, int usf); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat lininterp(const cmat &v, int usf); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void lininterp(const vec &v, int usf, vec &u); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void lininterp(const cvec &v, int usf, cvec &u); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void lininterp(const mat &v, int usf, mat &u); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void lininterp(const cmat &v, int usf, cmat &u); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat lininterp(const mat &m, double f_base, double f_ups, int nrof_samples, double t_start); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat lininterp(const cmat &m, double f_base, double f_ups, int nrof_samples, double t_start); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec lininterp(const vec &v, double f_base, double f_ups, int nrof_samples, double t_start); //! Extern Template instantiation of liniterp ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec lininterp(const cvec &v, double f_base, double f_ups, int nrof_samples, double t_start); //! \endcond } // namespace itpp #endif // #ifndef RESAMPLING_H itpp-4.3.1/itpp/signal/sigfun.cpp000066400000000000000000000215641216575753400167520ustar00rootroot00000000000000/*! * \file * \brief Implementation of signal processing functions * \author Tony Ottosson, Thomas Eriksson, Pal Frenger, and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #include namespace itpp { vec xcorr_old(const vec &x, const int max_lag, const std::string scaleopt) { vec out; xcorr_old(x, x, out, max_lag, scaleopt); return out; } vec xcorr(const vec &x, const int max_lag, const std::string scaleopt) { cvec out(2*x.length() - 1); //Initial size does ont matter, it will get adjusted xcorr(to_cvec(x), to_cvec(x), out, max_lag, scaleopt, true); return real(out); } cvec xcorr(const cvec &x, const int max_lag, const std::string scaleopt) { cvec out(2*x.length() - 1); //Initial size does ont matter, it will get adjusted xcorr(x, x, out, max_lag, scaleopt, true); return out; } vec xcorr(const vec &x, const vec &y, const int max_lag, const std::string scaleopt) { cvec out(2*x.length() - 1); //Initial size does ont matter, it will get adjusted xcorr(to_cvec(x), to_cvec(y), out, max_lag, scaleopt, false); return real(out); } cvec xcorr(const cvec &x, const cvec &y, const int max_lag, const std::string scaleopt) { cvec out(2*x.length() - 1); //Initial size does ont matter, it will get adjusted xcorr(x, y, out, max_lag, scaleopt, false); return out; } void xcorr(const vec &x, const vec &y, vec &out, const int max_lag, const std::string scaleopt) { cvec xx = to_cvec(x); cvec yy = to_cvec(y); cvec oo = to_cvec(out); xcorr(xx, yy, oo, max_lag, scaleopt, false); out = real(oo); } void xcorr_old(const vec &x, const vec &y, vec &out, const int max_lag, const std::string scaleopt) { int m, n; double s_plus, s_minus, M_double, coeff_scale = 0.0; int M, N; M = x.size(); M = std::max(x.size(), y.size()); M_double = double(M); if (max_lag == -1) { N = std::max(x.size(), y.size()); } else { N = max_lag + 1; } out.set_size(2*N - 1, false); it_assert(N <= std::max(x.size(), y.size()), "max_lag cannot be as large as, or larger than, the maximum length of x and y."); if (scaleopt == "coeff") { coeff_scale = std::sqrt(energy(x)) * std::sqrt(energy(y)); } for (m = 0; m < N; m++) { s_plus = 0; s_minus = 0; for (n = 0;n < M - m;n++) { s_minus += index_zero_pad(x, n) * index_zero_pad(y, n + m); s_plus += index_zero_pad(x, n + m) * index_zero_pad(y, n); } if (scaleopt == "none") { out(N + m - 1) = s_plus; out(N - m - 1) = s_minus; } else if (scaleopt == "biased") { out(N + m - 1) = s_plus / M_double; out(N - m - 1) = s_minus / M_double; } else if (scaleopt == "unbiased") { out(N + m - 1) = s_plus / double(M - m); out(N - m - 1) = s_minus / double(M - m); } else if (scaleopt == "coeff") { out(N + m - 1) = s_plus / coeff_scale; out(N - m - 1) = s_minus / coeff_scale; } else it_error("Incorrect scaleopt specified."); } } vec xcorr_old(const vec &x, const vec &y, const int max_lag, const std::string scaleopt) { vec out; xcorr_old(x, y, out, max_lag, scaleopt); return out; } //Correlation void xcorr(const cvec &x, const cvec &y, cvec &out, const int max_lag, const std::string scaleopt, bool autoflag) { int N = std::max(x.length(), y.length()); //Compute the FFT size as the "next power of 2" of the input vector's length (max) int b = ceil_i(::log2(2.0 * N - 1)); int fftsize = pow2i(b); int end = fftsize - 1; cvec temp2; if (autoflag == true) { //Take FFT of input vector cvec X = fft(zero_pad(x, fftsize)); //Compute the abs(X).^2 and take the inverse FFT. temp2 = ifft(elem_mult(X, conj(X))); } else { //Take FFT of input vectors cvec X = fft(zero_pad(x, fftsize)); cvec Y = fft(zero_pad(y, fftsize)); //Compute the crosscorrelation temp2 = ifft(elem_mult(X, conj(Y))); } // Compute the total number of lags to keep. We truncate the maximum number of lags to N-1. int maxlag; if ((max_lag == -1) || (max_lag >= N)) maxlag = N - 1; else maxlag = max_lag; //Move negative lags to the beginning of the vector. Drop extra values from the FFT/IFFt if (maxlag == 0) { out.set_size(1, false); out = temp2(0); } else out = concat(temp2(end - maxlag + 1, end), temp2(0, maxlag)); //Scale data if (scaleopt == "biased") //out = out / static_cast(N); out = out / static_cast >(N); else if (scaleopt == "unbiased") { //Total lag vector vec lags = linspace(-maxlag, maxlag, 2 * maxlag + 1); cvec scale = to_cvec(static_cast(N) - abs(lags)); out /= scale; } else if (scaleopt == "coeff") { if (autoflag == true) // Normalize by Rxx(0) out /= out(maxlag); else { //Normalize by sqrt(Rxx(0)*Ryy(0)) double rxx0 = sum(abs(elem_mult(x, x))); double ryy0 = sum(abs(elem_mult(y, y))); out /= std::sqrt(rxx0 * ryy0); } } else if (scaleopt == "none") {} else it_warning("Unknow scaling option in XCORR, defaulting to "); } mat cov(const mat &X, bool is_zero_mean) { int d = X.cols(), n = X.rows(); mat R(d, d), m2(n, d); vec tmp; R = 0.0; if (!is_zero_mean) { // Compute and remove mean for (int i = 0; i < d; i++) { tmp = X.get_col(i); m2.set_col(i, tmp - mean(tmp)); } // Calc corr matrix for (int i = 0; i < d; i++) { for (int j = 0; j <= i; j++) { for (int k = 0; k < n; k++) { R(i, j) += m2(k, i) * m2(k, j); } R(j, i) = R(i, j); // When i=j this is unnecassary work } } } else { // Calc corr matrix for (int i = 0; i < d; i++) { for (int j = 0; j <= i; j++) { for (int k = 0; k < n; k++) { R(i, j) += X(k, i) * X(k, j); } R(j, i) = R(i, j); // When i=j this is unnecassary work } } } R /= n; return R; } vec spectrum(const vec &v, int nfft, int noverlap) { it_assert_debug(pow2i(levels2bits(nfft)) == nfft, "nfft must be a power of two in spectrum()!"); vec P(nfft / 2 + 1), w(nfft), wd(nfft); P = 0.0; w = hanning(nfft); double w_energy = nfft == 1 ? 1 : (nfft + 1) * .375; // Hanning energy if (nfft > v.size()) { P = sqr(abs(fft(to_cvec(elem_mult(zero_pad(v, nfft), w)))(0, nfft / 2))); P /= w_energy; } else { int k = (v.size() - noverlap) / (nfft - noverlap), idx = 0; for (int i = 0; i < k; i++) { wd = elem_mult(v(idx, idx + nfft - 1), w); P += sqr(abs(fft(to_cvec(wd))(0, nfft / 2))); idx += nfft - noverlap; } P /= k * w_energy; } P.set_size(nfft / 2 + 1, true); return P; } vec spectrum(const vec &v, const vec &w, int noverlap) { int nfft = w.size(); it_assert_debug(pow2i(levels2bits(nfft)) == nfft, "The window size must be a power of two in spectrum()!"); vec P(nfft / 2 + 1), wd(nfft); P = 0.0; double w_energy = energy(w); if (nfft > v.size()) { P = sqr(abs(fft(to_cvec(elem_mult(zero_pad(v, nfft), w)))(0, nfft / 2))); P /= w_energy; } else { int k = (v.size() - noverlap) / (nfft - noverlap), idx = 0; for (int i = 0; i < k; i++) { wd = elem_mult(v(idx, idx + nfft - 1), w); P += sqr(abs(fft(to_cvec(wd))(0, nfft / 2))); idx += nfft - noverlap; } P /= k * w_energy; } P.set_size(nfft / 2 + 1, true); return P; } vec filter_spectrum(const vec &a, int nfft) { vec s = sqr(abs(fft(to_cvec(a), nfft))); s.set_size(nfft / 2 + 1, true); return s; } vec filter_spectrum(const vec &a, const vec &b, int nfft) { vec s = sqr(abs(elem_div(fft(to_cvec(a), nfft), fft(to_cvec(b), nfft)))); s.set_size(nfft / 2 + 1, true); return s; } } // namespace itpp itpp-4.3.1/itpp/signal/sigfun.h000066400000000000000000000172341216575753400164160ustar00rootroot00000000000000/*! * \file * \brief Definitions of signal processing functions * \author Tony Ottosson, Thomas Eriksson, Pal Frenger, and Tobias Ringstrom * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SIGFUN_H #define SIGFUN_H #include #include namespace itpp { /*! * \addtogroup sigproc * @{ */ /*! \brief Cross-correlation calculation \c z=xcorr(x,y,max_lag), where \a x and \a y are length \a M vectors \a (M>1), returns the length \c 2*max_lag+1 cross-correlation sequence \a z. (lags: \c -max_lag,...,0,...,max_lag) For \c max_lag=-1 the cross-correlation sequence is of length \c 2*M-1, i.e., the cross-correlation for all possible lags. Scaling options \a scaleopt: \arg \a none \c => No scaling of the cross-correlation vector \arg \a biased \c => Scales the cross-correlation vector by \c 1/M \arg \a unbiased \c => Scales the cross-correlation vector by \c 1/(M-abs(lag)) \arg \a coeff \c => Normalises the cross-correlation to 1 for zero lag. \note \c max_lag \c <= \c M-1 \note If \c x and \c y are of different length, the shortest one is zero-padded \param x (Input) Vector of samples \param y (Input) Vector of samples \param out (Output) The cross correlation between \a x and \a y. \param max_lag (Input) Maximum lag for which the cross-correlation is calculated. The output vector is of size \c 2*maxlag+1. Default value: \c max_lag=-1 calculates the cross-correlations for all possible lags \param scaleopt (Input) Indicates how the cross-correlation function should be scaled. Default value: \c "none" indicates that no scaling is done @{ */ ITPP_EXPORT void xcorr_old(const vec &x, const vec &y, vec &out, const int max_lag = -1, const std::string scaleopt = "none"); ITPP_EXPORT void xcorr(const vec &x, const vec &y, vec &out, const int max_lag = -1, const std::string scaleopt = "none"); /*! @} */ /*! \brief Cross-correlation calculation \c z=xcorr(x,y,max_lag), where \a x and \a y are length \a M vectors \a (M>1), returns the length \c 2*max_lag+1 cross-correlation sequence \a z. (lags: \c -max_lag,...,0,...,max_lag) For \c max_lag=-1 the cross-correlation sequence is of length \c 2*M-1, i.e., the cross-correlation for all possible lags. Scaling options \a scaleopt: \arg \a none \c => No scaling of the cross-correlation vector \arg \a biased \c => Scales the cross-correlation vector by \c 1/M \arg \a unbiased \c => Scales the cross-correlation vector by \c 1/(M-abs(lag)) \arg \a coeff \c => Normalises the cross-correlation to 1 for zero lag. \note \c max_lag \c <= \c M-1 \note If \c x and \c y are of different length, the shortest one is zero-padded \param x (Input) Vector of samples \param y (Input) Vector of samples \param max_lag (Input) Maximum lag for which the cross-correlation is calculated. The output vector is of size \c 2*maxlag+1. Default value: \c max_lag=-1 calculates the cross-correlations for all possible lags \param scaleopt (Input) Indicates how the cross-correlation function should be scaled. Default value: \c "none" indicates that no scaling is done \returns The cross correlation between \a x and \a y. @{ */ ITPP_EXPORT vec xcorr_old(const vec &x, const vec &y, const int max_lag = -1, const std::string scaleopt = "none"); ITPP_EXPORT vec xcorr(const vec &x, const vec &y, const int max_lag = -1, const std::string scaleopt = "none"); /*! @} */ /*! \brief Cross Correlation \code r = xcorr(x,y) \endcode returns the cross-correlation vector \b r. */ ITPP_EXPORT cvec xcorr(const cvec &x, const cvec &y, const int max_lag = -1, const std::string scaleopt = "none"); /*! \brief Auto-correlation calculation \c z=xcorr(x,max_lag), where \a x and is a length \a M vector \a (M>1), returns the length \c 2*max_lag+1 auto-correlation sequence \a z. (lags: \c -max_lag,...,0,...,max_lag) For \c max_lag=-1 the auto-correlation sequence is of length \c 2*M-1, i.e., the cross correlation for all possible lags. Scaling options \a scaleopt: \arg \a none \c => No scaling of the auto-correlation vector \arg \a biased \c => Scales the auto-correlation vector by \c 1/M \arg \a unbiased \c => Scales the auto-correlation vector by \c 1/(M-abs(lag)) \arg \a coeff \c => Normalises the auto-correlation so that \c acf(x)=1 for zero lag. \note \c max_lag \c <= \c M-1 \param x (Input) Vector of samples \param max_lag (Input) Maximum lag for which the auto-correlation is calculated. The output vector is of size \c 2*maxlag+1. Default value \c max_lag=-1 calculates the auto-correlations for all possible lags. \param scaleopt (Input) Indicates how the auto-correlation function should be scaled. Default value: \c "none" indicates that no scaling is done. \returns The auto-correlation of \a x. @{ */ ITPP_EXPORT vec xcorr_old(const vec &x, const int max_lag = -1, const std::string scaleopt = "none"); ITPP_EXPORT vec xcorr(const vec &x, const int max_lag = -1, const std::string scaleopt = "none"); /*! @} */ /*! \brief Cross Correlation \code r = xcorr(x) \endcode returns the auto-correlation vecotr \b r. */ ITPP_EXPORT cvec xcorr(const cvec &x, const int max_lag = -1, const std::string scaleopt = "none"); /*! \brief Cross Correlation \code xcorr(x,y,out) \endcode Computes the cross-correlatin and returns in vector \b out */ ITPP_EXPORT void xcorr(const cvec &x, const cvec &y, cvec &out, const int max_lag = -1, const std::string scaleopt = "none", bool autoflag = true); /*! \brief Covariance matrix calculation Calculates the covariance matrix of the observations in the matrix \f$X\f$. Each row is an observation and each column represents a variable. The covariance is normalized with the number of observations \f$N\f$. The mean value is removed before calculation. Set is_zero_mean if X already has zero mean. */ ITPP_EXPORT mat cov(const mat &X, bool is_zero_mean = false); //vec cov(const vec &x, short order); /*! \brief Power spectrum calculation Calculates the power spectrum using the Welch method and a Hanning window. */ ITPP_EXPORT vec spectrum(const vec &v, int nfft = 256, int noverlap = 0); /*! \brief Power spectrum calculation Calculates the power spectrum using using the Welch method and the supplied window w. */ ITPP_EXPORT vec spectrum(const vec &v, const vec &w, int noverlap = 0); /*! \brief Power spectrum calculation of a filter Calculates the power spectrum of a filter with transfer function a(z) */ ITPP_EXPORT vec filter_spectrum(const vec &a, int nfft = 256); /*! \brief Power spectrum calculation of a filter Calculates the power spectrum of a filter with transfer function a(z)/b(z) */ ITPP_EXPORT vec filter_spectrum(const vec &a, const vec &b, int nfft = 256); /*! @} */ } // namespace itpp #endif // #ifndef SIGFUN_H itpp-4.3.1/itpp/signal/source.cpp000066400000000000000000000131771216575753400167600ustar00rootroot00000000000000/*! * \file * \brief Deterministic sources - source file * \author Tobias Ringstrom and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { /////////////////////////////////////////////// // Sine_Source /////////////////////////////////////////////// Sine_Source::Sine_Source(double freq, double mean, double ampl, double inphase) { A = ampl; m = mean; theta = inphase; dtheta = 2.0 * pi * freq; } double Sine_Source::sample() { double samp = m + A * sin(theta); theta += dtheta; if (theta >= 2.0 * pi) theta -= 2.0 * pi; return samp; } vec Sine_Source::operator()(int n) { vec v(n); for (int i=0; i < n; i++) v(i) = sample(); return v; } mat Sine_Source::operator()(int h, int w) { mat mm(h, w); int i, j; for (i = 0; i < h; i++) for (j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Square_Source /////////////////////////////////////////////// Square_Source::Square_Source(double freq, double mean, double ampl, double inphase) { A = ampl; m = mean; theta = inphase / (2.0 * pi); dtheta = freq; } double Square_Source::sample() { double samp = theta < 0.5 ? 1.0 : -1.0; theta += dtheta; if (theta >= 1.0) theta -= 1.0; return samp; } vec Square_Source::operator()(int n) { vec v(n); for (int i=0; i < n; i++) v(i) = sample(); return v; } mat Square_Source::operator()(int h, int w) { mat mm(h, w); int i, j; for (i = 0; i < h; i++) for (j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Triangle_Source /////////////////////////////////////////////// Triangle_Source::Triangle_Source(double freq, double mean, double ampl, double inphase) { A = ampl; m = mean; theta = inphase / (2.0 * pi); dtheta = freq; } double Triangle_Source::sample() { double samp = m + 4.0 * A * (theta < 0.25 ? theta : 0.5 - theta); theta += dtheta; if (theta >= 0.75) theta -= 1.0; return samp; } vec Triangle_Source::operator()(int n) { vec v(n); for (int i=0; i < n; i++) v(i) = sample(); return v; } mat Triangle_Source::operator()(int h, int w) { mat mm(h, w); int i, j; for (i = 0; i < h; i++) for (j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Sawtooth_Source /////////////////////////////////////////////// Sawtooth_Source::Sawtooth_Source(double freq, double mean, double ampl, double inphase) { A = ampl; m = mean; theta = inphase / (2.0 * pi); dtheta = freq; } double Sawtooth_Source::sample() { double samp = 2.0 * A * theta; theta += dtheta; if (theta >= 0.5) theta -= 1.0; return samp; } vec Sawtooth_Source::operator()(int n) { vec v(n); for (int i=0; i < n; i++) v(i) = sample(); return v; } mat Sawtooth_Source::operator()(int h, int w) { mat mm(h, w); int i, j; for (i = 0; i < h; i++) for (j = 0; j < w; j++) mm(i, j) = sample(); return mm; } /////////////////////////////////////////////// // Impulse_Source /////////////////////////////////////////////// Impulse_Source::Impulse_Source(double freq, double ampl, double inphase) { A = ampl; pos = inphase / (2.0 * pi); dtheta = freq; } double Impulse_Source::sample() { double samp; if (pos >= 1.0) { samp = A; pos -= 1.0; } else { samp = 0.0; pos += dtheta; } return samp; } vec Impulse_Source::operator()(int n) { vec v(n); for (int i=0; i < n; i++) v(i) = sample(); return v; } mat Impulse_Source::operator()(int h, int w) { mat m(h, w); int i, j; for (i = 0; i < h; i++) for (j = 0; j < w; j++) m(i, j) = sample(); return m; } /////////////////////////////////////////////// // Pattern_Source /////////////////////////////////////////////// Pattern_Source::Pattern_Source(const vec &pattern, int start_pos) { pat = pattern; pos = start_pos; // Calculate the mean and variance. Note that the variance shall // be normalied by N and not N-1 in this case mean = var = 0.0; for (int i = pat.size() - 1; i >= 0; i--) { mean += pat(i); var += pat(i) * pat(i); } mean /= pat.size(); var /= pat.size(); var -= mean * mean; } double Pattern_Source::sample() { double samp = pat(pos); if (pos >= pat.size() - 1) pos = 0; else pos++; return samp; } vec Pattern_Source::operator()(int n) { vec v(n); for (int i=0; i < n; i++) v(i) = sample(); return v; } mat Pattern_Source::operator()(int h, int w) { mat m(h, w); int i, j; for (i = 0; i < h; i++) for (j = 0; j < w; j++) m(i, j) = sample(); return m; } } // namespace itpp itpp-4.3.1/itpp/signal/source.h000066400000000000000000000103751216575753400164220ustar00rootroot00000000000000/*! * \file * \brief Deterministic sources - header file * \author Tobias Ringstrom and Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef SOURCE_H #define SOURCE_H #include #include namespace itpp { //! \addtogroup detsource /*! \brief Sine-wave source \ingroup detsource */ class ITPP_EXPORT Sine_Source { public: //! Constructor. Set frequency, mean, amplitude, and start phase Sine_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0); //! Return a single sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); protected: private: double sample(); double m, A, theta, dtheta; }; /*! \brief Square-wave source \ingroup detsource */ class ITPP_EXPORT Square_Source { public: //! Constructor. Set frequency, mean, amplitude, and start phase Square_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0); //! Return a single sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); protected: private: double sample(); double m, A, theta, dtheta; }; /*! \brief Triangle-wave source \ingroup detsource */ class ITPP_EXPORT Triangle_Source { public: //! Constructor. Set frequency, mean, amplitude and start phase Triangle_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0); //! Return a single sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); protected: private: double sample(); double m, A, theta, dtheta; }; /*! \brief Sawtooth-wave source \ingroup detsource */ class ITPP_EXPORT Sawtooth_Source { public: //! Constructor. Set frequency, mean, amplitude, and start phase Sawtooth_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0); //! Return a single sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); protected: private: double sample(); double m, A, theta, dtheta; }; /*! \brief Impulse source \ingroup detsource */ class ITPP_EXPORT Impulse_Source { public: //! Constructor. Set frequency, amplitude and start phase Impulse_Source(double freq, double ampl = 1.0, double inphase = 0.0); //! Return a single sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); protected: private: double sample(); double A, pos, dtheta; }; /*! \brief Pattern source \ingroup detsource */ class ITPP_EXPORT Pattern_Source { public: //! Constructor. Set pattern and start position Pattern_Source(const vec &pattern, int start_pos = 0); //! Destructor virtual ~Pattern_Source() { } //! Return a single sample double operator()() { return sample(); } //! Get a sample vector. vec operator()(int n); //! Get a sample matrix. mat operator()(int h, int w); protected: private: double sample(); int pos; vec pat; double mean, var; }; } //namespace itpp #endif // #ifndef SOURCE_H itpp-4.3.1/itpp/signal/sources.mk000066400000000000000000000015271216575753400167640ustar00rootroot00000000000000h_signal_sources = \ $(top_srcdir)/itpp/signal/fastica.h \ $(top_srcdir)/itpp/signal/filter_design.h \ $(top_srcdir)/itpp/signal/filter.h \ $(top_srcdir)/itpp/signal/freq_filt.h \ $(top_srcdir)/itpp/signal/poly.h \ $(top_srcdir)/itpp/signal/resampling.h \ $(top_srcdir)/itpp/signal/sigfun.h \ $(top_srcdir)/itpp/signal/source.h \ $(top_srcdir)/itpp/signal/transforms.h \ $(top_srcdir)/itpp/signal/window.h cpp_signal_sources = \ $(top_srcdir)/itpp/signal/fastica.cpp \ $(top_srcdir)/itpp/signal/filter_design.cpp \ $(top_srcdir)/itpp/signal/filter.cpp \ $(top_srcdir)/itpp/signal/freq_filt.cpp \ $(top_srcdir)/itpp/signal/poly.cpp \ $(top_srcdir)/itpp/signal/resampling.cpp \ $(top_srcdir)/itpp/signal/sigfun.cpp \ $(top_srcdir)/itpp/signal/source.cpp \ $(top_srcdir)/itpp/signal/transforms.cpp \ $(top_srcdir)/itpp/signal/window.cpp itpp-4.3.1/itpp/signal/transforms.cpp000066400000000000000000001050671216575753400176560ustar00rootroot00000000000000/*! * \file * \brief Fourier, Cosine, Hadamard, Walsh-Hadamard, and 2D Hadamard * transforms - source file * \author Tony Ottosson, Thomas Eriksson, Simon Wood, Adam Piatyszek, Andy Panov and Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef _MSC_VER # include #else # include #endif #if defined(HAVE_FFT_MKL) #include #include namespace mkl { # include # include # undef DftiCreateDescriptor } #elif defined(HAVE_FFT_ACML) namespace acml { # include } #elif defined(HAVE_FFTW3) # include #endif #include //! \cond //multithreading mode selector enum MultithreadingTag {SingleThreaded = 1, OmpThreaded}; #ifdef _OPENMP #include static const MultithreadingTag ThreadingTag = OmpThreaded; //number of context records kept per transform type //see comments for Transform_Provider class for futher details static const int contexts_per_transform_type = 10; //specialize mutex for multi-threaded code with OMP class Mutex { omp_lock_t _lck; //disable copy-construction and assignment Mutex(const Mutex&); Mutex& operator=(const Mutex&); public: Mutex() {omp_init_lock(&_lck);} ~Mutex() {omp_destroy_lock(&_lck);} //lock the mutex void lock() {omp_set_lock(&_lck);} //try to lock. returns true if ownership is taken bool try_lock() {return (omp_test_lock(&_lck)) != 0;} //unlock void unlock() {omp_unset_lock(&_lck);} }; #else static const MultithreadingTag ThreadingTag = SingleThreaded; //number of context records kept per transform type //see comments for Transform_Provider class for futher details static const int contexts_per_transform_type = 1; //specialize mutex for single-threaded code class Mutex { //disable copy-construction and assignment Mutex(const Mutex&); Mutex& operator=(const Mutex&); public: Mutex() {} ~Mutex() {} void lock() {} bool try_lock() {return true;} void unlock() {} }; #endif //mutex-based lock class Lock { Mutex& _m; //disable copy-construction and assignment Lock(const Lock&); Lock& operator=(const Lock&); public: Lock(Mutex& m): _m(m) {_m.lock();} ~Lock() {_m.unlock();} }; namespace itpp { //define traits for all supported transform types: FFT complex, FFT real, IFFT Complex, IFFT Real, DCT, IDCT struct FFTCplx_Traits { typedef cvec InType; typedef cvec OutType; }; struct IFFTCplx_Traits { typedef cvec InType; typedef cvec OutType; }; struct FFTReal_Traits { typedef vec InType; typedef cvec OutType; }; struct IFFTReal_Traits { typedef cvec InType; typedef vec OutType; }; struct DCT_Traits { typedef vec InType; typedef vec OutType; }; struct IDCT_Traits { typedef vec InType; typedef vec OutType; }; //generic transforms implementation based on transform type and specific FFT library template class Transform; //FFT library initializer based on mutithreading model template inline void init_fft_library(); #if defined(HAVE_FFT_MKL) //MKL-specific implementations //MKL FFT-related notes: //If multithreading is enabled on ITPP level (and in user's code) MKL FFT descriptors can be created, committed and freed by multiple threads //In this case Intel recommends to use single-threaded FFT implementation: //1. "Intel MKL 10.x threading", http://software.intel.com/en-us/articles/intel-mkl-10x-threading, //2. "Examples of Using Multi-Threading for FFT Computation", http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/GUID-00422EBE-93C3-4BC9-A621-9BF0A0E93888.htm //Based on examples, provided by Intel, it seems to be safe to create/commit/free and run FFT on per-thread descriptor //without additional locking template<> inline void init_fft_library() {} //assume no actions required. ITPP does not use threading, so FFT library is free to use it's own threading implementation template<> inline void init_fft_library() { //switch FFT domain of MKL to single-threaded mode as Intel suggests //this should work starting from MKL 10.0 mkl::mkl_domain_set_num_threads(1, MKL_FFT); } //--------------------------------------------------------------------------- // FFT/IFFT based on MKL //--------------------------------------------------------------------------- inline void release_descriptor(mkl::DFTI_DESCRIPTOR* h) { if(h != NULL) { MKL_LONG status = mkl::DftiFreeDescriptor(&h); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library release_descriptor() failed on DftiFreeDescriptor."); } } } template<> class Transform { mkl::DFTI_DESCRIPTOR* _h; int _transform_length; public: Transform(): _h(NULL), _transform_length(0) {} void compute_transform(const cvec &in, cvec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { release_descriptor(_h); _transform_length = in.size(); MKL_LONG status = mkl::DftiCreateDescriptor(&_h, mkl::DFTI_DOUBLE, mkl::DFTI_COMPLEX, 1, _transform_length); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCreateDescriptor."); } mkl::DftiSetValue(_h, mkl::DFTI_PLACEMENT, mkl::DFTI_NOT_INPLACE); status = mkl::DftiCommitDescriptor(_h); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCommitDescriptor."); } } mkl::DftiComputeForward(_h, (void *)in._data(), out._data()); } void reset() {release_descriptor(_h); *this = Transform();} }; template<> class Transform { mkl::DFTI_DESCRIPTOR* _h; int _transform_length; public: Transform(): _h(NULL), _transform_length(0) {} void compute_transform(const cvec &in, cvec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { release_descriptor(_h); _transform_length = in.size(); MKL_LONG status = mkl::DftiCreateDescriptor(&_h, mkl::DFTI_DOUBLE, mkl::DFTI_COMPLEX, 1, _transform_length); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCreateDescriptor."); } mkl::DftiSetValue(_h, mkl::DFTI_PLACEMENT, mkl::DFTI_NOT_INPLACE); mkl::DftiSetValue(_h, mkl::DFTI_BACKWARD_SCALE, 1.0 / _transform_length); status = mkl::DftiCommitDescriptor(_h); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCommitDescriptor."); } } mkl::DftiComputeBackward(_h, (void *)in._data(), out._data()); } void reset() {release_descriptor(_h); *this = Transform();} }; template<> class Transform { mkl::DFTI_DESCRIPTOR* _h; int _transform_length; public: Transform(): _h(NULL), _transform_length(0) {} void compute_transform(const vec &in, cvec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { release_descriptor(_h); _transform_length = in.size(); MKL_LONG status = mkl::DftiCreateDescriptor(&_h, mkl::DFTI_DOUBLE, mkl::DFTI_REAL, 1, _transform_length); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCreateDescriptor."); } mkl::DftiSetValue(_h, mkl::DFTI_PLACEMENT, mkl::DFTI_NOT_INPLACE); status = mkl::DftiCommitDescriptor(_h); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCommitDescriptor."); } } mkl::DftiComputeForward(_h, (void *)in._data(), out._data()); // Real FFT does not compute the 2nd half of the FFT points because it // is redundant to the 1st half. However, we want all of the data so we // fill it in. This is consistent with Matlab's functionality int istart = ceil_i(in.size() / 2.0); int idelta = in.size() - istart; out.set_subvector(istart, reverse(conj(out(1, idelta)))); } void reset() {release_descriptor(_h); *this = Transform();} }; template<> class Transform { mkl::DFTI_DESCRIPTOR* _h; int _transform_length; public: Transform(): _h(NULL), _transform_length(0) {} void compute_transform(const cvec &in, vec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { release_descriptor(_h); _transform_length = in.size(); MKL_LONG status = mkl::DftiCreateDescriptor(&_h, mkl::DFTI_DOUBLE, mkl::DFTI_REAL, 1, _transform_length); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCreateDescriptor."); } mkl::DftiSetValue(_h, mkl::DFTI_PLACEMENT, mkl::DFTI_NOT_INPLACE); mkl::DftiSetValue(_h, mkl::DFTI_BACKWARD_SCALE, 1.0 / _transform_length); status = mkl::DftiCommitDescriptor(_h); if(status) { it_info(mkl::DftiErrorMessage(status)); it_error("MKL library compute_transform() failed on DftiCommitDescriptor."); } } mkl::DftiComputeBackward(_h, (void *)in._data(), out._data()); } void reset() {release_descriptor(_h); *this = Transform();} }; #endif // #ifdef HAVE_FFT_MKL #if defined(HAVE_FFT_ACML) //ACML-specific implementations //ACML FFT-related notes: //ACML documentation is not very verbose regarding the multithreaded use of the library, but multithreaded ifort-built ACML uses //OMP internally. AMD recommends linking with SINGLE-THREADED library if OMP is enabled in user's code. Also, they claim that //single-threaded functions can be used from the multiple threads simultaniously (see http://devgurus.amd.com/thread/141592 for //multi-threading discussion on AMD dev forums) The thread-safety of library functions is also mentioned in ACML release notes (ver 4.4.0). //In the following implementation we assume that ACML transform functions can be run simultaneously from different threads safely if they operate //on different data sets. template<> inline void init_fft_library() {} //assume no actions required. template<> inline void init_fft_library() {} //--------------------------------------------------------------------------- // FFT/IFFT based on ACML //--------------------------------------------------------------------------- template<> class Transform { cvec _scratchpad; int _transform_length; public: Transform(): _transform_length(0) {} void compute_transform(const cvec &in, cvec &out) { int info; out.set_size(in.size(), false); if(_transform_length != in.size()) { _transform_length = in.size(); int min_required_size = 5 * _transform_length + 100; //ACML guides suggest 3*size + 100 here, but ITPP code uses 5. if(_scratchpad.size() < min_required_size) _scratchpad.set_size(min_required_size); acml::zfft1dx(0, 1.0, false, _transform_length, (acml::doublecomplex *)in._data(), 1, (acml::doublecomplex *)out._data(), 1, (acml::doublecomplex *)_scratchpad._data(), &info); } acml::zfft1dx(-1, 1.0, false, _transform_length, (acml::doublecomplex *)in._data(), 1, (acml::doublecomplex *)out._data(), 1, (acml::doublecomplex *)_scratchpad._data(), &info); } void reset() {*this = Transform();} }; template<> class Transform { cvec _scratchpad; int _transform_length; public: Transform(): _transform_length(0) {} void compute_transform(const cvec &in, cvec &out) { int info; out.set_size(in.size(), false); if(_transform_length != in.size()) { _transform_length = in.size(); int min_required_size = 5 * _transform_length + 100; //ACML guides suggest 3*size + 100 here, but ITPP code uses 5. if(_scratchpad.size() < min_required_size) _scratchpad.set_size(min_required_size); acml::zfft1dx(0, 1.0 / _transform_length, false, _transform_length, (acml::doublecomplex *)in._data(), 1, (acml::doublecomplex *)out._data(), 1, (acml::doublecomplex *)_scratchpad._data(), &info); } acml::zfft1dx(1, 1.0 / _transform_length, false, _transform_length, (acml::doublecomplex *)in._data(), 1, (acml::doublecomplex *)out._data(), 1, (acml::doublecomplex *)_scratchpad._data(), &info); } void reset() {*this = Transform();} }; template<> class Transform { vec _scratchpad; int _transform_length; public: Transform(): _transform_length(0) {} void compute_transform(const vec &in, cvec &out) { vec out_re = in; int info; if(_transform_length != in.size()) { _transform_length = in.size(); int min_required_size = 5 * _transform_length + 100; //ACML guides suggest 3*size + 100 here, but ITPP code uses 5. if(_scratchpad.size() < min_required_size) _scratchpad.set_size(min_required_size); acml::dzfft(0, _transform_length, out_re._data(), _scratchpad._data(), &info); } acml::dzfft(1, _transform_length, out_re._data(), _scratchpad._data(), &info); // Normalise output data double factor = std::sqrt(static_cast(_transform_length)); out_re *= factor; // Convert the real Hermitian DZFFT's output to the Matlab's complex form vec out_im(_transform_length); out_im(0) = 0.0; if(!(_transform_length % 2)) out_im(_transform_length / 2) = 0.0; //even transform length out_im.set_subvector(1, reverse(out_re(_transform_length / 2 + 1, _transform_length - 1))); out_im.set_subvector(_transform_length / 2 + 1, -out_re(_transform_length / 2 + 1, _transform_length - 1)); out_re.set_subvector(_transform_length / 2 + 1, reverse(out_re(1, (_transform_length - 1) / 2))); out.set_size(_transform_length, false); out = to_cvec(out_re, out_im); } void reset() {*this = Transform();} }; template<> class Transform { vec _scratchpad; int _transform_length; public: Transform(): _transform_length(0) {} void compute_transform(const cvec &in, vec &out) { // Convert Matlab's complex input to the real Hermitian form out.set_size(in.size()); out.set_subvector(0, real(in(0, in.size() / 2))); out.set_subvector(in.size() / 2 + 1, -imag(in(in.size() / 2 + 1, in.size() - 1))); int info; if(_transform_length != in.size()) { _transform_length = in.size(); int min_required_size = 5 * _transform_length + 100; //ACML guides suggest 3*size + 100 here, but ITPP code uses 5. if(_scratchpad.size() < min_required_size) _scratchpad.set_size(min_required_size); acml::zdfft(0, _transform_length, out._data(), _scratchpad._data(), &info); } acml::zdfft(1, _transform_length, out._data(), _scratchpad._data(), &info); out.set_subvector(1, reverse(out(1, _transform_length - 1))); // Normalise output data double factor = 1.0 / std::sqrt(static_cast(_transform_length)); out *= factor; } void reset() {*this = Transform();} }; #endif // defined(HAVE_FFT_ACML) #if defined(HAVE_FFTW3) //FFTW3-specific implementations //FFTW3-related notes: //Based on the FFtW3 documentation, it is thread-safe to call fftw_execute family functions simultaniously from several threads assuming that data sets are different in each thread. //FFTW plans creation-destruction is not thread-safe and should be serialized by the caller. FFTW provides some functions to execute transforms with multiple threads (assuming FFTW // is compiled and linked with multithreading support). Current ITPP implementation does not use any of them. template<> inline void init_fft_library() {} //assume no actions required. template<> inline void init_fft_library() {} //define global lock for operations with FFTW plans. Mutex& get_library_lock() { static Mutex FFTW3LibraryLock; return FFTW3LibraryLock; } //--------------------------------------------------------------------------- // FFT/IFFT based on FFTW //--------------------------------------------------------------------------- inline void destroy_plan(fftw_plan p) { if(p != NULL) fftw_destroy_plan(p); // destroy the plan } template<> class Transform { fftw_plan _p; int _transform_length; public: Transform(): _p(NULL), _transform_length(0) {} void compute_transform(const cvec &in, cvec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { Lock l(get_library_lock()); //apply global library lock on plan changes _transform_length = in.size(); destroy_plan(_p); // destroy the previous plan // create a new plan (creation of plan guarantees not to return NULL) _p = fftw_plan_dft_1d(_transform_length, (fftw_complex *)in._data(), (fftw_complex *)out._data(), FFTW_FORWARD, FFTW_ESTIMATE); } //compute FFT using the GURU FFTW interface fftw_execute_dft(_p, (fftw_complex *)in._data(), (fftw_complex *)out._data()); } void reset() {destroy_plan(_p); *this = Transform();} }; template<> class Transform { fftw_plan _p; int _transform_length; public: Transform(): _p(NULL), _transform_length(0) {} void compute_transform(const cvec &in, cvec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { Lock l(get_library_lock()); //apply global library lock on plan changes _transform_length = in.size(); destroy_plan(_p); // destroy the previous plan // create a new plan (creation of plan guarantees not to return NULL) _p = fftw_plan_dft_1d(_transform_length, (fftw_complex *)in._data(), (fftw_complex *)out._data(), FFTW_BACKWARD, FFTW_ESTIMATE); } //compute FFT using the GURU FFTW interface fftw_execute_dft(_p, (fftw_complex *)in._data(), (fftw_complex *)out._data()); // scale output double inv_N = 1.0 / _transform_length; out *= inv_N; } void reset() {destroy_plan(_p); *this = Transform();} }; template<> class Transform { fftw_plan _p; int _transform_length; public: Transform(): _p(NULL), _transform_length(0) {} void compute_transform(const vec &in, cvec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { Lock l(get_library_lock()); //apply global library lock on plan changes _transform_length = in.size(); destroy_plan(_p); // destroy the previous plan // create a new plan (creation of plan guarantees not to return NULL) _p = fftw_plan_dft_r2c_1d(_transform_length, (double *)in._data(), (fftw_complex *)out._data(), FFTW_ESTIMATE); } //compute FFT using the GURU FFTW interface fftw_execute_dft_r2c(_p, (double *)in._data(), (fftw_complex *)out._data()); // Real FFT does not compute the 2nd half of the FFT points because it // is redundant to the 1st half. However, we want all of the data so we // fill it in. This is consistent with Matlab's functionality int offset = ceil_i(_transform_length / 2.0); int n_elem = _transform_length - offset; for(int i = 0; i < n_elem; ++i) { out(offset + i) = std::conj(out(n_elem - i)); } } void reset() {destroy_plan(_p); *this = Transform();} }; template<> class Transform { fftw_plan _p; int _transform_length; public: Transform(): _p(NULL), _transform_length(0) {} void compute_transform(const cvec &in, vec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { Lock l(get_library_lock()); //apply global library lock on plan changes _transform_length = in.size(); destroy_plan(_p); // destroy the previous plan // create a new plan (creation of plan guarantees not to return NULL) _p = fftw_plan_dft_c2r_1d(_transform_length, (fftw_complex *)in._data(), (double *)out._data(), FFTW_ESTIMATE | FFTW_PRESERVE_INPUT); } //compute FFT using the GURU FFTW interface fftw_execute_dft_c2r(_p, (fftw_complex *)in._data(), (double *)out._data()); // scale output double inv_N = 1.0 / _transform_length; out *= inv_N; } void reset() {destroy_plan(_p); *this = Transform();} }; //--------------------------------------------------------------------------- // DCT/IDCT based on FFTW //--------------------------------------------------------------------------- template<> class Transform { fftw_plan _p; int _transform_length; public: Transform(): _p(NULL), _transform_length(0) {} void compute_transform(const vec &in, vec &out) { out.set_size(in.size(), false); if(_transform_length != in.size()) { Lock l(get_library_lock()); //apply global library lock on plan changes _transform_length = in.size(); destroy_plan(_p); // destroy the previous plan // create a new plan (creation of plan guarantees not to return NULL) _p = fftw_plan_r2r_1d(_transform_length, (double *)in._data(), (double *)out._data(), FFTW_REDFT10, FFTW_ESTIMATE); } // compute FFT using the GURU FFTW interface fftw_execute_r2r(_p, (double *)in._data(), (double *)out._data()); // Scale to matlab definition format out /= std::sqrt(2.0 * _transform_length); out(0) /= std::sqrt(2.0); } void reset() {destroy_plan(_p); *this = Transform();} }; template<> class Transform { fftw_plan _p; int _transform_length; public: Transform(): _p(NULL), _transform_length(0) {} void compute_transform(const vec &in, vec &out) { out = in; // Rescale to FFTW format out(0) *= std::sqrt(2.0); out /= std::sqrt(2.0 * in.size()); if(_transform_length != in.size()) { Lock l(get_library_lock()); //apply global library lock on plan changes _transform_length = in.size(); destroy_plan(_p); // destroy the previous plan // create a new plan (creation of plan guarantees not to return NULL) _p = fftw_plan_r2r_1d(_transform_length, (double *)in._data(), (double *)out._data(), FFTW_REDFT01, FFTW_ESTIMATE); } // compute FFT using the GURU FFTW interface fftw_execute_r2r(_p, (double *)out._data(), (double *)out._data()); } void reset() {destroy_plan(_p); *this = Transform();} }; #endif // defined(HAVE_FFTW3) #if defined(HAVE_FFT_MKL) || defined(HAVE_FFT_ACML) //--------------------------------------------------------------------------- // DCT/IDCT based on MKL or ACML //--------------------------------------------------------------------------- //use FFT on real values to perform DCT template<> class Transform { Transform _tr; public: Transform() {} void compute_transform(const vec &in, vec &out) { int N = in.size(); if(N == 1) out = in; else { cvec c; _tr.compute_transform(concat(in, reverse(in)), c); c.set_size(N, true); for(int i = 0; i < N; i++) { c(i) *= std::complex(std::cos(pi * i / N / 2), std::sin(-pi * i / N / 2)) / std::sqrt(2.0 * N); } out = real(c); out(0) /= std::sqrt(2.0); } } void reset() {_tr.reset();} }; //use IFFT with real output to perform IDCT template<> class Transform { Transform _tr; public: Transform() {} void compute_transform(const vec &in, vec &out) { int N = in.size(); if(N == 1) out = in; else { cvec c = to_cvec(in); c.set_size(2 * N, true); c(0) *= std::sqrt(2.0); for(int i = 0; i < N; i++) { c(i) *= std::complex(std::cos(pi * i / N / 2), std::sin(pi * i / N / 2)) * std::sqrt(2.0 * N); } for(int i = N - 1; i >= 1; i--) { c(c.size() - i) = c(i) * std::complex(std::cos(pi * i / N), std::sin(-pi * i / N)); } _tr.compute_transform(c, out); out.set_size(N, true); } } void reset() {_tr.reset();} }; #endif #if defined(HAVE_FFT) //lock-protected transform to serialize accesses to the context from several threads template class Locked_Transform : private Transform { typedef Transform Base; Mutex _m; public: Locked_Transform() {} //release context void release_context() {Lock l(_m); Base::reset();} void run_transform(const typename TransformTraits::InType& in, typename TransformTraits::OutType& out) {Lock l(_m); Base::compute_transform(in, out);} }; //Typical multithreaded application creates several threads upon entry to parallel region and join them upon exit from it. //Threads used to perform parallel computations can either be terminated upon exit from the parallel region or left in the //parked state, so in the next parallel region application can reuse already created threads from the team instead of the //time-consuming creation of new threads. There is no way to control threads creation-destruction with OMP and, therefore //there is no way to implement automatic clean-up of transform computation contexts for each thread (basically, this means that //we can not appropriately release FFT library resources and this results in memory leak) //In order to solve this problem and implement the FFT transforms in multithreded environment library relyes on the statically //created pool of transform contexts. //Each thread willing to run the transfrom queries the context index from transfrom provider. Thread uses assigned index and //corresponding context to compute the transforms during it's lifetime. Provider assigns contexts in round-robbin fashion, so //context used by the exited threads are reused by newly created ones. //Single context can be reused by multiple threads if application created more then contexts_per_transform_type threads performing //some type of transform. static bool is_library_initialized = false; template class Transform_Provider { typedef Locked_Transform Transform; Transform _transforms[contexts_per_transform_type]; int _id; public: Transform_Provider(): _id(0) { if(!is_library_initialized) { //initialize FFT library on first conctruction of any of Transform_Provider objects init_fft_library(); is_library_initialized = true; } } int get_context_id() { //assign id in round-robin fashion. int ret = _id + 1; if(ret == contexts_per_transform_type) _id = 0; else _id = ret; return ret; } void run_transform(int id, const typename TransformTraits::InType& in, typename TransformTraits::OutType& out) { _transforms[id - 1].run_transform(in, out); } //provider destructor. releases context resources. //destructor is called after the main() exits, so there is no need to protect context release with mutex ~Transform_Provider() { for(int i = 0; i < contexts_per_transform_type; ++i) _transforms[i].release_context(); } }; //Transform_Provider is constructed upon the first request template Transform_Provider& get_transform_provider() { static Transform_Provider p; return p; } void fft(const cvec &in, cvec &out) { static int context_id = 0; #pragma omp threadprivate(context_id) if(context_id == 0) { //first-time transform call #pragma omp critical { //serialize access to transform provider to get the id context_id = get_transform_provider().get_context_id(); } } it_assert(in.size() > 0, "fft(): zero-sized input detected"); //there is no need to serialize here, since provider is constructed at this point get_transform_provider().run_transform(context_id, in, out); } void ifft(const cvec &in, cvec &out) { static int context_id = 0; #pragma omp threadprivate(context_id) if(context_id == 0) { //first-time transform call #pragma omp critical { //serialize access to transform provider to get the id context_id = get_transform_provider().get_context_id(); } } it_assert(in.size() > 0, "ifft(): zero-sized input detected"); //there is no need to serialize here, since provider is constructed at this point get_transform_provider().run_transform(context_id, in, out); } void fft_real(const vec &in, cvec &out) { static int context_id = 0; #pragma omp threadprivate(context_id) if(context_id == 0) { //first-time transform call #pragma omp critical { //serialize access to transform provider to get the id context_id = get_transform_provider().get_context_id(); } } it_assert(in.size() > 0, "fft_real(): zero-sized input detected"); //there is no need to serialize here, since provider is constructed at this point get_transform_provider().run_transform(context_id, in, out); } void ifft_real(const cvec &in, vec &out) { static int context_id = 0; #pragma omp threadprivate(context_id) if(context_id == 0) { //first-time transform call #pragma omp critical { //serialize access to transform provider to get the id context_id = get_transform_provider().get_context_id(); } } it_assert(in.size() > 0, "ifft_real(): zero-sized input detected"); //there is no need to serialize here, since provider is constructed at this point get_transform_provider().run_transform(context_id, in, out); } void dct(const vec &in, vec &out) { static int context_id = 0; #pragma omp threadprivate(context_id) if(context_id == 0) { //first-time transform call #pragma omp critical { //serialize access to transform provider to get the id context_id = get_transform_provider().get_context_id(); } } it_assert(in.size() > 0, "dct(): zero-sized input detected"); //there is no need to serialize here, since provider is definitely constructed at this point get_transform_provider().run_transform(context_id, in, out); } void idct(const vec &in, vec &out) { static int context_id = 0; #pragma omp threadprivate(context_id) if(context_id == 0) { //first-time transform call #pragma omp critical { //serialize access to transform provider to get the id context_id = get_transform_provider().get_context_id(); } } it_assert(in.size() > 0, "dct(): zero-sized input detected"); //there is no need to serialize here, since provider is definitely constructed at this point get_transform_provider().run_transform(context_id, in, out); } bool have_fourier_transforms() {return true;} bool have_cosine_transforms() {return true;} #else void fft(const cvec &in, cvec &out) { it_error("FFT library is needed to use fft() function"); } void ifft(const cvec &in, cvec &out) { it_error("FFT library is needed to use ifft() function"); } void fft_real(const vec &in, cvec &out) { it_error("FFT library is needed to use fft_real() function"); } void ifft_real(const cvec &in, vec & out) { it_error("FFT library is needed to use ifft_real() function"); } void dct(const vec &in, vec &out) { it_error("FFT library is needed to use dct() function"); } void idct(const vec &in, vec &out) { it_error("FFT library is needed to use idct() function"); } bool have_fourier_transforms() {return false;} bool have_cosine_transforms() {return false;} #endif // defined(HAVE_FFT) cvec fft(const cvec &in) { cvec out; fft(in, out); return out; } cvec fft(const cvec &in, const int N) { cvec in2 = in; cvec out; in2.set_size(N, true); fft(in2, out); return out; } cvec ifft(const cvec &in) { cvec out; ifft(in, out); return out; } cvec ifft(const cvec &in, const int N) { cvec in2 = in; cvec out; in2.set_size(N, true); ifft(in2, out); return out; } cvec fft_real(const vec& in) { cvec out; fft_real(in, out); return out; } cvec fft_real(const vec& in, const int N) { vec in2 = in; cvec out; in2.set_size(N, true); fft_real(in2, out); return out; } vec ifft_real(const cvec &in) { vec out; ifft_real(in, out); return out; } vec ifft_real(const cvec &in, const int N) { cvec in2 = in; in2.set_size(N, true); vec out; ifft_real(in2, out); return out; } vec dct(const vec &in) { vec out; dct(in, out); return out; } vec dct(const vec &in, const int N) { vec in2 = in; vec out; in2.set_size(N, true); dct(in2, out); return out; } vec idct(const vec &in) { vec out; idct(in, out); return out; } vec idct(const vec &in, const int N) { vec in2 = in; vec out; in2.set_size(N, true); idct(in2, out); return out; } // ---------------------------------------------------------------------- // Instantiation // ---------------------------------------------------------------------- template ITPP_EXPORT vec dht(const vec &v); template ITPP_EXPORT cvec dht(const cvec &v); template ITPP_EXPORT void dht(const vec &vin, vec &vout); template ITPP_EXPORT void dht(const cvec &vin, cvec &vout); template ITPP_EXPORT void self_dht(vec &v); template ITPP_EXPORT void self_dht(cvec &v); template ITPP_EXPORT vec dwht(const vec &v); template ITPP_EXPORT cvec dwht(const cvec &v); template ITPP_EXPORT void dwht(const vec &vin, vec &vout); template ITPP_EXPORT void dwht(const cvec &vin, cvec &vout); template ITPP_EXPORT void self_dwht(vec &v); template ITPP_EXPORT void self_dwht(cvec &v); template ITPP_EXPORT mat dht2(const mat &m); template ITPP_EXPORT cmat dht2(const cmat &m); template ITPP_EXPORT mat dwht2(const mat &m); template ITPP_EXPORT cmat dwht2(const cmat &m); } // namespace itpp //! \endcond itpp-4.3.1/itpp/signal/transforms.h000066400000000000000000000315031216575753400173140ustar00rootroot00000000000000/*! * \file * \brief Fourier, Hadamard, Walsh-Hadamard, and 2D Hadamard transforms - * header file * \author Tony Ottosson, Thomas Eriksson, Simon Wood, Adam Piatyszek, Andy Panov and Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef TRANSFORMS_H #define TRANSFORMS_H #include #include #include #include namespace itpp { /*! \addtogroup fft \brief One dimensional fast fourier transform \author Tony Ottosson and Adam Piatyszek The functions \code X = fft(x) \endcode and \code x = ifft(X) \endcode are the fourier and inverse fourier transforms of size \a N defined as: \f[ X(k) = \sum_{j=0}^{N-1} x(j) e^{-2\pi j k \cdot i / N} \f] \f[ x(j) = \frac{1}{N} \sum_{k=0}^{N-1} X(k) e^{2\pi j k \cdot i / N} \f] \code Y = fft(X, N) \endcode performs zero-padding up to size N and then performs an N-size fft. The implementation is built upon one of the following libraries: - FFTW (version 3.0.0 or higher) - MKL (version 8.0.0 or higher) - ACML (version 2.5.3 or higher). \note FFTW-based implementation is the fastest for powers of two. Furthermore, the second time you call the routine with the same size, the calculation is much faster due to many things were calculated and stored the first time the routine was called. \note Achieving maximum runtime efficiency with the FFTW library on some computer architectures requires that data are stored in the memory with a special alignment (to 16-byte boundaries). The IT++ memory management functions and container classes do not generally allocate memory aligned this way, and as a result calling FFTW via the IT++ interface (i.e. the fft() function) may be slower than using the FFTW library directly. Therefore, FFTW users concerned about maximum possible performance may want to consider the possibility of calling the FFTW library and its memory management/allocation routines directly, bypassing the IT++ storage classes and the fft() interface to FFTW. */ //!\addtogroup fft //!@{ //! Run-time test if library is built with Fast Fourier Transforms enabled ITPP_EXPORT bool have_fourier_transforms(); //! Fast Fourier Transform ITPP_EXPORT void fft(const cvec &in, cvec &out); //! Fast Fourier Transform ITPP_EXPORT cvec fft(const cvec &in); /*! \brief Fast Fourier Transform with zero-padding up to size N First N points of input vector are used to perform the transform if N < length(in). Padding with 0's is performed if N > length(in). */ ITPP_EXPORT cvec fft(const cvec &in, const int N); //! Inverse Fast Fourier Transform ITPP_EXPORT void ifft(const cvec &in, cvec &out); //! Inverse Fast Fourier Transform ITPP_EXPORT cvec ifft(const cvec &in); /*! \brief Inverse Fast Fourier Transform with zero-padding up to size N First N points of input vector are used to perform the transform if N < length(in). Padding with 0's is performed if N > length(in). */ ITPP_EXPORT cvec ifft(const cvec &in, const int N); //! Real Fast Fourier Transform ITPP_EXPORT void fft_real(const vec& in, cvec &out); //! Real Fast Fourier Transform ITPP_EXPORT cvec fft_real(const vec& in); /*! \brief Real Fast Fourier Transform with zero-padding up to size N First N points of input vector are used to perform the transform if N < length(in). Padding with 0's is performed if N > length(in). */ ITPP_EXPORT cvec fft_real(const vec &in, const int N); /*! \brief Inverse Real Fast Fourier Transform. Underlying implementation assumes Hermitian symmetry of the input spectra. Results are unpredictable and depending on the implementation (MKL/ACML/FFTW) if this requirement is not met. */ ITPP_EXPORT void ifft_real(const cvec &in, vec &out); /*! \brief Inverse Real Fast Fourier Transform. Underlying implementation assumes Hermittian symmetry of the input spectra. Results are unpredictable and depending on the implementation (MKL/ACML/FFTW) if this requirement is not met. */ ITPP_EXPORT vec ifft_real(const cvec &in); /*! \brief Inverse Real Fast Fourier Transformon with zero-padding up to size N. First N points of input vector are used to perform the transform if N < length(in). Padding with 0's is performed if N > length(in). Underlying implementation assumes Hermitian symmetry of the input subvector/padded sequence. Results are unpredictable and depending on the implementation (MKL/ACML/FFTW) if this requirement is not met. */ ITPP_EXPORT vec ifft_real(const cvec &in, const int N); //!@} /*! \addtogroup dct \brief One dimensional Dicrete Cosine Transform \author Tony Ottosson and Adam Piatyszek The functions \code X = dct(x) \endcode and \code x = idct(X) \endcode are the dicrete cosine and inverse discrete cosine transforms of size \a N defined as: \f[ X(k) = w(k) \sum_{j=0}^{N-1} x(j) \cos \left(\frac{(2j+1)k \pi}{2N} \right) \f] \f[ x(j) = \sum_{k=0}^{N-1} w(k) X(k) \cos \left(\frac{(2j+1)k \pi}{2N} \right) \f] where \f$w(k) = 1/sqrt{N}\f$ for \f$k=0\f$ and \f$w(k) = sqrt{2/N}\f$ for \f$k\geq 1\f$. The implementation is built upon one of the following libraries: - FFTW (version 3.0.0 or higher) - MKL (version 10.0.0 or higher) - ACML (version 4.4.0 or higher). \note FFTW-based implementation is the fastest for powers of two. Furthermore, the second time you call the routine with the same size, the calculation is much faster due to many things were calculated and stored the first time the routine was called. \note Achieving maximum runtime efficiency with the FFTW library on some computer architectures requires that data are stored in the memory with a special alignment (to 16-byte boundaries). The IT++ memory management functions and container classes do not generally allocate memory aligned this way, and as a result calling FFTW via the IT++ interface (i.e. the dct()/idct() function) may be slower than using the FFTW library directly. Therefore, FFTW users concerned about maximum possible performance may want to consider the possibility of calling the FFTW library and its memory management/allocation routines directly, bypassing the IT++ storage classes and the dct()/idct() interface to FFTW. */ //!\addtogroup dct //!@{ //! Run-time test if library is built with cosine transforms enabled ITPP_EXPORT bool have_cosine_transforms(); //! Discrete Cosine Transform (DCT) ITPP_EXPORT void dct(const vec &in, vec &out); //! Discrete Cosine Transform (DCT) ITPP_EXPORT vec dct(const vec &in); /*! \brief Discrete Cosine Transform (DCT) with zero-padding up to size N First N points of input vector are used to perform the transform if N < length(in). Padding with 0's is performed if N > length(in). */ ITPP_EXPORT vec dct(const vec &in, const int N); //! Inverse Discrete Cosine Transform (IDCT) ITPP_EXPORT void idct(const vec &in, vec &out); //! Inverse Discrete Cosine Transform (IDCT) ITPP_EXPORT vec idct(const vec &in); /*! \brief Inverse Discrete Cosine Transform (IDCT) with zero-padding up to size N First N points of input vector are used to perform the transform if N < length(in). Padding with 0's is performed if N > length(in). */ ITPP_EXPORT vec idct(const vec &in, const int N); //!@} //!\addtogroup fht //!@{ //! Fast Hadamard Transform template Vec dht(const Vec &v); //! Fast Hadamard Transform template void dht(const Vec &vin, Vec &vout); //! Fast Hadamard Transform - memory efficient. Stores the result in \c v template void self_dht(Vec &v); //! Fast Walsh Hadamard Transform template Vec dwht(const Vec &v); //! Fast Walsh Hadamard Transform template void dwht(const Vec &vin, Vec &vout); //! Fast Walsh Hadamard Transform - memory efficient (result in \c v) template void self_dwht(Vec &v); //! Fast 2D Hadamard Transform template Mat dht2(const Mat &m); //! Fast 2D Walsh Hadamard Transform template Mat dwht2(const Mat &m); //!@} template Vec dht(const Vec &v) { Vec ret(v.size()); dht(v, ret); return ret; } //! Bit reverse template void bitrv(Vec &out) { int N = out.size(); int j = 0; int N1 = N - 1; for(int i = 0; i < N1; ++i) { if(i < j) { T temp = out[j]; out[j] = out[i]; out[i] = temp; } int K = N / 2; while(K <= j) { j -= K; K /= 2; } j += K; } } template void dht(const Vec &vin, Vec &vout) { int N = vin.size(); int m = levels2bits(N); it_assert_debug((1 << m) == N, "dht(): The vector size must be a power of two"); vout.set_size(N); // This step is separated because it copies vin to vout for(int ib = 0; ib < N; ib += 2) { vout(ib) = vin(ib) + vin(ib + 1); vout(ib + 1) = vin(ib) - vin(ib + 1); } N /= 2; int l = 2; for(int i = 1; i < m; ++i) { N /= 2; int ib = 0; for(int k = 0; k < N; ++k) { for(int j = 0; j < l; ++j) { T t = vout(ib + j); vout(ib + j) += vout(ib + j + l); vout(ib + j + l) = t - vout(ib + j + l); } ib += 2 * l; } l *= 2; } vout /= static_cast(std::sqrt(static_cast(vin.size()))); } template void self_dht(Vec &v) { int N = v.size(); int m = levels2bits(N); it_assert_debug((1 << m) == N, "self_dht(): The vector size must be a power " "of two"); int l = 1; for(int i = 0; i < m; ++i) { N /= 2; int ib = 0; for(int k = 0; k < N; ++k) { for(int j = 0; j < l; ++j) { T t = v(ib + j); v(ib + j) += v(ib + j + l); v(ib + j + l) = t - v(ib + j + l); } ib += 2 * l; } l *= 2; } v /= static_cast(std::sqrt(static_cast(v.size()))); } template Vec dwht(const Vec &v) { Vec ret(v.size()); dwht(v, ret); return ret; } template void dwht(const Vec &vin, Vec &vout) { dht(vin, vout); bitrv(vout); } template void self_dwht(Vec &v) { self_dht(v); bitrv(v); } template Mat dht2(const Mat &m) { Mat ret(m.rows(), m.cols()); Vec v; for(int i = 0; i < m.rows(); ++i) { v = m.get_row(i); self_dht(v); ret.set_row(i, v); } for(int i = 0; i < m.cols(); ++i) { v = ret.get_col(i); self_dht(v); ret.set_col(i, v); } return transpose(ret); } template Mat dwht2(const Mat &m) { Mat ret(m.rows(), m.cols()); Vec v; for(int i = 0; i < m.rows(); ++i) { v = m.get_row(i); self_dwht(v); ret.set_row(i, v); } for(int i = 0; i < m.cols(); ++i) { v = ret.get_col(i); self_dwht(v); ret.set_col(i, v); } return transpose(ret); } //! \cond // ---------------------------------------------------------------------- // Instantiations // ---------------------------------------------------------------------- ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec dht(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec dht(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void dht(const vec &vin, vec &vout); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void dht(const cvec &vin, cvec &vout); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void self_dht(vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void self_dht(cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT vec dwht(const vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cvec dwht(const cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void dwht(const vec &vin, vec &vout); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void dwht(const cvec &vin, cvec &vout); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void self_dwht(vec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT void self_dwht(cvec &v); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat dht2(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat dht2(const cmat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT mat dwht2(const mat &m); ITPP_EXPORT_TEMPLATE template ITPP_EXPORT cmat dwht2(const cmat &m); //! \endcond } // namespace itpp #endif // #ifndef TRANSFORMS_H itpp-4.3.1/itpp/signal/window.cpp000066400000000000000000000070241216575753400167610ustar00rootroot00000000000000/*! * \file * \brief Implementation of window functions * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger, Adam Piatyszek * and Kumar Appaiah * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include namespace itpp { vec hamming(int n) { vec t(n); if (n == 1) t(0) = 0.08; else for (int i = 0;i < n;i++) t[i] = (0.54 - 0.46 * std::cos(2.0 * pi * i / (n - 1))); return t; } vec hanning(int n) { vec t(n); for (int i = 0;i < n;i++) t(i) = 0.5 * (1.0 - std::cos(2.0 * pi * (i + 1) / (n + 1))); return t; } // matlab version vec hann(int n) { vec t(n); for (int i = 0;i < n;i++) t(i) = 0.5 * (1.0 - std::cos(2.0 * pi * i / (n - 1))); return t; } vec blackman(int n) { vec t(n); for (int i = 0;i < n;i++) t(i) = 0.42 - 0.5 * std::cos(2.0 * pi * i / (n - 1)) + 0.08 * std::cos(4.0 * pi * i / (n - 1)); return t; } vec triang(int n) { vec t(n); if (n % 2) { // Odd for (int i = 0; i < n / 2; i++) t(i) = t(n - i - 1) = 2.0 * (i + 1) / (n + 1); t(n / 2) = 1.0; } else for (int i = 0; i < n / 2; i++) t(i) = t(n - i - 1) = (2.0 * i + 1) / n; return t; } vec sqrt_win(int n) { vec t(n); if (n % 2) { // Odd for (int i = 0; i < n / 2; i++) t(i) = t(n - i - 1) = std::sqrt(2.0 * (i + 1) / (n + 1)); t(n / 2) = 1.0; } else for (int i = 0; i < n / 2; i++) t(i) = t(n - i - 1) = std::sqrt((2.0 * i + 1) / n); return t; } vec chebwin(int n, double at) { it_assert((n > 0), "chebwin(): need a positive order n!"); if (n == 1) { return vec("1"); } at = at < 0 ? -at : at; // compute the parameter beta double beta = std::cosh(::acosh(pow10(at / 20)) / (n - 1)); vec k = (pi / n) * linspace(0, n - 1, n); vec cos_k = cos(k); // find the window's DFT coefficients vec p = cheb(n - 1, beta * cos_k); vec w(n); // the window vector // Appropriate IDFT and filling up depending on even/odd n if (is_even(n)) { w = ifft_real(to_cvec(elem_mult(p, cos_k), elem_mult(p, -sin(k)))); int half_length = n / 2 + 1; w = w.left(half_length) / w(1); w = concat(reverse(w), w.right(n - half_length)); } else { w = ifft_real(to_cvec(p)); int half_length = (n + 1) / 2; w = w.left(half_length) / w(0); w = concat(reverse(w), w.right(n - half_length)); } return w; } } // namespace itpp itpp-4.3.1/itpp/signal/window.h000066400000000000000000000064201216575753400164250ustar00rootroot00000000000000/*! * \file * \brief Definitions of window functions * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger, Adam Piatyszek * and Kumar Appaiah * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef WINDOW_H #define WINDOW_H #include #include namespace itpp { /*! \addtogroup windfunc */ /*!\addtogroup windfunc \brief Windowing functions */ //!@{ /*! \brief Hamming window The \c n size Hamming window is a vector \f$w\f$ where the \f$i\f$th component is \f[ w_i = 0.54 - 0.46 \cos(2\pi i/(n-1)) \f] */ ITPP_EXPORT vec hamming(int size); /*! \brief Hanning window The \c n size Hanning window is a vector \f$w\f$ where the \f$i\f$th component is \f[ w_i = 0.5(1 - \cos(2\pi (i+1)/(n+1)) \f] Observe that this function is not the same as the hann() function which is defined as in matlab. */ ITPP_EXPORT vec hanning(int n); /*! \brief Hanning window compatible with matlab The \c n size Hanning window is a vector \f$w\f$ where the \f$i\f$th component is \f[ w_i = 0.5(1 - \cos(2\pi i/(n-1)) \f] */ ITPP_EXPORT vec hann(int n); /*! \brief Blackman window The \c n size Blackman window is a vector \f$w\f$ where the \f$i\f$th component is \f[ w_i = 0.42 - 0.5\cos(2\pi i/(n-1)) + 0.08\cos(4\pi i/(n-1)) \f] */ ITPP_EXPORT vec blackman(int n); /*! \brief Triangular window The \c n size triangle window is a vector \f$w\f$ where the \f$i\f$th component is \f[ w_i = w_{n-i-1} = \frac{2(i+1)}{n+1} \f] for \c n odd and for \c n even \f[ w_i = w_{n-i-1} = \frac{2i+1}{n} \f] */ ITPP_EXPORT vec triang(int n); /*! \brief Square root window The square-root of the Triangle window. sqrt_win(n) = sqrt(triang(n)) */ ITPP_EXPORT vec sqrt_win(int n); /*! \brief Dolph-Chebyshev window The length \c n Dolph-Chebyshev window is a vector \f$w\f$ whose \f$i\f$th transform component is given by \f[ W[k] = \frac{T_M\left(\beta \cos\left(\frac{\pi k}{M}\right) \right)}{T_M(\beta)},k = 0, 1, 2, \ldots, M - 1 \f] where \c T_n(x) is the order \c n Chebyshev polynomial of the first kind. \param n length of the Doplh-Chebyshev window \param at attenutation of side lobe (in dB) \return symmetric length \c n Doplh-Chebyshev window \author Kumar Appaiah and Adam Piatyszek (code review) */ ITPP_EXPORT vec chebwin(int n, double at); //!@} } //namespace itpp #endif // #ifndef WINDOW_H itpp-4.3.1/itpp/sources.mk000066400000000000000000000007741216575753400155120ustar00rootroot00000000000000h_sources = $(top_srcdir)/itpp/itbase.h \ $(top_srcdir)/itpp/itstat.h \ $(top_srcdir)/itpp/itmex.h if ENABLE_COMM h_sources += $(top_srcdir)/itpp/itcomm.h endif if ENABLE_FIXED h_sources += $(top_srcdir)/itpp/itfixed.h endif if ENABLE_OPTIM h_sources += $(top_srcdir)/itpp/itoptim.h endif if ENABLE_PROTOCOL h_sources += $(top_srcdir)/itpp/itprotocol.h endif if ENABLE_SIGNAL h_sources += $(top_srcdir)/itpp/itsignal.h endif if ENABLE_SRCCODE h_sources += $(top_srcdir)/itpp/itsrccode.h endif itpp-4.3.1/itpp/srccode/000077500000000000000000000000001216575753400151105ustar00rootroot00000000000000itpp-4.3.1/itpp/srccode/Makefile.am000066400000000000000000000007561216575753400171540ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libsrccode.la if ENABLE_DEBUG noinst_LTLIBRARIES += libsrccode_debug.la endif libsrccode_la_SOURCES = $(h_srccode_sources) $(cpp_srccode_sources) libsrccode_la_CXXFLAGS = $(CXXFLAGS_OPT) libsrccode_debug_la_SOURCES = $(h_srccode_sources) $(cpp_srccode_sources) libsrccode_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/srccode pkginclude_HEADERS = $(h_srccode_sources) itpp-4.3.1/itpp/srccode/Makefile.in000066400000000000000000001041221216575753400171550ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libsrccode_debug.la subdir = itpp/srccode ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libsrccode_la_LIBADD = am__objects_1 = am__objects_2 = libsrccode_la-audiofile.lo libsrccode_la-gmm.lo \ libsrccode_la-lpcfunc.lo libsrccode_la-pnm.lo \ libsrccode_la-vq.lo libsrccode_la-vqtrain.lo am_libsrccode_la_OBJECTS = $(am__objects_1) $(am__objects_2) libsrccode_la_OBJECTS = $(am_libsrccode_la_OBJECTS) libsrccode_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libsrccode_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libsrccode_debug_la_LIBADD = am__objects_3 = libsrccode_debug_la-audiofile.lo \ libsrccode_debug_la-gmm.lo libsrccode_debug_la-lpcfunc.lo \ libsrccode_debug_la-pnm.lo libsrccode_debug_la-vq.lo \ libsrccode_debug_la-vqtrain.lo am_libsrccode_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libsrccode_debug_la_OBJECTS = $(am_libsrccode_debug_la_OBJECTS) libsrccode_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libsrccode_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libsrccode_la_SOURCES) $(libsrccode_debug_la_SOURCES) DIST_SOURCES = $(libsrccode_la_SOURCES) $(libsrccode_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/srccode ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_srccode_sources = \ $(top_srcdir)/itpp/srccode/audiofile.h \ $(top_srcdir)/itpp/srccode/gmm.h \ $(top_srcdir)/itpp/srccode/lpcfunc.h \ $(top_srcdir)/itpp/srccode/pnm.h \ $(top_srcdir)/itpp/srccode/vq.h \ $(top_srcdir)/itpp/srccode/vqtrain.h cpp_srccode_sources = \ $(top_srcdir)/itpp/srccode/audiofile.cpp \ $(top_srcdir)/itpp/srccode/gmm.cpp \ $(top_srcdir)/itpp/srccode/lpcfunc.cpp \ $(top_srcdir)/itpp/srccode/pnm.cpp \ $(top_srcdir)/itpp/srccode/vq.cpp \ $(top_srcdir)/itpp/srccode/vqtrain.cpp noinst_LTLIBRARIES = libsrccode.la $(am__append_1) libsrccode_la_SOURCES = $(h_srccode_sources) $(cpp_srccode_sources) libsrccode_la_CXXFLAGS = $(CXXFLAGS_OPT) libsrccode_debug_la_SOURCES = $(h_srccode_sources) $(cpp_srccode_sources) libsrccode_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_srccode_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/srccode/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/srccode/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libsrccode.la: $(libsrccode_la_OBJECTS) $(libsrccode_la_DEPENDENCIES) $(libsrccode_la_LINK) $(libsrccode_la_OBJECTS) $(libsrccode_la_LIBADD) $(LIBS) libsrccode_debug.la: $(libsrccode_debug_la_OBJECTS) $(libsrccode_debug_la_DEPENDENCIES) $(libsrccode_debug_la_LINK) $(am_libsrccode_debug_la_rpath) $(libsrccode_debug_la_OBJECTS) $(libsrccode_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_debug_la-audiofile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_debug_la-gmm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_debug_la-lpcfunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_debug_la-pnm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_debug_la-vq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_debug_la-vqtrain.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_la-audiofile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_la-gmm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_la-lpcfunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_la-pnm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_la-vq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsrccode_la-vqtrain.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libsrccode_la-audiofile.lo: $(top_srcdir)/itpp/srccode/audiofile.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_la-audiofile.lo -MD -MP -MF $(DEPDIR)/libsrccode_la-audiofile.Tpo -c -o libsrccode_la-audiofile.lo `test -f '$(top_srcdir)/itpp/srccode/audiofile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/audiofile.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_la-audiofile.Tpo $(DEPDIR)/libsrccode_la-audiofile.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/audiofile.cpp' object='libsrccode_la-audiofile.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_la-audiofile.lo `test -f '$(top_srcdir)/itpp/srccode/audiofile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/audiofile.cpp libsrccode_la-gmm.lo: $(top_srcdir)/itpp/srccode/gmm.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_la-gmm.lo -MD -MP -MF $(DEPDIR)/libsrccode_la-gmm.Tpo -c -o libsrccode_la-gmm.lo `test -f '$(top_srcdir)/itpp/srccode/gmm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/gmm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_la-gmm.Tpo $(DEPDIR)/libsrccode_la-gmm.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/gmm.cpp' object='libsrccode_la-gmm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_la-gmm.lo `test -f '$(top_srcdir)/itpp/srccode/gmm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/gmm.cpp libsrccode_la-lpcfunc.lo: $(top_srcdir)/itpp/srccode/lpcfunc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_la-lpcfunc.lo -MD -MP -MF $(DEPDIR)/libsrccode_la-lpcfunc.Tpo -c -o libsrccode_la-lpcfunc.lo `test -f '$(top_srcdir)/itpp/srccode/lpcfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/lpcfunc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_la-lpcfunc.Tpo $(DEPDIR)/libsrccode_la-lpcfunc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/lpcfunc.cpp' object='libsrccode_la-lpcfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_la-lpcfunc.lo `test -f '$(top_srcdir)/itpp/srccode/lpcfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/lpcfunc.cpp libsrccode_la-pnm.lo: $(top_srcdir)/itpp/srccode/pnm.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_la-pnm.lo -MD -MP -MF $(DEPDIR)/libsrccode_la-pnm.Tpo -c -o libsrccode_la-pnm.lo `test -f '$(top_srcdir)/itpp/srccode/pnm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/pnm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_la-pnm.Tpo $(DEPDIR)/libsrccode_la-pnm.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/pnm.cpp' object='libsrccode_la-pnm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_la-pnm.lo `test -f '$(top_srcdir)/itpp/srccode/pnm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/pnm.cpp libsrccode_la-vq.lo: $(top_srcdir)/itpp/srccode/vq.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_la-vq.lo -MD -MP -MF $(DEPDIR)/libsrccode_la-vq.Tpo -c -o libsrccode_la-vq.lo `test -f '$(top_srcdir)/itpp/srccode/vq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vq.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_la-vq.Tpo $(DEPDIR)/libsrccode_la-vq.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/vq.cpp' object='libsrccode_la-vq.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_la-vq.lo `test -f '$(top_srcdir)/itpp/srccode/vq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vq.cpp libsrccode_la-vqtrain.lo: $(top_srcdir)/itpp/srccode/vqtrain.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_la-vqtrain.lo -MD -MP -MF $(DEPDIR)/libsrccode_la-vqtrain.Tpo -c -o libsrccode_la-vqtrain.lo `test -f '$(top_srcdir)/itpp/srccode/vqtrain.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vqtrain.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_la-vqtrain.Tpo $(DEPDIR)/libsrccode_la-vqtrain.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/vqtrain.cpp' object='libsrccode_la-vqtrain.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_la-vqtrain.lo `test -f '$(top_srcdir)/itpp/srccode/vqtrain.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vqtrain.cpp libsrccode_debug_la-audiofile.lo: $(top_srcdir)/itpp/srccode/audiofile.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_debug_la-audiofile.lo -MD -MP -MF $(DEPDIR)/libsrccode_debug_la-audiofile.Tpo -c -o libsrccode_debug_la-audiofile.lo `test -f '$(top_srcdir)/itpp/srccode/audiofile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/audiofile.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_debug_la-audiofile.Tpo $(DEPDIR)/libsrccode_debug_la-audiofile.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/audiofile.cpp' object='libsrccode_debug_la-audiofile.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_debug_la-audiofile.lo `test -f '$(top_srcdir)/itpp/srccode/audiofile.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/audiofile.cpp libsrccode_debug_la-gmm.lo: $(top_srcdir)/itpp/srccode/gmm.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_debug_la-gmm.lo -MD -MP -MF $(DEPDIR)/libsrccode_debug_la-gmm.Tpo -c -o libsrccode_debug_la-gmm.lo `test -f '$(top_srcdir)/itpp/srccode/gmm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/gmm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_debug_la-gmm.Tpo $(DEPDIR)/libsrccode_debug_la-gmm.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/gmm.cpp' object='libsrccode_debug_la-gmm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_debug_la-gmm.lo `test -f '$(top_srcdir)/itpp/srccode/gmm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/gmm.cpp libsrccode_debug_la-lpcfunc.lo: $(top_srcdir)/itpp/srccode/lpcfunc.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_debug_la-lpcfunc.lo -MD -MP -MF $(DEPDIR)/libsrccode_debug_la-lpcfunc.Tpo -c -o libsrccode_debug_la-lpcfunc.lo `test -f '$(top_srcdir)/itpp/srccode/lpcfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/lpcfunc.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_debug_la-lpcfunc.Tpo $(DEPDIR)/libsrccode_debug_la-lpcfunc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/lpcfunc.cpp' object='libsrccode_debug_la-lpcfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_debug_la-lpcfunc.lo `test -f '$(top_srcdir)/itpp/srccode/lpcfunc.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/lpcfunc.cpp libsrccode_debug_la-pnm.lo: $(top_srcdir)/itpp/srccode/pnm.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_debug_la-pnm.lo -MD -MP -MF $(DEPDIR)/libsrccode_debug_la-pnm.Tpo -c -o libsrccode_debug_la-pnm.lo `test -f '$(top_srcdir)/itpp/srccode/pnm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/pnm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_debug_la-pnm.Tpo $(DEPDIR)/libsrccode_debug_la-pnm.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/pnm.cpp' object='libsrccode_debug_la-pnm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_debug_la-pnm.lo `test -f '$(top_srcdir)/itpp/srccode/pnm.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/pnm.cpp libsrccode_debug_la-vq.lo: $(top_srcdir)/itpp/srccode/vq.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_debug_la-vq.lo -MD -MP -MF $(DEPDIR)/libsrccode_debug_la-vq.Tpo -c -o libsrccode_debug_la-vq.lo `test -f '$(top_srcdir)/itpp/srccode/vq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vq.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_debug_la-vq.Tpo $(DEPDIR)/libsrccode_debug_la-vq.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/vq.cpp' object='libsrccode_debug_la-vq.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_debug_la-vq.lo `test -f '$(top_srcdir)/itpp/srccode/vq.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vq.cpp libsrccode_debug_la-vqtrain.lo: $(top_srcdir)/itpp/srccode/vqtrain.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libsrccode_debug_la-vqtrain.lo -MD -MP -MF $(DEPDIR)/libsrccode_debug_la-vqtrain.Tpo -c -o libsrccode_debug_la-vqtrain.lo `test -f '$(top_srcdir)/itpp/srccode/vqtrain.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vqtrain.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libsrccode_debug_la-vqtrain.Tpo $(DEPDIR)/libsrccode_debug_la-vqtrain.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/srccode/vqtrain.cpp' object='libsrccode_debug_la-vqtrain.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsrccode_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libsrccode_debug_la-vqtrain.lo `test -f '$(top_srcdir)/itpp/srccode/vqtrain.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/srccode/vqtrain.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/srccode/audiofile.cpp000066400000000000000000000571411216575753400175650ustar00rootroot00000000000000/*! * \file * \brief Implementation of audio Audio classes and functions * \author Tobias Ringstrom, Adam Piatyszek and Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include //! \cond namespace itpp { //magic id of snd file header static const uint32_t snd_magic = 0x2e736e64; //maximum length of annotation to extract from snd file static const std::size_t max_annotation_length = 1024; ////////////////////////////////////////////////// // // Audio_Samples_Reader - templated implementation of Audio_Samples_Reader_If // ////////////////////////////////////////////////// template class Audio_Samples_Reader : public audiofile_details::Audio_Samples_Reader_If { public: Audio_Samples_Reader(Binary_In_Stream& str, std::streamoff start, int nc): _str(str), _start_pos(start), _num_channels(nc), _cur_pos(0){} bool read_sample(double& s, int ch); //Read n samples from audio channel ch vec read_channel(int n, int ch); mat read(int n); virtual std::streamoff tell() const; virtual bool seek(std::streamoff n); virtual std::streamoff num_samples(); private: static const std::size_t sample_size = Audio_Sample::enc_sample_size; typedef typename Audio_Sample::enc_sample_type sample_type; //Number of audio channels int _num_channels; //! First sample offset from the start of the file std::streamoff _start_pos; //! Current position in samples std::streamoff _cur_pos; //! Binary stream Binary_In_Stream& _str; }; template std::streamoff Audio_Samples_Reader::tell() const { return _cur_pos; } template bool Audio_Samples_Reader::seek(std::streamoff n) { _str.seekg(_start_pos + (_cur_pos * _num_channels *sample_size), std::ios_base::beg); if(_str){ _cur_pos = n; return true; } else{ return false; } } template std::streamoff Audio_Samples_Reader::num_samples() { _str.seekg(0, std::ios_base::end); if(!_str) return -1; std::streamoff end_pos = _str.tellg(); return (end_pos - _start_pos)/(_num_channels * sample_size); } //read single channel samples starting at current position template bool Audio_Samples_Reader::read_sample(double& s, int ch) { if(ch >= _num_channels) return false; std::streamoff read_pos = _start_pos + (_cur_pos * _num_channels + ch )*sample_size; _str.seekg(read_pos, std::ios_base::beg); if(!_str) return false; sample_type raw_sample; _str >> raw_sample; if(_str){ s = Audio_Sample::decode(raw_sample); _cur_pos++; return true; } return false; } //read n samples from channel ch starting at current position template vec Audio_Samples_Reader::read_channel(int n, int ch) { //ignore threshold - ignore() is used instead of seekg() //if stride between samples is smaller then this threshold static const std::streamsize ignore_threshold = 64; if((n <= 0) || (ch >= _num_channels)) return vec(); vec ret(n); //read first n-1 samples const std::streamsize stride = sample_size*(_num_channels - 1); _str.seekg(_start_pos + (_cur_pos *_num_channels + ch) * sample_size, std::ios_base::beg); for(int i = 0; (i < (n-1)) && _str; ++i) { sample_type raw_sample; _str >> raw_sample; ret(i) = Audio_Sample::decode(raw_sample); if(stride > ignore_threshold) _str.seekg(stride, std::ios_base::cur); else _str.ignore(stride); } //read last sample if(_str){ sample_type raw_sample; _str >> raw_sample; ret(n-1) = Audio_Sample::decode(raw_sample); } if(_str){ _cur_pos += n; } else{ ret.set_size(0); } return ret; } //read n samples from all channels starting at current position template mat Audio_Samples_Reader::read(int n) { if(n <= 0) return mat(); mat ret(n,_num_channels); //read samples const std::streamsize stride = sample_size*(_num_channels - 1); _str.seekg(_start_pos + _cur_pos * sample_size *_num_channels, std::ios_base::beg); for(int i = 0; (i < n) && _str; ++i) { for(int j = 0; j < _num_channels && _str; ++j) { sample_type raw_sample; _str >> raw_sample; ret(i,j) = Audio_Sample::decode(raw_sample); } } if(_str){ _cur_pos += n; } else{ ret.set_size(0,0); } return ret; } //make audio samples reader to input data from stream template audiofile_details::Audio_Samples_Reader_If* make_reader(Binary_In_Stream& str, std::streamoff start_pos, Audio_Stream_Description* d) { Audio_Encoding encoding = d->get_encoding(); int num_channels = d->get_num_channels(); switch(encoding){ case enc_mulaw8: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_alaw8: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_linear8: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_linear16: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_linear24: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_linear32: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_float: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_double: return new Audio_Samples_Reader(str,start_pos,num_channels); case enc_unknown: default: return 0; } } ////////////////////////////////////////////////// // // Audio_Samples_Writer - templated implementation of Audio_Samples_Writer_If // ////////////////////////////////////////////////// template class Audio_Samples_Writer : public audiofile_details::Audio_Samples_Writer_If { public: Audio_Samples_Writer(Binary_Out_Stream& str, std::streamoff start, int nc): _str(str), _start_pos(start), _num_channels(nc), _cur_pos(0), _zero(Audio_Sample::encode(0.0)){} virtual bool write_sample(const double& s, int ch); virtual bool write_channel(const vec& s, int ch); //Write n samples to audio channel ch virtual bool write(const mat& s); virtual std::streamoff tell() const; virtual bool seek(std::streamoff n); virtual std::streamoff num_samples(); private: static const std::size_t sample_size = Audio_Sample::enc_sample_size; typedef typename Audio_Sample::enc_sample_type sample_type; //Number of audio channels int _num_channels; //! First sample offset from the start of the file std::streamoff _start_pos; //! Current position in samples std::streamoff _cur_pos; //! Binary stream Binary_Out_Stream& _str; //Zero sample sample_type _zero; }; template std::streamoff Audio_Samples_Writer::tell() const { return _cur_pos; } template bool Audio_Samples_Writer::seek(std::streamoff n) { _str.seekp(_start_pos + (n * _num_channels *sample_size), std::ios_base::beg); if(_str){ _cur_pos = n; return true; } else{ return false; } } template std::streamoff Audio_Samples_Writer::num_samples() { _str.seekp(0, std::ios_base::end); if(!_str) return -1; std::streamoff end_pos = _str.tellp(); return (end_pos - _start_pos)/(_num_channels * sample_size); } //write single sample starting at current position template bool Audio_Samples_Writer::write_sample(const double& s, int ch) { if(ch >= _num_channels) return false; std::streamoff write_pos = _start_pos + (_cur_pos * _num_channels + ch )*sample_size; _str.seekp(write_pos, std::ios_base::beg); if(!_str) return false; _str << Audio_Sample::encode(s); if(_str){ _cur_pos++; return true; } return false; } //write single channel samples starting at current position template bool Audio_Samples_Writer::write_channel(const vec& s, int ch) { if(ch >= _num_channels) return false; int len = s.length(); //overall number of already written samples std::streamoff ns = num_samples(); if(ns < 0) return false; //compute number of samples to overwrite and number of samples to add to the end of file int to_overwrite = (int)std::min(ns - _cur_pos, (std::streamoff)len); const std::streamoff stride = sample_size*(_num_channels - 1); int i = 0; //overwrite samples if(to_overwrite) { //process first to_overwrite-1 samples _str.seekp(_start_pos + (_cur_pos * _num_channels + ch )*sample_size, std::ios_base::beg); for(i = 0; (i < (to_overwrite-1)) && _str; ++i) { _str << Audio_Sample::encode(s(i)); if(stride) _str.seekp(stride,std::ios_base::cur); } if(_str){ _str << Audio_Sample::encode(s(i)); ++i; } } //add samples to the end of file if(i < len) { _str.seekp(_start_pos + ns * _num_channels * sample_size, std::ios_base::beg); for(; (i < len) && _str; ++i) { for(int j = 0; (j < _num_channels) && _str; ++j){ if(j == ch) _str << Audio_Sample::encode(s(i)); else _str << _zero; } } } if(_str){ _cur_pos += len; return true; } return false; } //write samples starting at current position template bool Audio_Samples_Writer::write(const mat& s) { if(s.cols() < _num_channels) return false; int len = s.rows(); for(int i = 0; (i < len) && _str; ++i){ for(int j = 0; (j < _num_channels) && _str; ++j){ sample_type raw_sample = Audio_Sample::encode(s(i,j)); _str << raw_sample; } } if(_str){ _cur_pos += len; return true; } return false; } //make audio samples writer for stream output template audiofile_details::Audio_Samples_Writer_If* make_writer(Binary_Out_Stream& str, std::streamoff start_pos, Audio_Stream_Description* d) { Audio_Encoding encoding = d->get_encoding(); int num_channels = d->get_num_channels(); switch(encoding){ case enc_mulaw8: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_alaw8: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_linear8: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_linear16: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_linear24: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_linear32: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_float: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_double: return new Audio_Samples_Writer(str,start_pos,num_channels); case enc_unknown: default: return 0; } } ////////////////////////////////////////////////// // // SND Header helpers // ////////////////////////////////////////////////// //snd header consists of 6 uint32_t fixed fields possibly followed //by the variable length annotation static const std::size_t snd_fixed_header_size = 24; //read_header() reads audio stream information from snd file header. //returns true if successfull. //d - pointer to stream description to collect info from snd header //audio_offset - byte offset of first audio sample inside snd file //number of audio samples stored in snd file, num_samples template bool read_header(Binary_In_Stream& _str, Audio_Stream_Description* d, std::streamoff& audio_offset, std::streamoff& num_samples) { //SND header fields uint32_t magic, hdr_size, data_size, encoding, sampling_rate, num_channels; //encoded sample size std::size_t sample_size; //annotation std::string annotation; //read fixed fields of snd file header _str.seekg(0, std::ios_base::beg); _str >> magic >> hdr_size>> data_size>> encoding >> sampling_rate>> num_channels; if(!_str) return false; //check magic if(magic != snd_magic) return false; //invalid magic //check header size (we do not verify divisibility of header size by 8 since we still able to //read unaligned data samples) if(hdr_size < snd_fixed_header_size) return false; //header is too short audio_offset = hdr_size; //check encoding sample_size = encoded_sample_size((Audio_Encoding)encoding); if(!sample_size) return false; //unknown or invalid encoding //read annotation if(hdr_size > snd_fixed_header_size) {//annotation is present //get annotation length std::streamsize ann_length = (std::streamsize)std::min(hdr_size - snd_fixed_header_size, max_annotation_length); for(int i = 0; i < ann_length; ++i){ char s; _str>>s; if(_str && s) annotation += s; else break; } if(!_str) return false; //failed to read annotation } //compute number of audio samples based on the file length _str.seekg(0, std::ios_base::end); if(!_str) return false; //failed to seek to the end std::streamoff ns = ((std::streamoff)_str.tellg() - hdr_size)/(num_channels * sample_size); //update number of samples just read from header if(data_size = 0xffffffff){ //data size was set to unknown in file header, use number of smaples obtained from file length num_samples = ns; } else{ num_samples = std::min((long unsigned int)ns,(std::streamoff)data_size/(num_channels * sample_size)); } //update start position of audio samples audio_offset = hdr_size; //update stream description d->set_encoding((Audio_Encoding) encoding); d->set_num_channels(num_channels); d->set_sampling_rate(sampling_rate); d->set_description(annotation); return true; } //write_header() writes audio stream information to snd file header. //it is assumed that stream description pointed by d is initialized with correct values template bool write_header(Binary_Out_Stream& _str, const Audio_Stream_Description* const d, std::streamoff& audio_offset) { uint32_t hdr_size, data_size, encoding, sampling_rate, num_channels; data_size = 0xffffffff; encoding = (uint32_t)d->get_encoding(); sampling_rate = (uint32_t)d->get_sampling_rate(); num_channels = (uint32_t)d->get_num_channels(); //compute header size based on fixed fields length and length of the annotation uint32_t ann_length = (uint32_t)std::min(d->get_description().length(), max_annotation_length); uint32_t padding_length = (8 - ((ann_length+1) % 8)) % 8; //compute padding length hdr_size = (uint32_t)snd_fixed_header_size + ann_length + padding_length + 1; //position stream pointer at the beginning of the file _str.seekp(0,std::ios_base::beg); if(!_str) return false; //write fixed-sized part of the header _str << snd_magic << hdr_size << data_size << encoding << sampling_rate << num_channels; if(!_str) return false; //write annotationn and padding _str.write(d->get_description().c_str(), ann_length); for(uint32_t i = 0; (i < (padding_length + 1)) && _str; ++i) _str << '\0'; if(!_str) return false; audio_offset = hdr_size; return true; } //update_num_samples_in_header() updates numder of samples in snd file header template bool update_num_samples_in_header(Binary_Out_Stream& _str, const Audio_Stream_Description* const d, std::streamoff num_samples) { uint32_t data_size = (uint32_t) std::min((long unsigned int)(num_samples * d->get_num_channels() * encoded_sample_size(d->get_encoding())), (long unsigned int)0xffffffff); _str.seekp(2*sizeof(uint32_t),std::ios_base::beg); if(!_str) return false; _str << data_size; if(!_str) return false; return true; } ////////////////////////////////////////////////// // // SND_In_File // ////////////////////////////////////////////////// SND_In_File::SND_In_File():_samples_reader(0), _description(new Audio_Stream_Description), _num_samples(0) { } SND_In_File::SND_In_File(const char *fname):_samples_reader(0), _description(new Audio_Stream_Description), _num_samples(0) { open(fname); } bool SND_In_File::open(const char *fname) { //try to reopen the stream if (_str.is_open()) close(); _str.clear(); _str.open(fname, bfstream_base::b_endian); if (!_str) return false; //read header and update description std::streamoff audio_offset; if (!read_header(_str,_description, audio_offset,_num_samples)) { _str.close(); return false; } //create samples reader it_assert(_samples_reader == 0, "SND_In_File::open: samples reader was not deallocated properly."); _samples_reader = make_reader(_str,audio_offset,_description); return true; } void SND_In_File::close() { //close stream if(_str.is_open()) _str.close(); //dispose reader if(_samples_reader){ delete _samples_reader; _samples_reader = 0; } //reset description _num_samples = 0; *_description = Audio_Stream_Description(); } SND_In_File::~SND_In_File() { //close file and dispose description close(); delete _description; } ////////////////////////////////////////////////// // // SND_Out_File // ////////////////////////////////////////////////// SND_Out_File::SND_Out_File():_samples_writer(0), _description(new Audio_Stream_Description), _num_samples(0) { } SND_Out_File::SND_Out_File(const char *fname, const Audio_Stream_Description& d): _samples_writer(0), _description(new Audio_Stream_Description), _num_samples(0) { open(fname, d); } bool SND_Out_File::open(const char *fname, const Audio_Stream_Description& d) { //check if we have a valid description if(!is_valid(d)) return false; //try to reopen the stream if (_str.is_open()) close(); _str.clear(); _str.open(fname, true, bfstream_base::b_endian); if (!_str) return false; //init description and write header *_description = d; std::streamoff audio_offset; if (!write_header(_str, &d, audio_offset)){ _str.close(); return false; } //create samples writer it_assert(_samples_writer == 0, "SND_Out_File::open: samples writer was not deallocated properly."); _samples_writer = make_writer(_str,audio_offset,_description); _num_samples = 0; return true; } void SND_Out_File::close() { //update file header with written samples counter and close the stream if(_str.is_open()){ update_num_samples_in_header(_str,_description,_num_samples); _str.close(); } //dispose samples writer if(_samples_writer){ delete _samples_writer; _samples_writer = 0; } //reset description _num_samples = 0; *_description = Audio_Stream_Description(); } SND_Out_File::~SND_Out_File() { //close file and dispose description close(); delete _description; } ////////////////////////////////////////////////// // // SND_IO_File // ////////////////////////////////////////////////// SND_IO_File::SND_IO_File(): _samples_reader(0), _samples_writer(0), _description(new Audio_Stream_Description), _num_samples(0) { } SND_IO_File::SND_IO_File(const char *fname): _samples_reader(0), _samples_writer(0), _description(new Audio_Stream_Description), _num_samples(0) { open(fname); } SND_IO_File::SND_IO_File(const char *fname, const Audio_Stream_Description& d): _samples_reader(0), _samples_writer(0), _description(new Audio_Stream_Description), _num_samples(0) { open(fname, d); } //open IO file. Pick up information about audio stream from file header bool SND_IO_File::open(const char *fname) { //try to reopen the stream if (_str.is_open()) close(); _str.clear(); _str.open(fname, false, bfstream_base::b_endian); if (!_str) return false; //reader header and update description std::streamoff audio_offset; if (!read_header(_str,_description, audio_offset,_num_samples)) { _str.close(); return false; } //create reader and writer for audio samples it_assert(_samples_reader == 0, "SND_IO_File::open: samples reader was not deallocated properly."); _samples_reader = make_reader(_str,audio_offset,_description); it_assert(_samples_writer == 0, "SND_IO_File::open: samples writer was not deallocated properly."); _samples_writer = make_writer(_str,audio_offset,_description); return true; } //open file for IO with new descrition - truncates file contents bool SND_IO_File::open(const char *fname, const Audio_Stream_Description& d) { //check if provided decription is valid if(!is_valid(d)) return false; //try reopen the stream if (_str.is_open()) close(); _str.clear(); _str.open(fname, true, bfstream_base::b_endian); if (!_str) return false; //init description and write file header *_description = d; std::streamoff audio_offset; if (!write_header(_str, &d, audio_offset)){ _str.close(); return false; } //create reader and writer for audio samples it_assert(_samples_reader == 0, "SND_IO_File::open: samples reader was not deallocated properly."); _samples_reader = make_reader(_str,audio_offset,_description); it_assert(_samples_writer == 0, "SND_IO_File::open: samples writer was not deallocated properly."); _samples_writer = make_writer(_str,audio_offset,_description); _num_samples = 0; return true; } void SND_IO_File::close() { //close the stream and update number of written samples if(_str.is_open()){ update_num_samples_in_header(_str,_description,_num_samples); _str.close(); } //dispose reader and writer of audio samples if(_samples_writer){ delete _samples_writer; _samples_writer = 0; } if(_samples_reader){ delete _samples_reader; _samples_reader = 0; } //reset description _num_samples = 0; *_description = Audio_Stream_Description(); } SND_IO_File::~SND_IO_File() { //close audio file and dispose description close(); delete _description; } } // namespace itpp //! \endcond itpp-4.3.1/itpp/srccode/audiofile.h000066400000000000000000000455121216575753400172310ustar00rootroot00000000000000/*! * \file * \brief Definitions of audio Audio classes and functions * \author Tobias Ringstrom, Adam Piatyszek and Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef AUDIOFILE_H #define AUDIOFILE_H #include #include #include #include #include #include #include namespace itpp { /*! \addtogroup audio \section audiostreams Audio Streams. Audio streams are used to handle audio files in Sun/NeXT format (the .au format). SND file consists of header followed by the audio samples. Number of channels, samples encoding and sampling rate are stored inside the file header. Header can also contain annotation of variable length describing the stream contents. Library provides Audio_Stream_Description class to describe the audio stream and SND_In_File/SND_Out_File/SND_InOut_File classes to support handling of SND files. */ /*! \ingroup audio \brief Description of audio stream. This class holds information about the stream of audio samples. Information includes samples encoding, number of channels and sampling rate. Stream can be annotated via set_description() method. */ class Audio_Stream_Description { public: //! Default ctor - creates uninitialized description Audio_Stream_Description():_encoding(enc_unknown), _sampling_rate(0), _num_channels(0){} //! Construct with stream parameters: encoding \a e, sampling rate \a sr and number of audio channels \a nc Audio_Stream_Description(Audio_Encoding e, int sr, int nc = 1): _encoding(e), _sampling_rate(sr), _num_channels(nc){} //! Set encoding of audio samples Audio_Stream_Description& set_encoding(Audio_Encoding e) {_encoding = e; return *this;} //! Set sampling rate (samples per second) Audio_Stream_Description& set_sampling_rate(int sr) {_sampling_rate = sr; return *this;} //! Set number of audio channels Audio_Stream_Description& set_num_channels(int nc) {_num_channels = nc; return *this;} //! Set stream annotation Audio_Stream_Description& set_description(const std::string& d) {_description = d; return *this;} //! Get encoding of audio samples Audio_Encoding get_encoding() const {return _encoding;} //! Get sampling rate (samples per second) int get_sampling_rate() const {return _sampling_rate;} //! Get number of audio channels int get_num_channels() const {return _num_channels;} //! Get stream annotation const std::string& get_description() const {return _description;} private: //! Encoding of audio samples Audio_Encoding _encoding; //! Sampling rate int _sampling_rate; //! Number of audio channels int _num_channels; //! Stream annotation text std::string _description; }; //! validity check for stream description \a d inline bool is_valid(const Audio_Stream_Description& d) { if(!encoded_sample_size(d.get_encoding())) return false; if(!d.get_num_channels()) return false; return true; } //! \cond namespace audiofile_details{ //abstract interfaces to read and write audio samples to streams class Audio_Samples_Reader_If { public: virtual bool read_sample(double& s, int ch) = 0; virtual vec read_channel(int n, int ch) = 0; virtual mat read(int n) = 0; virtual std::streamoff tell() const = 0; virtual bool seek(std::streamoff n) = 0; virtual std::streamoff num_samples() = 0; virtual ~Audio_Samples_Reader_If() {} }; class Audio_Samples_Writer_If { public: virtual bool write_sample(const double& s, int ch) = 0; virtual bool write_channel(const vec& s, int ch) = 0; //Write n samples to audio channel ch virtual bool write(const mat& s) = 0; virtual std::streamoff tell() const = 0; virtual bool seek(std::streamoff n) = 0; virtual std::streamoff num_samples() = 0; virtual ~Audio_Samples_Writer_If() {} }; } //! \endcond /*! \ingroup audio \brief Class to read audio data from au file Input stream of audio samples uses binary stream to get encoded audio data from snd audio file. Audio can be read as single sample from current read position in audio stream, as a vector of samples containing data from single audio channel or as matrix with audio channels stored columnwise. Following example illustratates read operations with SND_In_File \code #include using namespace itpp; int main() { //create audio stream SND_In_File f_in("inptut.au"); //get description Audio_Stream_Description d = f_in.get_description(); //read 100 audio samples if file contains stereo data on 8 kHz sampling rate mat in(100,2); vec first_channel(100); vec second_channel(100); if((d.get_num_channels == 2) && (d.get_sampling_rate() == 8000) && (f_in.num_samples()>=100)) { in = f_in.read(100); f_in.seek_read(0); //reposition to the first sample first_channel = f_in.read_channel(100); //read first channel f_in.seek_read(0); //reposition to the first sample second_channel = f_in.read_channel(100,1); //read second channel } return 0; } \endcode */ class ITPP_EXPORT SND_In_File { public: //! Default constructor - creates uninitialized stream SND_In_File(); //! Constructor from file name \a fname SND_In_File(const char* fname); //! Stream destructor ~SND_In_File(); //! Open the file \a fname bool open(const char* fname); //! Close the file. void close(); //! Get stream description Audio_Stream_Description get_description() const {return *_description;} //! Go to sample number \a pos bool seek_read(std::streamoff pos) { if((pos > _num_samples) || (pos < 0)) return false; if(_samples_reader) return _samples_reader->seek(pos); else return false; } //! Get current position in samples. std::streamoff tell_read() { if(_samples_reader) return _samples_reader->tell(); else return -1; } //! Get number of samples in stream std::streamoff num_samples() const {return _num_samples;} //! Read single sample \a s at current position to channel \a ch. bool read_sample(double& s, int ch = 0) { if(_samples_reader) return _samples_reader->read_sample(s,ch); else return false; } //! Read \a n samples from channel \a ch starting at current position vec read_channel(int n, int ch = 0) { if(_samples_reader) return _samples_reader->read_channel(n,ch); else return vec(); } //! Read \a n samples from all channels starting at current position into matrix mat read(int n) { if(_samples_reader) return _samples_reader->read(n); else return mat(); } private: //! Binary stream bifstream _str; //! Number of samples std::streamoff _num_samples; //! Samples Reader audiofile_details::Audio_Samples_Reader_If* _samples_reader; //! Stream Description Audio_Stream_Description* _description; }; /*! \ingroup audio \brief A class to write SND-files (the .au format) Output stream uses underlying binary stream to write audio data to the audio file in au format. Audio can be written sample-by sample, channel-wise or taken column-wise from the input matrix Following example illustrates write operations with SND_Out_File: \code #include using namespace itpp; int main() { //create stream description to store 8kHz 16-bit PCM stereo audio data d = Audio_Stream_Description(enc_linear16, 8000,2); //create audio stream SND_Out_File f_out("inptut.au",d); //fill input with 10004 Hz test tone mat in(100,2); for(int i = 0; i < 100; ++i){ in(i,0) = sin(2*pi*i*1004/8000); in(i,1) = cos(2*pi*i*1004/8000); } //write audio samples f_out.write(in); //zero sample 5 in channel 0 f_out.seek_write(5); f_out.write_sample(0,0); //zero samples 5..7 in channel 1 vec z(3); z(0) = 0.0; z(1) = 0.0; z(2) = 0.0; f_out.seek_write(5); f_out.write_channel(z,1); return 0; } \endcode */ class ITPP_EXPORT SND_Out_File { public: //! Default constructor - creates uninitialized stream SND_Out_File(); //! Constructor from file name \a fname and stream description \a d SND_Out_File(const char *fname, const Audio_Stream_Description& d); //! Stream destructor ~SND_Out_File(); //! Open the file \a fname with stream description \a d bool open(const char *fname, const Audio_Stream_Description& d); //! Close the file. void close(); //! Get stream description Audio_Stream_Description get_description() const {return *_description;} //! Set current position to write to \a pos (samples). bool seek_write(std::streamoff pos) { if((pos > _num_samples) || (pos < 0)) return false; if(_samples_writer) return _samples_writer->seek(pos); else return false; } //! Get current position in samples. std::streamoff tell_write() { if(_samples_writer) return _samples_writer->tell(); else return -1; } //! Get number of samples in stream std::streamoff num_samples() const {return _num_samples;} //! Write single sample \a s at current position to channel \a ch bool write_sample(const double &s, int ch = 0) { if(_samples_writer){ bool ret = _samples_writer->write_sample(s,ch); if(ret){ _num_samples = std::max(_num_samples, _samples_writer->tell()); } return ret; } else return false; } //! Write the vector \a v to channel \a ch starting at current position bool write_channel(const vec &v, int ch = 0) { if(_samples_writer){ bool ret = _samples_writer->write_channel(v,ch); if(ret){ _num_samples = std::max(_num_samples, _samples_writer->tell()); } return ret; } else return false; } //! Write audio channels from columns of the matrix \a m starting at current position bool write(const mat &m) { if(_samples_writer){ bool ret = _samples_writer->write(m); if(ret){ _num_samples = std::max(_num_samples, _samples_writer->tell()); } return ret; } else return false; } private: //! Binary stream bofstream _str; //! Number of samples std::streamoff _num_samples; //! Samples Writer audiofile_details::Audio_Samples_Writer_If* _samples_writer; //! Stream Description Audio_Stream_Description* _description; }; /*! \ingroup audio \brief A class for doing both input and output of audio samples. SND_IO_File provides facilities for doing both input and output of audio samples. */ class ITPP_EXPORT SND_IO_File { public: //! Constructor - creates uninitialized stream SND_IO_File(); //! Open the file \a fname, check file header. SND_IO_File(const char *fname); //! Open the file \a fname, truncate and overwrite header with description \a d. SND_IO_File(const char *fname, const Audio_Stream_Description& d); //! Stream destructor ~SND_IO_File(); //! Open the file \a fname, check file header. bool open(const char *fname); //! Open the file \a fname, truncate and overwrite header with description \a d. bool open(const char *fname, const Audio_Stream_Description& d); //! Close the file. void close(); //! Get stream description Audio_Stream_Description get_description() const {return *_description;} //! Set current position to read from \a pos (samples). bool seek_read(std::streamoff pos) { if((pos > _num_samples) || (pos < 0)) return false; if(_samples_reader) return _samples_reader->seek(pos); else return false; } //! Get current position to read from in samples. std::streamoff tell_read() { if(_samples_reader) return _samples_reader->tell(); else return -1; } //! Set current position to write to \a pos (samples). bool seek_write(std::streamoff pos) { if((pos > _num_samples) || (pos < 0)) return false; if(_samples_writer) return _samples_writer->seek(pos); else return false; } //! Get current position to write in samples. std::streamoff tell_write() { if(_samples_writer) return _samples_writer->tell(); else return -1; } //! Get number of samples in stream std::streamoff num_samples() const {return _num_samples;} //! Read single sample \a s at current position to channel \a ch. bool read_sample(double& s, int ch = 0) { if(_samples_reader) return _samples_reader->read_sample(s,ch); else return false; } //! Read \a n samples from channel \a ch starting at current position vec read_channel(int n, int ch = 0) { if(_samples_reader) return _samples_reader->read_channel(n,ch); else return vec(); } //! Read \a n samples from all channels starting at current position mat read(int n) { if(_samples_reader) return _samples_reader->read(n); else return mat(); } //! Write single sample \a s at current position to channel \a ch bool write_sample(const double &s, int ch = 0) { if(_samples_writer){ bool ret = _samples_writer->write_sample(s,ch); if(ret){ _num_samples = std::max(_num_samples, _samples_writer->tell()); } return ret; } else return false; } //! Write the vector \a v to channel \a ch starting at current position bool write_channel(const vec &v, int ch = 0) { if(_samples_writer){ bool ret = _samples_writer->write_channel(v,ch); if(ret){ _num_samples = std::max(_num_samples, _samples_writer->tell()); } return ret; } else return false; } //! Write audio channels from columns of the matrix \a m starting at current position bool write(const mat &m) { if(_samples_writer){ bool ret = _samples_writer->write(m); if(ret){ _num_samples = std::max(_num_samples, _samples_writer->tell()); } return ret; } else return false; } private: //! Binary stream bfstream _str; //! Number of samples std::streamoff _num_samples; //! Samples Reader audiofile_details::Audio_Samples_Reader_If* _samples_reader; //! Samples Writer audiofile_details::Audio_Samples_Writer_If* _samples_writer; //! Stream Description Audio_Stream_Description* _description; }; //! \cond /* \brief SAP audio file input class \ingroup audio ADD DETAILED DOCUMENTATION FOR THIS CLASS!!!!!!!!!!! */ /* class SAP_In_File : virtual public Audio_File { public: // Constructor SAP_In_File(); // Open the file {\em fname}. SAP_In_File(const char *fname); // Destructor virtual ~SAP_In_File() { close(); } // Open the file {\em fname}. virtual bool open(const char *fname); // Close the file. virtual void close(); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! virtual bool seek_read(int pos); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! virtual int tell_read(); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! bool read(vec &v); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! bool read(vec &v, int n); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! const char *get_header() { return header; } protected: char header[SAP_HEADER_SIZE]; }; */ /* \brief SAP audio file output class \ingroup audio ADD DETAILED DOCUMENTATION FOR THIS CLASS!!!!!!!!!!! */ /* class SAP_Out_File : virtual public Audio_File { public: // Constructor SAP_Out_File(); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! SAP_Out_File(const char *fname, const char *hdr); // Destructor virtual ~SAP_Out_File() { close(); } // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! bool open(const char *fname, const char *hdr); // Old def. Removed since Sun CC gave warning. //virtual bool open(const char *fname, const char *hdr); // Close the file virtual void close(); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! bool seek_write(int pos); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! int tell_write(); // ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!! virtual bool write(const vec &v); }; */ /* \brief SAP audio file input and output class \ingroup audio ADD DETAILED DOCUMENTATION FOR THIS CLASS!!!!!!!!!!! */ /* class SAP_IO_File : public SAP_In_File, public SAP_Out_File { public: // Constructor SAP_IO_File() { } // Open the file {\em fname}. SAP_IO_File(const char *fname) { open(fname); } // Destructor virtual ~SAP_IO_File() { close(); } // Open the file {\em fname}. virtual bool open(const char *fname); // Close the file virtual void close(); }; */ //! \endcond /*! \addtogroup audio */ //!@{ //! Read audio channel inline vec snd_read_channel(const char *fname, int ch = 0) { SND_In_File f(fname); int ns = (int)std::min(f.num_samples(), (std::streamoff)std::numeric_limits::max()); return f.read_channel(ns,ch); } //! Read \a len audio channel samples starting at position \a beg inline vec snd_read_channel(const char *fname, int ch, int len, std::streamoff beg = 0) { vec ret; SND_In_File f(fname); if(f.seek_read(beg)) ret = f.read_channel(len,ch); return ret; } //! Read audio data inline mat snd_read(const char *fname) { SND_In_File f(fname); int ns = (int)std::min(f.num_samples(), (std::streamoff)std::numeric_limits::max()); return f.read(ns); } //! Read \a len audio samples starting at position \a beg inline mat snd_read(const char *fname, int len, std::streamoff beg = 0) { mat ret; SND_In_File f(fname); if(f.seek_read(beg)) ret = f.read(len); return ret; } //! Write audio channel from vector \a s using stream description \a descr inline bool snd_write_channel(const char *fname, const Audio_Stream_Description& descr, const vec& s, int ch = 0) { SND_Out_File f(fname,descr); return f.write_channel(s,ch); } //! Write audio data inline bool snd_write(const char *fname, const Audio_Stream_Description& descr, const mat& s) { SND_Out_File f(fname,descr); return f.write(s); } //!@} //! \cond /* // Read SAP audio data bool sap_read(const char *fname, vec &v); // Read SAP audio data bool sap_read(const char *fname, vec &v, int beg, int len); // Write SAP audio data bool sap_write(const char *fname, const vec &v, const char *hdr); */ //! \endcond } // namespace itpp #endif // #ifndef AUDIOFILE_H itpp-4.3.1/itpp/srccode/audiosample.h000066400000000000000000000214431216575753400175700ustar00rootroot00000000000000/*! * \file * \brief Encoding and decoding of audio samples * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef AUDIOSAMPLE_H #define AUDIOSAMPLE_H #include #include #include /*! \addtogroup audio \section audiorepresentation Representaion of Audio samples. ITPP supports various types of representation for audio samples: - 8/16/32-bit PCM encoding formats - IEEE 754 Floating point formats with single and double precision - G.711 u-law and A-law encoded samples */ namespace itpp { /*! \ingroup audio \brief Supported encoding types for audio samples. Numerical values of these constants correspond to the encoding type identifier in snd file format, introduced by Sun Microsystems. */ enum Audio_Encoding {enc_unknown = 0, enc_mulaw8 = 1, enc_alaw8 = 27, enc_linear8 = 2,enc_linear16 = 3,enc_linear24 = 4, enc_linear32 = 5,enc_float = 6,enc_double = 7}; /*! \ingroup audio \brief Helper function for scaling and limiting of audio samples. This function maps [-1.0, 1.0] doubles to [-max_abs, max_abs] values of type T. Input values are limited before mapping. */ template T limit_audio_sample(double s) { //ternary operators allow optimizer to deploy SIMD floating-point instructions s < -1.0 ? -1.0 : s > 1.0 ? 1.0 : s; return (T)(s*max_abs); } /*! \ingroup audio \brief Helper function for scaling and limiting of audio samples. This function maps [-max_abs, max_abs] values of type T to doubles in [-1.0,1.0] interval */ template double audio_sample_to_double(T s) { return (1.0/down_scaling) * s; } /*! \ingroup audio \brief Generic template class for Audio samples. Specializations of this class provide encoding and decoding facilities for various representations of audio samples. Encoding inputs are limited to [-1.0,1.0] range. Decoding outputs are scaled to [-1.0,1.0] range. */ template class Audio_Sample; /*! \ingroup audio \brief uLaw-encoded Audio samples. */ template<> class Audio_Sample { public: typedef uint8_t enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) { int16_t l = limit_audio_sample(s); return ulaw_compress(l); } static double decode(const enc_sample_type& s) { return audio_sample_to_double((ulaw_expand(s))); } }; /*! \ingroup audio \brief 8-bit PCM encoded audio samples. */ template<> class Audio_Sample { public: typedef int8_t enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) { return limit_audio_sample(s); } static double decode(const enc_sample_type& s) { return audio_sample_to_double(s); } }; /*! \ingroup audio \brief 16-bit PCM encoded audio samples */ template<> class Audio_Sample { public: typedef int16_t enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) { return limit_audio_sample(s); } static double decode(const enc_sample_type& s) { return audio_sample_to_double(s); } }; //! Small class to represent 24-bit PCM samples. class Sample_24 { public: static const int32_t max_abs_value = (1<<23) - 1; explicit Sample_24(uint32_t v = 0):_value(v){} uint32_t value() const {return _value;} void value(uint32_t v){_value = v;} private: uint32_t _value; }; //! insertion operator for 24-bit PCM sample template Binary_Out_Stream& operator<<(Binary_Out_Stream& s, Sample_24 v) { uint32_t sample = v.value(); char *c = reinterpret_cast(&sample); if(s.get_endianity() == s.get_native_endianity()){ //stream endian matches machine endian s.write(c,3); } else{ //stream endian differs from machine endian - reverse order of bytes s.put(c[2]); s.put(c[1]); s.put(c[0]); } return s; } //! extraction operator for 24-bit PCM sample template Binary_In_Stream& operator>>(Binary_In_Stream& s, Sample_24& v) { uint32_t sample; char *c = reinterpret_cast(&sample); if(s.get_endianity() == s.get_native_endianity()){ //stream endian matches machine endian s.read(c,3); } else{ //stream endian differs from machine endian - reverse order of bytes s.get(c[2]); s.get(c[1]); s.get(c[0]); } if(s) v.value(sample); return s; } /*! \ingroup audio \brief 24-bit PCM encoded audio samples. */ template<> class Audio_Sample { public: typedef Sample_24 enc_sample_type; static const std::size_t enc_sample_size = 3; //3 bytes per sample static enc_sample_type encode(const double& s) { return Sample_24(limit_audio_sample(s)); } static double decode(const enc_sample_type& s) { return audio_sample_to_double(s.value()); } }; /*! \ingroup audio \brief 32-bit PCM encoded audio samples. */ template<> class Audio_Sample { public: typedef int32_t enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) { return limit_audio_sample(s); } static double decode(const enc_sample_type& s) { return audio_sample_to_double(s); } }; /*! \ingroup audio \brief Audio samples encoded as floats. Samples are NOT saturated to +/- 1.0 during conversion to this format. Encoded values are limited to [INT_MIN,INT_MAX] to avoid overflow on conversion. */ template<> class Audio_Sample { public: typedef float enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) {//saturate here to avoid Infinity values return (enc_sample_type)(s < -INT_MAX ? -INT_MAX : s > INT_MAX ? INT_MAX : s); } static double decode(const enc_sample_type& s){return s;} }; /*! \ingroup audio \brief Audio samples encoded as doubles. Samples are NOT saturated to +/- 1.0 during conversion to this format. */ template<> class Audio_Sample { public: typedef double enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) {return s;} static double decode(const enc_sample_type& s){return s;} }; /*! \brief aLaw-encoded Audio samples. \ingroup audio */ template<> class Audio_Sample { public: typedef uint8_t enc_sample_type; static const std::size_t enc_sample_size = sizeof(enc_sample_type); static enc_sample_type encode(const double& s) { int16_t l = limit_audio_sample(s); return alaw_compress(l); } static double decode(const enc_sample_type& s) { return audio_sample_to_double((alaw_expand(s))); } }; //! Size of encoded sample based on the encoding type \a e. inline std::size_t encoded_sample_size(Audio_Encoding e) { switch(e) { case enc_mulaw8: return Audio_Sample::enc_sample_size; case enc_linear8: return Audio_Sample::enc_sample_size; case enc_linear16: return Audio_Sample::enc_sample_size; case enc_linear24: return Audio_Sample::enc_sample_size; case enc_linear32: return Audio_Sample::enc_sample_size; case enc_float: return Audio_Sample::enc_sample_size; case enc_double: return Audio_Sample::enc_sample_size; case enc_alaw8: return Audio_Sample::enc_sample_size; case enc_unknown: default: return 0; } } } // namespace itpp #endif // #ifndef AUDIOFILE_H itpp-4.3.1/itpp/srccode/g711.cpp000066400000000000000000000213101216575753400162700ustar00rootroot00000000000000/*! * \file * \brief Implementation of G.711 logarithmic codecs * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include namespace itpp { namespace g711_details { //define tables used in compression and expansion algorithms uint8_t G711_Base_Properties::compression_table[128] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; int16_t MuLaw_Properties::expansion_table[256] = { -8031, -7775, -7519, -7263, -7007, -6751, -6495, -6239, -5983, -5727, -5471, -5215, -4959, -4703, -4447, -4191, -3999, -3871, -3743, -3615, -3487, -3359, -3231, -3103, -2975, -2847, -2719, -2591, -2463, -2335, -2207, -2079, -1983, -1919, -1855, -1791, -1727, -1663, -1599, -1535, -1471, -1407, -1343, -1279, -1215, -1151, -1087, -1023, -975, -943, -911, -879, -847, -815, -783, -751, -719, -687, -655, -623, -591, -559, -527, -495, -471, -455, -439, -423, -407, -391, -375, -359, -343, -327, -311, -295, -279, -263, -247, -231, -219, -211, -203, -195, -187, -179, -171, -163, -155, -147, -139, -131, -123, -115, -107, -99, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -30, -28, -26, -24, -22, -20, -18, -16, -14, -12, -10, -8, -6, -4, -2, 0, 8031, 7775, 7519, 7263, 7007, 6751, 6495, 6239, 5983, 5727, 5471, 5215, 4959, 4703, 4447, 4191, 3999, 3871, 3743, 3615, 3487, 3359, 3231, 3103, 2975, 2847, 2719, 2591, 2463, 2335, 2207, 2079, 1983, 1919, 1855, 1791, 1727, 1663, 1599, 1535, 1471, 1407, 1343, 1279, 1215, 1151, 1087, 1023, 975, 943, 911, 879, 847, 815, 783, 751, 719, 687, 655, 623, 591, 559, 527, 495, 471, 455, 439, 423, 407, 391, 375, 359, 343, 327, 311, 295, 279, 263, 247, 231, 219, 211, 203, 195, 187, 179, 171, 163, 155, 147, 139, 131, 123, 115, 107, 99, 93, 89, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41, 37, 33, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0 }; int16_t ALaw_Properties::expansion_table[256] = { -688, -656, -752, -720, -560, -528, -624, -592, -944, -912, -1008, -976, -816, -784, -880, -848, -344, -328, -376, -360, -280, -264, -312, -296, -472, -456, -504, -488, -408, -392, -440, -424, -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, -43, -41, -47, -45, -35, -33, -39, -37, -59, -57, -63, -61, -51, -49, -55, -53, -11, -9, -15, -13, -3, -1, -7, -5, -27, -25, -31, -29, -19, -17, -23, -21, -172, -164, -188, -180, -140, -132, -156, -148, -236, -228, -252, -244, -204, -196, -220, -212, -86, -82, -94, -90, -70, -66, -78, -74, -118, -114, -126, -122, -102, -98, -110, -106, 688, 656, 752, 720, 560, 528, 624, 592, 944, 912, 1008, 976, 816, 784, 880, 848, 344, 328, 376, 360, 280, 264, 312, 296, 472, 456, 504, 488, 408, 392, 440, 424, 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, 43, 41, 47, 45, 35, 33, 39, 37, 59, 57, 63, 61, 51, 49, 55, 53, 11, 9, 15, 13, 3, 1, 7, 5, 27, 25, 31, 29, 19, 17, 23, 21, 172, 164, 188, 180, 140, 132, 156, 148, 236, 228, 252, 244, 204, 196, 220, 212, 86, 82, 94, 90, 70, 66, 78, 74, 118, 114, 126, 122, 102, 98, 110, 106 }; /* //These two functions generate and print compression-expansion tables defined above. //They can be used to create these tables dynamically. void generate_tables() { //generation of table used in compression - compute segment //numbers for all possible values of MSBs uint8_t cmp_val = 1; uint8_t segno = 0; for(uint8_t i = 0; i < 128; ++i) { if(i == cmp_val) { //detect leading 1 cmp_val <<= 1; segno++; } G711_Base_Properties::compression_table[i] = segno; } //generation of expansion table (inverse encoding) for(uint16_t i = 0; i < 256; ++i){ uint16_t mantissa = ~i; // 1's complement of the input value uint8_t exponent = (mantissa >> 4) & (0x0007); // extract exponent uint8_t segment = exponent + 1; //compute segment number mantissa = (mantissa & 0x0f) | 0x10; // extract mantissa and add leading 1 int16_t rounding_value = 1 << exponent; //rounding value is equal to the half of the LSB int16_t restored_magnitude = (mantissa << segment) + rounding_value - MuLaw_Properties::magnitude_offset; //correct magnitude offset introduced during compression MuLaw_Properties::expansion_table[i] = i & 0x80 ? restored_magnitude : -restored_magnitude; } //generation of expansion table (inverse encoding) for(uint16_t i = 0; i < 256; ++i){ uint16_t mantissa = i ^ 0x55; //remove even bits toggle during compression uint8_t exponent = (mantissa >> 4) & (0x0007); //extract 3 bits of exponent from bits 6..4 mantissa = (mantissa & 0x0f); //get mantissa from bits 3..0 int16_t rounding_value; if(exponent > 0) { mantissa |= 0x10; ///add leading 1 rounding_value = 1 << (exponent - 1) ; //rounding value is equal to the half of the LSB } else { mantissa <<= 1; //scale mantissa a to align with initial dynamic range rounding_value = 1; //rounding value is equal to the LSB } //restore magnitude and sign int16_t restored_magnitude = (mantissa << (exponent)) + rounding_value; ALaw_Properties::expansion_table[i] = i & 0x80 ? restored_magnitude : -restored_magnitude; } } void print_tables() { std::cout << "compression:" << std::endl; int j = 0; for(int i = 0; i < 128; ++i, ++j) { if(j == 16){ std::cout << std::endl; j = 0; } std::cout <<" "<< (int)G711_Base_Properties::compression_table[i]; if(i != 127) std::cout<<','; } std::cout << std::endl; std::cout << "u expnasion:" << std::endl; j = 0; for(int i = 0; i < 256; ++i, ++j) { if(j == 8) { std::cout << std::endl; j = 0; } std::cout <<" "<< std::setw(5) << (int)MuLaw_Properties::expansion_table[i]; if(i != 255) std::cout<<','; } std::cout << std::endl; std::cout << "a expansion:" << std::endl; j = 0; for(int i = 0; i < 256; ++i, ++j) { if(j == 8) { std::cout << std::endl; j = 0; } std::cout <<" "<< std::setw(5) << (int)ALaw_Properties::expansion_table[i]; if(i != 255) std::cout<<','; } std::cout << std::endl; } */ } } itpp-4.3.1/itpp/srccode/g711.h000066400000000000000000000202001216575753400157320ustar00rootroot00000000000000/*! * \file * \brief Implementation of G.711 logarithmic codecs * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2013 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef G711_H #define G711_H #include #include #include /*! * \addtogroup audio * * \section g711 G.711 audio codecs * ITU-T G.711 defines two logarithmic codecs used for PCM audio data. Both codecs are widely used * for 64 kbps serial transmission in telephone networks. * * Codec algorithms are based on the perceptual properties of the human ear - weak signals are masked * by strong ones, so only the MSBs of the original sample can be kept without significant loss of quality. * * u-law compression encodes 14-bit input sample as floating point value with 1 bit of sign, * 3 bits of exponent and 4 bits of mantissa, representing the MSBs of the magnitude of the * original sample. * * a-law compression generates output in the same format but operates on 13-bit samples, providing * somewhat higher output dynamic range at the expense of larger quantization error [SPRA634]. * * Codecs differ in particular details of mantissa and exponent encoding (see [G.711] for details). * G.191 specification provides reference implementation and test vectors for G.711 codecs. * * \section g711_refs G.711 references * * - [G711] G.711 : Pulse code modulation (PCM) of voice frequencies; ITU-T Recommendation (11/1988) * - [G191] G.191 : Software tools for speech and audio coding; ITU-T Recommendation (03/2010) * - [SPRA634] Mark A. Castellano, Todd Hiers, Rebecca Ma TMS320C6000 u-Law and A-Law Companding with * Software or the McBSP. Application report, Texas Instruments, April 2000. */ namespace itpp { //! \cond //forward declarations to make friends visible std::pair ulaw_range(); uint8_t ulaw_compress(int16_t s); int16_t ulaw_expand(uint8_t s); std::pair alaw_range(); uint8_t alaw_compress(int16_t s); int16_t alaw_expand(uint8_t s); namespace g711_details { //This makes compression-expansion tables inaccessible in user's code //while compression-expansion functions are still defined inline. Also, it //hides property classes from itpp namespace. //Base properties of G.711 codecs class G711_Base_Properties { protected: //! look-up table used in compression functions static ITPP_EXPORT uint8_t compression_table[128]; }; //u-law algorithm properties class MuLaw_Properties : public G711_Base_Properties { //u-law codec input bitwidth static const int input_bitwidth = 14; //offset applied to magnitude of the input sample static const int16_t magnitude_offset = 33; //maximum input value according to G.711 static const int16_t input_max = 8158; //minimum input value according to G.711 static const int16_t input_min = -8159; //table used in u-law expansion static ITPP_EXPORT int16_t expansion_table[256]; friend std::pair itpp::ulaw_range(); friend uint8_t itpp::ulaw_compress(int16_t s); friend int16_t itpp::ulaw_expand(uint8_t s); }; //a-law algorithm properties class ALaw_Properties : public G711_Base_Properties { //a-law codec input bitwidth static const int input_bitwidth = 13; //maximum input value according to G.711 static const int16_t input_max = 4095; //minimum input value according to G.711 static const int16_t input_min = -4096; //table used in u-law expansion static ITPP_EXPORT int16_t expansion_table[256]; friend std::pair itpp::alaw_range(); friend uint8_t itpp::alaw_compress(int16_t s); friend int16_t itpp::alaw_expand(uint8_t s); }; } //! \endcond /*! \brief G.711 u-Law compressor input range. Returns (min,max) input values in std::pair. \ingroup audio */ inline std::pair ulaw_range() { using namespace g711_details; return std::make_pair(MuLaw_Properties::input_min,MuLaw_Properties::input_max); } /*! \brief G.711 u-Law compression function. Returns encoded value for sample \a s. \ingroup audio */ inline uint8_t ulaw_compress(int16_t s) { using namespace g711_details; //Limiting and shifting. Negative samples are 1's complemented to align dynamic //ranges of positive and negative numbers. Compressed negative //and positive values of equal magnitude are distinguished by the sign bit. //As per G.711 spec, resulting magnitude is shifted before compression. uint8_t sign; uint16_t shifted_magnitude; if(s >= 0){ if(s > MuLaw_Properties::input_max) s = MuLaw_Properties::input_max; shifted_magnitude = s + MuLaw_Properties::magnitude_offset; sign = 0xff; } else{ if(s < MuLaw_Properties::input_min) s = MuLaw_Properties::input_min; shifted_magnitude = (MuLaw_Properties::magnitude_offset - 1) - s; sign = 0x7f; } //use compression table to get the segment number. Segment number corresponds //to the exponent value stored in compressed sample. uint8_t seg_no = MuLaw_Properties::compression_table[shifted_magnitude>>6]; //extract 4 MSBs of magnitude, except leading 1, compose it with segment number //and sign, store 1's complement value as compressed sample uint8_t ret = (seg_no << 4) | ((shifted_magnitude >> (seg_no + 1)) & 0x0f); ret ^= sign; //1's complement and add sign return ret; } /*! \brief G.711 u-Law expansion function. Returns decoded value for previously compressed sample \a s. \ingroup audio Expansion is performed by the table look up. */ inline int16_t ulaw_expand(uint8_t s){return g711_details::MuLaw_Properties::expansion_table[s];} /*! \brief G.711 a-Law compressor input range. Returns (min,max) input values in std::pair. \ingroup audio */ inline std::pair alaw_range() { using namespace g711_details; return std::make_pair(ALaw_Properties::input_min,ALaw_Properties::input_max); } /*! \brief G.711 a-Law compression function. Returns encoded value for sample \a s. \ingroup audio */ inline uint8_t alaw_compress(int16_t s) { using namespace g711_details; //Limiting. Negative samples are 1's complemented to align dynamic //ranges of positive and negative numbers. Compressed negative //and positive values of equal magnitude are distinguished by the sign bit. uint8_t sign; uint16_t magnitude; if(s >= 0){ if(s > ALaw_Properties::input_max) s = ALaw_Properties::input_max; magnitude = s; sign = 0xd5; } else{//1's complement to get magnitude if(s < ALaw_Properties::input_min) s = ALaw_Properties::input_min; magnitude = -1 - s; sign = 0x55; } //use compression table to get the exponent. uint8_t exp_val = ALaw_Properties::compression_table[magnitude>>5]; uint8_t ret; if(exp_val > 0) { //extract 4 MSBs of magnitude, except leading 1 and compose it with exponent ret = (exp_val << 4) | ((magnitude >> (exp_val)) & 0x0f); } else{//exp is 0, store 4 MSBs of magnitude ret = (uint8_t)magnitude >> 1; } ret ^= sign; //toggle even bits and add sign return ret; } /*! \brief G.711 u-Law expansion function. Returns decoded value for previously compressed sample \a s. \ingroup audio Expansion is performed by the table look up. */ inline int16_t alaw_expand(uint8_t s){return g711_details::ALaw_Properties::expansion_table[s];} } #endif itpp-4.3.1/itpp/srccode/gmm.cpp000066400000000000000000000234451216575753400164040ustar00rootroot00000000000000/*! * \file * \brief Implementation of a Gaussian Mixture Model Class * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #include //! \cond namespace itpp { GMM::GMM() { d = 0; M = 0; } GMM::GMM(std::string filename) { load(filename); } GMM::GMM(int M_in, int d_in) { M = M_in; d = d_in; m = zeros(M * d); sigma = zeros(M * d); w = 1. / M * ones(M); for (int i = 0;i < M;i++) { w(i) = 1.0 / M; } compute_internals(); } void GMM::init_from_vq(const vec &codebook, int dim) { mat C(dim, dim); int i; vec v; d = dim; M = codebook.length() / dim; m = codebook; w = ones(M) / double(M); C.clear(); for (i = 0;i < M;i++) { v = codebook.mid(i * d, d); C = C + outer_product(v, v); } C = 1. / M * C; sigma.set_length(M*d); for (i = 0;i < M;i++) { sigma.replace_mid(i*d, diag(C)); } compute_internals(); } void GMM::init(const vec &w_in, const mat &m_in, const mat &sigma_in) { int i, j; d = m_in.rows(); M = m_in.cols(); m.set_length(M*d); sigma.set_length(M*d); for (i = 0;i < M;i++) { for (j = 0;j < d;j++) { m(i*d + j) = m_in(j, i); sigma(i*d + j) = sigma_in(j, i); } } w = w_in; compute_internals(); } void GMM::set_mean(const mat &m_in) { int i, j; d = m_in.rows(); M = m_in.cols(); m.set_length(M*d); for (i = 0;i < M;i++) { for (j = 0;j < d;j++) { m(i*d + j) = m_in(j, i); } } compute_internals(); } void GMM::set_mean(int i, const vec &means, bool compflag) { m.replace_mid(i*length(means), means); if (compflag) compute_internals(); } void GMM::set_covariance(const mat &sigma_in) { int i, j; d = sigma_in.rows(); M = sigma_in.cols(); sigma.set_length(M*d); for (i = 0;i < M;i++) { for (j = 0;j < d;j++) { sigma(i*d + j) = sigma_in(j, i); } } compute_internals(); } void GMM::set_covariance(int i, const vec &covariances, bool compflag) { sigma.replace_mid(i*length(covariances), covariances); if (compflag) compute_internals(); } void GMM::marginalize(int d_new) { it_error_if(d_new > d, "GMM.marginalize: cannot change to a larger dimension"); vec mnew(d_new*M), sigmanew(d_new*M); int i, j; for (i = 0;i < M;i++) { for (j = 0;j < d_new;j++) { mnew(i*d_new + j) = m(i * d + j); sigmanew(i*d_new + j) = sigma(i * d + j); } } m = mnew; sigma = sigmanew; d = d_new; compute_internals(); } void GMM::join(const GMM &newgmm) { if (d == 0) { w = newgmm.w; m = newgmm.m; sigma = newgmm.sigma; d = newgmm.d; M = newgmm.M; } else { it_error_if(d != newgmm.d, "GMM.join: cannot join GMMs of different dimension"); w = concat(double(M) / (M + newgmm.M) * w, double(newgmm.M) / (M + newgmm.M) * newgmm.w); w = w / sum(w); m = concat(m, newgmm.m); sigma = concat(sigma, newgmm.sigma); M = M + newgmm.M; } compute_internals(); } void GMM::clear() { w.set_length(0); m.set_length(0); sigma.set_length(0); d = 0; M = 0; } void GMM::save(std::string filename) { std::ofstream f(filename.c_str()); int i, j; f << M << " " << d << std::endl ; for (i = 0;i < w.length();i++) { f << w(i) << std::endl ; } for (i = 0;i < M;i++) { f << m(i*d) ; for (j = 1;j < d;j++) { f << " " << m(i*d + j) ; } f << std::endl ; } for (i = 0;i < M;i++) { f << sigma(i*d) ; for (j = 1;j < d;j++) { f << " " << sigma(i*d + j) ; } f << std::endl ; } } void GMM::load(std::string filename) { std::ifstream GMMFile(filename.c_str()); int i, j; it_error_if(!GMMFile, std::string("GMM::load : cannot open file ") + filename); GMMFile >> M >> d ; w.set_length(M); for (i = 0;i < M;i++) { GMMFile >> w(i) ; } m.set_length(M*d); for (i = 0;i < M;i++) { for (j = 0;j < d;j++) { GMMFile >> m(i*d + j) ; } } sigma.set_length(M*d); for (i = 0;i < M;i++) { for (j = 0;j < d;j++) { GMMFile >> sigma(i*d + j) ; } } compute_internals(); std::cout << " mixtures:" << M << " dim:" << d << std::endl ; } double GMM::likelihood(const vec &x) { double fx = 0; int i; for (i = 0;i < M;i++) { fx += w(i) * likelihood_aposteriori(x, i); } return fx; } vec GMM::likelihood_aposteriori(const vec &x) { vec v(M); int i; for (i = 0;i < M;i++) { v(i) = w(i) * likelihood_aposteriori(x, i); } return v; } double GMM::likelihood_aposteriori(const vec &x, int mixture) { int j; double s; it_error_if(d != x.length(), "GMM::likelihood_aposteriori : dimensions does not match"); s = 0; for (j = 0;j < d;j++) { s += normexp(mixture * d + j) * sqr(x(j) - m(mixture * d + j)); } return normweight(mixture)*std::exp(s);; } void GMM::compute_internals() { int i, j; double s; double constant = 1.0 / std::pow(2 * pi, d / 2.0); normweight.set_length(M); normexp.set_length(M*d); for (i = 0;i < M;i++) { s = 1; for (j = 0;j < d;j++) { normexp(i*d + j) = -0.5 / sigma(i * d + j); // check time s *= sigma(i * d + j); } normweight(i) = constant / std::sqrt(s); } } vec GMM::draw_sample() { static bool first = true; static vec cumweight; double u = randu(); int k; if (first) { first = false; cumweight = cumsum(w); it_error_if(std::abs(cumweight(length(cumweight) - 1) - 1) > 1e-6, "weight does not sum to 0"); cumweight(length(cumweight) - 1) = 1; } k = 0; while (u > cumweight(k)) k++; return elem_mult(sqrt(sigma.mid(k*d, d)), randn(d)) + m.mid(k*d, d); } GMM gmmtrain(Array &TrainingData, int M, int NOITER, bool VERBOSE) { mat mean; int i, j, d = TrainingData(0).length(); vec sig; GMM gmm(M, d); vec m(d*M); vec sigma(d*M); vec w(M); vec normweight(M); vec normexp(d*M); double LL = 0, LLold, fx; double constant = 1.0 / std::pow(2 * pi, d / 2.0); int T = TrainingData.length(); vec x1; int t, n; vec msum(d*M); vec sigmasum(d*M); vec wsum(M); vec p_aposteriori(M); vec x2; double s; vec temp1, temp2; //double MINIMUM_VARIANCE=0.03; //-----------initialization----------------------------------- mean = vqtrain(TrainingData, M, 200000, 0.5, VERBOSE); for (i = 0;i < M;i++) gmm.set_mean(i, mean.get_col(i), false); // for (i=0;i. * * ------------------------------------------------------------------------- */ #ifndef GMM_H #define GMM_H #include #include namespace itpp { /*! \ingroup sourcecoding \brief Gaussian Mixture Model Class \author Thomas Eriksson */ class ITPP_EXPORT GMM { public: GMM(); GMM(int nomix, int dim); GMM(std::string filename); void init_from_vq(const vec &codebook, int dim); // void init(const vec &w_in, const vec &m_in, const vec &sigma_in); void init(const vec &w_in, const mat &m_in, const mat &sigma_in); void load(std::string filename); void save(std::string filename); void set_weight(const vec &weights, bool compflag = true); void set_weight(int i, double weight, bool compflag = true); void set_mean(const mat &m_in); void set_mean(const vec &means, bool compflag = true); void set_mean(int i, const vec &means, bool compflag = true); void set_covariance(const mat &sigma_in); void set_covariance(const vec &covariances, bool compflag = true); void set_covariance(int i, const vec &covariances, bool compflag = true); int get_no_mixtures(); int get_no_gaussians() const { return M; } int get_dimension(); vec get_weight(); double get_weight(int i); vec get_mean(); vec get_mean(int i); vec get_covariance(); vec get_covariance(int i); void marginalize(int d_new); void join(const GMM &newgmm); void clear(); double likelihood(const vec &x); double likelihood_aposteriori(const vec &x, int mixture); vec likelihood_aposteriori(const vec &x); vec draw_sample(); protected: vec m, sigma, w; int M, d; private: void compute_internals(); vec normweight, normexp; }; inline void GMM::set_weight(const vec &weights, bool compflag) {w = weights; if (compflag) compute_internals(); } inline void GMM::set_weight(int i, double weight, bool compflag) {w(i) = weight; if (compflag) compute_internals(); } inline void GMM::set_mean(const vec &means, bool compflag) {m = means; if (compflag) compute_internals(); } inline void GMM::set_covariance(const vec &covariances, bool compflag) {sigma = covariances; if (compflag) compute_internals(); } inline int GMM::get_dimension() {return d;} inline vec GMM::get_weight() {return w;} inline double GMM::get_weight(int i) {return w(i);} inline vec GMM::get_mean() {return m;} inline vec GMM::get_mean(int i) {return m.mid(i*d, d);} inline vec GMM::get_covariance() {return sigma;} inline vec GMM::get_covariance(int i) {return sigma.mid(i*d, d);} ITPP_EXPORT GMM gmmtrain(Array &TrainingData, int M, int NOITER = 30, bool VERBOSE = true); //! \endcond } // namespace itpp #endif // #ifndef GMM_H itpp-4.3.1/itpp/srccode/lpcfunc.cpp000066400000000000000000000262411216575753400172530ustar00rootroot00000000000000/*! * \file * \brief Implementations of linear prediction functions, and conversion * between common representations of linear predictive parameters * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include //! \cond using std::cout; using std::endl; namespace itpp { // Autocorrelation sequence to reflection coefficients conversion. vec ac2rc(const vec &ac); // Autocorrelation sequence to prediction polynomial conversion. vec ac2poly(const vec &ac); // Inverse sine parameters to reflection coefficients conversion. vec is2rc(const vec &is); // Reflection coefficients to autocorrelation sequence conversion. vec rc2ac(const vec &rc); // Reflection coefficients to inverse sine parameters conversion. vec rc2is(const vec &rc); vec autocorr(const vec &x, int order) { if (order < 0) order = x.size(); vec R(order + 1); double sum; int i, j; for (i = 0;i < order + 1;i++) { sum = 0; for (j = 0;j < x.size() - i;j++) { sum += x[j] * x[j+i]; } R[i] = sum; } return R; } vec levinson(const vec &R2, int order) { vec R = R2; R[0] = R[0] * (1. + 1.e-9); if (order < 0) order = R.length() - 1; double k, alfa, s; double *any = new double[order+1]; double *a = new double[order+1]; int j, m; vec out(order + 1); a[0] = 1; alfa = R[0]; if (alfa <= 0) { out.clear(); out[0] = 1; return out; } for (m = 1;m <= order;m++) { s = 0; for (j = 1;j < m;j++) { s = s + a[j] * R[m-j]; } k = -(R[m] + s) / alfa; if (fabs(k) >= 1.0) { cout << "levinson : panic! abs(k)>=1, order " << m << ". Aborting..." << endl ; for (j = m;j <= order;j++) { a[j] = 0; } break; } for (j = 1;j < m;j++) { any[j] = a[j] + k * a[m-j]; } for (j = 1;j < m;j++) { a[j] = any[j]; } a[m] = k; alfa = alfa * (1 - k * k); } for (j = 0;j < out.length();j++) { out[j] = a[j]; } delete any; delete a; return out; } vec lpc(const vec &x, int order) { return levinson(autocorr(x, order), order); } vec poly2ac(const vec &poly) { vec a = poly; int order = a.length() - 1; double alfa, s, *any = new double[order+1]; int j, m; vec r(order + 1); vec k = poly2rc(a); it_error_if(a[0] != 1, "poly2ac : not an lpc filter"); r[0] = 1; alfa = 1; for (m = 1;m <= order;m++) { s = 0; for (j = 1;j < m;j++) { s = s + a[j] * r[m-j]; } r[m] = -s - alfa * k[m-1]; for (j = 1;j < m;j++) { any[j] = a[j] + k[m-1] * a[m-j]; } for (j = 1;j < m;j++) { a[j] = any[j]; } a[m] = k[m-1]; alfa = alfa * (1 - sqr(k[m-1])); } delete any; return r; } vec poly2rc(const vec &a) { // a is [1 xx xx xx], a.size()=order+1 int m, i; int order = a.size() - 1; vec k(order); vec any(order + 1), aold(a); for (m = order - 1;m > 0;m--) { k[m] = aold[m+1] ; if (fabs(k[m]) > 1) k[m] = 1.0 / k[m]; for (i = 0;i < m;i++) { any[i+1] = (aold[i+1] - aold[m-i] * k[m]) / (1 - k[m] * k[m]); } aold = any; } k[0] = any[1]; if (fabs(k[0]) > 1) k[0] = 1.0 / k[0]; return k; } vec rc2poly(const vec &k) { int m, i; vec a(k.length() + 1), any(k.length() + 1); a[0] = 1; any[0] = 1; a[1] = k[0]; for (m = 1;m < k.size();m++) { any[m+1] = k[m]; for (i = 0;i < m;i++) { any[i+1] = a[i+1] + a[m-i] * k[m]; } a = any; } return a; } vec rc2lar(const vec &k) { short m; vec LAR(k.size()); for (m = 0;m < k.size();m++) { LAR[m] = std::log((1 + k[m]) / (1 - k[m])); } return LAR; } vec lar2rc(const vec &LAR) { short m; vec k(LAR.size()); for (m = 0;m < LAR.size();m++) { k[m] = (std::exp(LAR[m]) - 1) / (std::exp(LAR[m]) + 1); } return k; } double FNevChebP_double(double x, const double c[], int n) { int i; double b0 = 0.0, b1 = 0.0, b2 = 0.0; for (i = n - 1; i >= 0; --i) { b2 = b1; b1 = b0; b0 = 2.0 * x * b1 - b2 + c[i]; } return (0.5 * (b0 - b2 + c[0])); } double FNevChebP(double x, const double c[], int n) { int i; double b0 = 0.0, b1 = 0.0, b2 = 0.0; for (i = n - 1; i >= 0; --i) { b2 = b1; b1 = b0; b0 = 2.0 * x * b1 - b2 + c[i]; } return (0.5 * (b0 - b2 + c[0])); } vec poly2lsf(const vec &pc) { int np = pc.length() - 1; vec lsf(np); vec fa((np + 1) / 2 + 1), fb((np + 1) / 2 + 1); vec ta((np + 1) / 2 + 1), tb((np + 1) / 2 + 1); double *t; double xlow, xmid, xhigh; double ylow, ymid, yhigh; double xroot; double dx; int i, j, nf; int odd; int na, nb, n; double ss, aa; double DW = (0.02 * pi); int NBIS = 4; odd = (np % 2 != 0); if (odd) { nb = (np + 1) / 2; na = nb + 1; } else { nb = np / 2 + 1; na = nb; } fa[0] = 1.0; for (i = 1, j = np; i < na; ++i, --j) fa[i] = pc[i] + pc[j]; fb[0] = 1.0; for (i = 1, j = np; i < nb; ++i, --j) fb[i] = pc[i] - pc[j]; if (odd) { for (i = 2; i < nb; ++i) fb[i] = fb[i] + fb[i-2]; } else { for (i = 1; i < na; ++i) { fa[i] = fa[i] - fa[i-1]; fb[i] = fb[i] + fb[i-1]; } } ta[0] = fa[na-1]; for (i = 1, j = na - 2; i < na; ++i, --j) ta[i] = 2.0 * fa[j]; tb[0] = fb[nb-1]; for (i = 1, j = nb - 2; i < nb; ++i, --j) tb[i] = 2.0 * fb[j]; nf = 0; t = ta._data(); n = na; xroot = 2.0; xlow = 1.0; ylow = FNevChebP_double(xlow, t, n); ss = std::sin(DW); aa = 4.0 - 4.0 * std::cos(DW) - ss; while (xlow > -1.0 && nf < np) { xhigh = xlow; yhigh = ylow; dx = aa * xhigh * xhigh + ss; xlow = xhigh - dx; if (xlow < -1.0) xlow = -1.0; ylow = FNevChebP_double(xlow, t, n); if (ylow * yhigh <= 0.0) { dx = xhigh - xlow; for (i = 1; i <= NBIS; ++i) { dx = 0.5 * dx; xmid = xlow + dx; ymid = FNevChebP_double(xmid, t, n); if (ylow * ymid <= 0.0) { yhigh = ymid; xhigh = xmid; } else { ylow = ymid; xlow = xmid; } } if (yhigh != ylow) xmid = xlow + dx * ylow / (ylow - yhigh); else xmid = xlow + dx; lsf[nf] = std::acos((double) xmid); ++nf; if (xmid >= xroot) { xmid = xlow - dx; } xroot = xmid; if (t == ta._data()) { t = tb._data(); n = nb; } else { t = ta._data(); n = na; } xlow = xmid; ylow = FNevChebP_double(xlow, t, n); } } if (nf != np) { cout << "poly2lsf: WARNING: failed to find all lsfs" << endl ; } return lsf; } vec lsf2poly(const vec &f) { int m = f.length(); vec pc(m + 1); double c1, c2, *a; vec p(m + 1), q(m + 1); int mq, n, i, nor; it_error_if(m % 2 != 0, "lsf2poly: THIS ROUTINE WORKS ONLY FOR EVEN m"); pc[0] = 1.0; a = pc._data() + 1; mq = m >> 1; for (i = 0 ; i <= m ; i++) { q[i] = 0.; p[i] = 0.; } p[0] = q[0] = 1.; for (n = 1; n <= mq; n++) { nor = 2 * n; c1 = 2 * std::cos(f[nor-1]); c2 = 2 * std::cos(f[nor-2]); for (i = nor; i >= 2; i--) { q[i] += q[i-2] - c1 * q[i-1]; p[i] += p[i-2] - c2 * p[i-1]; } q[1] -= c1; p[1] -= c2; } a[0] = 0.5 * (p[1] + q[1]); for (i = 1, n = 2; i < m ; i++, n++) a[i] = 0.5 * (p[i] + p[n] + q[n] - q[i]); return pc; } vec poly2cepstrum(const vec &a) { vec c(a.length() - 1); for (int n = 1;n <= c.length();n++) { c[n-1] = a[n]; for (int k = 1;k < n;k++) { c[n-1] -= double(k) / n * a[n-k] * c[k-1]; } } return c; } vec poly2cepstrum(const vec &a, int num) { it_error_if(num < a.length(), "a2cepstrum : not allowed cepstrum length"); vec c(num); int n; for (n = 1;n < a.length();n++) { c[n-1] = a[n]; for (int k = 1;k < n;k++) { c[n-1] -= double(k) / n * a[n-k] * c[k-1]; } } for (n = a.length();n <= c.length();n++) { c[n-1] = 0; for (int k = n - a.length() + 1;k < n;k++) { c[n-1] -= double(k) / n * a[n-k] * c[k-1]; } } return c; } vec cepstrum2poly(const vec &c) { vec a(c.length() + 1); a[0] = 1; for (int n = 1;n <= c.length();n++) { a[n] = c[n-1]; for (int k = 1;k < n;k++) { a[n] += double(k) / n * a[n-k] * c[k-1]; } } return a; } vec chirp(const vec &a, double factor) { vec temp(a.length()); int i; double f = factor; it_error_if(a[0] != 1, "chirp : a[0] should be 1"); temp[0] = a[0]; for (i = 1;i < a.length();i++) { temp[i] = a[i] * f; f *= factor; } return temp; } vec schurrc(const vec &R, int order) { if (order == -1) order = R.length() - 1; vec k(order), scratch(2*order + 2); int m; int h; double ex; double *ep; double *en; ep = scratch._data(); en = scratch._data() + order + 1; m = 0; while (m < order) { m++; ep[m] = R[m]; en[m] = R[m-1]; } if (en[1] < 1.0) en[1] = 1.0; h = -1; while (h < order) { h++; k[h] = -ep[h+1] / en[1]; en[1] = en[1] + k[h] * ep[h+1]; if (h == (order - 1)) { // cout << "k: " << k << endl ; return k; } ep[order] = ep[order] + k[h] * en[order-h]; m = h + 1; while (m < (order - 1)) { m++; ex = ep[m] + k[h] * en[m-h]; en[m-h] = en[m-h] + k[h] * ep[m]; ep[m] = ex; } } return k; // can never come here } vec lerouxguegenrc(const vec &R, int order) { vec k(order); double *r, *rny; int j, m; int M = order; r = new double[2*M+1]; rny = new double[2*M+1]; for (j = 0;j <= M;j++) { r[M-j] = r[M+j] = R[j]; } for (m = 1;m <= M;m++) { k[m-1] = -r[M+m] / r[M]; for (j = -M;j <= M;j++) { rny[M+j] = r[M+j] + k[m-1] * r[M+m-j]; } for (j = -M;j <= M;j++) { r[M+j] = rny[M+j]; } } delete r; delete rny; return k; } double sd(const vec &In1, const vec &In2) { return std::sqrt(37.722339402*energy(poly2cepstrum(In1, 32) - poly2cepstrum(In2, 32))); } // highestfreq=1 gives entire band double sd(const vec &In1, const vec &In2, double highestfreq) { vec Diff = sqr(abs(log10(filter_spectrum(In1, In2)))); double S = 0; for (int i = 0;i < round(highestfreq*129);i++) { S = S + Diff(i); } S = S * 100 / round(highestfreq * 129); return std::sqrt(S); } } // namespace itpp //! \endcond itpp-4.3.1/itpp/srccode/lpcfunc.h000066400000000000000000000112451216575753400167160ustar00rootroot00000000000000/*! * \file * \brief Implementation of linear prediction functions, and conversion * between common representations of linear predictive parameters * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- * Here we define functions for linear predictive analysis and * coding. Several functions for computation of lpc parameters are * given, together with functions to convert between various common * representations of the lpc polynomial coefficients. The * functionality is the same as in the MATLAB functions with the same * names. * * The short term for the various parameter types are: * poly - LPC polynomial coefficients * ac - autocorrelation coefficients * rc - reflection coefficients * lar - log area ratios * is - inverse sine parameters * lsf - line spectral frequencies */ #ifndef LPCFUNC_H #define LPCFUNC_H #include #include namespace itpp { /*! \addtogroup lpc */ //!@{ //! Returns a chirped version of the input vector ITPP_EXPORT vec chirp(const vec &a, double factor); //! Spectral distortion between two vectors, in dB. ITPP_EXPORT double sd(const vec &In1, const vec &In2); //! Spectral distortion between two vectors, in dB, up to highest frequency highestfreq. ITPP_EXPORT double sd(const vec &In1, const vec &In2, double highestfreq); //! Computes reflection coefficients from autocorrelation, using the Le-Roux-Guegen algorithm. ITPP_EXPORT vec lerouxguegenrc(const vec &R, int order); //! Levinson - Levinson-Durbin recursion. ITPP_EXPORT vec levinson(const vec &R2, int order); //! Computes the autocorrelation function ITPP_EXPORT vec autocorr(const vec &x, int order); //! lpc - Linear Predictive Coefficients using autocorrelation method. ITPP_EXPORT vec lpc(const vec &x, int order); //! schurrc - Schur algorithm. ITPP_EXPORT vec schurrc(const vec &R, int order); //! ac2rc - Autocorrelation sequence to reflection coefficients conversion. ITPP_EXPORT vec ac2rc(const vec &ac); //! ac2poly - Autocorrelation sequence to prediction polynomial conversion. ITPP_EXPORT vec ac2poly(const vec &ac); //! is2rc - Inverse sine parameters to reflection coefficients conversion. ITPP_EXPORT vec is2rc(const vec &is); //! lar2rc - Log area ratios to reflection coefficients conversion. ITPP_EXPORT vec lar2rc(const vec &lar); //! lsf2poly - Line spectral frequencies to prediction polynomial conversion. ITPP_EXPORT vec lsf2poly(const vec &lsf); //! poly2ac - Prediction polynomial to autocorrelation sequence conversion. ITPP_EXPORT vec poly2ac(const vec &poly); //! poly2lsf - Prediction polynomial to line spectral frequencies conversion. ITPP_EXPORT vec poly2lsf(const vec &poly); //! poly2rc - Prediction polynomial to reflection coefficients conversion. ITPP_EXPORT vec poly2rc(const vec &poly); //! poly2cepstrum - Prediction polynomial to cepstrum conversion. ITPP_EXPORT vec poly2cepstrum(const vec &a); //! poly2cepstrum - Prediction polynomial to cepstrum conversion, to the specified order. ITPP_EXPORT vec poly2cepstrum(const vec &a, int num); //! cepstrum2poly - Cepstrum to prediction polynomial conversion. ITPP_EXPORT vec cepstrum2poly(const vec &c); //! rc2ac - Reflection coefficients to autocorrelation sequence conversion. ITPP_EXPORT vec rc2ac(const vec &rc); //! rc2is - Reflection coefficients to inverse sine parameters conversion. ITPP_EXPORT vec rc2is(const vec &rc); //! rc2lar - Reflection coefficients to log area ratios conversion. ITPP_EXPORT vec rc2lar(const vec &rc); //! rc2poly - Reflection coefficients to prediction polynomial conversion. ITPP_EXPORT vec rc2poly(const vec &rc); //!@} } // namespace itpp #endif // #ifndef LPCFUNC_H itpp-4.3.1/itpp/srccode/pnm.cpp000066400000000000000000000327151216575753400164160ustar00rootroot00000000000000/*! * \file * \brief Implementation of PNM graphics format I/O function * \author * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include //! \cond using std::istream; using std::ostream; using std::endl; using std::string; using std::ifstream; using std::ofstream; using std::istringstream; using std::ios; using std::ios_base; using std::streampos; namespace itpp { // Suppress the additional white characters and return the comments static void pnm_read_comments(istream & i, string & comments); // Write comment in the image file static void pnm_write_comments(ostream & o, const string & comments); // Read/Write the header for the pnm file format static bool pnm_read_header(ifstream & file, char & pnm_type, int & width, int & height, int & max_val, string & comments, char pnm_type_required = '0'); static bool pnm_write_header(ofstream & file, char type, int width, int height, int max_val, const string & comments); //-------------------------------------------------------------- // General PNM functions //-------------------------------------------------------------- char pnm_type(const string & filename) { ifstream file; char pnm_type; file.open(filename.c_str(), ifstream::in | ifstream::binary); string comments; int width, height, max_val; pnm_read_header(file, pnm_type, width, height, max_val, comments); return pnm_type; } //-------------------------------------------------------------- bool pnm_info(const string & filename, char & pnm_type, int & width, int & height, int & max_val, string & comments) { ifstream file; file.open(filename.c_str(), ifstream::in | ifstream::binary); pnm_read_header(file, pnm_type, width, height, max_val, comments); return true; } //-------------------------------------------------------------- // PGM related functions (gray images) //-------------------------------------------------------------- bool pgm_read(const string & filename, imat & m, string & comments) { ifstream file; int width, height, max_val, i, j; comments = ""; file.open(filename.c_str(), ifstream::in | ifstream::binary); // The format code is 'P5' for pgm files char pnm_type; if (!pnm_read_header(file, pnm_type, width, height, max_val, comments, '5')) return false; // Format the returned matrix m.set_size(height, width, false); // Retrieve the integer value from the file for (i = 0 ; i < height; i++) for (j = 0; j < width; j++) m(i, j) = file.get(); return true; } //-------------------------------------------------------------- // Simplified version of read_pgm imat pgm_read(const string & filename) { imat I; string comments; if (!pgm_read(filename, I, comments)) { it_warning("pgm_read (PGM file->imat) failed "); } return I; } //-------------------------------------------------------------- bool pgm_read(const string & filename, imat &m, int r1, int r2, int c1, int c2) { ifstream file; int width, height, max_val, i, j; // This is a dummy variable. // Its purpose is the call of function pnm_read_header. string comments; file.open(filename.c_str(), ifstream::in | ifstream::binary); char pnm_type; if (!pnm_read_header(file, pnm_type, width, height, max_val, comments, '5')) return false; // Inversion of the column/row numbers may be required if (r1 > r2) { int rtmp = r2; r2 = r1; r1 = rtmp; } if (c1 > c2) { int ctmp = c2; c2 = c1; c1 = ctmp; } it_error_if((r1 < 0) || (c1 < 0), "Bad parameter value: row and column number must be >=0"); it_error_if((r2 >= height) || (c1 >= width), "Bad parameter value: " "row or column number exceeds the image heigth"); m.set_size(r2 - r1 + 1, c2 - c1 + 1, false); file.seekg(r1 * width + c1, ios::cur); for (i = 0 ; i < m.rows() ; i++) { for (j = 0 ; j < m.cols() ; j++) m(i, j) = file.get(); file.seekg(width - (c2 - c1 + 1), ios::cur); } return true; } //-------------------------------------------------------------- bool pgm_write(const string & filename, const imat &m, const string & comments) { ofstream file; int i, j; file.open(filename.c_str(), ofstream::out | ofstream::binary); if (!pnm_write_header(file, '5', m.cols(), m.rows(), 255, comments)) return false; for (i = 0; i < m.rows(); i++) for (j = 0; j < m.cols(); j++) file.put(static_cast(m(i, j))); if (!file) return false; return true; } //-------------------------------------------------------------- // PPM related functions (color images) //-------------------------------------------------------------- bool ppm_read(const string & filename, imat &r, imat &g, imat &b, string & comments) { ifstream file; int width, height, max_val, i, j; file.open(filename.c_str(), ifstream::in | ifstream::binary); char pnm_type; if (!pnm_read_header(file, pnm_type, width, height, max_val, comments, '6')) return false; r.set_size(height, width, false); g.set_size(height, width, false); b.set_size(height, width, false); for (i = 0; i < height; i++) for (j = 0; j < width; j++) { r(i, j) = file.get(); g(i, j) = file.get(); b(i, j) = file.get(); } return true; } //-------------------------------------------------------------- // Same function but suppress the comments bool ppm_read(const string & filename, imat &r, imat &g, imat &b) { string comments; // This is a dummy variable return ppm_read(filename, r, g, b, comments); } //-------------------------------------------------------------- bool ppm_read(const string & filename, imat &r, imat &g, imat &b, int r1, int r2, int c1, int c2) { ifstream file; int width, height, max_val, i, j; // This is a dummy variable. Its purpose is the call of function pnm_read_header. string comments; file.open(filename.c_str(), ifstream::in | ifstream::binary); char pnm_type; if (!pnm_read_header(file, pnm_type, width, height, max_val, comments, '6')) return false; // Inversion of the column/row numbers may be required if (r1 > r2) { // Funny way to do it... (without using any temporary variable) r1 += r2; r2 = r1 - r2; r1 -= r2; } if (c1 > c2) { // Conventionnal way to do it int ctmp = c2; c2 = c1; c1 = ctmp; } it_error_if((r1 < 0) || (c1 < 0), "Bad parameter value: row and column number must be >=0"); it_error_if((r2 >= height) || (c1 >= width), "Bad parameter value: " "row or column number exceeds the image heigth"); r.set_size(r2 - r1 + 1, c2 - c1 + 1, false); g.set_size(r2 - r1 + 1, c2 - c1 + 1, false); b.set_size(r2 - r1 + 1, c2 - c1 + 1, false); file.seekg(3 *(r1 * width + c1), ios::cur); for (i = 0; i < r.rows(); i++) { for (j = 0; j < r.cols(); j++) { r(i, j) = file.get(); g(i, j) = file.get(); b(i, j) = file.get(); } file.seekg(3 * (width - (c2 - c1 + 1)), ios::cur); } return true; } //-------------------------------------------------------------- bool ppm_write(const string & filename, const imat &r, const imat &g, const imat &b, const string & comments, int max_val) { ofstream file; int i, j; it_assert_debug(r.cols() == g.cols() && g.cols() == b.cols() && r.rows() == g.rows() && g.rows() == b.rows(), "Matrices r, g and b must have the same size in ppm_write()"); file.open(filename.c_str(), ofstream::out | ofstream::binary); if (max_val < 0 || max_val > 65535) { it_warning("Proposed maximal value is incorrect"); return false; } if (!pnm_write_header(file, '6', r.cols(), r.rows(), max_val, comments)) return false; for (i = 0; i < r.rows(); i++) for (j = 0; j < r.cols(); j++) { file.put(static_cast(r(i, j))); file.put(static_cast(g(i, j))); file.put(static_cast(b(i, j))); } if (!file) return false; return true; } //-------------------------------------------------------------- imat img_double2int(const mat & m, int max_val, double double_min, double double_max) { int i, j; imat M(m.rows(), m.cols()); for (i = 0 ; i < m.rows() ; i++) for (j = 0 ; j < m.cols() ; j++) if (m(i, j) <= double_min) M(i, j) = 0; else if (m(i, j) >= double_max) M(i, j) = max_val; else M(i, j) = (int)(max_val * (m(i, j) - double_min) / (double_max - double_min) + 0.5); return M; } //-------------------------------------------------------------- mat img_int2double(const imat & m, int max_val, double double_min, double double_max) { int i, j; mat M(m.rows(), m.cols()); for (i = 0 ; i < m.rows() ; i++) for (j = 0 ; j < m.cols() ; j++) if (m(i, j) <= 0) M(i, j) = double_min; else if (m(i, j) >= max_val) M(i, j) = double_max; else // This rounding works well when m(i,j) is positive M(i, j) = double_min + (double_max - double_min) * m(i, j) / (double) max_val; return M; } //-------------------------------------------------------------- // Static functions: Used in this file only //-------------------------------------------------------------- //-------------------------------------------------------------- static void pnm_read_comments(istream & i, string & comments) { while (isspace(i.peek())) { while (isspace(i.peek())) i.get(); if (i.peek() == '#') while (i.peek() != '\r' && i.peek() != '\n') comments += static_cast(i.get()); } } //-------------------------------------------------------------- static void pnm_write_comments(ostream & o, const string & comments) { istringstream comments_stream(comments); char comment_line[ 256 ]; // Put header and comment while (!comments_stream.eof()) { o << "#"; comments_stream.get(comment_line, 256); o << comment_line << endl; } } //-------------------------------------------------------------- // Read the header of a pnm file static bool pnm_read_header(ifstream & file, char & pnm_type, int & width, int & height, int & max_val, string & comments, char pnm_type_required) { bool return_code = true; if (file.get() != 'P') return_code = false; it_error_if(!return_code, "Invalid format file: code of file format has " "not been found"); // Read the type of the pnm file file.get(pnm_type); it_error_if((pnm_type < '1') || (pnm_type > '6'), "Bad file code P" << pnm_type); // If a type has been specified if (pnm_type_required != '0') if (pnm_type_required != pnm_type) { string err_msg("Found file code P"); err_msg += pnm_type + " instead of P" + pnm_type_required; it_error(err_msg); } // Retrieve the image format and the comments pnm_read_comments(file, comments); file >> width; pnm_read_comments(file, comments); file >> height; pnm_read_comments(file, comments); it_error_if((height < 0) || (width < 0), "Bad image size"); // Maximal values is not present in PBM files if (pnm_type == '2' || pnm_type == '3' || pnm_type == '5' || pnm_type == '6') file >> max_val; file.get(); // Eat the last whitespace // According to the pnm specification, the maximal value should not // be greater than 65536 and lower than 0 it_error_if((max_val >= 65536) || (max_val < 0), "Invalid maximum number in pnm header"); // For type P5 and P6, the value have to be lower than 255 it_error_if((pnm_type == '5' || pnm_type == '6') && (max_val > 255), "Invalid maximum number in pnm header"); return file.good(); } //-------------------------------------------------------------- static bool pnm_write_header(ofstream &file, char pnm_type, int width, int height, int max_val, const string & comments) { file << 'P' << pnm_type << endl; pnm_write_comments(file, comments); file << width << ' ' << height << endl; // Maximal values is not present in PBM files if (pnm_type == '2' || pnm_type == '3' || pnm_type == '5' || pnm_type == '6') file << max_val << endl; return file.good(); } } // namespace itpp //! \endcond itpp-4.3.1/itpp/srccode/pnm.h000066400000000000000000000177431216575753400160670ustar00rootroot00000000000000/*! * \file * \brief Definitions of PNM graphics format I/O function * \author * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef PNM_H #define PNM_H #include #include namespace itpp { /*! \addtogroup image The PNM graphics format is actually a family of formats consisting of PBM (black and white, not implemented yet), PGM (gray) and PPM (RGB color). This interface proposes input/output functions for images in the raw formats (type 'P4', 'P5' and 'P6'). There are several utilities available for manipulating PNM images. Search the net for the netpbm package. */ //-------------------------------------------------------------- // General PNM functions /*! \ingroup image \brief Determines the type of a PNM file, based on magic numbers. The returned value is a character between '1' and '6'. If an error occured, the returned value is the character '0' \param filename The name of the file from which the image is retrieved */ ITPP_EXPORT char pnm_type(const std::string & filename); /*! \ingroup image \brief Retrieve some information about an pnm file \param filename The name of the file from which the image is retrieved \param pnm_type The type of the pnm file (5: pgm file, 6: ppm file) \param width The image width \param height The image height \param max_val The greatest possible value \param comments The comments in the file */ ITPP_EXPORT bool pnm_info(const std::string & filename, char & pnm_type, int & width, int & height, int & max_val, std::string & comments); //-------------------------------------------------------------- // PGM related functions (gray images) /*! \ingroup image \brief Read the entire graymap into the matrix \a m or return false if the function failed. \param filename The name of the file from which the image is retrieved \param m The matrix in which the image will be stored \param comments This std::string variable is used to retrieve the comments of the file */ ITPP_EXPORT bool pgm_read(const std::string & filename, imat & m, std::string & comments); /*! \ingroup image \brief Read a part of the graymap into the matrix \a m. \param filename The name of the file from which the image is retrieved \param m The matrix in which the image will be stored \param r1 first row to be included in the matrix \param r2 last row to be included in the matrix \param c1 first column to be included in the matrix \param c2 last column to be included in the matrix */ ITPP_EXPORT bool pgm_read(const std::string & filename, imat &m, int r1, int r2, int c1, int c2); /*! \ingroup image \brief Read a pgm file of name filename and return the corresponding matrix of integers. Return a void matrix if an error ocurred. \param filename The name of the file from which the image is retrieved */ ITPP_EXPORT imat pgm_read(const std::string & filename); /*! \ingroup image \brief Create an image file from the matrix of integer \param filename The name of the image file to create \param m The matrix of integer representing the image \param comments Comments included in the file Coefficients greater than 255 and smaller than 0 are clipped. */ ITPP_EXPORT bool pgm_write(const std::string & filename, const imat &m, const std::string & comments = "Generated by IT++ (http://itpp.sourceforge.net)"); //-------------------------------------------------------------- // PPM related functions (color images) /*! \ingroup image \brief Read the color image file in the format ppm. The image is retrieved as a set of three matrices, each of whom is a plan of RGB component. \param filename The name of the file to be read \param r the red component of the image \param g the green component of the image \param b the blue component of the image \param comments a string variable to retrieve the comments contained in the file header. */ ITPP_EXPORT bool ppm_read(const std::string & filename, imat &r, imat &g, imat &b, std::string & comments); /*! \ingroup image \brief Read the color image file in the PPM format. \param filename The name of the file to be read \param r the red component of the image \param g the green component of the image \param b the blue component of the image */ ITPP_EXPORT bool ppm_read(const std::string & filename, imat &r, imat &g, imat &b); /*! \ingroup image \brief Read a part of the pixmap into the matrix \a m. The parameters \a r1, \a r2, \a c1 and \a c2 are the rows and columns (inclusive) of the subimage. */ ITPP_EXPORT bool ppm_read(const std::string & filename, imat &r, imat &g, imat &b, int r1, int r2, int c1, int c2); /*! \ingroup image \brief Write the matrix \a m as a pixmap. \param filename The name of the file to create \param r the red component of the image \param g the green component of the image \param b the blue component of the image \param comments a comment that will be inserted in the image file \param max_val The maximum value of a component. This quantity should be lower than 255 (raw type). */ ITPP_EXPORT bool ppm_write(const std::string & filename, const imat &r, const imat &g, const imat &b, const std::string & comments = "Generated by IT++ (http://itpp.sourceforge.net)", int max_val = 255); /*! \ingroup image \brief Prepare a matrix of double to be writted as an image \param m The matrix of real. The components are assumed to be between double_min and double_max, and will be scaled by factor \a max_val / (\a double_max - \a double_min ) in the output matrix. \param max_val The maximum value for the output matrix. This value is usually set to 255. \param double_min The value corresponding to the integer value 0. Note that all the values smaller that this quantity will be \a double_min. \param double_max The value corresponding to the integer value max_val. Similarly to \a double_min, values greater than \a double_max will be set to double_max */ ITPP_EXPORT imat img_double2int(const mat & m, int max_val = 255, double double_min = 0 , double double_max = 1); /*! \ingroup image \brief Return a matrix of double which is a scaled version of the input matrix \a m of integers. \param m The matrix of real. The components are assumed to be between 0 and 1, and will be scaled by factor max_val in the output matrix. \param max_val The maximum value for the output matrix. This value is usually set to 255. \param double_min The value on which the integer value 0 will be mapped \param double_max The value on which the integer value \a max_val will be mapped */ ITPP_EXPORT mat img_int2double(const imat & m, int max_val = 255, double double_min = 0, double double_max = 1); } // namespace itpp #endif // #ifndef PNM_H itpp-4.3.1/itpp/srccode/sources.mk000066400000000000000000000010011216575753400171140ustar00rootroot00000000000000h_srccode_sources = \ $(top_srcdir)/itpp/srccode/audiofile.h \ $(top_srcdir)/itpp/srccode/gmm.h \ $(top_srcdir)/itpp/srccode/lpcfunc.h \ $(top_srcdir)/itpp/srccode/pnm.h \ $(top_srcdir)/itpp/srccode/vq.h \ $(top_srcdir)/itpp/srccode/vqtrain.h cpp_srccode_sources = \ $(top_srcdir)/itpp/srccode/audiofile.cpp \ $(top_srcdir)/itpp/srccode/gmm.cpp \ $(top_srcdir)/itpp/srccode/lpcfunc.cpp \ $(top_srcdir)/itpp/srccode/pnm.cpp \ $(top_srcdir)/itpp/srccode/vq.cpp \ $(top_srcdir)/itpp/srccode/vqtrain.cpp itpp-4.3.1/itpp/srccode/vq.cpp000066400000000000000000000167751216575753400162620ustar00rootroot00000000000000/*! * \file * \brief Implementation of a vector quantizer class (unconstrained) * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include //! \cond using std::ifstream; using std::ofstream; using std::cout; using std::endl; namespace itpp { //-------------------------------------------------------------------- // class VQ //-------------------------------------------------------------------- Vector_Quantizer::Vector_Quantizer() : CodeBook() { LatestDist = 0; Size = 0; Dim = 0; } Vector_Quantizer::Vector_Quantizer(const char *Name) : CodeBook() { LatestDist = 0; Size = 0; Dim = 0; load(Name); } int Vector_Quantizer::encode(const vec &x) { int i; double S, MinS = 1.0E30F; int MinIndex = 0; int j, pos = 0; double a; for (i = 0;i < Size;i++) { S = 0; for (j = 0;j < Dim;j++) { a = x._elem(j) - CodeBook._elem(pos + j); S += a * a; if (S >= MinS) goto sune; } MinS = S; MinIndex = i; sune: pos += Dim; } LatestDist = MinS; return MinIndex; } ivec Vector_Quantizer::encode(const vec &x, int num) { double S, a; vec MinS(num); ivec MinIndex(num); int i, j, index, pos = 0; MinS.clear(); MinS += 1.0E30F; MinIndex.clear(); for (i = 0;i < Size;i++) { S = 0; for (j = 0;j < Dim;j++) { a = x._elem(j) - CodeBook._elem(pos + j); S += a * a; if (S >= MinS[num-1]) goto sune; } for (index = num - 2;(index >= 0) && (S < MinS[index]);index--); for (j = MinS.length() - 2;j > index;j--) { MinS[j+1] = MinS[j];// memcpy, memmov MinIndex[j+1] = MinIndex[j]; } MinS[index+1] = S; MinIndex[index+1] = i; sune: pos += Dim; } LatestDist = MinS[0]; return MinIndex; } Array Vector_Quantizer::decode(const ivec &Index) const { Array Temp(Index.length()); for (int i = 0;i < Temp.length();i++) { Temp(i) = get_codevector(Index(i)); } return Temp; } ifstream &operator>>(ifstream &ifs, vec &v) { int i; char str[2000]; char *ptr, *ptr_old; bool flag; if (length(v) != 0) { for (i = 0;i < length(v);i++) { ifs.operator >> (v[i]) ; } } else { v.set_length(50); ifs.getline(str, 2000); if (strlen(str) == 0) ifs.getline(str, 2000); i = 0; v[i++] = atof(str); ptr = str; ptr_old = ptr; ptr = strchr(ptr, ' '); while (ptr == ptr_old) { ptr++; ptr_old = ptr; ptr = strchr(ptr, ' '); } while (ptr) { if (i >= v.length()) v.set_length(2*v.length(), true); v[i++] = atof(ptr); ptr_old = ptr; ptr = strchr(ptr, ' '); while (ptr == ptr_old) { ptr++; ptr_old = ptr; ptr = strchr(ptr, ' '); } } flag = true; flag = false; v.set_length(i, true); } return ifs; } void Vector_Quantizer::load(const char *Name) { vec Temp; ifstream CodeBookFile(Name); vec v; int n; int d; it_error_if(!CodeBookFile, std::string("Vector_Quantizer::load : cannot open file ") + Name); cout << "Reading the codebook " << Name ; cout.flush() ; CodeBookFile >> v ; d = length(v); Temp.set_length(d*16); n = 0; while (!CodeBookFile.eof()) { if (n*d >= Temp.length()) Temp.set_length(2*Temp.length(), true); Temp.replace_mid(n*d, v); n++; CodeBookFile >> v ; } Size = n; Dim = d; CodeBook.set_length(Size*Dim); for (n = 0;n < CodeBook.length();n++) CodeBook(n) = Temp(n); cout << " size:" << size() << " dim:" << dim() << endl ; } void Vector_Quantizer::save(const char *Name) const { ofstream CodeBookFile(Name); cout << "Saving the codebook " << Name << endl ; for (int i = 0;i < Size;i++) { vec v = CodeBook.mid(i * Dim, Dim); for (int j = 0;j < v.length();j++) { CodeBookFile.operator << (v[j]); if (j < v.length() - 1) CodeBookFile.put(' ') ; } CodeBookFile << endl ; } CodeBookFile.close(); } void Vector_Quantizer::modify_codevector(int no, double mul, const vec &add) { int pos = Dim * no; for (int i = 0;i < Dim;i++) { CodeBook._elem(pos + i) *= mul; CodeBook._elem(pos + i) += add[i]; } } vec Vector_Quantizer::get_codevector(int Index) const { return CodeBook.mid(Index*Dim, Dim); } void Vector_Quantizer::set_codevector(int Index, const vec &v) { it_error_if(Dim != length(v), "Vector_Quantizer::set_codevector : Wrong dimension"); for (int i = 0;i < length(v);i++) { CodeBook._elem(Index*Dim + i) = v._elem(i); } } void Vector_Quantizer::set_codebook(const mat &CB) { Size = CB.cols(); Dim = CB.rows(); CodeBook.set_length(Size*Dim); for (int i = 0;i < Size;i++) { for (int j = 0;j < Dim;j++) { CodeBook(i*Dim + j) = CB(j, i); } } } mat Vector_Quantizer::get_codebook() const { mat CB(Dim, Size); for (int i = 0;i < Size;i++) { for (int j = 0;i < Dim;i++) { CB(j, i) = CodeBook(i * Dim + j); } } return CB; } //-------------------------------------------------------------------- // class SQ //-------------------------------------------------------------------- Scalar_Quantizer::Scalar_Quantizer() { } // SQ(const char *Name); int Scalar_Quantizer::encode(double x) const { int il = 0, ih = Levels.length() - 1, im; while (il < ih - 1) { im = (il + ih) / 2; if (x < Levels(im)) ih = im; else il = im; } if (Levels(ih) - x < x - Levels(il)) return ih; else return il; } ivec Scalar_Quantizer::encode(const vec &x) const { int i; ivec Index(x.length()); for (i = 0;i < x.length();i++) { Index(i) = encode(x(i)); } return Index; } vec Scalar_Quantizer::decode(const ivec &Index) const { int i; vec y(Index.length()); for (i = 0;i < Index.length();i++) { y(i) = decode(Index(i)); } return y; } vec Scalar_Quantizer::Q(const vec &x) const { int i; vec y(x.length()); for (i = 0;i < x.length();i++) { y(i) = Q(x(i)); } return y; } // void load(const char *Name); // void save(const char *Name) const; //------------------------------------------------------------------------- int scalar_encode(double x, vec &Levels) { int il = 0, ih = Levels.length() - 1, im; while (il < ih - 1) { im = (il + ih) / 2; if (x < Levels(im)) ih = im; else il = im; } if (Levels(ih) - x < x - Levels(il)) return ih; else return il; } ivec scalar_encode(vec &x, vec &Levels) { ivec ind(x.length()); for (int i = 0;i < x.length();i++) ind(i) = scalar_encode(x(i), Levels); return ind; } } // namespace itpp //! \endcond itpp-4.3.1/itpp/srccode/vq.h000066400000000000000000000145521216575753400157160ustar00rootroot00000000000000/*! * \file * \brief Definition of a vector quantizer class (unconstrained) * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef VQ_H #define VQ_H #include #include #include #include namespace itpp { /*! \addtogroup sourcecoding */ /*! \ingroup sourcecoding \brief Class for vector quantization The following code illustrates how the VQ can be initialized from a file and used to quantize a random vector. \code Vector_Quantizer Quantizer; vec x,y; int i; Quantizer.load("randomvq.vq"); x=randn(Quantizer.dim()); i=Quantizer.encode(x); y=Quantizer.decode(i); \endcode */ class ITPP_EXPORT Vector_Quantizer { public: //! Default constructor Vector_Quantizer(); //! Create a VQ from a VQ file Vector_Quantizer(const char *Name); //! Encode the input vector int encode(const vec &x); //! Encode the input vector, and return the num best indices ivec encode(const vec &x, int num); //! Decode the index vec decode(int Index) const; //! Decode the indices Array decode(const ivec &Index) const; //! Quantize the input vector vec Q(const vec &x); //! Quantize the input vector vec operator()(const vec &x); //! Initialize the codebook by a matrix void set_codebook(const mat &CB); //! Returns the codebook mat get_codebook() const; //! Set a codevector in the codebook void set_codevector(int Index, const vec &indata); //! Returns the codevector at the given index vec get_codevector(int Index) const; //! Rescale and translate a codevector void modify_codevector(int no, double mul, const vec &add); //! Returns the size (number of codevectors) of the VQ int size() const; //! Returns the dimension of the VQ int dim() const; //! Returns the number of bits of the VQ [log2(size)/dim] int nobits() const; /*! \brief Load the codebook from a file \param Name The name of the VQ file The file format is a textfile where each row is a vector from the codebook. */ void load(const char *Name); /*! \brief Save the codebook to a file \param Name The name of the VQ file The file format is a textfile where each row is a vector from the codebook. */ void save(const char *Name) const; //! Returns the distortion at the latest time a vector was encoded double latest_distortion(); protected: //! The vector containing the code book vec CodeBook; //! The size of the code book int Size; //! The dimension of the code book int Dim; //! The distortion at the latest time a vector was encoded double LatestDist; }; // INLINE FUNCTIONS inline int Vector_Quantizer::size() const { return Size; } inline int Vector_Quantizer::nobits() const { return levels2bits(Size); } inline int Vector_Quantizer::dim() const { return Dim; } inline double Vector_Quantizer::latest_distortion() { return LatestDist; } inline vec Vector_Quantizer::decode(int Index) const { return get_codevector(Index); } inline vec Vector_Quantizer::Q(const vec &x) { return decode(encode(x)); } inline vec Vector_Quantizer::operator()(const vec &x) { return Q(x); } /*! \ingroup sourcecoding \brief Class for vector quantization The following code illustrates how the quantizer can be initialized from a file and used to quantize a random vector. \code Scalar_Quantizer Quantizer; double x,y; int i; Quantizer.load("random.sq"); x=randn(); i=Quantizer.encode(x); y=Quantizer.decode(i); \endcode */ class ITPP_EXPORT Scalar_Quantizer { public: //! Default constructor Scalar_Quantizer(); //! Create a VQ from a VQ file Scalar_Quantizer(const char *Name); //! Encode int encode(double x) const; //! Encode the input vector ivec encode(const vec &x) const; //! Decode the index double decode(int Index) const; //! Decode the indices vec decode(const ivec &Index) const; //! Quantize double Q(double x) const; //! Quantize the input vector vec Q(const vec &x) const; //! Quantize double operator()(double x) const; //! Quantize the input vector vec operator()(const vec &x) const; //! Initialize the codebook by a matrix void set_levels(const vec &L); //! Returns the codebook vec get_levels() const; //! Returns the size (number of codevectors) of the VQ int size() const; protected: //! The vector containing the code book vec Levels; //! The distortion at the latest time a vector was encoded double LatestDist; }; inline int Scalar_Quantizer::size() const { return Levels.length(); } inline double Scalar_Quantizer::decode(int Index) const { return Levels(Index); } inline double Scalar_Quantizer::Q(double x) const { return decode(encode(x)); } inline double Scalar_Quantizer::operator()(double x) const { return Q(x); } inline vec Scalar_Quantizer::operator()(const vec &x) const { return Q(x); } inline void Scalar_Quantizer::set_levels(const vec &L) {Levels = L;sort(Levels); } inline vec Scalar_Quantizer::get_levels() const {return Levels; } //! ADD DOCUMENTATION HERE ITPP_EXPORT int scalar_encode(double x, vec &Levels) ; //! ADD DOCUMENTATION HERE ITPP_EXPORT ivec scalar_encode(vec &x, vec &Levels); //! ADD DOCUMENTATION HERE inline double scalar_quantize(double x, vec &Levels) { return Levels(scalar_encode(x, Levels)); } //! ADD DOCUMENTATION HERE inline vec scalar_quantize(vec &x, vec &Levels) { return Levels(scalar_encode(x, Levels)); } } // namespace itpp #endif // #ifndef VQ_H itpp-4.3.1/itpp/srccode/vqtrain.cpp000066400000000000000000000160051216575753400173020ustar00rootroot00000000000000/*! * \file * \brief Implementation of a vector quantizer training functions * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include //! \cond namespace itpp { // the cols contains codevectors double kmeansiter(Array &DB, mat &codebook) { int DIM = DB(0).length(), SIZE = codebook.cols(), T = DB.length(); vec x, xnum(SIZE); mat xsum(DIM, SIZE); int MinIndex, i, j, k; double MinS, S, D, *xp, *cp; xsum.clear(); xnum.clear(); D = 1E20; D = 0; for (k = 0;k < T;k++) { x = DB(k); xp = x._data(); MinS = 1E20; MinIndex = 0; for (i = 0;i < SIZE;i++) { cp = &codebook(0, i); S = sqr(xp[0] - cp[0]); for (j = 1;j < DIM;j++) { S += sqr(xp[j] - cp[j]); if (S >= MinS) goto sune; } MinS = S; MinIndex = i; sune: void(); } D += MinS; cp = &xsum(0, MinIndex); for (j = 0;j < DIM;j++) { cp[j] += xp[j]; } xnum(MinIndex)++; } for (i = 0;i < SIZE;i++) { for (j = 0;j < DIM;j++) { codebook(j, i) = xsum(j, i) / xnum(i); } } return D; } mat kmeans(Array &DB, int SIZE, int NOITER, bool VERBOSE) { int DIM = DB(0).length(), T = DB.length(); mat codebook(DIM, SIZE); int n, i, j; double D, Dold; ivec ind(SIZE); for (i = 0;i < SIZE;i++) { ind(i) = randi(0, T - 1); j = 0; while (j < i) { if (ind(j) == ind(i)) { ind(i) = randi(0, T - 1); j = 0; } j++; } codebook.set_col(i, DB(ind(i))); } if (VERBOSE) std::cout << "Training VQ..." << std::endl ; D = 1E20; for (n = 0;n < NOITER;n++) { Dold = D; D = kmeansiter(DB, codebook); if (VERBOSE) std::cout << n << ": " << D / T << " "; if (std::abs((D - Dold) / D) < 1e-4) break; } return codebook; } mat lbg(Array &DB, int SIZE, int NOITER, bool VERBOSE) { int S = 1, DIM = DB(0).length(), T = DB.length(), i, n; mat cb; vec delta = 0.001 * randn(DIM), x; double D, Dold; x = zeros(DIM); for (i = 0;i < T;i++) { x += DB(i); } x /= T; cb.set_size(DIM, 1); cb.set_col(0, x); while (cb.cols() < SIZE) { S = cb.cols(); if (2*S <= SIZE) cb.set_size(DIM, 2*S, true); else cb.set_size(DIM, 2*S, true); for (i = S;i < cb.cols();i++) { cb.set_col(i, cb.get_col(i - S) + delta); } D = 1E20; for (n = 0;n < NOITER;n++) { Dold = D; D = kmeansiter(DB, cb); if (VERBOSE) std::cout << n << ": " << D / T << " "; if (std::abs((D - Dold) / D) < 1e-4) break; } } return cb; } mat vqtrain(Array &DB, int SIZE, int NOITER, double STARTSTEP, bool VERBOSE) { int DIM = DB(0).length(); vec x; vec codebook(DIM*SIZE); int n, MinIndex, i, j; double MinS, S, D, step, *xp, *cp; for (i = 0;i < SIZE;i++) { codebook.replace_mid(i*DIM, DB(randi(0, DB.length() - 1))); } if (VERBOSE) std::cout << "Training VQ..." << std::endl ; res: D = 0; for (n = 0;n < NOITER;n++) { step = STARTSTEP * (1.0 - double(n) / NOITER); if (step < 0) step = 0; x = DB(randi(0, DB.length() - 1)); // seems unnecessary! Check it up. xp = x._data(); MinS = 1E20; MinIndex = 0; for (i = 0;i < SIZE;i++) { cp = &codebook(i * DIM); S = sqr(xp[0] - cp[0]); for (j = 1;j < DIM;j++) { S += sqr(xp[j] - cp[j]); if (S >= MinS) goto sune; } MinS = S; MinIndex = i; sune: i = i; } D += MinS; cp = &codebook(MinIndex * DIM); for (j = 0;j < DIM;j++) { cp[j] += step * (xp[j] - cp[j]); } if ((n % 20000 == 0) && (n > 1)) { if (VERBOSE) std::cout << n << ": " << D / 20000 << " "; D = 0; } } // checking training result vec dist(SIZE), num(SIZE); dist.clear(); num.clear(); for (n = 0;n < DB.length();n++) { x = DB(n); xp = x._data(); MinS = 1E20; MinIndex = 0; for (i = 0;i < SIZE;i++) { cp = &codebook(i * DIM); S = sqr(xp[0] - cp[0]); for (j = 1;j < DIM;j++) { S += sqr(xp[j] - cp[j]); if (S >= MinS) goto sune2; } MinS = S; MinIndex = i; sune2: i = i; } dist(MinIndex) += MinS; num(MinIndex) += 1; } dist = 10 * log10(dist * dist.length() / sum(dist)); if (VERBOSE) std::cout << std::endl << "Distortion contribution: " << dist << std::endl ; if (VERBOSE) std::cout << "Num spread: " << num / DB.length()*100 << " %" << std::endl << std::endl ; if (min(dist) < -30) { std::cout << "Points without entries! Retraining" << std::endl ; j = min_index(dist); i = max_index(num); codebook.replace_mid(j*DIM, codebook.mid(i*DIM, DIM)); goto res; } mat cb(DIM, SIZE); for (i = 0;i < SIZE;i++) { cb.set_col(i, codebook.mid(i*DIM, DIM)); } return cb; } vec sqtrain(const vec &inDB, int SIZE) { vec DB(inDB); vec Levels, Levels_old; ivec indexlist(SIZE + 1); int il, im, ih, i; int SIZEDB = inDB.length(); double x; sort(DB); Levels = DB(round_i(linspace(0.01 * SIZEDB, 0.99 * SIZEDB, SIZE))); Levels_old = zeros(SIZE); while (energy(Levels - Levels_old) > 0.0001) { Levels_old = Levels; for (i = 0;i < SIZE - 1;i++) { x = (Levels(i) + Levels(i + 1)) / 2; il = 0; ih = SIZEDB - 1; while (il < ih - 1) { im = (il + ih) / 2; if (x < DB(im)) ih = im; else il = im; } indexlist(i + 1) = il; } indexlist(0) = -1; indexlist(SIZE) = SIZEDB - 1; for (i = 0;i < SIZE;i++) Levels(i) = mean(DB(indexlist(i) + 1, indexlist(i + 1))); } return Levels; } ivec bitalloc(const vec &variances, int nobits) { ivec bitvec(variances.length()); bitvec.clear(); int i, bits = nobits; vec var = variances; while (bits > 0) { i = max_index(var); var(i) /= 4; bitvec(i)++; bits--; } return bitvec; } } // namespace itpp //! \endcond itpp-4.3.1/itpp/srccode/vqtrain.h000066400000000000000000000043451216575753400167530ustar00rootroot00000000000000/*! * \file * \brief Definitions of a vector quantizer training functions * \author Thomas Eriksson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef VQTRAIN_H #define VQTRAIN_H #include #include #include #include namespace itpp { //! ADD DOCUMENTATION HERE ITPP_EXPORT double kmeansiter(Array &DB, mat &codebook); //! ADD DOCUMENTATION HERE ITPP_EXPORT mat kmeans(Array &DB, int SIZE, int NOITER = 9999, bool VERBOSE = true); //! ADD DOCUMENTATION HERE ITPP_EXPORT mat lbg(Array &DB, int SIZE, int NOITER = 9999, bool VERBOSE = true); /*! \ingroup sourcecoding \brief Function for vector quantization training The following code illustrates how the VQ can be trained. \code VQ Quantizer; mat A; Array database; // read vectors into database somehow ... // train a vq A = vqtrain(database, 1024, 1000000); Quantizer.set_codebook(A); \endcode */ ITPP_EXPORT mat vqtrain(Array &DB, int SIZE, int NOITER, double STARTSTEP = 0.2, bool VERBOSE = true); //! ADD DOCUMENTATION HERE ITPP_EXPORT vec sqtrain(const vec &inDB, int SIZE); //! ADD DOCUMENTATION HERE ITPP_EXPORT ivec bitalloc(const vec& variances, int nobits); } // namespace itpp #endif // #ifndef VQTRAIN_H itpp-4.3.1/itpp/stat/000077500000000000000000000000001216575753400144415ustar00rootroot00000000000000itpp-4.3.1/itpp/stat/Makefile.am000066400000000000000000000007121216575753400164750ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk noinst_LTLIBRARIES = libstat.la if ENABLE_DEBUG noinst_LTLIBRARIES += libstat_debug.la endif libstat_la_SOURCES = $(h_stat_sources) $(cpp_stat_sources) libstat_la_CXXFLAGS = $(CXXFLAGS_OPT) libstat_debug_la_SOURCES = $(h_stat_sources) $(cpp_stat_sources) libstat_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkgincludedir = $(includedir)/@PACKAGE@/stat pkginclude_HEADERS = $(h_stat_sources) itpp-4.3.1/itpp/stat/Makefile.in000066400000000000000000000773721216575753400165260ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/sources.mk \ $(top_srcdir)/Makefile.common @ENABLE_DEBUG_TRUE@am__append_1 = libstat_debug.la subdir = itpp/stat ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libstat_la_LIBADD = am__objects_1 = am__objects_2 = libstat_la-misc_stat.lo libstat_la-mog_diag.lo \ libstat_la-mog_diag_em.lo libstat_la-mog_diag_kmeans.lo \ libstat_la-mog_generic.lo am_libstat_la_OBJECTS = $(am__objects_1) $(am__objects_2) libstat_la_OBJECTS = $(am_libstat_la_OBJECTS) libstat_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libstat_la_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libstat_debug_la_LIBADD = am__objects_3 = libstat_debug_la-misc_stat.lo \ libstat_debug_la-mog_diag.lo libstat_debug_la-mog_diag_em.lo \ libstat_debug_la-mog_diag_kmeans.lo \ libstat_debug_la-mog_generic.lo am_libstat_debug_la_OBJECTS = $(am__objects_1) $(am__objects_3) libstat_debug_la_OBJECTS = $(am_libstat_debug_la_OBJECTS) libstat_debug_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_DEBUG_TRUE@am_libstat_debug_la_rpath = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libstat_la_SOURCES) $(libstat_debug_la_SOURCES) DIST_SOURCES = $(libstat_la_SOURCES) $(libstat_debug_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/@PACKAGE@/stat ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) h_stat_sources = \ $(top_srcdir)/itpp/stat/histogram.h \ $(top_srcdir)/itpp/stat/misc_stat.h \ $(top_srcdir)/itpp/stat/mog_diag.h \ $(top_srcdir)/itpp/stat/mog_diag_em.h \ $(top_srcdir)/itpp/stat/mog_diag_kmeans.h \ $(top_srcdir)/itpp/stat/mog_generic.h cpp_stat_sources = \ $(top_srcdir)/itpp/stat/misc_stat.cpp \ $(top_srcdir)/itpp/stat/mog_diag.cpp \ $(top_srcdir)/itpp/stat/mog_diag_em.cpp \ $(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp \ $(top_srcdir)/itpp/stat/mog_generic.cpp noinst_LTLIBRARIES = libstat.la $(am__append_1) libstat_la_SOURCES = $(h_stat_sources) $(cpp_stat_sources) libstat_la_CXXFLAGS = $(CXXFLAGS_OPT) libstat_debug_la_SOURCES = $(h_stat_sources) $(cpp_stat_sources) libstat_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) pkginclude_HEADERS = $(h_stat_sources) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(srcdir)/sources.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu itpp/stat/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu itpp/stat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libstat.la: $(libstat_la_OBJECTS) $(libstat_la_DEPENDENCIES) $(libstat_la_LINK) $(libstat_la_OBJECTS) $(libstat_la_LIBADD) $(LIBS) libstat_debug.la: $(libstat_debug_la_OBJECTS) $(libstat_debug_la_DEPENDENCIES) $(libstat_debug_la_LINK) $(am_libstat_debug_la_rpath) $(libstat_debug_la_OBJECTS) $(libstat_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_debug_la-misc_stat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_debug_la-mog_diag.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_debug_la-mog_diag_em.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_debug_la-mog_diag_kmeans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_debug_la-mog_generic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_la-misc_stat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_la-mog_diag.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_la-mog_diag_em.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_la-mog_diag_kmeans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstat_la-mog_generic.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< libstat_la-misc_stat.lo: $(top_srcdir)/itpp/stat/misc_stat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_la-misc_stat.lo -MD -MP -MF $(DEPDIR)/libstat_la-misc_stat.Tpo -c -o libstat_la-misc_stat.lo `test -f '$(top_srcdir)/itpp/stat/misc_stat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/misc_stat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_la-misc_stat.Tpo $(DEPDIR)/libstat_la-misc_stat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/misc_stat.cpp' object='libstat_la-misc_stat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_la-misc_stat.lo `test -f '$(top_srcdir)/itpp/stat/misc_stat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/misc_stat.cpp libstat_la-mog_diag.lo: $(top_srcdir)/itpp/stat/mog_diag.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_la-mog_diag.lo -MD -MP -MF $(DEPDIR)/libstat_la-mog_diag.Tpo -c -o libstat_la-mog_diag.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_la-mog_diag.Tpo $(DEPDIR)/libstat_la-mog_diag.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_diag.cpp' object='libstat_la-mog_diag.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_la-mog_diag.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag.cpp libstat_la-mog_diag_em.lo: $(top_srcdir)/itpp/stat/mog_diag_em.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_la-mog_diag_em.lo -MD -MP -MF $(DEPDIR)/libstat_la-mog_diag_em.Tpo -c -o libstat_la-mog_diag_em.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_em.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_em.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_la-mog_diag_em.Tpo $(DEPDIR)/libstat_la-mog_diag_em.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_diag_em.cpp' object='libstat_la-mog_diag_em.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_la-mog_diag_em.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_em.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_em.cpp libstat_la-mog_diag_kmeans.lo: $(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_la-mog_diag_kmeans.lo -MD -MP -MF $(DEPDIR)/libstat_la-mog_diag_kmeans.Tpo -c -o libstat_la-mog_diag_kmeans.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_la-mog_diag_kmeans.Tpo $(DEPDIR)/libstat_la-mog_diag_kmeans.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp' object='libstat_la-mog_diag_kmeans.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_la-mog_diag_kmeans.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp libstat_la-mog_generic.lo: $(top_srcdir)/itpp/stat/mog_generic.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_la-mog_generic.lo -MD -MP -MF $(DEPDIR)/libstat_la-mog_generic.Tpo -c -o libstat_la-mog_generic.lo `test -f '$(top_srcdir)/itpp/stat/mog_generic.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_generic.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_la-mog_generic.Tpo $(DEPDIR)/libstat_la-mog_generic.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_generic.cpp' object='libstat_la-mog_generic.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_la-mog_generic.lo `test -f '$(top_srcdir)/itpp/stat/mog_generic.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_generic.cpp libstat_debug_la-misc_stat.lo: $(top_srcdir)/itpp/stat/misc_stat.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_debug_la-misc_stat.lo -MD -MP -MF $(DEPDIR)/libstat_debug_la-misc_stat.Tpo -c -o libstat_debug_la-misc_stat.lo `test -f '$(top_srcdir)/itpp/stat/misc_stat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/misc_stat.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_debug_la-misc_stat.Tpo $(DEPDIR)/libstat_debug_la-misc_stat.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/misc_stat.cpp' object='libstat_debug_la-misc_stat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_debug_la-misc_stat.lo `test -f '$(top_srcdir)/itpp/stat/misc_stat.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/misc_stat.cpp libstat_debug_la-mog_diag.lo: $(top_srcdir)/itpp/stat/mog_diag.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_debug_la-mog_diag.lo -MD -MP -MF $(DEPDIR)/libstat_debug_la-mog_diag.Tpo -c -o libstat_debug_la-mog_diag.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_debug_la-mog_diag.Tpo $(DEPDIR)/libstat_debug_la-mog_diag.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_diag.cpp' object='libstat_debug_la-mog_diag.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_debug_la-mog_diag.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag.cpp libstat_debug_la-mog_diag_em.lo: $(top_srcdir)/itpp/stat/mog_diag_em.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_debug_la-mog_diag_em.lo -MD -MP -MF $(DEPDIR)/libstat_debug_la-mog_diag_em.Tpo -c -o libstat_debug_la-mog_diag_em.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_em.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_em.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_debug_la-mog_diag_em.Tpo $(DEPDIR)/libstat_debug_la-mog_diag_em.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_diag_em.cpp' object='libstat_debug_la-mog_diag_em.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_debug_la-mog_diag_em.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_em.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_em.cpp libstat_debug_la-mog_diag_kmeans.lo: $(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_debug_la-mog_diag_kmeans.lo -MD -MP -MF $(DEPDIR)/libstat_debug_la-mog_diag_kmeans.Tpo -c -o libstat_debug_la-mog_diag_kmeans.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_debug_la-mog_diag_kmeans.Tpo $(DEPDIR)/libstat_debug_la-mog_diag_kmeans.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp' object='libstat_debug_la-mog_diag_kmeans.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_debug_la-mog_diag_kmeans.lo `test -f '$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp libstat_debug_la-mog_generic.lo: $(top_srcdir)/itpp/stat/mog_generic.cpp @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -MT libstat_debug_la-mog_generic.lo -MD -MP -MF $(DEPDIR)/libstat_debug_la-mog_generic.Tpo -c -o libstat_debug_la-mog_generic.lo `test -f '$(top_srcdir)/itpp/stat/mog_generic.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_generic.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libstat_debug_la-mog_generic.Tpo $(DEPDIR)/libstat_debug_la-mog_generic.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(top_srcdir)/itpp/stat/mog_generic.cpp' object='libstat_debug_la-mog_generic.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstat_debug_la_CXXFLAGS) $(CXXFLAGS) -c -o libstat_debug_la-mog_generic.lo `test -f '$(top_srcdir)/itpp/stat/mog_generic.cpp' || echo '$(srcdir)/'`$(top_srcdir)/itpp/stat/mog_generic.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgincludeHEADERS \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkgincludeHEADERS @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/itpp/stat/histogram.h000066400000000000000000000142441216575753400166140ustar00rootroot00000000000000/*! * \file * \brief Histogram class - header file * \author Andy Panov and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef HISTOGRAM_H #define HISTOGRAM_H #include namespace itpp { //! \addtogroup histogram //!@{ /*! \brief Histogram computation class \author Andy Panov The Histogram class counts the number of observations of arbitrary numerical types that fall into specified bins. Centers of the leftmost and rightmost bin along with a total number of bins are passed to a histogram object as constructor parameters. Histogram counters are updated when calling update() method. It is possible to access bin counters and bin interval parameters for all bins at once or separately for each bin. Example: \code // Create histogram with 100 bins spanning from 0 to 99 (leftmost bin is // centered at 0, rightmost bin is centerd at 99). Histogram hist(0, 99, 100); // Compute histogram of 100 random variables taken from normal distribution hist.update(randn(100)); // Get position of bin number 5 double bin5_center = hist.get_bin_center(5); // Get corresponding bin counter int bin5_counter = hist.get_bin(5); // Get bin 5 left boundary: double bin5_left = hist.get_bin_left(5); // compute PDF & CDF of experimental data vec my_data_pdf = hist.get_pdf(); vec my_data_cdf = hist.get_cdf(); \endcode */ template class Histogram { public: //! Default constructor. Constructs histogram with 100 bins spanning //! values from 0 to 99 by default. Histogram(Num_T from = Num_T(0), Num_T to = Num_T(99), int n_bins = 100); //! Default destructor ~Histogram() {}; //! Histogram setup void setup(Num_T from, Num_T to, int n_bins); //! Histogram update void update(Num_T value); //! Histogram update void update(Vec values); //! Histogram update void update(Mat values); //! Bins reset, so accumulation can be restarted void reset() { trials_cnt = 0; bins.zeros(); }; //! Access to single bin counter int get_bin(int ix) const { return bins(ix); }; //! Access to histogram as a vector ivec get_bins() const { return bins; }; //! Access to bin center values (all bins) Vec get_bin_centers() const { return center_vals; }; //! Access to bin center (single bin) Num_T get_bin_center(int ix) const { return center_vals(ix); }; //! Access to left boundary of bin intervals (all bins) Vec get_bin_lefts() const { return lo_vals; }; //! Access to left boundary of single bin Num_T get_bin_left(int ix) const { return lo_vals(ix); }; //! Access to right boundary of bin intervals (all bins) Vec get_bin_rights() const { return hi_vals; }; //! Access to right boundary of single bin Num_T get_bin_right(int ix) const { return hi_vals(ix); }; //! Experimental Probability Density Function (PDF) computation vec get_pdf() const; //! Experimental Cumulative Density Function (CDF) computation vec get_cdf() const; //! Current number of bins int bins_num() const { return num_bins; }; //! Current trials counter int trials_num() const {return trials_cnt;}; private: //! Number of bins int num_bins; //! Step between bins Num_T step; //! Low boundaries of histogram bins Vec lo_vals; //! Upper boundaries of histogram bins Vec hi_vals; //! Bin centers Vec center_vals; //! Bins storage ivec bins; //! Number of processed samples int trials_cnt; }; template inline Histogram::Histogram(Num_T from, Num_T to, int n_bins) { setup(from, to, n_bins); } template inline void Histogram::setup(Num_T from, Num_T to, int n_bins) { num_bins = n_bins; lo_vals.set_size(n_bins); hi_vals.set_size(n_bins); center_vals.set_size(n_bins); bins.set_size(n_bins); trials_cnt = 0; step = (to - from) / (num_bins - 1); center_vals = linspace(from, to, num_bins); lo_vals = center_vals - step / 2; hi_vals = center_vals + step / 2; reset(); } template inline void Histogram::update(Num_T value) { // search for the corresponding bin using dichotomy approach int start = 0; int end = num_bins - 1; int test = (start + end) / 2; while (start < end) { if (value < lo_vals(test)) end = test - 1; else if (value >= hi_vals(test)) start = test + 1; else break; test = (start + end) / 2; }; bins(test)++; trials_cnt++; } template inline void Histogram::update(Vec values) { for (int i = 0; i < values.length(); i++) update(values(i)); } template inline void Histogram::update(Mat values) { for (int i = 0; i < values.rows(); i++) for (int j = 0; j < values.cols(); j++) update(values(i, j)); } template inline vec Histogram::get_pdf() const { vec pdf(num_bins); for (int j = 0; j < num_bins; j++) pdf(j) = static_cast(bins(j)) / trials_cnt; return pdf; } template inline vec Histogram::get_cdf() const { ivec tmp = cumsum(bins); vec cdf(num_bins); for (int j = 0; j < num_bins; j++) cdf(j) = static_cast(tmp(j)) / trials_cnt; return cdf; } //!@} } // namespace itpp #endif // #ifndef HISTOGRAM_H itpp-4.3.1/itpp/stat/misc_stat.cpp000066400000000000000000000120251216575753400171330ustar00rootroot00000000000000/*! * \file * \brief Miscellaneous statistics functions and classes - source file * \author Tony Ottosson, Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { double mean(const vec &v) { return sum(v) / v.length(); } std::complex mean(const cvec &v) { return sum(v) / double(v.size()); } double mean(const svec &v) { return (double)sum(v) / v.length(); } double mean(const ivec &v) { return (double)sum(v) / v.length(); } double mean(const mat &m) { return sum(sum(m)) / (m.rows()*m.cols()); } std::complex mean(const cmat &m) { return sum(sum(m)) / static_cast >(m.rows()*m.cols()); } double mean(const smat &m) { return static_cast(sum(sum(m))) / (m.rows()*m.cols()); } double mean(const imat &m) { return static_cast(sum(sum(m))) / (m.rows()*m.cols()); } double norm(const cvec &v) { double E = 0.0; for (int i = 0; i < v.length(); i++) E += std::norm(v[i]); return std::sqrt(E); } double norm(const cvec &v, int p) { double E = 0.0; for (int i = 0; i < v.size(); i++) E += std::pow(std::norm(v[i]), p / 2.0); // Yes, 2.0 is correct! return std::pow(E, 1.0 / p); } double norm(const cvec &v, const std::string &) { return norm(v, 2); } /* * Calculate the p-norm of a real matrix * p = 1: max(svd(m)) * p = 2: max(sum(abs(X))) */ double norm(const mat &m, int p) { it_assert((p == 1) || (p == 2), "norm(): Can only calculate a matrix norm of order 1 or 2"); if (p == 1) return max(sum(abs(m))); else return max(svd(m)); } /* * Calculate the p-norm of a complex matrix * p = 1: max(svd(m)) * p = 2: max(sum(abs(X))) */ double norm(const cmat &m, int p) { it_assert((p == 1) || (p == 2), "norm(): Can only calculate a matrix norm of order 1 or 2"); if (p == 1) return max(sum(abs(m))); else return max(svd(m)); } // Calculate the Frobenius norm of matrix m for s = "fro" double norm(const mat &m, const std::string &s) { it_assert(s == "fro", "norm(): Unrecognised norm"); double E = 0.0; for (int r = 0; r < m.rows(); ++r) { for (int c = 0; c < m.cols(); ++c) { E += m(r, c) * m(r, c); } } return std::sqrt(E); } // Calculate the Frobenius norm of matrix m for s = "fro" double norm(const cmat &m, const std::string &s) { it_assert(s == "fro", "norm(): Unrecognised norm"); double E = 0.0; for (int r = 0; r < m.rows(); ++r) { for (int c = 0; c < m.cols(); ++c) { E += std::norm(m(r, c)); } } return std::sqrt(E); } double variance(const cvec &v) { int len = v.size(); double sq_sum = 0.0; std::complex sum = 0.0; const std::complex *p = v._data(); for (int i = 0; i < len; i++, p++) { sum += *p; sq_sum += std::norm(*p); } return (double)(sq_sum - std::norm(sum) / len) / (len - 1); } double moment(const vec &x, const int r) { double m = mean(x), mr = 0; int n = x.size(); double temp; switch (r) { case 1: for (int j = 0; j < n; j++) mr += (x(j) - m); break; case 2: for (int j = 0; j < n; j++) mr += (x(j) - m) * (x(j) - m); break; case 3: for (int j = 0; j < n; j++) mr += (x(j) - m) * (x(j) - m) * (x(j) - m); break; case 4: for (int j = 0; j < n; j++) { temp = (x(j) - m) * (x(j) - m); temp *= temp; mr += temp; } break; default: for (int j = 0; j < n; j++) mr += std::pow(x(j) - m, double(r)); break; } return mr / n; } double skewness(const vec &x) { int n = x.size(); double k2 = variance(x) * n / (n - 1); // 2nd k-statistic double k3 = moment(x, 3) * n * n / (n - 1) / (n - 2); //3rd k-statistic return k3 / std::pow(k2, 3.0 / 2.0); } double kurtosisexcess(const vec &x) { int n = x.size(); double m2 = variance(x); double m4 = moment(x, 4); double k2 = m2 * n / (n - 1); // 2nd k-statistic double k4 = (m4 * (n + 1) - 3 * (n - 1) * m2 * m2) * n * n / (n - 1) / (n - 2) / (n - 3); //4th k-statistic return k4 / (k2*k2); } } // namespace itpp itpp-4.3.1/itpp/stat/misc_stat.h000066400000000000000000000244241216575753400166060ustar00rootroot00000000000000/*! * \file * \brief Miscellaneous statistics functions and classes - header file * \author Tony Ottosson, Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MISC_STAT_H #define MISC_STAT_H #include #include #include #include #include namespace itpp { //! \addtogroup statistics //!@{ /*! \brief A class for sampling a signal and calculating statistics */ class ITPP_EXPORT Stat { public: //! Default constructor Stat() {clear();} //! Destructor virtual ~Stat() {} //! Clear statistics virtual void clear() { _n_overflows = 0; _n_samples = 0; _n_zeros = 0; _max = 0.0; _min = 0.0; _sqr_sum = 0.0; _sum = 0.0; } //! Register a sample and flag for overflow virtual void sample(const double s, const bool overflow = false) { _n_samples++; _sum += s; _sqr_sum += s * s; if (s < _min) _min = s; if (s > _max) _max = s; if (overflow) _n_overflows++; if (s == 0.0) _n_zeros++; } //! Number of reported overflows int n_overflows() const {return _n_overflows;} //! Number of samples int n_samples() const {return _n_samples;} //! Number of zero samples int n_zeros() const {return _n_zeros;} //! Average over all samples double avg() const {return _sum / _n_samples;} //! Maximum sample double max() const {return _max;} //! Minimum sample double min() const {return _min;} //! Standard deviation of all samples double sigma() const { double sigma2 = _sqr_sum / _n_samples - avg() * avg(); return std::sqrt(sigma2 < 0 ? 0 : sigma2); } //! Squared sum of all samples double sqr_sum() const {return _sqr_sum;} //! Sum of all samples double sum() const {return _sum;} //! Histogram over all samples (not implemented yet) vec histogram() const {return vec(0);} protected: //! Number of reported overflows int _n_overflows; //! Number of samples int _n_samples; //! Number of zero samples int _n_zeros; //! Maximum sample double _max; //! Minimum sample double _min; //! Squared sum of all samples double _sqr_sum; //! Sum of all samples double _sum; }; //! The mean value ITPP_EXPORT double mean(const vec &v); //! The mean value ITPP_EXPORT std::complex mean(const cvec &v); //! The mean value ITPP_EXPORT double mean(const svec &v); //! The mean value ITPP_EXPORT double mean(const ivec &v); //! The mean value ITPP_EXPORT double mean(const mat &m); //! The mean value ITPP_EXPORT std::complex mean(const cmat &m); //! The mean value ITPP_EXPORT double mean(const smat &m); //! The mean value ITPP_EXPORT double mean(const imat &m); //! The geometric mean of a vector template double geometric_mean(const Vec &v) { return std::exp(std::log(static_cast(prod(v))) / v.length()); } //! The geometric mean of a matrix template double geometric_mean(const Mat &m) { return std::exp(std::log(static_cast(prod(prod(m)))) / (m.rows() * m.cols())); } //! The median template double median(const Vec &v) { Vec invect(v); sort(invect); return (double)(invect[(invect.length()-1)/2] + invect[invect.length()/2]) / 2.0; } //! Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2)) ITPP_EXPORT double norm(const cvec &v); //! Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2)) template double norm(const Vec &v) { double E = 0.0; for (int i = 0; i < v.size(); i++) E += sqr(static_cast(v[i])); return std::sqrt(E); } //! Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p) ITPP_EXPORT double norm(const cvec &v, int p); //! Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p) template double norm(const Vec &v, int p) { double E = 0.0; for (int i = 0; i < v.size(); i++) E += std::pow(fabs(static_cast(v[i])), static_cast(p)); return std::pow(E, 1.0 / p); } //! Calculate the Frobenius norm for s = "fro" (equal to 2-norm) ITPP_EXPORT double norm(const cvec &v, const std::string &s); //! Calculate the Frobenius norm for s = "fro" (equal to 2-norm) template double norm(const Vec &v, const std::string &s) { it_assert(s == "fro", "norm(): Unrecognised norm"); double E = 0.0; for (int i = 0; i < v.size(); i++) E += sqr(static_cast(v[i])); return std::sqrt(E); } /*! * Calculate the p-norm of a real matrix * * p = 1: max(svd(m)) * p = 2: max(sum(abs(X))) * * Default if no p is given is the 2-norm */ ITPP_EXPORT double norm(const mat &m, int p = 2); /*! * Calculate the p-norm of a complex matrix * * p = 1: max(svd(m)) * p = 2: max(sum(abs(X))) * * Default if no p is given is the 2-norm */ ITPP_EXPORT double norm(const cmat &m, int p = 2); //! Calculate the Frobenius norm of a matrix for s = "fro" ITPP_EXPORT double norm(const mat &m, const std::string &s); //! Calculate the Frobenius norm of a matrix for s = "fro" ITPP_EXPORT double norm(const cmat &m, const std::string &s); //! The variance of the elements in the vector. Normalized with N-1 to be unbiased. ITPP_EXPORT double variance(const cvec &v); //! The variance of the elements in the vector. Normalized with N-1 to be unbiased. template double variance(const Vec &v) { int len = v.size(); const T *p = v._data(); double sum = 0.0, sq_sum = 0.0; for (int i = 0; i < len; i++, p++) { sum += *p; sq_sum += *p * *p; } return (double)(sq_sum - sum*sum / len) / (len - 1); } //! Calculate the energy: squared 2-norm. energy(v)=sum(abs(v).^2) template double energy(const Vec &v) { return sqr(norm(v)); } //! Return true if the input value \c x is within the tolerance \c tol of the reference value \c xref inline bool within_tolerance(double x, double xref, double tol = 1e-14) { return (fabs(x -xref) <= tol) ? true : false; } //! Return true if the input value \c x is within the tolerance \c tol of the reference value \c xref inline bool within_tolerance(std::complex x, std::complex xref, double tol = 1e-14) { return (abs(x -xref) <= tol) ? true : false; } //! Return true if the input vector \c x is elementwise within the tolerance \c tol of the reference vector \c xref inline bool within_tolerance(const vec &x, const vec &xref, double tol = 1e-14) { return (max(abs(x -xref)) <= tol) ? true : false; } //! Return true if the input vector \c x is elementwise within the tolerance \c tol of the reference vector \c xref inline bool within_tolerance(const cvec &x, const cvec &xref, double tol = 1e-14) { return (max(abs(x -xref)) <= tol) ? true : false; } //! Return true if the input matrix \c X is elementwise within the tolerance \c tol of the reference matrix \c Xref inline bool within_tolerance(const mat &X, const mat &Xref, double tol = 1e-14) { return (max(max(abs(X -Xref))) <= tol) ? true : false; } //! Return true if the input matrix \c X is elementwise within the tolerance \c tol of the reference matrix \c Xref inline bool within_tolerance(const cmat &X, const cmat &Xref, double tol = 1e-14) { return (max(max(abs(X -Xref))) <= tol) ? true : false; } /*! \brief Calculate the central moment of vector x The \f$r\f$th sample central moment of the samples in the vector \f$ \mathbf{x} \f$ is defined as \f[ m_r = \mathrm{E}[x-\mu]^r = \frac{1}{n} \sum_{i=0}^{n-1} (x_i - \mu)^r \f] where \f$\mu\f$ is the sample mean. */ ITPP_EXPORT double moment(const vec &x, const int r); /*! \brief Calculate the skewness excess of the input vector x The skewness is a measure of the degree of asymmetry of distribution. Negative skewness means that the distribution is spread more to the left of the mean than to the right, and vice versa if the skewness is positive. The skewness of the samples in the vector \f$ \mathbf{x} \f$ is \f[ \gamma_1 = \frac{\mathrm{E}[x-\mu]^3}{\sigma^3} \f] where \f$\mu\f$ is the mean and \f$\sigma\f$ the standard deviation. The skewness is estimated as \f[ \gamma_1 = \frac{k_3}{{k_2}^{3/2}} \f] where \f[ k_2 = \frac{n}{n-1} m_2 \f] and \f[ k_3 = \frac{n^2}{(n-1)(n-2)} m_3 \f] Here \f$m_2\f$ is the sample variance and \f$m_3\f$ is the 3rd sample central moment. */ ITPP_EXPORT double skewness(const vec &x); /*! \brief Calculate the kurtosis excess of the input vector x The kurtosis excess is a measure of peakedness of a distribution. The kurtosis excess is defined as \f[ \gamma_2 = \frac{\mathrm{E}[x-\mu]^4}{\sigma^4} - 3 \f] where \f$\mu\f$ is the mean and \f$\sigma\f$ the standard deviation. The kurtosis excess is estimated as \f[ \gamma_2 = \frac{k_4}{{k_2}^2} \f] where \f[ k_2 = \frac{n}{n-1} m_2 \f] and \f[ k_4 = \frac{n^2 [(n+1)m_4 - 3(n-1){m_2}^2]}{(n-1)(n-2)(n-3)} \f] Here \f$m_2\f$ is the sample variance and \f$m_4\f$ is the 4th sample central moment. */ ITPP_EXPORT double kurtosisexcess(const vec &x); /*! \brief Calculate the kurtosis of the input vector x The kurtosis is a measure of peakedness of a distribution. The kurtosis is defined as \f[ \gamma_2 = \frac{\mathrm{E}[x-\mu]^4}{\sigma^4} \f] where \f$\mu\f$ is the mean and \f$\sigma\f$ the standard deviation. For a Gaussian variable, the kurtusis is 3. See also the definition of kurtosisexcess. */ inline double kurtosis(const vec &x) {return kurtosisexcess(x) + 3;} //!@} } // namespace itpp #endif // #ifndef MISC_STAT_H itpp-4.3.1/itpp/stat/mog_diag.cpp000066400000000000000000000201601216575753400167120ustar00rootroot00000000000000/*! * \file * \brief diagonal Mixture of Gaussians class - source file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include namespace itpp { double MOG_diag::log_lhood_single_gaus_internal(const double * c_x_in, const int k) const { const double * c_mean = c_means[k]; const double * c_diag_cov_inv_etc = c_diag_covs_inv_etc[k]; double acc = 0.0; for (int d = 0; d < D; d++) { double tmp_val = c_x_in[d] - c_mean[d]; acc += (tmp_val * tmp_val) * c_diag_cov_inv_etc[d]; } return(c_log_det_etc[k] - acc); } double MOG_diag::log_lhood_single_gaus_internal(const vec &x_in, const int k) const { return log_lhood_single_gaus_internal(x_in._data(), k); } double MOG_diag::log_lhood_single_gaus(const double * c_x_in, const int k) const { if (do_checks) { it_assert(valid, "MOG_diag::log_lhood_single_gaus(): model not valid"); it_assert(((k >= 0) && (k < K)), "MOG::log_lhood_single_gaus(): k specifies a non-existant Gaussian"); } return log_lhood_single_gaus_internal(c_x_in, k); } double MOG_diag::log_lhood_single_gaus(const vec &x_in, const int k) const { if (do_checks) { it_assert(valid, "MOG_diag::log_lhood_single_gaus(): model not valid"); it_assert(check_size(x_in), "MOG_diag::log_lhood_single_gaus(): x has wrong dimensionality"); it_assert(((k >= 0) && (k < K)), "MOG::log_lhood_single_gaus(): k specifies a non-existant Gaussian"); } return log_lhood_single_gaus_internal(x_in._data(), k); } double MOG_diag::log_lhood_internal(const double * c_x_in) { bool danger = paranoid; for (int k = 0;k < K;k++) { double tmp = c_log_weights[k] + log_lhood_single_gaus_internal(c_x_in, k); c_tmpvecK[k] = tmp; if (tmp >= log_max_K) danger = true; } if (danger) { double log_sum = c_tmpvecK[0]; for (int k = 1; k < K; k++) log_sum = log_add(log_sum, c_tmpvecK[k]); return(log_sum); } else { double sum = 0.0; for (int k = 0;k < K;k++) sum += std::exp(c_tmpvecK[k]); return(std::log(sum)); } } double MOG_diag::log_lhood_internal(const vec &x_in) { return log_lhood_internal(x_in._data()); } double MOG_diag::log_lhood(const vec &x_in) { if (do_checks) { it_assert(valid, "MOG_diag::log_lhood(): model not valid"); it_assert(check_size(x_in), "MOG_diag::log_lhood(): x has wrong dimensionality"); } return log_lhood_internal(x_in._data()); } double MOG_diag::log_lhood(const double * c_x_in) { if (do_checks) { it_assert(valid, "MOG_diag::log_lhood(): model not valid"); it_assert((c_x_in != 0), "MOG_diag::log_lhood(): c_x_in is a null pointer"); } return log_lhood_internal(c_x_in); } double MOG_diag::lhood_internal(const double * c_x_in) { bool danger = paranoid; for (int k = 0;k < K;k++) { double tmp = c_log_weights[k] + log_lhood_single_gaus_internal(c_x_in, k); c_tmpvecK[k] = tmp; if (tmp >= log_max_K) danger = true; } if (danger) { double log_sum = c_tmpvecK[0]; for (int k = 1; k < K; k++) log_sum = log_add(log_sum, c_tmpvecK[k]); return(trunc_exp(log_sum)); } else { double sum = 0.0; for (int k = 0;k < K;k++) sum += std::exp(c_tmpvecK[k]); return(sum); } } double MOG_diag::lhood_internal(const vec &x_in) { return lhood_internal(x_in._data()); } double MOG_diag::lhood(const vec &x_in) { if (do_checks) { it_assert(valid, "MOG_diag::lhood(): model not valid"); it_assert(check_size(x_in), "MOG_diag::lhood(): x has wrong dimensionality"); } return lhood_internal(x_in._data()); } double MOG_diag::lhood(const double * c_x_in) { if (do_checks) { it_assert(valid, "MOG_diag::lhood(): model not valid"); it_assert((c_x_in != 0), "MOG_diag::lhood(): c_x_in is a null pointer"); } return lhood_internal(c_x_in); } double MOG_diag::avg_log_lhood(const double ** c_x_in, const int N) { if (do_checks) { it_assert(valid, "MOG_diag::avg_log_lhood(): model not valid"); it_assert((c_x_in != 0), "MOG_diag::avg_log_lhood(): c_x_in is a null pointer"); it_assert((N >= 0), "MOG_diag::avg_log_lhood(): N is zero or negative"); } double acc = 0.0; for (int n = 0;n < N;n++) acc += log_lhood_internal(c_x_in[n]); return(acc / N); } double MOG_diag::avg_log_lhood(const Array &X_in) { if (do_checks) { it_assert(valid, "MOG_diag::avg_log_lhood(): model not valid"); it_assert(check_size(X_in), "MOG_diag::avg_log_lhood(): X is empty or at least one vector has the wrong dimensionality"); } const int N = X_in.size(); double acc = 0.0; for (int n = 0;n < N;n++) acc += log_lhood_internal(X_in(n)._data()); return(acc / N); } void MOG_diag::zero_all_ptrs() { c_means = 0; c_diag_covs = 0; c_diag_covs_inv_etc = 0; c_weights = 0; c_log_weights = 0; c_log_det_etc = 0; c_tmpvecK = 0; } void MOG_diag::free_all_ptrs() { c_means = disable_c_access(c_means); c_diag_covs = disable_c_access(c_diag_covs); c_diag_covs_inv_etc = disable_c_access(c_diag_covs_inv_etc); c_weights = disable_c_access(c_weights); c_log_weights = disable_c_access(c_log_weights); c_log_det_etc = disable_c_access(c_log_det_etc); c_tmpvecK = disable_c_access(c_tmpvecK); } void MOG_diag::setup_means() { MOG_generic::setup_means(); disable_c_access(c_means); c_means = enable_c_access(means); } void MOG_diag::setup_covs() { MOG_generic::setup_covs(); if (full) return; disable_c_access(c_diag_covs); disable_c_access(c_diag_covs_inv_etc); disable_c_access(c_log_det_etc); c_diag_covs = enable_c_access(diag_covs); c_diag_covs_inv_etc = enable_c_access(diag_covs_inv_etc); c_log_det_etc = enable_c_access(log_det_etc); } void MOG_diag::setup_weights() { MOG_generic::setup_weights(); disable_c_access(c_weights); disable_c_access(c_log_weights); c_weights = enable_c_access(weights); c_log_weights = enable_c_access(log_weights); } void MOG_diag::setup_misc() { disable_c_access(c_tmpvecK); tmpvecK.set_size(K); c_tmpvecK = enable_c_access(tmpvecK); MOG_generic::setup_misc(); if (full) convert_to_diag_internal(); } void MOG_diag::load(const std::string &name_in) { MOG_generic::load(name_in); if (full) convert_to_diag(); } double ** MOG_diag::enable_c_access(Array & A_in) { int rows = A_in.size(); double ** A = (double **)std::malloc(rows * sizeof(double *)); if (A) for (int row = 0;row < rows;row++) A[row] = A_in(row)._data(); return(A); } int ** MOG_diag::enable_c_access(Array & A_in) { int rows = A_in.size(); int ** A = (int **)std::malloc(rows * sizeof(int *)); if (A) for (int row = 0;row < rows;row++) A[row] = A_in(row)._data(); return(A); } double ** MOG_diag::disable_c_access(double ** A_in) { if (A_in) std::free(A_in); return(0); } int ** MOG_diag::disable_c_access(int ** A_in) { if (A_in) std::free(A_in); return(0); } double * MOG_diag::enable_c_access(vec & v_in) { return v_in._data(); } int * MOG_diag::enable_c_access(ivec & v_in) { return v_in._data(); } double * MOG_diag::disable_c_access(double *) { return(0); } int * MOG_diag::disable_c_access(int *) { return(0); } } itpp-4.3.1/itpp/stat/mog_diag.h000066400000000000000000000173471216575753400163740ustar00rootroot00000000000000/*! * \file * \brief Diagonal Mixture of Gaussians class - header file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MOG_DIAG_H #define MOG_DIAG_H #include #include namespace itpp { /*! \ingroup MOG \brief Diagonal Mixture of Gaussians (MOG) class \author Conrad Sanderson Used for representing a statistical distribution as a convex combination of multi-variate Gaussian functions. Also known as a Gaussian Mixture Model. This class allows loading and saving of the MOG's parameters, as well as calculation of likelihoods. The parameters are set by the user or an optimisation algorithm (for example, see the MOG_diag_EM class). \note This class is optimised for diagonal covariance matrices. For speed reasons it uses C style arrays for direct access to memory. */ class ITPP_EXPORT MOG_diag : public MOG_generic { public: /*! \brief Default constructor \note An empty model is created. The likelihood functions are not useable until the model's parameters are set */ MOG_diag() { zero_all_ptrs(); init(); } /*! \brief Construct the MOG_diag object by loading the parameters from a model file \param name The model's filename */ MOG_diag(const std::string &name) { zero_all_ptrs(); load(name); } /*! \brief construct a default model (all Gaussians have zero mean and unit variance for all dimensions) \param K_in Number of Gaussians \param D_in Dimensionality \param full_in Ignored. Present for compatability with the MOG_generic class */ MOG_diag(const int &K_in, const int &D_in, bool full_in = false) { zero_all_ptrs(); init(K_in, D_in, full_in); } /*! \brief Construct a model using user supplied mean vectors \param means_in Array of mean vectors \note The number of mean vectors specifies the number of Gaussians. The covariance matrices are in effect set equal to the identity matrix. The weights for all Gaussians are the same, equal to 1/K, where K is the number of Gaussians */ MOG_diag(Array &means_in, bool) { zero_all_ptrs(); init(means_in, false); } /*! \brief Construct a model using user supplied parameters (diagonal covariance version) \param means_in Array of mean vectors \param diag_covs_in Array of vectors representing diagonal covariances \param weights_in vector of weights \note The number of mean vectors, covariance vectors and weights must be the same */ MOG_diag(Array &means_in, Array &diag_covs_in, vec &weights_in) { zero_all_ptrs(); init(means_in, diag_covs_in, weights_in); } /*! \brief Construct a model using user supplied parameters (full covariance version) \param means_in Array of mean vectors \param full_covs_in Array of full covariance matrices \param weights_in vector of weights \note The full covariance matrices are converted to be diagonal. The number of mean vectors, covariance matrices and weights must be the same. */ MOG_diag(Array &means_in, Array &full_covs_in, vec &weights_in) { zero_all_ptrs(); init(means_in, full_covs_in, weights_in); convert_to_diag(); } //! Default destructor ~MOG_diag() { cleanup(); } /*! \brief Release memory used by the model. The model will be empty. \note The likelihood functions are not useable until the model's parameters are re-initialised */ void cleanup() { free_all_ptrs(); MOG_generic::cleanup(); } /*! \brief Initialise the model by loading the parameters from a model file. \param name_in The model's filename \note If the model file contains a full covariance matrix model, the covariance matrices will be converted to be diagonal after loading. */ void load(const std::string &name_in); //! Do nothing. Present for compatability with the MOG_generic class. void convert_to_full() {}; //! calculate the log likelihood of C vector \c c_x_in using only Gaussian \c k double log_lhood_single_gaus(const double * c_x_in, const int k) const; //! calculate the log likelihood of IT++ vector \c x_in using only Gaussian \c k double log_lhood_single_gaus(const vec &x_in, const int k) const; //! calculate the log likelihood of C vector \c c_x_in double log_lhood(const double * c_x_in); //! calculate the log likelihood of IT++ vector \c x_in double log_lhood(const vec &x_in); //! calculate the likelihood of C vector \c c_x_in double lhood(const double * c_x_in); //! calculate the likelihood of IT++ vector \c x_in double lhood(const vec &x_in); //! calculate the average log likelihood of an array of C vectors ( \c c_x_in ) double avg_log_lhood(const double ** c_x_in, int N); //! calculate the average log likelihood of an array of IT++ vectors ( \c X_in ) double avg_log_lhood(const Array & X_in); protected: void setup_means(); void setup_covs(); void setup_weights(); void setup_misc(); //! ADD DOCUMENTATION HERE double log_lhood_single_gaus_internal(const double * c_x_in, const int k) const; //! ADD DOCUMENTATION HERE double log_lhood_single_gaus_internal(const vec &x_in, const int k) const; //! ADD DOCUMENTATION HERE double log_lhood_internal(const double * c_x_in); //! ADD DOCUMENTATION HERE double log_lhood_internal(const vec &x_in); //! ADD DOCUMENTATION HERE double lhood_internal(const double * c_x_in); //! ADD DOCUMENTATION HERE double lhood_internal(const vec &x_in); //! Enable C style access to an Array of vectors (vec) double ** enable_c_access(Array & A_in); //! Enable C style access to an Array of vectors (ivec) int ** enable_c_access(Array & A_in); //! Enable C style access to a vector (vec) double * enable_c_access(vec & v_in); //! Enable C style access to a vector (ivec) int * enable_c_access(ivec & v_in); //! Disable C style access to an Array of vectors (vec) double ** disable_c_access(double ** A_in); //! Disable C style access to an Array of vectors (ivec) int ** disable_c_access(int ** A_in); //! Disable C style access to a vector (vec) double * disable_c_access(double * v_in); //! Disable C style access to a vector (ivec) int * disable_c_access(int * v_in); //! ADD DOCUMENTATION HERE void zero_all_ptrs(); //! ADD DOCUMENTATION HERE void free_all_ptrs(); //! pointers to the mean vectors double ** c_means; //! pointers to the covariance vectors double ** c_diag_covs; //! pointers to the inverted covariance vectors double ** c_diag_covs_inv_etc; //! pointer to the weight vector double * c_weights; //! pointer to the log version of the weight vector double * c_log_weights; //! pointer to the log_det_etc vector double * c_log_det_etc; private: vec tmpvecK; double * c_tmpvecK; }; } #endif // #ifndef MOG_DIAG_H itpp-4.3.1/itpp/stat/mog_diag_em.cpp000066400000000000000000000207171216575753400174030ustar00rootroot00000000000000/*! * \file * \brief Expectation Maximisation based optimisers for Mixture of Gaussians - source file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include namespace itpp { //! update log versions of parameters and any necessary constants void inline MOG_diag_EM_sup::update_internals() { double Ddiv2_log_2pi = D / 2.0 * std::log(m_2pi); for (int k = 0;k < K;k++) c_log_weights[k] = std::log(c_weights[k]); for (int k = 0;k < K;k++) { double acc = 0.0; double * c_diag_cov = c_diag_covs[k]; double * c_diag_cov_inv_etc = c_diag_covs_inv_etc[k]; for (int d = 0;d < D;d++) { double tmp = c_diag_cov[d]; c_diag_cov_inv_etc[d] = 1.0 / (2.0 * tmp); acc += std::log(tmp); } c_log_det_etc[k] = -Ddiv2_log_2pi - 0.5 * acc; } } //! for helping to avoid numerical instability void inline MOG_diag_EM_sup::sanitise_params() { double acc = 0.0; for (int k = 0;k < K;k++) { if (c_weights[k] < weight_floor) c_weights[k] = weight_floor; if (c_weights[k] > 1.0) c_weights[k] = 1.0; acc += c_weights[k]; } for (int k = 0;k < K;k++) c_weights[k] /= acc; for (int k = 0;k < K;k++) for (int d = 0;d < D;d++) if (c_diag_covs[k][d] < var_floor) c_diag_covs[k][d] = var_floor; } //! update parameters using the Maximum Likelihood version of the EM algorithm double MOG_diag_EM_sup::ml_update_params() { double acc_loglhood = 0.0; for (int k = 0;k < K;k++) { c_acc_loglhood_K[k] = 0.0; double * c_acc_mean = c_acc_means[k]; double * c_acc_cov = c_acc_covs[k]; for (int d = 0;d < D;d++) { c_acc_mean[d] = 0.0; c_acc_cov[d] = 0.0; } } for (int n = 0;n < N;n++) { double * c_x = c_X[n]; bool danger = paranoid; for (int k = 0;k < K;k++) { double tmp = c_log_weights[k] + MOG_diag::log_lhood_single_gaus_internal(c_x, k); c_tmpvecK[k] = tmp; if (tmp >= log_max_K) danger = true; } if (danger) { double log_sum = c_tmpvecK[0]; for (int k = 1;k < K;k++) log_sum = log_add(log_sum, c_tmpvecK[k]); acc_loglhood += log_sum; for (int k = 0;k < K;k++) { double * c_acc_mean = c_acc_means[k]; double * c_acc_cov = c_acc_covs[k]; double tmp_k = trunc_exp(c_tmpvecK[k] - log_sum); acc_loglhood_K[k] += tmp_k; for (int d = 0;d < D;d++) { double tmp_x = c_x[d]; c_acc_mean[d] += tmp_k * tmp_x; c_acc_cov[d] += tmp_k * tmp_x * tmp_x; } } } else { double sum = 0.0; for (int k = 0;k < K;k++) { double tmp = std::exp(c_tmpvecK[k]); c_tmpvecK[k] = tmp; sum += tmp; } acc_loglhood += std::log(sum); for (int k = 0;k < K;k++) { double * c_acc_mean = c_acc_means[k]; double * c_acc_cov = c_acc_covs[k]; double tmp_k = c_tmpvecK[k] / sum; c_acc_loglhood_K[k] += tmp_k; for (int d = 0;d < D;d++) { double tmp_x = c_x[d]; c_acc_mean[d] += tmp_k * tmp_x; c_acc_cov[d] += tmp_k * tmp_x * tmp_x; } } } } for (int k = 0;k < K;k++) { double * c_mean = c_means[k]; double * c_diag_cov = c_diag_covs[k]; double * c_acc_mean = c_acc_means[k]; double * c_acc_cov = c_acc_covs[k]; double tmp_k = c_acc_loglhood_K[k]; c_weights[k] = tmp_k / N; for (int d = 0;d < D;d++) { double tmp_mean = c_acc_mean[d] / tmp_k; c_mean[d] = tmp_mean; c_diag_cov[d] = c_acc_cov[d] / tmp_k - tmp_mean * tmp_mean; } } return(acc_loglhood / N); } void MOG_diag_EM_sup::ml_iterate() { using std::cout; using std::endl; using std::setw; using std::showpos; using std::noshowpos; using std::scientific; using std::fixed; using std::flush; using std::setprecision; double avg_log_lhood_old = -1.0 * std::numeric_limits::max(); Real_Timer tt; if (verbose) { cout << "MOG_diag_EM_sup::ml_iterate()" << endl; cout << setw(14) << "iteration"; cout << setw(14) << "avg_loglhood"; cout << setw(14) << "delta"; cout << setw(10) << "toc"; cout << endl; } for (int i = 0; i < max_iter; i++) { sanitise_params(); update_internals(); if (verbose) tt.tic(); double avg_log_lhood_new = ml_update_params(); if (verbose) { double delta = avg_log_lhood_new - avg_log_lhood_old; cout << noshowpos << fixed; cout << setw(14) << i; cout << showpos << scientific << setprecision(3); cout << setw(14) << avg_log_lhood_new; cout << setw(14) << delta; cout << noshowpos << fixed; cout << setw(10) << tt.toc(); cout << endl << flush; } if (avg_log_lhood_new <= avg_log_lhood_old) break; avg_log_lhood_old = avg_log_lhood_new; } } void MOG_diag_EM_sup::ml(MOG_diag &model_in, Array &X_in, int max_iter_in, double var_floor_in, double weight_floor_in, bool verbose_in) { it_assert(model_in.is_valid(), "MOG_diag_EM_sup::ml(): initial model not valid"); it_assert(check_array_uniformity(X_in), "MOG_diag_EM_sup::ml(): 'X' is empty or contains vectors of varying dimensionality"); it_assert((max_iter_in > 0), "MOG_diag_EM_sup::ml(): 'max_iter' needs to be greater than zero"); verbose = verbose_in; N = X_in.size(); Array means_in = model_in.get_means(); Array diag_covs_in = model_in.get_diag_covs(); vec weights_in = model_in.get_weights(); init(means_in, diag_covs_in, weights_in); means_in.set_size(0); diag_covs_in.set_size(0); weights_in.set_size(0); if (K > N) { it_warning("MOG_diag_EM_sup::ml(): WARNING: K > N"); } else { if (K > N / 10) { it_warning("MOG_diag_EM_sup::ml(): WARNING: K > N/10"); } } var_floor = var_floor_in; weight_floor = weight_floor_in; const double tiny = std::numeric_limits::min(); if (var_floor < tiny) var_floor = tiny; if (weight_floor < tiny) weight_floor = tiny; if (weight_floor > 1.0 / K) weight_floor = 1.0 / K; max_iter = max_iter_in; tmpvecK.set_size(K); tmpvecD.set_size(D); acc_loglhood_K.set_size(K); acc_means.set_size(K); for (int k = 0;k < K;k++) acc_means(k).set_size(D); acc_covs.set_size(K); for (int k = 0;k < K;k++) acc_covs(k).set_size(D); c_X = enable_c_access(X_in); c_tmpvecK = enable_c_access(tmpvecK); c_tmpvecD = enable_c_access(tmpvecD); c_acc_loglhood_K = enable_c_access(acc_loglhood_K); c_acc_means = enable_c_access(acc_means); c_acc_covs = enable_c_access(acc_covs); ml_iterate(); model_in.init(means, diag_covs, weights); disable_c_access(c_X); disable_c_access(c_tmpvecK); disable_c_access(c_tmpvecD); disable_c_access(c_acc_loglhood_K); disable_c_access(c_acc_means); disable_c_access(c_acc_covs); tmpvecK.set_size(0); tmpvecD.set_size(0); acc_loglhood_K.set_size(0); acc_means.set_size(0); acc_covs.set_size(0); cleanup(); } void MOG_diag_EM_sup::map(MOG_diag &, MOG_diag &, Array &, int, double, double, double, bool) { it_error("MOG_diag_EM_sup::map(): not implemented yet"); } // // convenience functions void MOG_diag_ML(MOG_diag &model_in, Array &X_in, int max_iter_in, double var_floor_in, double weight_floor_in, bool verbose_in) { MOG_diag_EM_sup EM; EM.ml(model_in, X_in, max_iter_in, var_floor_in, weight_floor_in, verbose_in); } void MOG_diag_MAP(MOG_diag &, MOG_diag &, Array &, int, double, double, double, bool) { it_error("MOG_diag_MAP(): not implemented yet"); } } itpp-4.3.1/itpp/stat/mog_diag_em.h000066400000000000000000000125171216575753400170470ustar00rootroot00000000000000/*! * \file * \brief Expectation Maximisation (EM) based optimisers for MOG - header file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MOG_DIAG_EM_H #define MOG_DIAG_EM_H #include #include #include namespace itpp { /*! \brief support class for MOG_diag_ML() and MOG_diag_MAP() \author Conrad Sanderson */ class ITPP_EXPORT MOG_diag_EM_sup : public MOG_diag { public: //! Default constructor MOG_diag_EM_sup() { verbose = false; } //! Default destructor ~MOG_diag_EM_sup() { } //! ADD DOCUMENTATION HERE void ml(MOG_diag &model_in, Array &X_in, int max_iter_in = 10, double var_floor_in = 0.0, double weight_floor_in = 0.0, bool verbose_in = false); //! ADD DOCUMENTATION HERE void map(MOG_diag &model_in, MOG_diag &prior_model, Array &X_in, int max_iter_in = 10, double alpha_in = 0.5, double var_floor_in = 0.0, double weight_floor_in = 0.0, bool verbose_in = false); protected: //! Whether we print the progress bool verbose; //! number of training vectors int N; //! Maximum number of iterations int max_iter; //! 'C' pointers to training vectors double ** c_X; //! ADD DOCUMENTATION HERE double var_floor; //! ADD DOCUMENTATION HERE double weight_floor; //! ADD DOCUMENTATION HERE void inline update_internals(); //! ADD DOCUMENTATION HERE void inline sanitise_params(); //! ADD DOCUMENTATION HERE double ml_update_params(); //! ADD DOCUMENTATION HERE void ml_iterate(); private: vec tmpvecK; vec tmpvecD; vec acc_loglhood_K; Array acc_means; Array acc_covs; double * c_tmpvecK; double * c_tmpvecD; double * c_acc_loglhood_K; double ** c_acc_means; double ** c_acc_covs; }; // // convenience functions /*! \ingroup MOG \author Conrad Sanderson Maximum Likelihood Expectation Maximisation based optimisation of the parameters of an instance of the MOG_diag class. The seed values (starting points) are typically first obtained via MOG_diag_kmeans(). See [CSB06] and the references therein for detailed mathematical descriptions. - [CSB06] F. Cardinaux, C. Sanderson and S. Bengio, "User authentication via adapted statistical models of face images", IEEE Transactions on Signal Processing, Vol 54, No. 1, 2006, pp. 361-373. \param model_in The model to optimise (MOG_diag) \param X_in The training data (array of vectors) \param max_iter_in Maximum number of iterations. Default is 10. \param var_floor_in Variance floor (lowest allowable variance). Default is 0.0 (but see the note below) \param weight_floor_in Weight floor (lowest allowable weight). Default is 0.0 (but see the note below) \param verbose_in Whether progress in printed. Default is false. \note The variance and weight floors are set to std::numeric_limits::min() if they are below that value. As such, they are machine dependant. The largest allowable weight floor is 1/K, where K is the number of Gaussians. */ void MOG_diag_ML(MOG_diag &model_in, Array &X_in, int max_iter_in = 10, double var_floor_in = 0.0, double weight_floor_in = 0.0, bool verbose_in = false); /*! NOT YET IMPLEMENTED. Maximum a Posteriori (MAP) Expectation Maximisation optimiser for Mixtures of Gaussians. \param model_in The model to optimise (MOG_diag) \param prior_model_in The model representing the prior \param X_in The training data (array of vectors) \param max_iter_in Maximum number of iterations \param alpha_in Coefficient for combining the parameters with the prior. 0 <= _alpha <= 1. \param var_floor_in Variance floor (lowest allowable variance). Set to 0.0 to use the default. \param weight_floor_in Weight floor (lowest allowable weight). Set to 0.0 to use the default. \param verbose_in ADD DOCUMENTATION HERE \note NOT YET IMPLEMENTED. \note The variance and weight floors are set to std::numeric_limits::min() if they are below that value. The largest allowable weight floor is 1/K, where K is the number of Gaussians. */ void MOG_diag_MAP(MOG_diag &model_in, MOG_diag &prior_model_in, Array &X_in, int max_iter_in = 10, double alpha_in = 0.5, double var_floor_in = 0.0, double weight_floor_in = 0.0, bool verbose_in = false); } #endif // #ifndef MOG_DIAG_EM_H itpp-4.3.1/itpp/stat/mog_diag_kmeans.cpp000066400000000000000000000207531216575753400202600ustar00rootroot00000000000000/*! * \file * \brief kmeans based optimiser for Mixture of Gaussians - source file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include namespace itpp { inline double MOG_diag_kmeans_sup::dist(const double * x, const double * y) const { double acc = 0.0; for (int d = 0;d < D;d++) { double tmp = x[d] - y[d]; acc += tmp * tmp; } return(acc); } void MOG_diag_kmeans_sup::assign_to_means() { for (int k = 0;k < K;k++) c_count[k] = 0; for (int n = 0;n < N;n++) { int k = 0; double min_dist = dist(c_means[k], c_X[n]); int k_winner = k; for (int k = 1;k < K;k++) { double tmp_dist = dist(c_means[k], c_X[n]); if (tmp_dist < min_dist) { min_dist = tmp_dist; k_winner = k; } } c_partitions[ k_winner ][ count[k_winner] ] = n; c_count[k_winner]++; } } void MOG_diag_kmeans_sup::recalculate_means() { for (int k = 0;k < K;k++) { for (int d = 0;d < D;d++) c_tmpvec[d] = 0.0; int Nk = c_count[k]; for (int n = 0;n < Nk;n++) { double * x = c_X[ c_partitions[k][n] ]; for (int d = 0;d < D;d++) c_tmpvec[d] += x[d]; } if (Nk > 0) { double * c_mean = c_means[k]; for (int d = 0;d < D;d++) c_mean[d] = c_tmpvec[d] / Nk; } } } bool MOG_diag_kmeans_sup::dezombify_means() { static int counter = 0; bool zombie_mean = false; int k = 0; int max_count = count[k]; int k_hog = k; for (int k = 1;k < K;k++) if (c_count[k] > max_count) { max_count = c_count[k]; k_hog = k; } for (int k = 0;k < K;k++) { if (c_count[k] == 0) { zombie_mean = true; if (verbose) { it_warning("MOG_diag_kmeans_sup::dezombify_means(): detected zombie mean"); } if (k_hog == k) { it_warning("MOG_diag_kmeans_sup::dezombify_means(): weirdness: k_hog == k"); return(false); } if (counter >= c_count[k_hog]) counter = 0; double * c_mean = c_means[k]; double * c_x = c_X[ c_partitions[k_hog][counter] ]; for (int d = 0;d < D;d++) c_mean[d] = 0.5 * (c_means[k_hog][d] + c_x[d]); counter++; } } if (zombie_mean) assign_to_means(); return(true); } double MOG_diag_kmeans_sup::measure_change() const { double tmp_dist = 0.0; for (int k = 0;k < K;k++) tmp_dist += dist(c_means[k], c_means_old[k]); return(tmp_dist); } void MOG_diag_kmeans_sup::initial_means() { for (int d = 0;d < D;d++) c_tmpvec[d] = 0.0; for (int n = 0;n < N;n++) { double * c_x = c_X[n]; for (int d = 0;d < D;d++) c_tmpvec[d] += c_x[d]; } for (int d = 0;d < D;d++) c_tmpvec[d] /= N; int step = int(floor(double(N) / double(K))); for (int k = 0;k < K;k++) { double * c_mean = c_means[k]; double * c_x = c_X[k*step]; for (int d = 0;d < D;d++) c_mean[d] = 0.5 * (c_tmpvec[d] + c_x[d]); } } void MOG_diag_kmeans_sup::iterate() { for (int k = 0;k < K;k++) for (int d = 0;d < D;d++) c_means_old[k][d] = c_means[k][d]; for (int i = 0;i < max_iter;i++) { assign_to_means(); if (!dezombify_means()) return; recalculate_means(); double change = measure_change(); if (verbose) std::cout << "MOG_diag_kmeans_sup::iterate(): iteration = " << i << " change = " << change << std::endl; if (change == 0) break; for (int k = 0;k < K;k++) for (int d = 0;d < D;d++) c_means_old[k][d] = c_means[k][d]; } } void MOG_diag_kmeans_sup::calc_means() { initial_means(); iterate(); } void MOG_diag_kmeans_sup::calc_covs() { for (int k = 0;k < K;k++) { int Nk = c_count[k]; if (Nk >= 2) { double * c_mean = c_means[k]; for (int d = 0;d < D;d++) c_tmpvec[d] = 0.0; for (int n = 0;n < Nk;n++) { double * c_x = c_X[ c_partitions[k][n] ]; for (int d = 0;d < D;d++) { double tmp = c_x[d] - c_mean[d]; c_tmpvec[d] += tmp * tmp; } } for (int d = 0;d < D;d++) c_diag_covs[k][d] = trust * (c_tmpvec[d] / (Nk - 1.0)) + (1.0 - trust) * (1.0); } else { for (int d = 0;d < D;d++) c_diag_covs[k][d] = 1.0; } } } void MOG_diag_kmeans_sup::calc_weights() { for (int k = 0;k < K;k++) c_weights[k] = trust * (c_count[k] / double(N)) + (1.0 - trust) * (1.0 / K); } void MOG_diag_kmeans_sup::normalise_vectors() { for (int d = 0;d < D;d++) { double acc = 0.0; for (int n = 0;n < N;n++) acc += c_X[n][d]; c_norm_mu[d] = acc / N; } for (int d = 0;d < D;d++) { double acc = 0.0; for (int n = 0;n < N;n++) { double tmp = c_X[n][d] - c_norm_mu[d]; acc += tmp * tmp; } c_norm_sd[d] = std::sqrt(acc / (N - 1)); } for (int n = 0;n < N;n++) for (int d = 0;d < D;d++) { c_X[n][d] -= c_norm_mu[d]; if (c_norm_sd[d] > 0.0) c_X[n][d] /= c_norm_sd[d]; } } void MOG_diag_kmeans_sup::unnormalise_vectors() { for (int n = 0;n < N;n++) for (int d = 0;d < D;d++) { if (c_norm_sd[d] > 0.0) c_X[n][d] *= c_norm_sd[d]; c_X[n][d] += c_norm_mu[d]; } } void MOG_diag_kmeans_sup::unnormalise_means() { for (int k = 0;k < K;k++) for (int d = 0;d < D;d++) { if (norm_sd[d] > 0.0) c_means[k][d] *= c_norm_sd[d]; c_means[k][d] += norm_mu[d]; } } void MOG_diag_kmeans_sup::run(MOG_diag &model_in, Array &X_in, int max_iter_in, double trust_in, bool normalise_in, bool verbose_in) { it_assert(model_in.is_valid(), "MOG_diag_kmeans_sup::run(): given model is not valid"); it_assert((max_iter_in > 0), "MOG_diag_kmeans_sup::run(): 'max_iter' needs to be greater than zero"); it_assert(((trust_in >= 0.0) && (trust_in <= 1.0)), "MOG_diag_kmeans_sup::run(): 'trust' must be between 0 and 1 (inclusive)"); verbose = verbose_in; Array means_in = model_in.get_means(); Array diag_covs_in = model_in.get_diag_covs(); vec weights_in = model_in.get_weights(); init(means_in, diag_covs_in, weights_in); means_in.set_size(0); diag_covs_in.set_size(0); weights_in.set_size(0); it_assert(check_size(X_in), "MOG_diag_kmeans_sup::run(): 'X' is empty or contains vectors of wrong dimensionality"); N = X_in.size(); if (K > N) { it_warning("MOG_diag_kmeans_sup::run(): K > N"); } else { if (K > N / 10) { it_warning("MOG_diag_kmeans_sup::run(): K > N/10"); } } max_iter = max_iter_in; trust = trust_in; means_old.set_size(K); for (int k = 0;k < K;k++) means_old(k).set_size(D); partitions.set_size(K); for (int k = 0;k < K;k++) partitions(k).set_size(N); count.set_size(K); tmpvec.set_size(D); norm_mu.set_size(D); norm_sd.set_size(D); c_X = enable_c_access(X_in); c_means_old = enable_c_access(means_old); c_partitions = enable_c_access(partitions); c_count = enable_c_access(count); c_tmpvec = enable_c_access(tmpvec); c_norm_mu = enable_c_access(norm_mu); c_norm_sd = enable_c_access(norm_sd); if (normalise_in) normalise_vectors(); calc_means(); if (normalise_in) { unnormalise_vectors(); unnormalise_means(); } calc_covs(); calc_weights(); model_in.init(means, diag_covs, weights); disable_c_access(c_X); disable_c_access(c_means_old); disable_c_access(c_partitions); disable_c_access(c_count); disable_c_access(c_tmpvec); disable_c_access(c_norm_mu); disable_c_access(c_norm_sd); means_old.set_size(0); partitions.set_size(0); count.set_size(0); tmpvec.set_size(0); norm_mu.set_size(0); norm_sd.set_size(0); cleanup(); } // // convenience functions void MOG_diag_kmeans(MOG_diag &model_in, Array &X_in, int max_iter_in, double trust_in, bool normalise_in, bool verbose_in) { MOG_diag_kmeans_sup km; km.run(model_in, X_in, max_iter_in, trust_in, normalise_in, verbose_in); } } itpp-4.3.1/itpp/stat/mog_diag_kmeans.h000066400000000000000000000124431216575753400177220ustar00rootroot00000000000000/*! * \file * \brief K-means based optimiser for Mixture of Gaussians - header file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MOG_DIAG_KMEANS_H #define MOG_DIAG_KMEANS_H #include #include #include namespace itpp { /*! \brief support class for MOG_diag_kmeans() \author Conrad Sanderson */ class ITPP_EXPORT MOG_diag_kmeans_sup : public MOG_diag { public: //! Default constructor MOG_diag_kmeans_sup() { verbose = false; } //! Default destructor ~MOG_diag_kmeans_sup() { } //! ADD DOCUMENTATION HERE void run(MOG_diag &model_in, Array &X_in, int max_iter_in = 10, double trust_in = 0.5, bool normalise_in = true, bool verbose_in = false); protected: //! ADD DOCUMENTATION HERE inline double dist(const double * x, const double * y) const; //! ADD DOCUMENTATION HERE void assign_to_means(); //! ADD DOCUMENTATION HERE void recalculate_means(); //! ADD DOCUMENTATION HERE bool dezombify_means(); //! ADD DOCUMENTATION HERE double measure_change() const; //! ADD DOCUMENTATION HERE void initial_means(); //! ADD DOCUMENTATION HERE void iterate(); //! ADD DOCUMENTATION HERE void calc_means(); //! ADD DOCUMENTATION HERE void calc_covs(); //! ADD DOCUMENTATION HERE void calc_weights(); //! ADD DOCUMENTATION HERE void normalise_vectors(); //! ADD DOCUMENTATION HERE void unnormalise_vectors(); //! ADD DOCUMENTATION HERE void unnormalise_means(); //! Maximum number of iterations int max_iter; /*! \brief trust factor, where 0 <= trust <= 1. \note The higher the trust factor, the more we trust the estimates of covariance matrices and weights. */ double trust; //! Whether we print the progress bool verbose; //! number of training vectors int N; //! 'C' pointers to training vectors double ** c_X; //! means from the previous iteration, used to measure progress Array means_old; //! 'C' pointers to old means double ** c_means_old; //! contains indices of vectors assigned to each mean Array partitions; //! 'C' pointers to partition vectors int ** c_partitions; //! keeps a count of the number of vectors assigned to each mean ivec count; //! 'C' pointer to the count vector int * c_count; private: vec norm_mu; double * c_norm_mu; vec norm_sd; double * c_norm_sd; vec tmpvec; double * c_tmpvec; }; // // convenience functions /*! \ingroup MOG \author Conrad Sanderson K-means based optimisation (training) of the parameters of an instance of the MOG_diag class. The obtained parameters are typically used as a seed by MOG_diag_ML(). \param model_in The model to optimise \param X_in The training data \param max_iter_in Maximum number of iterations. Default is 10. \param trust_in The trust factor, where 0 <= \c trust_in <= 1. Default is 0.5. \param normalise_in Use normalised distance measure (in effect). Default is true. \param verbose_in Whether to print progress. Default is false. \note The higher the trust factor, the more we trust the estimates of covariance matrices and weights. Set this to 1.0 only if you have plenty of training data. One rule of thumb is to have 10*D vectors per Gaussian, where D is the dimensionality of the vectors. For smaller amounts of data, a lower trust factor will help (but not completely avoid) the EM algorithm ( used in MOG_diag_ML() ) from getting stuck in a local minimum. \note Setting \c normalise_in to true causes the the training data to be normalised to zero mean and unit variance prior to running the k-means algorithm. The data is unnormalised before returning. The normalisation helps clustering when the range of values varies greatly between dimensions. e.g. dimension 1 may have values in the [-1,+1] interval, while dimension 2 may have values in the [-100,+100] interval. Without normalisation, the distance between vectors is dominated by dimension 2. */ void MOG_diag_kmeans(MOG_diag &model_in, Array &X_in, int max_iter_in = 10, double trust_in = 0.5, bool normalise_in = true, bool verbose_in = false); } #endif // #ifndef MOG_DIAG_KMEANS_H itpp-4.3.1/itpp/stat/mog_generic.cpp000066400000000000000000000371301216575753400174270ustar00rootroot00000000000000/*! * \file * \brief generic Mixture of Gaussians (MOG) class - source file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include namespace itpp { void MOG_generic::init() { cleanup(); } void MOG_generic::init(const int &K_in, const int &D_in, bool full_in) { valid = false; it_assert(K_in >= 0, "MOG_generic::init(): number of Gaussians must be greater than zero"); it_assert(D_in >= 0, "MOG_generic::init(): dimensionality must be greater than zero"); K = K_in; D = D_in; full = full_in; set_means_zero_internal(); full ? set_full_covs_unity_internal() : set_diag_covs_unity_internal(); set_weights_uniform_internal(); setup_misc(); valid = true; do_checks = true; paranoid = false; } void MOG_generic::init(Array &means_in, bool full_in) { valid = false; K = means_in.size(); D = means_in(0).size(); full = full_in; it_assert(check_array_uniformity(means_in), "MOG_generic::init(): 'means' is empty or contains vectors of varying dimensionality"); set_means(means_in); full ? set_full_covs_unity_internal() : set_diag_covs_unity_internal(); set_weights_uniform_internal(); setup_misc(); valid = true; do_checks = true; paranoid = false; } void MOG_generic::init(Array &means_in, Array &diag_covs_in, vec &weights_in) { valid = false; K = means_in.size(); D = means_in(0).size(); full = false; it_assert(check_array_uniformity(means_in), "MOG_generic::init(): 'means' is empty or contains vectors of varying dimensionality"); set_means_internal(means_in); set_diag_covs_internal(diag_covs_in); set_weights_internal(weights_in); setup_misc(); valid = true; do_checks = true; paranoid = false; } void MOG_generic::init(Array &means_in, Array &full_covs_in, vec &weights_in) { valid = false; K = means_in.size(); D = means_in(0).size(); full = true; it_assert(check_array_uniformity(means_in), "MOG_generic::init(): 'means' is empty or contains vectors of varying dimensionality"); set_means_internal(means_in); set_full_covs_internal(full_covs_in); set_weights_internal(weights_in); setup_misc(); valid = true; do_checks = true; paranoid = false; } bool MOG_generic::check_size(const vec &x_in) const { if (x_in.size() == D) return true; return false; } bool MOG_generic::check_size(const Array &X_in) const { if (check_array_uniformity(X_in)) return check_size(X_in(0)); return false; } bool MOG_generic::check_array_uniformity(const Array & A) const { int rows = A.size(); int cols = A(0).size(); if (!rows || !cols) return false; for (int row = 1; row < rows; row++) if (A(row).size() != cols) return false; return true; } void MOG_generic::set_means_zero_internal() { means.set_size(K); for (int k = 0; k < K; k++) { means(k).set_size(D); means(k) = 0.0; } setup_means(); } void MOG_generic::set_means_internal(Array &means_in) { it_assert((means_in.size() == K), "MOG_generic::set_means_internal(): number of vectors in 'means' is not equivalent to number of Gaussians"); for (int k = 0; k < K; k++) it_assert((means_in(k).size() == D), "MOG_generic::set_means_internal(): dimensionality mismatch between model and one or more vectors in 'means'"); for (int k = 0; k < K; k++) for (int d = 0; d < D; d++) it_assert(std::isfinite(means_in(k)(d)), "MOG_generic::set_means_internal(): 'means' has a non-finite value"); means = means_in; setup_means(); } void MOG_generic::set_diag_covs_internal(Array &diag_covs_in) { it_assert((diag_covs_in.size() == K), "MOG_generic::set_diag_covs_internal(): number of vectors in 'diag_covs' does not match number of Gaussians"); for (int k = 0; k < K; k++) it_assert((diag_covs_in(k).size() == D), "MOG_generic::set_diag_covs_internal(): dimensionality mismatch between model and one or more vectors in 'diag_covs'"); for (int k = 0; k < K; k++) for (int d = 0; d < D; d++) { it_assert((diag_covs_in(k)(d) > 0.0), "MOG_generic::set_diag_covs_internal(): 'diag_covs' has a zero or negative value"); it_assert(std::isfinite(diag_covs_in(k)(d)), "MOG_generic::set_diag_covs_internal(): 'diag_covs' has a non-finite value"); } full_covs.set_size(0); diag_covs = diag_covs_in; full = false; setup_covs(); } void MOG_generic::set_full_covs_internal(Array &full_covs_in) { it_assert((full_covs_in.size() == K), "MOG_generic::set_full_covs_internal(): number of matrices in 'full_covs' does not match number of Gaussians"); for (int k = 0; k < K; k++) it_assert(((full_covs_in(k).rows() == D) && (full_covs_in(k).cols() == D)), "MOG_generic::set_full_covs_internal(): dimensionality mismatch between model and one or more matrices in 'full_covs'"); for (int k = 0; k < K; k++) for (int i = 0; i < D; i++) for (int j = 0; j < D; j++) { it_assert(std::isfinite(full_covs_in(k)(i, j)), "MOG_generic::set_full_covs_internal(): 'full_covs' has a non-finite value"); if (i == j) { it_assert(full_covs_in(k)(i, j) > 0.0, "MOG_generic::set_full_covs_internal(): 'full_covs' has " "a zero or negative value on a diagonal"); } } full_covs = full_covs_in; diag_covs.set_size(0); full = true; setup_covs(); } void MOG_generic::set_weights_internal(vec &weights_in) { it_assert((weights_in.size() == K), "MOG_generic::set_weights_internal(): number of elements in 'weights' does not match number of Gaussians"); for (int k = 0; k < K; k++) { it_assert((weights_in(k) >= 0), "MOG_generic::set_weights_internal(): 'weights' has a negative value"); it_assert(std::isfinite(weights_in(k)), "MOG_generic::set_weights_internal(): 'weights' has a non-finite value"); } weights = weights_in; setup_weights(); } void MOG_generic::set_diag_covs_unity_internal() { full_covs.set_size(0); diag_covs.set_size(K); for (int k = 0; k < K; k++) { diag_covs(k).set_size(D); diag_covs(k) = 1.0; } full = false; setup_covs(); } void MOG_generic::set_full_covs_unity_internal() { full_covs.set_size(K); diag_covs.set_size(0); for (int k = 0; k < K; k++) { full_covs(k).set_size(D, D); full_covs(k) = 0.0; for (int d = 0;d < D;d++) full_covs(k)(d, d) = 1.0; } full = true; setup_covs(); } void MOG_generic::set_weights_uniform_internal() { weights.set_size(K); weights = 1.0 / K; setup_weights(); } void MOG_generic::setup_means() { } void MOG_generic::setup_covs() { double Ddiv2_log_2pi = D / 2.0 * std::log(m_2pi); log_det_etc.set_size(K); if (full) { full_covs_inv.set_size(K); diag_covs_inv_etc.set_size(0); for (int k = 0;k < K;k++) full_covs_inv(k) = inv(full_covs(k)); for (int k = 0;k < K;k++) log_det_etc(k) = -Ddiv2_log_2pi - 0.5 * std::log(det(full_covs(k))); } else { full_covs_inv.set_size(0); diag_covs_inv_etc.set_size(K); for (int k = 0;k < K;k++) diag_covs_inv_etc(k).set_size(D); for (int k = 0;k < K;k++) { double acc = 0.0; vec & diag_cov = diag_covs(k); vec & diag_cov_inv_etc = diag_covs_inv_etc(k); for (int d = 0;d < D;d++) { double tmp = diag_cov(d); diag_cov_inv_etc(d) = 1.0 / (2.0 * tmp); acc += std::log(tmp); } log_det_etc(k) = -Ddiv2_log_2pi - 0.5 * acc; } } } void MOG_generic::setup_weights() { weights /= sum(weights); log_weights = log(weights); } void MOG_generic::setup_misc() { log_max_K = std::log(std::numeric_limits::max() / K); tmpvecD.set_size(D); tmpvecK.set_size(K); } void MOG_generic::cleanup() { valid = false; do_checks = true; K = 0; D = 0; tmpvecD.set_size(0); tmpvecK.set_size(0); means.set_size(0); diag_covs.set_size(0); full_covs.set_size(0); weights.set_size(0); log_det_etc.set_size(0); log_weights.set_size(0); full_covs_inv.set_size(0); diag_covs_inv_etc.set_size(0); } void MOG_generic::set_means(Array &means_in) { if (!valid) return; set_means_internal(means_in); } void MOG_generic::set_means_zero() { if (!valid) return; set_means_zero_internal(); } void MOG_generic::set_diag_covs(Array &diag_covs_in) { if (!valid) return; set_diag_covs_internal(diag_covs_in); } void MOG_generic::set_full_covs(Array &full_covs_in) { if (!valid) return; set_full_covs_internal(full_covs_in); } void MOG_generic::set_weights(vec &weights_in) { if (!valid) return; set_weights_internal(weights_in); } void MOG_generic::set_diag_covs_unity() { if (!valid) return; set_diag_covs_unity_internal(); } void MOG_generic::set_full_covs_unity() { if (!valid) return; set_full_covs_unity_internal(); } void MOG_generic::set_weights_uniform() { if (!valid) return; set_weights_uniform_internal(); } void MOG_generic::load(const std::string &name_in) { valid = false; it_assert(exist(name_in), "MOG_generic::load(): couldn't access file '" + name_in + "'"); it_file ff(name_in); bool contents = ff.exists("means") && (ff.exists("diag_covs") || ff.exists("full_covs")) && ff.exists("weights"); it_assert(contents, "MOG_generic::load(): file '" + name_in + "' doesn't appear to be a model file"); Array means_in; ff >> Name("means") >> means_in; vec weights_in; ff >> Name("weights") >> weights_in; if (ff.exists("full_covs")) { Array full_covs_in; ff >> Name("full_covs") >> full_covs_in; init(means_in, full_covs_in, weights_in); } else { Array diag_covs_in; ff >> Name("diag_covs") >> diag_covs_in; init(means_in, diag_covs_in, weights_in); } ff.close(); } void MOG_generic::save(const std::string &name_in) const { if (!valid) return; it_file ff(name_in); ff << Name("means") << means; if (full) ff << Name("full_covs") << full_covs; else ff << Name("diag_covs") << diag_covs; ff << Name("weights") << weights; ff.close(); } void MOG_generic::join(const MOG_generic &B_in) { if (!valid) return; if (!B_in.is_valid()) return; it_assert((full == B_in.is_full()), "MOG_generic::join(): given model must be of the same type"); it_assert((B_in.get_D() == D), "MOG_generic::join(): given model has different dimensionality"); it_assert((B_in.get_K() > 0), "MOG_generic::join(): given model has no components"); int new_K = K + B_in.get_K(); vec new_weights(new_K); vec B_in_weights = B_in.get_weights(); double alpha = double(K) / double(new_K); double beta = double(B_in.get_K()) / double(new_K); for (int k = 0;k < K;k++) new_weights(k) = alpha * weights(k); for (int k = K;k < new_K;k++) new_weights(k) = beta * B_in_weights(k); Array new_means = concat(means, B_in.get_means()); if (full) { Array new_full_covs = concat(full_covs, B_in.get_full_covs()); init(new_means, new_full_covs, new_weights); } else { Array new_diag_covs = concat(diag_covs, B_in.get_diag_covs()); init(new_means, new_diag_covs, new_weights); } } void MOG_generic::convert_to_diag_internal() { if (!full) return; diag_covs.set_size(K); for (int k = 0;k < K;k++) diag_covs(k) = diag(full_covs(k)); full_covs.set_size(0); full = false; setup_covs(); } void MOG_generic::convert_to_diag() { if (!valid) return; convert_to_diag_internal(); } void MOG_generic::convert_to_full_internal() { if (full) return; full_covs.set_size(K); for (int k = 0;k < K;k++) full_covs(k) = diag(diag_covs(k)); diag_covs.set_size(0); full = true; setup_covs(); } void MOG_generic::convert_to_full() { if (!valid) return; convert_to_full_internal(); } double MOG_generic::log_lhood_single_gaus_internal(const vec &x_in, const int k) { const vec & mean = means(k); if (full) { for (int d = 0;d < D;d++) tmpvecD[d] = x_in[d] - mean[d]; double tmpval = tmpvecD * (full_covs_inv(k) * tmpvecD); return(log_det_etc[k] - 0.5*tmpval); } else { const vec & diag_cov_inv_etc = diag_covs_inv_etc(k); double acc = 0.0; for (int d = 0; d < D; d++) { double tmpval = x_in[d] - mean[d]; acc += (tmpval * tmpval) * diag_cov_inv_etc[d]; } return(log_det_etc[k] - acc); } } double MOG_generic::log_lhood_single_gaus(const vec &x_in, const int k) { if (do_checks) { it_assert(valid, "MOG_generic::log_lhood_single_gaus(): model not valid"); it_assert(check_size(x_in), "MOG_generic::log_lhood_single_gaus(): x has wrong dimensionality"); it_assert(((k >= 0) && (k < K)), "MOG_generic::log_lhood_single_gaus(): k specifies a non-existant Gaussian"); } return log_lhood_single_gaus_internal(x_in, k); } double MOG_generic::log_lhood_internal(const vec &x_in) { bool danger = paranoid; for (int k = 0;k < K;k++) { double tmp = log_weights[k] + log_lhood_single_gaus_internal(x_in, k); tmpvecK[k] = tmp; if (tmp >= log_max_K) danger = true; } if (danger) { double log_sum = tmpvecK[0]; for (int k = 1; k < K; k++) log_sum = log_add(log_sum, tmpvecK[k]); return(log_sum); } else { double sum = 0.0; for (int k = 0;k < K;k++) sum += std::exp(tmpvecK[k]); return(std::log(sum)); } } double MOG_generic::log_lhood(const vec &x_in) { if (do_checks) { it_assert(valid, "MOG_generic::log_lhood(): model not valid"); it_assert(check_size(x_in), "MOG_generic::log_lhood(): x has wrong dimensionality"); } return log_lhood_internal(x_in); } double MOG_generic::lhood_internal(const vec &x_in) { bool danger = paranoid; for (int k = 0;k < K;k++) { double tmp = log_weights[k] + log_lhood_single_gaus_internal(x_in, k); tmpvecK[k] = tmp; if (tmp >= log_max_K) danger = true; } if (danger) { double log_sum = tmpvecK[0]; for (int k = 1; k < K; k++) log_sum = log_add(log_sum, tmpvecK[k]); return(trunc_exp(log_sum)); } else { double sum = 0.0; for (int k = 0;k < K;k++) sum += std::exp(tmpvecK[k]); return(sum); } } double MOG_generic::lhood(const vec &x_in) { if (do_checks) { it_assert(valid, "MOG_generic::lhood(): model not valid"); it_assert(check_size(x_in), "MOG_generic::lhood(): x has wrong dimensionality"); } return lhood_internal(x_in); } double MOG_generic::avg_log_lhood(const Array &X_in) { if (do_checks) { it_assert(valid, "MOG_generic::avg_log_lhood(): model not valid"); it_assert(check_size(X_in), "MOG_generic::avg_log_lhood(): X is empty or at least one vector has the wrong dimensionality"); } const int N = X_in.size(); double acc = 0.0; for (int n = 0;n < N;n++) acc += log_lhood_internal(X_in(n)); return(acc / N); } } // namespace itpp itpp-4.3.1/itpp/stat/mog_generic.h000066400000000000000000000363261216575753400171020ustar00rootroot00000000000000/*! * \file * \brief Generic Mixture of Gaussians (MOG) class - header file * \author Conrad Sanderson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #ifndef MOG_GENERIC_H #define MOG_GENERIC_H #include #include #include #include #include namespace itpp { /*! \ingroup MOG \brief Generic Mixture of Gaussians (MOG) class. Used as a base for other MOG classes. \author Conrad Sanderson Used for representing a statistical distribution as a convex combination of multi-variate Gaussian functions. Also known as a Gaussian Mixture Model. This class handles both full and diagonal covariance matrices, allows loading and saving of the MOG's parameters, as well as calculation of likelihoods. The parameters are set by the user or an optimisation algorithm (for example, see the MOG_diag_EM class). For speed and space reasons, diagonal and full covariance matrices are stored and handled separately. */ class ITPP_EXPORT MOG_generic { public: /*! \brief Default constructor \note An empty model is created. The likelihood functions are not useable until the model's parameters are set */ MOG_generic() { init(); } /*! \brief Construct the MOG_generic object by loading the parameters from a model file \param name_in The model's filename */ MOG_generic(const std::string &name_in) { load(name_in); } /*! \brief construct a default model (all Gaussians have zero mean and unit variance for all dimensions) \param K_in Number of Gaussians \param D_in Dimensionality \param full_in If true, use full covariance matrices; if false, use diagonal covariance matrices. Default = false. */ MOG_generic(const int &K_in, const int &D_in, bool full_in = false) { init(K_in, D_in, full_in); } /*! \brief Construct a model using user supplied mean vectors \param means_in Array of mean vectors \param full_in If true, use full covariance matrices; if false, use diagonal covariance matrices. Default = false. \note The number of mean vectors specifies the number of Gaussians. The covariance matrices are set to the identity matrix. The weights for all Gaussians are the same, equal to 1/K, where K is the number of Gaussians */ MOG_generic(Array &means_in, bool full_in = false) { init(means_in, full_in); } /*! \brief Construct a model using user supplied parameters (diagonal covariance version) \param means_in Array of mean vectors \param diag_covs_in Array of vectors representing diagonal covariances \param weights_in vector of weights \note The number of mean vectors, covariance vectors and weights must be the same */ MOG_generic(Array &means_in, Array &diag_covs_in, vec &weights_in) { init(means_in, diag_covs_in, weights_in); } /*! \brief Construct a model using user supplied parameters (full covariance version) \param means_in Array of mean vectors \param full_covs_in Array of full covariance matrices \param weights_in vector of weights \note The number of mean vectors, covariance matrices and weights must be the same */ MOG_generic(Array &means_in, Array &full_covs_in, vec &weights_in) { init(means_in, full_covs_in, weights_in); } //! Default destructor virtual ~MOG_generic() { cleanup(); } /*! \brief Initialise the model to be empty. \note The likelihood functions are not useable until the model's parameters are set */ void init(); /*! \brief initialise the model so that all Gaussians have zero mean and unit variance for all dimensions \param K_in Number of Gaussians \param D_in Dimensionality \param full_in If true, use full covariance matrices; if false, use diagonal covariance matrices. Default = false. */ void init(const int &K_in, const int &D_in, bool full_in = false); /*! \brief Initialise the model using user supplied mean vectors \param means_in Array of mean vectors \param full_in If true, use full covariance matrices; if false, use diagonal covariance matrices. Default = false. \note The number of mean vectors specifies the number of Gaussians. The covariance matrices are set to the identity matrix. The weights for all Gaussians are the same, equal to 1/K, where K is the number of Gaussians */ void init(Array &means_in, bool full_in = false); /*! \brief Initialise the model using user supplied parameters (diagonal covariance version) \param means_in Array of mean vectors \param diag_covs_in Array of vectors representing diagonal covariances \param weights_in vector of weights \note The number of mean vectors, covariance vectors and weights must be the same */ void init(Array &means_in, Array &diag_covs_in, vec &weights_in); /*! \brief Initialise the model using user supplied parameters (full covariance version) \param means_in Array of mean vectors \param full_covs_in Array of covariance matrices \param weights_in vector of weights \note The number of mean vectors, covariance matrices and weights must be the same */ void init(Array &means_in, Array &full_covs_in, vec &weights_in); /*! \brief Release memory used by the model. The model will be empty. \note The likelihood functions are not useable until the model's parameters are re-initialised */ virtual void cleanup(); //! Returns true if the model's parameters are valid bool is_valid() const { return valid; } //! Returns true if the model has full covariance matrices bool is_full() const { return full; } //! Return the number of Gaussians int get_K() const { if (valid) return(K); else return(0); } //! Return the dimensionality int get_D() const { if (valid) return(D); else return(0); } //! Obtain a copy of the weight vector vec get_weights() const { vec tmp; if (valid) { tmp = weights; } return tmp; } //! Obtain a copy of the array of mean vectors Array get_means() const { Array tmp; if (valid) { tmp = means; } return tmp; } //! Obtain a copy of the array of diagonal covariance vectors Array get_diag_covs() const { Array tmp; if (valid && !full) { tmp = diag_covs; } return tmp; } //! Obtain a copy of the array of full covariance matrices Array get_full_covs() const { Array tmp; if (valid && full) { tmp = full_covs; } return tmp; } /*! \brief Set the means of the model \note The number of means must match the number of Gaussians in the model */ void set_means(Array &means_in); /*! \brief Set the diagonal covariance vectors of the model \note The number of diagonal covariance vectors must match the number of Gaussians in the model */ void set_diag_covs(Array &diag_covs_in); /*! \brief Set the full covariance matrices of the model \note The number of covariance matrices must match the number of Gaussians in the model */ void set_full_covs(Array &full_covs_in); /*! \brief Set the weight vector of the model \note The number of elements in the weight vector must match the number of Gaussians in the model */ void set_weights(vec &weights_in); //! Set the means in the model to be zero void set_means_zero(); //! Set the diagonal covariance vectors to be unity void set_diag_covs_unity(); //! Set the full covariance matrices to be unity void set_full_covs_unity(); //! Set all the weights to 1/K, where K is the number of Gaussians void set_weights_uniform(); /*! \brief Enable/disable internal checks for likelihood functions \param do_checks_in If true, checks are enabled; if false, checks are disabled \note Disabling checks will provide a speedup in the likelihood functions. Disable them only when you're happy that everything is working correctly. */ void set_checks(bool do_checks_in) { do_checks = do_checks_in; } /*! \brief Enable/disable paranoia about numerical stability \param paranoid_in If true, calculate likelihoods using a safer, but slower method. */ void set_paranoid(bool paranoid_in) { paranoid = paranoid_in; } /*! \brief Initialise the model by loading the parameters from a model file \param name_in The model's filename */ virtual void load(const std::string &name_in); /*! \brief Save the model's parameters to a model file \param name_in The model's filename */ virtual void save(const std::string &name_in) const; /*! \brief Mathematically join the model with a user supplied model \param B_in user supplied model \note The Arrays of mean vectors and covariance vectors/matrices from the two models are simply concatenated, while the weights of the resultant model are a function of the original weights and numbers of Gaussians from both models. Specifically, \f$ w_{new} = [ \alpha \cdot w_{A} ~~~ \beta \cdot w_{B} ]^T \f$, where \f$ w_{new} \f$ is the new weight vector, \f$ w_{A} \f$ and \f$ w_{B} \f$ are the weight vectors from model A and B, while \f$ \alpha = K_A / (K_A + KB_in) \f$ and \f$ \beta = 1-\alpha \f$. In turn, \f$ K_A \f$ and \f$ KB_in \f$ are the numbers of Gaussians in model A and B, respectively. See On transforming statistical models... for more information. */ virtual void join(const MOG_generic &B_in); /*! \brief Convert the model to use diagonal covariances \note If the model is already diagonal, nothing is done. If the model has full covariance matrices, this results in irreversible information loss (in effect the off-diagonal covariance elements are now zero) */ virtual void convert_to_diag(); /*! \brief Convert the model to have full covariance matrices \note If the model has full covariance matrices, nothing is done. If the model has diagonal covariances, the off-diagonal elements in the full covariance matrices are set to zero. */ virtual void convert_to_full(); //! calculate the log likelihood of vector \c x_in using only Gaussian \c k virtual double log_lhood_single_gaus(const vec &x_in, const int k); //! calculate the log likelihood of vector \c x_in virtual double log_lhood(const vec &x_in); //! calculate the likelihood of vector \c x_in virtual double lhood(const vec &x_in); //! calculate the average log likelihood of an array of vectors \c X_in virtual double avg_log_lhood(const Array &X_in); protected: //! indicates whether checks on input data are done bool do_checks; //! indicates whether the parameters are valid bool valid; //! indicates whether we are using full or diagonal covariance matrices bool full; //! indicates whether we are paranoid about numerical stability bool paranoid; //! number of gaussians int K; //! dimensionality int D; //! means Array means; //! diagonal covariance matrices, stored as vectors Array diag_covs; //! full covariance matrices Array full_covs; //! weights vec weights; //! Pre-calcualted std::log(std::numeric_limits::max() / K), where K is the number of Gaussians double log_max_K; /*! \brief Gaussian specific pre-calcualted constants \note Vector of pre-calculated \f$ -\frac{D}{2}\log(2\pi) -\frac{1}{2}\log(|\Sigma|) \f$ for each Gaussian, where \f$ D \f$ is the dimensionality and \f$ |\Sigma| \f$ is the determinant for the Gaussian's covariance matrix \f$ \Sigma \f$. */ vec log_det_etc; //! Pre-calculated log versions of the weights vec log_weights; //! Pre-calcuated inverted version of each full covariance matrix Array full_covs_inv; //! Pre-calcuated inverted version of each diagonal covariance vector, where the covariance elements are first multiplied by two Array diag_covs_inv_etc; //! Check if vector \c x_in has the same dimensionality as the model bool check_size(const vec &x_in) const; //! Check if all vectors in Array \c X_in have the same dimensionality as the model bool check_size(const Array &X_in) const; //! Check if all vectors in Array \c X_in have the same dimensionality bool check_array_uniformity(const Array & A) const; //! ADD DOCUMENTATION HERE void set_means_internal(Array &means_in); //! ADD DOCUMENTATION HERE void set_diag_covs_internal(Array &diag_covs_in); //! ADD DOCUMENTATION HERE void set_full_covs_internal(Array &full_covs_in); //! ADD DOCUMENTATION HERE void set_weights_internal(vec &_weigths); //! ADD DOCUMENTATION HERE void set_means_zero_internal(); //! ADD DOCUMENTATION HERE void set_diag_covs_unity_internal(); //! ADD DOCUMENTATION HERE void set_full_covs_unity_internal(); //! ADD DOCUMENTATION HERE void set_weights_uniform_internal(); //! ADD DOCUMENTATION HERE void convert_to_diag_internal(); //! ADD DOCUMENTATION HERE void convert_to_full_internal(); //! additional processing of mean vectors, done as the last step of mean initialisation virtual void setup_means(); //! additional processing of covariance vectors/matrices, done as the last step of covariance initialisation virtual void setup_covs(); //! additional processing of the weight vector, done as the last step of weight initialisation virtual void setup_weights(); //! additional processing of miscellaneous parameters, done as the last step of overall initialisation virtual void setup_misc(); //! ADD DOCUMENTATION HERE virtual double log_lhood_single_gaus_internal(const vec &x_in, const int k); //! ADD DOCUMENTATION HERE virtual double log_lhood_internal(const vec &x_in); //! ADD DOCUMENTATION HERE virtual double lhood_internal(const vec &x_in); private: vec tmpvecD; vec tmpvecK; }; } // namespace itpp #endif // #ifndef MOG_GENERIC_H itpp-4.3.1/itpp/stat/sources.mk000066400000000000000000000007561216575753400164650ustar00rootroot00000000000000h_stat_sources = \ $(top_srcdir)/itpp/stat/histogram.h \ $(top_srcdir)/itpp/stat/misc_stat.h \ $(top_srcdir)/itpp/stat/mog_diag.h \ $(top_srcdir)/itpp/stat/mog_diag_em.h \ $(top_srcdir)/itpp/stat/mog_diag_kmeans.h \ $(top_srcdir)/itpp/stat/mog_generic.h cpp_stat_sources = \ $(top_srcdir)/itpp/stat/misc_stat.cpp \ $(top_srcdir)/itpp/stat/mog_diag.cpp \ $(top_srcdir)/itpp/stat/mog_diag_em.cpp \ $(top_srcdir)/itpp/stat/mog_diag_kmeans.cpp \ $(top_srcdir)/itpp/stat/mog_generic.cpp itpp-4.3.1/itpp_debug.pc.in000066400000000000000000000006521216575753400155700ustar00rootroot00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: @PACKAGE_NAME@ is a C++ library of mathematical, signal processing, speech processing, and communications classes and functions Version: @PACKAGE_VERSION@ URL: http://itpp.sourceforge.net/ Libs: -L${libdir} -l@PACKAGE_DEBUG@@EXPLICIT_LIBS@ Libs.private:@PRIVATE_LIBS@ Cflags: -I${includedir} @CXXFLAGS_DEBUG@ itpp-4.3.1/m4/000077500000000000000000000000001216575753400130325ustar00rootroot00000000000000itpp-4.3.1/m4/acx_blas.m4000066400000000000000000000170411216575753400150530ustar00rootroot00000000000000dnl @synopsis ACX_BLAS dnl @author Steven G. Johnson dnl @author Adam Piatyszek dnl @version 2007-02-15 dnl dnl This macro looks for a library that implements the BLAS dnl linear-algebra interface (see http://www.netlib.org/blas/). On dnl success, it sets the BLAS_LIBS output variable to hold the dnl requisite library linkages. Besides, it defines HAVE_BLAS. dnl dnl To link with BLAS, you should link with: dnl dnl $BLAS_LIBS $LIBS dnl dnl Many libraries are searched for, e.g. MKL, ACML or ATLAS. The dnl user may also use --with-blas= in order to use some specific dnl BLAS library . In order to link successfully, however, be dnl aware that you will probably need to use the same Fortran compiler dnl (which can be set via the F77 env. var.) as was used to compile the dnl BLAS library. dnl dnl This macro requires autoconf 2.50 or later. AC_DEFUN([ACX_BLAS], [ AC_PREREQ(2.50) test "x$sgemm" = x && sgemm=sgemm_ test "x$dgemm" = x && dgemm=dgemm_ # Initialise local variables acx_blas_ok=no blas_mkl_ok=no blas_acml_ok=no blas_atlas_ok=no # Parse "--with-blas=" option AC_ARG_WITH(blas, [AS_HELP_STRING([--with-blas@<:@=LIB@:>@], [use BLAS library, optionally specified by LIB])]) case $with_blas in yes | "") ;; no) acx_blas_ok=disabled ;; -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;; *) BLAS_LIBS="-l$with_blas" ;; esac # First, check BLAS_LIBS environment variable if test "$acx_blas_ok" = no; then if test "x$BLAS_LIBS" != x; then save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes]) AC_MSG_RESULT($acx_blas_ok) # Try to use MY_FLIBS if test "$acx_blas_ok" = no; then LIBS="$LIBS$MY_FLIBS" AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS$MY_FLIBS]) AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes; BLAS_LIBS="$BLAS_LIBS$MY_FLIBS"], [BLAS_LIBS=""]) AC_MSG_RESULT($acx_blas_ok) fi LIBS="$save_LIBS" fi fi # # BLAS linked to by default? (happens on some supercomputers) # if test $acx_blas_ok = no; then # save_LIBS="$LIBS"; LIBS="$LIBS" # AC_CHECK_FUNC($sgemm, [acx_blas_ok=yes]) # LIBS="$save_LIBS" # fi # BLAS in MKL library? # (http://www.intel.com/cd/software/products/asmo-na/eng/perflib/mkl/index.htm) if test "$acx_blas_ok" = no; then AC_CHECK_LIB([mkl_core], [$sgemm], [acx_blas_ok=yes; blas_mkl_ok=yes; BLAS_LIBS="-lmkl_core -lmkl_gnu_thread -lmkl_gf_lp64 -liomp5 -lpthread"], [AC_CHECK_LIB([mkl_core], [$dgemm], [acx_blas_ok=yes; blas_mkl_ok=yes; BLAS_LIBS="-lmkl_core -lmkl_gnu_thread -lmkl_gf -liomp5 -lpthread"], [], [-lmkl_gnu_thread -lmkl_gf -liomp5 -lpthread])], [-lmkl_gnu_thread -lmkl_gf_lp64 -liomp5 -lpthread]) fi # BLAS in ACML library? (http://developer.amd.com/acml.aspx) # +------------+-----------+---------------------+ # | | 32-bit | 64-bit | # +------------+-----------+---------------------+ # | GCC < 4.2 | -lacml | -lacml -lacml_mv | # | GCC >= 4.2 | -lacml_mp | -lacml_mp -lacml_mv | # +------------+-----------+---------------------+ if test "$acx_blas_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS$MY_FLIBS" AC_CHECK_LIB([acml], [$sgemm], [acx_blas_ok=yes; blas_acml_ok=yes; BLAS_LIBS="-lacml$MY_FLIBS"], [AC_CHECK_LIB([acml_mp], [$sgemm], [acx_blas_ok=yes; blas_acml_ok=yes; BLAS_LIBS="-lacml_mp$MY_FLIBS"], [AC_CHECK_LIB([acml], [$dgemm], [acx_blas_ok=yes; blas_acml_ok=yes; BLAS_LIBS="-lacml -lacml_mv$MY_FLIBS"], [AC_CHECK_LIB([acml_mp], [$dgemm], [acx_blas_ok=yes; blas_acml_ok=yes; BLAS_LIBS="-lacml_mp -lacml_mv$MY_FLIBS"], [], [-lacml_mv])], [], [-lacml_mv])], [])], []) LIBS="$save_LIBS" fi # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) if test "$acx_blas_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS$MY_FLIBS" AC_CHECK_LIB(atlas, ATL_xerbla, [AC_CHECK_LIB(f77blas, $sgemm, [AC_CHECK_LIB(cblas, cblas_dgemm, [acx_blas_ok=yes; blas_atlas_ok=yes; BLAS_LIBS="-lcblas -lf77blas -latlas$MY_FLIBS"], [], [-lf77blas -latlas])], [], [-latlas])]) LIBS="$save_LIBS" fi # # BLAS in PhiPACK libraries? (requires generic BLAS lib, too) # if test $acx_blas_ok = no; then # AC_CHECK_LIB(blas, $sgemm, # [AC_CHECK_LIB(dgemm, $dgemm, # [AC_CHECK_LIB(sgemm, $sgemm, # [acx_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], # [], [-lblas])], # [], [-lblas])]) # fi # # BLAS in Alpha CXML library? # if test $acx_blas_ok = no; then # AC_CHECK_LIB(cxml, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lcxml"]) # fi # # BLAS in Alpha DXML library? (now called CXML, see above) # if test $acx_blas_ok = no; then # AC_CHECK_LIB(dxml, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-ldxml"]) # fi # # BLAS in Sun Performance library? # if test $acx_blas_ok = no; then # if test "x$GCC" != xyes; then # only works with Sun CC # AC_CHECK_LIB(sunmath, acosp, # [AC_CHECK_LIB(sunperf, $sgemm, # [acx_blas_ok=yes; BLAS_LIBS="-xlic_lib=sunperf -lsunmath"], [], # [-lsunmath])]) # fi # fi # # BLAS in SCSL library? (SGI/Cray Scientific Library) # if test $acx_blas_ok = no; then # AC_CHECK_LIB(scs, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lscs"]) # fi # # BLAS in SGIMATH library? # if test $acx_blas_ok = no; then # AC_CHECK_LIB(complib.sgimath, $sgemm, # [acx_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) # fi # # BLAS in IBM ESSL library? (requires generic BLAS lib, too) # if test $acx_blas_ok = no; then # AC_CHECK_LIB(blas, $sgemm, # [AC_CHECK_LIB(essl, $sgemm, # [acx_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], [], [-lblas $FLIBS])]) # fi # Generic BLAS library? if test "$acx_blas_ok" = no; then AC_CHECK_LIB(blas, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas"], [AC_CHECK_LIB(blas, $dgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas$MY_FLIBS"], [], [$MY_FLIBS])]) fi # if BLAS is found check what kind of BLAS it is if test "$acx_blas_ok" = yes && test "$blas_mkl_ok" = no \ && test "$blas_acml_ok" = no && test "$blas_atlas_ok" = no; then save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" AC_MSG_CHECKING([for MKLGetVersion in $BLAS_LIBS]) AC_TRY_LINK_FUNC(MKLGetVersion, [blas_mkl_ok=yes]) AC_MSG_RESULT($blas_mkl_ok) if test "$blas_mkl_ok" = no; then AC_MSG_CHECKING([for acmlversion in $BLAS_LIBS]) AC_TRY_LINK_FUNC(acmlversion, [blas_acml_ok=yes]) AC_MSG_RESULT($blas_acml_ok) fi if test "$blas_mkl_ok" = no && test "$blas_acml_ok" = no; then AC_MSG_CHECKING([for ATL_xerbla in $BLAS_LIBS]) AC_TRY_LINK_FUNC(ATL_xerbla, [blas_atlas_ok=yes]) AC_MSG_RESULT($blas_atlas_ok) fi LIBS="$save_LIBS" fi AC_SUBST(BLAS_LIBS) # Finally, define HAVE_BLAS and others if test "$acx_blas_ok" = yes; then AC_DEFINE(HAVE_BLAS, 1, [Define if you have a BLAS library.]) if test "$blas_mkl_ok" = yes; then AC_DEFINE(HAVE_BLAS_MKL, 1, [Define if you have an MKL BLAS library.]) fi if test "$blas_acml_ok" = yes; then AC_DEFINE(HAVE_BLAS_ACML, 1, [Define if you have an ACML BLAS library.]) fi if test "$blas_atlas_ok" = yes; then AC_DEFINE(HAVE_BLAS_ATLAS, 1, [Define if you have an ATLAS BLAS library.]) fi else if test "$acx_blas_ok" != disabled; then AC_MSG_ERROR([cannot find any BLAS library, which is required by LAPACK. You can override this error by using "--without-blas" option, but the functionality of the IT++ library will be limited. You have been warned!]) fi fi ])dnl ACX_BLAS itpp-4.3.1/m4/acx_fft.m4000066400000000000000000000110071216575753400147050ustar00rootroot00000000000000dnl @synopsis ACX_FFT dnl @author Adam Piatyszek dnl @version 2007-02-15 dnl @license GPLWithACException dnl dnl This macro looks for some FFT implementation, e.g. FFTW3, MKL, ACML, dnl etc. On success, it sets the FFT_LIBS output variable to hold the dnl requisite library linkages. Besides it defines one of the following: dnl HAVE_FFT, HAVE_FFTW, HAVE_MKL_FFT, HAVE_ACML_FFT dnl dnl The user may also use --with-fft= in order to use some dnl specific FFT library . AC_DEFUN([ACX_FFT], [ # Initialise local variables acx_fft_ok=no fft_mkl_ok=no fft_acml_ok=no fftw3_ok=no # Parse "--with-fft=" option AC_ARG_WITH(fft, [AS_HELP_STRING([--with-fft@<:@=LIB@:>@], [use FFT library, optionally specified by LIB])]) case $with_fft in yes | "") ;; no) acx_fft_ok=disabled ;; -* | */* | *.a | *.so | *.so.* | *.o) FFT_LIBS="$with_fft" ;; *) FFT_LIBS="-l$with_fft" ;; esac # Parse "--with-fft-include=" option AC_ARG_WITH(fft_include, [AS_HELP_STRING([--with-fft-include=DIR], [path to FFT header files])], [CPPFLAGS="$CPPFLAGS -I$with_fft_include"]) # First, check FFT_LIBS environment variable if test "x$FFT_LIBS" != x; then save_LIBS="$LIBS"; LIBS="$FFT_LIBS $LIBS" AC_MSG_CHECKING([for DftiComputeForward in $FFT_LIBS]) AC_TRY_LINK_FUNC(DftiComputeForward, [acx_fft_ok=yes]) AC_MSG_RESULT($acx_fft_ok) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([mkl_dfti.h], [fft_mkl_ok=yes], [acx_fft_ok=no]) fi if test "$acx_fft_ok" = no; then AC_MSG_CHECKING([for zfft1dx in $FFT_LIBS]) AC_TRY_LINK_FUNC(zfft1dx, [acx_fft_ok=yes]) AC_MSG_RESULT($acx_fft_ok) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([acml.h], [fft_acml_ok=yes], [acx_fft_ok=no]) fi fi if test "$acx_fft_ok" = no; then AC_MSG_CHECKING([for fftw_plan_dft_1d in $FFT_LIBS]) AC_TRY_LINK_FUNC(fftw_plan_dft_1d, [acx_fft_ok=yes], [FFT_LIBS=""]) AC_MSG_RESULT($acx_fft_ok) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([fftw3.h], [fftw3_ok=yes], [acx_fft_ok=no; FFT_LIBS=""]) fi fi LIBS="$save_LIBS" fi # FFT in BLAS (MKL) library? if test "$acx_fft_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS" AC_CHECK_FUNC(DftiComputeForward, [acx_fft_ok=yes]) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([mkl_dfti.h], [fft_mkl_ok=yes], [acx_fft_ok=no]) fi LIBS="$save_LIBS" fi # FFT in BLAS (ACML) library? if test "$acx_fft_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS" AC_CHECK_FUNC(zfft1dx, [acx_fft_ok=yes]) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([acml.h], [fft_acml_ok=yes], [acx_fft_ok=no]) fi LIBS="$save_LIBS" fi # FFT in FFTW3 library? if test "$acx_fft_ok" = no; then AC_CHECK_LIB(fftw3, fftw_plan_dft_1d, [acx_fft_ok=yes]) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([fftw3.h], [fftw3_ok=yes; FFT_LIBS="-lfftw3"], [acx_fft_ok=no]) fi fi # FFT in FFTW3 library (extra -lm)? if test "$acx_fft_ok" = no; then AC_CHECK_LIB(fftw3, fftw_plan_dft_1d, [acx_fft_ok=yes], [], [-lm]) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([fftw3.h], [fftw3_ok=yes; FFT_LIBS="-lfftw3 -lm"], [acx_fft_ok=no]) fi fi # FFT in MKL library? if test "$acx_fft_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS" AC_CHECK_LIB(mkl, DftiComputeForward, [acx_fft_ok=yes], [], [-lguide -lpthread]) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([mkl_dfti.h], [fft_mkl_ok=yes; FFT_LIBS="-lmkl -lguide -lpthread"], [acx_fft_ok=no]) fi LIBS="$save_LIBS" fi # FFT in ACML library? if test "$acx_fft_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS$MY_FLIBS" AC_CHECK_LIB(acml, zfft1dx, [acx_fft_ok=yes]) if test "$acx_fft_ok" = yes; then AC_CHECK_HEADER([acml.h], [fft_acml_ok=yes; FFT_LIBS="-lacml$MY_FLIBS"], [acx_fft_ok=no]) fi LIBS="$save_LIBS" fi AC_SUBST(FFT_LIBS) # Finally, define HAVE_* if test "$acx_fft_ok" = yes; then AC_DEFINE(HAVE_FFT, 1, [Define if you have FFT library.]) if test "$fft_mkl_ok" = yes; then AC_DEFINE(HAVE_FFT_MKL, 1, [Define if you have MKL FFT library.]) fi if test "$fft_acml_ok" = yes; then AC_DEFINE(HAVE_FFT_ACML, 1, [Define if you have ACML FFT library.]) fi if test "$fftw3_ok" = yes; then AC_DEFINE(HAVE_FFTW3, 1, [Define if you have FFTW3 library.]) fi else if test "$acx_fft_ok" != disabled; then AC_MSG_ERROR([cannot find any FFT library. You can override this error by using "--without-fft" option, but the functionality of the IT++ library will be limited. You have been warned!]) fi fi ])dnl ACX_FFT itpp-4.3.1/m4/acx_lapack.m4000066400000000000000000000061541216575753400153700ustar00rootroot00000000000000dnl @synopsis ACX_LAPACK dnl @author Steven G. Johnson dnl @author Adam Piatyszek dnl @version 2007-02-15 dnl dnl This macro looks for a library that implements the LAPACK dnl linear-algebra interface (see http://www.netlib.org/lapack/). On dnl success, it sets the LAPACK_LIBS output variable to hold the dnl requisite library linkages. Besides, it defines HAVE_LAPACK dnl dnl To link with LAPACK, you should link with: dnl dnl $LAPACK_LIBS $BLAS_LIBS $LIBS dnl dnl in that order. BLAS_LIBS is the output variable of the ACX_BLAS dnl macro, called automatically. dnl dnl The user may also use --with-lapack= in order to use some dnl specific LAPACK library . In order to link successfully, dnl however, be aware that you will probably need to use the same dnl Fortran compiler (which can be set via the F77 env. var.) as was dnl used to compile the LAPACK and BLAS libraries. AC_DEFUN([ACX_LAPACK], [ AC_REQUIRE([ACX_BLAS]) test "x$cheev" = x && cheev=cheev_ # Initialise local variables # We cannot use LAPACK if BLAS is not found if test "$acx_blas_ok" != yes; then acx_lapack_ok=noblas else acx_lapack_ok=no fi # Parse "--with-lapack=" option AC_ARG_WITH(lapack, [AS_HELP_STRING([--with-lapack@<:@=LIB@:>@], [use LAPACK library, optionally specified by LIB])]) case $with_lapack in yes | "") ;; no) acx_lapack_ok=disabled ;; -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;; *) LAPACK_LIBS="-l$with_lapack" ;; esac # First, check LAPACK_LIBS environment variable if test "x$LAPACK_LIBS" != x; then save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS" AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) AC_TRY_LINK_FUNC($cheev, [acx_lapack_ok=yes], [LAPACK_LIBS=""]) AC_MSG_RESULT($acx_lapack_ok) LIBS="$save_LIBS" fi # LAPACK linked to by default? (it is sometimes included in BLAS) if test "$acx_lapack_ok" = no; then save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS" AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes]) LIBS="$save_LIBS" fi # LAPACK in MKL library? # (http://www.intel.com/cd/software/products/asmo-na/eng/perflib/mkl/index.htm) if test "$acx_lapack_ok" = no; then save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" AC_CHECK_LIB(mkl_lapack32, $cheev, [acx_lapack_ok=yes; LAPACK_LIBS="-lmkl_lapack32 -lmkl_lapack64"], [AC_CHECK_LIB(mkl_lapack, $cheev, [acx_lapack_ok=yes; LAPACK_LIBS="-lmkl_lapack"])], [-lmkl_lapack64]) LIBS="$save_LIBS" fi # Generic LAPACK library? for lapack in lapack lapack_rs6k; do if test "$acx_lapack_ok" = no; then save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" AC_CHECK_LIB($lapack, $cheev, [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"]) LIBS="$save_LIBS" fi done AC_SUBST(LAPACK_LIBS) # Finally, define HAVE_LAPACK if test "$acx_lapack_ok" = yes; then AC_DEFINE(HAVE_LAPACK, 1, [Define if you have LAPACK library.]) else if test "$acx_lapack_ok" != disabled; then AC_MSG_ERROR([cannot find any LAPACK library. You can override this error by using "--without-lapack" option, but the functionality of the IT++ library will be limited. You have been warned!]) fi fi ])dnl ACX_LAPACK itpp-4.3.1/tests/000077500000000000000000000000001216575753400136545ustar00rootroot00000000000000itpp-4.3.1/tests/CMakeLists.txt000066400000000000000000000036301216575753400164160ustar00rootroot00000000000000# # \file CMakeLists.txt # \brief cmake configuration file for old unit tests # \author Bogdan Cristea # # ------------------------------------------------------------------------- # # Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) # # This file is part of IT++ - a C++ library of mathematical, signal # processing, speech processing, and communications classes and functions. # # IT++ is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any # later version. # # IT++ 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 General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with IT++. If not, see . # # ------------------------------------------------------------------------- file ( GLOB ITPP_TEST_SRCS *.cpp ) include_directories ( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) foreach (FILE ${ITPP_TEST_SRCS}) get_filename_component ( target ${FILE} NAME_WE ) add_executable ( ${target} ${FILE} ) if (target MATCHES "^fastica") set_target_properties(${target} PROPERTIES COMPILE_FLAGS -DFASTICA_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/fastica_test_data.txt\\") endif() if (target MATCHES "^parser") set_target_properties(${target} PROPERTIES COMPILE_FLAGS -DPARSER_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/parser_test_data.txt\\") endif() if (target MATCHES "^itfile") set_target_properties(${target} PROPERTIES COMPILE_FLAGS -DITFILE_TEST_FILE=\\""${CMAKE_CURRENT_SOURCE_DIR}"/itfile_test_data.it\\") endif() target_link_libraries ( ${target} ${ITPP_LIBS} ${libitpp_target} ) endforeach (FILE) itpp-4.3.1/tests/Makefile.am000066400000000000000000000137151216575753400157170ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common LDADD = $(top_builddir)/itpp/libitpp.la AM_CXXFLAGS = $(CXXFLAGS_OPT) BASE_TESTS = array_test bessel_test blas_test circular_buffer_test \ converters_test fastmath_test gf2mat_test integration_test itfile_test \ mat_test parser_test rand_test sort_test sparse_test specmat_test \ timer_test vec_test linspace_test operators_test BASE_LAP_TESTS = cholesky_test det_test eigen_test inv_test ls_solve_test \ lu_test matfunc_test qr_test schur_test svd_test COMM_TESTS = bch_test commfunc_test convcode_test error_count_test \ galois_test interleaver_test ldpc_test llr_test modulator_test \ pulse_shape_test rec_syst_conv_code_test reedsolomon_test turbo_test siso_test \ exit_test stc_test demapper_test COMM_LAP_TESTS = modulator_nd_test COMM_FFT_TESTS = channel_test FIXED_TESTS = fix_test OPTIM_TESTS = newton_search_test SIGNAL_TESTS = filter_test source_test SIGNAL_LAP_TESTS = fastica_test poly_test SIGNAL_FFT_TESTS = freq_filt_test sigfun_test transforms_test window_test SIGNAL_LAP_FFT_TESTS = filter_design_test STAT_TESTS = histogram_test STAT_LAP_TESTS = stat_test ALL_TESTS = $(BASE_TESTS) $(BASE_LAP_TESTS) $(COMM_TESTS) $(COMM_LAP_TESTS) \ $(COMM_FFT_TESTS) $(FIXED_TESTS) $(OPTIM_TESTS) $(SIGNAL_TESTS) \ $(SIGNAL_LAP_TESTS) $(SIGNAL_FFT_TESTS) $(SIGNAL_LAP_FFT_TESTS) \ $(STAT_TESTS) $(STAT_LAP_TESTS) USED_TESTS = $(BASE_TESTS) $(STAT_TESTS) if RUN_LAPACK_TESTS USED_TESTS += $(BASE_LAP_TESTS) $(STAT_LAP_TESTS) endif # RUN_LAPACK_TESTS if ENABLE_COMM USED_TESTS += $(COMM_TESTS) if RUN_LAPACK_TESTS USED_TESTS += $(COMM_LAP_TESTS) endif # RUN_LAPACK_TESTS if RUN_FFT_TESTS USED_TESTS += $(COMM_FFT_TESTS) endif # RUN_FFT_TESTS endif # ENABLE_COMM if ENABLE_FIXED USED_TESTS += $(FIXED_TESTS) endif # ENABLE_FIXED if ENABLE_OPTIM USED_TESTS += $(OPTIM_TESTS) endif # ENABLE_OPTIM if ENABLE_SIGNAL USED_TESTS += $(SIGNAL_TESTS) if RUN_LAPACK_TESTS USED_TESTS += $(SIGNAL_LAP_TESTS) endif # RUN_LAPACK_TESTS if RUN_FFT_TESTS USED_TESTS += $(SIGNAL_FFT_TESTS) if RUN_LAPACK_TESTS USED_TESTS += $(SIGNAL_LAP_FFT_TESTS) endif # RUN_LAPACK_TESTS endif # RUN_FFT_TESTS endif # ENABLE_SIGNAL array_test_SOURCES = array_test.cpp bch_test_SOURCES = bch_test.cpp bessel_test_SOURCES = bessel_test.cpp blas_test_SOURCES = blas_test.cpp channel_test_SOURCES = channel_test.cpp converters_test_SOURCES = converters_test.cpp itfile_test_SOURCES = itfile_test.cpp itfile_test_CPPFLAGS = -DITFILE_TEST_FILE=\"$(srcdir)/itfile_test_data.it\" $(AM_CPPFLAGS) cholesky_test_SOURCES = cholesky_test.cpp circular_buffer_test_SOURCES = circular_buffer_test.cpp commfunc_test_SOURCES = commfunc_test.cpp convcode_test_SOURCES = convcode_test.cpp det_test_SOURCES = det_test.cpp eigen_test_SOURCES = eigen_test.cpp error_count_test_SOURCES = error_count_test.cpp fastica_test_SOURCES = fastica_test.cpp fastica_test_CPPFLAGS = -DFASTICA_TEST_FILE=\"$(srcdir)/fastica_test_data.txt\" $(AM_CPPFLAGS) fastmath_test_SOURCES = fastmath_test.cpp filter_test_SOURCES = filter_test.cpp filter_design_test_SOURCES = filter_design_test.cpp fix_test_SOURCES = fix_test.cpp freq_filt_test_SOURCES = freq_filt_test.cpp galois_test_SOURCES = galois_test.cpp gf2mat_test_SOURCES = gf2mat_test.cpp histogram_test_SOURCES = histogram_test.cpp integration_test_SOURCES = integration_test.cpp interleaver_test_SOURCES = interleaver_test.cpp inv_test_SOURCES = inv_test.cpp ldpc_test_SOURCES = ldpc_test.cpp llr_test_SOURCES = llr_test.cpp ls_solve_test_SOURCES = ls_solve_test.cpp lu_test_SOURCES = lu_test.cpp matfunc_test_SOURCES = matfunc_test.cpp mat_test_SOURCES = mat_test.cpp modulator_test_SOURCES = modulator_test.cpp modulator_nd_test_SOURCES = modulator_nd_test.cpp newton_search_test_SOURCES = newton_search_test.cpp parser_test_SOURCES = parser_test.cpp parser_test_CPPFLAGS = -DPARSER_TEST_FILE=\"$(srcdir)/parser_test_data.txt\" $(AM_CPPFLAGS) poly_test_SOURCES = poly_test.cpp pulse_shape_test_SOURCES = pulse_shape_test.cpp qr_test_SOURCES = qr_test.cpp rand_test_SOURCES = rand_test.cpp rec_syst_conv_code_test_SOURCES = rec_syst_conv_code_test.cpp reedsolomon_test_SOURCES = reedsolomon_test.cpp schur_test_SOURCES = schur_test.cpp sigfun_test_SOURCES = sigfun_test.cpp sort_test_SOURCES = sort_test.cpp source_test_SOURCES = source_test.cpp sparse_test_SOURCES = sparse_test.cpp specmat_test_SOURCES = specmat_test.cpp stat_test_SOURCES = stat_test.cpp svd_test_SOURCES = svd_test.cpp timer_test_SOURCES = timer_test.cpp transforms_test_SOURCES = transforms_test.cpp turbo_test_SOURCES = turbo_test.cpp vec_test_SOURCES = vec_test.cpp linspace_test_SOURCES = linspace_test.cpp operators_test_SOURCES = operators_test.cpp window_test_SOURCES = window_test.cpp siso_test_SOURCES = siso_test.cpp exit_test_SOURCES = exit_test.cpp stc_test_SOURCES = stc_test.cpp demapper_test_SOURCES = demapper_test.cpp check_PROGRAMS = $(USED_TESTS) tmp_files = $(USED_TESTS:=.tmp) ref_files = $(ALL_TESTS:=.ref) EXTRA_DIST = itfile_test_data.it fastica_test_data.txt parser_test_data.txt \ $(ref_files) check-local: $(check_PROGRAMS) $(ref_files) @total=0; failed=0; \ for i in $(USED_TESTS); \ do \ echo "------------------------------------------------------------------------------"; \ ./$$i$(EXEEXT) 2>/dev/null | sed -e 's/^M$$//' -e 's/\(-\?[0-9]\+\.\?[0-9]*e[+-]\)0\([0-9][0-9]\)/\1\2/g' > $$i.tmp; \ $(DIFF) $(srcdir)/$$i.ref $$i.tmp >/dev/null; \ if [ "x$$?" = "x0" ]; \ then \ echo "Test \`$$i' PASSED."; \ else \ echo "Test \`$$i' FAILED!!!"; \ failed=$$(($$failed + 1)); \ fi; \ total=$$(($$total + 1)); \ done; \ echo "------------------------------------------------------------------------------"; \ if [ $$failed -gt 0 ]; \ then \ echo ""; \ echo "******************************************************************************"; \ echo "*** ERROR: $$failed/$$total tests failed!!!"; \ echo "******************************************************************************"; \ echo ""; \ exit 1; \ fi clean-local: -rm -f $(tmp_files) gf2mat_test.alist ldpc_test.codec itpp-4.3.1/tests/Makefile.in000066400000000000000000001564421216575753400157350ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.common @RUN_LAPACK_TESTS_TRUE@am__append_1 = $(BASE_LAP_TESTS) $(STAT_LAP_TESTS) @ENABLE_COMM_TRUE@am__append_2 = $(COMM_TESTS) @ENABLE_COMM_TRUE@@RUN_LAPACK_TESTS_TRUE@am__append_3 = $(COMM_LAP_TESTS) @ENABLE_COMM_TRUE@@RUN_FFT_TESTS_TRUE@am__append_4 = $(COMM_FFT_TESTS) @ENABLE_FIXED_TRUE@am__append_5 = $(FIXED_TESTS) @ENABLE_OPTIM_TRUE@am__append_6 = $(OPTIM_TESTS) @ENABLE_SIGNAL_TRUE@am__append_7 = $(SIGNAL_TESTS) @ENABLE_SIGNAL_TRUE@@RUN_LAPACK_TESTS_TRUE@am__append_8 = $(SIGNAL_LAP_TESTS) @ENABLE_SIGNAL_TRUE@@RUN_FFT_TESTS_TRUE@am__append_9 = $(SIGNAL_FFT_TESTS) @ENABLE_SIGNAL_TRUE@@RUN_FFT_TESTS_TRUE@@RUN_LAPACK_TESTS_TRUE@am__append_10 = $(SIGNAL_LAP_FFT_TESTS) check_PROGRAMS = $(am__EXEEXT_24) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = array_test$(EXEEXT) bessel_test$(EXEEXT) \ blas_test$(EXEEXT) circular_buffer_test$(EXEEXT) \ converters_test$(EXEEXT) fastmath_test$(EXEEXT) \ gf2mat_test$(EXEEXT) integration_test$(EXEEXT) \ itfile_test$(EXEEXT) mat_test$(EXEEXT) parser_test$(EXEEXT) \ rand_test$(EXEEXT) sort_test$(EXEEXT) sparse_test$(EXEEXT) \ specmat_test$(EXEEXT) timer_test$(EXEEXT) vec_test$(EXEEXT) am__EXEEXT_2 = histogram_test$(EXEEXT) am__EXEEXT_3 = cholesky_test$(EXEEXT) det_test$(EXEEXT) \ eigen_test$(EXEEXT) inv_test$(EXEEXT) ls_solve_test$(EXEEXT) \ lu_test$(EXEEXT) matfunc_test$(EXEEXT) qr_test$(EXEEXT) \ schur_test$(EXEEXT) svd_test$(EXEEXT) am__EXEEXT_4 = stat_test$(EXEEXT) @RUN_LAPACK_TESTS_TRUE@am__EXEEXT_5 = $(am__EXEEXT_3) $(am__EXEEXT_4) am__EXEEXT_6 = bch_test$(EXEEXT) commfunc_test$(EXEEXT) \ convcode_test$(EXEEXT) error_count_test$(EXEEXT) \ galois_test$(EXEEXT) interleaver_test$(EXEEXT) \ ldpc_test$(EXEEXT) llr_test$(EXEEXT) modulator_test$(EXEEXT) \ pulse_shape_test$(EXEEXT) rec_syst_conv_code_test$(EXEEXT) \ reedsolomon_test$(EXEEXT) turbo_test$(EXEEXT) \ siso_test$(EXEEXT) exit_test$(EXEEXT) @ENABLE_COMM_TRUE@am__EXEEXT_7 = $(am__EXEEXT_6) am__EXEEXT_8 = modulator_nd_test$(EXEEXT) @ENABLE_COMM_TRUE@@RUN_LAPACK_TESTS_TRUE@am__EXEEXT_9 = \ @ENABLE_COMM_TRUE@@RUN_LAPACK_TESTS_TRUE@ $(am__EXEEXT_8) am__EXEEXT_10 = channel_test$(EXEEXT) @ENABLE_COMM_TRUE@@RUN_FFT_TESTS_TRUE@am__EXEEXT_11 = \ @ENABLE_COMM_TRUE@@RUN_FFT_TESTS_TRUE@ $(am__EXEEXT_10) am__EXEEXT_12 = fix_test$(EXEEXT) @ENABLE_FIXED_TRUE@am__EXEEXT_13 = $(am__EXEEXT_12) am__EXEEXT_14 = newton_search_test$(EXEEXT) @ENABLE_OPTIM_TRUE@am__EXEEXT_15 = $(am__EXEEXT_14) am__EXEEXT_16 = filter_test$(EXEEXT) source_test$(EXEEXT) \ window_test$(EXEEXT) @ENABLE_SIGNAL_TRUE@am__EXEEXT_17 = $(am__EXEEXT_16) am__EXEEXT_18 = fastica_test$(EXEEXT) poly_test$(EXEEXT) @ENABLE_SIGNAL_TRUE@@RUN_LAPACK_TESTS_TRUE@am__EXEEXT_19 = \ @ENABLE_SIGNAL_TRUE@@RUN_LAPACK_TESTS_TRUE@ $(am__EXEEXT_18) am__EXEEXT_20 = freq_filt_test$(EXEEXT) sigfun_test$(EXEEXT) \ transforms_test$(EXEEXT) @ENABLE_SIGNAL_TRUE@@RUN_FFT_TESTS_TRUE@am__EXEEXT_21 = \ @ENABLE_SIGNAL_TRUE@@RUN_FFT_TESTS_TRUE@ $(am__EXEEXT_20) am__EXEEXT_22 = filter_design_test$(EXEEXT) @ENABLE_SIGNAL_TRUE@@RUN_FFT_TESTS_TRUE@@RUN_LAPACK_TESTS_TRUE@am__EXEEXT_23 = $(am__EXEEXT_22) am__EXEEXT_24 = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_5) \ $(am__EXEEXT_7) $(am__EXEEXT_9) $(am__EXEEXT_11) \ $(am__EXEEXT_13) $(am__EXEEXT_15) $(am__EXEEXT_17) \ $(am__EXEEXT_19) $(am__EXEEXT_21) $(am__EXEEXT_23) am_array_test_OBJECTS = array_test.$(OBJEXT) array_test_OBJECTS = $(am_array_test_OBJECTS) array_test_LDADD = $(LDADD) array_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_bch_test_OBJECTS = bch_test.$(OBJEXT) bch_test_OBJECTS = $(am_bch_test_OBJECTS) bch_test_LDADD = $(LDADD) bch_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_bessel_test_OBJECTS = bessel_test.$(OBJEXT) bessel_test_OBJECTS = $(am_bessel_test_OBJECTS) bessel_test_LDADD = $(LDADD) bessel_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_blas_test_OBJECTS = blas_test.$(OBJEXT) blas_test_OBJECTS = $(am_blas_test_OBJECTS) blas_test_LDADD = $(LDADD) blas_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_channel_test_OBJECTS = channel_test.$(OBJEXT) channel_test_OBJECTS = $(am_channel_test_OBJECTS) channel_test_LDADD = $(LDADD) channel_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_cholesky_test_OBJECTS = cholesky_test.$(OBJEXT) cholesky_test_OBJECTS = $(am_cholesky_test_OBJECTS) cholesky_test_LDADD = $(LDADD) cholesky_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_circular_buffer_test_OBJECTS = circular_buffer_test.$(OBJEXT) circular_buffer_test_OBJECTS = $(am_circular_buffer_test_OBJECTS) circular_buffer_test_LDADD = $(LDADD) circular_buffer_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_commfunc_test_OBJECTS = commfunc_test.$(OBJEXT) commfunc_test_OBJECTS = $(am_commfunc_test_OBJECTS) commfunc_test_LDADD = $(LDADD) commfunc_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_convcode_test_OBJECTS = convcode_test.$(OBJEXT) convcode_test_OBJECTS = $(am_convcode_test_OBJECTS) convcode_test_LDADD = $(LDADD) convcode_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_converters_test_OBJECTS = converters_test.$(OBJEXT) converters_test_OBJECTS = $(am_converters_test_OBJECTS) converters_test_LDADD = $(LDADD) converters_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_det_test_OBJECTS = det_test.$(OBJEXT) det_test_OBJECTS = $(am_det_test_OBJECTS) det_test_LDADD = $(LDADD) det_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_eigen_test_OBJECTS = eigen_test.$(OBJEXT) eigen_test_OBJECTS = $(am_eigen_test_OBJECTS) eigen_test_LDADD = $(LDADD) eigen_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_error_count_test_OBJECTS = error_count_test.$(OBJEXT) error_count_test_OBJECTS = $(am_error_count_test_OBJECTS) error_count_test_LDADD = $(LDADD) error_count_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_exit_test_OBJECTS = exit_test.$(OBJEXT) exit_test_OBJECTS = $(am_exit_test_OBJECTS) exit_test_LDADD = $(LDADD) exit_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_fastica_test_OBJECTS = fastica_test-fastica_test.$(OBJEXT) fastica_test_OBJECTS = $(am_fastica_test_OBJECTS) fastica_test_LDADD = $(LDADD) fastica_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_fastmath_test_OBJECTS = fastmath_test.$(OBJEXT) fastmath_test_OBJECTS = $(am_fastmath_test_OBJECTS) fastmath_test_LDADD = $(LDADD) fastmath_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_filter_design_test_OBJECTS = filter_design_test.$(OBJEXT) filter_design_test_OBJECTS = $(am_filter_design_test_OBJECTS) filter_design_test_LDADD = $(LDADD) filter_design_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_filter_test_OBJECTS = filter_test.$(OBJEXT) filter_test_OBJECTS = $(am_filter_test_OBJECTS) filter_test_LDADD = $(LDADD) filter_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_fix_test_OBJECTS = fix_test.$(OBJEXT) fix_test_OBJECTS = $(am_fix_test_OBJECTS) fix_test_LDADD = $(LDADD) fix_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_freq_filt_test_OBJECTS = freq_filt_test.$(OBJEXT) freq_filt_test_OBJECTS = $(am_freq_filt_test_OBJECTS) freq_filt_test_LDADD = $(LDADD) freq_filt_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_galois_test_OBJECTS = galois_test.$(OBJEXT) galois_test_OBJECTS = $(am_galois_test_OBJECTS) galois_test_LDADD = $(LDADD) galois_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_gf2mat_test_OBJECTS = gf2mat_test.$(OBJEXT) gf2mat_test_OBJECTS = $(am_gf2mat_test_OBJECTS) gf2mat_test_LDADD = $(LDADD) gf2mat_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_histogram_test_OBJECTS = histogram_test.$(OBJEXT) histogram_test_OBJECTS = $(am_histogram_test_OBJECTS) histogram_test_LDADD = $(LDADD) histogram_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_integration_test_OBJECTS = integration_test.$(OBJEXT) integration_test_OBJECTS = $(am_integration_test_OBJECTS) integration_test_LDADD = $(LDADD) integration_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_interleaver_test_OBJECTS = interleaver_test.$(OBJEXT) interleaver_test_OBJECTS = $(am_interleaver_test_OBJECTS) interleaver_test_LDADD = $(LDADD) interleaver_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_inv_test_OBJECTS = inv_test.$(OBJEXT) inv_test_OBJECTS = $(am_inv_test_OBJECTS) inv_test_LDADD = $(LDADD) inv_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_itfile_test_OBJECTS = itfile_test-itfile_test.$(OBJEXT) itfile_test_OBJECTS = $(am_itfile_test_OBJECTS) itfile_test_LDADD = $(LDADD) itfile_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_ldpc_test_OBJECTS = ldpc_test.$(OBJEXT) ldpc_test_OBJECTS = $(am_ldpc_test_OBJECTS) ldpc_test_LDADD = $(LDADD) ldpc_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_llr_test_OBJECTS = llr_test.$(OBJEXT) llr_test_OBJECTS = $(am_llr_test_OBJECTS) llr_test_LDADD = $(LDADD) llr_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_ls_solve_test_OBJECTS = ls_solve_test.$(OBJEXT) ls_solve_test_OBJECTS = $(am_ls_solve_test_OBJECTS) ls_solve_test_LDADD = $(LDADD) ls_solve_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_lu_test_OBJECTS = lu_test.$(OBJEXT) lu_test_OBJECTS = $(am_lu_test_OBJECTS) lu_test_LDADD = $(LDADD) lu_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_mat_test_OBJECTS = mat_test.$(OBJEXT) mat_test_OBJECTS = $(am_mat_test_OBJECTS) mat_test_LDADD = $(LDADD) mat_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_matfunc_test_OBJECTS = matfunc_test.$(OBJEXT) matfunc_test_OBJECTS = $(am_matfunc_test_OBJECTS) matfunc_test_LDADD = $(LDADD) matfunc_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_modulator_nd_test_OBJECTS = modulator_nd_test.$(OBJEXT) modulator_nd_test_OBJECTS = $(am_modulator_nd_test_OBJECTS) modulator_nd_test_LDADD = $(LDADD) modulator_nd_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_modulator_test_OBJECTS = modulator_test.$(OBJEXT) modulator_test_OBJECTS = $(am_modulator_test_OBJECTS) modulator_test_LDADD = $(LDADD) modulator_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_newton_search_test_OBJECTS = newton_search_test.$(OBJEXT) newton_search_test_OBJECTS = $(am_newton_search_test_OBJECTS) newton_search_test_LDADD = $(LDADD) newton_search_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_parser_test_OBJECTS = parser_test-parser_test.$(OBJEXT) parser_test_OBJECTS = $(am_parser_test_OBJECTS) parser_test_LDADD = $(LDADD) parser_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_poly_test_OBJECTS = poly_test.$(OBJEXT) poly_test_OBJECTS = $(am_poly_test_OBJECTS) poly_test_LDADD = $(LDADD) poly_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_pulse_shape_test_OBJECTS = pulse_shape_test.$(OBJEXT) pulse_shape_test_OBJECTS = $(am_pulse_shape_test_OBJECTS) pulse_shape_test_LDADD = $(LDADD) pulse_shape_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_qr_test_OBJECTS = qr_test.$(OBJEXT) qr_test_OBJECTS = $(am_qr_test_OBJECTS) qr_test_LDADD = $(LDADD) qr_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_rand_test_OBJECTS = rand_test.$(OBJEXT) rand_test_OBJECTS = $(am_rand_test_OBJECTS) rand_test_LDADD = $(LDADD) rand_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_rec_syst_conv_code_test_OBJECTS = \ rec_syst_conv_code_test.$(OBJEXT) rec_syst_conv_code_test_OBJECTS = \ $(am_rec_syst_conv_code_test_OBJECTS) rec_syst_conv_code_test_LDADD = $(LDADD) rec_syst_conv_code_test_DEPENDENCIES = \ $(top_builddir)/itpp/libitpp.la am_reedsolomon_test_OBJECTS = reedsolomon_test.$(OBJEXT) reedsolomon_test_OBJECTS = $(am_reedsolomon_test_OBJECTS) reedsolomon_test_LDADD = $(LDADD) reedsolomon_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_schur_test_OBJECTS = schur_test.$(OBJEXT) schur_test_OBJECTS = $(am_schur_test_OBJECTS) schur_test_LDADD = $(LDADD) schur_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_sigfun_test_OBJECTS = sigfun_test.$(OBJEXT) sigfun_test_OBJECTS = $(am_sigfun_test_OBJECTS) sigfun_test_LDADD = $(LDADD) sigfun_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_siso_test_OBJECTS = siso_test.$(OBJEXT) siso_test_OBJECTS = $(am_siso_test_OBJECTS) siso_test_LDADD = $(LDADD) siso_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_sort_test_OBJECTS = sort_test.$(OBJEXT) sort_test_OBJECTS = $(am_sort_test_OBJECTS) sort_test_LDADD = $(LDADD) sort_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_source_test_OBJECTS = source_test.$(OBJEXT) source_test_OBJECTS = $(am_source_test_OBJECTS) source_test_LDADD = $(LDADD) source_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_sparse_test_OBJECTS = sparse_test.$(OBJEXT) sparse_test_OBJECTS = $(am_sparse_test_OBJECTS) sparse_test_LDADD = $(LDADD) sparse_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_specmat_test_OBJECTS = specmat_test.$(OBJEXT) specmat_test_OBJECTS = $(am_specmat_test_OBJECTS) specmat_test_LDADD = $(LDADD) specmat_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_stat_test_OBJECTS = stat_test.$(OBJEXT) stat_test_OBJECTS = $(am_stat_test_OBJECTS) stat_test_LDADD = $(LDADD) stat_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_svd_test_OBJECTS = svd_test.$(OBJEXT) svd_test_OBJECTS = $(am_svd_test_OBJECTS) svd_test_LDADD = $(LDADD) svd_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_timer_test_OBJECTS = timer_test.$(OBJEXT) timer_test_OBJECTS = $(am_timer_test_OBJECTS) timer_test_LDADD = $(LDADD) timer_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_transforms_test_OBJECTS = transforms_test.$(OBJEXT) transforms_test_OBJECTS = $(am_transforms_test_OBJECTS) transforms_test_LDADD = $(LDADD) transforms_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_turbo_test_OBJECTS = turbo_test.$(OBJEXT) turbo_test_OBJECTS = $(am_turbo_test_OBJECTS) turbo_test_LDADD = $(LDADD) turbo_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_vec_test_OBJECTS = vec_test.$(OBJEXT) vec_test_OBJECTS = $(am_vec_test_OBJECTS) vec_test_LDADD = $(LDADD) vec_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la am_window_test_OBJECTS = window_test.$(OBJEXT) window_test_OBJECTS = $(am_window_test_OBJECTS) window_test_LDADD = $(LDADD) window_test_DEPENDENCIES = $(top_builddir)/itpp/libitpp.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/itpp depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(array_test_SOURCES) $(bch_test_SOURCES) \ $(bessel_test_SOURCES) $(blas_test_SOURCES) \ $(channel_test_SOURCES) $(cholesky_test_SOURCES) \ $(circular_buffer_test_SOURCES) $(commfunc_test_SOURCES) \ $(convcode_test_SOURCES) $(converters_test_SOURCES) \ $(det_test_SOURCES) $(eigen_test_SOURCES) \ $(error_count_test_SOURCES) $(exit_test_SOURCES) \ $(fastica_test_SOURCES) $(fastmath_test_SOURCES) \ $(filter_design_test_SOURCES) $(filter_test_SOURCES) \ $(fix_test_SOURCES) $(freq_filt_test_SOURCES) \ $(galois_test_SOURCES) $(gf2mat_test_SOURCES) \ $(histogram_test_SOURCES) $(integration_test_SOURCES) \ $(interleaver_test_SOURCES) $(inv_test_SOURCES) \ $(itfile_test_SOURCES) $(ldpc_test_SOURCES) \ $(llr_test_SOURCES) $(ls_solve_test_SOURCES) \ $(lu_test_SOURCES) $(mat_test_SOURCES) $(matfunc_test_SOURCES) \ $(modulator_nd_test_SOURCES) $(modulator_test_SOURCES) \ $(newton_search_test_SOURCES) $(parser_test_SOURCES) \ $(poly_test_SOURCES) $(pulse_shape_test_SOURCES) \ $(qr_test_SOURCES) $(rand_test_SOURCES) \ $(rec_syst_conv_code_test_SOURCES) $(reedsolomon_test_SOURCES) \ $(schur_test_SOURCES) $(sigfun_test_SOURCES) \ $(siso_test_SOURCES) $(sort_test_SOURCES) \ $(source_test_SOURCES) $(sparse_test_SOURCES) \ $(specmat_test_SOURCES) $(stat_test_SOURCES) \ $(svd_test_SOURCES) $(timer_test_SOURCES) \ $(transforms_test_SOURCES) $(turbo_test_SOURCES) \ $(vec_test_SOURCES) $(window_test_SOURCES) DIST_SOURCES = $(array_test_SOURCES) $(bch_test_SOURCES) \ $(bessel_test_SOURCES) $(blas_test_SOURCES) \ $(channel_test_SOURCES) $(cholesky_test_SOURCES) \ $(circular_buffer_test_SOURCES) $(commfunc_test_SOURCES) \ $(convcode_test_SOURCES) $(converters_test_SOURCES) \ $(det_test_SOURCES) $(eigen_test_SOURCES) \ $(error_count_test_SOURCES) $(exit_test_SOURCES) \ $(fastica_test_SOURCES) $(fastmath_test_SOURCES) \ $(filter_design_test_SOURCES) $(filter_test_SOURCES) \ $(fix_test_SOURCES) $(freq_filt_test_SOURCES) \ $(galois_test_SOURCES) $(gf2mat_test_SOURCES) \ $(histogram_test_SOURCES) $(integration_test_SOURCES) \ $(interleaver_test_SOURCES) $(inv_test_SOURCES) \ $(itfile_test_SOURCES) $(ldpc_test_SOURCES) \ $(llr_test_SOURCES) $(ls_solve_test_SOURCES) \ $(lu_test_SOURCES) $(mat_test_SOURCES) $(matfunc_test_SOURCES) \ $(modulator_nd_test_SOURCES) $(modulator_test_SOURCES) \ $(newton_search_test_SOURCES) $(parser_test_SOURCES) \ $(poly_test_SOURCES) $(pulse_shape_test_SOURCES) \ $(qr_test_SOURCES) $(rand_test_SOURCES) \ $(rec_syst_conv_code_test_SOURCES) $(reedsolomon_test_SOURCES) \ $(schur_test_SOURCES) $(sigfun_test_SOURCES) \ $(siso_test_SOURCES) $(sort_test_SOURCES) \ $(source_test_SOURCES) $(sparse_test_SOURCES) \ $(specmat_test_SOURCES) $(stat_test_SOURCES) \ $(svd_test_SOURCES) $(timer_test_SOURCES) \ $(transforms_test_SOURCES) $(turbo_test_SOURCES) \ $(vec_test_SOURCES) $(window_test_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) LDADD = $(top_builddir)/itpp/libitpp.la AM_CXXFLAGS = $(CXXFLAGS_OPT) BASE_TESTS = array_test bessel_test blas_test circular_buffer_test \ converters_test fastmath_test gf2mat_test integration_test itfile_test \ mat_test parser_test rand_test sort_test sparse_test specmat_test \ timer_test vec_test BASE_LAP_TESTS = cholesky_test det_test eigen_test inv_test ls_solve_test \ lu_test matfunc_test qr_test schur_test svd_test COMM_TESTS = bch_test commfunc_test convcode_test error_count_test \ galois_test interleaver_test ldpc_test llr_test modulator_test \ pulse_shape_test rec_syst_conv_code_test reedsolomon_test turbo_test siso_test \ exit_test COMM_LAP_TESTS = modulator_nd_test COMM_FFT_TESTS = channel_test FIXED_TESTS = fix_test OPTIM_TESTS = newton_search_test SIGNAL_TESTS = filter_test source_test window_test SIGNAL_LAP_TESTS = fastica_test poly_test SIGNAL_FFT_TESTS = freq_filt_test sigfun_test transforms_test SIGNAL_LAP_FFT_TESTS = filter_design_test STAT_TESTS = histogram_test STAT_LAP_TESTS = stat_test ALL_TESTS = $(BASE_TESTS) $(BASE_LAP_TESTS) $(COMM_TESTS) $(COMM_LAP_TESTS) \ $(COMM_FFT_TESTS) $(FIXED_TESTS) $(OPTIM_TESTS) $(SIGNAL_TESTS) \ $(SIGNAL_LAP_TESTS) $(SIGNAL_FFT_TESTS) $(SIGNAL_LAP_FFT_TESTS) \ $(STAT_TESTS) $(STAT_LAP_TESTS) USED_TESTS = $(BASE_TESTS) $(STAT_TESTS) $(am__append_1) \ $(am__append_2) $(am__append_3) $(am__append_4) \ $(am__append_5) $(am__append_6) $(am__append_7) \ $(am__append_8) $(am__append_9) $(am__append_10) array_test_SOURCES = array_test.cpp bch_test_SOURCES = bch_test.cpp bessel_test_SOURCES = bessel_test.cpp blas_test_SOURCES = blas_test.cpp channel_test_SOURCES = channel_test.cpp converters_test_SOURCES = converters_test.cpp itfile_test_SOURCES = itfile_test.cpp itfile_test_CPPFLAGS = -DITFILE_TEST_FILE=\"$(srcdir)/itfile_test_data.it\" $(AM_CPPFLAGS) cholesky_test_SOURCES = cholesky_test.cpp circular_buffer_test_SOURCES = circular_buffer_test.cpp commfunc_test_SOURCES = commfunc_test.cpp convcode_test_SOURCES = convcode_test.cpp det_test_SOURCES = det_test.cpp eigen_test_SOURCES = eigen_test.cpp error_count_test_SOURCES = error_count_test.cpp fastica_test_SOURCES = fastica_test.cpp fastica_test_CPPFLAGS = -DFASTICA_TEST_FILE=\"$(srcdir)/fastica_test_data.txt\" $(AM_CPPFLAGS) fastmath_test_SOURCES = fastmath_test.cpp filter_test_SOURCES = filter_test.cpp filter_design_test_SOURCES = filter_design_test.cpp fix_test_SOURCES = fix_test.cpp freq_filt_test_SOURCES = freq_filt_test.cpp galois_test_SOURCES = galois_test.cpp gf2mat_test_SOURCES = gf2mat_test.cpp histogram_test_SOURCES = histogram_test.cpp integration_test_SOURCES = integration_test.cpp interleaver_test_SOURCES = interleaver_test.cpp inv_test_SOURCES = inv_test.cpp ldpc_test_SOURCES = ldpc_test.cpp llr_test_SOURCES = llr_test.cpp ls_solve_test_SOURCES = ls_solve_test.cpp lu_test_SOURCES = lu_test.cpp matfunc_test_SOURCES = matfunc_test.cpp mat_test_SOURCES = mat_test.cpp modulator_test_SOURCES = modulator_test.cpp modulator_nd_test_SOURCES = modulator_nd_test.cpp newton_search_test_SOURCES = newton_search_test.cpp parser_test_SOURCES = parser_test.cpp parser_test_CPPFLAGS = -DPARSER_TEST_FILE=\"$(srcdir)/parser_test_data.txt\" $(AM_CPPFLAGS) poly_test_SOURCES = poly_test.cpp pulse_shape_test_SOURCES = pulse_shape_test.cpp qr_test_SOURCES = qr_test.cpp rand_test_SOURCES = rand_test.cpp rec_syst_conv_code_test_SOURCES = rec_syst_conv_code_test.cpp reedsolomon_test_SOURCES = reedsolomon_test.cpp schur_test_SOURCES = schur_test.cpp sigfun_test_SOURCES = sigfun_test.cpp sort_test_SOURCES = sort_test.cpp source_test_SOURCES = source_test.cpp sparse_test_SOURCES = sparse_test.cpp specmat_test_SOURCES = specmat_test.cpp stat_test_SOURCES = stat_test.cpp svd_test_SOURCES = svd_test.cpp timer_test_SOURCES = timer_test.cpp transforms_test_SOURCES = transforms_test.cpp turbo_test_SOURCES = turbo_test.cpp vec_test_SOURCES = vec_test.cpp window_test_SOURCES = window_test.cpp siso_test_SOURCES = siso_test.cpp exit_test_SOURCES = exit_test.cpp tmp_files = $(USED_TESTS:=.tmp) ref_files = $(ALL_TESTS:=.ref) EXTRA_DIST = itfile_test_data.it fastica_test_data.txt parser_test_data.txt \ $(ref_files) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list array_test$(EXEEXT): $(array_test_OBJECTS) $(array_test_DEPENDENCIES) @rm -f array_test$(EXEEXT) $(CXXLINK) $(array_test_OBJECTS) $(array_test_LDADD) $(LIBS) bch_test$(EXEEXT): $(bch_test_OBJECTS) $(bch_test_DEPENDENCIES) @rm -f bch_test$(EXEEXT) $(CXXLINK) $(bch_test_OBJECTS) $(bch_test_LDADD) $(LIBS) bessel_test$(EXEEXT): $(bessel_test_OBJECTS) $(bessel_test_DEPENDENCIES) @rm -f bessel_test$(EXEEXT) $(CXXLINK) $(bessel_test_OBJECTS) $(bessel_test_LDADD) $(LIBS) blas_test$(EXEEXT): $(blas_test_OBJECTS) $(blas_test_DEPENDENCIES) @rm -f blas_test$(EXEEXT) $(CXXLINK) $(blas_test_OBJECTS) $(blas_test_LDADD) $(LIBS) channel_test$(EXEEXT): $(channel_test_OBJECTS) $(channel_test_DEPENDENCIES) @rm -f channel_test$(EXEEXT) $(CXXLINK) $(channel_test_OBJECTS) $(channel_test_LDADD) $(LIBS) cholesky_test$(EXEEXT): $(cholesky_test_OBJECTS) $(cholesky_test_DEPENDENCIES) @rm -f cholesky_test$(EXEEXT) $(CXXLINK) $(cholesky_test_OBJECTS) $(cholesky_test_LDADD) $(LIBS) circular_buffer_test$(EXEEXT): $(circular_buffer_test_OBJECTS) $(circular_buffer_test_DEPENDENCIES) @rm -f circular_buffer_test$(EXEEXT) $(CXXLINK) $(circular_buffer_test_OBJECTS) $(circular_buffer_test_LDADD) $(LIBS) commfunc_test$(EXEEXT): $(commfunc_test_OBJECTS) $(commfunc_test_DEPENDENCIES) @rm -f commfunc_test$(EXEEXT) $(CXXLINK) $(commfunc_test_OBJECTS) $(commfunc_test_LDADD) $(LIBS) convcode_test$(EXEEXT): $(convcode_test_OBJECTS) $(convcode_test_DEPENDENCIES) @rm -f convcode_test$(EXEEXT) $(CXXLINK) $(convcode_test_OBJECTS) $(convcode_test_LDADD) $(LIBS) converters_test$(EXEEXT): $(converters_test_OBJECTS) $(converters_test_DEPENDENCIES) @rm -f converters_test$(EXEEXT) $(CXXLINK) $(converters_test_OBJECTS) $(converters_test_LDADD) $(LIBS) det_test$(EXEEXT): $(det_test_OBJECTS) $(det_test_DEPENDENCIES) @rm -f det_test$(EXEEXT) $(CXXLINK) $(det_test_OBJECTS) $(det_test_LDADD) $(LIBS) eigen_test$(EXEEXT): $(eigen_test_OBJECTS) $(eigen_test_DEPENDENCIES) @rm -f eigen_test$(EXEEXT) $(CXXLINK) $(eigen_test_OBJECTS) $(eigen_test_LDADD) $(LIBS) error_count_test$(EXEEXT): $(error_count_test_OBJECTS) $(error_count_test_DEPENDENCIES) @rm -f error_count_test$(EXEEXT) $(CXXLINK) $(error_count_test_OBJECTS) $(error_count_test_LDADD) $(LIBS) exit_test$(EXEEXT): $(exit_test_OBJECTS) $(exit_test_DEPENDENCIES) @rm -f exit_test$(EXEEXT) $(CXXLINK) $(exit_test_OBJECTS) $(exit_test_LDADD) $(LIBS) fastica_test$(EXEEXT): $(fastica_test_OBJECTS) $(fastica_test_DEPENDENCIES) @rm -f fastica_test$(EXEEXT) $(CXXLINK) $(fastica_test_OBJECTS) $(fastica_test_LDADD) $(LIBS) fastmath_test$(EXEEXT): $(fastmath_test_OBJECTS) $(fastmath_test_DEPENDENCIES) @rm -f fastmath_test$(EXEEXT) $(CXXLINK) $(fastmath_test_OBJECTS) $(fastmath_test_LDADD) $(LIBS) filter_design_test$(EXEEXT): $(filter_design_test_OBJECTS) $(filter_design_test_DEPENDENCIES) @rm -f filter_design_test$(EXEEXT) $(CXXLINK) $(filter_design_test_OBJECTS) $(filter_design_test_LDADD) $(LIBS) filter_test$(EXEEXT): $(filter_test_OBJECTS) $(filter_test_DEPENDENCIES) @rm -f filter_test$(EXEEXT) $(CXXLINK) $(filter_test_OBJECTS) $(filter_test_LDADD) $(LIBS) fix_test$(EXEEXT): $(fix_test_OBJECTS) $(fix_test_DEPENDENCIES) @rm -f fix_test$(EXEEXT) $(CXXLINK) $(fix_test_OBJECTS) $(fix_test_LDADD) $(LIBS) freq_filt_test$(EXEEXT): $(freq_filt_test_OBJECTS) $(freq_filt_test_DEPENDENCIES) @rm -f freq_filt_test$(EXEEXT) $(CXXLINK) $(freq_filt_test_OBJECTS) $(freq_filt_test_LDADD) $(LIBS) galois_test$(EXEEXT): $(galois_test_OBJECTS) $(galois_test_DEPENDENCIES) @rm -f galois_test$(EXEEXT) $(CXXLINK) $(galois_test_OBJECTS) $(galois_test_LDADD) $(LIBS) gf2mat_test$(EXEEXT): $(gf2mat_test_OBJECTS) $(gf2mat_test_DEPENDENCIES) @rm -f gf2mat_test$(EXEEXT) $(CXXLINK) $(gf2mat_test_OBJECTS) $(gf2mat_test_LDADD) $(LIBS) histogram_test$(EXEEXT): $(histogram_test_OBJECTS) $(histogram_test_DEPENDENCIES) @rm -f histogram_test$(EXEEXT) $(CXXLINK) $(histogram_test_OBJECTS) $(histogram_test_LDADD) $(LIBS) integration_test$(EXEEXT): $(integration_test_OBJECTS) $(integration_test_DEPENDENCIES) @rm -f integration_test$(EXEEXT) $(CXXLINK) $(integration_test_OBJECTS) $(integration_test_LDADD) $(LIBS) interleaver_test$(EXEEXT): $(interleaver_test_OBJECTS) $(interleaver_test_DEPENDENCIES) @rm -f interleaver_test$(EXEEXT) $(CXXLINK) $(interleaver_test_OBJECTS) $(interleaver_test_LDADD) $(LIBS) inv_test$(EXEEXT): $(inv_test_OBJECTS) $(inv_test_DEPENDENCIES) @rm -f inv_test$(EXEEXT) $(CXXLINK) $(inv_test_OBJECTS) $(inv_test_LDADD) $(LIBS) itfile_test$(EXEEXT): $(itfile_test_OBJECTS) $(itfile_test_DEPENDENCIES) @rm -f itfile_test$(EXEEXT) $(CXXLINK) $(itfile_test_OBJECTS) $(itfile_test_LDADD) $(LIBS) ldpc_test$(EXEEXT): $(ldpc_test_OBJECTS) $(ldpc_test_DEPENDENCIES) @rm -f ldpc_test$(EXEEXT) $(CXXLINK) $(ldpc_test_OBJECTS) $(ldpc_test_LDADD) $(LIBS) llr_test$(EXEEXT): $(llr_test_OBJECTS) $(llr_test_DEPENDENCIES) @rm -f llr_test$(EXEEXT) $(CXXLINK) $(llr_test_OBJECTS) $(llr_test_LDADD) $(LIBS) ls_solve_test$(EXEEXT): $(ls_solve_test_OBJECTS) $(ls_solve_test_DEPENDENCIES) @rm -f ls_solve_test$(EXEEXT) $(CXXLINK) $(ls_solve_test_OBJECTS) $(ls_solve_test_LDADD) $(LIBS) lu_test$(EXEEXT): $(lu_test_OBJECTS) $(lu_test_DEPENDENCIES) @rm -f lu_test$(EXEEXT) $(CXXLINK) $(lu_test_OBJECTS) $(lu_test_LDADD) $(LIBS) mat_test$(EXEEXT): $(mat_test_OBJECTS) $(mat_test_DEPENDENCIES) @rm -f mat_test$(EXEEXT) $(CXXLINK) $(mat_test_OBJECTS) $(mat_test_LDADD) $(LIBS) matfunc_test$(EXEEXT): $(matfunc_test_OBJECTS) $(matfunc_test_DEPENDENCIES) @rm -f matfunc_test$(EXEEXT) $(CXXLINK) $(matfunc_test_OBJECTS) $(matfunc_test_LDADD) $(LIBS) modulator_nd_test$(EXEEXT): $(modulator_nd_test_OBJECTS) $(modulator_nd_test_DEPENDENCIES) @rm -f modulator_nd_test$(EXEEXT) $(CXXLINK) $(modulator_nd_test_OBJECTS) $(modulator_nd_test_LDADD) $(LIBS) modulator_test$(EXEEXT): $(modulator_test_OBJECTS) $(modulator_test_DEPENDENCIES) @rm -f modulator_test$(EXEEXT) $(CXXLINK) $(modulator_test_OBJECTS) $(modulator_test_LDADD) $(LIBS) newton_search_test$(EXEEXT): $(newton_search_test_OBJECTS) $(newton_search_test_DEPENDENCIES) @rm -f newton_search_test$(EXEEXT) $(CXXLINK) $(newton_search_test_OBJECTS) $(newton_search_test_LDADD) $(LIBS) parser_test$(EXEEXT): $(parser_test_OBJECTS) $(parser_test_DEPENDENCIES) @rm -f parser_test$(EXEEXT) $(CXXLINK) $(parser_test_OBJECTS) $(parser_test_LDADD) $(LIBS) poly_test$(EXEEXT): $(poly_test_OBJECTS) $(poly_test_DEPENDENCIES) @rm -f poly_test$(EXEEXT) $(CXXLINK) $(poly_test_OBJECTS) $(poly_test_LDADD) $(LIBS) pulse_shape_test$(EXEEXT): $(pulse_shape_test_OBJECTS) $(pulse_shape_test_DEPENDENCIES) @rm -f pulse_shape_test$(EXEEXT) $(CXXLINK) $(pulse_shape_test_OBJECTS) $(pulse_shape_test_LDADD) $(LIBS) qr_test$(EXEEXT): $(qr_test_OBJECTS) $(qr_test_DEPENDENCIES) @rm -f qr_test$(EXEEXT) $(CXXLINK) $(qr_test_OBJECTS) $(qr_test_LDADD) $(LIBS) rand_test$(EXEEXT): $(rand_test_OBJECTS) $(rand_test_DEPENDENCIES) @rm -f rand_test$(EXEEXT) $(CXXLINK) $(rand_test_OBJECTS) $(rand_test_LDADD) $(LIBS) rec_syst_conv_code_test$(EXEEXT): $(rec_syst_conv_code_test_OBJECTS) $(rec_syst_conv_code_test_DEPENDENCIES) @rm -f rec_syst_conv_code_test$(EXEEXT) $(CXXLINK) $(rec_syst_conv_code_test_OBJECTS) $(rec_syst_conv_code_test_LDADD) $(LIBS) reedsolomon_test$(EXEEXT): $(reedsolomon_test_OBJECTS) $(reedsolomon_test_DEPENDENCIES) @rm -f reedsolomon_test$(EXEEXT) $(CXXLINK) $(reedsolomon_test_OBJECTS) $(reedsolomon_test_LDADD) $(LIBS) schur_test$(EXEEXT): $(schur_test_OBJECTS) $(schur_test_DEPENDENCIES) @rm -f schur_test$(EXEEXT) $(CXXLINK) $(schur_test_OBJECTS) $(schur_test_LDADD) $(LIBS) sigfun_test$(EXEEXT): $(sigfun_test_OBJECTS) $(sigfun_test_DEPENDENCIES) @rm -f sigfun_test$(EXEEXT) $(CXXLINK) $(sigfun_test_OBJECTS) $(sigfun_test_LDADD) $(LIBS) siso_test$(EXEEXT): $(siso_test_OBJECTS) $(siso_test_DEPENDENCIES) @rm -f siso_test$(EXEEXT) $(CXXLINK) $(siso_test_OBJECTS) $(siso_test_LDADD) $(LIBS) sort_test$(EXEEXT): $(sort_test_OBJECTS) $(sort_test_DEPENDENCIES) @rm -f sort_test$(EXEEXT) $(CXXLINK) $(sort_test_OBJECTS) $(sort_test_LDADD) $(LIBS) source_test$(EXEEXT): $(source_test_OBJECTS) $(source_test_DEPENDENCIES) @rm -f source_test$(EXEEXT) $(CXXLINK) $(source_test_OBJECTS) $(source_test_LDADD) $(LIBS) sparse_test$(EXEEXT): $(sparse_test_OBJECTS) $(sparse_test_DEPENDENCIES) @rm -f sparse_test$(EXEEXT) $(CXXLINK) $(sparse_test_OBJECTS) $(sparse_test_LDADD) $(LIBS) specmat_test$(EXEEXT): $(specmat_test_OBJECTS) $(specmat_test_DEPENDENCIES) @rm -f specmat_test$(EXEEXT) $(CXXLINK) $(specmat_test_OBJECTS) $(specmat_test_LDADD) $(LIBS) stat_test$(EXEEXT): $(stat_test_OBJECTS) $(stat_test_DEPENDENCIES) @rm -f stat_test$(EXEEXT) $(CXXLINK) $(stat_test_OBJECTS) $(stat_test_LDADD) $(LIBS) svd_test$(EXEEXT): $(svd_test_OBJECTS) $(svd_test_DEPENDENCIES) @rm -f svd_test$(EXEEXT) $(CXXLINK) $(svd_test_OBJECTS) $(svd_test_LDADD) $(LIBS) timer_test$(EXEEXT): $(timer_test_OBJECTS) $(timer_test_DEPENDENCIES) @rm -f timer_test$(EXEEXT) $(CXXLINK) $(timer_test_OBJECTS) $(timer_test_LDADD) $(LIBS) transforms_test$(EXEEXT): $(transforms_test_OBJECTS) $(transforms_test_DEPENDENCIES) @rm -f transforms_test$(EXEEXT) $(CXXLINK) $(transforms_test_OBJECTS) $(transforms_test_LDADD) $(LIBS) turbo_test$(EXEEXT): $(turbo_test_OBJECTS) $(turbo_test_DEPENDENCIES) @rm -f turbo_test$(EXEEXT) $(CXXLINK) $(turbo_test_OBJECTS) $(turbo_test_LDADD) $(LIBS) vec_test$(EXEEXT): $(vec_test_OBJECTS) $(vec_test_DEPENDENCIES) @rm -f vec_test$(EXEEXT) $(CXXLINK) $(vec_test_OBJECTS) $(vec_test_LDADD) $(LIBS) window_test$(EXEEXT): $(window_test_OBJECTS) $(window_test_DEPENDENCIES) @rm -f window_test$(EXEEXT) $(CXXLINK) $(window_test_OBJECTS) $(window_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bch_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bessel_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blas_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cholesky_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/circular_buffer_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commfunc_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convcode_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/converters_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/det_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eigen_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_count_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exit_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fastica_test-fastica_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fastmath_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_design_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fix_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freq_filt_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/galois_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gf2mat_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/histogram_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/integration_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interleaver_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inv_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itfile_test-itfile_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldpc_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llr_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ls_solve_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lu_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mat_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matfunc_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modulator_nd_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modulator_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newton_search_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser_test-parser_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poly_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pulse_shape_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qr_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rand_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rec_syst_conv_code_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reedsolomon_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/schur_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigfun_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/siso_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparse_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/specmat_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/svd_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transforms_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/turbo_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vec_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window_test.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< fastica_test-fastica_test.o: fastica_test.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fastica_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fastica_test-fastica_test.o -MD -MP -MF $(DEPDIR)/fastica_test-fastica_test.Tpo -c -o fastica_test-fastica_test.o `test -f 'fastica_test.cpp' || echo '$(srcdir)/'`fastica_test.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fastica_test-fastica_test.Tpo $(DEPDIR)/fastica_test-fastica_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fastica_test.cpp' object='fastica_test-fastica_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fastica_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fastica_test-fastica_test.o `test -f 'fastica_test.cpp' || echo '$(srcdir)/'`fastica_test.cpp fastica_test-fastica_test.obj: fastica_test.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fastica_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fastica_test-fastica_test.obj -MD -MP -MF $(DEPDIR)/fastica_test-fastica_test.Tpo -c -o fastica_test-fastica_test.obj `if test -f 'fastica_test.cpp'; then $(CYGPATH_W) 'fastica_test.cpp'; else $(CYGPATH_W) '$(srcdir)/fastica_test.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fastica_test-fastica_test.Tpo $(DEPDIR)/fastica_test-fastica_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fastica_test.cpp' object='fastica_test-fastica_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(fastica_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fastica_test-fastica_test.obj `if test -f 'fastica_test.cpp'; then $(CYGPATH_W) 'fastica_test.cpp'; else $(CYGPATH_W) '$(srcdir)/fastica_test.cpp'; fi` itfile_test-itfile_test.o: itfile_test.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(itfile_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT itfile_test-itfile_test.o -MD -MP -MF $(DEPDIR)/itfile_test-itfile_test.Tpo -c -o itfile_test-itfile_test.o `test -f 'itfile_test.cpp' || echo '$(srcdir)/'`itfile_test.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/itfile_test-itfile_test.Tpo $(DEPDIR)/itfile_test-itfile_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='itfile_test.cpp' object='itfile_test-itfile_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(itfile_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o itfile_test-itfile_test.o `test -f 'itfile_test.cpp' || echo '$(srcdir)/'`itfile_test.cpp itfile_test-itfile_test.obj: itfile_test.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(itfile_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT itfile_test-itfile_test.obj -MD -MP -MF $(DEPDIR)/itfile_test-itfile_test.Tpo -c -o itfile_test-itfile_test.obj `if test -f 'itfile_test.cpp'; then $(CYGPATH_W) 'itfile_test.cpp'; else $(CYGPATH_W) '$(srcdir)/itfile_test.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/itfile_test-itfile_test.Tpo $(DEPDIR)/itfile_test-itfile_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='itfile_test.cpp' object='itfile_test-itfile_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(itfile_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o itfile_test-itfile_test.obj `if test -f 'itfile_test.cpp'; then $(CYGPATH_W) 'itfile_test.cpp'; else $(CYGPATH_W) '$(srcdir)/itfile_test.cpp'; fi` parser_test-parser_test.o: parser_test.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT parser_test-parser_test.o -MD -MP -MF $(DEPDIR)/parser_test-parser_test.Tpo -c -o parser_test-parser_test.o `test -f 'parser_test.cpp' || echo '$(srcdir)/'`parser_test.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/parser_test-parser_test.Tpo $(DEPDIR)/parser_test-parser_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parser_test.cpp' object='parser_test-parser_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o parser_test-parser_test.o `test -f 'parser_test.cpp' || echo '$(srcdir)/'`parser_test.cpp parser_test-parser_test.obj: parser_test.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT parser_test-parser_test.obj -MD -MP -MF $(DEPDIR)/parser_test-parser_test.Tpo -c -o parser_test-parser_test.obj `if test -f 'parser_test.cpp'; then $(CYGPATH_W) 'parser_test.cpp'; else $(CYGPATH_W) '$(srcdir)/parser_test.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/parser_test-parser_test.Tpo $(DEPDIR)/parser_test-parser_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parser_test.cpp' object='parser_test-parser_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o parser_test-parser_test.obj `if test -f 'parser_test.cpp'; then $(CYGPATH_W) 'parser_test.cpp'; else $(CYGPATH_W) '$(srcdir)/parser_test.cpp'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ ctags distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am @SET_MAKE@ check-local: $(check_PROGRAMS) $(ref_files) @total=0; failed=0; \ for i in $(USED_TESTS); \ do \ echo "------------------------------------------------------------------------------"; \ ./$$i$(EXEEXT) 2>/dev/null | sed -e 's/^M$$//' -e 's/\(-\?[0-9]\+\.\?[0-9]*e[+-]\)0\([0-9][0-9]\)/\1\2/g' > $$i.tmp; \ $(DIFF) $(srcdir)/$$i.ref $$i.tmp >/dev/null; \ if [ "x$$?" = "x0" ]; \ then \ echo "Test \`$$i' PASSED."; \ else \ echo "Test \`$$i' FAILED!!!"; \ failed=$$(($$failed + 1)); \ fi; \ total=$$(($$total + 1)); \ done; \ echo "------------------------------------------------------------------------------"; \ if [ $$failed -gt 0 ]; \ then \ echo ""; \ echo "******************************************************************************"; \ echo "*** ERROR: $$failed/$$total tests failed!!!"; \ echo "******************************************************************************"; \ echo ""; \ exit 1; \ fi clean-local: -rm -f $(tmp_files) gf2mat_test.alist ldpc_test.codec # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/tests/array_test.cpp000066400000000000000000000045121216575753400165370ustar00rootroot00000000000000/*! * \file * \brief Array class test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace std; using namespace itpp; int main() { Array A1(10), A2(15); A1 = 1; A1(2) = 42; A2 = 5; cout << "Testing simple Arrays of integers:" << endl << "A1 = " << A1 << endl << "A2 = " << A2 << endl << endl; // Test of Array initialisation by string: Array A3 = "{[1 1] [1 0 1 0] [0 0 1]}"; cout << "Testing Array initialisation with: \"{[1 1] [1 0 1 0] [0 0 1]}\":" << endl << "A3 = " << A3 << endl << endl; Array > A4 = "{{[5 3; 020 4] [1 0; 3 9]} {[0 -3; 1 0xa]}}"; cout << "Testing Array initialisation with: \"{{[5 3; 020 4] [1 0; 3 9]} {[0 -3; 1 0xa]}}\":" << endl << "A4 = " << A4 << endl << endl; // Test of operator() cout << "Testing Array::operator():" << endl << "A4(1) = " << A4(1) << endl << "A4(0)(1) = " << A4(0)(1) << endl << endl; // Test of left(), right() and mid() methods: cout << "Testing Array::left(), Array::right() and Array::mid():" << endl << "A1.left(4) = " << A1.left(4) << endl << "A1.right(5) = " << A1.right(5) << endl << "A1.mid(2, 3) = " << A1.mid(2, 3) << endl << endl; // Test of swap function A4.swap(0, 1); cout << "Testing A4.swap(0, 1):" << endl << A4 << endl; return 0; } itpp-4.3.1/tests/array_test.ref000066400000000000000000000011641216575753400165310ustar00rootroot00000000000000Testing simple Arrays of integers: A1 = {1 1 42 1 1 1 1 1 1 1} A2 = {5 5 5 5 5 5 5 5 5 5 5 5 5 5 5} Testing Array initialisation with: "{[1 1] [1 0 1 0] [0 0 1]}": A3 = {[1 1] [1 0 1 0] [0 0 1]} Testing Array initialisation with: "{{[5 3; 020 4] [1 0; 3 9]} {[0 -3; 1 0xa]}}": A4 = {{[[5 3] [16 4]] [[1 0] [3 9]]} {[[0 -3] [1 10]]}} Testing Array::operator(): A4(1) = {[[0 -3] [1 10]]} A4(0)(1) = [[1 0] [3 9]] Testing Array::left(), Array::right() and Array::mid(): A1.left(4) = {1 1 42 1} A1.right(5) = {1 1 1 1 1} A1.mid(2, 3) = {42 1 1} Testing A4.swap(0, 1): {{[[0 -3] [1 10]]} {[[5 3] [16 4]] [[1 0] [3 9]]}} itpp-4.3.1/tests/bch_test.cpp000066400000000000000000000113601216575753400161540ustar00rootroot00000000000000/*! * \file * \brief BCH encoder/decoder class test program * \author Pal Frenger, Steve Peters and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; bvec set_errors(const bvec &input, const ivec errpos) { bvec output = input; for (int i = 0; i < errpos.length(); i++) output(errpos(i)) ^= 1; return output ; } int main() { cout << "===================================" << endl; cout << " Test of BCH encoder/decoder " << endl; cout << "===================================" << endl; { BCH bch(31, 2); bvec input = randb(21); bvec encoded = bch.encode(input); bvec err = set_errors(encoded, (ivec) "1 2"); // error positions bvec decoded = bch.decode(err); cout << "A two error case (should be corrected)" << endl; cout << "input = " << input << endl ; cout << "encoded = " << encoded << endl ; cout << "err = " << err << endl ; cout << "decoded = " << decoded << endl ; input = randb(21); encoded = bch.encode(input); err = set_errors(encoded, (ivec) "1 2 27"); // error positions decoded = bch.decode(err); cout << "A three error case (will cause decoding errors)" << endl; cout << "input = " << input << endl; cout << "encoded = " << encoded << endl; cout << "err = " << err << endl; cout << "decoded = " << decoded << endl << endl; } cout << "========================================" << endl; cout << " Systematic vs. non-systematic test " << endl; cout << "========================================" << endl; { bmat u = "0 0 0 0; 0 0 0 1; 0 0 1 0; 0 0 1 1; 0 1 0 0; 0 1 0 1; 0 1 1 0"; bmat c(u.rows(), 7); bmat y(u.rows(), 7); bmat decoded(u.rows(), u.cols()); BCH bch_nsys(7, 1); BCH bch_sys(7, 1, true); bmat f = "1 0 0 0 0 0 0; 0 1 0 0 0 0 0; 0 0 1 0 0 0 0; 0 0 0 1 0 0 0; 0 0 0 0 1 0 0; 0 0 0 0 0 1 0; 0 0 0 0 0 0 1"; cout << "Non-systematic case" << endl; cout << "-------------------" << endl; for (int i = 0; i < u.rows(); i++) { c.set_row(i, bch_nsys.encode(u.get_row(i))); cout << "Encoded " << u.get_row(i) << " to " << c.get_row(i) << endl; y.set_row(i, f.get_row(i) + c.get_row(i)); cout << "One error added: " << y.get_row(i) << endl; decoded.set_row(i, bch_nsys.decode(y.get_row(i))); cout << "Decoded to:" << decoded.get_row(i) << endl << endl; } cout << "Systematic case" << endl; cout << "---------------" << endl; for (int i = 0; i < u.rows(); i++) { c.set_row(i, bch_sys.encode(u.get_row(i))); cout << "Encoded " << u.get_row(i) << " to " << c.get_row(i) << endl; y.set_row(i, f.get_row(i) + c.get_row(i)); cout << "One error added: " << y.get_row(i) << endl; decoded.set_row(i, bch_sys.decode(y.get_row(i))); cout << "Decoded to:" << decoded.get_row(i) << endl << endl; } } cout << "========================================" << endl; cout << " Systematic decoding failure test " << endl; cout << "========================================" << endl; { BCH bch(31, 3, true); bvec input = randb(21); bvec encoded = bch.encode(input); bvec err = set_errors(encoded, (ivec) "1 2 14 27"); // error positions bvec decoded; bvec is_valid_cw; // test the new decoding procedure for the systematic case (should extract the systematics) cout << "all codewords valid? " << bch.decode(err, decoded, is_valid_cw) << endl; cout << "valid codeword? = " << is_valid_cw << endl; cout << "A four error case (will cause decoding failure)" << endl; cout << "input = " << input << endl; cout << "encoded = " << encoded << endl; cout << "err = " << err << endl; cout << "decoded = " << decoded << endl << endl << endl; } return 0; } itpp-4.3.1/tests/bch_test.ref000066400000000000000000000051371216575753400161530ustar00rootroot00000000000000=================================== Test of BCH encoder/decoder =================================== A two error case (should be corrected) input = [0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0] encoded = [0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0] err = [0 1 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0] decoded = [0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0] A three error case (will cause decoding errors) input = [1 0 1 0 0 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0] encoded = [1 1 0 1 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0] err = [1 0 1 1 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 1 0 1 1 0] decoded = [1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 0 0 1 1 0] ======================================== Systematic vs. non-systematic test ======================================== Non-systematic case ------------------- Encoded [0 0 0 0] to [0 0 0 0 0 0 0] One error added: [1 0 0 0 0 0 0] Decoded to:[0 0 0 0] Encoded [0 0 0 1] to [0 0 0 1 0 1 1] One error added: [0 1 0 1 0 1 1] Decoded to:[0 0 0 1] Encoded [0 0 1 0] to [0 0 1 0 1 1 0] One error added: [0 0 0 0 1 1 0] Decoded to:[0 0 1 0] Encoded [0 0 1 1] to [0 0 1 1 1 0 1] One error added: [0 0 1 0 1 0 1] Decoded to:[0 0 1 1] Encoded [0 1 0 0] to [0 1 0 1 1 0 0] One error added: [0 1 0 1 0 0 0] Decoded to:[0 1 0 0] Encoded [0 1 0 1] to [0 1 0 0 1 1 1] One error added: [0 1 0 0 1 0 1] Decoded to:[0 1 0 1] Encoded [0 1 1 0] to [0 1 1 1 0 1 0] One error added: [0 1 1 1 0 1 1] Decoded to:[0 1 1 0] Systematic case --------------- Encoded [0 0 0 0] to [0 0 0 0 0 0 0] One error added: [1 0 0 0 0 0 0] Decoded to:[0 0 0 0] Encoded [0 0 0 1] to [0 0 0 1 0 1 1] One error added: [0 1 0 1 0 1 1] Decoded to:[0 0 0 1] Encoded [0 0 1 0] to [0 0 1 0 1 1 0] One error added: [0 0 0 0 1 1 0] Decoded to:[0 0 1 0] Encoded [0 0 1 1] to [0 0 1 1 1 0 1] One error added: [0 0 1 0 1 0 1] Decoded to:[0 0 1 1] Encoded [0 1 0 0] to [0 1 0 0 1 1 1] One error added: [0 1 0 0 0 1 1] Decoded to:[0 1 0 0] Encoded [0 1 0 1] to [0 1 0 1 1 0 0] One error added: [0 1 0 1 1 1 0] Decoded to:[0 1 0 1] Encoded [0 1 1 0] to [0 1 1 0 0 0 1] One error added: [0 1 1 0 0 0 0] Decoded to:[0 1 1 0] ======================================== Systematic decoding failure test ======================================== all codewords valid? 0 valid codeword? = [0] A four error case (will cause decoding failure) input = [1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 1 1 1 0] encoded = [1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 0] err = [1 0 1 0 1 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 0 0] decoded = [1 0 1 0 1 1 0 0 1 0 0 0 1 1 0 0] itpp-4.3.1/tests/bessel_test.cpp000066400000000000000000000052341216575753400167000ustar00rootroot00000000000000/*! * \file * \brief Bessel test program * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace std; using namespace itpp; int main(void) { cout << "================================" << endl; cout << " Test of bessel functions " << endl; cout << "================================" << endl; vec x = linspace(0.01, 10, 20); cout << "x = " << x << endl; cout << "besselj(0, x) = " << fixed << besselj(0, x) << endl; cout << "besselj(1, x) = " << besselj(1, x) << endl; cout << "besselj(5, x) = " << round_to_infty(besselj(5, x)) << endl; cout << "besselj(0.3, x) = " << besselj(0.3, x) << endl; cout << "besselj(1.7, x) = " << besselj(1.7, x) << endl; cout << "besselj(5.3, x) = " << round_to_infty(besselj(5.3, x)) << endl; cout << "bessely(0, x) = " << bessely(0, x) << endl; cout << "bessely(1, x) = " << bessely(1, x) << endl; cout << "bessely(5, x) = " << round_to_infty(bessely(5, x)) << endl; cout << "bessely(0.3, x) = " << bessely(0.3, x) << endl; cout << "bessely(1.7, x) = " << bessely(1.7, x) << endl; cout << "bessely(5.3, x) = " << round_to_infty(bessely(5.3, x)) << endl; cout << "besseli(0, x) = " << besseli(0, x) << endl; cout << "besseli(1, x) = " << besseli(1, x) << endl; cout << "besseli(5, x) = " << besseli(5, x) << endl; cout << "besseli(0.3, x) = " << besseli(0.3, x) << endl; cout << "besseli(1.7, x) = " << besseli(1.7, x) << endl; cout << "besseli(5.3, x) = " << besseli(5.3, x) << endl; cout << "besselk(0, x) = " << besselk(0, x) << endl; cout << "besselk(1, x) = " << besselk(1, x) << endl; cout << "besselk(5, x) = " << round_to_infty(besselk(5, x)) << endl; return 0; } itpp-4.3.1/tests/bessel_test.ref000066400000000000000000000111361216575753400166700ustar00rootroot00000000000000================================ Test of bessel functions ================================ x = [0.01 0.535789 1.06158 1.58737 2.11316 2.63895 3.16474 3.69053 4.21632 4.74211 5.26789 5.79368 6.31947 6.84526 7.37105 7.89684 8.42263 8.94842 9.47421 10] besselj(0, x) = [0.999975 0.929510 0.737496 0.462593 0.159139 -0.114928 -0.310723 -0.398702 -0.374249 -0.257398 -0.086903 0.089735 0.227815 0.295737 0.281659 0.195053 0.063020 -0.077530 -0.189700 -0.245936] besselj(1, x) = [0.005000 0.258396 0.459448 0.568610 0.566890 0.459775 0.275443 0.057757 -0.144224 -0.287643 -0.345450 -0.311940 -0.203055 -0.051503 0.101930 0.218652 0.271552 0.251069 0.166657 0.043473] besselj(5, x) = [0.000000 0.000011 0.000335 0.002361 0.009087 0.024777 0.053741 0.098533 0.158167 0.226989 0.294752 0.348121 0.373422 0.360040 0.303620 0.208143 0.086202 -0.042842 -0.156525 -0.234062] besselj(0.3, x) = [0.227333 0.709740 0.733615 0.600610 0.371136 0.105291 -0.137641 -0.309029 -0.380002 -0.346362 -0.227881 -0.062193 0.105129 0.231848 0.288953 0.266844 0.176472 0.045388 -0.090110 -0.194619] besselj(1.7, x) = [0.000079 0.067160 0.198405 0.343409 0.457949 0.507700 0.475136 0.363160 0.194018 0.003625 -0.167309 -0.283160 -0.321855 -0.279865 -0.172579 -0.030045 0.110759 0.215140 0.259064 0.234648] besselj(5.3, x) = [0.000000 0.000005 0.000165 0.001317 0.005544 0.016247 0.037475 0.072593 0.122628 0.184847 0.252110 0.313421 0.355752 0.366874 0.338539 0.269215 0.165544 0.041984 -0.081497 -0.183307] bessely(0, x) = [-3.005456 -0.393388 0.134747 0.415986 0.518927 0.473687 0.320004 0.110022 -0.099731 -0.259413 -0.335829 -0.318494 -0.220309 -0.072808 0.082722 0.205946 0.267362 0.254997 0.176400 0.055671] bessely(1, x) = [-63.678596 -1.387656 -0.729200 -0.355648 -0.044554 0.204046 0.363724 0.416719 0.365013 0.231664 0.055661 -0.117354 -0.245833 -0.301794 -0.276703 -0.182445 -0.047311 0.091854 0.199244 0.249015] bessely(5, x) = [-2444635204830.000000 -5637.104920 -194.723098 -28.527040 -7.796072 -3.084767 -1.583672 -0.986094 -0.698192 -0.523538 -0.384929 -0.250859 -0.112548 0.025099 0.148996 0.242846 0.292104 0.288391 0.232521 0.135403] bessely(0.3, x) = [-4.501885 -0.756144 -0.192147 0.176734 0.399032 0.477286 0.425200 0.275829 0.077193 -0.117613 -0.261894 -0.325212 -0.299154 -0.197723 -0.052439 0.096490 0.210615 0.262704 0.242933 0.160422] bessely(1.7, x) = [-2360.521095 -3.009003 -1.185564 -0.719724 -0.432942 -0.177942 0.054479 0.240501 0.353307 0.377184 0.314160 0.184609 0.022720 -0.131614 -0.242281 -0.285365 -0.254426 -0.161362 -0.032773 0.097192] bessely(5.3, x) = [-19010147659829.000000 -13261.137342 -371.693756 -47.926483 -11.884160 -4.322880 -2.054324 -1.196689 -0.809794 -0.599174 -0.453007 -0.323825 -0.193008 -0.058325 0.071986 0.183747 0.261390 0.292489 0.271580 0.202481] besseli(0, x) = [1.000025 1.073066 1.302214 1.736363 2.469391 3.662497 5.582888 8.668475 13.634868 21.651723 34.633273 55.717272 90.055289 146.118049 237.853623 388.258981 635.295671 1041.696056 1711.231130 2815.716628] besseli(1, x) = [0.005000 0.277623 0.609156 1.071337 1.766870 2.854192 4.586135 7.372273 11.880787 19.205890 31.143828 50.648619 82.585563 134.978313 221.074665 362.771310 596.295812 981.640046 1618.232132 2670.988304] besseli(5, x) = [0.000000 0.000012 0.000368 0.002913 0.013185 0.044294 0.124033 0.307911 0.702786 1.509283 3.097299 6.139460 11.845643 22.373107 41.540816 76.069168 137.725169 247.024584 439.606601 777.188286] besseli(0.3, x) = [0.227342 0.792616 1.133692 1.616922 2.370067 3.565909 5.475611 8.537063 13.462834 21.416322 34.301243 55.238598 89.353662 145.076015 236.289277 385.889218 631.678022 1036.136392 1702.636834 2802.362489] besseli(1.7, x) = [0.000079 0.070827 0.244469 0.548134 1.052827 1.884257 3.253621 5.511453 9.237952 15.393238 25.566853 42.392032 70.233829 116.332703 192.705987 319.311124 529.310475 877.837948 1456.603093 2418.229821] besseli(5.3, x) = [0.000000 0.000005 0.000181 0.001608 0.007903 0.028250 0.083093 0.214721 0.506726 1.119372 2.353247 4.762836 9.357849 17.957982 33.815077 62.699642 114.791605 207.960347 373.439504 665.621707] besselk(0, x) = [4.721245 0.867728 0.385816 0.191022 0.099182 0.052916 0.028734 0.015799 0.008767 0.004900 0.002754 0.001555 0.000881 0.000501 0.000286 0.000163 0.000094 0.000054 0.000031 0.000018] besselk(1, x) = [99.973894 1.514822 0.542899 0.244952 0.120671 0.062227 0.032994 0.017822 0.009756 0.005393 0.003005 0.001684 0.000949 0.000537 0.000305 0.000173 0.000099 0.000057 0.000032 0.000019] besselk(5, x) = [3839976000100.000000 8542.624206 265.658856 32.672931 6.971494 1.991747 0.679497 0.260647 0.108529 0.047977 0.022189 0.010627 0.005232 0.002634 0.001350 0.000703 0.000371 0.000197 0.000106 0.000058] itpp-4.3.1/tests/blas_test.cpp000066400000000000000000000055601216575753400163460ustar00rootroot00000000000000/*! * \file * \brief BLAS aided routines test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { cout.setf(ios::fixed); cout.precision(4); // dot() tests { vec a = randn(10); vec b = randn(10); cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "dot(a,b) = " << dot(a, b) << endl << endl; cvec c = randn_c(6); cvec d = randn_c(6); cout << "c = " << c << endl; cout << "d = " << d << endl; cout << "dot(c,d) = " << dot(c, d) << endl << endl; } // outer_product() tests { vec a = randn(4); vec b = randn(7); cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "outer_product(a,b) = " << outer_product(a, b) << endl; cvec c = randn_c(4); cvec d = randn_c(7); cout << "c = " << c << endl; cout << "d = " << d << endl; cout << "outer_product(c,d) = " << outer_product(c, d) << endl; cout << "outer_product(c,d,true) = " << outer_product(c, d, true) << endl << endl; } // Mat *= Mat operator test { mat M1 = randn(3, 5); mat N1 = randn(5, 2); cout << "M = " << M1 << endl; cout << "N = " << N1 << endl; M1 *= N1; cout << "M *= N;\nM = " << M1 << endl << endl; cmat M2 = randn_c(4, 4); cmat N2 = randn_c(4, 2); cout << "M = " << M2 << endl; cout << "N = " << N2 << endl; M2 *= N2; cout << "M *= N;\nM = " << M2 << endl << endl; } // Vec = Mat * Vec operator test { mat M1 = randn(3, 4); vec v1 = randn(4); cout << "M = " << M1 << endl; cout << "v = " << v1 << endl; cout << "out = M * v = " << M1 * v1 << endl << endl; cmat M2 = randn_c(3, 2); cvec v2 = randn_c(2); cout << "M = " << M2 << endl; cout << "v = " << v2 << endl; cout << "out = M * v = " << M2 * v2 << endl << endl; } return 0; } itpp-4.3.1/tests/blas_test.ref000066400000000000000000000060411216575753400163330ustar00rootroot00000000000000a = [-0.2839 1.3645 0.9060 1.2494 1.5578 0.5650 -0.5961 -1.1973 -1.2676 -0.3004] b = [-1.0746 2.3648 2.3651 1.2280 0.2341 -0.7320 -2.1055 -0.9235 -1.8923 -0.6643] dot(a,b) = 12.1190 c = [-0.6148-0.0357i 0.5655+0.7273i -0.6367-0.1610i -1.2992+0.0362i 1.0192-1.0469i 0.7602-0.2805i] d = [0.3611+0.7801i 0.6436+0.7944i 1.0329-0.1906i -0.7109+1.3237i 0.3498+0.5105i 0.1741+0.4752i] dot(c,d) = 0.9360-0.8990i a = [-1.0015 -0.1797 0.5492 -0.8090] b = [-2.2974 -0.4538 0.2596 -1.4477 0.3031 -1.3909 0.3693] outer_product(a,b) = [[2.3008 0.4545 -0.2600 1.4499 -0.3035 1.3930 -0.3699] [0.4129 0.0816 -0.0467 0.2602 -0.0545 0.2500 -0.0664] [-1.2616 -0.2492 0.1426 -0.7951 0.1665 -0.7639 0.2028] [1.8585 0.3671 -0.2100 1.1712 -0.2452 1.1252 -0.2988]] c = [1.1340-0.2258i 1.0773-0.8848i 0.4656-0.6077i 0.0533-0.1216i] d = [-0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i] outer_product(c,d) = [[-1.2535-1.2701i 0.6228-0.2055i -0.7170+1.2666i -0.0824+0.3445i 0.6357-0.3513i -0.1304+0.1174i -0.3609-0.7115i] [-2.0549-0.6377i 0.5454-0.5726i -0.0423+1.7544i 0.1083+0.4131i 0.4762-0.7350i -0.0719+0.1989i -0.7882-0.5513i] [-1.1786-0.0844i 0.2202-0.3743i 0.1965+0.9435i 0.1095+0.2074i 0.1629-0.4525i -0.0136+0.1154i -0.4904-0.1964i] [-0.2020+0.0345i 0.0216-0.0722i 0.0721+0.1508i 0.0270+0.0304i 0.0087-0.0830i 0.0025+0.0200i -0.0907-0.0128i]] outer_product(c,d,true) = [[-0.6714+1.6533i 0.6540-0.0488i -1.1475-0.8954i -0.2081-0.2867i 0.7218+0.0810i -0.1654-0.0585i -0.0608+0.7954i] [0.2261+2.1397i 0.6677-0.4237i -1.7292-0.2996i -0.3842-0.1865i 0.8135-0.3243i -0.2091+0.0318i 0.3876+0.8803i] [0.3881+1.1160i 0.3041-0.3100i -0.9621+0.0557i -0.2288-0.0518i 0.3946-0.2750i -0.1079+0.0431i 0.3172+0.4224i] [0.1115+0.1720i 0.0384-0.0648i -0.1598+0.0492i -0.0407+0.0007i 0.0551-0.0626i -0.0164+0.0117i 0.0709+0.0580i]] M = [[0.4622 -0.1160 0.8974 0.4191 1.3636] [0.8491 -0.4974 0.1234 1.2743 1.1834] [-0.3094 0.3126 -0.4214 -0.3288 -0.6750]] N = [[-0.9017 -1.2206] [-1.7663 0.8783] [0.4802 -0.5088] [0.0332 0.8674] [-0.2567 0.7170]] M *= N; M = [[-0.1171 0.2185] [-0.0892 0.4176] [-0.3132 0.0975]] M = [[-0.2954+0.6752i 0.3509-0.8392i -0.1657-2.0782i 0.7353+0.3734i] [-0.4759+0.1206i 0.5307-0.2334i -0.4310-0.1739i -0.4338-0.2881i] [-0.8572-0.0647i -0.3763+0.9574i -0.6664-0.1808i 0.4343-0.3287i] [0.5640+0.6469i 0.9597+0.2796i 0.1352+0.4314i -0.4972+0.3697i]] N = [[1.3078+0.6448i 0.8402+0.3585i] [-0.6401-0.4675i -0.5533+0.0174i] [0.2482-0.1109i 0.1669+0.1394i] [0.2890+0.3665i -0.3050+1.6777i]] M *= N; M = [[-1.6347+0.9456i -1.2585+1.6816i] [-1.2951-0.4854i -0.1647-0.6600i] [-0.3305-0.9812i -0.1725-0.1922i] [-0.3610+0.5989i -0.8000-0.2483i]] M = [[0.3034 -0.9044 0.0200 -0.5678] [-0.8565 -0.0507 -1.6310 -0.5196] [0.7694 1.0273 1.2419 0.9753]] v = [1.1692 -0.7650 0.0243 -0.4304] out = M * v = [1.2915 -0.7787 -0.2759] M = [[0.4752+0.1366i 0.5401-0.2073i] [-0.3031+0.8992i -0.6724-0.3295i] [-0.0309-0.1823i 2.2539-0.1707i]] v = [-0.2552+1.6929i 0.4983-0.5504i] out = M * v = [-0.1975+0.3691i -1.9613-0.5367i 1.3456-1.3313i] itpp-4.3.1/tests/channel_test.cpp000066400000000000000000000053141216575753400170320ustar00rootroot00000000000000/*! * \file * \brief Channel classes test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace std; using namespace itpp; int main() { cout.setf(ios::fixed); cout.precision(3); double Ts = 100e-9; // channel sampling time Ts = 100ns double fd_norm = 100e3 * Ts; // normalised Doppler fd_norm = 10kHz * Ts Channel_Specification cost207ra(COST207_RA); Channel_Specification cost207bu(COST207_BU); TDL_Channel tdl_207ra(cost207ra, Ts); TDL_Channel tdl_207bu(cost207bu, Ts); cmat ch_coeffs; tdl_207ra.set_fading_type(Independent); tdl_207ra.generate(10, ch_coeffs); cout << "Independent Fading Generator\n" << "----------------------------\n" << ch_coeffs << "\n\n"; tdl_207bu.set_fading_type(Static); tdl_207bu.generate(5, ch_coeffs); cout << "Static Fading Generator\n" << "-----------------------\n" << ch_coeffs << "\n\n"; tdl_207bu.set_fading_type(Correlated); tdl_207bu.set_norm_doppler(fd_norm); tdl_207bu.generate(10, ch_coeffs); cout << "Correlated Fading Generator (Rice method)\n" << "-----------------------------------------\n" << round_to_zero(ch_coeffs) << "\n\n"; tdl_207ra.set_correlated_method(FIR); tdl_207ra.set_norm_doppler(fd_norm); tdl_207ra.generate(10, ch_coeffs); cout << "Correlated Fading Generator (FIR method)\n" << "----------------------------------------\n" << round_to_zero(ch_coeffs) << "\n\n"; tdl_207ra.set_correlated_method(IFFT); tdl_207ra.generate(200, ch_coeffs); cout << "Correlated Fading Generator (IFFT method)\n" << "-----------------------------------------\n" << round_to_zero(ch_coeffs.get_rows(0, 9)) << "\n\n"; return 0; } itpp-4.3.1/tests/channel_test.ref000066400000000000000000000063511216575753400170260ustar00rootroot00000000000000Independent Fading Generator ---------------------------- [[0.628+0.300i -0.370-0.021i 0.084+0.122i -0.046+0.004i] [0.890+0.275i 0.340+0.438i 0.042+0.114i -0.009-0.064i] [1.034+0.124i -0.383-0.097i -0.170-0.030i -0.098+0.043i] [0.560-0.264i -0.782+0.022i 0.093-0.137i -0.005-0.062i] [0.412-0.066i 0.614-0.630i -0.389-0.077i 0.072-0.010i] [0.454+0.521i 0.458-0.169i 0.044-0.245i 0.021+0.045i] [1.212+0.270i 0.217+0.470i 0.051-0.236i -0.014-0.010i] [0.743-0.161i 0.387+0.478i 0.063+0.272i 0.006-0.014i] [0.227-0.203i 0.622-0.115i -0.054+0.258i -0.050+0.025i] [0.274-0.146i -0.428+0.797i -0.212+0.112i 0.046-0.017i]] Static Fading Generator ----------------------- [[-0.032-0.136i 0.121+0.347i 0.034-0.115i 0.091+0.277i -0.101+0.419i 0.289-0.165i] [-0.032-0.136i 0.121+0.347i 0.034-0.115i 0.091+0.277i -0.101+0.419i 0.289-0.165i] [-0.032-0.136i 0.121+0.347i 0.034-0.115i 0.091+0.277i -0.101+0.419i 0.289-0.165i] [-0.032-0.136i 0.121+0.347i 0.034-0.115i 0.091+0.277i -0.101+0.419i 0.289-0.165i] [-0.032-0.136i 0.121+0.347i 0.034-0.115i 0.091+0.277i -0.101+0.419i 0.289-0.165i]] Correlated Fading Generator (Rice method) ----------------------------------------- [[-0.107+0.036i 0.740-0.440i -0.080+0.000i 0.274+0.000i -0.154+0.000i -0.506+0.000i] [-0.114+0.029i 0.732-0.431i -0.082+0.004i 0.273+0.004i -0.156-0.000i -0.506-0.024i] [-0.121+0.021i 0.721-0.420i -0.083+0.008i 0.272+0.008i -0.158-0.001i -0.506-0.047i] [-0.128+0.014i 0.710-0.407i -0.085+0.011i 0.271+0.012i -0.160-0.001i -0.504-0.071i] [-0.134+0.007i 0.697-0.392i -0.086+0.015i 0.270+0.016i -0.162-0.002i -0.502-0.095i] [-0.140-0.000i 0.682-0.374i -0.087+0.019i 0.268+0.021i -0.163-0.003i -0.498-0.119i] [-0.146-0.007i 0.666-0.356i -0.087+0.023i 0.266+0.025i -0.164-0.004i -0.493-0.144i] [-0.151-0.014i 0.648-0.335i -0.088+0.026i 0.264+0.030i -0.165-0.005i -0.487-0.168i] [-0.155-0.021i 0.629-0.312i -0.088+0.030i 0.261+0.035i -0.166-0.006i -0.480-0.192i] [-0.159-0.028i 0.609-0.288i -0.088+0.034i 0.259+0.039i -0.166-0.007i -0.472-0.216i]] Correlated Fading Generator (FIR method) ---------------------------------------- [[0.835+0.133i 0.480+0.221i -0.277+0.089i 0.038-0.054i] [0.830+0.154i 0.471+0.228i -0.273+0.081i 0.035-0.054i] [0.824+0.174i 0.462+0.235i -0.268+0.073i 0.032-0.055i] [0.816+0.195i 0.453+0.242i -0.264+0.065i 0.029-0.055i] [0.807+0.215i 0.444+0.249i -0.260+0.056i 0.026-0.055i] [0.797+0.235i 0.435+0.256i -0.256+0.048i 0.024-0.055i] [0.785+0.255i 0.426+0.263i -0.252+0.040i 0.021-0.055i] [0.772+0.274i 0.417+0.270i -0.247+0.032i 0.018-0.056i] [0.758+0.293i 0.408+0.277i -0.243+0.024i 0.015-0.056i] [0.743+0.312i 0.399+0.284i -0.239+0.016i 0.012-0.056i]] Correlated Fading Generator (IFFT method) ----------------------------------------- [[0.445-0.420i 0.443+0.434i 0.488+0.137i 0.004+0.079i] [0.420-0.393i 0.448+0.434i 0.489+0.138i 0.004+0.083i] [0.394-0.366i 0.451+0.433i 0.488+0.139i 0.004+0.087i] [0.367-0.338i 0.453+0.432i 0.487+0.140i 0.004+0.091i] [0.340-0.308i 0.455+0.431i 0.483+0.141i 0.004+0.095i] [0.313-0.279i 0.455+0.430i 0.479+0.141i 0.004+0.098i] [0.284-0.248i 0.455+0.429i 0.473+0.141i 0.004+0.101i] [0.256-0.217i 0.453+0.428i 0.466+0.141i 0.004+0.103i] [0.227-0.186i 0.451+0.427i 0.458+0.141i 0.004+0.106i] [0.198-0.154i 0.447+0.426i 0.448+0.140i 0.003+0.108i]] itpp-4.3.1/tests/cholesky_test.cpp000066400000000000000000000050361216575753400172440ustar00rootroot00000000000000/*! * \file * \brief Cholesky factorisation test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "================================" << endl; cout << " Test of Cholesky routines " << endl; cout << "================================" << endl; { cout << "Real matrix" << endl; mat X, F; bool ok = false; while (!ok) { X = randn(5, 5); X = transpose(X) * X; // create a symmetric matrix // Make diagonal real and positive for (int i = 0; i < X.cols(); i++) X(i, i) = std::abs(X(i, i)); ok = chol(X, F); cout << "X = " << round_to_zero(X) << endl; if (!ok) cout << "matrix is not positive definite" << endl; else { cout << "norm(X - F^T*F) = " << round_to_zero(norm(X - transpose(F) * F)) << endl; } } } { cout << endl << "Complex matrix" << endl; cmat X, F; bool ok = false; while (!ok) { X = randn_c(5, 5); X = hermitian_transpose(X) * X; // create a symmetric matrix // Make diagonal real and positive for (int i = 0; i < X.cols(); i++) X(i, i) = std::abs(real(X(i, i))) ; ok = chol(X, F); cout << "X = " << round_to_zero(X) << endl; if (!ok) cout << "matrix is not positive definite" << endl; else { cout << "norm(X - F^H*F) = " << round_to_zero(norm(X - hermitian_transpose(F) * F)) << endl; } } } return 0; } itpp-4.3.1/tests/cholesky_test.ref000066400000000000000000000015001216575753400172260ustar00rootroot00000000000000================================ Test of Cholesky routines ================================ Real matrix X = [[6.75107 -4.11024 7.57353 -6.9009 0.784665] [-4.11024 3.8051 -6.47556 4.54544 -2.45177] [7.57353 -6.47556 13.9033 -8.85583 3.75844] [-6.9009 4.54544 -8.85583 9.84391 -1.34372] [0.784665 -2.45177 3.75844 -1.34372 3.26664]] norm(X - F^T*F) = 0 Complex matrix X = [[5.65948+0i -3.48645-1.42956i -1.91953+1.49454i -3.25204+0.21731i 0.998051+1.40267i] [-3.48645+1.42956i 5.1323+0i 0.0659595+0.413262i 2.0106-2.66829i -0.0618241-1.24643i] [-1.91953-1.49454i 0.0659595-0.413262i 5.3992+0i 0.745831+3.55662i -1.5896-2.13185i] [-3.25204-0.21731i 2.0106+2.66829i 0.745831-3.55662i 6.26614+0i -1.2381+0.228838i] [0.998051-1.40267i -0.0618241+1.24643i -1.5896+2.13185i -1.2381-0.228838i 2.4179+0i]] norm(X - F^H*F) = 0 itpp-4.3.1/tests/circular_buffer_test.cpp000066400000000000000000000067101216575753400205600ustar00rootroot00000000000000#include #include #include using namespace std; using namespace itpp; int main() { //Set a fixed seed to the random number generator RNG_reset(12345); int nrof_elements; ivec index_vec; vec a = randn(3); vec b = randn(8); vec out_vec; double out; Array out_array; Circular_Buffer cb1(10); //Put the elements of a to the buffer cb1.put(a); //Vector output: Peek at the two oldest elements of the buffer (the two first extracted) cb1.peek(out_vec, 2); cout << "peek(out_vec,2) = " << out_vec << ": display 2 first elements of the buffer, without affecting the content" << endl; //Vector output: Peek at all elements of the buffer in reverse order cb1.peek_reverse(out_vec); cout << "peek_reverse(out_vec,-1) = " << out_vec << ": display buffer, without affecting the content" << endl; //Array output: Peek at all elements of the buffer in reverse order cb1.peek_reverse(out_array); cout << "peek_reverse(out_array,-1) = " << out_array << ": display buffer, without affecting the content" << endl; //Put the elements of \c b to the buffer cb1.put(b); //Extract the oldest element of the buffer cb1.get(out_vec, 1); cout << "get(out_vec,1) = " << out_vec << endl ; //Extract all element of the buffer cb1.get(out_vec); cout << "get(out_vec) = " << out_vec << endl ; cb1.get(out_vec); cb1.get(out_array, 0); cout << "get(out_vec) = " << out_vec; cout << "; get(out_array,0) = " << out_array << ": empty buffer, no content" << endl; for (int i = 0;i < a.length();i++) { cb1.put(a(i)); } for (int i = 0;i < b.length();i++) { cb1.put(b(i)); } cout << "buffer size = " << cb1.size() << endl; cout << "nrof_elements = " << cb1.nrof_elements() << endl; nrof_elements = cb1.nrof_elements(); for (int i = 0;i < nrof_elements;i++) { cout << "i = " << i; cout << ": peek() = " << cb1.peek(); cout << "; peek_reverse() = " << cb1.peek_reverse(); cout << "; get() = " << cb1.get(); cout << endl; } //Test of error handling //cout << "get() = " << cb1.get() << endl; cb1.put(b); cout << "buffer size = " << cb1.size() << endl; cout << "nrof_elements = " << cb1.nrof_elements() << endl; cb1.peek(out_vec, -1); cout << "peek(out_vec) = " << out_vec << endl; index_vec = "5 3 7 1"; for (int i = 0;i < index_vec.size();i++) { cb1.peek(index_vec(i), out); cout << "peek at index " << index_vec(i); cout << ": peek(" << index_vec(i) << ") = " << out << endl; } cb1.peek(index_vec, out_vec); cout << "peek at indices " << index_vec << ":" << endl; cout << "peek(index_vec,out_vec) = " << out_vec << endl; cb1.set_size(15, true); cout << "buffer size = " << cb1.size() << endl; cout << "nrof_elements = " << cb1.nrof_elements() << endl; cb1.peek(out_vec, -1); cout << "peek(out_vec) = " << out_vec << endl; cb1.set_size(5, true); cout << "buffer size = " << cb1.size() << endl; cout << "nrof_elements = " << cb1.nrof_elements() << endl; cb1.peek(out_vec, -1); cout << "peek(out_vec) = " << out_vec << endl; cout << "Copy constructor: " << endl; Circular_Buffer cb2(cb1); cb2.peek(out_vec, -1); cout << "Circular_Buffer cb2(cb1): cb2.peek(out_vec) = " << out_vec << endl; cout << "Copy operator: " << endl; Circular_Buffer cb3 = cb1; cb3.peek(out_array, -1); cout << "Circular_Buffer cb3=cb1: cb3.peek(out_array) = " << out_array << endl; return 0; } itpp-4.3.1/tests/circular_buffer_test.ref000066400000000000000000000040031216575753400205430ustar00rootroot00000000000000peek(out_vec,2) = [0.347621 2.24348]: display 2 first elements of the buffer, without affecting the content peek_reverse(out_vec,-1) = [-0.813962 2.24348 0.347621]: display buffer, without affecting the content peek_reverse(out_array,-1) = {-0.813962 2.24348 0.347621}: display buffer, without affecting the content get(out_vec,1) = [2.24348] get(out_vec) = [-0.813962 0.402693 -0.0180747 0.456185 -2.65107 0.48475 0.9001 0.489366 0.305648] get(out_vec) = []; get(out_array,0) = {}: empty buffer, no content buffer size = 10 nrof_elements = 10 i = 0: peek() = 2.24348; peek_reverse() = 0.305648; get() = 2.24348 i = 1: peek() = -0.813962; peek_reverse() = 0.305648; get() = -0.813962 i = 2: peek() = 0.402693; peek_reverse() = 0.305648; get() = 0.402693 i = 3: peek() = -0.0180747; peek_reverse() = 0.305648; get() = -0.0180747 i = 4: peek() = 0.456185; peek_reverse() = 0.305648; get() = 0.456185 i = 5: peek() = -2.65107; peek_reverse() = 0.305648; get() = -2.65107 i = 6: peek() = 0.48475; peek_reverse() = 0.305648; get() = 0.48475 i = 7: peek() = 0.9001; peek_reverse() = 0.305648; get() = 0.9001 i = 8: peek() = 0.489366; peek_reverse() = 0.305648; get() = 0.489366 i = 9: peek() = 0.305648; peek_reverse() = 0.305648; get() = 0.305648 buffer size = 10 nrof_elements = 8 peek(out_vec) = [0.402693 -0.0180747 0.456185 -2.65107 0.48475 0.9001 0.489366 0.305648] peek at index 5: peek(5) = 0.9001 peek at index 3: peek(3) = -2.65107 peek at index 7: peek(7) = 0.305648 peek at index 1: peek(1) = -0.0180747 peek at indices [5 3 7 1]: peek(index_vec,out_vec) = [0.9001 -2.65107 0.305648 -0.0180747] buffer size = 15 nrof_elements = 8 peek(out_vec) = [0.402693 -0.0180747 0.456185 -2.65107 0.48475 0.9001 0.489366 0.305648] buffer size = 5 nrof_elements = 5 peek(out_vec) = [-2.65107 0.48475 0.9001 0.489366 0.305648] Copy constructor: Circular_Buffer cb2(cb1): cb2.peek(out_vec) = [-2.65107 0.48475 0.9001 0.489366 0.305648] Copy operator: Circular_Buffer cb3=cb1: cb3.peek(out_array) = {-2.65107 0.48475 0.9001 0.489366 0.305648} itpp-4.3.1/tests/commfunc_test.cpp000066400000000000000000000031731216575753400172320ustar00rootroot00000000000000/*! * \file * \brief Commfunc test program * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace std; using namespace itpp; int main() { cout << graycode(5) << endl; bvec b1 = randb(10); bvec b2 = randb(10); cout << hamming_distance(b1, b2) << endl; cout << weight(b1) << endl; cout << waterfilling("1 2 3", 0.001) << endl; cout << waterfilling("1 2 3", 0.01) << endl; cout << waterfilling("1 2 3", 0.1) << endl; cout << waterfilling("1 2 3", 0.5) << endl; cout << waterfilling("1 2 3", 1) << endl; cout << waterfilling("1 2 3", 5) << endl; cout << waterfilling("1 2 3", 100) << endl; return 0; } itpp-4.3.1/tests/commfunc_test.ref000066400000000000000000000010461216575753400172210ustar00rootroot00000000000000[[0 0 0 0 0] [0 0 0 0 1] [0 0 0 1 1] [0 0 0 1 0] [0 0 1 1 0] [0 0 1 1 1] [0 0 1 0 1] [0 0 1 0 0] [0 1 1 0 0] [0 1 1 0 1] [0 1 1 1 1] [0 1 1 1 0] [0 1 0 1 0] [0 1 0 1 1] [0 1 0 0 1] [0 1 0 0 0] [1 1 0 0 0] [1 1 0 0 1] [1 1 0 1 1] [1 1 0 1 0] [1 1 1 1 0] [1 1 1 1 1] [1 1 1 0 1] [1 1 1 0 0] [1 0 1 0 0] [1 0 1 0 1] [1 0 1 1 1] [1 0 1 1 0] [1 0 0 1 0] [1 0 0 1 1] [1 0 0 0 1] [1 0 0 0 0]] 6 4 [0 0 0.001] [0 0 0.01] [0 0 0.1] [0 0.166667 0.333333] [0 0.416667 0.583333] [1.27778 1.77778 1.94444] [32.9444 33.4444 33.6111] itpp-4.3.1/tests/convcode_test.cpp000066400000000000000000000212511216575753400172200ustar00rootroot00000000000000/*! * \file * \brief Convolutional encoder/decoder class test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "====================================" << endl; cout << " Test of convolutional coders " << endl; cout << "====================================" << endl; Array spectrum, spectrum_fast, spectrum_punct, spectrum_punct_fast; spectrum.set_size(2); spectrum_fast.set_size(2); spectrum_punct.set_size(2); spectrum_punct_fast.set_size(2); Convolutional_Code code; Punctured_Convolutional_Code code_punct; BPSK bpsk; BERC berc; const int no_bits = 2500; const int packet_size = 500; int coded_packet_size; bvec bits, tail_coded_bits, tail_decoded_bits, tailbite_coded_bits, tailbite_decoded_bits, trunc_coded_bits, trunc_decoded_bits; vec symbols; ivec dist_profile; ivec G(2); G(0) = 0133; G(1) = 0171; int L = max(int2bits(G(0)), int2bits(G(1))); // L = 7 code.set_generator_polynomials(G, L); code_punct.set_generator_polynomials(G, L); bmat punct_matrix = "1 0 1; 1 1 0"; // results in R = 3/4 code_punct.set_puncture_matrix(punct_matrix); cout << "------------------------------------------------------------------------------" << endl; cout << "1) Rate 1/2 code" << endl; cout << "------------------------------------------------------------------------------" << endl; cout << "Catastrophic test = " << code.catastrophic() << endl; cout << "Code rate = " << code.get_rate() << endl << endl; code.calculate_spectrum(spectrum, 10, 10); code.fast(spectrum_fast, 10, 10); code.distance_profile(dist_profile, 10); cout << "Spectrum:" << endl; cout << "* Ad = " << spectrum(0) << endl; cout << "* Cd = " << spectrum(1) << endl; cout << "Spectrum, fast:" << endl; cout << "* Ad = " << spectrum_fast(0) << endl; cout << "* Cd = " << spectrum_fast(1) << endl << endl; cout << "Distance profile = " << dist_profile << endl << endl; cout << "Tail method test. Printing 30 bits starting from bit 1400:" << endl; bits = randb(no_bits); cout << "* Input bits = " << bits.mid(1400, 30) << endl; tail_coded_bits = code.encode_tail(bits); cout << "* Coded bits = " << tail_coded_bits.mid(1400, 30) << endl; bpsk.modulate_bits(tail_coded_bits, symbols); tail_decoded_bits = code.decode_tail(symbols); cout << "* Decoded bits = " << tail_decoded_bits.mid(1400, 30) << endl; berc.count(bits, tail_decoded_bits); cout << "BER = " << berc.get_errorrate() << endl << endl; cout << "Tailbite method test. Printing 30 bits starting from bit 1400:" << endl; cout << "* Input bits = " << bits.mid(1400, 30) << endl; tailbite_coded_bits = code.encode_tailbite(bits); cout << "* Coded bits = " << tailbite_coded_bits.mid(1400, 30) << endl; bpsk.modulate_bits(tailbite_coded_bits, symbols); tailbite_decoded_bits = code.decode_tailbite(symbols); cout << "* Decoded bits = " << tailbite_decoded_bits.mid(1400, 30) << endl; berc.clear(); berc.count(bits, tailbite_decoded_bits); cout << "BER = " << berc.get_errorrate() << endl << endl; cout << "Trunc method test. Printing 30 bits starting from bit 1400:" << endl; cout << "* Input bits = " << bits.mid(1400, 30) << endl; trunc_coded_bits.set_size(0); for (int i = 0; i < no_bits / packet_size; i++) { trunc_coded_bits = concat(trunc_coded_bits, code.encode_trunc(bits.mid(i * packet_size, packet_size))); } cout << "* Coded bits = " << trunc_coded_bits.mid(1400, 30) << endl; bpsk.modulate_bits(trunc_coded_bits, symbols); trunc_decoded_bits.set_size(0); coded_packet_size = round_i(packet_size / code.get_rate()); for (int i = 0; i < no_bits / packet_size; i++) { trunc_decoded_bits = concat(trunc_decoded_bits, code.decode_trunc(symbols.mid(i * coded_packet_size, coded_packet_size))); } cout << "* Decoded bits = " << trunc_decoded_bits.mid(1400, 30) << endl; berc.clear(); berc.count(bits, trunc_decoded_bits); cout << "BER = " << berc.get_errorrate() << endl << endl; cout << "------------------------------------------------------------------------------" << endl; cout << "2) Punctured code (R = 3/4)" << endl; cout << "------------------------------------------------------------------------------" << endl; cout << "Catastrophic test = " << code_punct.catastrophic() << endl; cout << "Code rate = " << code_punct.get_rate() << endl; cout << "Puncture matrix = " << code_punct.get_puncture_matrix() << endl << endl; cout << "Tail method test. Printing 30 bits starting from bit 1400:" << endl; bits = randb(no_bits); cout << "* Input bits = " << bits.mid(1400, 30) << endl; tail_coded_bits = code_punct.encode_tail(bits); cout << "* Coded bits = " << tail_coded_bits.mid(1400, 30) << endl; bpsk.modulate_bits(tail_coded_bits, symbols); tail_decoded_bits = code_punct.decode_tail(symbols); cout << "* Decoded bits = " << tail_decoded_bits.mid(1400, 30) << endl; berc.count(bits, tail_decoded_bits); cout << "BER = " << berc.get_errorrate() << endl << endl; cout << "Tailbite method test. Printing 30 bits starting from bit 1400:" << endl; cout << "* Input bits = " << bits.mid(1400, 30) << endl; tailbite_coded_bits = code_punct.encode_tailbite(bits); cout << "* Coded bits = " << tailbite_coded_bits.mid(1400, 30) << endl; bpsk.modulate_bits(tailbite_coded_bits, symbols); tailbite_decoded_bits = code_punct.decode_tailbite(symbols); cout << "* Decoded bits = " << tailbite_decoded_bits.mid(1400, 30) << endl; berc.clear(); berc.count(bits, tailbite_decoded_bits); cout << "BER = " << berc.get_errorrate() << endl << endl; cout << "Trunc method test. Printing 30 bits starting from bit 1400:" << endl; cout << "* Input bits = " << bits.mid(1400, 30) << endl; trunc_coded_bits.set_size(0); for (int i = 0; i < no_bits / packet_size; i++) { trunc_coded_bits = concat(trunc_coded_bits, code_punct.encode_trunc(bits.mid(i * packet_size, packet_size))); } cout << "* Coded bits = " << trunc_coded_bits.mid(1400, 30) << endl; bpsk.modulate_bits(trunc_coded_bits, symbols); trunc_decoded_bits.set_size(0); coded_packet_size = round_i(packet_size / code_punct.get_rate()); for (int i = 0; i < no_bits / packet_size; i++) { trunc_decoded_bits = concat(trunc_decoded_bits, code_punct.decode_trunc(symbols.mid(i * coded_packet_size, coded_packet_size))); } cout << "* Decoded bits = " << trunc_decoded_bits.mid(1400, 30) << endl; berc.clear(); berc.count(bits, trunc_decoded_bits); cout << "BER = " << berc.get_errorrate() << endl << endl; cout << "------------------------------------------------------------------------------" << endl; cout << "3) Rate 1/7 code" << endl; cout << "------------------------------------------------------------------------------" << endl; ivec generator(7); generator(0)=02; generator(1)=011; generator(2)=015; generator(3)=014; generator(4)=07; generator(5)=012; generator(6)=06; code.set_generator_polynomials(generator, 4); bvec uncoded = "1 1 1 1 1 1 1"; bvec coded = code.encode_tail(uncoded); bvec decoded = code.decode_tail(to_vec((-2)*to_ivec(coded)+1)); cout << "* Input bits = " << uncoded << endl; cout << "* Decoded bits = " << decoded << endl; berc.clear(); berc.count(uncoded, decoded); cout << "BER = " << berc.get_errorrate() << endl << endl; return 0; } itpp-4.3.1/tests/convcode_test.ref000066400000000000000000000057201216575753400172150ustar00rootroot00000000000000==================================== Test of convolutional coders ==================================== ------------------------------------------------------------------------------ 1) Rate 1/2 code ------------------------------------------------------------------------------ Catastrophic test = 0 Code rate = 0.5 Spectrum: * Ad = [0 0 0 0 0 0 0 0 0 0 11 0 38 0 193 0 1331 0 7275 0] * Cd = [0 0 0 0 0 0 0 0 0 0 36 0 211 0 1404 0 11633 0 77433 0] Spectrum, fast: * Ad = [0 0 0 0 0 0 0 0 0 0 11 0 38 0 193 0 1331 0 7275 0] * Cd = [0 0 0 0 0 0 0 0 0 0 36 0 211 0 1404 0 11633 0 77433 0] Distance profile = [2 3 3 4 4 4 4] Tail method test. Printing 30 bits starting from bit 1400: * Input bits = [1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 1] * Coded bits = [0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0] * Decoded bits = [1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 1] BER = 0 Tailbite method test. Printing 30 bits starting from bit 1400: * Input bits = [1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 1] * Coded bits = [0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0] * Decoded bits = [1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 1] BER = 0 Trunc method test. Printing 30 bits starting from bit 1400: * Input bits = [1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 1] * Coded bits = [0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0] * Decoded bits = [1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 1] BER = 0 ------------------------------------------------------------------------------ 2) Punctured code (R = 3/4) ------------------------------------------------------------------------------ Catastrophic test = 0 Code rate = 0.75 Puncture matrix = [[1 0 1] [1 1 0]] Tail method test. Printing 30 bits starting from bit 1400: * Input bits = [1 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0] * Coded bits = [1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 1] * Decoded bits = [1 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0] BER = 0 Tailbite method test. Printing 30 bits starting from bit 1400: * Input bits = [1 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0] * Coded bits = [1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 1] * Decoded bits = [1 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0] BER = 0 Trunc method test. Printing 30 bits starting from bit 1400: * Input bits = [1 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0] * Coded bits = [0 1 1 1 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0] * Decoded bits = [1 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0] BER = 0 ------------------------------------------------------------------------------ 3) Rate 1/7 code ------------------------------------------------------------------------------ * Input bits = [1 1 1 1 1 1 1] * Decoded bits = [1 1 1 1 1 1 1] BER = 0 itpp-4.3.1/tests/converters_test.cpp000066400000000000000000000047031216575753400176150ustar00rootroot00000000000000/*! * \file * \brief Tests of miscellaneous conversion functions * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "==================================" << endl << " Test of conversion functions" << endl << "==================================" << endl; vec v = "-4:0.5:5.5"; v = concat(v, randn(10) * 20 - 10); cout << "v = " << v << endl << endl; cout << "round(v) = " << round_to_zero(round(v)) << endl; cout << "round_i(v) = " << round_i(v) << endl << endl; cout << "ceil(v) = " << round_to_zero(ceil(v)) << endl; cout << "ceil_i(v) = " << ceil_i(v) << endl << endl; cout << "floor(v) = " << round_to_zero(floor(v)) << endl; cout << "floor_i(v) = " << floor_i(v) << endl << endl; bvec b = randb(15); cout << "b = " << b << endl << endl; int i = bin2dec(b); cout << "bin2dec(b) = " << i << endl; cout << "dec2bin(bin2dec(b)) = " << dec2bin(i) << endl; i = bin2dec(b, false); cout << "bin2dec(b, false) = " << i << endl; cout << "dec2bin(bin2dec(b, false), false) = " << dec2bin(i, false) << endl << endl; ivec iv = bin2oct(b); cout << "bin2oct(b) = " << iv << endl; cout << "oct2bin(bin2oct(b)) = " << oct2bin(iv) << endl; cout << "oct2bin(bin2oct(b), 1) = " << oct2bin(iv, 1) << endl << endl; iv = bin2pol(b); cout << "bin2pol(b) = " << iv << endl; cout << "pol2bin(bin2pol(b)) = " << pol2bin(iv) << endl << endl; return 0; } itpp-4.3.1/tests/converters_test.ref000066400000000000000000000023731216575753400176100ustar00rootroot00000000000000================================== Test of conversion functions ================================== v = [-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 -15.6777 17.2892 8.12002 14.9884 21.1566 1.29941 -21.9229 -33.9464 -35.3513 -16.0077] round(v) = [-4 -4 -3 -2 -2 -2 -1 0 0 0 1 2 2 2 3 4 4 4 5 6 -16 17 8 15 21 1 -22 -34 -35 -16] round_i(v) = [-4 -4 -3 -2 -2 -2 -1 0 0 0 1 2 2 2 3 4 4 4 5 6 -16 17 8 15 21 1 -22 -34 -35 -16] ceil(v) = [-4 -3 -3 -2 -2 -1 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 -15 18 9 15 22 2 -21 -33 -35 -16] ceil_i(v) = [-4 -3 -3 -2 -2 -1 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 -15 18 9 15 22 2 -21 -33 -35 -16] floor(v) = [-4 -4 -3 -3 -2 -2 -1 -1 0 0 1 1 2 2 3 3 4 4 5 5 -16 17 8 14 21 1 -22 -34 -36 -17] floor_i(v) = [-4 -4 -3 -3 -2 -2 -1 -1 0 0 1 1 2 2 3 3 4 4 5 5 -16 17 8 14 21 1 -22 -34 -36 -17] b = [1 1 0 0 1 1 0 0 0 0 0 1 0 1 0] bin2dec(b) = 26122 dec2bin(bin2dec(b)) = [1 1 0 0 1 1 0 0 0 0 0 1 0 1 0] bin2dec(b, false) = 10291 dec2bin(bin2dec(b, false), false) = [1 1 0 0 1 1 0 0 0 0 0 1 0 1] bin2oct(b) = [6 3 0 1 2] oct2bin(bin2oct(b)) = [1 1 0 0 1 1 0 0 0 0 0 1 0 1 0] oct2bin(bin2oct(b), 1) = [1 1 0 0 1 1 0 0 0 0 0 1 0 1 0] bin2pol(b) = [-1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 1] pol2bin(bin2pol(b)) = [1 1 0 0 1 1 0 0 0 0 0 1 0 1 0] itpp-4.3.1/tests/demapper_test.cpp000066400000000000000000000074021216575753400172170ustar00rootroot00000000000000/*! * \file * \brief test program for MIMO demapper * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" #include using namespace std; using namespace itpp; int main() { //parameters int const_size = 16; string demapper_method[] = {"Hassibi_maxlogMAP", "GA", "sGA", "mmsePIC", "zfPIC"}; string code_name = "V-BLAST_MxN"; int em_antennas = 2; int rec_antennas = 2; int channel_uses = 1; int perm_len = pow2i(6);//permutation length //QAM modulator class QAM mod(const_size); //Space-Time code parameters STC st_block_code(code_name, const_size, em_antennas, channel_uses);//generate matrices for LD code (following Hassibi's approach) //SISO blocks SISO siso; siso.set_constellation(mod.bits_per_symbol(), mod.get_symbols(), mod.get_bits2symbols()); siso.set_st_block_code(st_block_code.get_nb_symbols_per_block(), st_block_code.get_1st_gen_matrix(), st_block_code.get_2nd_gen_matrix(), rec_antennas); siso.set_noise(1e-1); //bits generation bvec bits = randb(perm_len); //QAM modulation cvec em = mod.modulate_bits(bits)/sqrt(double(em_antennas));//normalize emitted symbols //ST code cmat S = st_block_code.encode(em); //internal variables int symb_block = st_block_code.get_nb_symbols_per_block(); int nb_symb = perm_len/mod.bits_per_symbol();//number of symbols at the modulator output int nb_subblocks = nb_symb/symb_block;//number of blocks of ST code emitted in an interleaver period int tx_duration = channel_uses*nb_subblocks;//transmission duration expressed in number of symbol periods //ideal channel if (em_antennas != rec_antennas) { return EXIT_FAILURE; } cmat mimo_channel = eye_c(em_antennas); cmat rec(tx_duration,rec_antennas); for (int ns=0;ns 0), bits); cout << demapper_method[n] << ", BER = " << ber.get_errorrate() << endl; demapper_extrinsic_data.zeros(); } } itpp-4.3.1/tests/demapper_test.ref000066400000000000000000000001241216575753400172030ustar00rootroot00000000000000Hassibi_maxlogMAP, BER = 0 GA, BER = 0 sGA, BER = 0 mmsePIC, BER = 0 zfPIC, BER = 0 itpp-4.3.1/tests/det_test.cpp000066400000000000000000000040511216575753400161730ustar00rootroot00000000000000/*! * \file * \brief Determinant routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "===================================" << endl; cout << " Test of Determinant routines " << endl; cout << "===================================" << endl; { cout << "Real matrix" << endl; mat X = randn(5, 5); double d; d = det(X); cout << "X = " << round_to_zero(X) << endl; cout << "det(X) = " << round_to_zero(d) << endl; X = randn(5, 5); d = det(X); cout << "X = " << round_to_zero(X) << endl; cout << "det(X) = " << round_to_zero(d) << endl; } { cout << endl << "Complex matrix" << endl; cmat X = randn_c(5, 5); complex d; d = det(X); cout << "X = " << round_to_zero(X) << endl; cout << "det(X) = " << round_to_zero(d) << endl; X = randn_c(5, 5); d = det(X); cout << "X = " << round_to_zero(X) << endl; cout << "det(X) = " << round_to_zero(d) << endl; } return 0; } itpp-4.3.1/tests/det_test.ref000066400000000000000000000032661216575753400161740ustar00rootroot00000000000000=================================== Test of Determinant routines =================================== Real matrix X = [[-0.283885 0.56497 -1.0746 -0.732016 -0.869443] [1.36446 -0.596145 2.36476 -2.10553 -0.0504762] [0.906001 -1.19732 2.36508 -0.923457 0.799682] [1.24942 -1.26756 1.22804 -1.89227 1.02849] [1.55783 -0.300385 0.234136 -0.664315 -0.900489]] det(X) = -3.35694 X = [[-0.227649 1.07507 1.12342 0.494639 -0.179719] [-1.83729 -0.396638 1.46072 0.721932 0.549174] [0.0511841 0.51065 -0.269572 0.246282 -0.808968] [1.44132 1.10323 -1.00539 0.672038 -2.29735] [-1.48058 0.910165 1.87195 -1.00149 -0.453797]] det(X) = 3.4773 Complex matrix X = [[0.1836-1.02371i -0.60769+0.0533137i 0.278311+0.598587i -0.0820166-0.351743i 0.836821-0.477303i] [0.214321-0.98353i -0.121635-0.848777i -0.190616-0.13041i 0.221056+0.634561i -0.637571-1.24894i] [0.261137+1.13396i -1.28903+0.562993i 0.0775548-0.185926i 0.0872567-0.29795i 0.339558+0.0234865i] [-0.225782+1.07734i -0.0690923-0.822132i -0.664453+0.326851i 0.296357+0.901056i -0.181505-0.863075i] [-0.884797+0.465648i 0.953281-0.128067i 0.600433-0.218791i -0.232511+0.964179i 0.621065-0.359776i]] det(X) = 3.06712-4.24441i X = [[0.61333+0.506973i 0.350946-0.839171i -0.431011-0.173918i 0.43428-0.328699i 0.289013+0.366511i] [-0.295419+0.675185i 0.530681-0.233433i -0.666422-0.180822i -0.497205+0.369685i 0.840226+0.358469i] [-0.475898+0.120633i -0.376251+0.957435i 0.135151+0.431443i 1.30784+0.644844i -0.553286+0.0173776i] [-0.85725-0.0647025i 0.959656+0.279574i 0.735259+0.373431i -0.64014-0.467499i 0.166865+0.139432i] [0.564002+0.646938i -0.165729-2.07819i -0.43385-0.288087i 0.248209-0.110927i -0.304968+1.67774i]] det(X) = -0.534835-1.62956i itpp-4.3.1/tests/eigen_test.cpp000066400000000000000000000051611216575753400165110ustar00rootroot00000000000000/*! * \file * \brief Eigenvalue decomposition test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main(void) { cout << "================================" << endl; cout << " Test of eigenvalue routines " << endl; cout << "================================" << endl; const double thresh = 1e-13; { cout << "Real symmetric matrix" << endl; mat A = randn(5, 5); A = transpose(A) * A; // make it symmetic mat V; vec d; eig_sym(A, d, V); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*V-V*diag(d)) = " << round_to_zero(norm(A * V - V * diag(d)), thresh) << endl; } { cout << endl << "Real non-symmetric matrix" << endl; mat A = randn(5, 5); cmat V; cvec d; eig(A, d, V); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*V-V*diag(d)) = " << round_to_zero(norm(A * V - V * diag(d)), thresh) << endl; } { cout << endl << "Complex hermitian matrix" << endl; cmat A = randn_c(5, 5); A = transpose(conj(A)) * A; // make it hermitian cmat V; vec d; eig_sym(A, d, V); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*V-V*diag(d)) = " << round_to_zero(norm(A * V - V * diag(d)), thresh) << endl; } { cout << endl << "Complex non-hermitian matrix" << endl; cmat A = randn_c(5, 5); cmat V; cvec d; eig(A, d, V); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*V-V*diag(d)) = " << round_to_zero(norm(A * V - V * diag(d)), thresh) << endl; } return 0; } itpp-4.3.1/tests/eigen_test.ref000066400000000000000000000033011216575753400164750ustar00rootroot00000000000000================================ Test of eigenvalue routines ================================ Real symmetric matrix A = [[6.75107 -4.11024 7.57353 -6.9009 0.784665] [-4.11024 3.8051 -6.47556 4.54544 -2.45177] [7.57353 -6.47556 13.9033 -8.85583 3.75844] [-6.9009 4.54544 -8.85583 9.84391 -1.34372] [0.784665 -2.45177 3.75844 -1.34372 3.26664]] norm(A*V-V*diag(d)) = 0 Real non-symmetric matrix A = [[-0.227649 1.07507 1.12342 0.494639 -0.179719] [-1.83729 -0.396638 1.46072 0.721932 0.549174] [0.0511841 0.51065 -0.269572 0.246282 -0.808968] [1.44132 1.10323 -1.00539 0.672038 -2.29735] [-1.48058 0.910165 1.87195 -1.00149 -0.453797]] norm(A*V-V*diag(d)) = 0 Complex hermitian matrix A = [[5.66035+0i -0.828828+0.624351i -0.795847+0.598926i 1.01174-1.23943i 0.243402-0.0850845i] [-0.828828-0.624351i 4.69172+0i 0.169611-1.02905i -1.92101+1.73425i 1.5394-0.718265i] [-0.795847-0.598926i 0.169611+1.02905i 1.48641+0i -0.549066-0.315334i 0.543691+0.138787i] [1.01174+1.23943i -1.92101-1.73425i -0.549066+0.315334i 2.5618+0i -2.13434-0.0421936i] [0.243402+0.0850845i 1.5394+0.718265i 0.543691-0.138787i -2.13434+0.0421936i 4.30329+0i]] norm(A*V-V*diag(d)) = 0 Complex non-hermitian matrix A = [[0.61333+0.506973i 0.350946-0.839171i -0.431011-0.173918i 0.43428-0.328699i 0.289013+0.366511i] [-0.295419+0.675185i 0.530681-0.233433i -0.666422-0.180822i -0.497205+0.369685i 0.840226+0.358469i] [-0.475898+0.120633i -0.376251+0.957435i 0.135151+0.431443i 1.30784+0.644844i -0.553286+0.0173776i] [-0.85725-0.0647025i 0.959656+0.279574i 0.735259+0.373431i -0.64014-0.467499i 0.166865+0.139432i] [0.564002+0.646938i -0.165729-2.07819i -0.43385-0.288087i 0.248209-0.110927i -0.304968+1.67774i]] norm(A*V-V*diag(d)) = 0 itpp-4.3.1/tests/error_count_test.cpp000066400000000000000000000044741216575753400177710ustar00rootroot00000000000000/*! * \file * \brief BERC and BLER error counters test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "==========================" << endl; cout << " BERC and BLER test " << endl; cout << "==========================" << endl << endl; const int block_size = 20; const ivec error_pos = "3 5 9 17"; BERC berc; BLERC blerc(block_size); for (int i = 0; i < 100; ++i) { bvec input = randb(block_size); bvec output = input; // introduce some errors if (i < 80) for (int j = 0; j < error_pos.size(); ++j) output(error_pos(j)) = !output(error_pos(j)); // extend the output vector by one bit output = concat(output, bin(1)); // count errors berc.count(input, output); blerc.count(input, output); } cout << "BLER = " << blerc.get_errorrate() << endl << "Block errors = " << blerc.get_errors() << endl << "Correct blocks = " << blerc.get_corrects() << endl << "Total blocks = " << blerc.get_total_blocks() << endl << endl; blerc.clear(); cout << "BER = " << berc.get_errorrate() << endl << "Bit errors = " << berc.get_errors() << endl << "Correct bits = " << berc.get_corrects() << endl << "Total bits = " << berc.get_total_bits() << endl; return 0; } itpp-4.3.1/tests/error_count_test.ref000066400000000000000000000003311216575753400177470ustar00rootroot00000000000000========================== BERC and BLER test ========================== BLER = 0.8 Block errors = 80 Correct blocks = 20 Total blocks = 100 BER = 0.16 Bit errors = 320 Correct bits = 1680 Total bits = 2000 itpp-4.3.1/tests/exit_test.cpp000066400000000000000000000144401216575753400163730ustar00rootroot00000000000000/*! * \file * \brief EXIT class test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" #include using namespace itpp; using std::cout; using std::endl; using std::string; using std::fixed; int main(void) { //general parameters vec sigmaA = "0.01 2 4 7";//standard deviation (sqrt(variance)) of the mutual a priori information double threshold_value = 50; string map_metric="maxlogMAP"; ivec gen = "07 05";//octal form int constraint_length = 3; int nb_blocks_lim = 10; int perm_len = int(itpp::pow10(3.0));//total number of bits in a block (with tail) double EbN0_dB = 0.8; double R = 1.0/3.0;//coding rate of PCCC double Ec = 1.0;//coded bit energy //other parameters vec sigma2A = sqr(sigmaA); int sigma2A_len = sigma2A.length(); int nb_bits = perm_len-(constraint_length-1);//number of bits in a block (without tail) double sigma2 = (0.5*Ec/R)*pow(inv_dB(EbN0_dB), -1.0);//N0/2 double Lc = -2/sigma2;//normalisation factor for intrinsic information (take into account the BPSK modulation) bvec bits(nb_bits); bvec tail; bvec bits_tail(perm_len); bmat parity_bits; int coded_bits_len = 2*perm_len; bvec coded_bits(coded_bits_len); vec mod_bits(coded_bits_len); vec rec_sig(coded_bits_len); vec intrinsic_coded(coded_bits_len); vec intrinsic_coded_p(2*nb_bits); intrinsic_coded_p.zeros(); vec apriori_data(perm_len); vec extrinsic_coded; vec extrinsic_data; vec apriori_mutual_info(sigma2A_len); vec extrinsic_mutual_info(sigma2A_len); vec extrinsic_mutual_info_p(sigma2A_len); extrinsic_mutual_info.zeros(); extrinsic_mutual_info_p.zeros(); register int en,n,nb_blocks; //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code rsc; rsc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; channel.set_noise(sigma2); //SISO module SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //EXIT chart EXIT exit; //Randomize generators //RNG_randomize(); RNG_reset(12345); cout << "=============================================" << endl; cout << " Starting Simulation " << endl; cout << " Extrinsic Mutual Information (IE) as a function of A priori Mutual Information (IA) " << endl; cout << "=============================================" << endl; cout << " Block length = " << perm_len << endl; cout << " Generator polynomials = " << std::oct << gen << std::dec << endl; cout << " Turbo encoder rate 1/3 (plus tail bits)" << endl; cout << "=============================================" << endl; //main loop for (en=0; en-1,0->+1) mod_bits = bpsk.modulate_bits(coded_bits); //AWGN channel rec_sig = channel(mod_bits); //first SISO RSC module (tail is added) //intrinsic info. of coded bits intrinsic_coded = Lc*rec_sig; //a priori info. of data bits apriori_data = exit.generate_apriori_info(bits_tail); //SISO RSC module siso.rsc(extrinsic_coded, extrinsic_data, intrinsic_coded, apriori_data, true); //threshold extrinsic_data = SISO::threshold(extrinsic_data, threshold_value); //extrinsic mutual info extrinsic_mutual_info(en) += exit.extrinsic_mutual_info(extrinsic_data.left(nb_bits), bits); //second SISO RSC module (no tail added) //intrinsic info. of coded bits for (n=0; n using std::cout; using std::endl; using namespace itpp; int main(void) { cout << "====================================================" << endl; cout << " Test of fastmath" << endl; cout << "====================================================" << endl; mat m0("1 2 3;4 5 6;7 8 9"), mv0("2;3;1"); vec v0("2 3 1"); cout << "sub_v_vT_m: the slow and fast way" << endl; cout << (m0 - mv0*transpose(mv0)*m0) << endl; sub_v_vT_m(m0, v0); cout << m0 << endl; m0 = "1 2 3;4 5 6;7 8 9"; cout << endl << "sub_m_v_vT: the slow and fast way" << endl; cout << (m0 - m0*mv0*transpose(mv0)) << endl; sub_m_v_vT(m0, v0); cout << m0 << endl; return 0; } itpp-4.3.1/tests/fastmath_test.ref000066400000000000000000000006061216575753400172220ustar00rootroot00000000000000==================================================== Test of fastmath ==================================================== sub_v_vT_m: the slow and fast way [[-41 -52 -63] [-59 -76 -93] [-14 -19 -24]] [[-41 -52 -63] [-59 -76 -93] [-14 -19 -24]] sub_m_v_vT: the slow and fast way [[-21 -31 -8] [-54 -82 -23] [-87 -133 -38]] [[-21 -31 -8] [-54 -82 -23] [-87 -133 -38]] itpp-4.3.1/tests/filter_design_test.cpp000066400000000000000000000066031216575753400202420ustar00rootroot00000000000000/*! * \file * \brief Filter design test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "====================================" << endl; cout << " Test of filter design routines " << endl; cout << "====================================" << endl; { cout << "Stabilisation of real filters" << endl; vec p = "0.7 3.0 -0.4"; vec p2 = polystab(p); cout << "Polynomial, p = " << p << endl; cout << "p2 = polystab(p) = " << round_to_zero(p2) << endl; p = randn(7); p2 = polystab(p); cout << "Polynomial, p = " << p << endl; cout << "p2 = polystab(p) = " << round_to_zero(p2) << endl; p = poly(vec("1.1 0.7 0.2")); p2 = polystab(p); cout << "Polynomial, p = " << p << endl; cout << "p2 = polystab(p) = " << round_to_zero(p2) << endl; } { cout << "Stabilisation of complex filters" << endl; cvec p = "0.7 3.0 -0.4"; cvec p2 = polystab(p); cout << "Polynomial, p = " << p << endl; cout << "p2 = polystab(p) = " << round_to_zero(p2) << endl; p = randn_c(7); p2 = polystab(p); cout << "Polynomial, p = " << p << endl; cout << "p2 = polystab(p) = " << round_to_zero(p2) << endl; p = poly(cvec("1.1 0.7 0.2")); p2 = polystab(p); cout << "Polynomial, p = " << p << endl; cout << "p2 = polystab(p) = " << round_to_zero(p2) << endl; cvec a = randn_c(4); cvec b = randn_c(6); cvec h = freqz(b, a, 32); cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "freqz(b,a,32) = " << round_to_zero(h) << endl; } { cout << "Yulewalk filter design" << endl; vec f = "0 0.5 0.6 1"; vec m = "1 1 0 0"; vec a, b, R; cout << "f = " << f << endl; cout << "m = " << m << endl; cout << "filter_design_autocorrelation(32, f, m, R): " << endl; filter_design_autocorrelation(256, f, m, R); cout << "R = " << fixed << R << endl; cout << "arma_estimator(8, 8, R, b, a): " << endl; arma_estimator(8, 8, R, b, a); cout << "a = " << a << endl; cout << "b = " << b << endl; vec n = "0:1:256"; double fd = 0.1; R = besselj(0, 2 * pi * fd * n); cout << "R = " << R << endl; arma_estimator(8, 8, R, b, a); cout << "arma_estimator(8, 8, R, b, a): " << endl; cout << "a = " << a << endl; cout << "b = " << b << endl; } return 0; } itpp-4.3.1/tests/filter_design_test.ref000066400000000000000000000160621216575753400202340ustar00rootroot00000000000000==================================== Test of filter design routines ==================================== Stabilisation of real filters Polynomial, p = [0.7 3 -0.4] p2 = polystab(p) = [0.7 0.067948 -0.0205197] Polynomial, p = [-0.283885 1.36446 0.906001 1.24942 1.55783 0.56497 -0.596145] p2 = polystab(p) = [-0.283885 -0.1827 -0.132481 -0.12513 -0.0297861 0.0793631 -0.012405] Polynomial, p = [1 -2 1.13 -0.154] p2 = polystab(p) = [1 -1.80909 0.958182 -0.127273] Stabilisation of complex filters Polynomial, p = [0.7+0i 3+0i -0.4+0i] p2 = polystab(p) = [0.7+0i 0.067948+0i -0.0205197+0i] Polynomial, p = [-0.846632-0.896303i -0.212404-0.759858i 1.67214+1.67236i 0.868358+0.165559i -0.517613-1.48884i -0.652983-1.33804i -0.469741-0.614789i] p2 = polystab(p) = [-0.846632-0.896303i -0.507607-0.353231i 0.2481+0.781307i 0.0734606+0.5071i -0.117401-0.086041i -0.202569-0.25927i -0.101812-0.13325i] Polynomial, p = [1+0i -2+0i 1.13+0i -0.154+0i] p2 = polystab(p) = [1+0i -1.80909+0i 0.958182+0i -0.127273+0i] a = [-0.0356921+0.565461i 0.72725-0.636742i -0.160972-1.29916i 0.0361926+1.01917i] b = [-1.04693+0.760191i -0.280465+0.361084i 0.780099+0.643584i 0.794379+1.03288i -0.190616-0.710921i 1.32367+0.349763i] freqz(b,a,32) = [-0.165674+4.19633i 0.470012+3.08506i 0.702477+1.92199i 0.682517+0.880545i 0.550411+0.0388362i 0.397606-0.574834i 0.267659-0.958963i 0.172126-1.13158i 0.108526-1.12555i 0.0728061-0.981531i 0.0642769-0.74076i 0.0853369-0.440152i 0.139327-0.110415i 0.228562+0.223937i 0.353196+0.543771i 0.510842+0.834431i 0.696683+1.085i 0.903834+1.2878i 1.12382+1.43804i 1.34706+1.53356i 1.56333+1.57461i 1.76209+1.56362i 1.93276+1.5048i 2.06476+1.40351i 2.14745+1.26512i 2.17028+1.09255i 2.1252+0.881888i 2.01672+0.618081i 1.88261+0.287479i 1.7856-0.0739272i 1.73342-0.379213i 1.66954-0.587277i] Yulewalk filter design f = [0 0.5 0.6 1] m = [1 1 0 0] filter_design_autocorrelation(32, f, m, R): R = [0.532559 0.315821 -0.031951 -0.098821 0.030194 0.052117 -0.027468 -0.030472 0.024049 0.017893 -0.020260 -0.010026 0.016429 0.005118 -0.012847 -0.002225 0.009732 0.000713 -0.007211 -0.000100 0.005318 0.000009 -0.004008 -0.000158 0.003178 0.000354 -0.002694 -0.000487 0.002425 0.000517 -0.002257 -0.000453 0.002112 0.000332 -0.001947 -0.000198 0.001752 0.000087 -0.001541 -0.000020 0.001334 0.000000 -0.001154 -0.000016 0.001015 0.000050 -0.000918 -0.000083 0.000856 0.000102 -0.000817 -0.000102 0.000786 0.000084 -0.000751 -0.000057 0.000707 0.000029 -0.000654 -0.000009 0.000596 0.000000 -0.000542 -0.000003 0.000495 0.000013 -0.000460 -0.000026 0.000436 0.000035 -0.000420 -0.000037 0.000409 0.000033 -0.000396 -0.000024 0.000381 0.000014 -0.000361 -0.000005 0.000338 0.000001 -0.000315 -0.000001 0.000294 0.000005 -0.000277 -0.000010 0.000265 0.000015 -0.000257 -0.000017 0.000251 0.000017 -0.000246 -0.000013 0.000239 0.000008 -0.000230 -0.000003 0.000219 0.000001 -0.000207 -0.000000 0.000196 0.000002 -0.000186 -0.000005 0.000179 0.000008 -0.000174 -0.000009 0.000171 0.000009 -0.000168 -0.000008 0.000165 0.000005 -0.000160 -0.000003 0.000154 0.000001 -0.000147 -0.000000 0.000140 0.000001 -0.000135 -0.000002 0.000130 0.000004 -0.000127 -0.000005 0.000125 0.000006 -0.000123 -0.000005 0.000121 0.000004 -0.000118 -0.000002 0.000115 0.000001 -0.000111 -0.000000 0.000106 0.000000 -0.000103 -0.000001 0.000099 0.000002 -0.000097 -0.000003 0.000096 0.000004 -0.000095 -0.000003 0.000093 0.000003 -0.000092 -0.000002 0.000089 0.000001 -0.000087 -0.000000 0.000084 0.000000 -0.000081 -0.000001 0.000079 0.000001 -0.000077 -0.000002 0.000076 0.000003 -0.000075 -0.000002 0.000075 0.000002 -0.000074 -0.000001 0.000072 0.000001 -0.000070 -0.000000 0.000068 0.000000 -0.000066 -0.000000 0.000065 0.000001 -0.000063 -0.000001 0.000063 0.000002 -0.000062 -0.000002 0.000061 0.000002 -0.000061 -0.000001 0.000060 0.000000 -0.000059 -0.000000 0.000057 0.000000 -0.000056 -0.000000 0.000054 0.000001 -0.000053 -0.000001 0.000053 0.000001 -0.000052 -0.000001 0.000052 0.000001 -0.000051 -0.000001 0.000051 0.000000 -0.000050 -0.000000 0.000049 0.000000 -0.000048 -0.000000 0.000047 0.000000 -0.000046 -0.000001 0.000045 0.000001 -0.000045 -0.000001 0.000045 0.000001 -0.000044 -0.000001 0.000044 0.000000 -0.000043 -0.000000 0.000042 0.000000 -0.000042 -0.000000 0.000041 0.000000 -0.000040 -0.000000 0.000040 0.000001 -0.000039 -0.000001] arma_estimator(8, 8, R, b, a): a = [1.000000 0.674659 1.903750 0.910429 1.202849 0.356944 0.264436 0.033088 0.009850] b = [0.098191 0.427406 0.944264 1.365558 1.419767 1.112417 0.654916 0.271520 0.062529] R = [1.000000 0.903713 0.642512 0.290564 -0.054960 -0.304242 -0.401986 -0.342615 -0.168862 0.045176 0.220277 0.298483 0.260759 0.130387 -0.038298 -0.181211 -0.247891 -0.218682 -0.109979 0.033729 0.157507 0.216539 0.192023 0.096868 -0.030454 -0.141182 -0.194690 -0.173208 -0.087544 0.027970 0.129064 0.178348 0.159020 0.080477 -0.026004 -0.119609 -0.165531 -0.147829 -0.074884 0.024400 0.111968 0.155131 0.138710 0.070314 -0.023059 -0.105625 -0.146473 -0.131094 -0.066490 0.021917 0.100251 0.139119 0.124608 0.063229 -0.020929 -0.095621 -0.132772 -0.118998 -0.060405 0.020063 0.091579 0.127221 0.114084 0.057928 -0.019296 -0.088009 -0.122313 -0.109732 -0.055733 0.018611 0.084827 0.117932 0.105843 0.053770 -0.017994 -0.081967 -0.113991 -0.102340 -0.052000 0.017434 0.079377 0.110420 0.099163 0.050395 -0.016923 -0.077019 -0.107165 -0.096265 -0.048929 0.016455 0.074859 0.104181 0.093607 0.047585 -0.016024 -0.072871 -0.101434 -0.091157 -0.046345 0.015625 0.071033 0.098893 0.088890 0.045197 -0.015254 -0.069328 -0.096534 -0.086785 -0.044131 0.014908 0.067740 0.094336 0.084822 0.043137 -0.014585 -0.066256 -0.092282 -0.082987 -0.042207 0.014282 0.064866 0.090356 0.081266 0.041335 -0.013997 -0.063560 -0.088546 -0.079647 -0.040514 0.013729 0.062330 0.086841 0.078122 0.039741 -0.013475 -0.061168 -0.085231 -0.076681 -0.039010 0.013235 0.060069 0.083707 0.075317 0.038319 -0.013007 -0.059027 -0.082261 -0.074023 -0.037662 0.012791 0.058038 0.080889 0.072794 0.037039 -0.012585 -0.057096 -0.079582 -0.071624 -0.036445 0.012389 0.056199 0.078337 0.070509 0.035879 -0.012202 -0.055343 -0.077149 -0.069444 -0.035338 0.012023 0.054525 0.076013 0.068426 0.034822 -0.011851 -0.053743 -0.074926 -0.067451 -0.034327 0.011687 0.052993 0.073884 0.066517 0.033853 -0.011529 -0.052273 -0.072885 -0.065621 -0.033398 0.011378 0.051582 0.071925 0.064760 0.032961 -0.011232 -0.050918 -0.071002 -0.063932 -0.032540 0.011092 0.050279 0.070114 0.063135 0.032135 -0.010957 -0.049663 -0.069258 -0.062367 -0.031745 0.010827 0.049070 0.068432 0.061627 0.031369 -0.010701 -0.048497 -0.067636 -0.060912 -0.031006 0.010579 0.047943 0.066867 0.060221 0.030655 -0.010462 -0.047409 -0.066123 -0.059554 -0.030316 0.010348 0.046891 0.065404 0.058908 0.029988 -0.010238 -0.046391 -0.064708 -0.058283 -0.029670 0.010132 0.045906 0.064033 0.057677 0.029362 -0.010029 -0.045436 -0.063379 -0.057090 -0.029064 0.009929 0.044980 0.062745 0.056520 0.028774 -0.009831 -0.044537 -0.062129] arma_estimator(8, 8, R, b, a): a = [1.000000 -5.639923 14.887872 -23.713094 24.788487 -17.355262 7.935089 -2.164767 0.269989] b = [0.117196 -0.457317 0.947020 -1.258532 1.157363 -0.723747 0.290453 -0.062104 0.004607] itpp-4.3.1/tests/filter_test.cpp000066400000000000000000000137341216575753400167140ustar00rootroot00000000000000/*! * \file * \brief Filter classes test program * \author Hakan Eriksson, Thomas Eriksson, Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { cout << "======================================" << endl; cout << " Test of filter routines " << endl; cout << "======================================" << endl; // Test signals vec x = randn(20), x2 = randn(20); cvec cx = randn_c(20), cx2 = randn_c(20); cout << "Input signals: " << endl; cout << "x = " << x << endl; cout << "x2 = " << x2 << endl; cout << "cx = " << cx << endl; cout << "cx2 = " << cx2 << endl; // Filter coefficients vec b(10); b.ones(); b(0) += 0.1; cvec cb(10); cb.ones(); cb(0) += 0.1; cvec ca(2); ca(0) = 1.0; ca(1) = -1.0; vec a(2); a(0) = 1.0; a(1) = -1.0; cout << "Filter coefficients: " << endl; cout << "b = " << b << endl; cout << "cb = " << cb << endl; cout << "a = " << a << endl; cout << "ca = " << ca << endl; vec y, y2; vec s1, s2; cvec cy, cy2; cvec cs1, cs2; cout << endl << "-----------------------------------------------" << endl; cout << "MA Filter: " << endl; MA_Filter H(b); MA_Filter, double, complex > CH(b); MA_Filter, complex, complex > C(cb); y = H(x); s1 = H.get_state(); cout << "y = " << y << endl; cout << "s1 = " << s1 << endl; y2 = H(x2); s2 = H.get_state(); cout << "y2 = " << y2 << endl; cout << "s2 = " << s2 << endl; cout << "Redo, reseting to state s1" << endl; H.set_state(s1); y2 = H(x2); s2 = H.get_state(); cout << "y2 = " << y2 << endl; cout << "s2 = " << s2 << endl; cy = CH(cx); cs1 = CH.get_state(); cout << "cy = " << cy << endl; cout << "cs1 = " << cs1 << endl; cy2 = CH(cx2); cs2 = CH.get_state(); cout << "cy2 = " << cy2 << endl; cout << "cs2 = " << cs2 << endl; cout << "Redo, reseting to state s1" << endl; CH.set_state(cs1); cy2 = CH(cx2); cs2 = CH.get_state(); cout << "cy2 = " << cy2 << endl; cout << "cs2 = " << cs2 << endl; cy = C(cx); cout << "cy = " << cy << endl; y = filter(b, 1, x); cout << "y = " << y << endl; cy = filter(b, 1, cx); cout << "cy = " << cy << endl; cy = filter(cb, 1, cx); cout << "cy = " << cy << endl; cout << endl << "-----------------------------------------------" << endl; cout << "AR Filter: " << endl; AR_Filter HAR(a); AR_Filter, double, complex > CHAR(a); AR_Filter, complex, complex > CAR(ca); y = HAR(x); s1 = HAR.get_state(); cout << "y = " << y << endl; cout << "s1 = " << s1 << endl; y2 = HAR(x2); s2 = HAR.get_state(); cout << "y2 = " << y2 << endl; cout << "s2 = " << s2 << endl; cout << "Redo, reseting to state s1" << endl; HAR.set_state(s1); y2 = HAR(x2); s2 = HAR.get_state(); cout << "y2 = " << y2 << endl; cout << "s2 = " << s2 << endl; cy = CHAR(cx); cs1 = CHAR.get_state(); cout << "cy = " << cy << endl; cout << "cs1 = " << cs1 << endl; cy2 = CHAR(cx2); cs2 = CHAR.get_state(); cout << "cy2 = " << cy2 << endl; cout << "cs2 = " << cs2 << endl; cout << "Redo, reseting to state s1" << endl; CHAR.set_state(cs1); cy2 = CHAR(cx2); cs2 = CHAR.get_state(); cout << "cy2 = " << cy2 << endl; cout << "cs2 = " << cs2 << endl; cy = CAR(cx); cout << "cy = " << cy << endl; y = filter(1, a, x); cout << "y = " << y << endl; cy = filter(1, a, cx); cout << "cy = " << cy << endl; cy = filter(1, ca, cx); cout << "cy = " << cy << endl; cout << endl << "-----------------------------------------------" << endl; cout << "ARMA Filter: " << endl; ARMA_Filter HARMA(b, a); ARMA_Filter, double, complex > CHARMA(b, a); ARMA_Filter, complex, complex > CARMA(cb, ca); y = HARMA(x); s1 = HARMA.get_state(); cout << "y = " << y << endl; cout << "s1 = " << s1 << endl; y2 = HARMA(x2); s2 = HARMA.get_state(); cout << "y2 = " << y2 << endl; cout << "s2 = " << s2 << endl; cout << "Redo, reseting to state s1" << endl; HARMA.set_state(s1); y2 = HARMA(x2); s2 = HARMA.get_state(); cout << "y2 = " << y2 << endl; cout << "s2 = " << s2 << endl; cy = CHARMA(cx); cs1 = CHARMA.get_state(); cout << "cy = " << cy << endl; cout << "cs1 = " << cs1 << endl; cy2 = CHARMA(cx2); cs2 = CHARMA.get_state(); cout << "cy2 = " << cy2 << endl; cout << "cs2 = " << cs2 << endl; cout << "Redo, reseting to state s1" << endl; CHARMA.set_state(cs1); cy2 = CHARMA(cx2); cs2 = CHARMA.get_state(); cout << "cy2 = " << cy2 << endl; cout << "cs2 = " << cs2 << endl; cy = CARMA(cx); cout << "cy = " << cy << endl; y = filter(b, a, x); cout << "y = " << y << endl; cy = filter(b, a, cx); cout << "cy = " << cy << endl; cy = filter(cb, ca, cx); cout << "cy = " << cy << endl; } itpp-4.3.1/tests/filter_test.ref000066400000000000000000000303401216575753400166760ustar00rootroot00000000000000====================================== Test of filter routines ====================================== Input signals: x = [-0.283885 1.36446 0.906001 1.24942 1.55783 0.56497 -0.596145 -1.19732 -1.26756 -0.300385 -1.0746 2.36476 2.36508 1.22804 0.234136 -0.732016 -2.10553 -0.923457 -1.89227 -0.664315] x2 = [-0.869443 -0.0504762 0.799682 1.02849 -0.900489 -0.227649 -1.83729 0.0511841 1.44132 -1.48058 1.07507 -0.396638 0.51065 1.10323 0.910165 1.12342 1.46072 -0.269572 -1.00539 1.87195] cx = [0.349763+0.510483i 0.174148+0.475202i -0.708159-0.127081i 0.388325-0.572027i -1.62447-0.320883i 0.1836-1.02371i 0.214321-0.98353i 0.261137+1.13396i -0.225782+1.07734i -0.884797+0.465648i -0.60769+0.0533137i -0.121635-0.848777i -1.28903+0.562993i -0.0690923-0.822132i 0.953281-0.128067i 0.278311+0.598587i -0.190616-0.13041i 0.0775548-0.185926i -0.664453+0.326851i 0.600433-0.218791i] cx2 = [-0.0820166-0.351743i 0.221056+0.634561i 0.0872567-0.29795i 0.296357+0.901056i -0.232511+0.964179i 0.836821-0.477303i -0.637571-1.24894i 0.339558+0.0234865i -0.181505-0.863075i 0.621065-0.359776i 0.61333+0.506973i -0.295419+0.675185i -0.475898+0.120633i -0.85725-0.0647025i 0.564002+0.646938i 0.350946-0.839171i 0.530681-0.233433i -0.376251+0.957435i 0.959656+0.279574i -0.165729-2.07819i] Filter coefficients: b = [1.1 1 1 1 1 1 1 1 1 1] cb = [1.1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i 1+0i] a = [1 -1] ca = [1+0i -1+0i] ----------------------------------------------- MA Filter: y = [-0.312273 1.21702 2.07718 3.36094 4.94961 5.4153 4.70304 3.4456 2.17101 1.96735 1.09921 2.44344 3.90255 3.76747 2.34438 0.950782 -0.695958 -0.303889 -1.02548 -1.26661] s1 = [-1.0746 -0.664315 -1.89227 -0.923457 -2.10553 -0.732016 0.234136 1.22804 2.36508 2.36476] y2 = [-1.08197 -3.41531 -4.89568 -5.07236 -6.39988 -5.82823 -5.72095 -4.55746 -1.08485 -2.19331 0.00677576 -0.486557 -0.684861 -0.550864 1.24048 2.61288 5.94461 5.45083 2.93053 6.5708] s2 = [1.07507 1.87195 -1.00539 -0.269572 1.46072 1.12342 0.910165 1.10323 0.51065 -0.396638] Redo, reseting to state s1 y2 = [-1.08197 -3.41531 -4.89568 -5.07236 -6.39988 -5.82823 -5.72095 -4.55746 -1.08485 -2.19331 0.00677576 -0.486557 -0.684861 -0.550864 1.24048 2.61288 5.94461 5.45083 2.93053 6.5708] s2 = [1.07507 1.87195 -1.00539 -0.269572 1.46072 1.12342 0.910165 1.10323 0.51065 -0.396638] cy = [0.384739+0.561531i 0.541325+1.03321i -0.255065+0.845896i 0.242908+0.229375i -1.58285-0.0663932i -1.21844-1.16039i -1.00105-2.1399i -0.735228-0.794189i -1.0097+0.277485i -1.9604+0.681964i -2.89014+0.183561i -3.13732-1.23063i -3.83493-0.399376i -4.17035-0.787994i -1.49036-0.525772i -1.46314+1.16919i -1.91497+1.94941i -2.07174+0.623974i -2.58461-0.075235i -0.972891-0.814238i] cs1 = [-0.60769+0.0533137i 0.600433-0.218791i -0.664453+0.326851i 0.0775548-0.185926i -0.190616-0.13041i 0.278311+0.598587i 0.953281-0.128067i -0.0690923-0.822132i -1.28903+0.562993i -0.121635-0.848777i] cy2 = [-0.515462-1.23259i -0.142464+0.34938i 1.22044-0.604815i 1.6068+1.23827i 0.368122+2.33683i 1.03357+1.11679i 0.439171-0.0788998i 0.798888+0.257756i 1.22973-1.02083i 1.33062-1.11148i 2.02519-0.166091i 1.41784-0.108646i 0.83664+0.254482i -0.355103-0.72981i 0.583535-0.975887i 0.0763542-1.48636i 1.26258-0.410285i 0.456077+0.64275i 1.73083+1.71761i 0.831495-0.236578i] cs2 = [0.61333+0.506973i -0.165729-2.07819i 0.959656+0.279574i -0.376251+0.957435i 0.530681-0.233433i 0.350946-0.839171i 0.564002+0.646938i -0.85725-0.0647025i -0.475898+0.120633i -0.295419+0.675185i] Redo, reseting to state s1 cy2 = [-0.515462-1.23259i -0.142464+0.34938i 1.22044-0.604815i 1.6068+1.23827i 0.368122+2.33683i 1.03357+1.11679i 0.439171-0.0788998i 0.798888+0.257756i 1.22973-1.02083i 1.33062-1.11148i 2.02519-0.166091i 1.41784-0.108646i 0.83664+0.254482i -0.355103-0.72981i 0.583535-0.975887i 0.0763542-1.48636i 1.26258-0.410285i 0.456077+0.64275i 1.73083+1.71761i 0.831495-0.236578i] cs2 = [0.61333+0.506973i -0.165729-2.07819i 0.959656+0.279574i -0.376251+0.957435i 0.530681-0.233433i 0.350946-0.839171i 0.564002+0.646938i -0.85725-0.0647025i -0.475898+0.120633i -0.295419+0.675185i] cy = [0.384739+0.561531i 0.541325+1.03321i -0.255065+0.845896i 0.242908+0.229375i -1.58285-0.0663932i -1.21844-1.16039i -1.00105-2.1399i -0.735228-0.794189i -1.0097+0.277485i -1.9604+0.681964i -2.89014+0.183561i -3.13732-1.23063i -3.83493-0.399376i -4.17035-0.787994i -1.49036-0.525772i -1.46314+1.16919i -1.91497+1.94941i -2.07174+0.623974i -2.58461-0.075235i -0.972891-0.814238i] y = [-0.312273 1.21702 2.07718 3.36094 4.94961 5.4153 4.70304 3.4456 2.17101 1.96735 1.09921 2.44344 3.90255 3.76747 2.34438 0.950782 -0.695958 -0.303889 -1.02548 -1.26661] cy = [0.384739+0.561531i 0.541325+1.03321i -0.255065+0.845896i 0.242908+0.229375i -1.58285-0.0663932i -1.21844-1.16039i -1.00105-2.1399i -0.735228-0.794189i -1.0097+0.277485i -1.9604+0.681964i -2.89014+0.183561i -3.13732-1.23063i -3.83493-0.399376i -4.17035-0.787994i -1.49036-0.525772i -1.46314+1.16919i -1.91497+1.94941i -2.07174+0.623974i -2.58461-0.075235i -0.972891-0.814238i] cy = [0.384739+0.561531i 0.541325+1.03321i -0.255065+0.845896i 0.242908+0.229375i -1.58285-0.0663932i -1.21844-1.16039i -1.00105-2.1399i -0.735228-0.794189i -1.0097+0.277485i -1.9604+0.681964i -2.89014+0.183561i -3.13732-1.23063i -3.83493-0.399376i -4.17035-0.787994i -1.49036-0.525772i -1.46314+1.16919i -1.91497+1.94941i -2.07174+0.623974i -2.58461-0.075235i -0.972891-0.814238i] ----------------------------------------------- AR Filter: y = [-0.283885 1.08058 1.98658 3.236 4.79383 5.3588 4.76265 3.56534 2.29777 1.99739 0.922784 3.28754 5.65262 6.88066 7.1148 6.38278 4.27725 3.35379 1.46152 0.797203] s1 = [0.797203] y2 = [-0.0722399 -0.122716 0.676966 1.70545 0.804964 0.577315 -1.25997 -1.20879 0.232537 -1.24804 -0.172971 -0.569609 -0.0589596 1.04427 1.95443 3.07785 4.53857 4.269 3.26361 5.13556] s2 = [5.13556] Redo, reseting to state s1 y2 = [-0.0722399 -0.122716 0.676966 1.70545 0.804964 0.577315 -1.25997 -1.20879 0.232537 -1.24804 -0.172971 -0.569609 -0.0589596 1.04427 1.95443 3.07785 4.53857 4.269 3.26361 5.13556] s2 = [5.13556] cy = [0.349763+0.510483i 0.52391+0.985685i -0.184249+0.858604i 0.204076+0.286578i -1.4204-0.0343049i -1.2368-1.05802i -1.02248-2.04155i -0.761341-0.907585i -0.987124+0.169751i -1.87192+0.635399i -2.47961+0.688713i -2.60125-0.160064i -3.89027+0.402929i -3.95937-0.419203i -3.00609-0.54727i -2.72777+0.0513172i -2.91839-0.0790928i -2.84084-0.265019i -3.50529+0.0618313i -2.90486-0.156959i] cs1 = [-2.90486-0.156959i] cy2 = [-2.98687-0.508702i -2.76582+0.125859i -2.67856-0.172091i -2.3822+0.728965i -2.61471+1.69314i -1.77789+1.21584i -2.41546-0.0330987i -2.0759-0.00961226i -2.25741-0.872688i -1.63634-1.23246i -1.02301-0.72549i -1.31843-0.0503057i -1.79433+0.0703278i -2.65158+0.0056253i -2.08758+0.652563i -1.73663-0.186607i -1.20595-0.42004i -1.5822+0.537395i -0.622546+0.816968i -0.788275-1.26122i] cs2 = [-0.788275-1.26122i] Redo, reseting to state s1 cy2 = [-2.98687-0.508702i -2.76582+0.125859i -2.67856-0.172091i -2.3822+0.728965i -2.61471+1.69314i -1.77789+1.21584i -2.41546-0.0330987i -2.0759-0.00961226i -2.25741-0.872688i -1.63634-1.23246i -1.02301-0.72549i -1.31843-0.0503057i -1.79433+0.0703278i -2.65158+0.0056253i -2.08758+0.652563i -1.73663-0.186607i -1.20595-0.42004i -1.5822+0.537395i -0.622546+0.816968i -0.788275-1.26122i] cs2 = [-0.788275-1.26122i] cy = [0.349763+0.510483i 0.52391+0.985685i -0.184249+0.858604i 0.204076+0.286578i -1.4204-0.0343049i -1.2368-1.05802i -1.02248-2.04155i -0.761341-0.907585i -0.987124+0.169751i -1.87192+0.635399i -2.47961+0.688713i -2.60125-0.160064i -3.89027+0.402929i -3.95937-0.419203i -3.00609-0.54727i -2.72777+0.0513172i -2.91839-0.0790928i -2.84084-0.265019i -3.50529+0.0618313i -2.90486-0.156959i] y = [-0.283885 1.08058 1.98658 3.236 4.79383 5.3588 4.76265 3.56534 2.29777 1.99739 0.922784 3.28754 5.65262 6.88066 7.1148 6.38278 4.27725 3.35379 1.46152 0.797203] cy = [0.349763+0.510483i 0.52391+0.985685i -0.184249+0.858604i 0.204076+0.286578i -1.4204-0.0343049i -1.2368-1.05802i -1.02248-2.04155i -0.761341-0.907585i -0.987124+0.169751i -1.87192+0.635399i -2.47961+0.688713i -2.60125-0.160064i -3.89027+0.402929i -3.95937-0.419203i -3.00609-0.54727i -2.72777+0.0513172i -2.91839-0.0790928i -2.84084-0.265019i -3.50529+0.0618313i -2.90486-0.156959i] cy = [0.349763+0.510483i 0.52391+0.985685i -0.184249+0.858604i 0.204076+0.286578i -1.4204-0.0343049i -1.2368-1.05802i -1.02248-2.04155i -0.761341-0.907585i -0.987124+0.169751i -1.87192+0.635399i -2.47961+0.688713i -2.60125-0.160064i -3.89027+0.402929i -3.95937-0.419203i -3.00609-0.54727i -2.72777+0.0513172i -2.91839-0.0790928i -2.84084-0.265019i -3.50529+0.0618313i -2.90486-0.156959i] ----------------------------------------------- ARMA Filter: y = [-0.312273 0.904751 2.98193 6.34287 11.2925 16.7078 21.4108 24.8564 27.0274 28.9948 30.094 32.5374 36.44 40.2074 42.5518 43.5026 42.8067 42.5028 41.4773 40.2107] s1 = [0.797203 1.46152 3.35379 4.27725 6.38278 7.1148 6.88066 5.65262 3.28754] y2 = [39.1287 35.7134 30.8177 25.7453 19.3455 13.5172 7.79629 3.23883 2.15398 -0.039326 -0.0325503 -0.519107 -1.20397 -1.75483 -0.514348 2.09853 8.04315 13.494 16.4245 22.9953] s2 = [5.13556 3.26361 4.269 4.53857 3.07785 1.95443 1.04427 -0.0589596 -0.569609] Redo, reseting to state s1 y2 = [39.1287 35.7134 30.8177 25.7453 19.3455 13.5172 7.79629 3.23883 2.15398 -0.039326 -0.0325503 -0.519107 -1.20397 -1.75483 -0.514348 2.09853 8.04315 13.494 16.4245 22.9953] s2 = [5.13556 3.26361 4.269 4.53857 3.07785 1.95443 1.04427 -0.0589596 -0.569609] cy = [0.384739+0.561531i 0.926064+1.59474i 0.670999+2.44063i 0.913908+2.67001i -0.668938+2.60362i -1.88738+1.44323i -2.88842-0.696676i -3.62365-1.49086i -4.63335-1.21338i -6.59375-0.531416i -9.4839-0.347854i -12.6212-1.57848i -16.4561-1.97786i -20.6265-2.76585i -22.1169-3.29162i -23.58-2.12243i -25.495-0.173016i -27.5667+0.450958i -30.1513+0.375723i -31.1242-0.438515i] cs1 = [-2.90486-0.156959i -3.50529+0.0618313i -2.84084-0.265019i -2.91839-0.0790928i -2.72777+0.0513172i -3.00609-0.54727i -3.95937-0.419203i -3.89027+0.402929i -2.60125-0.160064i] cy2 = [-31.6397-1.6711i -31.7821-1.32173i -30.5617-1.92654i -28.9549-0.688266i -28.5868+1.64857i -27.5532+2.76536i -27.114+2.68646i -26.3152+2.94421i -25.0854+1.92339i -23.7548+0.811907i -21.7296+0.645816i -20.3118+0.53717i -19.4751+0.791652i -19.8302+0.0618418i -19.2467-0.914045i -19.1703-2.40041i -17.9078-2.81069i -17.4517-2.16794i -15.7209-0.450331i -14.8894-0.686909i] cs2 = [-0.788275-1.26122i -0.622546+0.816968i -1.5822+0.537395i -1.20595-0.42004i -1.73663-0.186607i -2.08758+0.652563i -2.65158+0.0056253i -1.79433+0.0703278i -1.31843-0.0503057i] Redo, reseting to state s1 cy2 = [-31.6397-1.6711i -31.7821-1.32173i -30.5617-1.92654i -28.9549-0.688266i -28.5868+1.64857i -27.5532+2.76536i -27.114+2.68646i -26.3152+2.94421i -25.0854+1.92339i -23.7548+0.811907i -21.7296+0.645816i -20.3118+0.53717i -19.4751+0.791652i -19.8302+0.0618418i -19.2467-0.914045i -19.1703-2.40041i -17.9078-2.81069i -17.4517-2.16794i -15.7209-0.450331i -14.8894-0.686909i] cs2 = [-0.788275-1.26122i -0.622546+0.816968i -1.5822+0.537395i -1.20595-0.42004i -1.73663-0.186607i -2.08758+0.652563i -2.65158+0.0056253i -1.79433+0.0703278i -1.31843-0.0503057i] cy = [0.384739+0.561531i 0.926064+1.59474i 0.670999+2.44063i 0.913908+2.67001i -0.668938+2.60362i -1.88738+1.44323i -2.88842-0.696676i -3.62365-1.49086i -4.63335-1.21338i -6.59375-0.531416i -9.4839-0.347854i -12.6212-1.57848i -16.4561-1.97786i -20.6265-2.76585i -22.1169-3.29162i -23.58-2.12243i -25.495-0.173016i -27.5667+0.450958i -30.1513+0.375723i -31.1242-0.438515i] y = [-0.312273 0.904751 2.98193 6.34287 11.2925 16.7078 21.4108 24.8564 27.0274 28.9948 30.094 32.5374 36.44 40.2074 42.5518 43.5026 42.8067 42.5028 41.4773 40.2107] cy = [0.384739+0.561531i 0.926064+1.59474i 0.670999+2.44063i 0.913908+2.67001i -0.668938+2.60362i -1.88738+1.44323i -2.88842-0.696676i -3.62365-1.49086i -4.63335-1.21338i -6.59375-0.531416i -9.4839-0.347854i -12.6212-1.57848i -16.4561-1.97786i -20.6265-2.76585i -22.1169-3.29162i -23.58-2.12243i -25.495-0.173016i -27.5667+0.450958i -30.1513+0.375723i -31.1242-0.438515i] cy = [0.384739+0.561531i 0.926064+1.59474i 0.670999+2.44063i 0.913908+2.67001i -0.668938+2.60362i -1.88738+1.44323i -2.88842-0.696676i -3.62365-1.49086i -4.63335-1.21338i -6.59375-0.531416i -9.4839-0.347854i -12.6212-1.57848i -16.4561-1.97786i -20.6265-2.76585i -22.1169-3.29162i -23.58-2.12243i -25.495-0.173016i -27.5667+0.450958i -30.1513+0.375723i -31.1242-0.438515i] itpp-4.3.1/tests/fix_test.cpp000066400000000000000000000130311216575753400162030ustar00rootroot00000000000000/*! * \file * \brief Fixed-point classes test program * \author Johan Bergman and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { // This is a hack for improper rounding under MinGW cout.precision(8); cout << "Testing declaration, initialization and conversion" << endl; cout << "==================================================" << endl; int shift(10); // -64...+63 (0 is default) int wordlen(20); // 1...64 (64 is default) e_mode emode(TC); // TC or US (TC is default) o_mode omode(WRAP); // WRAP or SAT (WRAP is default) q_mode qmode(TRN); // RND or TRN (TRN is default) Stat *stat_ptr(0); // 0 or Stat* value (0 is default) cout << "For double and complex:" << endl; double real_value(3.14159265358979323846); cout << " real_value = " << real_value << endl; complex complex_value(100.0 / 3.0, 200.0 / 3.0); cout << " complex_value = " << complex_value << endl; cout << "For Fix and CFix:" << endl; Fix the_fix(real_value, shift, wordlen, emode, omode, qmode, stat_ptr); cout << " the_fix = " << double(the_fix) << endl; CFix the_cfix(complex_value, 0.0, shift, wordlen, emode, omode, qmode, stat_ptr); cout << " the_cfix = " << complex(the_cfix) << endl; cout << "For Fixed and CFixed:" << endl; Fixed<20, TC, WRAP, TRN> the_fixed(real_value, shift, stat_ptr); cout << " the_fixed = " << double(the_fixed) << endl; CFixed<20, TC, WRAP, TRN> the_cfixed(complex_value, 0.0, shift, stat_ptr); cout << " the_cfixed = " << complex(the_cfixed) << endl; cout << "For Fixed and CFixed declared using a typedef:" << endl; fixed20 the_fixed20(real_value, shift, stat_ptr); cout << " the_fixed20 = " << double(the_fixed20) << endl; cfixed20 the_cfixed20(complex_value, 0.0, shift, stat_ptr); cout << " the_cfixed20 = " << complex(the_cfixed20) << endl; cout << "For Fix and CFix declared using a factory:" << endl; Fix the_fix20(FIX20); the_fix20.set(real_value, shift); cout << " the_fix20 = " << double(the_fix20) << endl; CFix the_cfix20(FIX20); the_cfix20.set(complex_value, shift); cout << " the_cfix20 = " << complex(the_cfix20) << endl << endl; cout << "Testing Array/Vec/Mat declarations and operations" << endl; cout << "=================================================" << endl; int vec_length(2); cout << "For Vec and Vec:" << endl; fixvec the_fixvec(vec_length, FIX20); the_fixvec = Fix(real_value, shift); cout << " the_fixvec = " << to_vec(the_fixvec) << endl; cfixvec the_cfixvec(vec_length, FIX20); the_cfixvec = CFix(complex_value, 0.0, shift); cout << " the_cfixvec = " << to_cvec(the_cfixvec) << endl; cout << " the_cfixvec + the_fixvec = " << to_cvec(the_cfixvec + the_fixvec) << endl; cout << " the_cfixvec - the_fixvec = " << to_cvec(the_cfixvec - the_fixvec) << endl; cout << " the_cfixvec * the_fixvec = " << complex(the_cfixvec * the_fixvec) << endl; cout << " the_cfixvec / the_fix = " << to_cvec(the_cfixvec / the_fix) << endl << endl; cout << "Testing functions" << endl; cout << "=================" << endl; cout << "Function is_fix:" << endl; Array > the_array2d_fixvec; cout << " is_fix(the_array2d_fixvec) = " << is_fix(the_array2d_fixvec) << endl; cout << "Function set_fix:" << endl; vec original_float = "0:7"; fixvec resulting_fix(FIX3); set_fix(resulting_fix, original_float, 0); cout << " original_float = " << original_float << " => resulting_fix = " << resulting_fix << endl; vec resulting_float(FIX3); set_fix(resulting_float, original_float, 0); cout << " original_float = " << original_float << " => resulting_float = " << resulting_float << endl; cout << "Function lshift_fix:" << endl; Fix fix_to_be_lshifted(FIX16); fix_to_be_lshifted = 77; cout << " before lshift: " << fix_to_be_lshifted << " , rep: " << fix_to_be_lshifted.get_re() << endl; lshift_fix(fix_to_be_lshifted, 1); cout << " after lshift: " << fix_to_be_lshifted << " , rep: " << fix_to_be_lshifted.get_re() << endl; cout << "Function rshift_fix:" << endl; Fix fix_to_be_rshifted(FIX16); fix_to_be_rshifted = Fix(3.14, 8); cout << " before rshift: " << fix_to_be_rshifted << " , rep: " << fix_to_be_rshifted.get_re() << endl; rshift_fix(fix_to_be_rshifted, 6, RND); cout << " after rshift: " << fix_to_be_rshifted << " , rep: " << fix_to_be_rshifted.get_re() << endl; return 0; } itpp-4.3.1/tests/fix_test.ref000066400000000000000000000027151216575753400162040ustar00rootroot00000000000000Testing declaration, initialization and conversion ================================================== For double and complex: real_value = 3.1415927 complex_value = 33.333333+66.666667i For Fix and CFix: the_fix = 3.140625 the_cfix = 33.333008+66.666016i For Fixed and CFixed: the_fixed = 3.140625 the_cfixed = 33.333008+66.666016i For Fixed and CFixed declared using a typedef: the_fixed20 = 3.140625 the_cfixed20 = 33.333008+66.666016i For Fix and CFix declared using a factory: the_fix20 = 3.140625 the_cfix20 = 33.333008+66.666016i Testing Array/Vec/Mat declarations and operations ================================================= For Vec and Vec: the_fixvec = [3.140625 3.140625] the_cfixvec = [33.333008+66.666016i 33.333008+66.666016i] the_cfixvec + the_fixvec = [36.473633+66.666016i 36.473633+66.666016i] the_cfixvec - the_fixvec = [30.192383+66.666016i 30.192383+66.666016i] the_cfixvec * the_fixvec = 209.37296+418.74591i the_cfixvec / the_fix = [10+21i 10+21i] Testing functions ================= Function is_fix: is_fix(the_array2d_fixvec) = 1 Function set_fix: original_float = [0 1 2 3 4 5 6 7] => resulting_fix = [0<0> 1<0> 2<0> 3<0> -4<0> -3<0> -2<0> -1<0>] original_float = [0 1 2 3 4 5 6 7] => resulting_float = [0 1 2 3 4 5 6 7] Function lshift_fix: before lshift: 77<0> , rep: 77 after lshift: 154<1> , rep: 154 Function rshift_fix: before rshift: 803<8> , rep: 803 after rshift: 13<2> , rep: 13 itpp-4.3.1/tests/freq_filt_test.cpp000066400000000000000000000034411216575753400173740ustar00rootroot00000000000000/*! * \file * \brief Frequency filter test program * \author Simon Wood and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { vec b = "1 2 3 4"; vec x(20); x.zeros(); x(0) = 1; // Define a filter object for doubles Freq_Filt FF(b, x.length()); // Filter the data vec y = FF.filter(x); // Check the FFT and block sizes that were used int fftsize = FF.get_fft_size(); int blksize = FF.get_blk_size(); cout << fftsize << endl; cout << blksize << endl; cout << round_to_zero(y) << endl; // Test streaming mode x = linspace(0, 10, 100); Freq_Filt FFS(b, x.length()); vec y1 = FFS.filter(x(0, 49), 1); vec y2 = FFS.filter(x(50, 99), 1); cout << round_to_zero(concat(y1, y2)) << endl; return 0; } itpp-4.3.1/tests/freq_filt_test.ref000066400000000000000000000014761216575753400173740ustar00rootroot000000000000008 5 [1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0.10101 0.40404 1.0101 2.0202 3.0303 4.0404 5.05051 6.06061 7.07071 8.08081 9.09091 10.101 11.1111 12.1212 13.1313 14.1414 15.1515 16.1616 17.1717 18.1818 19.1919 20.202 21.2121 22.2222 23.2323 24.2424 25.2525 26.2626 27.2727 28.2828 29.2929 30.303 31.3131 32.3232 33.3333 34.3434 35.3535 36.3636 37.3737 38.3838 39.3939 40.404 41.4141 42.4242 43.4343 44.4444 45.4545 46.4646 47.4747 48.4848 49.4949 50.5051 51.5152 52.5253 53.5354 54.5455 55.5556 56.5657 57.5758 58.5859 59.596 60.6061 61.6162 62.6263 63.6364 64.6465 65.6566 66.6667 67.6768 68.6869 69.697 70.7071 71.7172 72.7273 73.7374 74.7475 75.7576 76.7677 77.7778 78.7879 79.798 80.8081 81.8182 82.8283 83.8384 84.8485 85.8586 86.8687 87.8788 88.8889 89.899 90.9091 91.9192 92.9293 93.9394 94.9495 95.9596 96.9697 97.9798] itpp-4.3.1/tests/galois_test.cpp000066400000000000000000000025411216575753400166770ustar00rootroot00000000000000/*! * \file * \brief Galois Field algebra classes test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { GF a(8), b(8), c(8); a = 4; b = 2; c = a + b; cout << "a=" << a << ", b=" << b << endl; cout << "c=" << c << endl; return 0; } itpp-4.3.1/tests/galois_test.ref000066400000000000000000000000371216575753400166670ustar00rootroot00000000000000a=alpha^4, b=alpha^2 c=alpha^1 itpp-4.3.1/tests/gf2mat_test.cpp000066400000000000000000000172401216575753400166030ustar00rootroot00000000000000/*! * \file * \brief Test program for a class for algebra on GF(2) (binary) matrices * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ // To run extensive tests uncomment the following definition // #define EXTENSIVE_TESTS #include using namespace itpp; using namespace std; GF2mat random_matrix(int m, int n) { GF2mat Z(m, n); for (int j = 0; j < n; j++) { for (int i = 0; i < m; i++) { Z.set(i, j, (rand() % 2 == 0 ? 1 : 0)); } } return Z; } int main() { // ========== SIMPLE DEMOS/TESTS ==================== cout << "===========================================================" << endl; cout << "gf2mat_test: Test of matrix operations in gfmat.h/gfmat.cpp" << endl; cout << "===========================================================" << endl; GF2mat A(3, 3); A.set(0, 0, 1); A.set(1, 2, 1); A.set(2, 1, 1); cout << "A=" << A << endl; cout << "A*A=" << A*A << endl; cout << "A*A'=" << A*A.transpose() << endl; GF2mat B = A; cout << "B=" << B << endl; cout << "B.get_row(1)=" << B.get_row(1) << endl; cout << "B.get_col(2)=" << B.get_col(2) << endl; bvec v(3); v(0) = 1; v(1) = 1; v(2) = 0; cout << "v=" << v << endl; cout << "A*v=" << A*v << endl; cout << "rank(A)=" << A.row_rank() << endl; cout << "inv(A)=" << A.inverse() << endl; GF2mat C, D; ivec p; A.T_fact(C, D, p); cout << "C=" << C << endl; cout << "D=" << D << endl; cout << "p=" << p << endl; // Test Alist functionality string file = "gf2mat_test.alist"; GF2mat_sparse_alist alist; alist.from_sparse(A.sparsify()); alist.write(file); GF2mat_sparse_alist alist2(file); it_assert(GF2mat(alist2.to_sparse()) == A, "Alist test failed"); #ifdef EXTENSIVE_TESTS // ========== EXTENSIVE RANDOM TESTS ========== // The following code can be used to verify the behavior of the GF2 // class for large matrix dimensions. Note that with debugging // options enabled, this code takes a while to run. To run these // extensive tests, simply remove the comments around this code segment. // Test of file I/O GF2mat Z = random_matrix(301, 179); it_file f1("gf2mat_test.it"); f1 << Name("Z") << Z; f1.close(); cout << "Saved successfully." << endl; it_ifile f2("gf2mat_test.it"); GF2mat Z_temp; f2 >> Name("Z") >> Z_temp; f2.close(); it_assert(Z == Z_temp, "error"); cout << "Read successfully." << endl; // Binary vector bvec b = randb(Z.cols()); it_assert(GF2mat(Z*b, 1) == Z*GF2mat(b, 1), "error"); cout << "Passed matrix-vector multiplication test" << endl; // Multiplication test GF2mat W = random_matrix(139, Z.rows()); GF2mat temp1 = W * Z; cout << "computed product." << endl; GF2mat temp2 = GF2mat(W.sparsify() * Z.sparsify()); it_assert(temp1 == temp2, "error"); Z = Z.transpose(); it_assert(W*Z.transpose() == mult_trans(W, Z), "error"); cout << "Passed matrix-matrix multiplication test" << endl; // Transpose it_assert(GF2mat(b, 0) == GF2mat(b, 1).transpose(), "error"); it_assert(GF2mat(b, 1) == GF2mat(b, 0).transpose(), "error"); GF2mat Y = random_matrix(Z.cols(), 73); it_assert((Z*Y).transpose() == Y.transpose()*Z.transpose(), "error"); cout << "Passed transpose test." << endl; // Concatenation int m = Z.rows(); int n = Z.cols(); it_assert(Z == Z.get_submatrix(0, 0, m - 1, 27).concatenate_horizontal(Z.get_submatrix(0, 28, m - 1, n - 1)), "error"); it_assert(Z == Z.get_submatrix(0, 0, 13, n - 1).concatenate_vertical(Z.get_submatrix(14, 0, m - 1, n - 1)), "error"); cout << "Passed concatenation test." << endl; // Assignment operator GF2mat P = Z; it_assert(P == Z, "error"); it_assert((P + Z).is_zero(), "error"); cout << "Passed assignment operator test." << endl; // Sparse-dense conversions GF2mat_sparse As(Z.rows(), Z.cols()); for (int i = 0; i < Z.rows(); i++) { for (int j = 0; j < Z.cols(); j++) { if (Z.get(i, j) == 1) { As.set(i, j, 1); } } } it_assert(GF2mat(As) == Z, "error"); GF2mat_sparse Cs = Z.sparsify(); it_assert(Cs.full() == As.full(), "error"); cout << "Passed sparse test." << endl; Z = random_matrix(100, 75); // Get rows and columns cout << "Z.get_row(1)=" << Z.get_row(1) << endl; cout << "Z.get_col(2)=" << Z.get_col(2) << endl; // Print a submatrix on the screen cout << "Z.get_submatrix(1,1,6,4): " << Z.get_submatrix(1, 1, 6, 4) << endl; // Test of T-factorization int dim = 250; for (int trial = 0; trial < 100; trial++) { cout << "Testing T-factorization, realization: " << trial << endl; GF2mat X = random_matrix(rand() % dim + 1, rand() % dim + 1); GF2mat T, U; ivec perm; X.T_fact(T, U, perm); GF2mat W = T * X; W.permute_cols(perm, 0); it_assert(U == W, "error"); } // Test of inversion for (int trial = 0; trial < 100; trial++) { cout << "Testing inversion, realization: " << trial << endl; GF2mat X = random_matrix(dim, dim); while (X.row_rank() != dim) { X.set(rand() % dim, rand() % dim, rand() % 2); } it_assert(X*X.inverse() == gf2dense_eye(dim), "error"); it_assert(X.inverse()*X == gf2dense_eye(dim), "error"); } // Test of the T-factorization bitflip update for (int trial = 0; trial < 100; trial++) { cout << "Testing the T-factorization bitflip update, realization: " << trial; GF2mat X = random_matrix(rand() % dim + 1, rand() % dim + 1); cout << " dimension: " << X.rows() << "*" << X.cols(); GF2mat T, U; ivec perm; int rank = X.T_fact(T, U, perm); cout << " rank:" << rank << endl; GF2mat Tnew = T; GF2mat Unew = U; ivec permnew = perm; for (int trial2 = 0; trial2 < 10; trial2++) { int i = rand() % X.rows(); int j = rand() % X.cols(); X.addto_element(i, j, 1); X.T_fact_update_bitflip(Tnew, Unew, permnew, rank, i, j); GF2mat W = Tnew * X; W.permute_cols(permnew, 0); it_assert(Unew == W, "error"); } } // Test of the T-factorization add-column update for (int trial = 0; trial < 100; trial++) { cout << "Testing the T-factorization add-column update, realization number: " << trial << endl; bvec c = randb(dim); GF2mat X(c, 1); GF2mat T, U; ivec perm; X.T_fact(T, U, perm); for (int trial2 = 0; trial2 < 100; trial2++) { bvec c = randb(dim); // cout << X << endl; // cout << GF2mat(c,1) << endl; GF2mat Xtemp = X.concatenate_horizontal(GF2mat(c, 1)); int success = Xtemp.T_fact_update_addcol(T, U, perm, c); if (success == 1) { X = Xtemp; } // cout << "rank was: " << X.row_rank() << endl; GF2mat W = T * X; W.permute_cols(perm, 0); it_assert(U == W, "error"); } } cout << "All tests successfully passed." << endl; #endif // #ifdef(EXTENSIVE_TESTS) } itpp-4.3.1/tests/gf2mat_test.ref000066400000000000000000000017431216575753400165760ustar00rootroot00000000000000=========================================================== gf2mat_test: Test of matrix operations in gfmat.h/gfmat.cpp =========================================================== A=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 0 1 0 1 0 A*A=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 1 0 0 0 1 A*A'=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 1 0 0 0 1 B=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 0 1 0 1 0 B.get_row(1)=[0 0 1] B.get_col(2)=[0 1 0] v=[1 1 0] A*v=[1 0 1] rank(A)=3 inv(A)=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 0 1 0 1 0 C=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 1 0 0 0 1 D=---- GF(2) matrix of dimension 3*3 -- Density: 0.333333 ---- 1 0 0 0 1 0 0 0 1 p=[0 2 1] itpp-4.3.1/tests/histogram_test.cpp000066400000000000000000000073351216575753400174240ustar00rootroot00000000000000/*! * \file * \brief Histogram class test program * \author Andy Panov and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; void display_pdf(Histogram& hist) { cout.setf(ios::fixed); const int max_asterisks_per_line = 40; ivec bins = hist.get_bins(); // compute and display experimental PDF vec exp_pdf = hist.get_pdf(); double pdf_max = max(exp_pdf); cout << " bin | count | PDF |" << endl << "------+-------+---------+-------------------------------------------" << endl; for (int i = 0; i < exp_pdf.length(); i++) { int num_asterisks = static_cast(exp_pdf(i) * max_asterisks_per_line / pdf_max); cout << setw(5) << setprecision(1) << round_to_zero(hist.get_bin_center(i)) << " | " << setw(5) << hist.get_bin(i) << " | " << setw(7) << setprecision(5) << round_to_zero(exp_pdf(i)) << " | "; for (int j = 0; j < num_asterisks; j++) { cout << "*"; } cout << endl; } cout << "------+-------+---------+-------------------------------------------" << endl; cout << "Histogram trials counter : " << sum(hist.get_bins()) << endl; cout << "Sum of the histogram bins : " << sum(hist.get_bins()) << endl; cout << "Sum of PDF values : " << sum(exp_pdf) << endl; cout << "--------------------------------------------------------------------" << endl << endl; } int main() { cout << "=======================" << endl; cout << " Histogram tests " << endl; cout << "=======================" << endl << endl; // create histogram Histogram hist(-3, 3, 21); // matrix dimension for statistical test int mat_dim = 100; cout << "Experimental PDF of " << mat_dim << "x" << mat_dim << " normal distributed random matrix:" << endl << endl; // compute histogram for a random matrix hist.update(randn(mat_dim, mat_dim)); display_pdf(hist); // reset histogram, so we can start next experiment hist.reset(); // compute histogram for a random vector int num_stat_trials = 50000; cout << "Experimental PDF of " << num_stat_trials << " normal distributed random variables:" << endl << endl; // compute histogram for random vector hist.update(randn(num_stat_trials)); display_pdf(hist); // compute CDF. CDF is computed vs. right bin boundaries cout << "Experimental CDF (CDF(x) = Pr(a < x), a - random variable) " << endl << "of the same vector:" << endl << endl; vec exp_cdf = hist.get_cdf(); for (int i = 0; i < exp_cdf.length(); i++) cout << "CDF(" << setw(5) << setprecision(2) << hist.get_bin_right(i) << ") = " << setw(6) << setprecision(4) << exp_cdf(i) << endl; return 0; } itpp-4.3.1/tests/histogram_test.ref000066400000000000000000000061151216575753400174110ustar00rootroot00000000000000======================= Histogram tests ======================= Experimental PDF of 100x100 normal distributed random matrix: bin | count | PDF | ------+-------+---------+------------------------------------------- -3.0 | 24 | 0.00240 | -2.7 | 32 | 0.00320 | * -2.4 | 68 | 0.00680 | ** -2.1 | 105 | 0.01050 | *** -1.8 | 244 | 0.02440 | ******** -1.5 | 374 | 0.03740 | ************ -1.2 | 604 | 0.06040 | ******************* -0.9 | 786 | 0.07860 | ************************* -0.6 | 1012 | 0.10120 | ********************************* -0.3 | 1195 | 0.11950 | *************************************** 0.0 | 1214 | 0.12140 | **************************************** 0.3 | 1111 | 0.11110 | ************************************ 0.6 | 988 | 0.09880 | ******************************** 0.9 | 781 | 0.07810 | ************************* 1.2 | 592 | 0.05920 | ******************* 1.5 | 384 | 0.03840 | ************ 1.8 | 233 | 0.02330 | ******* 2.1 | 134 | 0.01340 | **** 2.4 | 74 | 0.00740 | ** 2.7 | 26 | 0.00260 | 3.0 | 19 | 0.00190 | ------+-------+---------+------------------------------------------- Histogram trials counter : 10000 Sum of the histogram bins : 10000 Sum of PDF values : 1.00000 -------------------------------------------------------------------- Experimental PDF of 50000 normal distributed random variables: bin | count | PDF | ------+-------+---------+------------------------------------------- -3.0 | 117 | 0.00234 | -2.7 | 157 | 0.00314 | * -2.4 | 346 | 0.00692 | ** -2.1 | 672 | 0.01344 | **** -1.8 | 1207 | 0.02414 | ******* -1.5 | 1921 | 0.03842 | ************ -1.2 | 2904 | 0.05808 | ******************* -0.9 | 3940 | 0.07880 | ************************* -0.6 | 5068 | 0.10136 | ********************************* -0.3 | 5752 | 0.11504 | ************************************* 0.0 | 6086 | 0.12172 | **************************************** 0.3 | 5631 | 0.11262 | ************************************* 0.6 | 4911 | 0.09822 | ******************************** 0.9 | 4038 | 0.08076 | ************************** 1.2 | 2871 | 0.05742 | ****************** 1.5 | 1871 | 0.03742 | ************ 1.8 | 1227 | 0.02454 | ******** 2.1 | 670 | 0.01340 | **** 2.4 | 338 | 0.00676 | ** 2.7 | 152 | 0.00304 | 3.0 | 121 | 0.00242 | ------+-------+---------+------------------------------------------- Histogram trials counter : 50000 Sum of the histogram bins : 50000 Sum of PDF values : 1.00000 -------------------------------------------------------------------- Experimental CDF (CDF(x) = Pr(a < x), a - random variable) of the same vector: CDF(-2.85) = 0.0023 CDF(-2.55) = 0.0055 CDF(-2.25) = 0.0124 CDF(-1.95) = 0.0258 CDF(-1.65) = 0.0500 CDF(-1.35) = 0.0884 CDF(-1.05) = 0.1465 CDF(-0.75) = 0.2253 CDF(-0.45) = 0.3266 CDF(-0.15) = 0.4417 CDF( 0.15) = 0.5634 CDF( 0.45) = 0.6760 CDF( 0.75) = 0.7742 CDF( 1.05) = 0.8550 CDF( 1.35) = 0.9124 CDF( 1.65) = 0.9498 CDF( 1.95) = 0.9744 CDF( 2.25) = 0.9878 CDF( 2.55) = 0.9945 CDF( 2.85) = 0.9976 CDF( 3.15) = 1.0000 itpp-4.3.1/tests/integration_test.cpp000066400000000000000000000010741216575753400177440ustar00rootroot00000000000000#include using std::cout; using std::endl; using namespace itpp; double f(const double x) { return x*log(x); } int main() { cout << "=========================================" << endl; cout << " Test of numerical integration routines" << endl; cout << "=========================================" << endl; double res = itpp::quad(f, 1.5, 3.5); double res2 = itpp::quadl(f, 1.5, 3.5); cout << "Integration of f(x)=x*log(x) over [1.5,3.5]" << endl; cout << "quad = " << res << endl; cout << "quadl = " << res2 << endl; return 0; } itpp-4.3.1/tests/integration_test.ref000066400000000000000000000003101216575753400177260ustar00rootroot00000000000000========================================= Test of numerical integration routines ========================================= Integration of f(x)=x*log(x) over [1.5,3.5] quad = 4.71702 quadl = 4.71702 itpp-4.3.1/tests/interleaver_test.cpp000066400000000000000000000060051216575753400177400ustar00rootroot00000000000000/*! * \file * \brief Interleaver classes test program * \author Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { //Declare scalars and vectors: int rows, cols, order, depth; ivec input, output, deinterleaved; //Declare the interleavers. Block_Interleaver block_interleaver; Cross_Interleaver cross_interleaver; Sequence_Interleaver sequence_interleaver; //Testing Block_Interleaver rows = 4; cols = 5; block_interleaver.set_rows(rows); block_interleaver.set_cols(cols); input = "1:20"; output = block_interleaver.interleave(input); deinterleaved = block_interleaver.deinterleave(output); cout << "Testing Block_Interleaver:" << endl; cout << "input = " << input << endl; cout << "output = " << output << endl; cout << "deinterleaved = " << deinterleaved << endl; cout << "===============================================================" << endl; //Testing Cross_Interleaver order = 5; cross_interleaver.set_order(order); input = "1:25"; output = cross_interleaver.interleave(input); deinterleaved = cross_interleaver.deinterleave(output); cout << "Testing Cross_Interleaver:" << endl; cout << "input = " << input << endl; cout << "output = " << output << endl; cout << "deinterleaved = " << deinterleaved << endl; cout << "===============================================================" << endl; //Testing Sequence_Interleaver depth = 25; sequence_interleaver.set_interleaver_depth(depth); sequence_interleaver.randomize_interleaver_sequence(); input = "1:25"; output = sequence_interleaver.interleave(input); deinterleaved = sequence_interleaver.deinterleave(output); cout << "Testing Sequence_Interleaver:" << endl; cout << "input = " << input << endl; cout << "output = " << output << endl; cout << "deinterleaved = " << deinterleaved << endl; cout << "===============================================================" << endl; //Exit program: return 0; } itpp-4.3.1/tests/interleaver_test.ref000066400000000000000000000017401216575753400177330ustar00rootroot00000000000000Testing Block_Interleaver: input = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] output = [1 5 9 13 17 2 6 10 14 18 3 7 11 15 19 4 8 12 16 20] deinterleaved = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] =============================================================== Testing Cross_Interleaver: input = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25] output = [1 0 0 0 0 6 2 0 0 0 11 7 3 0 0 16 12 8 4 0 21 17 13 9 5 0 22 18 14 10 0 0 23 19 15 0 0 0 24 20 0 0 0 0 25 0 0 0 0 0] deinterleaved = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25] =============================================================== Testing Sequence_Interleaver: input = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25] output = [22 4 8 15 11 16 12 3 24 6 17 23 25 5 21 19 14 10 1 20 13 2 18 7 9] deinterleaved = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25] =============================================================== itpp-4.3.1/tests/inv_test.cpp000066400000000000000000000040341216575753400162140ustar00rootroot00000000000000/*! * \file * \brief Matrix inversion routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main(void) { cout << "======================================" << endl; cout << " Test of Matrix inversion routines" << endl; cout << "======================================" << endl; { cout << "Real matrix" << endl; mat X = randn(5, 5), Y; Y = inv(X); cout << "X = " << round_to_zero(X) << endl; cout << "inv(X) = " << round_to_zero(Y) << endl; X = randn(5, 5); Y = inv(X); cout << "X = " << round_to_zero(X) << endl; cout << "inv(X) = " << round_to_zero(Y) << endl; } { cout << endl << "Complex matrix" << endl; cmat X = randn_c(5, 5), Y; Y = inv(X); cout << "X = " << round_to_zero(X) << endl; cout << "inv(X) = " << round_to_zero(Y) << endl; X = randn_c(5, 5); Y = inv(X); cout << "X = " << round_to_zero(X) << endl; cout << "inv(X) = " << round_to_zero(Y) << endl; } return 0; } itpp-4.3.1/tests/inv_test.ref000066400000000000000000000061451216575753400162130ustar00rootroot00000000000000====================================== Test of Matrix inversion routines ====================================== Real matrix X = [[-0.283885 0.56497 -1.0746 -0.732016 -0.869443] [1.36446 -0.596145 2.36476 -2.10553 -0.0504762] [0.906001 -1.19732 2.36508 -0.923457 0.799682] [1.24942 -1.26756 1.22804 -1.89227 1.02849] [1.55783 -0.300385 0.234136 -0.664315 -0.900489]] inv(X) = [[-1.28697 0.589133 -1.41789 0.393791 0.400174] [-1.79976 1.77388 -2.63758 0.183279 -0.494701] [-0.150577 0.369851 0.208356 -0.402353 -0.14986] [-0.461792 -0.196036 0.100129 -0.265647 0.242373] [-1.32454 0.668246 -1.59278 0.711471 -0.470963]] X = [[-0.227649 1.07507 1.12342 0.494639 -0.179719] [-1.83729 -0.396638 1.46072 0.721932 0.549174] [0.0511841 0.51065 -0.269572 0.246282 -0.808968] [1.44132 1.10323 -1.00539 0.672038 -2.29735] [-1.48058 0.910165 1.87195 -1.00149 -0.453797]] inv(X) = [[0.240678 -0.0965384 -2.05963 0.68312 0.00118506] [0.780926 -0.630974 2.1332 -0.929806 -0.168489] [0.131737 0.345854 -2.39064 0.854897 0.300151] [0.342516 0.396511 0.14336 0.104106 -0.438402] [0.568554 -0.398937 0.820371 -0.796888 -0.339767]] Complex matrix X = [[0.1836-1.02371i -0.60769+0.0533137i 0.278311+0.598587i -0.0820166-0.351743i 0.836821-0.477303i] [0.214321-0.98353i -0.121635-0.848777i -0.190616-0.13041i 0.221056+0.634561i -0.637571-1.24894i] [0.261137+1.13396i -1.28903+0.562993i 0.0775548-0.185926i 0.0872567-0.29795i 0.339558+0.0234865i] [-0.225782+1.07734i -0.0690923-0.822132i -0.664453+0.326851i 0.296357+0.901056i -0.181505-0.863075i] [-0.884797+0.465648i 0.953281-0.128067i 0.600433-0.218791i -0.232511+0.964179i 0.621065-0.359776i]] inv(X) = [[-0.285053+0.223534i 0.31513+0.369885i 0.164909-0.0367054i -0.163276-0.293843i -0.0385361+0.171905i] [0.0649418-0.226207i -0.523085+0.115861i -0.69094-0.173853i 0.117923-0.0170855i -0.0610203-0.333552i] [-0.174947-0.314781i 0.122741+0.43016i 0.0814864+0.441221i -0.444011-0.614915i 0.353384+0.141768i] [0.794489+0.326959i -0.408365-0.887589i -0.273996-0.613903i -0.0747653+0.0991911i 0.568163-0.962121i] [0.583528+0.362492i -0.192835-0.177672i 0.120562-0.184039i -0.0439687+0.32014i 0.339201-0.285129i]] X = [[0.61333+0.506973i 0.350946-0.839171i -0.431011-0.173918i 0.43428-0.328699i 0.289013+0.366511i] [-0.295419+0.675185i 0.530681-0.233433i -0.666422-0.180822i -0.497205+0.369685i 0.840226+0.358469i] [-0.475898+0.120633i -0.376251+0.957435i 0.135151+0.431443i 1.30784+0.644844i -0.553286+0.0173776i] [-0.85725-0.0647025i 0.959656+0.279574i 0.735259+0.373431i -0.64014-0.467499i 0.166865+0.139432i] [0.564002+0.646938i -0.165729-2.07819i -0.43385-0.288087i 0.248209-0.110927i -0.304968+1.67774i]] inv(X) = [[-1.56884+2.85706i -0.686022-1.51365i -1.82956-0.368623i -0.654194+1.10399i 0.496356-0.554415i] [1.08318+1.70744i -0.632973-0.263027i -0.689351+0.674477i 0.555648+0.674981i -0.182873-0.194447i] [-0.109461+1.50678i -1.03201-0.464927i -0.509282+0.098309i 0.516951-0.0845369i 0.118724-0.561728i] [2.4589-0.184882i -0.625436+0.734133i 0.864678+0.780617i 0.630133-0.265798i -0.538024-0.116793i] [1.83981+0.683063i -0.427612+0.31054i 0.0578048+0.748268i 0.769988-0.0769272i -0.496158-0.562479i]] itpp-4.3.1/tests/itfile_test.cpp000066400000000000000000000200151216575753400166710ustar00rootroot00000000000000/*! * \file * \brief IT file endianness test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; // To run extensive tests uncomment the following definition // #define EXTENSIVE_TESTS // To rewrite the ITFILE_TEST_FILE uncomment the following definition // #define SAVE_DATA #if (!defined(ITFILE_TEST_FILE) || defined(ITPP_ITFILE_EXCLUDED)) int main() { cerr << "ITFILE_TEST_FILE not defined or ITPP_ITFILE_EXCLUDED defined. Test skipped." << endl; return 1; } #else int main() { char c, c_ref = 'c'; bool bo, bo_ref = true; bin b, b_ref = 0; short s, s_ref = 1234; int i, i_ref = -1234567890; float f, f_ref = -12345.6f; double d, d_ref = 2.1e-8; complex cd, cd_ref = std::complex(1.0, -1.5); string st, st_ref = "abcdefghij 0123456789"; bvec bv, bv_ref = "0 1 0 1 1"; ivec iv, iv_ref = "2 5 -400 2 -10"; vec v, v_ref = "1e-9 0.2 0.7 -1.0 0.0"; cvec cv, cv_ref = "(0,2) (1.5,7.2)"; bmat bm, bm_ref = "0 1 0; 1 1 1"; imat im, im_ref = "2 5; 4 -10; 0 3"; mat m, m_ref = "1e-9 0.2 0.7; -1.0 0.0 3e10"; cmat cm, cm_ref = "(0,2) (-1.5,7.2); (1.1,2) (7,-4e-5)"; Array abv, abv_ref = "{[0 1] [0 0 0] [1 0] [1 1 0]}"; Array aiv, aiv_ref = "{[1 2 3] [4 5 6] [7 8 9]}"; Array av, av_ref = "{[1 2e4 -3.0] [-0.5 6e-9] [7e-3]}"; Array acv, acv_ref = "{[(0,2) (0.5,-0.5)] [(2,1)] [(0,0) (-4.6,2)]}"; Array abm, abm_ref = "{[0 1 0; 0 0 1] [1 1; 0 0; 1 0] [1; 1; 0]}"; Array aim, aim_ref = "{[0 2 3; 0 -1 9; 2 3 -1] [1 10 100] [0 4; -2 3]}"; Array am, am_ref = "{[0.5 2e7; 0.5 -0.5] [1e-4 3 4; 0.1 0.2 .3]}"; Array acm, acm_ref = "{[(0,2) (0.5,-0.5); (2,1) (0,0)] " "[(1.1,2) (7,-4e-5); (0,2) (1.5,7.2)]}"; #ifdef SAVE_DATA it_file fw; fw.open(string(ITFILE_TEST_FILE), true); fw << Name("c", "char variable") << c_ref; fw << Name("bo", "bool variable") << bo_ref; fw << Name("b", "bin variable") << b_ref; fw << Name("s", "short int variable") << s_ref; fw << Name("i", "int variable") << i_ref; fw << Name("f") << f_ref; fw << Name("d") << d_ref; fw << Name("cd") << cd_ref; fw << Name("st") << st_ref; fw << Name("bv") << bv_ref; fw << Name("iv") << concat(iv_ref, iv_ref, iv_ref); fw << Name("v") << v_ref; fw << Name("cv") << cv_ref; fw << Name("bm") << bm_ref; fw << Name("im") << im_ref; fw << Name("m") << m_ref; fw << Name("cm") << cm_ref; fw << Name("abv") << abv_ref; fw << Name("aiv") << aiv_ref; fw << Name("av") << av_ref; fw << Name("acv") << acv_ref; fw << Name("abm") << abm_ref; fw << Name("aim") << aim_ref; fw << Name("am") << am_ref; fw << Name("acm") << acm_ref; fw.remove("iv"); fw << Name("iv") << iv_ref; fw.close(); #endif std::string name, type, desc; uint64_t size; int n = 0; cout << "Name | Type | Size | Description\n" << "------------------------------------------------\n"; it_ifile ff(string(ITFILE_TEST_FILE)); while (ff.seek(n++)) { ff.info(name, type, desc, size); cout << setw(4) << name << setw(12) << type << setw(7) << size << " " << desc << endl; } cout << "------------------------------------------------\n\n"; ff >> Name("abm") >> abm; ff >> Name("abv") >> abv; ff >> Name("acm") >> acm; ff >> Name("acv") >> acv; ff >> Name("aim") >> aim; ff >> Name("aiv") >> aiv; ff >> Name("am") >> am; ff >> Name("av") >> av; ff >> Name("b") >> b; ff >> Name("bm") >> bm; ff >> Name("bo") >> bo; ff >> Name("bv") >> bv; ff >> Name("c") >> c; ff >> Name("cd") >> cd; ff >> Name("cm") >> cm; ff >> Name("cv") >> cv; ff >> Name("d") >> d; ff >> Name("f") >> f; ff >> Name("i") >> i; ff >> Name("im") >> im; ff >> Name("iv") >> iv; ff >> Name("m") >> m; ff >> Name("s") >> s; ff >> Name("st") >> st; ff >> Name("v") >> v; ff.close(); cout << "char : '" << fixed << c << "'" << endl << " '" << fixed << c_ref << "'" << endl << "bool : " << fixed << bo << endl << " " << fixed << bo_ref << endl << "bin : " << fixed << b << endl << " " << fixed << b_ref << endl << "short : " << fixed << s << endl << " " << fixed << s_ref << endl << "int : " << fixed << i << endl << " " << fixed << i_ref << endl << "float : " << fixed << f << endl << " " << fixed << f_ref << endl << "double : " << fixed << d << endl << " " << fixed << d_ref << endl << "complex : " << fixed << cd << endl << " " << fixed << cd_ref << endl << "string : \"" << fixed << st << "\"" << endl << " \"" << fixed << st_ref << "\"" << endl << endl; cout << "bvec : " << fixed << bv << endl << " " << fixed << bv_ref << endl << "ivec : " << fixed << iv << endl << " " << fixed << iv_ref << endl << "vec : " << fixed << v << endl << " " << fixed << v_ref << endl << "cvec : " << fixed << cv << endl << " " << fixed << cv_ref << endl << endl; cout << "bmat :\n" << fixed << bm << endl << fixed << bm_ref << endl << "imat :\n" << fixed << im << endl << fixed << im_ref << endl << "mat :\n" << fixed << m << endl << fixed << m_ref << endl << "cmat :\n" << fixed << cm << endl << fixed << cm_ref << endl << endl; cout << "Array :\n" << fixed << abv << endl << fixed << abv_ref << endl << "Array :\n" << fixed << aiv << endl << fixed << aiv_ref << endl << "Array :\n" << fixed << av << endl << fixed << av_ref << endl << "Array :\n" << fixed << acv << endl << fixed << acv_ref << endl << endl; cout << "Array :\n" << fixed << abm << endl << fixed << abm_ref << endl << "Array :\n" << fixed << aim << endl << fixed << aim_ref << endl << "Array :\n" << fixed << am << endl << fixed << am_ref << endl << "Array :\n" << fixed << acm << endl << fixed << acm_ref << endl << endl; #ifdef EXTENSIVE_TESTS ivec iv0 = "0 0"; ivec iv1 = ones_i(100); ivec iv2 = "2 2 2 2"; ivec iv3 = "3"; it_file ff1("itfile_test_extensive.it", true); ff1 << Name("iv0") << iv0 << flush; ff1 << Name("iv1") << iv1 << flush; ff1 << Name("iv2") << iv2 << flush; ff1.remove("iv1"); ff1 << Name("iv1") << ivec("1") << flush; ff1 << Name("iv3") << iv3 << flush; ff1 << Name("iv4") << iv3 << flush; ff1.remove("iv3"); ff1.low_level().seekg(0, std::ios::end); it_info("Size before packing: " << ff1.low_level().tellg()); ff1.pack(); ff1.low_level().seekg(0, std::ios::end); it_info("Size after packing: " << ff1.low_level().tellg()); ff1.close(); it_ifile ff2("itfile_test_extensive.it"); n = 0; while (ff2.seek(n++)) { ff2.info(name, type, desc, size); ff2 >> iv1; cout << "Name = " << name << " Type = " << type << " Size = " << size << " Desc = \"" << desc << "\" Data = " << iv1 << endl; } ff2.close(); #endif return 0; } #endif itpp-4.3.1/tests/itfile_test.ref000066400000000000000000000064521216575753400166740ustar00rootroot00000000000000Name | Type | Size | Description ------------------------------------------------ c int8 1 char variable bo bool 1 bool variable b bin 1 bin variable s int16 2 short int variable i int32 4 int variable f float32 4 d float64 8 cd cfloat64 16 st string 29 bv bvec 13 iv ivec 28 v dvec 48 cv dcvec 40 bm bmat 22 im imat 40 m dmat 64 cm dcmat 80 abv bvecArray 50 aiv ivecArray 68 av vecArray 80 acv cvecArray 112 abm bmatArray 71 aim imatArray 120 am matArray 120 acm cmatArray 168 ------------------------------------------------ char : 'c' 'c' bool : 1 1 bin : 0 0 short : 1234 1234 int : -1234567890 -1234567890 float : -12345.599609 -12345.599609 double : 0.000000 0.000000 complex : 1.000000-1.500000i 1.000000-1.500000i string : "abcdefghij 0123456789" "abcdefghij 0123456789" bvec : [0 1 0 1 1] [0 1 0 1 1] ivec : [2 5 -400 2 -10] [2 5 -400 2 -10] vec : [0.000000 0.200000 0.700000 -1.000000 0.000000] [0.000000 0.200000 0.700000 -1.000000 0.000000] cvec : [0.000000+2.000000i 1.500000+7.200000i] [0.000000+2.000000i 1.500000+7.200000i] bmat : [[0 1 0] [1 1 1]] [[0 1 0] [1 1 1]] imat : [[2 5] [4 -10] [0 3]] [[2 5] [4 -10] [0 3]] mat : [[0.000000 0.200000 0.700000] [-1.000000 0.000000 30000000000.000000]] [[0.000000 0.200000 0.700000] [-1.000000 0.000000 30000000000.000000]] cmat : [[0.000000+2.000000i -1.500000+7.200000i] [1.100000+2.000000i 7.000000-0.000040i]] [[0.000000+2.000000i -1.500000+7.200000i] [1.100000+2.000000i 7.000000-0.000040i]] Array : {[0 1] [0 0 0] [1 0] [1 1 0]} {[0 1] [0 0 0] [1 0] [1 1 0]} Array : {[1 2 3] [4 5 6] [7 8 9]} {[1 2 3] [4 5 6] [7 8 9]} Array : {[1.000000 20000.000000 -3.000000] [-0.500000 0.000000] [0.007000]} {[1.000000 20000.000000 -3.000000] [-0.500000 0.000000] [0.007000]} Array : {[0.000000+2.000000i 0.500000-0.500000i] [2.000000+1.000000i] [0.000000+0.000000i -4.600000+2.000000i]} {[0.000000+2.000000i 0.500000-0.500000i] [2.000000+1.000000i] [0.000000+0.000000i -4.600000+2.000000i]} Array : {[[0 1 0] [0 0 1]] [[1 1] [0 0] [1 0]] [[1] [1] [0]]} {[[0 1 0] [0 0 1]] [[1 1] [0 0] [1 0]] [[1] [1] [0]]} Array : {[[0 2 3] [0 -1 9] [2 3 -1]] [[1 10 100]] [[0 4] [-2 3]]} {[[0 2 3] [0 -1 9] [2 3 -1]] [[1 10 100]] [[0 4] [-2 3]]} Array : {[[0.500000 20000000.000000] [0.500000 -0.500000]] [[0.000100 3.000000 4.000000] [0.100000 0.200000 0.300000]]} {[[0.500000 20000000.000000] [0.500000 -0.500000]] [[0.000100 3.000000 4.000000] [0.100000 0.200000 0.300000]]} Array : {[[0.000000+2.000000i 0.500000-0.500000i] [2.000000+1.000000i 0.000000+0.000000i]] [[1.100000+2.000000i 7.000000-0.000040i] [0.000000+2.000000i 1.500000+7.200000i]]} {[[0.000000+2.000000i 0.500000-0.500000i] [2.000000+1.000000i 0.000000+0.000000i]] [[1.100000+2.000000i 7.000000-0.000040i] [0.000000+2.000000i 1.500000+7.200000i]]} itpp-4.3.1/tests/itfile_test_data.it000066400000000000000000000042031216575753400175150ustar00rootroot00000000000000IT++-.cint8char variablec./boboolbool variable+,bbinbin variable35sint16short int variable-1iint32int variable.i#'ffloat32f@#+dfloat64oV>%5cdcfloat64?#@ststringabcdefghij 0123456789! .bvbvec!eivivecppp 0Pvdvec& .>?ffffff?"(Jcvdcvec@?@!7bmbmat!(Iimimat @`mdmat& .>𿚙?ffffff?B"Prcmdcmat@?@@@h㈵'2YabvbvecArray'DkaivivecArray %PuavvecArray?@A:9>y&1|?'pacvcvecArray@?@?ffffff@'GnabmbmatArray'xaimimatArray  d%xammatArray??sA-C6??@?@333333?'acmcmatArray@@???@@@h㈵?@itpp-4.3.1/tests/ldpc_test.cpp000066400000000000000000000054101216575753400163410ustar00rootroot00000000000000/*! * \file * \brief LDPC class test program * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using std::cout; using std::endl; using namespace itpp; int main() { LDPC_Parity_Regular H; H.generate(200, 3, 6, "rand", "100 6"); int girth = H.cycle_removal_MGW(6); cout << "girth=" << girth << endl; LDPC_Generator_Systematic G; G.construct(&H); LDPC_Code C(&H, &G); C.save_code("ldpc_test.codec"); LDPC_Code C1("ldpc_test.codec", &G); cout << C << endl; bvec bitsin = randb(C.get_nvar() - C.get_ncheck()); bvec bitsout; C.encode(bitsin, bitsout); it_assert(C.syndrome_check(bitsout), "syndrome check failed"); double EbN0db = 1.5; double N0 = pow(10.0, -EbN0db / 10.0) / C.get_rate(); double sigma = sqrt(N0 / 2.0); vec x = 1.0 + sigma * randn(C.get_nvar()); QLLRvec LLRin = C.get_llrcalc().to_qllr(2.0 * x / (N0 / 2.0)); QLLRvec LLRout(C.get_nvar()); C.bp_decode(LLRin, LLRout); cout << LLRout.left(25) << endl; // BLDPC code { cout.precision(5); imat A = "0 -1 -1 0; -1 1 4 -1; -1 2 -1 6"; imat B = "1; -1; 2"; imat T = "0 -1 -1; 0 0 -1; -1 0 0"; imat C = "3 -1 5 -1"; imat D = "3"; imat E = "-1 -1 0"; // base matrix imat H_b = concat_vertical(concat_horizontal(concat_horizontal(A, B), T), concat_horizontal(concat_horizontal(C, D), E)); int Z = 4; // expansion factor cout << endl; cout << "expansion factor Z = " << Z << endl; cout << "base matrix H_b =\n" << H_b << endl; BLDPC_Parity H(H_b, Z); cout << "expanded parity check matrix H =\n" << H.get_H() << endl; BLDPC_Generator G(&H); bvec in_bits = randb(H.get_nvar() - H.get_ncheck()); bvec codeword; G.encode(in_bits, codeword); cout << in_bits << endl << codeword << endl; } } itpp-4.3.1/tests/ldpc_test.ref000066400000000000000000000045711216575753400163420ustar00rootroot00000000000000girth=6 --- LDPC codec ---------------------------------- Nvar : 200 Ncheck : 100 Rate : 0.5 Column degrees (node perspective): [0 0 0 200] Row degrees (node perspective): [0 0 0 0 0 0 100] ------------------------------------------------- Decoder parameters: - method : BP - max. iterations : 50 - syndrome check at each iteration : 1 - syndrome check at start : 0 ------------------------------------------------- ---------- LLR calculation unit ----------------- LLR_calc_unit table properties: The granularity in the LLR representation is 0.000244141 The LLR scale factor is 4096 The largest LLR that can be represented is 32768 The table resolution is 0.03125 The number of entries in the table is 300 The tables truncates at the LLR value 9.375 ------------------------------------------------- [59206 84045 66547 55815 30811 70593 50011 58882 47795 79132 67235 65274 33933 79540 70854 68505 65730 64267 75268 62512 83351 75884 59064 72167 45408] expansion factor Z = 4 base matrix H_b = [[0 -1 -1 0 1 0 -1 -1] [-1 1 4 -1 -1 0 0 -1] [-1 2 -1 6 2 -1 0 0] [3 -1 5 -1 3 -1 -1 0]] expanded parity check matrix H = ---- GF(2) matrix of dimension 16*32 -- Density: 0.13281 ---- 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 [0 0 0 1 0 1 0 1 1 1 1 1 1 0 1 1] [0 0 0 1 0 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 1 0] itpp-4.3.1/tests/linspace_test.cpp000066400000000000000000000276031216575753400172250ustar00rootroot00000000000000/*! * \file * \brief linspace functions test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace std; using namespace itpp; #define TOL 1e-12 int main(void) { cout << "================================" << endl; cout << " Test of linspace() function " << endl; cout << "================================" << endl; double from = 0; double to = 2; int points = 1; vec v = linspace(from, to, points); cout << "Generating a vector of " << points << " points, from " << from << " to " << to << std::endl; if (points != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be " << points << endl; } else { cout << "Vector length is " << v.length() << endl; } if (to != v(0)) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be " << to << endl; } else { cout << "Vector element is " << v(0) << endl; } from = 0; to = 10; points = 30; v = linspace(from, to, points); cout << "Generating a vector of " << points << " points, from " << from << " to " << to << endl; if (points != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be " << points << endl; } else { cout << "Vector length is " << v.length() << endl; } vec actual_v(v.length()); int n; for (n = 0; n < v.length()-1; ++n) { actual_v(n) = n*(to-from)/(points-1); } actual_v(n) = to; if (any(abs(actual_v - v) > TOL) || from != v(0) || to != v(v.length()-1)) { cout << "Wrong vector elements: " << v << endl; cout << "Vector elements should be: " << actual_v << endl; } else { cout << "Vector elements are: " << v << endl; } cout << "==========================================" << endl; cout << " Test of linspace_fixed_step() function " << endl; cout << "==========================================" << endl; from = 0; to = 10; double step = 1.0; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; int actual_len = floor_i((to-from)/step)+1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } if (any(abs(actual_v - v) > TOL) || from != v(0) || to < v(v.length()-1)) { cout << "Wrong vector elements: " << v << endl; cout << "Vector elements should be: " << actual_v << endl; } else { cout << "Vector elements are: " << v << endl; } from = 0; to = 10; step = 1.1; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = floor_i((to-from)/step)+1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } if (any(abs(actual_v - v) > TOL) || from != v(0) || to < v(v.length()-1)) { cout << "Wrong vector elements: " << v << endl; cout << "Vector elements should be: " << actual_v << endl; } else { cout << "Vector elements are: " << v << endl; } from = 0; to = 1; step = 2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = 1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } if (from != v(0)) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } from = 0; to = -1; step = -2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = 1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } if (from != v(0)) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } from = 0; to = -1; step = 2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = 0; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); if (v != actual_v) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } from = -1; to = 0; step = 2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = 1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); actual_v(0) = from; if (v != actual_v) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } from = -1; to = 0; step = -2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = 0; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); if (v != actual_v) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } from = -5; to = 5; step = 2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = floor_i((to-from)/step)+1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); for (n = 0; n < actual_v.length(); ++n) { actual_v(n) = from+n*step; } if (v != actual_v) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } from = 5; to = -5; step = -2; v = linspace_fixed_step(from, to, step); cout << "Generating a vector with a step of " << step << ", from " << from << " to " << to << endl; actual_len = floor_i((to-from)/step)+1; if (actual_len != v.length()) { cout << "Wrong vector length: " << v.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << v.length() << endl; } actual_v.set_size(actual_len); for (n = 0; n < actual_len; ++n) { actual_v(n) = from+n*step; } if (v != actual_v) { cout << "Wrong vector element: " << v << endl; cout << "Vector element should be: " << actual_v << endl; } else { cout << "Vector element is: " << v << endl; } int ifrom = 0; int ito = 10; ivec iv = linspace_fixed_step(ifrom, ito); cout << "Generating an integer vector with a step of 1" << ", from " << ifrom << " to " << ito << endl; actual_len = floor_i(ito-ifrom)+1; if (actual_len != iv.length()) { cout << "Wrong vector length: " << iv.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << iv.length() << endl; } ivec actual_iv(actual_len); for (n = 0; n < actual_iv.length(); ++n) { actual_iv(n) = ifrom+n; } if (iv != actual_iv) { cout << "Wrong vector element: " << iv << endl; cout << "Vector element should be: " << actual_iv << endl; } else { cout << "Vector element is: " << iv << endl; } short int sfrom = 0; short int sto = 10; svec sv = linspace_fixed_step(sfrom, sto); cout << "Generating a short integer vector with a step of 1" << ", from " << sfrom << " to " << sto << endl; actual_len = floor_i(sto-sfrom)+1; if (actual_len != sv.length()) { cout << "Wrong vector length: " << sv.length() << endl; cout << "Vector length should be: " << actual_len << endl; } else { cout << "Vector length is: " << sv.length() << endl; } svec actual_sv(actual_len); for (n = 0; n < actual_sv.length(); ++n) { actual_sv(n) = sfrom+n; } if (sv != actual_sv) { cout << "Wrong vector element: " << sv << endl; cout << "Vector element should be: " << actual_sv << endl; } else { cout << "Vector element is: " << sv << endl; } } itpp-4.3.1/tests/linspace_test.ref000066400000000000000000000034411216575753400172110ustar00rootroot00000000000000================================ Test of linspace() function ================================ Generating a vector of 1 points, from 0 to 2 Vector length is 1 Vector element is 2 Generating a vector of 30 points, from 0 to 10 Vector length is 30 Vector elements are: [0 0.344828 0.689655 1.03448 1.37931 1.72414 2.06897 2.41379 2.75862 3.10345 3.44828 3.7931 4.13793 4.48276 4.82759 5.17241 5.51724 5.86207 6.2069 6.55172 6.89655 7.24138 7.58621 7.93103 8.27586 8.62069 8.96552 9.31034 9.65517 10] ========================================== Test of linspace_fixed_step() function ========================================== Generating a vector with a step of 1, from 0 to 10 Vector length is: 11 Vector elements are: [0 1 2 3 4 5 6 7 8 9 10] Generating a vector with a step of 1.1, from 0 to 10 Vector length is: 10 Vector elements are: [0 1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9] Generating a vector with a step of 2, from 0 to 1 Vector length is: 1 Vector element is: [0] Generating a vector with a step of -2, from 0 to -1 Vector length is: 1 Vector element is: [0] Generating a vector with a step of 2, from 0 to -1 Vector length is: 0 Vector element is: [] Generating a vector with a step of 2, from -1 to 0 Vector length is: 1 Vector element is: [-1] Generating a vector with a step of -2, from -1 to 0 Vector length is: 0 Vector element is: [] Generating a vector with a step of 2, from -5 to 5 Vector length is: 6 Vector element is: [-5 -3 -1 1 3 5] Generating a vector with a step of -2, from 5 to -5 Vector length is: 6 Vector element is: [5 3 1 -1 -3 -5] Generating an integer vector with a step of 1, from 0 to 10 Vector length is: 11 Vector element is: [0 1 2 3 4 5 6 7 8 9 10] Generating a short integer vector with a step of 1, from 0 to 10 Vector length is: 11 Vector element is: [0 1 2 3 4 5 6 7 8 9 10] itpp-4.3.1/tests/llr_test.cpp000066400000000000000000000063601216575753400162150ustar00rootroot00000000000000/*! * \file * \brief Test program for the LLR class * \author Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { // This is a hack for improper rounding under MinGW cout.precision(13); LLR_calc_unit lcu1; // standard table resolution LLR_calc_unit lcu2(10, 7, 9); // low table resolution LLR_calc_unit lcu3(2, 15, 0); // low table resolution and low LLR granuality LLR_calc_unit lcu4(10, 0, 0); // this gives logexp=logmax cout << lcu1 << endl; cout << lcu2 << endl; cout << lcu3 << endl; cout << lcu4 << endl; cout << "Testing Jacobian logarithm with four different resolutions." << endl; for (double x = 0.0; x < 10; x += 0.1) { cout << "JacLog(" << x << ") = " << lcu1.to_double(lcu1.logexp(lcu1.to_qllr(x))) << " ; " << lcu2.to_double(lcu2.logexp(lcu2.to_qllr(x))) << " ; " << lcu3.to_double(lcu3.logexp(lcu3.to_qllr(x))) << " ; " << lcu4.to_double(lcu4.logexp(lcu4.to_qllr(x))) << endl; } cout << "-------------------" << endl; cout << "Some special cases:" << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(100.0), lcu1.to_qllr(0.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(100.0), lcu1.to_qllr(-0.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-100.0), lcu1.to_qllr(0.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-100.0), lcu1.to_qllr(-0.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(0.0), lcu1.to_qllr(0.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(0.0), lcu1.to_qllr(-0.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(3.75), lcu1.to_qllr(-1.25))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-1.25), lcu1.to_qllr(3.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(-3.75), lcu1.to_qllr(1.25))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(1.25), lcu1.to_qllr(-3.75))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(3.75), lcu1.to_qllr(1.25))) << endl; cout << lcu1.to_double(lcu1.Boxplus(lcu1.to_qllr(1.25), lcu1.to_qllr(3.75))) << endl; return 0; } itpp-4.3.1/tests/llr_test.ref000066400000000000000000000137601216575753400162110ustar00rootroot00000000000000---------- LLR calculation unit ----------------- LLR_calc_unit table properties: The granularity in the LLR representation is 0.000244140625 The LLR scale factor is 4096 The largest LLR that can be represented is 32767.99975586 The table resolution is 0.03125 The number of entries in the table is 300 The tables truncates at the LLR value 9.375 ------------------------------------------------- ---------- LLR calculation unit ----------------- LLR_calc_unit table properties: The granularity in the LLR representation is 0.0009765625 The LLR scale factor is 1024 The largest LLR that can be represented is 131071.9990234 The table resolution is 0.5 The number of entries in the table is 7 The tables truncates at the LLR value 3.5 ------------------------------------------------- ---------- LLR calculation unit ----------------- LLR_calc_unit table properties: The granularity in the LLR representation is 0.25 The LLR scale factor is 4 The largest LLR that can be represented is 33554431.75 The table resolution is 0.25 The number of entries in the table is 15 The tables truncates at the LLR value 3.75 ------------------------------------------------- ---------- LLR calculation unit ----------------- LLR_calc_unit table properties: The granularity in the LLR representation is 0.0009765625 The LLR scale factor is 1024 The largest LLR that can be represented is 131071.9990234 The table resolution is 0.0009765625 The number of entries in the table is 0 The tables truncates at the LLR value 0 ------------------------------------------------- Testing Jacobian logarithm with four different resolutions. JacLog(0) = 0.693115234375 ; 0.693359375 ; 0.75 ; 0 JacLog(0.1) = 0.6474609375 ; 0.693359375 ; 0.75 ; 0 JacLog(0.2) = 0.603759765625 ; 0.693359375 ; 0.5 ; 0 JacLog(0.3) = 0.562255859375 ; 0.693359375 ; 0.5 ; 0 JacLog(0.4) = 0.523193359375 ; 0.693359375 ; 0.5 ; 0 JacLog(0.5) = 0.47412109375 ; 0.4736328125 ; 0.5 ; 0 JacLog(0.6) = 0.439697265625 ; 0.4736328125 ; 0.5 ; 0 JacLog(0.7) = 0.407470703125 ; 0.4736328125 ; 0.5 ; 0 JacLog(0.8) = 0.376953125 ; 0.4736328125 ; 0.5 ; 0 JacLog(0.9) = 0.348388671875 ; 0.4736328125 ; 0.25 ; 0 JacLog(1) = 0.313232421875 ; 0.3134765625 ; 0.25 ; 0 JacLog(1.1) = 0.288818359375 ; 0.3134765625 ; 0.25 ; 0 JacLog(1.2) = 0.26611328125 ; 0.3134765625 ; 0.25 ; 0 JacLog(1.3) = 0.2451171875 ; 0.3134765625 ; 0.25 ; 0 JacLog(1.4) = 0.225341796875 ; 0.3134765625 ; 0.25 ; 0 JacLog(1.5) = 0.201416015625 ; 0.201171875 ; 0.25 ; 0 JacLog(1.6) = 0.18505859375 ; 0.201171875 ; 0.25 ; 0 JacLog(1.7) = 0.169677734375 ; 0.201171875 ; 0.25 ; 0 JacLog(1.8) = 0.15576171875 ; 0.201171875 ; 0.25 ; 0 JacLog(1.9) = 0.142578125 ; 0.201171875 ; 0.25 ; 0 JacLog(2) = 0.126953125 ; 0.126953125 ; 0.25 ; 0 JacLog(2.1) = 0.1162109375 ; 0.126953125 ; 0.25 ; 0 JacLog(2.2) = 0.1064453125 ; 0.126953125 ; 0 ; 0 JacLog(2.3) = 0.09716796875 ; 0.126953125 ; 0 ; 0 JacLog(2.4) = 0.0888671875 ; 0.126953125 ; 0 ; 0 JacLog(2.5) = 0.078857421875 ; 0.0791015625 ; 0 ; 0 JacLog(2.6) = 0.072021484375 ; 0.0791015625 ; 0 ; 0 JacLog(2.7) = 0.06591796875 ; 0.0791015625 ; 0 ; 0 JacLog(2.8) = 0.06005859375 ; 0.0791015625 ; 0 ; 0 JacLog(2.9) = 0.054931640625 ; 0.0791015625 ; 0 ; 0 JacLog(3) = 0.048583984375 ; 0.048828125 ; 0 ; 0 JacLog(3.1) = 0.04443359375 ; 0.048828125 ; 0 ; 0 JacLog(3.2) = 0.04052734375 ; 0.048828125 ; 0 ; 0 JacLog(3.3) = 0.036865234375 ; 0.048828125 ; 0 ; 0 JacLog(3.4) = 0.03369140625 ; 0.048828125 ; 0 ; 0 JacLog(3.5) = 0.02978515625 ; 0 ; 0 ; 0 JacLog(3.6) = 0.027099609375 ; 0 ; 0 ; 0 JacLog(3.7) = 0.024658203125 ; 0 ; 0 ; 0 JacLog(3.8) = 0.0224609375 ; 0 ; 0 ; 0 JacLog(3.9) = 0.0205078125 ; 0 ; 0 ; 0 JacLog(4) = 0.01806640625 ; 0 ; 0 ; 0 JacLog(4.1) = 0.0166015625 ; 0 ; 0 ; 0 JacLog(4.2) = 0.01513671875 ; 0 ; 0 ; 0 JacLog(4.3) = 0.013671875 ; 0 ; 0 ; 0 JacLog(4.4) = 0.012451171875 ; 0 ; 0 ; 0 JacLog(4.5) = 0.010986328125 ; 0 ; 0 ; 0 JacLog(4.6) = 0.010009765625 ; 0 ; 0 ; 0 JacLog(4.7) = 0.00927734375 ; 0 ; 0 ; 0 JacLog(4.8) = 0.00830078125 ; 0 ; 0 ; 0 JacLog(4.9) = 0.007568359375 ; 0 ; 0 ; 0 JacLog(5) = 0.0068359375 ; 0 ; 0 ; 0 JacLog(5.1) = 0.006103515625 ; 0 ; 0 ; 0 JacLog(5.2) = 0.005615234375 ; 0 ; 0 ; 0 JacLog(5.3) = 0.005126953125 ; 0 ; 0 ; 0 JacLog(5.4) = 0.004638671875 ; 0 ; 0 ; 0 JacLog(5.5) = 0.004150390625 ; 0 ; 0 ; 0 JacLog(5.6) = 0.003662109375 ; 0 ; 0 ; 0 JacLog(5.7) = 0.00341796875 ; 0 ; 0 ; 0 JacLog(5.8) = 0.003173828125 ; 0 ; 0 ; 0 JacLog(5.9) = 0.002685546875 ; 0 ; 0 ; 0 JacLog(6) = 0.00244140625 ; 0 ; 0 ; 0 JacLog(6.1) = 0.002197265625 ; 0 ; 0 ; 0 JacLog(6.2) = 0.001953125 ; 0 ; 0 ; 0 JacLog(6.3) = 0.001953125 ; 0 ; 0 ; 0 JacLog(6.4) = 0.001708984375 ; 0 ; 0 ; 0 JacLog(6.5) = 0.00146484375 ; 0 ; 0 ; 0 JacLog(6.6) = 0.00146484375 ; 0 ; 0 ; 0 JacLog(6.7) = 0.001220703125 ; 0 ; 0 ; 0 JacLog(6.8) = 0.001220703125 ; 0 ; 0 ; 0 JacLog(6.9) = 0.0009765625 ; 0 ; 0 ; 0 JacLog(7) = 0.0009765625 ; 0 ; 0 ; 0 JacLog(7.1) = 0.000732421875 ; 0 ; 0 ; 0 JacLog(7.2) = 0.000732421875 ; 0 ; 0 ; 0 JacLog(7.3) = 0.000732421875 ; 0 ; 0 ; 0 JacLog(7.4) = 0.000732421875 ; 0 ; 0 ; 0 JacLog(7.5) = 0.00048828125 ; 0 ; 0 ; 0 JacLog(7.6) = 0.00048828125 ; 0 ; 0 ; 0 JacLog(7.7) = 0.00048828125 ; 0 ; 0 ; 0 JacLog(7.8) = 0.00048828125 ; 0 ; 0 ; 0 JacLog(7.9) = 0.00048828125 ; 0 ; 0 ; 0 JacLog(8) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.1) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.2) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.3) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.4) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.5) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.6) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.7) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.8) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(8.9) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(9) = 0.000244140625 ; 0 ; 0 ; 0 JacLog(9.1) = 0 ; 0 ; 0 ; 0 JacLog(9.2) = 0 ; 0 ; 0 ; 0 JacLog(9.3) = 0 ; 0 ; 0 ; 0 JacLog(9.4) = 0 ; 0 ; 0 ; 0 JacLog(9.5) = 0 ; 0 ; 0 ; 0 JacLog(9.6) = 0 ; 0 ; 0 ; 0 JacLog(9.7) = 0 ; 0 ; 0 ; 0 JacLog(9.8) = 0 ; 0 ; 0 ; 0 JacLog(9.9) = 0 ; 0 ; 0 ; 0 JacLog(10) = 0 ; 0 ; 0 ; 0 ------------------- Some special cases: 0.75 -0.75 -0.75 0.75 0 0 -1.177978515625 -1.177978515625 -1.177978515625 -1.177978515625 1.177978515625 1.177978515625 itpp-4.3.1/tests/ls_solve_test.cpp000066400000000000000000000135621216575753400172540ustar00rootroot00000000000000/*! * \file * \brief Linear systems of equations solving test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "==========================================" << endl; cout << " Solving linear systems of equations" << endl; cout << "==========================================" << endl; { cout << "Real systems:" << endl << endl; mat A, B, X; vec b, x; A = randn(4, 4); b = randn(4); x = ls_solve(A, b); cout << "Square system: Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn(4, 4); B = randn(4, 2); X = ls_solve(A, B); cout << "Square system: AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; A = randn(4, 4); A = A.transpose() * A; b = randn(4); x = ls_solve(A, b); cout << "Square system (chol): Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn(4, 4); A = A.transpose() * A; B = randn(4, 2); X = ls_solve(A, B); cout << "Square system (Chol): AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; A = randn(4, 2); b = randn(4); x = ls_solve_od(A, b); cout << "Overdetermined system: Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn(4, 2); B = randn(4, 3); X = ls_solve_od(A, B); cout << "Overdetermined system: AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; A = randn(2, 4); b = randn(2); x = ls_solve_ud(A, b); cout << "Underdetermined system: Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn(2, 4); B = randn(2, 3); X = ls_solve_ud(A, B); cout << "Underdetermined system: AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; } { cout << "Complex systems:" << endl << endl; cmat A, B, X; cvec b, x; A = randn_c(4, 4); b = randn_c(4); x = ls_solve(A, b); cout << "Square system: Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn_c(4, 4); B = randn_c(4, 2); X = ls_solve(A, B); cout << "Square system: AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; A = randn_c(4, 4); A = A.transpose() * A; b = randn_c(4); x = ls_solve(A, b); cout << "Square system (chol): Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn_c(4, 4); A = A.transpose() * A; B = randn_c(4, 2); X = ls_solve(A, B); cout << "Square system (Chol): AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; A = randn_c(4, 2); b = randn_c(4); x = ls_solve_od(A, b); cout << "Overdetermined system: Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn_c(4, 2); B = randn_c(4, 3); X = ls_solve_od(A, B); cout << "Overdetermined system: AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; A = randn_c(2, 4); b = randn_c(2); x = ls_solve_ud(A, b); cout << "Underdetermined system: Ax=b" << endl << "============================" << endl << "A=" << A << endl << "b=" << b << endl << "x=" << x << endl << endl; A = randn_c(2, 4); B = randn_c(2, 3); X = ls_solve_ud(A, B); cout << "Underdetermined system: AX=B" << endl << "============================" << endl << "A=" << A << endl << "B=" << B << endl << "X=" << X << endl << endl; } return 0; } itpp-4.3.1/tests/ls_solve_test.ref000066400000000000000000000154571216575753400172530ustar00rootroot00000000000000========================================== Solving linear systems of equations ========================================== Real systems: Square system: Ax=b ============================ A=[[-0.283885 1.55783 -1.26756 2.36508] [1.36446 0.56497 -0.300385 1.22804] [0.906001 -0.596145 -1.0746 0.234136] [1.24942 -1.19732 2.36476 -0.732016]] b=[-2.10553 -0.923457 -1.89227 -0.664315] x=[0.567745 2.89152 0.0468522 -2.70159] Square system: AX=B ============================ A=[[-0.869443 -0.900489 1.44132 0.51065] [-0.0504762 -0.227649 -1.48058 1.10323] [0.799682 -1.83729 1.07507 0.910165] [1.02849 0.0511841 -0.396638 1.12342]] B=[[1.46072 0.494639] [-0.269572 0.721932] [-1.00539 0.246282] [1.87195 0.672038]] X=[[-0.288243 -0.198088] [2.51547 0.22125] [1.57136 0.0793743] [2.37036 0.797498]] Square system (chol): Ax=b ============================ A=[[1.9913 3.6961 -1.14807 -1.17394] [3.6961 7.64716 -2.29094 -1.23612] [-1.14807 -2.29094 4.73466 -1.62202] [-1.17394 -1.23612 -1.62202 4.42265]] b=[-0.859404 0.075397 -0.172018 -1.20035] x=[-11.9288 4.92971 -1.42876 -2.58393] Square system (Chol): AX=B ============================ A=[[5.31846 -3.62451 0.639575 2.35781] [-3.62451 2.72182 -0.509437 -1.27826] [0.639575 -0.509437 0.187849 0.342553] [2.35781 -1.27826 0.342553 1.91344]] B=[[-0.115989 0.1234] [-0.49744 -0.421365] [0.312621 0.419113] [0.897405 1.27429]] X=[[-13.745 -10.3588] [-16.9402 -12.3473] [-12.7432 -8.06913] [8.37061 6.62646]] Overdetermined system: Ax=b ============================ A=[[-0.32882 -0.901661] [1.36355 -1.76627] [1.18344 0.480208] [-0.675009 0.0332149]] b=[-0.256686 -1.22057 0.878319 -0.5088] x=[0.2637 0.769654] Overdetermined system: AX=B ============================ A=[[0.867379 -0.673021] [0.716969 0.170602] [-0.417785 -1.21233] [0.954855 -0.0915031]] B=[[0.797619 0.750496 1.35716] [0.914909 -0.330124 0.395377] [0.496313 -0.532099 -0.234376] [-1.18677 1.35402 -2.93901]] X=[[-0.00493739 0.820064 -0.533252] [-0.445897 -0.00281812 -0.160925]] Underdetermined system: Ax=b ============================ A=[[-0.609542 -0.942463 0.191133 1.03981] [-0.245957 -0.255721 0.610152 0.528111]] b=[-0.613556 -0.407417] x=[0.146367 0.17172 -0.279479 -0.297248] Underdetermined system: AX=B ============================ A=[[0.614165 -0.703154 1.84956 -0.905295] [-0.46485 0.522814 0.911948 -0.661143]] B=[[0.35102 0.408726 1.18826] [-0.156875 0.518324 0.506951]] X=[[0.185859 -0.158099 0.0745981] [-0.210747 0.178063 -0.0863754] [0.0571189 0.248651 0.463066] [0.0187346 -0.189039 -0.248804]] Complex systems: Square system: Ax=b ============================ A=[[-0.553286+0.0173776i 0.544018-0.639508i -0.367446+0.689669i -0.303096+0.899195i] [0.166865+0.139432i -0.0358186+0.726389i 0.826762-0.540905i -0.0308906-0.182278i] [-0.304968+1.67774i 0.0141512-1.15327i 0.0171929-0.304334i 0.540058-0.207293i] [0.214558-0.605614i 0.878131-0.401499i 0.475183+0.136609i -0.6724-0.329522i]] b=[2.25393-0.170705i -0.25516+1.69291i 0.49826-0.550361i 0.338276-0.300265i] x=[1.46343-0.862356i 1.79686-0.0956254i -0.309463+0.118249i 0.076739-2.36142i] Square system: AX=B ============================ A=[[0.559865+0.00183951i -0.293208+0.663596i -0.37374+0.405477i 0.158062+0.51012i] [0.242933+0.543132i 0.89475+0.303812i 0.301014+0.506654i 1.00245-0.229429i] [-0.612738+0.588127i -1.0207-0.951271i 0.960425+0.975944i 0.0881398-0.58438i] [1.65792-0.393007i -1.04226-0.386231i 0.335689+0.747608i 0.126475-0.189326i]] B=[[-0.618709+0.491061i -0.253027-0.541688i] [1.16609-0.145443i -0.934058+0.686608i] [0.983717-0.213724i -1.25157-0.584849i] [-0.731866+0.217072i -1.01874+0.76928i]] X=[[-0.647035-0.0797186i -0.444017+0.365443i] [-0.432648+0.234662i -0.390796-0.940388i] [0.353828+0.766879i -2.21001+0.264831i] [1.97228+0.188757i -0.392537+2.74235i]] Square system (chol): Ax=b ============================ A=[[0.642759-0.111856i 1.3799+0.875182i 0.523224-0.163564i -0.545654+0.469629i] [1.3799+0.875182i 0.255661-0.122812i 1.65199-2.6126i -1.57054+0.633755i] [0.523224-0.163564i 1.65199-2.6126i -1.56583-1.12734i 0.155171-0.735735i] [-0.545654+0.469629i -1.57054+0.633755i 0.155171-0.735735i 0.969467+2.25502i]] b=[-1.18005-1.24755i 0.926539-0.38808i 1.65558-0.23692i 1.54007+0.101457i] x=[-1.42493-2.6008i 0.105342-0.046747i -1.4517+0.626622i -0.821244-0.105259i] Square system (Chol): AX=B ============================ A=[[-0.0148067-1.02659i 1.44002+1.05624i -0.391971+0.107885i 0.333963+1.06198i] [1.44002+1.05624i -1.43101+1.62274i 1.29331+0.372876i -1.12338+0.0113861i] [-0.391971+0.107885i 1.29331+0.372876i 2.73332+0.4951i 1.14373-0.476184i] [0.333963+1.06198i -1.12338+0.0113861i 1.14373-0.476184i -1.31052-1.55123i]] B=[[-0.158393-0.157269i -0.63153-0.612888i] [0.0125424-0.0270121i 0.460076-0.878953i] [-0.300359+0.101718i 0.378644-0.988922i] [0.158826-0.502674i 0.249059-0.589429i]] X=[[0.389139+0.0892948i -1.01639+0.828168i] [-0.0375853-0.165545i -1.34917-0.264449i] [-0.297581-0.00326746i 0.608098+0.173997i] [0.343503+0.561919i 0.255098-0.318909i]] Overdetermined system: Ax=b ============================ A=[[0.887644+0.582224i 0.0900309-0.997146i] [-0.0248339+0.78084i 0.977005+0.114152i] [0.15159-0.305971i -0.140535+0.87207i] [-0.415223+0.745347i 0.389236-0.558537i]] b=[0.276085+0.862114i -1.06655+0.16668i 0.259354-0.144917i 0.117112+0.628333i] x=[0.0665721+0.196317i -0.59465+0.275673i] Overdetermined system: AX=B ============================ A=[[-0.659098-1.48735i 0.58196+0.342779i] [0.0430125-0.665631i 0.461418+0.702588i] [-0.370575-0.431749i 0.110563+1.34271i] [-1.12362-1.24675i -0.00076101-0.48476i]] B=[[1.40989+0.195876i -0.737889-0.424932i 1.11931-0.181617i] [0.425358+0.748408i -0.269236+0.0084679i 1.26684+1.15784i] [0.410579-0.438732i -0.051776-0.741508i -0.0620548-0.988024i] [0.463633+0.247649i -0.261667+1.31094i 0.316112-0.582709i]] X=[[-0.438722+0.436199i -0.163013-0.328491i -0.0390137+0.650818i] [-0.0363226-0.179313i -0.684569-0.174871i 0.057899+0.0385157i]] Underdetermined system: Ax=b ============================ A=[[-0.0698983+0.088161i 0.778473+0.593819i -0.8982-0.0189115i -1.17379+0.928384i] [-0.195936+0.710242i -0.139549+1.08637i 0.499634+1.05246i -0.0335779+0.71951i]] b=[0.176255+1.29583i -1.17782-0.117682i] x=[0.0430714+0.304995i 0.300008+0.787028i -0.457362+0.0316862i 0.209836-0.296065i] Underdetermined system: AX=B ============================ A=[[-0.733434+0.604719i -0.384603-1.29524i -0.899498-0.59834i -0.271117-0.21665i] [0.890914+0.570106i -0.583197-0.457921i 0.563629+0.130534i 0.238394+0.0181737i]] B=[[1.17187-0.961501i -0.0316097+0.348813i 0.294257-0.531736i] [0.746982+1.05226i -0.0338086-0.340333i 0.714624+0.369524i]] X=[[0.3885+0.326178i -0.0743608-0.164814i 0.326415+0.038784i] [-0.451728+0.726351i 0.0349013-0.0602447i -0.125941+0.433723i] [0.209724+1.11027i -0.0723079-0.245307i 0.355353+0.450711i] [0.105905+0.42722i -0.0273786-0.0925306i 0.149089+0.172091i]] itpp-4.3.1/tests/lu_test.cpp000066400000000000000000000037461216575753400160510ustar00rootroot00000000000000/*! * \file * \brief LU factorization routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main(void) { cout << "=================================" << endl; cout << "Test of LU factorization routines" << endl; cout << "=================================" << endl; { cout << "Real matrix" << endl; mat X = randn(5, 5); mat L, U; ivec p; lu(X, L, U, p); mat P = to_mat(permutation_matrix(p)); cout << "X = " << round_to_zero(X) << endl; cout << "norm(X - P^T*L*U) = " << round_to_zero(norm(X - transpose(P) * L * U)) << endl; } { cout << "Complex matrix" << endl; cmat X = randn_c(5, 5); cmat L, U; ivec p; lu(X, L, U, p); mat P = to_mat(permutation_matrix(p)); cout << "X = " << round_to_zero(X) << endl; cout << "norm(X - P^H*L*U = " << round_to_zero(norm(X - hermitian_transpose(P) * L * U)) << endl; } return 0; } itpp-4.3.1/tests/lu_test.ref000066400000000000000000000016231216575753400160330ustar00rootroot00000000000000================================= Test of LU factorization routines ================================= Real matrix X = [[-0.283885 0.56497 -1.0746 -0.732016 -0.869443] [1.36446 -0.596145 2.36476 -2.10553 -0.0504762] [0.906001 -1.19732 2.36508 -0.923457 0.799682] [1.24942 -1.26756 1.22804 -1.89227 1.02849] [1.55783 -0.300385 0.234136 -0.664315 -0.900489]] norm(X - P^T*L*U) = 0 Complex matrix X = [[-0.160972-1.29916i 0.794379+1.03288i -0.127081+0.388325i 1.13396-0.225782i 0.562993-0.0690923i] [0.0361926+1.01917i -0.190616-0.710921i -0.572027-1.62447i 1.07734-0.884797i -0.822132+0.953281i] [-1.04693+0.760191i 1.32367+0.349763i -0.320883+0.1836i 0.465648-0.60769i -0.128067+0.278311i] [-0.280465+0.361084i 0.510483+0.174148i -1.02371+0.214321i 0.0533137-0.121635i 0.598587-0.190616i] [0.780099+0.643584i 0.475202-0.708159i -0.98353+0.261137i -0.848777-1.28903i -0.13041+0.0775548i]] norm(X - P^H*L*U = 0 itpp-4.3.1/tests/mat_test.cpp000066400000000000000000000207121216575753400162020ustar00rootroot00000000000000/*! * \file * \brief Matrix class test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; template void common_operators(const Mat &A, const Mat &B, const Mat &C, const Vec &u, const Vec &v, T c) { cout.setf(ios::fixed); cout.precision(4); cout << "A =\n" << A << endl; cout << "B =\n" << B << endl; cout << "C =\n" << C << endl; cout << "v = " << v << endl; cout << "u = " << u << endl; cout << "c = " << c << endl << endl; // indexing cout << "A(1,2) = " << A(1, 2) << endl; cout << "A(2,3) = " << A(2, 3) << endl; cout << "A(6) = " << A(6) << endl; cout << "A(0,2,1,3) =\n" << A(0, 2, 1, 3) << endl; cout << "A.get_row(1) = " << A.get_row(1) << endl; cout << "A.get_rows(1,2) =\n" << A.get_rows(1, 2) << endl; cout << "A.get_col(2) = " << A.get_col(2) << endl; cout << "A.get_cols(2,3) =\n" << A.get_cols(2, 3) << endl << endl; // setting, copying, swapping Mat Mv(v); cout << "Mv(A) =\n" << Mv << endl; Mat D(A); cout << "D(A) =\n" << D << endl; D.set_size(6, 5, true); cout << "D.set_size(6,5, true); D =\n" << D << endl; D.set_size(3, 2, true); cout << "D.set_size(3,2, true); D =\n" << D << endl; D.zeros(); cout << "D.zeros(); D =\n" << D << endl; D.ones(); cout << "D.ones(); D =\n" << D << endl; D = A; cout << "D = A; D =\n" << D << endl; D(2, 2) = c; cout << "D(2,2) = c; D =\n" << D << endl; D(9) = c; cout << "D(7) = c; D =\n" << D << endl; D.set(0, 1, c); cout << "D.set(0,1, c); D =\n" << D << endl; D.set_row(1, v); cout << "D.set_row(1, v); D =\n" << D << endl; D.set_col(2, u); cout << "D.set_col(2, u): D =\n" << D << endl; D.set_rows(0, B.get_rows(1, 2)); cout << "D.set_rows(0, B.get_rows(1,2)); D =\n" << D << endl; D.set_cols(2, B.get_cols(0, 1)); cout << "D.set_cols(2, B.get_cols(0,1)); D =\n" << D << endl; D.copy_row(1, 2); cout << "D.copy_row(1, 2); D =\n" << D << endl; D.copy_col(2, 3); cout << "D.copy_col(2, 3); D =\n" << D << endl; D.swap_rows(0, 2); cout << "D.swap_rows(0, 2); D =\n" << D << endl; D.swap_cols(0, 3); cout << "D.swap_cols(0, 3); D =\n" << D << endl; D.set_submatrix(1, 2, A(0, 1, 0, 1)); cout << "D.set_submatrix(1,2, A(0,1,0,1); D =\n" << D << endl; D.set_submatrix(0, 0, A(0, 1, 0, 1)); cout << "D.set_submatrix(0,0, A(0,1,0,1); D =\n" << D << endl; D.set_submatrix(1, 2, 2, 3, c); cout << "D.set_submatrix(1,2,2,3, c); D =\n" << D << endl << endl; // transposition cout << "A.T() =\n" << A.T() << endl; cout << "A.T().T() =\n" << A.T().T() << endl; cout << "A.H() =\n" << A.H() << endl << endl; // concatenation D = concat_horizontal(A, B); cout << "D = concat_horizontal(A,B); D =\n" << D << endl; D = concat_vertical(A, B); cout << "D = concat_vertical(A,B); D =\n" << D << endl << endl; // deleting rows, cols D.del_row(2); cout << "D.del_row(2); D =\n" << D << endl; D.del_rows(0, 2); cout << "D.del_rows(0,2); D =\n" << D << endl; D.del_col(3); cout << "D.del_col(3); D =\n" << D << endl; D.del_cols(0, 1); cout << "D.del_cols(0,1); D =\n" << D << endl << endl; // inserting, appending rows cols Mat A2 = A; A2.ins_row(1, v); cout << "A.ins_row(1, v); A =\n" << A2 << endl; A2.ins_col(0, v); cout << "A.ins_col(0, v); A =\n" << A2 << endl; A2.append_col(A2.get_col(3)); cout << "A.append_col(A2.get_col(3)); A =\n" << A2 << endl; A2.append_row(A2.get_row(0)); cout << "A.append_row(A2.get_row(0)); A =\n" << A2 << endl << endl; // addition cout << "A+B =\n" << A + B << endl; cout << "A+c =\n" << A + c << endl; cout << "c+A =\n" << c + A << endl; A2 = A; A2 += B; cout << "A+=B; A =\n" << A2 << endl; A2 = A; A2 += c; cout << "A+=c; A =\n" << A2 << endl << endl; // subtraction cout << "A-B =\n" << A - B << endl; cout << "A-c =\n" << A - c << endl; cout << "c-A =\n" << c - A << endl; A2 = A; A2 -= B; cout << "A-=B; A =\n" << A2 << endl; A2 = A; A2 -= c; cout << "A-=c; A =\n" << A2 << endl; cout << "-A =\n" << -A << endl << endl; // multiplication cout << "A*C =\n" << A*C << endl; A2 = A; A2 *= C; cout << "A*=C; A =\n" << A2 << endl; cout << "A*c =\n" << A*c << endl; cout << "c*A =\n" << c*A << endl; A2 = A; A2 *= c; cout << "A*=c; A =\n" << A2 << endl; cout << "A*v = " << A*v << endl; cout << "elem_mult(A,B) =\n" << elem_mult(A, B) << endl; elem_mult_out(A, B, A2); cout << "elem_mult_out(A,B,out); out =\n" << A2 << endl; Mat B2 = B; elem_mult_inplace(A, B2); cout << "elem_mult_inplace(A,B); B =\n" << B2 << endl; cout << "elem_mult_sum(A,B) = " << elem_mult_sum(A, B) << endl << endl; // division cout << "A/c =\n" << A / c << endl; A2 = A; A2 /= c; cout << "A/=c; A =\n" << A2 << endl; A2 = A; A2 /= B; cout << "A/=B; A =\n" << A2 << endl; cout << "elem_div(A,B) =\n" << elem_div(A, B) << endl; elem_div_out(A, B, A2); cout << "elem_div_out(A,B,out); out =\n" << A2 << endl; cout << "elem_div_sum(A,B) = " << elem_div_sum(A, B) << endl << endl; } int main() { cout << "=============================" << endl << " Testing Mat (bmat)" << endl << "=============================" << endl; bmat bM1 = randb(3, 4); bmat bM2 = randb(3, 4); bmat bM3 = randb(4, 3); bvec bv1 = randb(3); bvec bv2 = randb(4); bin bx = randb(); common_operators(bM1, bM2, bM3, bv1, bv2, bx); cout << "=============================" << endl << " Testing Mat (imat)" << endl << "=============================" << endl; imat iM1 = randi(3, 4, 1, 9); imat iM2 = randi(3, 4, 1, 9); imat iM3 = randi(4, 3, 1, 9); ivec iv1 = randi(3, 1, 9); ivec iv2 = randi(4, 1, 9); int ix = randi(1, 9); common_operators(iM1, iM2, iM3, iv1, iv2, ix); cout << "===============================" << endl << " Testing Mat (mat)" << endl << "===============================" << endl; mat dM1 = randn(3, 4); mat dM2 = randn(3, 4); mat dM3 = randn(4, 3); vec dv1 = randn(3); vec dv2 = randn(4); double dx = randn(); common_operators(dM1, dM2, dM3, dv1, dv2, dx); cout << "==========================================" << endl << " Testing Mat > (cmat)" << endl << "==========================================" << endl; cmat cM1 = randn_c(3, 4); cmat cM2 = randn_c(3, 4); cmat cM3 = randn_c(4, 3); cvec cv1 = randn_c(3); cvec cv2 = randn_c(4); complex cx = randn_c(); common_operators(cM1, cM2, cM3, cv1, cv2, cx); cout << "========================================" << endl; cout << " Testing initialisation with string" << endl; cout << "========================================" << endl; cout << "bmat M = \" 1 1 0; 0 1; 1 1 ,1, 1; ; 0 1\"" << endl; bmat bM = " 1 1 0; 0 1; 1 1 ,1, 1; ; 0 1"; cout << "M =\n" << bM << endl; cout << "smat M = \"0xFF, -021 , 100; 0,-0x01; 0xA, 10 012; \"" << endl; smat sM = "0xFF, -021 , 100; 0,-0x01; 0xA, 10 012; "; cout << "M =\n" << sM << endl; cout << "imat M = \"0xFAC0, -021, 100000; 0,-0x01; 0xA, 10 012; \"" << endl; imat iM = "0xFAC0, -021, 100000; 0,-0x01; 0xA, 10 012; "; cout << "M =\n" << iM << endl; cout << "mat M = \".77 1e9 35; 0x7 3.5 -1000 \""; mat M = ".77 1.89e5 35; 7 3.5 -1000 "; cout << "M =\n" << M << endl; cout << "cmat M = \" 1.5+3i, (.33,1) ; (333,-1) 2-0.2E-3i\"" << endl; cmat cM = " 1.5+3i, (.33,1) ; (333,-1) 2-0.2E-3i"; cout << "M =\n" << cM << endl << endl; return 0; } itpp-4.3.1/tests/mat_test.ref000066400000000000000000000736001216575753400162000ustar00rootroot00000000000000============================= Testing Mat (bmat) ============================= A = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] B = [[0 1 0 1] [0 0 0 0] [1 0 0 1]] C = [[0 1 0] [0 0 1] [0 1 1] [0 1 1]] v = [1 1 0 1] u = [1 0 1] c = 1 A(1,2) = 1 A(2,3) = 1 A(6) = 0 A(0,2,1,3) = [[1 0 0] [0 1 1] [1 0 1]] A.get_row(1) = [0 0 1 1] A.get_rows(1,2) = [[0 0 1 1] [1 1 0 1]] A.get_col(2) = [0 1 0] A.get_cols(2,3) = [[0 0] [1 1] [0 1]] Mv(A) = [[1] [1] [0] [1]] D(A) = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] D.set_size(6,5, true); D = [[0 1 0 0 0] [0 0 1 1 0] [1 1 0 1 0] [0 0 0 0 0] [0 0 0 0 0] [0 0 0 0 0]] D.set_size(3,2, true); D = [[0 1] [0 0] [1 1]] D.zeros(); D = [[0 0] [0 0] [0 0]] D.ones(); D = [[1 1] [1 1] [1 1]] D = A; D = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] D(2,2) = c; D = [[0 1 0 0] [0 0 1 1] [1 1 1 1]] D(7) = c; D = [[0 1 0 1] [0 0 1 1] [1 1 1 1]] D.set(0,1, c); D = [[0 1 0 1] [0 0 1 1] [1 1 1 1]] D.set_row(1, v); D = [[0 1 0 1] [1 1 0 1] [1 1 1 1]] D.set_col(2, u): D = [[0 1 1 1] [1 1 0 1] [1 1 1 1]] D.set_rows(0, B.get_rows(1,2)); D = [[0 0 0 0] [1 0 0 1] [1 1 1 1]] D.set_cols(2, B.get_cols(0,1)); D = [[0 0 0 1] [1 0 0 0] [1 1 1 0]] D.copy_row(1, 2); D = [[0 0 0 1] [1 1 1 0] [1 1 1 0]] D.copy_col(2, 3); D = [[0 0 1 1] [1 1 0 0] [1 1 0 0]] D.swap_rows(0, 2); D = [[1 1 0 0] [1 1 0 0] [0 0 1 1]] D.swap_cols(0, 3); D = [[0 1 0 1] [0 1 0 1] [1 0 1 0]] D.set_submatrix(1,2, A(0,1,0,1); D = [[0 1 0 1] [0 1 0 1] [1 0 0 0]] D.set_submatrix(0,0, A(0,1,0,1); D = [[0 1 0 1] [0 0 0 1] [1 0 0 0]] D.set_submatrix(1,2,2,3, c); D = [[0 1 0 1] [0 0 1 1] [1 0 1 1]] A.T() = [[0 0 1] [1 0 1] [0 1 0] [0 1 1]] A.T().T() = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] A.H() = [[0 0 1] [1 0 1] [0 1 0] [0 1 1]] D = concat_horizontal(A,B); D = [[0 1 0 0 0 1 0 1] [0 0 1 1 0 0 0 0] [1 1 0 1 1 0 0 1]] D = concat_vertical(A,B); D = [[0 1 0 0] [0 0 1 1] [1 1 0 1] [0 1 0 1] [0 0 0 0] [1 0 0 1]] D.del_row(2); D = [[0 1 0 0] [0 0 1 1] [0 1 0 1] [0 0 0 0] [1 0 0 1]] D.del_rows(0,2); D = [[0 0 0 0] [1 0 0 1]] D.del_col(3); D = [[0 0 0] [1 0 0]] D.del_cols(0,1); D = [[0] [0]] A.ins_row(1, v); A = [[0 1 0 0] [1 1 0 1] [0 0 1 1] [1 1 0 1]] A.ins_col(0, v); A = [[1 0 1 0 0] [1 1 1 0 1] [0 0 0 1 1] [1 1 1 0 1]] A.append_col(A2.get_col(3)); A = [[1 0 1 0 0 0] [1 1 1 0 1 0] [0 0 0 1 1 1] [1 1 1 0 1 0]] A.append_row(A2.get_row(0)); A = [[1 0 1 0 0 0] [1 1 1 0 1 0] [0 0 0 1 1 1] [1 1 1 0 1 0] [1 0 1 0 0 0]] A+B = [[0 0 0 1] [0 0 1 1] [0 1 0 0]] A+c = [[1 0 1 1] [1 1 0 0] [0 0 1 0]] c+A = [[1 0 1 1] [1 1 0 0] [0 0 1 0]] A+=B; A = [[0 0 0 1] [0 0 1 1] [0 1 0 0]] A+=c; A = [[1 0 1 1] [1 1 0 0] [0 0 1 0]] A-B = [[0 0 0 1] [0 0 1 1] [0 1 0 0]] A-c = [[1 0 1 1] [1 1 0 0] [0 0 1 0]] c-A = [[1 0 1 1] [1 1 0 0] [0 0 1 0]] A-=B; A = [[0 0 0 1] [0 0 1 1] [0 1 0 0]] A-=c; A = [[1 0 1 1] [1 1 0 0] [0 0 1 0]] -A = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] A*C = [[0 0 1] [0 0 0] [0 0 0]] A*=C; A = [[0 0 1] [0 0 0] [0 0 0]] A*c = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] c*A = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] A*=c; A = [[0 1 0 0] [0 0 1 1] [1 1 0 1]] A*v = [1 1 1] elem_mult(A,B) = [[0 1 0 0] [0 0 0 0] [1 0 0 1]] elem_mult_out(A,B,out); out = [[0 1 0 0] [0 0 0 0] [1 0 0 1]] elem_mult_inplace(A,B); B = [[0 1 0 0] [0 0 0 0] [1 0 0 1]] elem_mult_sum(A,B) = 1 A/c = [[1 1 1 1] [1 1 1 1] [1 1 1 1]] A/=c; A = [[1 1 1 1] [1 1 1 1] [1 1 1 1]] A/=B; A = [[0 1 0 1] [0 0 1 1] [1 1 0 1]] elem_div(A,B) = [[0 1 0 1] [0 0 1 1] [1 1 0 1]] elem_div_out(A,B,out); out = [[0 1 0 1] [0 0 1 1] [1 1 0 1]] elem_div_sum(A,B) = 1 ============================= Testing Mat (imat) ============================= A = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] B = [[2 7 7 2] [4 2 9 1] [7 8 9 8]] C = [[2 4 7] [5 1 4] [5 9 8] [6 2 2]] v = [2 4 4 8] u = [1 3 7] c = 1 A(1,2) = 1 A(2,3) = 1 A(6) = 4 A(0,2,1,3) = [[7 4 2] [9 1 5] [9 4 1]] A.get_row(1) = [7 9 1 5] A.get_rows(1,2) = [[7 9 1 5] [7 9 4 1]] A.get_col(2) = [4 1 4] A.get_cols(2,3) = [[4 2] [1 5] [4 1]] Mv(A) = [[2] [4] [4] [8]] D(A) = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] D.set_size(6,5, true); D = [[6 7 4 2 0] [7 9 1 5 0] [7 9 4 1 0] [0 0 0 0 0] [0 0 0 0 0] [0 0 0 0 0]] D.set_size(3,2, true); D = [[6 7] [7 9] [7 9]] D.zeros(); D = [[0 0] [0 0] [0 0]] D.ones(); D = [[1 1] [1 1] [1 1]] D = A; D = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] D(2,2) = c; D = [[6 7 4 2] [7 9 1 5] [7 9 1 1]] D(7) = c; D = [[6 7 4 1] [7 9 1 5] [7 9 1 1]] D.set(0,1, c); D = [[6 1 4 1] [7 9 1 5] [7 9 1 1]] D.set_row(1, v); D = [[6 1 4 1] [2 4 4 8] [7 9 1 1]] D.set_col(2, u): D = [[6 1 1 1] [2 4 3 8] [7 9 7 1]] D.set_rows(0, B.get_rows(1,2)); D = [[4 2 9 1] [7 8 9 8] [7 9 7 1]] D.set_cols(2, B.get_cols(0,1)); D = [[4 2 2 7] [7 8 4 2] [7 9 7 8]] D.copy_row(1, 2); D = [[4 2 2 7] [7 9 7 8] [7 9 7 8]] D.copy_col(2, 3); D = [[4 2 7 7] [7 9 8 8] [7 9 8 8]] D.swap_rows(0, 2); D = [[7 9 8 8] [7 9 8 8] [4 2 7 7]] D.swap_cols(0, 3); D = [[8 9 8 7] [8 9 8 7] [7 2 7 4]] D.set_submatrix(1,2, A(0,1,0,1); D = [[8 9 8 7] [8 9 6 7] [7 2 7 9]] D.set_submatrix(0,0, A(0,1,0,1); D = [[6 7 8 7] [7 9 6 7] [7 2 7 9]] D.set_submatrix(1,2,2,3, c); D = [[6 7 8 7] [7 9 1 1] [7 2 1 1]] A.T() = [[6 7 7] [7 9 9] [4 1 4] [2 5 1]] A.T().T() = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] A.H() = [[6 7 7] [7 9 9] [4 1 4] [2 5 1]] D = concat_horizontal(A,B); D = [[6 7 4 2 2 7 7 2] [7 9 1 5 4 2 9 1] [7 9 4 1 7 8 9 8]] D = concat_vertical(A,B); D = [[6 7 4 2] [7 9 1 5] [7 9 4 1] [2 7 7 2] [4 2 9 1] [7 8 9 8]] D.del_row(2); D = [[6 7 4 2] [7 9 1 5] [2 7 7 2] [4 2 9 1] [7 8 9 8]] D.del_rows(0,2); D = [[4 2 9 1] [7 8 9 8]] D.del_col(3); D = [[4 2 9] [7 8 9]] D.del_cols(0,1); D = [[9] [9]] A.ins_row(1, v); A = [[6 7 4 2] [2 4 4 8] [7 9 1 5] [7 9 4 1]] A.ins_col(0, v); A = [[2 6 7 4 2] [4 2 4 4 8] [4 7 9 1 5] [8 7 9 4 1]] A.append_col(A2.get_col(3)); A = [[2 6 7 4 2 4] [4 2 4 4 8 4] [4 7 9 1 5 1] [8 7 9 4 1 4]] A.append_row(A2.get_row(0)); A = [[2 6 7 4 2 4] [4 2 4 4 8 4] [4 7 9 1 5 1] [8 7 9 4 1 4] [2 6 7 4 2 4]] A+B = [[8 14 11 4] [11 11 10 6] [14 17 13 9]] A+c = [[7 8 5 3] [8 10 2 6] [8 10 5 2]] c+A = [[7 8 5 3] [8 10 2 6] [8 10 5 2]] A+=B; A = [[8 14 11 4] [11 11 10 6] [14 17 13 9]] A+=c; A = [[7 8 5 3] [8 10 2 6] [8 10 5 2]] A-B = [[4 0 -3 0] [3 7 -8 4] [0 1 -5 -7]] A-c = [[5 6 3 1] [6 8 0 4] [6 8 3 0]] c-A = [[-5 -6 -3 -1] [-6 -8 0 -4] [-6 -8 -3 0]] A-=B; A = [[4 0 -3 0] [3 7 -8 4] [0 1 -5 -7]] A-=c; A = [[5 6 3 1] [6 8 0 4] [6 8 3 0]] -A = [[-6 -7 -4 -2] [-7 -9 -1 -5] [-7 -9 -4 -1]] A*C = [[79 71 106] [94 56 103] [85 75 119]] A*=C; A = [[79 71 106] [94 56 103] [85 75 119]] A*c = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] c*A = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] A*=c; A = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] A*v = [72 94 74] elem_mult(A,B) = [[12 49 28 4] [28 18 9 5] [49 72 36 8]] elem_mult_out(A,B,out); out = [[12 49 28 4] [28 18 9 5] [49 72 36 8]] elem_mult_inplace(A,B); B = [[12 49 28 4] [28 18 9 5] [49 72 36 8]] elem_mult_sum(A,B) = 318 A/c = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] A/=c; A = [[6 7 4 2] [7 9 1 5] [7 9 4 1]] A/=B; A = [[3 1 0 1] [1 4 0 5] [1 1 0 0]] elem_div(A,B) = [[3 1 0 1] [1 4 0 5] [1 1 0 0]] elem_div_out(A,B,out); out = [[3 1 0 1] [1 4 0 5] [1 1 0 0]] elem_div_sum(A,B) = 17 =============================== Testing Mat (mat) =============================== A = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332]] B = [[-0.2567 -0.5088 -0.4178 0.1706] [-1.2206 0.8674 0.9549 -1.2123] [0.8783 0.7170 -0.6730 -0.0915]] C = [[0.7976 0.7505 1.3572] [0.9149 -0.3301 0.3954] [0.4963 -0.5321 -0.2344] [-1.1868 1.3540 -2.9390]] v = [-0.2557 0.1911 0.6102 1.0398] u = [-0.6095 -0.2460 -0.9425] c = 0.5281 A(1,2) = -0.6750 A(2,3) = 0.0332 A(6) = 1.1834 A(0,2,1,3) = [[1.2743 1.1834 -1.7663] [-0.3288 -0.6750 0.4802] [1.3636 -0.9017 0.0332]] A.get_row(1) = [-0.4214 -0.3288 -0.6750 0.4802] A.get_rows(1,2) = [[-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332]] A.get_col(2) = [1.1834 -0.6750 -0.9017] A.get_cols(2,3) = [[1.1834 -1.7663] [-0.6750 0.4802] [-0.9017 0.0332]] Mv(A) = [[-0.2557] [0.1911] [0.6102] [1.0398]] D(A) = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332]] D.set_size(6,5, true); D = [[0.1234 1.2743 1.1834 -1.7663 0.0000] [-0.4214 -0.3288 -0.6750 0.4802 0.0000] [0.4191 1.3636 -0.9017 0.0332 0.0000] [0.0000 0.0000 0.0000 0.0000 0.0000] [0.0000 0.0000 0.0000 0.0000 0.0000] [0.0000 0.0000 0.0000 0.0000 0.0000]] D.set_size(3,2, true); D = [[0.1234 1.2743] [-0.4214 -0.3288] [0.4191 1.3636]] D.zeros(); D = [[0.0000 0.0000] [0.0000 0.0000] [0.0000 0.0000]] D.ones(); D = [[1.0000 1.0000] [1.0000 1.0000] [1.0000 1.0000]] D = A; D = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332]] D(2,2) = c; D = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 0.5281 0.0332]] D(7) = c; D = [[0.1234 1.2743 1.1834 0.5281] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 0.5281 0.0332]] D.set(0,1, c); D = [[0.1234 0.5281 1.1834 0.5281] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 0.5281 0.0332]] D.set_row(1, v); D = [[0.1234 0.5281 1.1834 0.5281] [-0.2557 0.1911 0.6102 1.0398] [0.4191 1.3636 0.5281 0.0332]] D.set_col(2, u): D = [[0.1234 0.5281 -0.6095 0.5281] [-0.2557 0.1911 -0.2460 1.0398] [0.4191 1.3636 -0.9425 0.0332]] D.set_rows(0, B.get_rows(1,2)); D = [[-1.2206 0.8674 0.9549 -1.2123] [0.8783 0.7170 -0.6730 -0.0915] [0.4191 1.3636 -0.9425 0.0332]] D.set_cols(2, B.get_cols(0,1)); D = [[-1.2206 0.8674 -0.2567 -0.5088] [0.8783 0.7170 -1.2206 0.8674] [0.4191 1.3636 0.8783 0.7170]] D.copy_row(1, 2); D = [[-1.2206 0.8674 -0.2567 -0.5088] [0.4191 1.3636 0.8783 0.7170] [0.4191 1.3636 0.8783 0.7170]] D.copy_col(2, 3); D = [[-1.2206 0.8674 -0.5088 -0.5088] [0.4191 1.3636 0.7170 0.7170] [0.4191 1.3636 0.7170 0.7170]] D.swap_rows(0, 2); D = [[0.4191 1.3636 0.7170 0.7170] [0.4191 1.3636 0.7170 0.7170] [-1.2206 0.8674 -0.5088 -0.5088]] D.swap_cols(0, 3); D = [[0.7170 1.3636 0.7170 0.4191] [0.7170 1.3636 0.7170 0.4191] [-0.5088 0.8674 -0.5088 -1.2206]] D.set_submatrix(1,2, A(0,1,0,1); D = [[0.7170 1.3636 0.7170 0.4191] [0.7170 1.3636 0.1234 1.2743] [-0.5088 0.8674 -0.4214 -0.3288]] D.set_submatrix(0,0, A(0,1,0,1); D = [[0.1234 1.2743 0.7170 0.4191] [-0.4214 -0.3288 0.1234 1.2743] [-0.5088 0.8674 -0.4214 -0.3288]] D.set_submatrix(1,2,2,3, c); D = [[0.1234 1.2743 0.7170 0.4191] [-0.4214 -0.3288 0.5281 0.5281] [-0.5088 0.8674 0.5281 0.5281]] A.T() = [[0.1234 -0.4214 0.4191] [1.2743 -0.3288 1.3636] [1.1834 -0.6750 -0.9017] [-1.7663 0.4802 0.0332]] A.T().T() = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332]] A.H() = [[0.1234 -0.4214 0.4191] [1.2743 -0.3288 1.3636] [1.1834 -0.6750 -0.9017] [-1.7663 0.4802 0.0332]] D = concat_horizontal(A,B); D = [[0.1234 1.2743 1.1834 -1.7663 -0.2567 -0.5088 -0.4178 0.1706] [-0.4214 -0.3288 -0.6750 0.4802 -1.2206 0.8674 0.9549 -1.2123] [0.4191 1.3636 -0.9017 0.0332 0.8783 0.7170 -0.6730 -0.0915]] D = concat_vertical(A,B); D = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332] [-0.2567 -0.5088 -0.4178 0.1706] [-1.2206 0.8674 0.9549 -1.2123] [0.8783 0.7170 -0.6730 -0.0915]] D.del_row(2); D = [[0.1234 1.2743 1.1834 -1.7663] [-0.4214 -0.3288 -0.6750 0.4802] [-0.2567 -0.5088 -0.4178 0.1706] [-1.2206 0.8674 0.9549 -1.2123] [0.8783 0.7170 -0.6730 -0.0915]] D.del_rows(0,2); D = [[-1.2206 0.8674 0.9549 -1.2123] [0.8783 0.7170 -0.6730 -0.0915]] D.del_col(3); D = [[-1.2206 0.8674 0.9549] [0.8783 0.7170 -0.6730]] D.del_cols(0,1); D = [[0.9549] [-0.6730]] A.ins_row(1, v); A = [[0.1234 1.2743 1.1834 -1.7663] [-0.2557 0.1911 0.6102 1.0398] [-0.4214 -0.3288 -0.6750 0.4802] [0.4191 1.3636 -0.9017 0.0332]] A.ins_col(0, v); A = [[-0.2557 0.1234 1.2743 1.1834 -1.7663] [0.1911 -0.2557 0.1911 0.6102 1.0398] [0.6102 -0.4214 -0.3288 -0.6750 0.4802] [1.0398 0.4191 1.3636 -0.9017 0.0332]] A.append_col(A2.get_col(3)); A = [[-0.2557 0.1234 1.2743 1.1834 -1.7663 1.1834] [0.1911 -0.2557 0.1911 0.6102 1.0398 0.6102] [0.6102 -0.4214 -0.3288 -0.6750 0.4802 -0.6750] [1.0398 0.4191 1.3636 -0.9017 0.0332 -0.9017]] A.append_row(A2.get_row(0)); A = [[-0.2557 0.1234 1.2743 1.1834 -1.7663 1.1834] [0.1911 -0.2557 0.1911 0.6102 1.0398 0.6102] [0.6102 -0.4214 -0.3288 -0.6750 0.4802 -0.6750] [1.0398 0.4191 1.3636 -0.9017 0.0332 -0.9017] [-0.2557 0.1234 1.2743 1.1834 -1.7663 1.1834]] A+B = [[-0.1333 0.7655 0.7657 -1.5957] [-1.6419 0.5386 0.2798 -0.7321] [1.2974 2.0805 -1.5747 -0.0583]] A+c = [[0.6515 1.8024 1.7116 -1.2382] [0.1067 0.1993 -0.1469 1.0083] [0.9472 1.8917 -0.3736 0.5613]] c+A = [[0.6515 1.8024 1.7116 -1.2382] [0.1067 0.1993 -0.1469 1.0083] [0.9472 1.8917 -0.3736 0.5613]] A+=B; A = [[-0.1333 0.7655 0.7657 -1.5957] [-1.6419 0.5386 0.2798 -0.7321] [1.2974 2.0805 -1.5747 -0.0583]] A+=c; A = [[0.6515 1.8024 1.7116 -1.2382] [0.1067 0.1993 -0.1469 1.0083] [0.9472 1.8917 -0.3736 0.5613]] A-B = [[0.3801 1.7831 1.6012 -1.9369] [0.7992 -1.1962 -1.6299 1.6925] [-0.4592 0.6466 -0.2286 0.1247]] A-c = [[-0.4047 0.7462 0.6553 -2.2944] [-0.9495 -0.8569 -1.2031 -0.0479] [-0.1090 0.8354 -1.4298 -0.4949]] c-A = [[0.4047 -0.7462 -0.6553 2.2944] [0.9495 0.8569 1.2031 0.0479] [0.1090 -0.8354 1.4298 0.4949]] A-=B; A = [[0.3801 1.7831 1.6012 -1.9369] [0.7992 -1.1962 -1.6299 1.6925] [-0.4592 0.6466 -0.2286 0.1247]] A-=c; A = [[-0.4047 0.7462 0.6553 -2.2944] [-0.9495 -0.8569 -1.2031 -0.0479] [-0.1090 0.8354 -1.4298 -0.4949]] -A = [[-0.1234 -1.2743 -1.1834 1.7663] [0.4214 0.3288 0.6750 -0.4802] [-0.4191 -1.3636 0.9017 -0.0332]] A*C = [[3.9478 -3.3493 5.5850] [-1.5418 0.8017 -1.9550] [1.0949 0.3891 1.2216]] A*=C; A = [[3.9478 -3.3493 5.5850] [-1.5418 0.8017 -1.9550] [1.0949 0.3891 1.2216]] A*c = [[0.0652 0.6730 0.6250 -0.9328] [-0.2225 -0.1737 -0.3565 0.2536] [0.2213 0.7201 -0.4762 0.0175]] c*A = [[0.0652 0.6730 0.6250 -0.9328] [-0.2225 -0.1737 -0.3565 0.2536] [0.2213 0.7201 -0.4762 0.0175]] A*=c; A = [[0.0652 0.6730 0.6250 -0.9328] [-0.2225 -0.1737 -0.3565 0.2536] [0.2213 0.7201 -0.4762 0.0175]] A*v = [-0.9025 0.1324 -0.3622] elem_mult(A,B) = [[-0.0317 -0.6484 -0.4944 -0.3013] [0.5143 -0.2852 -0.6445 -0.5822] [0.3681 0.9776 0.6068 -0.0030]] elem_mult_out(A,B,out); out = [[-0.0317 -0.6484 -0.4944 -0.3013] [0.5143 -0.2852 -0.6445 -0.5822] [0.3681 0.9776 0.6068 -0.0030]] elem_mult_inplace(A,B); B = [[-0.0317 -0.6484 -0.4944 -0.3013] [0.5143 -0.2852 -0.6445 -0.5822] [0.3681 0.9776 0.6068 -0.0030]] elem_mult_sum(A,B) = -0.5239 A/c = [[0.2337 2.4129 2.2409 -3.3445] [-0.7979 -0.6226 -1.2782 0.9093] [0.7936 2.5819 -1.7073 0.0629]] A/=c; A = [[0.2337 2.4129 2.2409 -3.3445] [-0.7979 -0.6226 -1.2782 0.9093] [0.7936 2.5819 -1.7073 0.0629]] A/=B; A = [[-0.4807 -2.5045 -2.8327 -10.3532] [0.3452 -0.3791 -0.7069 -0.3961] [0.4772 1.9018 1.3397 -0.3630]] elem_div(A,B) = [[-0.4807 -2.5045 -2.8327 -10.3532] [0.3452 -0.3791 -0.7069 -0.3961] [0.4772 1.9018 1.3397 -0.3630]] elem_div_out(A,B,out); out = [[-0.4807 -2.5045 -2.8327 -10.3532] [0.3452 -0.3791 -0.7069 -0.3961] [0.4772 1.9018 1.3397 -0.3630]] elem_div_sum(A,B) = -13.9522 ========================================== Testing Mat > (cmat) ========================================== A = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] B = [[0.5440-0.6395i 0.8781-0.4015i 0.0172-0.3043i -0.0309-0.1823i] [-0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i 0.5401-0.2073i] [0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i -0.6724-0.3295i]] C = [[2.2539-0.1707i 0.5599+0.0018i -0.2932+0.6636i] [-0.2552+1.6929i 0.2429+0.5431i 0.8948+0.3038i] [0.4983-0.5504i -0.6127+0.5881i -1.0207-0.9513i] [0.3383-0.3003i 1.6579-0.3930i -1.0423-0.3862i]] v = [0.3357+0.7476i 0.1581+0.5101i 1.0024-0.2294i 0.0881-0.5844i] u = [-0.3737+0.4055i 0.3010+0.5067i 0.9604+0.9759i] c = 0.1265-0.1893i A(1,2) = 0.8402+0.3585i A(2,3) = 0.2146-0.6056i A(6) = 0.2890+0.3665i A(0,2,1,3) = [[1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [-0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] A.get_row(1) = [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] A.get_rows(1,2) = [[0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] A.get_col(2) = [0.2890+0.3665i 0.8402+0.3585i -0.5533+0.0174i] A.get_cols(2,3) = [[0.2890+0.3665i 0.1669+0.1394i] [0.8402+0.3585i -0.3050+1.6777i] [-0.5533+0.0174i 0.2146-0.6056i]] Mv(A) = [[0.3357+0.7476i] [0.1581+0.5101i] [1.0024-0.2294i] [0.0881-0.5844i]] D(A) = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] D.set_size(6,5, true); D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i 0.0000+0.0000i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i 0.0000+0.0000i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i 0.0000+0.0000i] [0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i] [0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i] [0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i]] D.set_size(3,2, true); D = [[-0.4338-0.2881i 1.3078+0.6448i] [0.4343-0.3287i -0.6401-0.4675i] [-0.4972+0.3697i 0.2482-0.1109i]] D.zeros(); D = [[0.0000+0.0000i 0.0000+0.0000i] [0.0000+0.0000i 0.0000+0.0000i] [0.0000+0.0000i 0.0000+0.0000i]] D.ones(); D = [[1.0000+0.0000i 1.0000+0.0000i] [1.0000+0.0000i 1.0000+0.0000i] [1.0000+0.0000i 1.0000+0.0000i]] D = A; D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] D(2,2) = c; D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i 0.1265-0.1893i 0.2146-0.6056i]] D(7) = c; D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1265-0.1893i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i 0.1265-0.1893i 0.2146-0.6056i]] D.set(0,1, c); D = [[-0.4338-0.2881i 0.1265-0.1893i 0.2890+0.3665i 0.1265-0.1893i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i 0.1265-0.1893i 0.2146-0.6056i]] D.set_row(1, v); D = [[-0.4338-0.2881i 0.1265-0.1893i 0.2890+0.3665i 0.1265-0.1893i] [0.3357+0.7476i 0.1581+0.5101i 1.0024-0.2294i 0.0881-0.5844i] [-0.4972+0.3697i 0.2482-0.1109i 0.1265-0.1893i 0.2146-0.6056i]] D.set_col(2, u): D = [[-0.4338-0.2881i 0.1265-0.1893i -0.3737+0.4055i 0.1265-0.1893i] [0.3357+0.7476i 0.1581+0.5101i 0.3010+0.5067i 0.0881-0.5844i] [-0.4972+0.3697i 0.2482-0.1109i 0.9604+0.9759i 0.2146-0.6056i]] D.set_rows(0, B.get_rows(1,2)); D = [[-0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i 0.5401-0.2073i] [0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i -0.6724-0.3295i] [-0.4972+0.3697i 0.2482-0.1109i 0.9604+0.9759i 0.2146-0.6056i]] D.set_cols(2, B.get_cols(0,1)); D = [[-0.0358+0.7264i -0.3674+0.6897i 0.5440-0.6395i 0.8781-0.4015i] [0.0142-1.1533i 0.8268-0.5409i -0.0358+0.7264i -0.3674+0.6897i] [-0.4972+0.3697i 0.2482-0.1109i 0.0142-1.1533i 0.8268-0.5409i]] D.copy_row(1, 2); D = [[-0.0358+0.7264i -0.3674+0.6897i 0.5440-0.6395i 0.8781-0.4015i] [-0.4972+0.3697i 0.2482-0.1109i 0.0142-1.1533i 0.8268-0.5409i] [-0.4972+0.3697i 0.2482-0.1109i 0.0142-1.1533i 0.8268-0.5409i]] D.copy_col(2, 3); D = [[-0.0358+0.7264i -0.3674+0.6897i 0.8781-0.4015i 0.8781-0.4015i] [-0.4972+0.3697i 0.2482-0.1109i 0.8268-0.5409i 0.8268-0.5409i] [-0.4972+0.3697i 0.2482-0.1109i 0.8268-0.5409i 0.8268-0.5409i]] D.swap_rows(0, 2); D = [[-0.4972+0.3697i 0.2482-0.1109i 0.8268-0.5409i 0.8268-0.5409i] [-0.4972+0.3697i 0.2482-0.1109i 0.8268-0.5409i 0.8268-0.5409i] [-0.0358+0.7264i -0.3674+0.6897i 0.8781-0.4015i 0.8781-0.4015i]] D.swap_cols(0, 3); D = [[0.8268-0.5409i 0.2482-0.1109i 0.8268-0.5409i -0.4972+0.3697i] [0.8268-0.5409i 0.2482-0.1109i 0.8268-0.5409i -0.4972+0.3697i] [0.8781-0.4015i -0.3674+0.6897i 0.8781-0.4015i -0.0358+0.7264i]] D.set_submatrix(1,2, A(0,1,0,1); D = [[0.8268-0.5409i 0.2482-0.1109i 0.8268-0.5409i -0.4972+0.3697i] [0.8268-0.5409i 0.2482-0.1109i -0.4338-0.2881i 1.3078+0.6448i] [0.8781-0.4015i -0.3674+0.6897i 0.4343-0.3287i -0.6401-0.4675i]] D.set_submatrix(0,0, A(0,1,0,1); D = [[-0.4338-0.2881i 1.3078+0.6448i 0.8268-0.5409i -0.4972+0.3697i] [0.4343-0.3287i -0.6401-0.4675i -0.4338-0.2881i 1.3078+0.6448i] [0.8781-0.4015i -0.3674+0.6897i 0.4343-0.3287i -0.6401-0.4675i]] D.set_submatrix(1,2,2,3, c); D = [[-0.4338-0.2881i 1.3078+0.6448i 0.8268-0.5409i -0.4972+0.3697i] [0.4343-0.3287i -0.6401-0.4675i 0.1265-0.1893i 0.1265-0.1893i] [0.8781-0.4015i -0.3674+0.6897i 0.1265-0.1893i 0.1265-0.1893i]] A.T() = [[-0.4338-0.2881i 0.4343-0.3287i -0.4972+0.3697i] [1.3078+0.6448i -0.6401-0.4675i 0.2482-0.1109i] [0.2890+0.3665i 0.8402+0.3585i -0.5533+0.0174i] [0.1669+0.1394i -0.3050+1.6777i 0.2146-0.6056i]] A.T().T() = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] A.H() = [[-0.4338+0.2881i 0.4343+0.3287i -0.4972-0.3697i] [1.3078-0.6448i -0.6401+0.4675i 0.2482+0.1109i] [0.2890-0.3665i 0.8402-0.3585i -0.5533-0.0174i] [0.1669-0.1394i -0.3050-1.6777i 0.2146+0.6056i]] D = concat_horizontal(A,B); D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i 0.5440-0.6395i 0.8781-0.4015i 0.0172-0.3043i -0.0309-0.1823i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i -0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i 0.5401-0.2073i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i 0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i -0.6724-0.3295i]] D = concat_vertical(A,B); D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i] [0.5440-0.6395i 0.8781-0.4015i 0.0172-0.3043i -0.0309-0.1823i] [-0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i 0.5401-0.2073i] [0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i -0.6724-0.3295i]] D.del_row(2); D = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [0.5440-0.6395i 0.8781-0.4015i 0.0172-0.3043i -0.0309-0.1823i] [-0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i 0.5401-0.2073i] [0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i -0.6724-0.3295i]] D.del_rows(0,2); D = [[-0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i 0.5401-0.2073i] [0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i -0.6724-0.3295i]] D.del_col(3); D = [[-0.0358+0.7264i -0.3674+0.6897i 0.4752+0.1366i] [0.0142-1.1533i 0.8268-0.5409i -0.3031+0.8992i]] D.del_cols(0,1); D = [[0.4752+0.1366i] [-0.3031+0.8992i]] A.ins_row(1, v); A = [[-0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.3357+0.7476i 0.1581+0.5101i 1.0024-0.2294i 0.0881-0.5844i] [0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [-0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] A.ins_col(0, v); A = [[0.3357+0.7476i -0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i] [0.1581+0.5101i 0.3357+0.7476i 0.1581+0.5101i 1.0024-0.2294i 0.0881-0.5844i] [1.0024-0.2294i 0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i] [0.0881-0.5844i -0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i]] A.append_col(A2.get_col(3)); A = [[0.3357+0.7476i -0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i 0.2890+0.3665i] [0.1581+0.5101i 0.3357+0.7476i 0.1581+0.5101i 1.0024-0.2294i 0.0881-0.5844i 1.0024-0.2294i] [1.0024-0.2294i 0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i 0.8402+0.3585i] [0.0881-0.5844i -0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i -0.5533+0.0174i]] A.append_row(A2.get_row(0)); A = [[0.3357+0.7476i -0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i 0.2890+0.3665i] [0.1581+0.5101i 0.3357+0.7476i 0.1581+0.5101i 1.0024-0.2294i 0.0881-0.5844i 1.0024-0.2294i] [1.0024-0.2294i 0.4343-0.3287i -0.6401-0.4675i 0.8402+0.3585i -0.3050+1.6777i 0.8402+0.3585i] [0.0881-0.5844i -0.4972+0.3697i 0.2482-0.1109i -0.5533+0.0174i 0.2146-0.6056i -0.5533+0.0174i] [0.3357+0.7476i -0.4338-0.2881i 1.3078+0.6448i 0.2890+0.3665i 0.1669+0.1394i 0.2890+0.3665i]] A+B = [[0.1102-0.9276i 2.1860+0.2433i 0.3062+0.0622i 0.1360-0.0428i] [0.3985+0.3977i -1.0076+0.2222i 1.3154+0.4951i 0.2351+1.4704i] [-0.4831-0.7836i 1.0750-0.6518i -0.8564+0.9166i -0.4578-0.9351i]] A+c = [[-0.3074-0.4774i 1.4343+0.4555i 0.4155+0.1772i 0.2933-0.0499i] [0.5608-0.5180i -0.5137-0.6568i 0.9667+0.1691i -0.1785+1.4884i] [-0.3707+0.1804i 0.3747-0.3003i -0.4268-0.1719i 0.3410-0.7949i]] c+A = [[-0.3074-0.4774i 1.4343+0.4555i 0.4155+0.1772i 0.2933-0.0499i] [0.5608-0.5180i -0.5137-0.6568i 0.9667+0.1691i -0.1785+1.4884i] [-0.3707+0.1804i 0.3747-0.3003i -0.4268-0.1719i 0.3410-0.7949i]] A+=B; A = [[0.1102-0.9276i 2.1860+0.2433i 0.3062+0.0622i 0.1360-0.0428i] [0.3985+0.3977i -1.0076+0.2222i 1.3154+0.4951i 0.2351+1.4704i] [-0.4831-0.7836i 1.0750-0.6518i -0.8564+0.9166i -0.4578-0.9351i]] A+=c; A = [[-0.3074-0.4774i 1.4343+0.4555i 0.4155+0.1772i 0.2933-0.0499i] [0.5608-0.5180i -0.5137-0.6568i 0.9667+0.1691i -0.1785+1.4884i] [-0.3707+0.1804i 0.3747-0.3003i -0.4268-0.1719i 0.3410-0.7949i]] A-B = [[-0.9779+0.3514i 0.4297+1.0463i 0.2718+0.6708i 0.1978+0.3217i] [0.4701-1.0551i -0.2727-1.1572i 0.3650+0.2219i -0.8450+1.8850i] [-0.5114+1.5230i -0.5786+0.4300i -0.2502-0.8818i 0.8870-0.2761i]] A-c = [[-0.5603-0.0988i 1.1814+0.8342i 0.1625+0.5558i 0.0404+0.3288i] [0.3078-0.1394i -0.7666-0.2782i 0.7138+0.5478i -0.4314+1.8671i] [-0.6237+0.5590i 0.1217+0.0784i -0.6798+0.2067i 0.0881-0.4163i]] c-A = [[0.5603+0.0988i -1.1814-0.8342i -0.1625-0.5558i -0.0404-0.3288i] [-0.3078+0.1394i 0.7666+0.2782i -0.7138-0.5478i 0.4314-1.8671i] [0.6237-0.5590i -0.1217-0.0784i 0.6798-0.2067i -0.0881+0.4163i]] A-=B; A = [[-0.9779+0.3514i 0.4297+1.0463i 0.2718+0.6708i 0.1978+0.3217i] [0.4701-1.0551i -0.2727-1.1572i 0.3650+0.2219i -0.8450+1.8850i] [-0.5114+1.5230i -0.5786+0.4300i -0.2502-0.8818i 0.8870-0.2761i]] A-=c; A = [[-0.5603-0.0988i 1.1814+0.8342i 0.1625+0.5558i 0.0404+0.3288i] [0.3078-0.1394i -0.7666-0.2782i 0.7138+0.5478i -0.4314+1.8671i] [-0.6237+0.5590i 0.1217+0.0784i -0.6798+0.2067i 0.0881-0.4163i]] -A = [[0.4338+0.2881i -1.3078-0.6448i -0.2890-0.3665i -0.1669-0.1394i] [-0.4343+0.3287i 0.6401+0.4675i -0.8402-0.3585i 0.3050-1.6777i] [0.4972-0.3697i -0.2482+0.1109i 0.5533-0.0174i -0.2146+0.6056i]] A*C = [[-2.0084+1.4949i -0.3361+0.8159i 1.2262-0.0879i] [2.8940-1.4041i -0.2298+2.5314i 0.1093-3.0242i] [-1.3085+1.4105i 0.2880-1.1105i 0.2800+0.5947i]] A*=C; A = [[-2.0084+1.4949i -0.3361+0.8159i 1.2262-0.0879i] [2.8940-1.4041i -0.2298+2.5314i 0.1093-3.0242i] [-1.3085+1.4105i 0.2880-1.1105i 0.2800+0.5947i]] A*c = [[-0.1094+0.0457i 0.2875-0.1661i 0.1059-0.0084i 0.0475-0.0140i] [-0.0073-0.1238i -0.1695+0.0621i 0.1741-0.1137i 0.2791+0.2699i] [0.0071+0.1409i 0.0104-0.0610i -0.0667+0.1069i -0.0875-0.1172i]] c*A = [[-0.1094+0.0457i 0.2875-0.1661i 0.1059-0.0084i 0.0475-0.0140i] [-0.0073-0.1238i -0.1695+0.0621i 0.1741-0.1137i 0.2791+0.2699i] [0.0071+0.1409i 0.0104-0.0610i -0.0667+0.1069i -0.0875-0.1172i]] A*=c; A = [[-0.1094+0.0457i 0.2875-0.1661i 0.1059-0.0084i 0.0475-0.0140i] [-0.0073-0.1238i -0.1695+0.0621i 0.1741-0.1137i 0.2791+0.2699i] [0.0071+0.1409i 0.0104-0.0610i -0.0667+0.1069i -0.0875-0.1172i]] A*v = [0.4175+0.5639i 2.4069+0.3066i -1.2331-0.1729i] elem_mult(A,B) = [[-0.4203+0.1207i 1.4074+0.0412i 0.1165-0.0817i 0.0203-0.0347i] [0.2232+0.3272i 0.5576-0.2697i 0.3503+0.2851i 0.1831+0.9693i] [0.4193+0.5786i 0.1452-0.2260i 0.1521-0.5028i -0.3438+0.3365i]] elem_mult_out(A,B,out); out = [[-0.4203+0.1207i 1.4074+0.0412i 0.1165-0.0817i 0.0203-0.0347i] [0.2232+0.3272i 0.5576-0.2697i 0.3503+0.2851i 0.1831+0.9693i] [0.4193+0.5786i 0.1452-0.2260i 0.1521-0.5028i -0.3438+0.3365i]] elem_mult_inplace(A,B); B = [[-0.4203+0.1207i 1.4074+0.0412i 0.1165-0.0817i 0.0203-0.0347i] [0.2232+0.3272i 0.5576-0.2697i 0.3503+0.2851i 0.1831+0.9693i] [0.4193+0.5786i 0.1452-0.2260i 0.1521-0.5028i -0.3438+0.3365i]] elem_mult_sum(A,B) = 2.8108+1.5439i A/c = [[-0.0063-2.2873i 0.8357+6.3496i -0.6334+1.9497i -0.1021+0.9496i] [2.2600+0.7841i 0.1456-3.4784i 0.7407+3.9432i -6.8713+2.9794i] [-2.5632-0.9139i 1.0107+0.6359i -1.4133-1.9783i 2.7352-0.6939i]] A/=c; A = [[-0.0063-2.2873i 0.8357+6.3496i -0.6334+1.9497i -0.1021+0.9496i] [2.2600+0.7841i 0.1456-3.4784i 0.7407+3.9432i -6.8713+2.9794i] [-2.5632-0.9139i 1.0107+0.6359i -1.4133-1.9783i 2.7352-0.6939i]] A/=B; A = [[-0.0735-0.6159i 0.9541+1.1706i -1.1470+1.0145i -0.8944+0.7639i] [-0.4808-0.5742i -0.1428+1.0043i 1.8335+0.2273i -1.5315+2.5188i] [-0.3258-0.4271i 0.2717+0.0436i 0.2036+0.5467i 0.0986+0.8523i]] elem_div(A,B) = [[-0.0735-0.6159i 0.9541+1.1706i -1.1470+1.0145i -0.8944+0.7639i] [-0.4808-0.5742i -0.1428+1.0043i 1.8335+0.2273i -1.5315+2.5188i] [-0.3258-0.4271i 0.2717+0.0436i 0.2036+0.5467i 0.0986+0.8523i]] elem_div_out(A,B,out); out = [[-0.0735-0.6159i 0.9541+1.1706i -1.1470+1.0145i -0.8944+0.7639i] [-0.4808-0.5742i -0.1428+1.0043i 1.8335+0.2273i -1.5315+2.5188i] [-0.3258-0.4271i 0.2717+0.0436i 0.2036+0.5467i 0.0986+0.8523i]] elem_div_sum(A,B) = -1.2342+6.5246i ======================================== Testing initialisation with string ======================================== bmat M = " 1 1 0; 0 1; 1 1 ,1, 1; ; 0 1" M = [[1 1 0 0] [0 1 0 0] [1 1 1 1] [0 0 0 0] [0 1 0 0]] smat M = "0xFF, -021 , 100; 0,-0x01; 0xA, 10 012; " M = [[255 -17 100] [0 -1 0] [10 10 10]] imat M = "0xFAC0, -021, 100000; 0,-0x01; 0xA, 10 012; " M = [[64192 -17 100000] [0 -1 0] [10 10 10]] mat M = ".77 1e9 35; 0x7 3.5 -1000 "M = [[0.7700 189000.0000 35.0000] [7.0000 3.5000 -1000.0000]] cmat M = " 1.5+3i, (.33,1) ; (333,-1) 2-0.2E-3i" M = [[1.5000+3.0000i 0.3300+1.0000i] [333.0000-1.0000i 2.0000-0.0002i]] itpp-4.3.1/tests/matfunc_test.cpp000066400000000000000000000073021216575753400170560ustar00rootroot00000000000000/*! * \file * \brief Test program of various functions on vectors and matrices * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace std; using namespace itpp; int main() { cout << "=================================" << endl; cout << " Test of matfunc routines " << endl; cout << "=================================" << endl; cout.setf(ios::fixed); cout.precision(3); vec a = randn(5); cout << "a = " << a << endl; cout << "sum(a) = " << sum(a) << endl; cout << "cumsum(a) = " << cumsum(a) << endl; cout << "prod(a) = " << prod(a) << endl; cout << "sum_sqr(a) = " << sum_sqr(a) << endl << endl; mat A = randn(5, 5); cout << "A = " << A << endl << endl; cout << "sum(A) = " << sum(A) << endl; cout << "sum(A,1) = " << sum(A, 1) << endl; cout << "sum(A,2) = " << sum(A, 2) << endl << endl; cout << "cumsum(A) = " << cumsum(A) << endl; cout << "cumsum(A,1) = " << cumsum(A, 1) << endl; cout << "cumsum(A,2) = " << cumsum(A, 2) << endl << endl; cout << "prod(A) = " << prod(A) << endl; cout << "prod(A,1) = " << prod(A, 1) << endl; cout << "prod(A,2) = " << prod(A, 2) << endl << endl; cout << "sum_sqr(A) = " << sum_sqr(A) << endl; cout << "sum_sqr(A,1) = " << sum_sqr(A, 1) << endl; cout << "sum_sqr(A,2) = " << sum_sqr(A, 2) << endl << endl; cout << "repmat(a, 1, 3) = " << repmat(a, 1, 3) << endl; cout << "repmat(a, 3, 1, true) = " << repmat(a, 3, 1, true) << endl; cout << "repmat(A, 2, 2) = " << repmat(A, 2, 2) << endl << endl; cout << "Kronecker test" << endl; mat X = to_mat(randi(2, 2, 1, 4)); mat Y = randn(3, 3); cout << "X = " << X << endl; cout << "Y = " << Y << endl; cout << "kron(X, Y) = " << kron(X, Y) << endl << endl; cout << "sqrtm of a real matrix" << endl; A = randn(3, 3); cmat A_sqrtm = sqrtm(A); cout << "A = " << A << endl; cout << "norm(sqrtm(A) * sqrtm(A) - A) = " << round_to_zero(norm(A_sqrtm * A_sqrtm - to_cmat(A)), 1e-13) << endl << endl; cout << "sqrtm of a complex matrix" << endl; cmat B = randn_c(3, 3); cmat B_sqrtm = sqrtm(B); cout << "B = " << B << endl; cout << "norm(sqrtm(B) * sqrtm(B) - B) = " << round_to_zero(norm(B_sqrtm * B_sqrtm - B), 1e-13) << endl << endl; cout << "Rank test" << endl; A = randn(3, 3); cout << "A = " << A << endl; cout << "rank(A) = " << itpp::rank(A) << endl; A.set_row(1, 3.0 * A.get_row(0)); cout << "A2 = " << A << endl; cout << "rank(A2) = " << itpp::rank(A) << endl; B = randn_c(3, 3); cout << "B = " << B << endl; cout << "rank(B) = " << itpp::rank(B) << endl; B.set_col(1, B.get_col(0)); cout << "B2 = " << B << endl; cout << "rank(B2) = " << itpp::rank(B) << endl; return 0; } itpp-4.3.1/tests/matfunc_test.ref000066400000000000000000000070171216575753400170530ustar00rootroot00000000000000================================= Test of matfunc routines ================================= a = [-0.284 1.364 0.906 1.249 1.558] sum(a) = 4.794 cumsum(a) = [-0.284 1.081 1.987 3.236 4.794] prod(a) = -0.683 sum_sqr(a) = 6.751 A = [[0.565 -1.075 -0.732 -0.869 -0.228] [-0.596 2.365 -2.106 -0.050 -1.837] [-1.197 2.365 -0.923 0.800 0.051] [-1.268 1.228 -1.892 1.028 1.441] [-0.300 0.234 -0.664 -0.900 -1.481]] sum(A) = [-2.796 5.117 -6.318 0.008 -2.053] sum(A,1) = [-2.796 5.117 -6.318 0.008 -2.053] sum(A,2) = [-2.339 -2.225 1.095 0.538 -3.112] cumsum(A) = [[0.565 -1.075 -0.732 -0.869 -0.228] [-0.031 1.290 -2.838 -0.920 -2.065] [-1.228 3.655 -3.761 -0.120 -2.014] [-2.496 4.883 -5.653 0.908 -0.572] [-2.796 5.117 -6.318 0.008 -2.053]] cumsum(A,1) = [[0.565 -1.075 -0.732 -0.869 -0.228] [-0.031 1.290 -2.838 -0.920 -2.065] [-1.228 3.655 -3.761 -0.120 -2.014] [-2.496 4.883 -5.653 0.908 -0.572] [-2.796 5.117 -6.318 0.008 -2.053]] cumsum(A,2) = [[0.565 -0.510 -1.242 -2.111 -2.339] [-0.596 1.769 -0.337 -0.387 -2.225] [-1.197 1.168 0.244 1.044 1.095] [-1.268 -0.040 -1.932 -0.903 0.538] [-0.300 -0.066 -0.731 -1.631 -3.112]] prod(A) = [0.154 -1.728 -1.789 -0.033 -0.046] prod(A,1) = [0.154 -1.728 -1.789 -0.033 -0.046] prod(A,2) = [0.088 0.275 0.107 4.366 0.062] sum_sqr(A) = [3.805 13.903 9.844 3.267 7.700] sum_sqr(A,1) = [3.805 13.903 9.844 3.267 7.700] sum_sqr(A,2) = [2.818 13.759 8.522 9.831 3.589] repmat(a, 1, 3) = [[-0.284 -0.284 -0.284] [1.364 1.364 1.364] [0.906 0.906 0.906] [1.249 1.249 1.249] [1.558 1.558 1.558]] repmat(a, 3, 1, true) = [[-0.284 1.364 0.906 1.249 1.558] [-0.284 1.364 0.906 1.249 1.558] [-0.284 1.364 0.906 1.249 1.558]] repmat(A, 2, 2) = [[0.565 -1.075 -0.732 -0.869 -0.228 0.565 -1.075 -0.732 -0.869 -0.228] [-0.596 2.365 -2.106 -0.050 -1.837 -0.596 2.365 -2.106 -0.050 -1.837] [-1.197 2.365 -0.923 0.800 0.051 -1.197 2.365 -0.923 0.800 0.051] [-1.268 1.228 -1.892 1.028 1.441 -1.268 1.228 -1.892 1.028 1.441] [-0.300 0.234 -0.664 -0.900 -1.481 -0.300 0.234 -0.664 -0.900 -1.481] [0.565 -1.075 -0.732 -0.869 -0.228 0.565 -1.075 -0.732 -0.869 -0.228] [-0.596 2.365 -2.106 -0.050 -1.837 -0.596 2.365 -2.106 -0.050 -1.837] [-1.197 2.365 -0.923 0.800 0.051 -1.197 2.365 -0.923 0.800 0.051] [-1.268 1.228 -1.892 1.028 1.441 -1.268 1.228 -1.892 1.028 1.441] [-0.300 0.234 -0.664 -0.900 -1.481 -0.300 0.234 -0.664 -0.900 -1.481]] Kronecker test X = [[2.000 2.000] [3.000 1.000]] Y = [[0.910 -0.270 0.495] [1.123 -1.005 0.722] [1.461 1.872 0.246]] kron(X, Y) = [[1.820 -0.539 0.989 1.820 -0.539 0.989] [2.247 -2.011 1.444 2.247 -2.011 1.444] [2.921 3.744 0.493 2.921 3.744 0.493] [2.730 -0.809 1.484 0.910 -0.270 0.495] [3.370 -3.016 2.166 1.123 -1.005 0.722] [4.382 5.616 0.739 1.461 1.872 0.246]] sqrtm of a real matrix A = [[0.672 0.549 -0.454] [-1.001 -0.809 0.260] [-0.180 -2.297 -1.448]] norm(sqrtm(A) * sqrtm(A) - A) = 0.000 sqrtm of a complex matrix B = [[0.214-0.984i -0.885+0.466i -1.289+0.563i] [0.261+1.134i -0.608+0.053i -0.069-0.822i] [-0.226+1.077i -0.122-0.849i 0.953-0.128i]] norm(sqrtm(B) * sqrtm(B) - B) = 0.000 Rank test A = [[0.394 -0.184 -0.940] [0.847 0.110 0.462] [-0.270 -0.263 0.849]] rank(A) = 3 A2 = [[0.394 -0.184 -0.940] [1.181 -0.553 -2.819] [-0.270 -0.263 0.849]] rank(A2) = 2 B = [[-0.219-0.082i -0.298+0.296i -0.477-0.638i] [-0.352+0.221i 0.901-0.233i -1.249+0.340i] [0.635+0.087i 0.964+0.837i 0.023-0.182i]] rank(B) = 3 B2 = [[-0.219-0.082i -0.219-0.082i -0.477-0.638i] [-0.352+0.221i -0.352+0.221i -1.249+0.340i] [0.635+0.087i 0.635+0.087i 0.023-0.182i]] rank(B2) = 2 itpp-4.3.1/tests/modulator_nd_test.cpp000066400000000000000000000150441216575753400201120ustar00rootroot00000000000000/*! * \file * \brief Vector ("MIMO") modulator classes test program * \author Erik G. Larsson, Adam Piatyszek, and Mirsad Cirkic * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include using namespace std; using namespace itpp; int main() { cout << "========================================================" << endl; cout << " Test of ND (MIMO) Modulators " << endl; cout << "========================================================" << endl; cout.setf(ios::fixed); cout.precision(2); RNG_reset(12345); double sigma2 = 0.05; { // --- Test for M-PAM, M^2-QAM, and M^2-PSK constellations ND_UPAM pammod; ND_UQAM qammod; ND_UPSK pskmod; int nt = 2; for (int nb = 1; nb <= 2; nb++) { cout << "================== " << (1 << nb) << "-PAM, " << (1<<2*nb) << "-QAM, and " << (1<<2*nb) << "-PSK ==================\n"; pammod.set_M(2*nt, 1<. * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { RNG_reset(12345); cout << "===========================================================" << endl; cout << " Test of Modulators " << endl; cout << "===========================================================" << endl; const int no_symbols = 5; const double N0 = 0.1; { cout << endl << "Modulator_1D (configured as BPSK)" << endl; Modulator_1D mod("1.0 -1.0", "0 1"); int bps = round_i(mod.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); vec noise = sqrt(N0) * randn(no_symbols); vec tx_symbols = mod.modulate_bits(tx_bits); vec rx_symbols = tx_symbols + noise; bvec decbits = mod.demodulate_bits(rx_symbols); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; tx_symbols = mod.modulate(tx_sym_numbers); rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = mod.demodulate(rx_symbols); cout << "* modulating symbol numbers:" << endl; cout << " tx_sym_numbers = " << tx_sym_numbers << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " dec_sym_numbers = " << dec_sym_numbers << endl; cout << endl << "BPSK (real signal)" << endl; BPSK bpsk; bpsk.modulate_bits(tx_bits, tx_symbols); rx_symbols = tx_symbols + noise; bpsk.demodulate_bits(rx_symbols, decbits); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; cout << endl << "BPSK (complex signal)" << endl; BPSK_c bpsk_c; cvec tx_csymbols = bpsk_c.modulate_bits(tx_bits); cvec rx_csymbols = tx_csymbols + to_cvec(noise, -noise); decbits = bpsk_c.demodulate_bits(rx_csymbols); vec softbits_approx = bpsk_c.demodulate_soft_bits(rx_csymbols, N0, APPROX); vec softbits = bpsk_c.demodulate_soft_bits(rx_csymbols, N0, LOGMAP); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_csymbols = " << tx_csymbols << endl; cout << " rx_csymbols = " << rx_csymbols << endl; cout << " decbits = " << decbits << endl; cout << " softbits = " << softbits << endl; cout << " softbits_approx = " << softbits_approx << endl << endl; } cout << "===========================================================" << endl; { cout << endl << "Modulator_1D (configured as 4-PAM)" << endl; Modulator_1D mod("-3.0 -1.0 1.0 3.0", "0 1 3 2"); int bps = round_i(mod.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); vec noise = sqrt(N0) * randn(no_symbols); vec tx_symbols = mod.modulate_bits(tx_bits); vec rx_symbols = tx_symbols + noise; bvec decbits = mod.demodulate_bits(rx_symbols); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; tx_symbols = mod.modulate(tx_sym_numbers); rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = mod.demodulate(rx_symbols); cout << "* modulating symbol numbers:" << endl; cout << " tx_sym_numbers = " << tx_sym_numbers << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " dec_sym_numbers = " << dec_sym_numbers << endl; cout << endl << "4-PAM (real signal)" << endl; PAM pam(4); pam.modulate_bits(tx_bits, tx_symbols); rx_symbols = tx_symbols + noise; pam.demodulate_bits(rx_symbols, decbits); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; cout << endl << "4-PAM (complex signal)" << endl; PAM_c pam_c(4); cvec tx_csymbols = pam_c.modulate_bits(tx_bits); cvec rx_csymbols = tx_csymbols + to_cvec(noise, -noise); decbits = pam_c.demodulate_bits(rx_csymbols); vec softbits_approx = pam_c.demodulate_soft_bits(rx_csymbols, N0, APPROX); vec softbits = pam_c.demodulate_soft_bits(rx_csymbols, N0, LOGMAP); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_csymbols = " << tx_csymbols << endl; cout << " rx_csymbols = " << rx_csymbols << endl; cout << " decbits = " << decbits << endl; cout << " softbits = " << softbits << endl; cout << " softbits_approx = " << softbits_approx << endl << endl; } cout << "===========================================================" << endl; { cout << endl << "Modulator_2D (configured as 256-QAM)" << endl; QAM qam(256); Modulator_2D mod(qam.get_symbols(), qam.get_bits2symbols()); int bps = round_i(mod.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); cvec noise = sqrt(N0) * randn_c(no_symbols); cvec tx_symbols = mod.modulate(tx_sym_numbers); cvec rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = mod.demodulate(rx_symbols); cout << "* modulating symbol numbers:" << endl; cout << " tx_sym_numbers = " << tx_sym_numbers << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " dec_sym_numbers = " << dec_sym_numbers << endl; tx_symbols = mod.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; bvec decbits = mod.demodulate_bits(rx_symbols); vec softbits_approx = mod.demodulate_soft_bits(rx_symbols, N0, APPROX); vec softbits = mod.demodulate_soft_bits(rx_symbols, N0, LOGMAP); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; cout << " softbits = " << softbits << endl; cout << " softbits_approx = " << softbits_approx << endl; cout << endl << "256-QAM" << endl; tx_symbols = qam.modulate(tx_sym_numbers); rx_symbols = tx_symbols + noise; dec_sym_numbers = qam.demodulate(rx_symbols); cout << "* modulating symbol numbers:" << endl; cout << " tx_sym_numbers = " << tx_sym_numbers << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " dec_sym_numbers = " << dec_sym_numbers << endl; tx_symbols = qam.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; decbits = qam.demodulate_bits(rx_symbols); softbits_approx = qam.demodulate_soft_bits(rx_symbols, N0, APPROX); softbits = qam.demodulate_soft_bits(rx_symbols, N0, LOGMAP); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; cout << " softbits = " << softbits << endl; cout << " softbits_approx = " << softbits_approx << endl << endl; } cout << "===========================================================" << endl; { cout << endl << "8-PSK" << endl; PSK psk(8); int bps = round_i(psk.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); cvec noise = sqrt(N0) * randn_c(no_symbols); cvec tx_symbols = psk.modulate(tx_sym_numbers); cvec rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = psk.demodulate(rx_symbols); cout << "* modulating symbol numbers:" << endl; cout << " tx_sym_numbers = " << tx_sym_numbers << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " dec_sym_numbers = " << dec_sym_numbers << endl; tx_symbols = psk.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; bvec decbits = psk.demodulate_bits(rx_symbols); vec softbits_approx = psk.demodulate_soft_bits(rx_symbols, N0, APPROX); vec softbits = psk.demodulate_soft_bits(rx_symbols, N0, LOGMAP); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; cout << " softbits = " << softbits << endl; cout << " softbits_approx = " << softbits_approx << endl << endl; } cout << "===========================================================" << endl; { cout << endl << "16-QAM" << endl; QAM qam(16); int bps = round_i(qam.bits_per_symbol()); bvec tx_bits = randb(no_symbols * bps); ivec tx_sym_numbers = randi(no_symbols, 0, pow2i(bps) - 1); cvec noise = sqrt(N0) * randn_c(no_symbols); cvec tx_symbols = qam.modulate(tx_sym_numbers); cvec rx_symbols = tx_symbols + noise; ivec dec_sym_numbers = qam.demodulate(rx_symbols); cout << "* modulating symbol numbers:" << endl; cout << " tx_sym_numbers = " << tx_sym_numbers << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " dec_sym_numbers = " << dec_sym_numbers << endl; tx_symbols = qam.modulate_bits(tx_bits); rx_symbols = tx_symbols + noise; bvec decbits = qam.demodulate_bits(rx_symbols); vec softbits_approx = qam.demodulate_soft_bits(rx_symbols, N0, APPROX); vec softbits = qam.demodulate_soft_bits(rx_symbols, N0, LOGMAP); cout << "* modulating bits:" << endl; cout << " tx_bits = " << tx_bits << endl; cout << " tx_symbols = " << tx_symbols << endl; cout << " rx_symbols = " << rx_symbols << endl; cout << " decbits = " << decbits << endl; cout << " softbits = " << softbits << endl; cout << " softbits_approx = " << softbits_approx << endl << endl; } } itpp-4.3.1/tests/modulator_test.ref000066400000000000000000000174001216575753400174210ustar00rootroot00000000000000=========================================================== Test of Modulators =========================================================== Modulator_1D (configured as BPSK) * modulating bits: tx_bits = [1 1 0 1 1] tx_symbols = [-1 -1 1 -1 -1] rx_symbols = [-0.903346 -0.634069 0.890343 -1.15583 -0.830113] decbits = [1 1 0 1 1] * modulating symbol numbers: tx_sym_numbers = [1 1 0 1 1] tx_symbols = [-1 -1 1 -1 -1] rx_symbols = [-0.903346 -0.634069 0.890343 -1.15583 -0.830113] dec_sym_numbers = [1 1 0 1 1] BPSK (real signal) * modulating bits: tx_bits = [1 1 0 1 1] tx_symbols = [-1 -1 1 -1 -1] rx_symbols = [-0.903346 -0.634069 0.890343 -1.15583 -0.830113] decbits = [1 1 0 1 1] BPSK (complex signal) * modulating bits: tx_bits = [1 1 0 1 1] tx_csymbols = [-1+0i -1+0i 1+0i -1+0i -1+0i] rx_csymbols = [-0.903346-0.0966544i -0.634069-0.365931i 0.890343+0.109657i -1.15583+0.155832i -0.830113-0.169887i] decbits = [1 1 0 1 1] softbits = [-36.1338 -25.3628 35.6137 -46.2333 -33.2045] softbits_approx = [-36.1338 -25.3628 35.6137 -46.2333 -33.2045] =========================================================== Modulator_1D (configured as 4-PAM) * modulating bits: tx_bits = [1 0 0 1 1 0 1 1 0 1] tx_symbols = [3 -1 3 1 -1] rx_symbols = [2.81898 -1.09523 2.8743 1.56882 -0.880341] decbits = [1 0 0 1 1 0 1 1 0 1] * modulating symbol numbers: tx_sym_numbers = [2 0 3 3 2] tx_symbols = [1 -3 3 3 1] rx_symbols = [0.818976 -3.09523 2.8743 3.56882 1.11966] dec_sym_numbers = [2 0 3 3 2] 4-PAM (real signal) * modulating bits: tx_bits = [1 0 0 1 1 0 1 1 0 1] tx_symbols = [-1.34164 0.447214 -1.34164 -0.447214 0.447214] rx_symbols = [-1.52266 0.351985 -1.46734 0.121605 0.566872] decbits = [1 0 0 1 1 0 0 1 0 1] 4-PAM (complex signal) * modulating bits: tx_bits = [1 0 0 1 1 0 1 1 0 1] tx_csymbols = [-1.34164+0i 0.447214+0i -1.34164+0i -0.447214+0i 0.447214+0i] rx_csymbols = [-1.52266+0.181024i 0.351985+0.0952288i -1.46734+0.125701i 0.121605-0.568819i 0.566872-0.119659i] decbits = [1 0 0 1 1 0 0 1 0 1] softbits = [-38.4765 11.2383 6.29656 -9.70535 -36.4973 10.2486 2.17534 -13.9308 10.1434 -5.85952] softbits_approx = [-38.4765 11.2383 6.2965 -9.7035 -36.4972 10.2486 2.17534 -13.8247 10.1405 -5.85948] =========================================================== Modulator_2D (configured as 256-QAM) * modulating symbol numbers: tx_sym_numbers = [59 139 29 178 124] tx_symbols = [-0.536875+0.690268i -0.536875-0.0766965i -0.843661+0.997054i 0.843661-0.536875i -0.690268+0.0766965i] rx_symbols = [-0.254627+0.564075i -0.440218+0.144641i -1.01567+1.09629i 0.848682-0.37757i -0.759703-0.322026i] dec_sym_numbers = [73 122 14 162 172] * modulating bits: tx_bits = [0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 1 1 0 1] tx_symbols = [-0.843661+0.230089i -0.997054+1.15045i 0.997054+0.0766965i -0.383482-0.0766965i -0.230089+0.536875i] rx_symbols = [-0.561413+0.103896i -0.900397+1.37179i 0.825046+0.175927i -0.378462+0.0826089i -0.299524+0.138153i] decbits = [0 1 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1] softbits = [0.764361 -4.53879 1.33914 0.0998816 -5.24815 -0.383786 -1.56908 0.175588 20.8995 6.83599 2.47707 0.707791 -10.7329 2.17238 -0.289121 -0.303773 1.31869 -3.74479 0.901794 -0.0470311 9.34327 1.56432 -0.762366 -0.165231 0.605491 -4.76275 1.44412 0.13652 -3.12443 -1.80187 -0.499773 -0.153056 1.02428 -4.16087 1.14289 0.0319552 -2.36526 -2.49883 0.0507592 -0.205765] softbits_approx = [0.318739 -3.43093 0.774286 0.151849 -4.06582 -0.160015 -1.09173 0.310573 20.4911 6.48084 2.29924 0.914328 -9.51492 1.28929 -0.061239 -0.409349 0.608852 -2.61613 0.401456 -0.0691321 8.12793 0.826956 -0.292404 -0.178184 0.253433 -3.69215 0.9049 0.217156 -2.07144 -0.971982 -0.219892 -0.250697 0.423836 -3.01054 0.564094 0.0467527 -1.36721 -1.4786 0.0222797 -0.448308] 256-QAM * modulating symbol numbers: tx_sym_numbers = [59 139 29 178 124] tx_symbols = [-0.536875+0.690268i -0.536875-0.0766965i -0.843661+0.997054i 0.843661-0.536875i -0.690268+0.0766965i] rx_symbols = [-0.254627+0.564075i -0.440218+0.144641i -1.01567+1.09629i 0.848682-0.37757i -0.759703-0.322026i] dec_sym_numbers = [73 122 14 162 172] * modulating bits: tx_bits = [0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 1 1 0 1] tx_symbols = [-0.843661+0.230089i -0.997054+1.15045i 0.997054+0.0766965i -0.383482-0.0766965i -0.230089+0.536875i] rx_symbols = [-0.561413+0.103896i -0.900397+1.37179i 0.825046+0.175927i -0.378462+0.0826089i -0.299524+0.138153i] decbits = [0 1 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1] softbits = [0.764361 -4.53879 1.33914 0.0998816 -5.24815 -0.383786 -1.56908 0.175588 20.8995 6.83599 2.47707 0.707791 -10.7329 2.17238 -0.289121 -0.303773 1.31869 -3.74479 0.901794 -0.0470311 9.34327 1.56432 -0.762366 -0.165231 0.605491 -4.76275 1.44412 0.13652 -3.12443 -1.80187 -0.499773 -0.153056 1.02428 -4.16087 1.14289 0.0319552 -2.36526 -2.49883 0.0507592 -0.205765] softbits_approx = [0.318739 -3.43093 0.774286 0.151849 -4.06582 -0.160015 -1.09173 0.310573 20.4911 6.48084 2.29924 0.914328 -9.51492 1.28929 -0.061239 -0.409349 0.608852 -2.61613 0.401456 -0.0691321 8.12793 0.826956 -0.292404 -0.178184 0.253433 -3.69215 0.9049 0.217156 -2.07144 -0.971982 -0.219892 -0.250697 0.423836 -3.01054 0.564094 0.0467527 -1.36721 -1.4786 0.0222797 -0.448308] =========================================================== 8-PSK * modulating symbol numbers: tx_sym_numbers = [7 7 7 0 1] tx_symbols = [0.707107-0.707107i 0.707107-0.707107i 0.707107-0.707107i 1+0i 0.707107+0.707107i] rx_symbols = [0.8977-0.790151i 0.613921-1.00098i 0.597143-0.839004i 1.14134+0.25144i 0.978761+0.560701i] dec_sym_numbers = [7 7 7 0 1] * modulating bits: tx_bits = [1 0 1 0 0 1 1 0 0 1 0 1 0 1 1] tx_symbols = [0-1i 0.707107+0.707107i 0.707107-0.707107i 0-1i 0+1i] rx_symbols = [0.190593-1.08304i 0.613921+0.413229i 0.597143-0.839004i 0.141345-0.74856i 0.271654+0.853594i] decbits = [1 0 1 0 0 1 1 0 0 1 0 1 0 1 1] softbits = [-17.8748 9.0654 -3.64905 11.79 6.36194 -2.2495 -8.39621 16.9189 3.53033 -12.2338 6.47187 -2.38768 22.7189 -1.15859 -9.05583] softbits_approx = [-17.849 9.03972 -3.64894 11.6879 6.26152 -2.24768 -8.36733 16.8897 3.5301 -12.1443 6.38388 -2.38605 22.505 -1.15847 -8.842] =========================================================== 16-QAM * modulating symbol numbers: tx_sym_numbers = [8 9 15 10 2] tx_symbols = [0.948683-0.316228i 0.316228-0.316228i -0.948683-0.948683i -0.316228-0.316228i -0.316228+0.948683i] rx_symbols = [0.761834-0.196896i 0.818726-0.145779i -1.08588-1.63427i -0.239432-0.0518489i -0.318584+0.783665i] dec_sym_numbers = [8 8 15 10 2] * modulating bits: tx_bits = [1 1 0 1 1 0 0 0 1 0 1 1 1 0 0 1 0 1 1 0] tx_symbols = [0.316228-0.316228i 0.948683-0.948683i -0.316228-0.948683i 0.316228-0.948683i -0.948683+0.316228i] rx_symbols = [0.129379-0.196896i 1.45118-0.778235i -0.453421-1.63427i 0.393024-0.684304i -0.95104+0.151209i] decbits = [1 1 0 1 1 0 0 0 1 0 1 1 1 0 0 1 0 1 1 0] softbits = [-2.49457 -5.58849 1.63818 -6.53399 -11.8348 1.84392 28.7123 10.3562 -33.3441 12.6721 -5.83419 -2.26785 -9.72974 0.655668 5.01865 -3.03551 1.91488 -6.22187 -16.0772 4.0298] softbits_approx = [-2.49055 -5.50945 1.63652 -6.36348 -11.688 1.84398 28.7123 10.3562 -33.3441 12.6721 -5.73537 -2.26463 -9.31168 0.655842 4.9714 -3.0286 1.91266 -6.08734 -16.0596 4.02981] itpp-4.3.1/tests/newton_search_test.cpp000066400000000000000000000110501216575753400202530ustar00rootroot00000000000000/*! * \file * \brief Newton search test program * \author Tony Ottosson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace std; using namespace itpp; double rosenbrock(const vec &x) { double f1 = x(1) - sqr(x(0)), f2 = 1 - x(0); double F = 50 * sqr(f1) + 0.5 * sqr(f2) + 0.0; return F; } vec rosenbrock_gradient(const vec &x) { double f1 = x(1) - sqr(x(0)), f2 = 1 - x(0); vec g(2); g(0) = -200.0 * x(0) * f1 - f2; g(1) = 100.0 * f1; return g; } int main(void) { cout << "=====================================" << endl; cout << " Test of Numerical optimization " << endl; cout << "=====================================" << endl; cout << setprecision(6); { cout << " Line_Search " << endl; cout << "--------------------" << endl; vec x0 = "-1.2 1"; double F0 = rosenbrock(x0); vec g0 = rosenbrock_gradient(x0); vec h = -g0; Line_Search line; line.set_functions(rosenbrock, rosenbrock_gradient); cout << "x0 = " << x0 << endl; cout << "F0 = " << F0 << endl; cout << "g0 = " << g0 << endl; cout << "h = " << h << endl; double Fn; vec xn, gn; line.enable_trace(); if (!line.search(x0, F0, g0, h, xn, Fn, gn)) cout << "Line search failed" << endl; cout << "Soft: " << endl; cout << "xn = " << xn << endl; cout << "Fn = " << Fn << endl; cout << "gn = " << gn << endl; cout << "no_feval = " << line.get_no_function_evaluations() << endl; vec alpha_values, F_values, dF_values; line.get_trace(alpha_values, F_values, dF_values); cout << endl << "trace:" << endl; cout << "alpha = " << fixed << alpha_values << endl; cout << "F = " << round_to_infty(F_values) << endl; cout << "dF = " << round_to_infty(dF_values) << endl; line.set_method(Exact); if (!line.search(x0, F0, g0, h, xn, Fn, gn)) cout << "Line search failed" << endl; cout << endl << "Exact: " << endl; cout << "xn = " << xn << endl; cout << "Fn = " << Fn << endl; cout << "gn = " << gn << endl; cout << "no_feval = " << line.get_no_function_evaluations() << endl; line.get_trace(alpha_values, F_values, dF_values); cout << endl << "trace:" << endl; cout << "alpha = " << alpha_values << endl; cout << "F = " << round_to_infty(F_values) << endl; cout << "dF = " << round_to_infty(dF_values) << endl; } { cout << endl << " Newton_Search " << endl; cout << "--------------------" << endl; vec x0 = "-1.2 1"; Newton_Search newton; newton.set_functions(rosenbrock, rosenbrock_gradient); newton.enable_trace(); cout << "x0 = " << x0 << endl; vec xn, gn; if (!newton.search(x0, xn)) cout << "Newton search failed" << endl; cout << "xn = " << xn << endl; cout << "F = " << newton.get_function_value() << endl; cout << "norm(f') = " << newton.get_stop_1() << endl; cout << "norm(dx) = " << newton.get_stop_2() << endl; cout << "no_feval = " << newton.get_no_function_evaluations() << endl; cout << "no_iter = " << newton.get_no_iterations() << endl; Array xv; vec Fv, ngv, dv; newton.get_trace(xv, Fv, ngv, dv); cout << endl << "trace:" << endl; cout << "xv = " << xv << endl; cout << "Fv = " << Fv << endl; cout << "ngv = " << ngv << endl; cout << "dv = " << dv << endl; newton.disable_trace(); cout << endl << " fminunc " << endl; cout << "--------------------" << endl; xn = fminunc(rosenbrock, rosenbrock_gradient, x0); cout << "x0 = " << x0 << endl; cout << "xn = " << xn << endl; } return 0; } itpp-4.3.1/tests/newton_search_test.ref000066400000000000000000000053501216575753400202530ustar00rootroot00000000000000===================================== Test of Numerical optimization ===================================== Line_Search -------------------- x0 = [-1.2 1] F0 = 12.1 g0 = [-107.8 -44] h = [107.8 44] Soft: xn = [-0.876168 1.13218] Fn = 8.40327 gn = [61.9977 36.4507] no_feval = 4 trace: alpha = [0.000000 1.000000 0.100000 0.010000 0.003004] F = [12.100000 6405495599.000000 373080.932048 102.177223 8.403265] dF = [-13556.840000 25963610893.000000 17461465.026720 9898.069917 8287.177114] Exact: xn = [-1.030081 1.069355] Fn = 2.064049 gn = [-0.322427 0.828893] no_feval = 7 trace: alpha = [0.000000 1.000000 0.100000 0.010000 0.003004 0.001652 0.001487 0.001576] F = [12.100000 6405495599.000000 373080.932048 102.177223 8.403265 2.084316 2.092433 2.064049] dF = [-13556.840000 25963610893.000000 17461465.026720 9898.069917 8287.177114 531.883089 -638.606410 1.713651] Newton_Search -------------------- x0 = [-1.200000 1.000000] xn = [1.000000 1.000001] F = 0.000000 norm(f') = 0.000001 norm(dx) = 0.000009 no_feval = 38 no_iter = 34 trace: xv = {[-0.916319 1.115788] [-0.638053 0.473473] [-0.486640 0.157920] [-0.562213 0.316996] [-0.544444 0.284199] [-0.526701 0.256691] [-0.495460 0.215661] [-0.435025 0.148111] [-0.370499 0.093745] [-0.259872 0.036687] [-0.161128 0.012750] [-0.101892 -0.013244] [0.019384 -0.030515] [0.121386 0.000657] [0.241795 0.023194] [0.333980 0.103868] [0.440777 0.163873] [0.460275 0.202783] [0.548110 0.288172] [0.629240 0.379956] [0.696863 0.482099] [0.771227 0.579446] [0.792735 0.623061] [0.857229 0.727208] [0.900213 0.807282] [0.946131 0.890252] [0.974258 0.952002] [1.004641 1.007415] [0.992922 0.986096] [0.997054 0.994036] [0.999452 0.998810] [0.999954 0.999879] [1.000005 1.000009] [1.000000 1.000001]} Fv = [5.649045 1.561800 1.416294 1.220297 1.200119 1.186880 1.162660 1.114258 1.033853 0.841214 0.682837 0.634992 0.528517 0.395891 0.349639 0.224737 0.202608 0.149765 0.109608 0.081510 0.046565 0.037942 0.022920 0.013106 0.005460 0.002657 0.000730 0.000189 0.000027 0.000005 0.000001 0.000000 0.000000 0.000000] ngv = [48.691723 6.830348 9.165624 1.459632 2.875052 3.709679 4.450318 5.014087 4.595658 3.084625 1.586910 2.362569 3.089105 1.407767 3.527066 0.767488 3.041157 0.907026 1.225191 1.641121 0.351909 2.138139 0.643864 1.166039 0.458514 0.875640 0.575896 0.384089 0.047380 0.013278 0.018376 0.005620 0.000112 0.000001] dv = [0.350000 0.350000 0.350000 0.350000 0.350000 0.350000 0.350000 0.350000 0.350000 0.350000 0.350000 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500 0.122500] fminunc -------------------- x0 = [-1.200000 1.000000] xn = [1.000000 1.000001] itpp-4.3.1/tests/operators_test.cpp000066400000000000000000000123141216575753400174360ustar00rootroot00000000000000/*! * \file * \brief Operators test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2011 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itbase.h" using namespace itpp; using std::cout; using std::endl; using std::complex; int main() { //complex plus/minus scalar { //complex scalar complex x(1.0, 1.0); int y = 2; complex z = x+y; if (complex(x.real()+y, x.imag()) != z) { cout << "complex scalar plus int scalar operator is wrong" << endl; return EXIT_FAILURE; } z = x-y; if (complex(x.real()-y, x.imag()) != z) { cout << "complex scalar minus int scalar operator is wrong" << endl; return EXIT_FAILURE; } //complex vector vec x1_re("1 3"); vec x1_im("2 4"); cvec x1 = to_cvec(x1_re, x1_im); cvec z1 = x1+y; if (to_cvec(x1_re+y, x1_im) != z1) { cout << "complex vector plus int scalar operator is wrong" << endl; return EXIT_FAILURE; } z1 = x1-y; if (to_cvec(x1_re-y, x1_im) != z1) { cout << "complex vector minus int scalar operator is wrong" << endl; return EXIT_FAILURE; } //complex scalar float y1 = 2.7; z = x+y1; if (complex(x.real()+y1, x.imag()) != z) { cout << "complex plus float scalar operator is wrong" << endl; return EXIT_FAILURE; } z = x-y1; if (complex(x.real()-y1, x.imag()) != z) { cout << "complex minus float scalar operator is wrong" << endl; return EXIT_FAILURE; } //complex vector z1 = x1+y1; if (to_cvec(x1_re+y1, x1_im) != z1) { cout << "complex vector plus float scalar operator is wrong" << endl; return EXIT_FAILURE; } z1 = x1-y1; if (to_cvec(x1_re-y1, x1_im) != z1) { cout << "complex vector minus float scalar operator is wrong" << endl; return EXIT_FAILURE; } //complex matrix mat x2_re("1 3; 5 7"); mat x2_im("2 4; 6 8"); cmat x2 = to_cmat(x2_re, x2_im); cmat z2 = x2+complex(y1, 0); if (to_cmat(x2_re+double(y1), x2_im) != z2) { cout << "complex matrix plus complex scalar operator is wrong" << endl; return EXIT_FAILURE; } z2 = x2-complex(y1, 0); if (to_cmat(x2_re-double(y1), x2_im) != z2) { cout << "complex matrix minus complex scalar operator is wrong" << endl; return EXIT_FAILURE; } } //scalar plus/minus complex { //complex scalar int x = 2; complex y(1.0, 1.0); complex z = x+y; if (complex(x+y.real(), y.imag()) != z) { cout << "int scalar plus complex scalar operator is wrong" << endl; return EXIT_FAILURE; } z = x-y; if (complex(x-y.real(), -y.imag()) != z) { cout << "int scalar minus complex scalar operator is wrong" << endl; return EXIT_FAILURE; } //complex vector vec y1_re("1 3"); vec y1_im("2 4"); cvec y1 = to_cvec(y1_re, y1_im); cvec z1 = x+y1; if (to_cvec(x+y1_re, y1_im) != z1) { cout << "int scalar plus complex vector operator is wrong" << endl; return EXIT_FAILURE; } z1 = x-y1; if (to_cvec(x-y1_re, -y1_im) != z1) { cout << "int scalar minus complex vector operator is wrong" << endl; return EXIT_FAILURE; } //complex scalar float x1 = 2.7; z = x1+y; if (complex(x1+y.real(), y.imag()) != z) { cout << "float scalar plus complex operator is wrong" << endl; return EXIT_FAILURE; } z = x1-y; if (complex(x1-y.real(), -y.imag()) != z) { cout << "float scalar minus complex operator is wrong" << endl; return EXIT_FAILURE; } //complex vector z1 = x1+y1; if (to_cvec(x1+y1_re, y1_im) != z1) { cout << "float scalar plus complex vector operator is wrong" << endl; return EXIT_FAILURE; } z1 = x1-y1; if (to_cvec(x1-y1_re, -y1_im) != z1) { cout << "float scalar minus complex vector operator is wrong" << endl; return EXIT_FAILURE; } //complex matrix mat y2_re("1 3; 5 7"); mat y2_im("2 4; 6 8"); cmat y2 = to_cmat(y2_re, y2_im); cmat z2 = complex(x1, 0)+y2; if (to_cmat(x1+y2_re, y2_im) != z2) { cout << "complex scalar plus complex matrix operator is wrong" << endl; return EXIT_FAILURE; } z2 = complex(x1, 0)-y2; if (to_cmat(x1-y2_re, -y2_im) != z2) { cout << "complex scalar minus complex matrix operator is wrong" << endl; return EXIT_FAILURE; } } cout << "operators test successful" << endl; return EXIT_SUCCESS; } itpp-4.3.1/tests/operators_test.ref000066400000000000000000000000321216575753400174220ustar00rootroot00000000000000operators test successful itpp-4.3.1/tests/parser_test.cpp000066400000000000000000000136001216575753400167130ustar00rootroot00000000000000/*! * \file * \brief Parser test program * \author Pal Frenger and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; #ifndef PARSER_TEST_FILE int main() { cerr << "PARSER_TEST_FILE not defined. Test skipped." << endl; return 1; } #else int main(int argc, char *argv[]) { Parser p; int a; double b; string c; ivec d; vec e; svec f; bvec g; imat h; mat i; smat j; bmat k; bool l, m; string n; Array > o, q; cout << "Use the Parser class on a parameter file:" << boolalpha << endl; p.init(string(PARSER_TEST_FILE)); a = p.get_int("a"); cout << "a = " << a << endl; p.get_double("b"); //The default value of b p.get_double("b", 1); //The first alternative value of b p.get_double("b", 2); //The second alternative value of b c = p.get_string("c"); cout << "c = " << c << endl; d = p.get_ivec("d"); cout << "d = " << d << endl; e = p.get_vec("e"); cout << "e = " << e << endl; f = p.get_svec("f"); cout << "f = " << f << endl; g = p.get_bvec("g"); cout << "g = " << g << endl; h = p.get_imat("h"); cout << "h = " << h << endl; i = p.get_mat("i"); cout << "i = " << i << endl; j = p.get_smat("j"); cout << "j = " << j << endl; k = p.get_bmat("k"); cout << "k = " << k << endl; l = p.get_bool("l"); cout << "l = " << l << endl; m = p.get_bool("m"); cout << "m = " << m << endl; n = p.get_string("n"); cout << "n = " << n << endl; cout << "------------------------------------------------------------" << endl; cout << "Use the Parser class on the command line input:" << endl; cout << "Example: > ./parser_test.run \"a=3; b=-1.2; d=[0 1 2 45];\"" << endl << endl; cout << "Use the following code:" << endl; cout << " p.init(argc,argv);" << endl; cout << " a = p.get_int(\"a\"); cout << \"a = \" << a << endl;" << endl; cout << " b = p.get_double(\"b\"); cout << \"b = \" << b << endl;" << endl; cout << " d = p.get_ivec(\"d\"); cout << \"d = \" << d << endl;" << endl; cout << "------------------------------------------------------------" << endl; cout << "Use the Parser class on a char pointer (usually the command line input):" << endl; char argv1_0[] = "a=345"; char argv1_1[] = "b=1.001"; char argv1_2[] = "c=\"Hello Bird\""; char argv1_3[] = "d=[1,2,3,-1,-2,-3]"; int argc1 = 4; char *argv1[4] = { argv1_0, argv1_1, argv1_2, argv1_3 }; p.init(argc1, argv1); a = p.get_int("a"); b = p.get_double("b"); c = p.get_string("c"); d = p.get_ivec("d"); cout << "------------------------------------------------------------" << endl; cout << "Use the Parser class on a parameter file and a char pointer:" << endl; // The data in the char pointer are selected first. The data in the // file are used as default values char argv2_0[] = "a=345"; char argv2_1[] = "d=[1,-2,3,-4,5,-6,7,-8]"; int argc2 = 2; char *argv2[2] = { argv2_0, argv2_1 }; if (argc == 0) { p.init(string(PARSER_TEST_FILE), argc2, argv2); } else { p.init(string(PARSER_TEST_FILE), argc, argv); } a = p.get_int("a"); cout << "a = " << a << endl; b = p.get_double("b"); cout << "b = " << b << endl; c = p.get_string("c"); cout << "c = " << c << endl; d = p.get_ivec("d"); cout << "d = " << d << endl; cout << "------------------------------------------------------------" << endl; cout << "Use the Parser class on an Array of strings:" << endl; Array parser_data(4); parser_data(0) = "a=-11"; parser_data(1) = "b=3.14"; parser_data(2) = "c=\"Hello Nerd\""; parser_data(3) = "d=[0,1,2,0,3,4,7]"; p.init(parser_data); a = p.get_int("a"); b = p.get_double("b"); c = p.get_string("c"); d = p.get_ivec("d"); cout << "------------------------------------------------------------" << endl; cout << "Use the Parser::get() method on a parameter file:" << endl; p.init(string(PARSER_TEST_FILE)); p.get(a, "a"); p.get(b, "b"); p.get(b, "b", 1); p.get(b, "b", 2); p.get(c, "c"); p.get(d, "d"); p.get(e, "e"); p.get(f, "f"); p.get(g, "g"); p.get(h, "h"); p.get(i, "i"); p.get(j, "j"); p.get(k, "k"); p.get(l, "l"); p.get(m, "m"); p.get(n, "n"); p.get(o, "o"); // The following tries can not be found in the data file, so their initial // values should not be changed: set_array(q, "{{[1][2 3][4 5 6]}}"); p.get(q, "q"); bool r = true; p.get(r, "r"); int s = 7; p.get(s, "s"); double t = 3.14; p.get(t, "t"); std::string u = "test string"; p.get(u, "u"); cout << "------------------------------------------------------------" << endl; cout << "Check if variables exist in the Parser:" << endl; cout << "p.exist(\"a\") = " << p.exist("a") << endl; cout << "p.exist(\"aa\") = " << p.exist("aa") << endl; cout << "------------------------------------------------------------" << endl; return 0; } #endif /* ----- #ifndef PARSER_TEST_FILE ----- */ itpp-4.3.1/tests/parser_test.ref000066400000000000000000000042521216575753400167100ustar00rootroot00000000000000Use the Parser class on a parameter file: a = 4 Parsing double: b = 2.35 Parsing double: b = 2.36 Parsing double: b = 2.37 c = Hello World d = [1 2 3 4 3 2 -1] e = [1.2 2 3.33 4.01 3.2 2 -1.2] f = [1 2 3 4 3 2 -1] g = [0 1 0 0 1] h = [[1 2 3] [4 5 6]] i = [[1 2] [-3 4.2]] j = [[1 -2 -3] [4 -5 6]] k = [[0 1 0 1] [1 0 1 0] [0 0 0 0] [1 1 1 1]] l = false m = true n = Hello World ------------------------------------------------------------ Use the Parser class on the command line input: Example: > ./parser_test.run "a=3; b=-1.2; d=[0 1 2 45];" Use the following code: p.init(argc,argv); a = p.get_int("a"); cout << "a = " << a << endl; b = p.get_double("b"); cout << "b = " << b << endl; d = p.get_ivec("d"); cout << "d = " << d << endl; ------------------------------------------------------------ Use the Parser class on a char pointer (usually the command line input): Parsing int : a = 345 Parsing double: b = 1.001 Parsing string: c = Hello Bird Parsing ivec : d = [1 2 3 -1 -2 -3] ------------------------------------------------------------ Use the Parser class on a parameter file and a char pointer: a = 4 Parsing double: b = 2.35 b = 2.35 c = Hello World d = [1 2 3 4 3 2 -1] ------------------------------------------------------------ Use the Parser class on an Array of strings: Parsing int : a = -11 Parsing double: b = 3.14 Parsing string: c = Hello Nerd Parsing ivec : d = [0 1 2 0 3 4 7] ------------------------------------------------------------ Use the Parser::get() method on a parameter file: a = 4; b = 2.35 b = 2.36 b = 2.37 c = 'Hello World'; d = [1 2 3 4 3 2 -1]; e = [1.2 2 3.33 4.01 3.2 2 -1.2]; f = [1 2 3 4 3 2 -1]; g = [0 1 0 0 1]; h = [[1 2 3] [4 5 6]]; i = [[1 2] [-3 4.2]]; j = [[1 -2 -3] [4 -5 6]]; k = [[0 1 0 1] [1 0 1 0] [0 0 0 0] [1 1 1 1]]; l = false; m = true; n = 'Hello World'; o = {{[1+2i 3+4i] [5+6i]} {[7+0i 8+0i 9+0i]}} q = {{[1+0i] [2+0i 3+0i] [4+0i 5+0i 6+0i]}}; r = true; s = 7; t = 3.14; u = 'test string'; ------------------------------------------------------------ Check if variables exist in the Parser: p.exist("a") = true p.exist("aa") = false ------------------------------------------------------------ itpp-4.3.1/tests/parser_test_data.txt000066400000000000000000000035221216575753400177430ustar00rootroot00000000000000%--------------------------------------------------------------------- % Test data file for the parser_test.cpp program %--------------------------------------------------------------------- % Lines that begins with % are ignored. Expressions that ends with ';' % are not printed while parsing. a = 4; %Comments may be put at the end of each line % You can give several values for the same parameter name. Each % alternative value must be on a new row. Select the value you % want with the num parameter in the get_double member function. % Use: % Parser p("filename.txt"); % double b = p.get_double("b",1); % to select the value 2.36 below. b = 2.35 2.36 2.37 % Several expressions may be put on the same row (separated by , or ;) % c is a string, d is an integer vector. Spaces and/or commas separate % the vector elements. c = "Hello World"; d =[1,2,3 4,3 2, -1]; % This a vector. e=[1.2,2,3.33 4.01,3.2 2, -1.2]; % This is a short vector. f=[1,2,3 4,3 2, -1]; % This is a binary vector. g=[0 1 0 0 1]; % This an integer matrix. Spaces and/or commas separate the colums. Semicolons separate rows. h=[1 2 3;4 5 6]; % Expressions can continue over several rows by inserting '...' at the end of the rows % (as in Matlab). This is a matrix. i=[... 1.0, 2 ; ... -3 4.2 ... ] ; % This is a short matrix. j=[1 -2 -3;4 -5 6]; % This is a binary matrix. k=[0 1 0 1;1 0 1 0;0 0 0 0;1 1 1 1]; % These are boolean variables: l= 0; m= true; % This is a string with single instead of double quotes (For Matlab compatibility) n='Hello World'; % This is an Array > % In Matlab, the elements defined below are accessible as % o{1}{1}, o{1}{2} and o{2}{1}; note the curly brackets. % For complex numbers, both 1+2i and (1,2) are allowed formats, % but only the first one is Matlab compatible. o = {{[1+2i 3+4i] [5+6i]} {[7 8 9]}} itpp-4.3.1/tests/poly_test.cpp000066400000000000000000000053751216575753400164140ustar00rootroot00000000000000/*! * \file * \brief Polynomial routines test program * \author Tony Ottosson, Adam Piatyszek and Kumar Appaiah * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { cout << "===================================" << endl; cout << " Test of polynomial routines " << endl; cout << "===================================" << endl; cout.setf(ios::fixed); cout.precision(6); { cout << "Real polynomials" << endl; vec r = randn(3); vec p = poly(r); cvec r2 = roots(p); cout << "Roots, r = " << r << endl; cout << "Polynomial, p = " << p << endl; cout << "r = roots(p) = " << r2 << endl; r = randn(7); p = poly(r); r2 = roots(p); cout << "Roots, r = " << r << endl; cout << "Polynomial, p = " << p << endl; cout << "r = roots(p) = " << r2 << endl; vec x = randn(9); vec y = polyval(p, x); cout << "x = " << x << endl; cout << "polyval(p, x) = " << y << endl; } { cout << "Complex polynomials" << endl; cvec r = randn_c(3); cvec p = poly(r); cvec r2 = roots(p); cout << "Roots, r = " << r << endl; cout << "Polynomial, p = " << p << endl; cout << "r = roots(p) = " << r2 << endl; r = randn_c(7); p = poly(r); r2 = roots(p); cout << "Roots, r = " << r << endl; cout << "Polynomial, p = " << p << endl; cout << "r = roots(p) = " << r2 << endl; cvec x = randn_c(9); cvec y = polyval(p, x); cout << "x = " << x << endl; cout << "polyval(p, x) = " << y << endl; } { cout << "Chebyshev polynomial" << endl; vec x = randn(8); cout << "x = " << x << endl; cout << "cheb(10, x) = " << cheb(10, x) << endl; cout << "cheb(15, x) = " << cheb(15, x) << endl; } return 0; } itpp-4.3.1/tests/poly_test.ref000066400000000000000000000043351216575753400164010ustar00rootroot00000000000000=================================== Test of polynomial routines =================================== Real polynomials Roots, r = [-0.283885 1.364462 0.906001] Polynomial, p = [1.000000 -1.986579 0.591655 0.350939] r = roots(p) = [1.364462+0.000000i 0.906001+0.000000i -0.283885+0.000000i] Roots, r = [1.249419 1.557830 0.564970 -0.596145 -1.197318 -1.267564 -0.300385] Polynomial, p = [1.000000 -0.010807 -3.896433 -0.597658 4.298162 1.153145 -1.021590 -0.298857] r = roots(p) = [1.557830+0.000000i 1.249419+0.000000i -1.267564+0.000000i -1.197318+0.000000i 0.564970+0.000000i -0.596145+0.000000i -0.300385+0.000000i] x = [-1.074602 2.364758 2.365075 1.228044 0.234136 -0.732016 -2.105534 -0.923457 -1.892274] polyval(p, x) = [-0.087985 165.384526 165.592625 0.078881 -0.424166 -0.085999 -68.059907 -0.154228 -23.858406] Complex polynomials Roots, r = [-0.469741-0.614789i -0.035692+0.565461i 0.727250-0.636742i] Polynomial, p = [1.000000+0.000000i -0.221817+0.686070i -0.034581+0.042280i -0.109854+0.409246i] r = roots(p) = [0.727250-0.636742i -0.469741-0.614789i -0.035692+0.565461i] Roots, r = [-0.160972-1.299157i 0.036193+1.019169i -1.046929+0.760191i -0.280465+0.361084i 0.780099+0.643584i 0.794379+1.032883i -0.190616-0.710921i] Polynomial, p = [1.000000+0.000000i 0.068312-1.806834i -0.158305-0.930377i -1.202161-3.461733i -3.908780+0.529733i -1.009816+0.365843i -1.368117+1.443013i 0.265664+0.718430i] r = roots(p) = [-0.160972-1.299157i -1.046929+0.760191i -0.190616-0.710921i 0.794379+1.032883i 0.780099+0.643584i 0.036193+1.019169i -0.280465+0.361084i] x = [1.323672+0.349763i 0.510483+0.174148i 0.475202-0.708159i -0.127081+0.388325i -0.572027-1.624474i -0.320883+0.183600i -1.023713+0.214321i -0.983530+0.261137i 1.133963-0.225782i] polyval(p, x) = [10.010566-7.090964i -1.057338+0.508034i 6.313101+3.020747i -0.067120+0.186664i 33.098080-42.921040i 0.345802-0.000105i -1.501636-4.154270i -1.503561-3.174843i -17.655443-0.481204i] Chebyshev polynomial x = [1.523584 -1.251292 0.658525 -0.859404 0.075397 -0.172018 -1.200352 -1.822961] cheb(10, x) = [9312.529843 520.885927 -0.617377 0.608798 -0.728487 0.157326 253.608153 88254.183938] cheb(15, x) = [1270915.019652 -16812.346582 0.977463 0.195158 -0.905276 0.521343 -5711.593426 -37078141.121001] itpp-4.3.1/tests/pulse_shape_test.cpp000066400000000000000000000066171216575753400177410ustar00rootroot00000000000000/*! * \file * \brief Pulse shaping classes test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace std; using namespace itpp; int main() { cout << "======================================" << endl; cout << " Test of pulse shaping routines " << endl; cout << "======================================" << endl << endl; BPSK bpsk; vec symbols, samples, rsymbols; Root_Raised_Cosine rrc_tx(0.5), rrc_rx(0.5); Raised_Cosine rc_tx(0.5); bpsk.modulate_bits(randb(20), symbols); samples = rrc_tx.shape_symbols(symbols); rsymbols = rrc_rx.shape_samples(samples); cout << "*** Root Raised Cosine; real input ***" << endl << endl; cout << "pulse, RRC = " << round_to_zero(rrc_tx.get_pulse_shape()) << endl << endl; cout << "symbols = " << round_to_zero(symbols) << endl << endl; cout << "samples = " << round_to_zero(samples) << endl << endl; cout << "received symbols =" << fixed << round_to_zero(rsymbols) << endl << endl; samples = rc_tx.shape_symbols(symbols); cout << "*** Raised Cosine; real input ***" << endl << endl; cout << "pulse, RC = " << fixed << round_to_zero(rc_tx.get_pulse_shape()) << endl << endl; cout << "symbols = " << fixed << round_to_zero(symbols) << endl << endl; cout << "samples = " << fixed << round_to_zero(samples) << endl << endl; QPSK qpsk; cvec csymbols, csamples, crsymbols; Root_Raised_Cosine > crrc_tx(0.5), crrc_rx(0.5); Raised_Cosine > crc_tx(0.5); qpsk.modulate_bits(randb(40), csymbols); csamples = crrc_tx.shape_symbols(csymbols); crsymbols = crrc_rx.shape_samples(csamples); cout << "*** Root Raised Cosine; complex input ***" << endl << endl; cout << "pulse, RRC = " << fixed << round_to_zero(crrc_tx.get_pulse_shape()) << endl << endl; cout << "symbols = " << fixed << round_to_zero(csymbols) << endl << endl; cout << "samples = " << fixed << round_to_zero(csamples) << endl << endl; cout << "received symbols = " << fixed << round_to_zero(crsymbols) << endl << endl; csamples = crc_tx.shape_symbols(csymbols); cout << "*** Raised Cosine; complex input ***" << endl << endl; cout << "pulse, RC = " << fixed << round_to_zero(crc_tx.get_pulse_shape()) << endl << endl; cout << "symbols = " << fixed << round_to_zero(csymbols) << endl << endl; cout << "samples = " << fixed << round_to_zero(csamples) << endl << endl; return 0; } itpp-4.3.1/tests/pulse_shape_test.ref000066400000000000000000000415741216575753400177340ustar00rootroot00000000000000====================================== Test of pulse shaping routines ====================================== *** Root Raised Cosine; real input *** pulse, RRC = [0.00107181 -0.0027027 -0.00581667 -0.00696875 -0.00530516 -0.000815537 0.00546883 0.0115738 0.0150053 0.0134306 0.00546883 -0.00861562 -0.0265258 -0.0440088 -0.0554523 -0.0549318 -0.0375132 -0.000532387 0.0554523 0.126288 0.204577 0.280729 0.344536 0.386975 0.401856 0.386975 0.344536 0.280729 0.204577 0.126288 0.0554523 -0.000532387 -0.0375132 -0.0549318 -0.0554523 -0.0440088 -0.0265258 -0.00861562 0.00546883 0.0134306 0.0150053 0.0115738 0.00546883 -0.000815537 -0.00530516 -0.00696875 -0.00581667 -0.0027027 0.00107181] symbols = [1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 1 -1 -1 1 1 1 1] samples = [0.00107181 -0.0027027 -0.00581667 -0.00696875 -0.00530516 -0.000815537 0.00546883 0.0115738 0.0160771 0.0107279 -0.000347842 -0.0155844 -0.031831 -0.0448243 -0.0499834 -0.0433579 -0.0235797 0.0156009 0.0667378 0.124641 0.183357 0.237536 0.283615 0.32047 0.348266 0.375715 0.400336 0.422601 0.440986 0.451841 0.449972 0.429801 0.387922 0.316443 0.222346 0.112079 -0.00530516 -0.119863 -0.222694 -0.307572 -0.372917 -0.413668 -0.438686 -0.453488 -0.462207 -0.465795 -0.461257 -0.442221 -0.399712 -0.337135 -0.239448 -0.109601 0.0424413 0.199281 0.338719 0.43788 0.476882 0.446999 0.350353 0.197618 0.0106103 -0.18205 -0.349657 -0.464741 -0.506893 -0.470147 -0.36129 -0.195987 0 0.195987 0.36129 0.470147 0.506893 0.464741 0.349657 0.18205 -0.0106103 -0.197618 -0.350353 -0.446999 -0.476882 -0.43788 -0.338719 -0.199281 -0.0424413 0.109601 0.239448 0.337135 0.399712 0.442221 0.461257 0.465795 0.462207 0.453488 0.438686 0.413668 0.373989 0.304869 0.216877 0.112894 0 -0.112894 -0.216877 -0.304869 -0.371845 -0.419073 -0.45032 -0.467426 -0.472817 -0.467426 -0.45032 -0.419073 -0.371845 -0.304869 -0.216877 -0.112894 0 0.112894 0.216877 0.304869 0.371845 0.419073 0.45032 0.467426 0.472817 0.467426 0.45032 0.419073 0.371845 0.304869 0.216877 0.112894 0 -0.112894 -0.216877 -0.304869 -0.371845 -0.419073 -0.45032 -0.467426 -0.472817 -0.467426 -0.45032 -0.419073 -0.369702 -0.310274 -0.228511 -0.126832 -0.0106103 0.111263 0.227815 0.328017 0.403999 0.440529 0.449624 0.436257 0.409155 0.377777 0.350353 0.332357] received symbols =[0.000001 -0.000006 -0.000005 0.000017 0.000060 0.000108 0.000126 0.000079 -0.000053 -0.000260 -0.000459 -0.000529 -0.000349 0.000141 0.000892 0.001719 0.002311 0.002310 0.001390 -0.000595 -0.003486 -0.006766 -0.009611 -0.011055 -0.010260 -0.006809 -0.001011 0.005985 0.012271 0.015480 0.013292 0.004050 -0.012643 -0.035502 -0.061385 -0.085526 -0.102115 -0.105115 -0.089194 -0.050552 0.012505 0.099367 0.207267 0.331800 0.467592 0.608946 0.750305 0.886429 1.012288 1.122740 1.212302 1.274914 1.304098 1.293529 1.237934 1.134168 0.982185 0.785654 0.552007 0.291785 0.017486 -0.257896 -0.522280 -0.765525 -0.979838 -1.159474 -1.299912 -1.396719 -1.444671 -1.437506 -1.368578 -1.232489 -1.027413 -0.757641 -0.435657 -0.082985 0.270607 0.589809 0.838190 0.983728 1.004510 0.893523 0.661493 0.336930 -0.036790 -0.407132 -0.720064 -0.928455 -0.999796 -0.921806 -0.705016 -0.381481 0.000000 0.381481 0.705016 0.921806 0.999798 0.928450 0.720059 0.407149 0.036850 -0.336822 -0.661366 -0.893445 -1.004564 -0.983988 -0.838649 -0.590337 -0.270956 0.083125 0.436549 0.759360 1.029723 1.234799 1.369968 1.436910 1.441185 1.389952 1.290301 1.148419 0.969578 0.758717 0.521268 0.263881 -0.005215 -0.276306 -0.538715 -0.781604 -0.994828 -1.169670 -1.299319 -1.379056 -1.406213 -1.380028 -1.301496 -1.173291 -0.999781 -0.787074 -0.543048 -0.277113 0.000120 0.277362 0.543291 0.787220 0.999674 1.172782 1.300588 1.378938 1.405394 1.379121 1.300851 1.172951 0.999563 0.786711 0.542382 0.276271 -0.000698 -0.277047 -0.541516 -0.783793] *** Raised Cosine; real input *** pulse, RC = [0.000000 0.001138 0.004773 0.010566 0.017149 0.022186 0.022750 0.015992 0.000000 -0.025329 -0.057613 -0.091717 -0.120042 -0.133416 -0.122502 -0.079525 0.000000 0.115879 0.262504 0.428983 0.600211 0.758749 0.887236 0.970942 1.000000 0.970942 0.887236 0.758749 0.600211 0.428983 0.262504 0.115879 0.000000 -0.079525 -0.122502 -0.133416 -0.120042 -0.091717 -0.057613 -0.025329 0.000000 0.015992 0.022750 0.022186 0.017149 0.010566 0.004773 0.001138 0.000000] symbols = [1.000000 1.000000 -1.000000 -1.000000 1.000000 -1.000000 1.000000 -1.000000 1.000000 1.000000 -1.000000 -1.000000 1.000000 1.000000 -1.000000 -1.000000 1.000000 1.000000 1.000000 1.000000] samples = [0.000000 0.001138 0.004773 0.010566 0.017149 0.022186 0.022750 0.015992 0.000000 -0.024191 -0.052840 -0.081151 -0.102893 -0.111230 -0.099752 -0.063533 0.000000 0.089413 0.200118 0.326700 0.463020 0.603147 0.741985 0.875425 1.000000 1.111012 1.202580 1.268882 1.303315 1.298961 1.249492 1.150354 1.000000 0.802004 0.564616 0.298633 0.017149 -0.265881 -0.537094 -0.784874 -1.000000 -1.176821 -1.311877 -1.401244 -1.440506 -1.424483 -1.347831 -1.206529 -1.000000 -0.733079 -0.417095 -0.071882 0.274382 0.587650 0.832369 0.977046 1.000000 0.892129 0.662099 0.338713 -0.034298 -0.404216 -0.717144 -0.926388 -1.000000 -0.924113 -0.707598 -0.383084 0.000000 0.383084 0.707598 0.924113 1.000000 0.926388 0.717144 0.404216 0.034298 -0.338713 -0.662099 -0.892129 -1.000000 -0.977046 -0.832369 -0.587650 -0.274382 0.071882 0.417095 0.733079 1.000000 1.206529 1.347831 1.424483 1.440506 1.401244 1.311877 1.176821 1.000000 0.786012 0.541866 0.276447 0.000000 -0.276447 -0.541866 -0.786012 -1.000000 -1.174545 -1.302332 -1.380112 -1.406208 -1.380112 -1.302332 -1.174545 -1.000000 -0.786012 -0.541866 -0.276447 0.000000 0.276447 0.541866 0.786012 1.000000 1.174545 1.302332 1.380112 1.406208 1.380112 1.302332 1.174545 1.000000 0.786012 0.541866 0.276447 0.000000 -0.276447 -0.541866 -0.786012 -1.000000 -1.174545 -1.302332 -1.380112 -1.406208 -1.380112 -1.302332 -1.174545 -1.000000 -0.783736 -0.532321 -0.255315 0.034298 0.320819 0.587366 0.817996 1.000000 1.126163 1.196652 1.217811 1.200422 1.157652 1.102828 1.047479] *** Root Raised Cosine; complex input *** pulse, RRC = [0.001072 -0.002703 -0.005817 -0.006969 -0.005305 -0.000816 0.005469 0.011574 0.015005 0.013431 0.005469 -0.008616 -0.026526 -0.044009 -0.055452 -0.054932 -0.037513 -0.000532 0.055452 0.126288 0.204577 0.280729 0.344536 0.386975 0.401856 0.386975 0.344536 0.280729 0.204577 0.126288 0.055452 -0.000532 -0.037513 -0.054932 -0.055452 -0.044009 -0.026526 -0.008616 0.005469 0.013431 0.015005 0.011574 0.005469 -0.000816 -0.005305 -0.006969 -0.005817 -0.002703 0.001072] symbols = [0.000000+1.000000i 0.000000+1.000000i 1.000000+0.000000i 1.000000+0.000000i 0.000000-1.000000i -1.000000+0.000000i 0.000000+1.000000i -1.000000+0.000000i 0.000000-1.000000i -1.000000+0.000000i 0.000000-1.000000i -1.000000+0.000000i 1.000000+0.000000i -1.000000+0.000000i 1.000000+0.000000i 0.000000-1.000000i 1.000000+0.000000i -1.000000+0.000000i 0.000000-1.000000i 0.000000+1.000000i] samples = [0.000000+0.001072i 0.000000-0.002703i 0.000000-0.005817i 0.000000-0.006969i 0.000000-0.005305i 0.000000-0.000816i 0.000000+0.005469i 0.000000+0.011574i 0.000000+0.016077i 0.000000+0.010728i 0.000000-0.000348i 0.000000-0.015584i 0.000000-0.031831i 0.000000-0.044824i 0.000000-0.049983i 0.000000-0.043358i 0.001072-0.022508i -0.002703+0.012898i -0.005817+0.060921i -0.006969+0.117673i -0.005305+0.178052i -0.000816+0.236720i 0.005469+0.289084i 0.011574+0.332044i 0.016077+0.364343i 0.010728+0.386443i -0.000348+0.399988i -0.015584+0.407017i -0.031831+0.409155i -0.044824+0.407017i -0.049983+0.399988i -0.043358+0.386443i -0.022508+0.363271i 0.012898+0.334746i 0.060921+0.294901i 0.117673+0.243689i 0.178052+0.183357i 0.236720+0.118488i 0.289084+0.055452i 0.332044+0.001324i 0.363271-0.037513i 0.389146-0.056789i 0.405805-0.055452i 0.413986-0.036209i 0.414460-0.005305i 0.407833+0.028424i 0.394520+0.055104i 0.374869+0.065660i 0.349337+0.054662i 0.318613+0.009404i 0.283615-0.055800i 0.245336-0.134072i 0.204577-0.215188i 0.161681-0.288513i 0.116373-0.344884i 0.067830-0.378104i 0.013933-0.385779i -0.040123-0.373545i -0.099619-0.339067i -0.164144-0.289345i -0.231103-0.231103i -0.295498-0.170297i -0.350353-0.110905i -0.387821-0.054399i -0.400784-0.001072i -0.388832+0.057102i -0.344536+0.116721i -0.272929+0.177266i -0.183357+0.236408i -0.089248+0.290160i -0.005817+0.333598i 0.052761+0.361971i 0.075026+0.371845i 0.058167+0.361971i 0.005817+0.333598i -0.075311+0.290160i -0.172746+0.236408i -0.271298+0.177266i -0.355474+0.116721i -0.411980+0.057102i -0.431866-0.002144i -0.411980-0.051697i -0.355474-0.105088i -0.271298-0.163328i -0.172746-0.225798i -0.075311-0.288529i 0.005817-0.344536i 0.058167-0.385119i 0.072883-0.401856i 0.058167-0.388832i 0.005817-0.344536i -0.075311-0.272929i -0.172746-0.183357i -0.271298-0.089248i -0.355474-0.005817i -0.411980+0.052761i -0.430795+0.076098i -0.414682+0.055464i -0.361290+0.000000i -0.278267-0.082279i -0.178052-0.178052i -0.076126-0.272113i 0.011285-0.350005i 0.069741-0.400406i 0.087888-0.416861i 0.071597-0.398549i 0.011285-0.350005i -0.083926-0.279913i -0.199272-0.199272i -0.315307-0.119319i -0.410926-0.049636i -0.466912+0.003235i -0.468308+0.036441i -0.415215+0.054932i -0.305838+0.055452i -0.151978+0.044009i 0.026526+0.026526i 0.204603+0.008616i 0.355822-0.005469i 0.456716-0.013431i 0.490816-0.016077i 0.455870-0.008871i 0.350005+0.000348i 0.189834+0.007784i 0.000000+0.010610i -0.189834+0.007784i -0.350005+0.000348i -0.455870-0.008871i -0.490816-0.016077i -0.456716-0.013431i -0.355822-0.005469i -0.204603+0.008616i -0.026526+0.026526i 0.151978+0.044009i 0.305838+0.055452i 0.415215+0.054932i 0.467236+0.037513i 0.469614+0.000532i 0.416743-0.055452i 0.322275-0.126288i 0.204577-0.204577i 0.084742-0.280729i -0.016754-0.344536i -0.083171-0.386975i -0.103965-0.402928i -0.080469-0.384273i -0.010938-0.338719i 0.091711-0.273760i 0.209883-0.199272i 0.323091-0.125473i 0.411274-0.060921i 0.458040-0.011041i 0.453302+0.023580i 0.399082+0.038798i 0.294553+0.044167i 0.153625+0.045656i -0.005305+0.047746i -0.161409+0.051809i -0.294901+0.055452i -0.390210+0.053075i] received symbols = [0.000000+0.000001i 0.000000-0.000006i 0.000000-0.000005i 0.000000+0.000017i 0.000000+0.000060i 0.000000+0.000108i 0.000000+0.000126i 0.000000+0.000079i 0.000000-0.000053i 0.000000-0.000260i 0.000000-0.000459i 0.000000-0.000529i 0.000000-0.000349i 0.000000+0.000141i 0.000000+0.000892i 0.000000+0.001719i 0.000001+0.002312i -0.000006+0.002305i -0.000005+0.001385i 0.000017-0.000579i 0.000060-0.003426i 0.000108-0.006658i 0.000126-0.009485i 0.000079-0.010976i -0.000053-0.010313i -0.000260-0.007069i -0.000459-0.001471i -0.000529+0.005456i -0.000349+0.011922i 0.000141+0.015620i 0.000892+0.014184i 0.001719+0.005769i 0.002312-0.010333i 0.002305-0.033186i 0.001385-0.059990i -0.000579-0.086138i -0.003426-0.105661i -0.006658-0.111989i -0.009485-0.098931i -0.010976-0.061685i -0.010314+0.002302i -0.007063+0.092801i -0.001466+0.206699i 0.005440+0.338363i 0.011862+0.480392i 0.015512+0.624609i 0.014058+0.763083i 0.005690+0.888996i -0.010278+0.997169i -0.032937+1.084175i -0.059541+1.148175i -0.085577+1.188314i -0.105192+1.204122i -0.111914+1.195063i -0.099571+1.160396i -0.063247+1.099435i -0.000120+1.012159i 0.089993+0.900010i 0.204411+0.766705i 0.337835+0.618606i 0.482940+0.464635i 0.631225+0.315539i 0.773973+0.182576i 0.903175+0.075801i 1.012268+0.002266i 1.096622-0.035478i 1.153783-0.040276i 1.183319-0.020320i 1.186516+0.011862i 1.165920+0.041272i 1.124819+0.052868i 1.066713+0.034105i 0.994820-0.022857i 0.911647-0.119715i 0.818701-0.251602i 0.716270-0.407774i 0.603479-0.573253i 0.478594-0.731099i 0.339609-0.864891i 0.185077-0.960953i 0.015081-1.009967i -0.167835-1.007723i -0.357972-0.955093i -0.546256-0.857087i -0.720653-0.721531i -0.867300-0.557618i -0.972284-0.374661i -1.023847-0.181260i -1.014681+0.015046i -0.943850+0.207705i -0.818053+0.390826i -0.651585+0.558818i -0.465105+0.706183i -0.283197+0.827573i -0.131038+0.918115i -0.030649+0.973906i 0.002621+0.992520i -0.037218+0.973327i -0.145417+0.917627i -0.306824+0.828276i -0.497878+0.709200i -0.690038+0.564840i -0.854093+0.399725i -0.964708+0.218342i -1.004439+0.025360i -0.966540-0.173858i -0.856233-0.372610i -0.689921-0.562421i -0.492723-0.732984i -0.294640-0.872724i -0.125951-0.970048i -0.012572-1.015138i 0.027927-1.002000i -0.010987-0.930320i -0.123717-0.806735i -0.293400-0.644944i -0.494392-0.464635i -0.696100-0.289202i -0.867572-0.142546i -0.982195-0.045492i -1.021794-0.012427i -0.979533-0.048808i -0.861206-0.150063i -0.684588-0.302052i -0.476966-0.483120i -0.271146-0.667381i -0.100476-0.828686i 0.006408-0.944579i 0.030327-0.999562i -0.034962-0.987120i -0.181109-0.910303i -0.385773-0.780568i -0.615461-0.615461i -0.830293-0.435497i -0.990035-0.260841i -1.060535-0.108377i -1.019531+0.010358i -0.860858+0.090129i -0.596432+0.131778i -0.255209+0.141026i 0.120479+0.126633i 0.480889+0.098353i 0.776236+0.065092i 0.964341+0.033616i 1.017335+0.007966i 0.926299-0.010392i 0.703129-0.021886i 0.379080-0.027851i 0.000349-0.029528i -0.378692-0.027364i -0.703562-0.020797i -0.927758-0.008582i -1.019594+0.010442i -0.966725+0.036351i -0.777747+0.067258i -0.480418+0.098756i -0.117113+0.123966i 0.261851+0.134285i 0.605922+0.120766i 0.871840+0.075877i] *** Raised Cosine; complex input *** pulse, RC = [0.000000 0.001138 0.004773 0.010566 0.017149 0.022186 0.022750 0.015992 0.000000 -0.025329 -0.057613 -0.091717 -0.120042 -0.133416 -0.122502 -0.079525 0.000000 0.115879 0.262504 0.428983 0.600211 0.758749 0.887236 0.970942 1.000000 0.970942 0.887236 0.758749 0.600211 0.428983 0.262504 0.115879 0.000000 -0.079525 -0.122502 -0.133416 -0.120042 -0.091717 -0.057613 -0.025329 0.000000 0.015992 0.022750 0.022186 0.017149 0.010566 0.004773 0.001138 0.000000] symbols = [0.000000+1.000000i 0.000000+1.000000i 1.000000+0.000000i 1.000000+0.000000i 0.000000-1.000000i -1.000000+0.000000i 0.000000+1.000000i -1.000000+0.000000i 0.000000-1.000000i -1.000000+0.000000i 0.000000-1.000000i -1.000000+0.000000i 1.000000+0.000000i -1.000000+0.000000i 1.000000+0.000000i 0.000000-1.000000i 1.000000+0.000000i -1.000000+0.000000i 0.000000-1.000000i 0.000000+1.000000i] samples = [0.000000+0.000000i 0.000000+0.001138i 0.000000+0.004773i 0.000000+0.010566i 0.000000+0.017149i 0.000000+0.022186i 0.000000+0.022750i 0.000000+0.015992i 0.000000+0.000000i 0.000000-0.024191i 0.000000-0.052840i 0.000000-0.081151i 0.000000-0.102893i 0.000000-0.111230i 0.000000-0.099752i 0.000000-0.063533i 0.000000+0.000000i 0.001138+0.090550i 0.004773+0.204891i 0.010566+0.337266i 0.017149+0.480169i 0.022186+0.625333i 0.022750+0.764734i 0.015992+0.891417i 0.000000+1.000000i -0.024191+1.086821i -0.052840+1.149740i -0.081151+1.187731i -0.102893+1.200422i -0.111230+1.187731i -0.099752+1.149740i -0.063533+1.086821i 0.000000+1.000000i 0.090550+0.890279i 0.204891+0.759962i 0.337266+0.614767i 0.480169+0.463020i 0.625333+0.315080i 0.764734+0.182141i 0.891417+0.074558i 1.000000+0.000000i 1.085683-0.038204i 1.144967-0.042139i 1.177165-0.019513i 1.183273+0.017149i 1.165546+0.052265i 1.126990+0.069662i 1.070829+0.055334i 1.000000+0.000000i 0.916746-0.098750i 0.822347-0.234981i 0.717050-0.396231i 0.600211-0.565913i 0.470682-0.725997i 0.327393-0.859714i 0.170076-0.953812i 0.000000-1.000000i -0.180550-0.996271i -0.367029-0.944849i -0.550779-0.850465i -0.720253-0.720253i -0.862085-0.562398i -0.962826-0.385005i -1.011125-0.195404i -1.000000+0.000000i -0.929621+0.194267i -0.806874+0.380233i -0.644846+0.551832i -0.463020+0.703104i -0.285001+0.828280i -0.135229+0.922099i -0.035217+0.980279i 0.000000+1.000000i -0.037492+0.980279i -0.144775+0.922099i -0.306133+0.828280i -0.497318+0.703104i -0.689217+0.551832i -0.852373+0.380233i -0.961605+0.194267i -1.000000+0.000000i -0.961605-0.196542i -0.852373-0.389778i -0.689217-0.572964i -0.497318-0.737402i -0.306133-0.872651i -0.144775-0.967598i -0.037492-1.012263i 0.000000-1.000000i -0.037492-0.929621i -0.144775-0.806874i -0.306133-0.644846i -0.497318-0.463020i -0.689217-0.285001i -0.852373-0.135229i -0.961605-0.035217i -1.000000+0.000000i -0.960467-0.036354i -0.847600-0.140002i -0.678651-0.295567i -0.480169-0.480169i -0.283947-0.667032i -0.122025-0.829623i -0.021500-0.945613i 0.000000-1.000000i -0.062821-0.986934i -0.202388-0.909986i -0.397850-0.780934i -0.617360-0.617360i -0.822633-0.439549i -0.974875-0.267277i -1.041130-0.117017i -1.000000+0.000000i -0.844588+0.079525i -0.585096+0.122502i -0.249669+0.133416i 0.120042+0.120042i 0.474801+0.091717i 0.765211+0.057613i 0.949442+0.025329i 1.000000+0.000000i 0.909258-0.017130i 0.689621-0.027522i 0.371465-0.032752i 0.000000-0.034298i -0.371465-0.032752i -0.689621-0.027522i -0.909258-0.017130i -1.000000+0.000000i -0.949442+0.025329i -0.765211+0.057613i -0.474801+0.091717i -0.120042+0.120042i 0.249669+0.133416i 0.585096+0.122502i 0.844588+0.079525i 1.000000+0.000000i 1.039992-0.115879i 0.970102-0.262504i 0.812067-0.428983i 0.600211-0.600211i 0.375664-0.758749i 0.179638-0.887236i 0.046829-0.970942i 0.000000-1.000000i 0.045691-0.972079i 0.174865-0.892009i 0.365098-0.769315i 0.583062-0.617360i 0.789881-0.451168i 0.947352-0.285253i 1.024000-0.131871i 1.000000+0.000000i 0.871054+0.105992i 0.647482+0.184887i 0.351951+0.235699i 0.017149+0.257233i -0.319200+0.247318i -0.619960+0.202864i -0.853925+0.120846i] itpp-4.3.1/tests/qr_test.cpp000066400000000000000000000127601216575753400160470ustar00rootroot00000000000000/*! * \file * \brief QR factorisation test program * \author Tony Ottosson, Adam Piatyszek and Vasek Smidl * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "=================================" << endl; cout << "Test of QR factorization routines" << endl; cout << "=================================" << endl; { cout << "QR of Real matrix" << endl; mat Q, R, e; mat A = randn(5, 5); qr(A, Q, R); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - Q*R) = " << round_to_zero(norm(A - Q * R)) << endl << endl; // This does not give same sizes as matlab. Why???!!!!! A = randn(4, 2); qr(A, Q, R); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - Q*R) = " << round_to_zero(norm(A - Q * R)) << endl << endl; A = randn(2, 4); qr(A, Q, R); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - Q*R) = " << round_to_zero(norm(A - Q * R)) << endl << endl; } { cout << "QR of Real matrix without Q" << endl; mat R; mat A = randn(5, 5); qr(A, R); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A.T()*A - R.T()*R) = " << round_to_zero(norm(A.T()*A - R.T()*R)) << endl << endl; A = randn(4, 2); qr(A, R); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A.T()*A - R.T()*R) = " << round_to_zero(norm(A.T()*A - R.T()*R)) << endl << endl; A = randn(2, 4); qr(A, R); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A.T()*A - R.T()*R) = " << round_to_zero(norm(A.T()*A - R.T()*R)) << endl << endl; } { cout << "QR of Real matrix with pivoting" << endl; mat Q, R, e; bmat P; mat A = randn(5, 5); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*mat(P) - Q*R) = " << round_to_zero(norm(e)) << endl << endl; // This does not give same sizes as matlab. Why???!!!!! A = randn(4, 2); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*mat(P) - Q*R) = " << round_to_zero(norm(e)) << endl << endl; A = randn(2, 4); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*mat(P) - Q*R) = " << round_to_zero(norm(e)) << endl << endl; } { cout << "QR of Complex matrix" << endl; cmat A = randn_c(5, 5); cmat Q, R, e; qr(A, Q, R); e = A - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - Q*R) = " << round_to_zero(norm(e)) << endl << endl; // This does not give same sizes as matlab. Why???!!!!! A = randn_c(4, 2); qr(A, Q, R); e = A - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - Q*R) = " << round_to_zero(norm(e)) << endl << endl; A = randn_c(2, 4); qr(A, Q, R); e = A - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - Q*R) = " << round_to_zero(norm(e)) << endl << endl; } { cout << "QR of Complex matrix without Q" << endl; cmat A = randn_c(5, 5); cmat R, e; qr(A, R); e = A.H() * A - R.H() * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A.H()*A - R.H()*R) = " << round_to_zero(norm(e)) << endl << endl; A = randn_c(4, 2); qr(A, R); e = A.H() * A - R.H() * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A.H()*A - R.H()*R) = " << round_to_zero(norm(e)) << endl << endl; A = randn_c(2, 4); qr(A, R); e = A.H() * A - R.H() * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A.H()*A - R.H()*R) = " << round_to_zero(norm(e)) << endl << endl; } { cout << "QR of Complex matrix with pivoting" << endl; cmat A = randn_c(5, 5); cmat Q, R, e; bmat P; qr(A, Q, R, P); e = A * to_mat(P) - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*mat(P) - Q*R) = " << round_to_zero(norm(e)) << endl << endl; // This does not give same sizes as matlab. Why???!!!!! A = randn_c(4, 2); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*mat(P) - Q*R) = " << round_to_zero(norm(e)) << endl << endl; A = randn_c(2, 4); qr(A, Q, R, P); e = A * to_mat(P) - Q * R; cout << "A = " << round_to_zero(A) << endl; cout << "norm(A*mat(P) - Q*R) = " << round_to_zero(norm(e)) << endl << endl; } return 0; } itpp-4.3.1/tests/qr_test.ref000066400000000000000000000106141216575753400160350ustar00rootroot00000000000000================================= Test of QR factorization routines ================================= QR of Real matrix A = [[-0.283885 0.56497 -1.0746 -0.732016 -0.869443] [1.36446 -0.596145 2.36476 -2.10553 -0.0504762] [0.906001 -1.19732 2.36508 -0.923457 0.799682] [1.24942 -1.26756 1.22804 -1.89227 1.02849] [1.55783 -0.300385 0.234136 -0.664315 -0.900489]] norm(A - Q*R) = 0 A = [[-0.227649 -1.48058] [-1.83729 1.07507] [0.0511841 -0.396638] [1.44132 0.51065]] norm(A - Q*R) = 0 A = [[1.10323 1.12342 -0.269572 1.87195] [0.910165 1.46072 -1.00539 0.494639]] norm(A - Q*R) = 0 QR of Real matrix without Q A = [[0.721932 0.549174 -1.44775 -0.319305 0.075397] [0.246282 -0.808968 0.303095 1.52358 -0.172018] [0.672038 -2.29735 -1.39092 -1.25129 -1.20035] [-1.00149 -0.453797 0.369303 0.658525 -1.82296] [-0.179719 0.259649 1.60367 -0.859404 0.796193]] norm(A.T()*A - R.T()*R) = 0 A = [[-0.0977113 0.393591] [-1.16267 0.84653] [1.34814 -0.269572] [-0.181114 -0.184428]] norm(A.T()*A - R.T()*R) = 0 A = [[0.109679 -0.939679 0.849141 -0.115989] [-0.26294 0.462237 -0.309417 -0.49744]] norm(A.T()*A - R.T()*R) = 0 QR of Real matrix with pivoting A = [[0.312621 1.27429 -0.901661 -1.22057 -0.417785] [0.897405 -0.32882 -1.76627 0.878319 0.954855] [0.1234 1.36355 0.480208 -0.5088 -0.673021] [-0.421365 1.18344 0.0332149 0.867379 0.170602] [0.419113 -0.675009 -0.256686 0.716969 -1.21233]] norm(A*mat(P) - Q*R) = 0 A = [[-0.0915031 -1.18677] [0.797619 0.750496] [0.914909 -0.330124] [0.496313 -0.532099]] norm(A*mat(P) - Q*R) = 0 A = [[1.35402 0.395377 -2.93901 -0.245957] [1.35716 -0.234376 -0.609542 -0.942463]] norm(A*mat(P) - Q*R) = 0 QR of Complex matrix A = [[-0.180822+0.135151i 0.369685+1.30784i 0.358469-0.553286i -0.639508-0.0358186i -0.540905+0.0171929i] [0.431443+0.735259i 0.644844-0.64014i 0.0173776+0.166865i 0.726389+0.0141512i -0.304334+0.475183i] [0.373431-0.43385i -0.467499+0.248209i 0.139432-0.304968i -1.15327+0.878131i 0.136609-0.303096i] [-0.288087+0.43428i -0.110927+0.289013i 1.67774+0.214558i -0.401499-0.367446i 0.899195-0.0308906i] [-0.328699-0.497205i 0.366511+0.840226i -0.605614+0.544018i 0.689669+0.826762i -0.182278+0.540058i]] norm(A - Q*R) = 0 A = [[-0.207293-0.6724i -0.550361+0.338276i] [-0.329522+2.25393i -0.300265+0.559865i] [-0.170705-0.25516i 0.00183951+0.242933i] [1.69291+0.49826i 0.543132-0.612738i]] norm(A - Q*R) = 0 A = [[0.588127+1.65792i 0.663596+0.89475i -0.951271-1.04226i 0.405477+0.301014i] [-0.393007-0.293208i 0.303812-1.0207i -0.386231-0.37374i 0.506654+0.960425i]] norm(A - Q*R) = 0 QR of Complex matrix without Q A = [[0.975944+0.335689i -0.189326-0.618709i -0.541688-0.934058i 0.243942-0.735716i -0.162513-0.149577i] [0.747608+0.158062i 0.491061+1.16609i 0.686608-1.25157i -0.246661-0.417594i -0.203973+1.13481i] [0.51012+1.00245i -0.145443+0.983717i -0.584849-1.01874i 0.310173+0.476513i 0.870201+0.523148i] [-0.229429+0.0881398i -0.213724-0.731866i 0.76928+0.000212176i -0.810911-0.131968i -0.765188-0.748296i] [-0.58438+0.126475i 0.217072-0.253027i 0.228199-0.44241i -0.799134-1.16319i 1.57135+0.359823i]] norm(A.H()*A - R.H()*R) = 0 A = [[0.0693729-0.753371i 0.531057-1.18005i] [-0.612721-0.13247i -1.24755+0.926539i] [-0.544132+0.132892i -0.38808+1.65558i] [-0.419233+1.2231i -0.23692+1.54007i]] norm(A.H()*A - R.H()*R) = 0 A = [[0.101457-0.125741i -0.392005-0.673579i 0.353439+0.134666i 0.81203-0.648739i] [0.741277+0.247239i 0.184505-0.562731i -0.181077+0.0856875i -0.917434-0.26573i]] norm(A.H()*A - R.H()*R) = 0 QR of Complex matrix with pivoting A = [[-0.643503+1.73417i -0.748152+0.212312i -0.0270121-0.300359i -0.988922+0.249059i 0.745347+0.0900309i] [0.456608+0.707365i -0.434625+0.238697i 0.101718+0.158826i -0.589429+0.887644i -0.997146+0.977005i] [0.00694129-0.0307072i -0.566399+0.590754i -0.502674-0.63153i 0.582224-0.0248339i 0.114152-0.140535i] [0.157592-0.580597i -0.835156-0.158393i -0.612888+0.460076i 0.78084+0.15159i 0.87207+0.389236i] [0.937583+0.0732077i -0.157269+0.0125424i -0.878953+0.378644i -0.305971-0.415223i -0.558537+0.276085i]] norm(A*mat(P) - Q*R) = 0 A = [[0.862114-1.06655i -1.48735+0.0430125i] [0.16668+0.259354i -0.665631-0.370575i] [-0.144917+0.117112i -0.431749-1.12362i] [0.628333-0.659098i -1.24675+0.58196i]] norm(A*mat(P) - Q*R) = 0 A = [[0.342779+0.461418i 1.34271-0.00076101i 0.195876+0.425358i -0.438732+0.463633i] [0.702588+0.110563i -0.48476+1.40989i 0.748408+0.410579i 0.247649-0.737889i]] norm(A*mat(P) - Q*R) = 0 itpp-4.3.1/tests/rand_core_test.cpp000066400000000000000000000634331216575753400173640ustar00rootroot00000000000000/*! * \file * \brief Random Number generation core tests * \author Andy Panov * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2012 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include #include #include #include #ifdef _OPENMP //should work on both gcc & msvc (it is an omp standard requirement) #include #endif //tests vectors are taken from dSFMT package (v 2.2) //Here is the package license /* Copyright (c) 2007, 2008, 2009 Mutsuo Saito, Makoto Matsumoto and Hiroshima University. Copyright (c) 2011, 2002 Mutsuo Saito, Makoto Matsumoto, Hiroshima University and The University of Tokyo. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Hiroshima University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ //init_gen_rand(0) generated randoms [1, 2) double ref_result1[] = { 1.030581026769374, 1.213140320067012, 1.299002525016001, 1.381138853044628, 1.863488397063594, 1.133443440024236, 1.073465290616508, 1.924735636004535, 1.642876178923654, 1.135658049473512, 1.614181131134505, 1.758658396495576, 1.629675660963117, 1.280639430198043, 1.450236428147610, 1.493660282874514, 1.814271115361793, 1.167373211634437, 1.029478262306546, 1.995645230878212, 1.571796427913721, 1.820991494675444, 1.342215733241735, 1.623155152394482, 1.770877090925340, 1.971604009986542, 1.291307503466583, 1.042482713804030, 1.489892341518318, 1.846505153340657, 1.464614144455080, 1.722998990286586, 1.261140462560469, 1.466608076171318, 1.284476538780147, 1.566267595424500, 1.214877812942994, 1.814025145094890, 1.875364841982453, 1.420058799919090, 1.185941915813226, 1.613435647553408, 1.261307303980314, 1.575227905977901, 1.368593422560852, 1.178339827374882, 1.617026203567302, 1.605806966367909, 1.688420982162701, 1.271452757436403, 1.380651074471749, 1.923694230059664, 1.183689647854999, 1.813616738156070, 1.674316771173891, 1.388616443854270, 1.112619958524579, 1.143443226388526, 1.044504544026019, 1.059792215140743, 1.473318469170684, 1.907724040304600, 1.840641748107302, 1.880247376378763, 1.662300761822745, 1.756077893716310, 1.794902408257739, 1.208089693203264, 1.573346980275286, 1.343298418696786, 1.290031288673300, 1.785887855614908, 1.469555312775962, 1.303565840269790, 1.821346312600028, 1.464630963746065, 1.350918117062525, 1.608975946390805, 1.218770519593969, 1.553737984201091, 1.799048445169658, 1.934409566880829, 1.518706598932114, 1.806743174028226, 1.445770445550219, 1.853994985463463, 1.294940116346864, 1.846933188597791, 1.585285299858689, 1.436399337803629, 1.984097327010455, 1.104286003167359, 1.650974773825423, 1.509620107806257, 1.257788148487937, 1.343504084778931, 1.949774691002465, 1.575826707171932, 1.334309761521545, 1.970145826389876, 1.634179511150286, 1.117295679338137, 1.975634802490159, 1.876312964236097, 1.588415777998304, 1.655714874553697, 1.333606641414210, 1.534065546092020, 1.430491671060673, 1.948237416318885, 1.221039675791948, 1.002582148951994, 1.154359196718931, 1.871051234557714, 1.608929525044202, 1.314753139712890, 1.024921298185855, 1.269548213986646, 1.311905073508091, 1.820250418624237, 1.530899807500864, 1.382415501216911, 1.723050693688422, 1.273273073610244, 1.313899532538009, 1.788939639818993, 1.876299000001360, 1.991333199989678, 1.991820254950511, 1.030433951689168, 1.676262472193616, 1.508094775671104, 1.379478805615782, 1.669062560664250, 1.454294977515323, 1.058637649351106, 1.762305416761906, 1.259329140543268, 1.069306898227167, 1.416672040871633, 1.692817632828360, 1.325016179312241, 1.894413502990435, 1.065827451446854, 1.648472088974056, 1.136729079291305, 1.577029131655685, 1.770630083651844, 1.312969529843681, 1.120742660491037, 1.381749920757092, 1.532127565299400, 1.430576333290474, 1.408675485986594, 1.664550700542242, 1.808244181927591, 1.449745796589231, 1.561376218313360, 1.823412610420372, 1.175033367831775, 1.302133406247658, 1.209386996910797, 1.958852403617822, 1.327413109121052, 1.905326191931480, 1.243341689973321, 1.171964300933144, 1.947795532949568, 1.406088608658097, 1.352799736126945, 1.038567042456604, 1.952366632464022, 1.271894317271382, 1.276879063784723, 1.962232899932226, 1.635977123253224, 1.427227475039741, 1.902767774021188, 1.348976205109293, 1.098551616320939, 1.761303753087471, 1.725151135219154, 1.973647280723666, 1.438406762461431, 1.976338460962363, 1.080691466989757, 1.302440271222677, 1.524443530330429, 1.677973975664305, 1.899365828945253, 1.758064697654786, 1.664994321814212, 1.702509799458075, 1.542285497404383, 1.583785005757146, 1.364775251860427, 1.914911483830064, 1.492662121733521, 1.803292510850298, 1.913612505233413, 1.990030445920955, 1.265653421547230, 1.371464451146616, 1.812272753750019, 1.468314372775775, 1.962074516808028, 1.071993018163613, 1.362232923167970, 1.286098054243162, 1.166494117866721, 1.190627308126986, 1.336522203701874, 1.589002579609417, 1.989085299207313, 1.886248617042378, 1.494809620088929, 1.210511688798404, 1.373900882339293, 1.529044652411248, 1.599366524611929, 1.436552769988409, 1.577285005915829, 1.688182285296122, 1.277637471607439, 1.929554385968616, 1.823441682648089, 1.922013798503081, 1.645761293216693, 1.431349251849024, 1.762959265242032, 1.878537838979557, 1.999467237190877, 1.485220104894368, 1.716411480065391, 1.412097187018955, 1.552070069949518, 1.892433293954831, 1.503681065768480, 1.856696961604681, 1.652070478210699, 1.941264820695600, 1.747443060523082, 1.340963648345302, 1.115605969659878, 1.350907250724354, 1.815702983867849, 1.598890428370514, 1.439048661943484, 1.517663378502000, 1.304964768398997, 1.079026972256675, 1.524811537337526, 1.316547675188607, 1.138964396377513, 1.662996685355875, 1.267094641341935, 1.501239512928825, 1.102282578729245, 1.681064147709950, 1.806571233091203, 1.723576229776429, 1.736972959477229, 1.912237952025255, 1.660774311421941, 1.025816042908814, 1.438547835995945, 1.739013210613549, 1.413224917267124, 1.358475319974022, 1.358765432047162, 1.593140545500734, 1.172245654090473, 1.930726901246793, 1.162761062259565, 1.318549211468092, 1.092783981301198, 1.555764474221963, 1.708252060788802, 1.269806348212832, 1.852955157375948, 1.907379745865761, 1.486699553976457, 1.515744472393222, 1.620128750267234, 1.622430346507121, 1.668132516832666, 1.796788360374040, 1.636602348582785, 1.773593519549434, 1.258248394226789, 1.246140312082405, 1.015163448535963, 1.521503953242567, 1.140634382438487, 1.702118160723025, 1.132078836187980, 1.963663308022001, 1.452227189409805, 1.832632887982046, 1.261616333794024, 1.803214901972612, 1.388570383844696, 1.643765598586203, 1.619544270246625, 1.307755937472623, 1.857004438119476, 1.398636660692930, 1.556031209947539, 1.641338721048474, 1.115939103561434, 1.654221123345289, 1.150482842848706, 1.494319794557959, 1.788401632203792, 1.025831928414729, 1.042464682154734, 1.886776958738527, 1.968746864493441, 1.159635330475675, 1.956557704773203, 1.284243453753799, 1.572925045526015, 1.859321130727941, 1.005189956275669, 1.005337392745185, 1.442294781323312, 1.890812262600537, 1.206329358583467, 1.026098286977865, 1.047660975111641, 1.037196173307690, 1.743350801362402, 1.274336569674040, 1.719733191271306, 1.241944533170590, 1.761242705869024, 1.087057719955586, 1.923433325400596, 1.769554882850761, 1.422355508046144, 1.335735282689950, 1.969166433701194, 1.309113579529401, 1.934488263782031, 1.363050605738272, 1.205012399069315, 1.702636620368798, 1.377299901239738, 1.082603967707894, 1.707678198781335, 1.357839171792981, 1.249151205817995, 1.414407072442705, 1.758876753195856, 1.947897139275915, 1.873737405944571, 1.864011982004539, 1.197733232912529, 1.708750747026161, 1.584026807407247, 1.464232596280593, 1.910020147544669, 1.107379834907888, 1.431311422166039, 1.656031749095368, 1.583060053927119, 1.338823782349183, 1.675841451609077, 1.863125002352507, 1.383321945211853, 1.437552865439453, 1.323329267004908, 1.510393439678810, 1.381858897252844, 1.488904172419540, 1.703038148781844, 1.363689874508434, 1.782902379399008, 1.207151750281740, 1.134081954739325, 1.786230025908168, 1.301807943529430, 1.818037084625490, 1.954083924684191, 1.503136817574214, 1.166174793570306, 1.905851898350567, 1.861611595448786, 1.912073551209336, 1.311539667277574, 1.348138517947969, 1.835216223115592, 1.848638059772834, 1.508211065551719, 1.501558584290350, 1.841635694216024, 1.695119173143315, 1.454484117280340, 1.625646404371770, 1.119869639433384, 1.444195622035266, 1.399038475609640, 1.911871066122697, 1.393715521875472, 1.634940751730062, 1.299965953553803, 1.625354065027734, 1.880393059283658, 1.690675478017034, 1.628589134880479, 1.012241730322596, 1.151619785119961, 1.951158889711496, 1.797539238310482, 1.755218167276459, 1.713478006991327, 1.571668224641071, 1.319684419283076, 1.470800535782670, 1.106150064396913, 1.759426082965527, 1.413902064615626, 1.663209862298114, 1.688656611986246, 1.561766088174504, 1.021593733617964, 1.104216171759727, 1.056934446307648, 1.131101785914085, 1.025747434603107, 1.653089659161949, 1.862010102275871, 1.700392592888141, 1.749844513072156, 1.600475707472835, 1.797824285171013, 1.303262789973822, 1.833983051083715, 1.706436841851279, 1.583152584413344, 1.157186002470311, 1.160819822241010, 1.212754944300861, 1.963053526130375, 1.268811286389321, 1.374828807938443, 1.049479080410400, 1.973869788889314, 1.280288819687655, 1.193231050947952, 1.306156625366250, 1.244778108696800, 1.731164172106588, 1.765672206167307, 1.617163972329793, 1.333068311058873, 1.230571993026005, 1.225697451543153, 1.277811874136488, 1.572508333797608, 1.556415237569166, 1.209965265731652, 1.934900416408164, 1.370051485789686, 1.026053486793906, 1.090498102405539, 1.516231184525802, 1.080879023417522, 1.616056345268405, 1.414971598053735, 1.813169501790841, 1.946113087783638, 1.550874962654984, 1.095276777050610, 1.022240506381006, 1.349953863208443, 1.639335057225891, 1.086999372715814, 1.198125757163164, 1.358872097979379, 1.864767925147218, 1.425774441879807, 1.324356243811146, 1.013779032909748, 1.877970176001620, 1.017769324762142, 1.517328996674653, 1.156791735454128, 1.820771116348883, 1.209713056264071, 1.854832025810033, 1.626515379727837, 1.072074225561507, 1.621286465674130, 1.549902343511516, 1.266113813183351, 1.450731461629206, 1.023903615692273, 1.141802126238102, 1.478789349904744, 1.030261249106096, 1.744520411596375, 1.610339075504574, 1.734036515785284, 1.445021690251891, 1.067695047319750, 1.044588489496833, 1.078902049240712, 1.775656376455273, 1.529010846255880, 1.684639314731656, 1.869078008870465, 1.196659282984713, 1.055877083218375, 1.343311406572803, 1.657804323039657, 1.931310179843877, 1.876531128866294, 1.953312528893538, 1.751295176436919, 1.990635408763924, 1.747960800049019, 1.625876628099381, 1.950163235823662, 1.461443118782703, 1.075928147908412, 1.092143870551425, 1.530725871270558, 1.134721738077522, 1.006593825427538, 1.510662628484829, 1.102117778241225, 1.237414790616429, 1.415898757276402, 1.227818931317890, 1.803733837180969, 1.039835919301454, 1.945637370177811, 1.014985550164521, 1.662360752310358, 1.389442153375327, 1.067707198772765, 1.752954274484631, 1.712429083915912, 1.798210585469825, 1.644104449048200, 1.668431996831141, 1.786974747468935, 1.411459450430814, 1.354534709965009, 1.755820242124135, 1.186816760748136, 1.711332994678620, 1.903597963775769, 1.127695794052451, 1.055764745873512, 1.462173219563238, 1.601988414252792, 1.542788005387959, 1.470016225539294, 1.053250417579233, 1.919128040049399, 1.920409133273121, 1.930196071775802, 1.093941301487821, 1.907077053805924, 1.180006330527884, 1.855787153756457, 1.038787604610960, 1.603390528893462, 1.675699800641335, 1.436579268097476, 1.695216721991263, 1.667921392643477, 1.298225569286973, 1.176659205584008, 1.484688184402969, 1.736977199998048, 1.527346818010219, 1.124337166052271, 1.004126214409010, 1.257995351445688, 1.048750698690273, 1.600687893284987, 1.771330853717698, 1.781338029764260, 1.791045259533474, 1.218240073554028, 1.404476462748409, 1.263776254264821, 1.771506489056091, 1.492535106857984, 1.942560639598830, 1.880445735782105, 1.987365393774292, 1.624806632834506, 1.360289989229111, 1.259447098681650, 1.565201597574085, 1.724405238661507, 1.480135931789360, 1.613728648660302, 1.148462875077473, 1.082990694586929, 1.791549713090436, 1.011697309037590, 1.051330287711138, 1.404529653735530, 1.255076827666297, 1.465354319402313, 1.959722467095358, 1.667465002487598, 1.059786656048662, 1.145589007250259, 1.111653746143364, 1.118097303976153, 1.274790361215896, 1.061022554596977, 1.650762458048159, 1.426666443801441, 1.643025168116494, 1.881525522016726, 1.331922961270956, 1.141320506705509, 1.835459356205120, 1.604755953946371, 1.126481102674482, 1.345361030653902, 1.552930483800284, 1.651060315989797, 1.281924176836940, 1.478282162483309, 1.089522082067808, 1.514671692662497, 1.062032369569581, 1.220072855001427, 1.335222242385036, 1.917688560760201, 1.881563679176478, 1.061345187966617, 1.932816485102730, 1.831378583403447, 1.018053903667606, 1.803752606555742, 1.744151146745064, 1.823935602019249, 1.549411228789844, 1.852085525549937, 1.268910953917921, 1.398103908872195, 1.115463052648461, 1.134166374832642, 1.059662865049822, 1.913385314672057, 1.817573645089763, 1.543472539894835, 1.879411496379644, 1.187052469310417, 1.327060124683171, 1.201797766005763, 1.585708496011359, 1.726441950212828, 1.765366139479803, 1.575105655795392, 1.161836204689848, 1.177060808947556, 1.991643941775680, 1.483304774937826, 1.299878727524718, 1.860512786972423, 1.055049090865626, 1.843398581472891, 1.092910752402670, 1.944321623196737, 1.663494470271249, 1.922888589107380, 1.203337506107050, 1.673695668302879, 1.453053811175328, 1.005089626720857, 1.795346999949530, 1.229821542926916, 1.748377783144588, 1.321996885703262, 1.309371806850785, 1.716138869778725, 1.135666913050759, 1.338269469982098, 1.970855876728981, 1.853517049886400, 1.057177758132396, 1.248940788315584, 1.791020744082269, 1.081574247946067, 1.730996177586578, 1.009526675464715, 1.009798100718231, 1.881102727076643, 1.670032923753426, 1.864089798899085, 1.947800326838745, 1.525753676291635, 1.481044314974777, 1.045650816913446, 1.343050229590432, 1.254467660379006, 1.942791560918173, 1.712818820358553, 1.365835692787808, 1.840681238589795, 1.226240189108953, 1.322696502726162, 1.519948924493175, 1.902086636313264, 1.831961607099442, 1.656813895374856, 1.580562626129614, 1.628706392122500, 1.709923293711780, 1.397619640553994, 1.955521961038447, 1.131582790546282, 1.120774954775631, 1.643383921264857, 1.428256924538280, 1.629234961965852, 1.481973671272142, 1.355168703906496, 1.381360123066666, 1.297353474383750, 1.998779984895075, 1.299540149195283, 1.554953631008684, 1.022499550534725, 1.267538332848977, 1.999635534064931, 1.216908438689689, 1.125330423218031, 1.521094226167544, 1.352444820153410, 1.891355866547355, 1.237188250644441, 1.829163148453760, 1.010975705160555, 1.389099307599609, 1.166572697139759, 1.209619877947629, 1.957432819952394, 1.171713118207805, 1.995544396463686, 1.113738650685683, 1.954952493800097, 1.309046349979008, 1.125405858742736, 1.334059551241411, 1.618705235720444, 1.231177186143469, 1.553727846971735, 1.178887689593680, 1.264866781514123, 1.091971065285239, 1.056441862383996, 1.283527024623163, 1.834607590365417, 1.962802242863336, 1.228730340204497, 1.842991683633420, 1.697545988525402, 1.844710792546847, 1.192417542034665, 1.697508607262110, 1.784896632338091, 1.034112834139585, 1.422033286751813, 1.453652054620216, 1.058379823639922, 1.507638941358602, 1.047993066417010, 1.516397461578060, 1.302372136540590, 1.461998564058737, 1.554611626737750, 1.134122374348743, 1.667716941372084, 1.433151414564393, 1.319857533959847, 1.583420071116494, 1.478250465560727, 1.466784271564917, 1.923843580047532, 1.176048670365018, 1.518583880443583, 1.126284343690593, 1.309458927538403, 1.254116920997212, 1.221286762203130, 1.314794812269592, 1.865355356312181, 1.875368141725648, 1.478554967746866, 1.289949440091931, 1.240447745313523, 1.101700136534686, 1.332573248950360, 1.167135678363469, 1.604936747884104, 1.828477968610324, 1.981787275210698, 1.528961708093550, 1.844833688431583, 1.292908212260039, 1.526421493343533, 1.477684242274037, 1.520192575343653, 1.407146775494489, 1.433258876432486, 1.140499612461638, 1.224429147839875, 1.413739425285328, 1.939104296647277, 1.669514052983343, 1.732909897181110, 1.751457852668096, 1.242198740016763, 1.909522621661234, 1.248802188164318, 1.785821368840928, 1.444035896141739, 1.408015292232671, 1.097220772250296, 1.433573415928994, 1.019849701076716, 1.192183652047805, 1.942228730880240, 1.511971120822260, 1.167847411636749, 1.424386751141384, 1.999535966473089, 1.256446120225825, 1.758859587241302, 1.554606274137138, 1.141112413898596, 1.872291378873514, 1.893151469654739, 1.869646558937494, 1.826227167199755, 1.804544311254211, 1.730661202511795, 1.226769815903244, 1.679838430928674, 1.643941207337068, 1.322059748794036, 1.045053637669191, 1.309404672920857, 1.331474945197764, 1.790509417887939, 1.263083376723605, 1.245939409206071, 1.759660309891394, 1.281800922487132, 1.712213197965571, 1.803213756378482, 1.717270512776782, 1.385372857246577, 1.255945382268436, 1.564636086727342, 1.644313176830236, 1.176523282489581, 1.334422402615048, 1.208067092977696, 1.149552540117835, 1.771501288135706, 1.564055713684924, 1.621614271733339, 1.081066576966760, 1.495853964383299, 1.219063833026128, 1.084142314244871, 1.549237225541902, 1.936776127604372, 1.845512189258520, 1.005975975876582, 1.811498259332091, 1.635990011669673, 1.536881182554052, 1.443297379586476, 1.886119584133706, 1.275449488687871, 1.670965527087923, 1.987232750305201, 1.544406415554266, 1.725582465417778, 1.799340284160104, 1.608735841735920, 1.264891652333546, 1.808533254198986, 1.974563992723363, 1.673825352257849, 1.559378666798180, 1.815513818850944, 1.679215902745112, 1.846384704667485, 1.353621521988754, 1.236648508090431, 1.002104116734581, 1.053298883217048, 1.430242739641769, 1.420261924778031, 1.783120431598888, 1.331408790925515, 1.781593450829028, 1.139278556251319, 1.925682266142099, 1.138131587567467, 1.474662993172124, 1.319063477600368, 1.536365678407554, 1.129922971629872, 1.780938176769717, 1.257945861972239, 1.206107632090796, 1.055490753863072, 1.161054816125216, 1.058802624223267, 1.756641825929552, 1.754378196150022, 1.827313268250450, 1.951406696895395, 1.315659554078758, 1.926535624123573, 1.711614142494693, 1.408317616914680, 1.167503504129387, 1.221579231246995, 1.772499449844828, 1.229590547241117, 1.523859240135010, 1.750638838700595, 1.294969757722743, 1.239218469359550, 1.895331049984825, 1.351848818389126, 1.953628356200589, 1.556987376063896, 1.742382503539244, 1.831314773712437, 1.931187779890391, 1.627064275586785, 1.092521265403294, 1.056269664216268, 1.697419776942093, 1.020621151020278, 1.016460701790075, 1.663349935983337, 1.700240650962897, 1.294295439244268, 1.217283432848958, 1.724633019876359, 1.611555526017567, 1.976769804845470, 1.322482963420171, 1.119851357883444, 1.188940717720834, 1.639649300982932, 1.430594405952054, 1.528763701984112, 1.677238553046157, 1.804257644847276, 1.373695667911955, 1.041607859915277, 1.292586152868963, 1.204343281283561, 1.219648415953772, 1.118298775504544, 1.489325174543727, 1.223311365895364, 1.215428634537803, 1.544464527855300, 1.211873174969368, 1.800882969641407, 1.395620323924559, 1.513764352278001, 1.855296462052718, 1.311627987537891, 1.106545691943606, 1.006292260028909, 1.266506021169479, 1.061150534120227, 1.552364586842264, 1.302709575585848, 1.821775657431182, 1.391750759396551, 1.365952489392163, 1.337000387140509, 1.740591934294086, 1.185662060689487, 1.200293174238620, 1.390126083634700, 1.802185187529872, 1.091847733098113 }; size_t test1_dataset_size = sizeof(ref_result1) / sizeof(double); //init_gen_rand(5) generated randoms (0, 1] double ref_result2[] = { 0.576676137904379, 0.994304310329450, 0.127959185148864, 0.178972277952344, 0.501233068055063, 0.859840653012468, 0.546161779037789, 0.805380602145160, 0.381324178276622, 0.229028865043289, 0.666794531244068, 0.821723842976139 }; size_t test2_dataset_size = sizeof(ref_result2) / sizeof(double); using namespace itpp; int main() { bool test1_failed = false; bool test2_failed = false; bool test3_failed = false; //set test tolerance; double tol = 5 * std::numeric_limits::epsilon(); //verify correcness of RNG core algorithms first { //genrand_close1_open2 test with seed = 0 RNG_reset(0); Random_Generator rng; for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { test1_failed = true; } } } { //genrand_open_close test with seed = 5 RNG_reset(5); Random_Generator rng; for(size_t i = 0; i < test2_dataset_size; ++i) { double r = rng.genrand_open_close(); if(std::abs(r - ref_result2[i]) > tol) { test2_failed = true; } } } #ifdef _OPENMP //set number of threads in the team to the maximum available value const int threads_cnt = omp_get_max_threads(); omp_set_num_threads(threads_cnt); #else const int threads_cnt = 1; #ifndef _MSC_VER #pragma message "no OMP support" #else #pragma message ("no OMP support") #endif #endif //repeat test 1 in multithreaded environment //(repeat 3 times for each thread to test a possible clashes on shared data). std::vector err_counters(threads_cnt); #pragma omp parallel { #pragma omp for for(int j = 0; j < threads_cnt; ++j) { //genrand_close1_open2 test with seed = 0 RNG_reset(0); Random_Generator rng; for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { //can't use gtest macro here, omp does not allow to execute the code with flow breaks in parallel loop iterations err_counters[j]++; } } RNG_reset(0); for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { //can't use gtest macro here, omp does not allow to execute the code with flow breaks in parallel loop iterations err_counters[j]++; } } RNG_reset(0); for(size_t i = 0; i < test1_dataset_size; ++i) { double r = rng.genrand_close1_open2(); if(std::abs(r - ref_result1[i]) > tol) { //can't use gtest macro here, omp does not allow to execute the code with flow breaks in parallel loop iterations err_counters[j]++; } } } } //check results when single-threaded again for(int j = 0; j < threads_cnt; ++j) { if(err_counters[j] != 0) { test3_failed = true; } } //output results std::cout << "-----------------------------------------" << std::endl; std::cout << "RNG core tests:" << std::endl; std::cout << "-----------------------------------------" << std::endl; std::cout << "genrand_close1_open2() test: " << (test1_failed ? "FAILED" : "PASSED") << std::endl; std::cout << "genrand_open_close() test: " << (test2_failed ? "FAILED" : "PASSED") << std::endl; std::cout << "multithreading test: " << (test3_failed ? "FAILED" : "PASSED") << std::endl; std::cout << "-----------------------------------------" << std::endl; return 0; } itpp-4.3.1/tests/rand_core_test.ref000066400000000000000000000003721216575753400173470ustar00rootroot00000000000000----------------------------------------- RNG core tests: ----------------------------------------- genrand_close1_open2() test: PASSED genrand_open_close() test: PASSED multithreading test: PASSED ----------------------------------------- itpp-4.3.1/tests/rand_test.cpp000066400000000000000000000062331216575753400163470ustar00rootroot00000000000000/*! * \file * \brief Random number generator test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { cout.setf(ios::fixed); cout.precision(2); RNG_reset(4357U); Bernoulli_RNG b_rng; cout << "Bernoulli_RNG:\n" << b_rng() << endl; cout << b_rng(10) << endl; cout << b_rng(3, 5) << endl << endl; RNG_reset(4357U); Uniform_RNG u_rng; cout << "Uniform_RNG:\n" << u_rng() << endl; cout << u_rng(10) << endl; cout << u_rng(3, 5) << endl << endl; RNG_reset(4357U); I_Uniform_RNG iu_rng(0, 9); cout << "I_Uniform_RNG [0..9]:\n" << iu_rng() << endl; cout << iu_rng(10) << endl; cout << iu_rng(3, 5) << endl << endl; RNG_reset(4357U); Normal_RNG n_rng; cout << "Normal_RNG:\n" << n_rng() << endl; cout << n_rng(10) << endl; cout << n_rng(3, 5) << endl << endl; RNG_reset(4357U); Complex_Normal_RNG cn_rng; cout << "Complex_Normal_RNG:\n" << cn_rng() << endl; cout << cn_rng(10) << endl; cout << cn_rng(3, 5) << endl << endl; RNG_reset(4357U); Exponential_RNG e_rng; cout << "Exponential_RNG:\n" << e_rng() << endl; cout << e_rng(10) << endl; cout << e_rng(3, 5) << endl << endl; RNG_reset(4357U); Gamma_RNG g_rng; cout << "Gamma_RNG:\n" << g_rng() << endl; cout << g_rng(10) << endl; cout << g_rng(3, 5) << endl << endl; RNG_reset(4357U); Laplace_RNG lap_rng; cout << "Laplace_RNG:\n" << lap_rng() << endl; cout << lap_rng(10) << endl; cout << lap_rng(3, 5) << endl << endl; RNG_reset(4357U); AR1_Normal_RNG ar1_rng; cout << "AR1_Normal_RNG:\n" << ar1_rng() << endl; cout << ar1_rng(10) << endl; cout << ar1_rng(3, 5) << endl << endl; RNG_reset(4357U); Weibull_RNG w_rng; cout << "Weibull_RNG:\n" << w_rng() << endl; cout << w_rng(10) << endl; cout << w_rng(3, 5) << endl << endl; RNG_reset(4357U); Rayleigh_RNG ray_rng; cout << "Rayleigh_RNG:\n" << ray_rng() << endl; cout << ray_rng(10) << endl; cout << ray_rng(3, 5) << endl << endl; RNG_reset(4357U); Rice_RNG ric_rng; cout << "Rice_RNG:\n" << ric_rng() << endl; cout << ric_rng(10) << endl; cout << ric_rng(3, 5) << endl << endl; return 0; } itpp-4.3.1/tests/rand_test.ref000066400000000000000000000036231216575753400163410ustar00rootroot00000000000000Bernoulli_RNG: 0 [0 1 1 0 1 0 1 0 0 0] [[1 1 1 0 0] [1 0 1 0 1] [1 0 0 1 1]] Uniform_RNG: 0.68 [0.69 0.47 0.49 0.62 0.31 0.98 0.22 0.87 0.56 0.95] [[0.36 0.18 0.08 0.76 0.59] [0.20 0.81 0.29 0.86 0.50] [0.17 0.67 0.85 0.45 0.14]] I_Uniform_RNG [0..9]: 6 [6 4 4 6 3 9 2 8 5 9] [[3 2 1 1 8] [6 0 2 8 7] [8 4 5 4 1]] Normal_RNG: 1.89 [0.64 -0.67 0.73 -0.98 0.09 -0.41 1.50 1.71 -0.36 0.55] [[-0.37 0.24 0.09 0.73 -0.19] [-0.50 0.44 0.43 -1.57 0.75] [-1.75 -0.47 0.18 -0.43 -0.32]] Complex_Normal_RNG: 1.34+0.45i [-0.47+0.51i -0.69+0.06i -0.29+1.06i 1.21-0.26i 0.39-0.26i -0.35-1.23i 0.17+0.31i -0.33+0.06i 0.30+0.13i 0.52-1.11i] [[-0.30-0.14i 0.37-0.43i -0.14-0.13i -1.36+0.87i 0.75+0.49i] [0.53-0.23i 0.63-0.21i -0.47+0.21i 0.79-0.30i 0.13-0.00i] [0.44-0.34i 0.60+1.29i 0.79+0.36i 1.31+0.25i 0.23-0.29i]] Exponential_RNG: 1.13 [1.18 0.63 0.67 0.96 0.37 3.81 0.25 2.02 0.81 3.02] [[0.44 0.23 0.18 0.20 1.64] [1.10 0.08 0.34 1.93 1.44] [1.93 0.59 0.88 0.69 0.16]] Gamma_RNG: 2.73 [1.06 0.14 0.05 0.25 2.44 0.28 0.27 6.41 0.37 0.30] [[0.22 2.63 1.60 1.51 1.48] [0.16 0.37 0.93 0.07 0.55] [0.31 0.14 2.16 3.91 1.57]] Laplace_RNG: 0.31 [0.35 -0.05 -0.02 0.19 -0.33 2.20 -0.58 0.94 0.09 1.65] [[-0.24 -0.63 -0.77 -0.72 0.67] [0.29 -1.30 -0.39 0.87 0.53] [0.88 -0.08 0.13 -0.00 -0.88]] AR1_Normal_RNG: -0.68 [1.38 -1.13 -0.24 -0.64 0.59 0.70 0.10 0.85 0.95 0.90] [[0.28 0.17 -0.58 0.78 -1.63] [-0.20 0.35 -0.46 -1.91 0.17] [1.96 -1.25 -0.45 -0.56 -0.01]] Weibull_RNG: 1.13 [1.18 0.63 0.67 0.96 0.37 3.81 0.25 2.02 0.81 3.02] [[0.44 0.23 0.18 0.20 1.64] [1.10 0.08 0.34 1.93 1.44] [1.93 0.59 0.88 0.69 0.16]] Rayleigh_RNG: 2.00 [0.99 0.99 1.56 1.75 0.66 1.82 0.50 0.48 0.47 1.74] [[0.47 0.82 0.79 0.80 0.94] [2.02 0.27 0.72 1.23 2.29] [1.20 1.88 1.27 0.19 0.52]] Rice_RNG: 2.96 [0.80 0.09 1.62 2.73 1.59 1.82 1.31 0.54 1.44 2.34] [[0.60 1.78 1.69 1.64 1.92] [2.61 0.82 0.45 2.17 1.54] [2.17 2.87 2.18 1.19 1.38]] itpp-4.3.1/tests/rec_syst_conv_code_test.cpp000066400000000000000000000050061216575753400212720ustar00rootroot00000000000000/*! * \file * \brief Recursive systematic convolutional codes class test program * \author Pal Frenger * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { bvec uncoded_bits = "0 1 1 0 1 0 1", tail_bits(4), decoded_bits(11); bmat parity_bits(11, 1); vec received_systematic(11), extrinsic_output(11), L(11), symbols; mat received_parity(11, 1); double Ec = 1.0, N0 = 0.00000000000000000000000000000000000000001, Lc = 4.0 * sqrt(Ec) / N0; Normal_RNG noise(0.0, N0 / 2.0); BPSK bpsk; Rec_Syst_Conv_Code rscc; // Fixed by ediap: ivec("string") constructor uses only decimal notation // rscc.set_generator_polynomials("031 027",5); rscc.set_generator_polynomials("25 23", 5); rscc.set_awgn_channel_parameters(Ec, N0); rscc.encode_tail(uncoded_bits, tail_bits, parity_bits); bpsk.modulate_bits(concat(uncoded_bits, tail_bits), symbols); received_systematic = symbols + noise(11); bpsk.modulate_bits(parity_bits.get_col(0), symbols); received_parity.set_col(0, symbols + noise(11)); vec extrinsic_input = zeros(11); rscc.map_decode(received_systematic, received_parity, extrinsic_input, extrinsic_output); L = Lc * received_systematic + extrinsic_output; for (int k = 0; k < 11; k++) { (L(k) > 0) ? (decoded_bits(k) = bin(0)) : (decoded_bits(k) = bin(1)); } cout << "uncoded_bits = " << uncoded_bits << endl; cout << "tail_bits = " << tail_bits << endl; cout << "decoded_bits = " << decoded_bits << endl; return 0; } itpp-4.3.1/tests/rec_syst_conv_code_test.ref000066400000000000000000000001341216575753400212610ustar00rootroot00000000000000uncoded_bits = [0 1 1 0 1 0 1] tail_bits = [1 1 0 1] decoded_bits = [0 1 1 0 1 0 1 1 1 0 1] itpp-4.3.1/tests/reedsolomon_test.cpp000066400000000000000000000133111216575753400177440ustar00rootroot00000000000000/*! * \file * \brief Reed-Solomon encoder/decoder class test program * \author Steve Peters and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using std::cout; using std::endl; int main() { cout << "==========================================" << endl; cout << " Test of Reed-Solomon encoder/decoder " << endl; cout << "==========================================" << endl; bmat u = randb(8, 15); bmat c(u.rows(), 21); bmat y(u.rows(), 21); bvec codeword, errorword; bmat decoded(u.rows(), u.cols()); Reed_Solomon rs(3, 1); Reed_Solomon rs_sys(3, 1, true); bmat f = "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0"; cout << "Non-systematic case" << endl; cout << "-------------------" << endl; for (int i = 0; i < u.rows(); i++) { cout << "Info word: " << u.get_row(i) << endl; codeword = rs.encode(u.get_row(i)); it_assert(c.cols() == length(codeword), "Error 1"); c.set_row(i, rs.encode(u.get_row(i))); cout << "Encoded: " << c.get_row(i) << endl; errorword = f.get_row(i) + c.get_row(i); it_assert(y.cols() == length(errorword), "Error 2"); y.set_row(i, f.get_row(i) + c.get_row(i)); cout << "One error added: " << y.get_row(i) << endl; decoded.set_row(i, rs.decode(y.get_row(i))); cout << "Decoded to: " << decoded.get_row(i) << endl << endl; } cout << "Systematic case" << endl; cout << "---------------" << endl; for (int i = 0; i < u.rows(); i++) { c.set_row(i, rs_sys.encode(u.get_row(i))); cout << "Info word: " << u.get_row(i) << endl; cout << "Encoded: " << c.get_row(i) << endl; y.set_row(i, f.get_row(i) + c.get_row(i)); cout << "One error added: " << y.get_row(i) << endl; decoded.set_row(i, rs_sys.decode(y.get_row(i))); cout << "Decoded to: " << decoded.get_row(i) << endl << endl; } bmat g = "1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1; 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0"; cout << "Systematic case with decoder failure indicator" << endl; cout << "----------------------------------------------" << endl; for (int i = 0; i < u.rows(); i++) { c.set_row(i, rs_sys.encode(u.get_row(i))); cout << "Info word: " << u.get_row(i) << endl; cout << "Encoded: " << c.get_row(i) << endl; y.set_row(i, g.get_row(i) + c.get_row(i)); cout << "Two error added: " << y.get_row(i) << endl; bvec message, cw_is_valid; rs_sys.decode(y.get_row(i), message, cw_is_valid); decoded.set_row(i, message); cout << "Decoded to: " << decoded.get_row(i) << endl; cout << "Codeword valid: " << cw_is_valid << endl << endl; } rs = Reed_Solomon(3, 1, false, 0); rs_sys = Reed_Solomon(3, 1, true, 0); cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl; cout << "Erasure decoding (1 erasure) and non-narrow-sense" << endl; cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl; cout << "Non-systematic case" << endl; cout << "-------------------" << endl; for (int i = 0; i < u.rows(); i++) { cout << "Info word: " << u.get_row(i) << endl; codeword = rs.encode(u.get_row(i)); it_assert(c.cols() == length(codeword), "Error 1"); c.set_row(i, rs.encode(u.get_row(i))); cout << "Encoded: " << c.get_row(i) << endl; it_assert(y.cols() == length(errorword), "Error 2"); y.set_row(i, c.get_row(i)); bvec decoded_tmp; bvec cw_isvalid; ivec erasure(1); erasure(0) = i/y.cols(); rs.decode(y.get_row(i), erasure, decoded_tmp, cw_isvalid); decoded.set_row(i, decoded_tmp); cout << "Decoded to: " << decoded.get_row(i) << endl << endl; } cout << "Systematic case" << endl; cout << "---------------" << endl; for (int i = 0; i < u.rows(); i++) { c.set_row(i, rs_sys.encode(u.get_row(i))); cout << "Info word: " << u.get_row(i) << endl; cout << "Encoded: " << c.get_row(i) << endl; y.set_row(i, c.get_row(i)); bvec decoded_tmp; bvec cw_isvalid; ivec erasure(1); erasure(0) = 0;//i/y.cols(); rs_sys.decode(y.get_row(i), erasure, decoded_tmp, cw_isvalid); decoded.set_row(i, decoded_tmp); cout << "Decoded to: " << decoded.get_row(i) << endl << endl; } return 0; } itpp-4.3.1/tests/reedsolomon_test.ref000066400000000000000000000205151216575753400177420ustar00rootroot00000000000000========================================== Test of Reed-Solomon encoder/decoder ========================================== Non-systematic case ------------------- Info word: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Encoded: [0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0] One error added: [1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0] Decoded to: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Info word: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Encoded: [0 0 0 1 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 1 0] One error added: [0 1 0 1 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 1 0] Decoded to: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Info word: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Encoded: [0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 0] One error added: [0 0 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 0] Decoded to: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Info word: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Encoded: [0 0 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0] One error added: [0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0] Decoded to: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Info word: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Encoded: [0 0 0 0 0 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0] One error added: [0 0 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0] Decoded to: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Info word: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Encoded: [1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0] One error added: [1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 0 1 0] Decoded to: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Info word: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Encoded: [1 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0] One error added: [1 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1] Decoded to: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Info word: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Encoded: [0 1 0 1 1 0 0 1 0 1 1 1 0 0 0 0 1 1 1 1 1] One error added: [0 1 0 1 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1] Decoded to: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Systematic case --------------- Info word: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Encoded: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0 1 1 0 0 0 0] One error added: [1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 1 1 0 0 0 0] Decoded to: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Info word: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Encoded: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1] One error added: [0 1 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1] Decoded to: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Info word: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Encoded: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1] One error added: [1 1 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1 1] Decoded to: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Info word: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Encoded: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0] One error added: [1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0] Decoded to: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Info word: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Encoded: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1] One error added: [0 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1] Decoded to: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Info word: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Encoded: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0] One error added: [1 0 1 0 0 0 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0] Decoded to: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Info word: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Encoded: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0] One error added: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1] Decoded to: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Info word: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Encoded: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0] One error added: [1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0] Decoded to: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Systematic case with decoder failure indicator ---------------------------------------------- Info word: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Encoded: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0 1 1 0 0 0 0] Two error added: [1 0 1 0 0 1 0 1 0 1 1 1 0 1 0 1 1 0 0 0 0] Decoded to: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Codeword valid: [1] Info word: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Encoded: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1] Two error added: [0 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1] Decoded to: [0 1 0 0 0 0 0 0 0 1 0 1 1 1 0] Codeword valid: [1] Info word: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Encoded: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1] Two error added: [1 1 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 1 1] Decoded to: [1 1 0 0 1 1 1 0 1 0 0 1 0 1 0] Codeword valid: [1] Info word: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Encoded: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0] Two error added: [1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 0 1 0 1 1 0] Decoded to: [1 1 0 1 1 1 0 1 0 0 0 1 0 0 0] Codeword valid: [1] Info word: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Encoded: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1] Two error added: [0 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 1 0 1 1] Decoded to: [0 0 0 1 0 0 0 1 1 0 1 1 1 0 0] Codeword valid: [0] Info word: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Encoded: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0] Two error added: [1 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0] Decoded to: [1 0 1 0 0 0 0 0 1 0 1 0 0 1 0] Codeword valid: [0] Info word: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Encoded: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0] Two error added: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 1 0 0 1 1] Decoded to: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Codeword valid: [0] Info word: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Encoded: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0] Two error added: [1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 0] Decoded to: [1 1 1 1 1 1 1 1 1 0 1 1 1 1 1] Codeword valid: [1] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Erasure decoding (1 erasure) and non-narrow-sense XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Non-systematic case ------------------- Info word: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Encoded: [0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0] Decoded to: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Info word: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Encoded: [0 0 0 1 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 1 0] Decoded to: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Info word: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Encoded: [0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 0] Decoded to: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Info word: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Encoded: [0 0 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0] Decoded to: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Info word: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Encoded: [0 0 0 0 0 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0] Decoded to: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Info word: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Encoded: [1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0] Decoded to: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Info word: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Encoded: [1 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0] Decoded to: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Info word: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Encoded: [0 1 0 1 1 0 0 1 0 1 1 1 0 0 0 0 1 1 1 1 1] Decoded to: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Systematic case --------------- Info word: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Encoded: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0 1 1 0 0 0 0] Decoded to: [0 0 0 0 0 1 0 1 0 1 1 1 0 1 0] Info word: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Encoded: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1] Decoded to: [0 0 0 0 1 0 0 0 0 1 1 1 1 1 0] Info word: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Encoded: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1] Decoded to: [1 1 0 0 1 1 1 0 0 0 0 0 0 1 0] Info word: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Encoded: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0] Decoded to: [1 1 0 0 1 1 0 1 0 0 1 1 0 0 0] Info word: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Encoded: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1] Decoded to: [0 0 0 1 1 0 0 1 1 0 1 1 1 0 0] Info word: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Encoded: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0] Decoded to: [1 0 1 0 0 0 0 1 1 0 1 1 0 1 0] Info word: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Encoded: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0] Decoded to: [0 1 0 1 1 1 1 0 0 1 0 1 1 0 0] Info word: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] Encoded: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0] Decoded to: [1 1 1 1 1 1 1 1 0 1 1 1 1 1 1] itpp-4.3.1/tests/schur_test.cpp000066400000000000000000000052401216575753400165440ustar00rootroot00000000000000/*! * \file * \brief Schur decomposition test program * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { int size = 5; double thres = 1e-13; cout << "==========================================" << endl; cout << " Test of Schur decomposition routines " << endl; cout << "==========================================" << endl; { cout << "Real matrix" << endl; mat A = randn(size, size); mat T, U; schur(A, U, T); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - U*T*U^T) = " << round_to_zero(norm(A - (U * T * transpose(U))), thres) << endl; cout << "norm(I - U*U^T) = " << round_to_zero(norm(eye(size) - (U * transpose(U))), thres) << endl; double temp_sum = 0; for (int i = 2; i < size; i++) for (int j = 0; j < i - 1; j++) temp_sum += sqr(T(i, j)); cout << "norm(lower triangular part of T) = " << round_to_zero(sqrt(temp_sum), thres) << endl; } { cout << endl << "Complex matrix" << endl; cmat A = randn_c(size, size); cmat T, U; schur(A, U, T); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - U*T*U^H) = " << round_to_zero(norm(A - (U * T * hermitian_transpose(U))), thres) << endl; cout << "norm(I - U*U^H) = " << round_to_zero(norm(eye(size) - (U * hermitian_transpose(U))), thres) << endl; double temp_sum = 0; for (int i = 1; i < size; i++) for (int j = 0; j < i; j++) temp_sum += sqr(T(i, j)); cout << "norm(lower triangular part of T) = " << round_to_zero(sqrt(temp_sum), thres) << endl; } return 0; } itpp-4.3.1/tests/schur_test.ref000066400000000000000000000020421216575753400165330ustar00rootroot00000000000000========================================== Test of Schur decomposition routines ========================================== Real matrix A = [[-0.283885 0.56497 -1.0746 -0.732016 -0.869443] [1.36446 -0.596145 2.36476 -2.10553 -0.0504762] [0.906001 -1.19732 2.36508 -0.923457 0.799682] [1.24942 -1.26756 1.22804 -1.89227 1.02849] [1.55783 -0.300385 0.234136 -0.664315 -0.900489]] norm(A - U*T*U^T) = 0 norm(I - U*U^T) = 0 norm(lower triangular part of T) = 0 Complex matrix A = [[-0.160972-1.29916i 0.794379+1.03288i -0.127081+0.388325i 1.13396-0.225782i 0.562993-0.0690923i] [0.0361926+1.01917i -0.190616-0.710921i -0.572027-1.62447i 1.07734-0.884797i -0.822132+0.953281i] [-1.04693+0.760191i 1.32367+0.349763i -0.320883+0.1836i 0.465648-0.60769i -0.128067+0.278311i] [-0.280465+0.361084i 0.510483+0.174148i -1.02371+0.214321i 0.0533137-0.121635i 0.598587-0.190616i] [0.780099+0.643584i 0.475202-0.708159i -0.98353+0.261137i -0.848777-1.28903i -0.13041+0.0775548i]] norm(A - U*T*U^H) = 0 norm(I - U*U^H) = 0 norm(lower triangular part of T) = 0 itpp-4.3.1/tests/sigfun_test.cpp000066400000000000000000000102771216575753400167210ustar00rootroot00000000000000/*! * \file * \brief Signal processing routines test program * \author Tony Ottosson, Thomas Eriksson, Pal Frenger, Tobias Ringstrom * and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { RNG_reset(12345); vec x = randn(10); vec y = randn(10); int max_lag; cout << "x = " << x << endl; cout << "y = " << y << endl; cout << "Testing cross correlation" << endl; cout << "--------------------------------------------------------------------------" << endl; cout << "xcorr(x,y) = " << xcorr(x, y) << endl; max_lag = 0; cout << "xcorr(x,y," << max_lag << ") = " << xcorr(x, y, max_lag) << endl; max_lag = 5; cout << "xcorr(x,y," << max_lag << ") = " << xcorr(x, y, max_lag) << endl; max_lag = -1; cout << "xcorr(x,y," << max_lag << ") = " << xcorr(x, y, max_lag) << endl; max_lag = 0; cout << "xcorr(x,y," << max_lag << ",biased) = " << xcorr(x, y, max_lag, "biased") << endl; max_lag = 5; cout << "xcorr(x,y," << max_lag << ",biased) = " << xcorr(x, y, max_lag, "biased") << endl; max_lag = -1; cout << "xcorr(x,y," << max_lag << ",biased) = " << xcorr(x, y, max_lag, "biased") << endl; max_lag = 0; cout << "xcorr(x,y," << max_lag << ",unbiased) = " << xcorr(x, y, max_lag, "unbiased") << endl; max_lag = 5; cout << "xcorr(x,y," << max_lag << ",unbiased) = " << xcorr(x, y, max_lag, "unbiased") << endl; max_lag = -1; cout << "xcorr(x,y," << max_lag << ",unbiased) = " << xcorr(x, y, max_lag, "unbiased") << endl; max_lag = 0; cout << "xcorr(x,y," << max_lag << ",coeff) = " << xcorr(x, y, max_lag, "coeff") << endl; max_lag = 5; cout << "xcorr(x,y," << max_lag << ",coeff) = " << xcorr(x, y, max_lag, "coeff") << endl; max_lag = -1; cout << "xcorr(x,y," << max_lag << ",coeff) = " << xcorr(x, y, max_lag, "coeff") << endl; cout << "Testing auto correlation" << endl; cout << "--------------------------------------------------------------------------" << endl; cout << "xcorr(x) = " << xcorr(x) << endl; max_lag = 0; cout << "xcorr(x," << max_lag << ") = " << xcorr(x, max_lag) << endl; max_lag = 5; cout << "xcorr(x," << max_lag << ") = " << xcorr(x, max_lag) << endl; max_lag = -1; cout << "xcorr(x," << max_lag << ") = " << xcorr(x, max_lag) << endl; max_lag = 0; cout << "xcorr(x," << max_lag << ",biased) = " << xcorr(x, max_lag, "biased") << endl; max_lag = 5; cout << "xcorr(x," << max_lag << ",biased) = " << xcorr(x, max_lag, "biased") << endl; max_lag = -1; cout << "xcorr(x," << max_lag << ",biased) = " << xcorr(x, max_lag, "biased") << endl; max_lag = 0; cout << "xcorr(x," << max_lag << ",unbiased) = " << xcorr(x, max_lag, "unbiased") << endl; max_lag = 5; cout << "xcorr(x," << max_lag << ",unbiased) = " << xcorr(x, max_lag, "unbiased") << endl; max_lag = -1; cout << "xcorr(x," << max_lag << ",unbiased) = " << xcorr(x, max_lag, "unbiased") << endl; max_lag = 0; cout << "xcorr(x," << max_lag << ",coeff) = " << xcorr(x, max_lag, "coeff") << endl; max_lag = 5; cout << "xcorr(x," << max_lag << ",coeff) = " << xcorr(x, max_lag, "coeff") << endl; max_lag = -1; cout << "xcorr(x," << max_lag << ",coeff) = " << xcorr(x, max_lag, "coeff") << endl; return 0; } itpp-4.3.1/tests/sigfun_test.ref000066400000000000000000000066561216575753400167210ustar00rootroot00000000000000x = [0.347621 2.24348 -0.813962 0.402693 -0.0180747 0.456185 -2.65107 0.48475 0.9001 0.489366] y = [0.305648 1.15718 -0.346767 -0.492783 0.537229 -0.0618721 -0.0772945 -0.790719 0.358175 0.988643] Testing cross correlation -------------------------------------------------------------------------- xcorr(x,y) = [0.343673 2.34251 -0.276029 -1.69426 0.575064 0.236971 -1.39007 -2.51791 3.36735 3.37605 -0.551727 -1.91208 1.41728 1.65607 -3.27706 -0.802629 1.02004 0.841397 0.149574] xcorr(x,y,0) = [3.37605] xcorr(x,y,5) = [0.575064 0.236971 -1.39007 -2.51791 3.36735 3.37605 -0.551727 -1.91208 1.41728 1.65607 -3.27706] xcorr(x,y,-1) = [0.343673 2.34251 -0.276029 -1.69426 0.575064 0.236971 -1.39007 -2.51791 3.36735 3.37605 -0.551727 -1.91208 1.41728 1.65607 -3.27706 -0.802629 1.02004 0.841397 0.149574] xcorr(x,y,0,biased) = [0.337605] xcorr(x,y,5,biased) = [0.0575064 0.0236971 -0.139007 -0.251791 0.336735 0.337605 -0.0551727 -0.191208 0.141728 0.165607 -0.327706] xcorr(x,y,-1,biased) = [0.0343673 0.234251 -0.0276029 -0.169426 0.0575064 0.0236971 -0.139007 -0.251791 0.336735 0.337605 -0.0551727 -0.191208 0.141728 0.165607 -0.327706 -0.0802629 0.102004 0.0841397 0.0149574] xcorr(x,y,0,unbiased) = [0.337605] xcorr(x,y,5,unbiased) = [0.115013 0.0394951 -0.198582 -0.314739 0.37415 0.337605 -0.061303 -0.23901 0.202469 0.276012 -0.655413] xcorr(x,y,-1,unbiased) = [0.343673 1.17126 -0.0920096 -0.423564 0.115013 0.0394951 -0.198582 -0.314739 0.37415 0.337605 -0.061303 -0.23901 0.202469 0.276012 -0.655413 -0.200657 0.340014 0.420698 0.149574] xcorr(x,y,0,coeff) = [0.453329] xcorr(x,y,5,coeff) = [0.0772185 0.03182 -0.186656 -0.3381 0.452161 0.453329 -0.0740849 -0.25675 0.19031 0.222374 -0.440038] xcorr(x,y,-1,coeff) = [0.0461477 0.314548 -0.0370646 -0.227502 0.0772185 0.03182 -0.186656 -0.3381 0.452161 0.453329 -0.0740849 -0.25675 0.19031 0.222374 -0.440038 -0.107776 0.136969 0.112981 0.0200845] Testing auto correlation -------------------------------------------------------------------------- xcorr(x) = [0.170114 1.41078 1.78954 -0.36962 -5.83 3.57721 -2.23494 -1.06105 -3.00721 14.5 -3.00721 -1.06105 -2.23494 3.57721 -5.83 -0.36962 1.78954 1.41078 0.170114] xcorr(x,0) = [14.5] xcorr(x,5) = [-5.83 3.57721 -2.23494 -1.06105 -3.00721 14.5 -3.00721 -1.06105 -2.23494 3.57721 -5.83] xcorr(x,-1) = [0.170114 1.41078 1.78954 -0.36962 -5.83 3.57721 -2.23494 -1.06105 -3.00721 14.5 -3.00721 -1.06105 -2.23494 3.57721 -5.83 -0.36962 1.78954 1.41078 0.170114] xcorr(x,0,biased) = [1.45] xcorr(x,5,biased) = [-0.583 0.357721 -0.223494 -0.106105 -0.300721 1.45 -0.300721 -0.106105 -0.223494 0.357721 -0.583] xcorr(x,-1,biased) = [0.0170114 0.141078 0.178954 -0.036962 -0.583 0.357721 -0.223494 -0.106105 -0.300721 1.45 -0.300721 -0.106105 -0.223494 0.357721 -0.583 -0.036962 0.178954 0.141078 0.0170114] xcorr(x,0,unbiased) = [1.45] xcorr(x,5,unbiased) = [-1.166 0.596201 -0.319278 -0.132632 -0.334135 1.45 -0.334135 -0.132632 -0.319278 0.596201 -1.166] xcorr(x,-1,unbiased) = [0.170114 0.70539 0.596515 -0.092405 -1.166 0.596201 -0.319278 -0.132632 -0.334135 1.45 -0.334135 -0.132632 -0.319278 0.596201 -1.166 -0.092405 0.596515 0.70539 0.170114] xcorr(x,0,coeff) = [1] xcorr(x,5,coeff) = [-0.402069 0.246704 -0.154134 -0.0731761 -0.207394 1 -0.207394 -0.0731761 -0.154134 0.246704 -0.402069] xcorr(x,-1,coeff) = [0.011732 0.0972952 0.123417 -0.025491 -0.402069 0.246704 -0.154134 -0.0731761 -0.207394 1 -0.207394 -0.0731761 -0.154134 0.246704 -0.402069 -0.025491 0.123417 0.0972952 0.011732] itpp-4.3.1/tests/siso_test.cpp000066400000000000000000000156741216575753400164110ustar00rootroot00000000000000/*! * \file * \brief SISO class test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" using namespace itpp; using std::cout; using std::endl; using std::string; using std::fixed; int main(void) { //general parameters string map_metric="maxlogMAP"; ivec gen = "07 05";//octal form, feedback first int constraint_length = 3; int nb_errors_lim = 300; int nb_bits_lim = int(1e4); int perm_len = (1<<14);//total number of bits in a block (with tail) int nb_iter = 10;//number of iterations in the turbo decoder vec EbN0_dB = "0.0 0.5 1.0 1.5 2.0"; double R = 1.0/3.0;//coding rate (non punctured PCCC) double Ec = 1.0;//coded bit energy //other parameters int nb_bits = perm_len-(constraint_length-1);//number of bits in a block (without tail) vec sigma2 = (0.5*Ec/R)*pow(inv_dB(EbN0_dB), -1.0);//N0/2 double Lc;//scaling factor int nb_blocks;//number of blocks int nb_errors; ivec perm(perm_len); ivec inv_perm(perm_len); bvec bits(nb_bits); int cod_bits_len = perm_len*gen.length(); bmat cod1_bits;//tail is added bvec tail; bvec cod2_input; bmat cod2_bits; int rec_len = int(1.0/R)*perm_len; bvec coded_bits(rec_len); vec rec(rec_len); vec dec1_intrinsic_coded(cod_bits_len); vec dec2_intrinsic_coded(cod_bits_len); vec apriori_data(perm_len);//a priori LLR for information bits vec extrinsic_coded(perm_len); vec extrinsic_data(perm_len); bvec rec_bits(perm_len); int snr_len = EbN0_dB.length(); mat ber(nb_iter,snr_len); ber.zeros(); register int en,n; //Recursive Systematic Convolutional Code Rec_Syst_Conv_Code cc; cc.set_generator_polynomials(gen, constraint_length);//initial state should be the zero state //BPSK modulator BPSK bpsk; //AWGN channel AWGN_Channel channel; //SISO modules SISO siso; siso.set_generators(gen, constraint_length); siso.set_map_metric(map_metric); //BER BERC berc; //Fix random generators RNG_reset(12345); cout << "=============================================" << endl; cout << " Starting Simulation " << endl; cout << " Bit error rate as a function of Eb/N0 " << endl; cout << "=============================================" << endl; cout << " Block length = " << perm_len << endl; cout << " Generator polynomials = " << std::oct << gen << std::dec << endl; cout << " Number of iterations = " << nb_iter << endl; cout << " Max number of errors = " << nb_errors_lim << endl; cout << " Max number of tx bits = " << nb_bits_lim << endl; cout << " Turbo encoder rate 1/3 (plus tail bits)" << endl; cout << "=============================================" << endl; //main loop for (en=0;en A(i)) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Introsort: Successful!" << endl; else cout << "Introsort: Failed!" << endl; A = URNG(20000); sort(A, QUICKSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Quicksort: Successful!" << endl; else cout << "Quicksort: Failed!" << endl; A = URNG(20000); sort(A, HEAPSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(i - 1) > A(i)) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Heapsort: Successful!" << endl; else cout << "Heapsort: Failed!" << endl; A = URNG(20000); I = sort_index(A); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Introsort (index): Successful!" << endl; else cout << "Introsort (index): Failed!" << endl; A = URNG(20000); I = sort_index(A, QUICKSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Quicksort (index): Successful!" << endl; else cout << "Quicksort (index): Failed!" << endl; A = URNG(20000); I = sort_index(A, HEAPSORT); failedSort = 0; for (int i = 1; i < A.length(); i++) { if (A(I(i - 1)) > A(I(i))) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Heapsort (index): Successful!" << endl; else cout << "Heapsort (index): Failed!" << endl; cout << endl << endl; cout << "Vectors of length 15, using uniform random integers (0,10):" << endl; B = IURNG(15); cout << "Introsort:" << endl; cout << " B (before sort): " << B << endl; sort(B); cout << " B (after sort): " << B << endl; B = IURNG(15); cout << "Quicksort:" << endl; cout << " B (before sort): " << B << endl; sort(B, QUICKSORT); cout << " B (after sort): " << B << endl; B = IURNG(15); cout << "Heapsort:" << endl; cout << " B (before sort): " << B << endl; sort(B, HEAPSORT); cout << " B (after sort): " << B << endl; B = IURNG(15); cout << "Insertion sort:" << endl; cout << " B (before sort): " << B << endl; sort(B, INSERTSORT); cout << " B (after sort): " << B << endl; B = IURNG(15); cout << "Introsort (index):" << endl; cout << " B: " << B << endl; I = sort_index(B); cout << " I: " << I << endl; cout << " B(I): " << B(I) << endl; B = IURNG(15); cout << "Quicksort (index):" << endl; cout << " B: " << B << endl; I = sort_index(B, QUICKSORT); cout << " I: " << I << endl; cout << " B(I): " << B(I) << endl; B = IURNG(15); cout << "Heapsort (index):" << endl; cout << " B: " << B << endl; I = sort_index(B, HEAPSORT); cout << " I: " << I << endl; cout << " B(I): " << B(I) << endl; B = IURNG(15); cout << "Insertion sort (index):" << endl; cout << " B: " << B << endl; I = sort_index(B, INSERTSORT); cout << " I: " << I << endl; cout << " B(I): " << B(I) << endl; cout << endl << endl; cout << "Vectors of length 20000, using uniform random integers (0,10):" << endl; B = IURNG(20000); sort(B); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Introsort: Successful!" << endl; else cout << "Introsort: Failed!" << endl; B = IURNG(20000); sort(B, QUICKSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Quicksort: Successful!" << endl; else cout << "Quicksort: Failed!" << endl; B = IURNG(20000); sort(B, HEAPSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(i - 1) > B(i)) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Heapsort: Successful!" << endl; else cout << "Heapsort: Failed!" << endl; B = IURNG(20000); I = sort_index(B); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Introsort (index): Successful!" << endl; else cout << "Introsort (index): Failed!" << endl; B = IURNG(20000); I = sort_index(B, QUICKSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Quicksort (index): Successful!" << endl; else cout << "Quicksort (index): Failed!" << endl; B = IURNG(20000); I = sort_index(B, HEAPSORT); failedSort = 0; for (int i = 1; i < B.length(); i++) { if (B(I(i - 1)) > B(I(i))) { cout << "error in sort!" << endl; failedSort++; } } if (failedSort == 0) cout << "Heapsort (index): Successful!" << endl; else cout << "Heapsort (index): Failed!" << endl; } itpp-4.3.1/tests/sort_test.ref000066400000000000000000000074471216575753400164140ustar00rootroot00000000000000----------------- Sorting Tests ----------------- Vectors of length 15, using uniform random doubles (0,1): Introsort: A (before sort): [0.793 0.881 0.395 0.029 0.583 0.427 0.930 0.065 0.946 0.773 0.158 0.358 0.856 0.677 0.156] A (after sort): [0.029 0.065 0.156 0.158 0.358 0.395 0.427 0.583 0.677 0.773 0.793 0.856 0.881 0.930 0.946] Quicksort: A (before sort): [0.163 0.512 0.913 0.616 0.855 0.591 0.013 0.533 0.415 0.538 0.950 0.709 0.932 0.479 0.603] A (after sort): [0.013 0.163 0.415 0.479 0.512 0.533 0.538 0.591 0.603 0.616 0.709 0.855 0.913 0.932 0.950] Heapsort: A (before sort): [0.409 0.462 0.659 0.214 0.014 0.304 0.468 0.958 0.193 0.219 0.250 0.839 0.018 0.024 0.613] A (after sort): [0.014 0.018 0.024 0.193 0.214 0.219 0.250 0.304 0.409 0.462 0.468 0.613 0.659 0.839 0.958] Insertion Sort: A (before sort): [0.745 0.422 0.150 0.716 0.899 0.025 0.543 0.764 0.921 0.439 0.017 0.216 0.748 0.763 0.118] A (after sort): [0.017 0.025 0.118 0.150 0.216 0.422 0.439 0.543 0.716 0.745 0.748 0.763 0.764 0.899 0.921] Introsort (index): A: [0.427 0.179 0.917 0.036 0.678 0.873 0.892 0.845 0.125 0.343 0.697 0.535 0.015 0.414 0.553] I: [12 3 8 1 9 13 0 11 14 4 10 7 5 6 2] A(I): [0.015 0.036 0.125 0.179 0.343 0.414 0.427 0.535 0.553 0.678 0.697 0.845 0.873 0.892 0.917] Quicksort (index): A: [0.988 0.843 0.644 0.171 0.201 0.051 0.259 0.767 0.179 0.355 0.375 0.846 0.035 0.489 0.031] I: [14 12 5 3 8 4 6 9 10 13 2 7 1 11 0] A(I): [0.031 0.035 0.051 0.171 0.179 0.201 0.259 0.355 0.375 0.489 0.644 0.767 0.843 0.846 0.988] Heapsort (index): A: [0.710 0.032 0.366 0.256 0.058 0.425 0.772 0.481 0.819 0.753 0.086 0.687 0.081 0.333 0.469] I: [1 4 12 10 3 13 2 5 14 7 11 0 9 6 8] A(I): [0.032 0.058 0.081 0.086 0.256 0.333 0.366 0.425 0.469 0.481 0.687 0.710 0.753 0.772 0.819] Insertion sort (index): A: [0.304 0.157 0.644 0.619 0.248 0.784 0.193 0.991 0.633 0.942 0.556 0.696 0.824 0.800 0.417] I: [1 6 4 0 14 10 3 8 2 11 5 13 12 9 7] A(I): [0.157 0.193 0.248 0.304 0.417 0.556 0.619 0.633 0.644 0.696 0.784 0.800 0.824 0.942 0.991] Vectors of length 20000, using uniform random doubles (0,1): Introsort: Successful! Quicksort: Successful! Heapsort: Successful! Introsort (index): Successful! Quicksort (index): Successful! Heapsort (index): Successful! Vectors of length 15, using uniform random integers (0,10): Introsort: B (before sort): [9 2 5 5 5 0 5 5 8 6 2 7 0 4 7] B (after sort): [0 0 2 2 4 5 5 5 5 5 6 7 7 8 9] Quicksort: B (before sort): [2 6 8 9 1 7 1 8 8 3 4 5 7 0 1] B (after sort): [0 1 1 1 2 3 4 5 6 7 7 8 8 8 9] Heapsort: B (before sort): [7 3 0 4 2 8 9 2 5 0 8 3 3 8 3] B (after sort): [0 0 2 2 3 3 3 3 4 5 7 8 8 8 9] Insertion sort: B (before sort): [3 5 1 10 9 7 5 5 9 8 3 3 7 7 0] B (after sort): [0 1 3 3 3 5 5 5 7 7 7 8 9 9 10] Introsort (index): B: [6 6 7 9 8 3 1 9 7 8 9 2 9 8 3] I: [6 11 5 14 0 1 2 8 4 9 13 3 7 10 12] B(I): [1 2 3 3 6 6 7 7 8 8 8 9 9 9 9] Quicksort (index): B: [8 5 4 6 0 4 9 7 5 8 0 2 4 10 3] I: [10 4 11 14 2 5 12 1 8 3 7 0 9 6 13] B(I): [0 0 2 3 4 4 4 5 5 6 7 8 8 9 10] Heapsort (index): B: [4 10 8 9 0 5 3 5 0 7 2 5 3 3 1] I: [4 8 14 10 6 12 13 0 11 5 7 9 2 3 1] B(I): [0 0 1 2 3 3 3 4 5 5 5 7 8 9 10] Insertion sort (index): B: [9 10 2 2 1 2 8 7 6 10 9 5 1 2 5] I: [4 12 2 3 5 13 11 14 8 7 6 0 10 1 9] B(I): [1 1 2 2 2 2 5 5 6 7 8 9 9 10 10] Vectors of length 20000, using uniform random integers (0,10): Introsort: Successful! Quicksort: Successful! Heapsort: Successful! Introsort (index): Successful! Quicksort (index): Successful! Heapsort (index): Successful! itpp-4.3.1/tests/source_test.cpp000066400000000000000000000046221216575753400167230ustar00rootroot00000000000000/*! * \file * \brief Deterministic sources test program * \author Tobias Ringstrom, Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include #include using namespace itpp; using namespace std; #define LOOP_SIZE 100000 #define THRESHOLD 1e-13 #define REALRUN(name,s) \ for (int i = 0; i < LOOP_SIZE; i++) \ real_result(i) = s(); \ show(name, mean(real_result), variance(real_result)); void show(const char *name, double sm, double sv) { cout << setw(18) << name << " " << setw(20) << round_to_zero(sm, THRESHOLD) << " " << setw(20) << round_to_zero(sv, THRESHOLD) << endl; } int main() { Sine_Source s10(20.0 / LOOP_SIZE); Square_Source s11(20.0 / LOOP_SIZE); Triangle_Source s12(20.0 / LOOP_SIZE); Sawtooth_Source s13(20.0 / LOOP_SIZE); Impulse_Source s14(20.0 / LOOP_SIZE); Pattern_Source s15(vec("1 3")); RNG_reset(12345); cout.setf(ios::fixed); cout.precision(8); cout << setw(18) << "Source" << " " << setw(20) << "sim mean" << " " << setw(20) << "sim var" << endl << "============================================================================" << endl; vec real_result(LOOP_SIZE); REALRUN("Sine", s10); REALRUN("Square", s11); REALRUN("Triangle", s12); REALRUN("Sawtooth", s13); REALRUN("Impulse", s14); REALRUN("Pattern", s15); return 0; } itpp-4.3.1/tests/source_test.ref000066400000000000000000000010061216575753400167060ustar00rootroot00000000000000 Source sim mean sim var ============================================================================ Sine 0.00000000 0.50000500 Square 0.00002000 1.00001000 Triangle 0.00000000 0.33333677 Sawtooth 0.00020000 0.33333665 Impulse 0.00019000 0.00018997 Pattern 2.00000000 1.00001000 itpp-4.3.1/tests/sparse_test.cpp000066400000000000000000000077311216575753400167240ustar00rootroot00000000000000#include using std::cout; using std::endl; using namespace itpp; int main() { //********* Testing Sparse_Vec ********* cout << endl << "******* Testing Sparse_Vec *******" << endl; Sparse_Vec v1(5), v2(5); Sparse_Vec v_out(5); ivec index_vec; vec v; v1.set(1, 3); v2.set(1, 1); v2.set(2, 2); cout << "v1=" << v1.full() << endl; cout << "v2=" << v2.full() << endl; v_out = v1 + v2; cout << "v1+v2=" << endl << v_out.full() << endl; cout << "v1*v2=" << v1*v2 << endl; cout << "density(v1)=" << v1.density() << endl; v1.zeros(); cout << "v1=" << v1.full() << endl; index_vec = "0 2 2 3"; v = "1 2 4 3"; v1.set(index_vec, v); cout << "Set " << v << " to the indices " << index_vec << endl; cout << "v1=" << v1.full() << endl; v1.set_new(index_vec, v); cout << "Set new " << v << " to the indices " << index_vec << endl; cout << "Unnoticed error in set_new() if the same index is used several times" << endl; cout << "v1=" << v1.full() << endl; v1.zeros(); v1 -= v2; cout << "v1(for v1-=v2) = " << v1.full() << endl; v1 /= 4; cout << "v1(for v1/=4) = " << v1.full() << endl; v1 *= 2; cout << "v1(for v1*=2) = " << v1.full() << endl; v2 /= 2; v1 += v2; cout << "v1(for v1+=v2/2) = " << v1.full() << endl; cout << "number of non-zero elements in v1: nnz = " << v1.nnz() << endl; index_vec = "0 2 2 1"; v = "-1 5 -2 4"; cout << "Add " << v << " to the indices " << index_vec << endl; v1.add(index_vec, v); cout << "v1=" << v1.full() << endl; v1.clear_elem(2); cout << "v1(element 2 cleared) = " << v1.full() << endl; Sparse_Vec v3; v3.set_size(2); v3.set(0, 3); cout << "v3=" << endl << v3.full() << endl; v3.set_size(5); cout << "v3=" << v3.full() << endl; Sparse_Vec v4(5), v5(5); v4.set(1, 1); v5.set(1, 1); v4.set(2, 2); v5.set(2, 4); cout << "v4=" << v4.full() << endl; cout << "v5=" << v5.full() << endl; if (v4 == v5) cout << "v4 equal to v5" << endl; else cout << "v4 not equal to v5" << endl; //********* Testing Sparse_Mat ********* cout << endl << "******* Testing Sparse_Mat *******" << endl; Sparse_Mat m1(3, 3), m2(3, 3); m1.set(1, 1, 3); m2.set(1, 2, 1); m2.set(2, 1, 2); cout << "m1=" << endl << full(m1) << endl; cout << "m2=" << endl << full(m2) << endl; cout << "m1+m2=" << endl << full(m1 + m2) << endl; cout << "m1*m2=" << endl << full(m1*m2) << endl; cout << "density(m1)=" << m1.density() << endl; cout << "transpose(m2)=" << endl << full(transpose(m2)) << endl; m1.zeros(); cout << "m1.zeros()=" << endl << full(m1) << endl; m1 -= m2; cout << "m1(-=m2)=" << endl << full(m1) << endl; m1 /= 4; cout << "m1(/=4)=" << endl << full(m1) << endl; m1 *= 2; cout << "m1(*=2)=" << endl << full(m1) << endl; m1.add_elem(0, 2, 4); cout << "m1.add_elem(0,2,4)=" << endl << full(m1) << endl; m1.clear_elem(1, 2); cout << "m1.clear_elem(1,2)=" << endl << full(m1) << endl; Sparse_Mat m3(2, 3), m4(3, 2); m3.set(0, 0, 3); m4.set(0, 1, 1); m4.set(2, 0, 2); cout << "m3=" << endl << full(m3) << endl; cout << "m4=" << endl << full(m4) << endl; cout << "m3*m4=" << endl << full(m3*m4) << endl; cout << "transpose(m4)=" << endl << full(transpose(m4)) << endl; cout << "trans_mult(m4,m4)=" << full(trans_mult(m4, m4)) << endl; cout << "mult_trans(m4,m4)=" << full(mult_trans(m4, m4)) << endl; cout << "mult_trans(m4,m4)=" << full(mult_trans(m4, m4)) << endl; v = "1 2 3"; cout << "v = " << v << endl; cout << "m3 * v = " << m3*v << endl; Sparse_Mat A(3, 5), B(5, 3), C; vec x(3), y(5), z1, z2; A = randn(3, 5); B = randn(5, 3); x = randn(3); y = randn(5); cout << "A = " << full(A) << endl; cout << "B = " << full(B) << endl; cout << "x = " << x << endl; cout << "y = " << y << endl; C = A * B; z1 = A * y; z2 = x * A; cout << "C = " << full(C) << endl; cout << "z1 = " << z1 << endl; cout << "z2 = " << z2 << endl; return 0; } itpp-4.3.1/tests/sparse_test.ref000066400000000000000000000036601216575753400167130ustar00rootroot00000000000000 ******* Testing Sparse_Vec ******* v1=[0 3 0 0 0] v2=[0 1 2 0 0] v1+v2= [0 4 2 0 0] v1*v2=3 density(v1)=0.2 v1=[0 0 0 0 0] Set [1 2 4 3] to the indices [0 2 2 3] v1=[1 0 6 3 0] Set new [1 2 4 3] to the indices [0 2 2 3] Unnoticed error in set_new() if the same index is used several times v1=[1 0 4 3 0] v1(for v1-=v2) = [0 -1 -2 0 0] v1(for v1/=4) = [0 -0.25 -0.5 0 0] v1(for v1*=2) = [0 -0.5 -1 0 0] v1(for v1+=v2/2) = [0 0 0 0 0] number of non-zero elements in v1: nnz = 0 Add [-1 5 -2 4] to the indices [0 2 2 1] v1=[-1 4 3 0 0] v1(element 2 cleared) = [-1 4 0 0 0] v3= [3 0] v3=[0 0 0 0 0] v4=[0 1 2 0 0] v5=[0 1 4 0 0] v4 not equal to v5 ******* Testing Sparse_Mat ******* m1= [[0 0 0] [0 3 0] [0 0 0]] m2= [[0 0 0] [0 0 1] [0 2 0]] m1+m2= [[0 0 0] [0 3 1] [0 2 0]] m1*m2= [[0 0 0] [0 0 3] [0 0 0]] density(m1)=0.111111 transpose(m2)= [[0 0 0] [0 0 2] [0 1 0]] m1.zeros()= [[0 0 0] [0 0 0] [0 0 0]] m1(-=m2)= [[0 0 0] [0 0 -1] [0 -2 0]] m1(/=4)= [[0 0 0] [0 0 -0.25] [0 -0.5 0]] m1(*=2)= [[0 0 0] [0 0 -0.5] [0 -1 0]] m1.add_elem(0,2,4)= [[0 0 4] [0 0 -0.5] [0 -1 0]] m1.clear_elem(1,2)= [[0 0 4] [0 0 0] [0 -1 0]] m3= [[3 0 0] [0 0 0]] m4= [[0 1] [0 0] [2 0]] m3*m4= [[0 3] [0 0]] transpose(m4)= [[0 0 2] [1 0 0]] trans_mult(m4,m4)=[[4 0] [0 1]] mult_trans(m4,m4)=[[1 0 0] [0 0 0] [0 0 4]] mult_trans(m4,m4)=[[1 0 0] [0 0 0] [0 0 4]] v = [1 2 3] m3 * v = [3 0] A = [[-0.283885 1.24942 -0.596145 -0.300385 2.36508] [1.36446 1.55783 -1.19732 -1.0746 1.22804] [0.906001 0.56497 -1.26756 2.36476 0.234136]] B = [[-0.732016 -0.869443 -0.227649] [-2.10553 -0.0504762 -1.83729] [-0.923457 0.799682 0.0511841] [-1.89227 1.02849 1.44132] [-0.664315 -0.900489 -1.48058]] x = [1.07507 -0.396638 0.51065] y = [1.10323 0.910165 1.12342 1.46072 -0.269572] C = [[-2.87512 -2.73164 -6.19606] [-1.95557 -4.43348 -6.60115] [-5.31254 0.391404 1.75258]] z1 = [-0.922069 -0.322638 3.48086] z2 = [-0.383745 1.01382 -0.813279 1.31086 2.1751] itpp-4.3.1/tests/specmat_test.cpp000066400000000000000000000043051216575753400170550ustar00rootroot00000000000000/*! * \file * \brief Test program of special vectors and matrices * \author Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace std; using namespace itpp; int main() { cout << "=================================" << endl; cout << " Test of specmat routines" << endl; cout << "=================================" << endl; cout.setf(ios::fixed); cout.precision(3); bvec b1 = randb(7); bvec b2 = randb(13); cout << "b1 = " << b1 << endl; cout << "b2 = " << b2 << endl; cout << "toeplitz(b1, b2) =" << endl << toeplitz(b1, b2) << endl; cout << "toeplitz(b1) =" << endl << toeplitz(b1) << endl << endl; vec v1 = randn(5); vec v2 = randn(7); cout << "v1 = " << v1 << endl; cout << "v2 = " << v2 << endl; cout << "toeplitz(v1, v2) =" << endl << toeplitz(v1, v2) << endl; cout << "toeplitz(v1) =" << endl << toeplitz(v1) << endl << endl; cvec c1 = randn_c(4); cvec c2 = randn_c(3); cout << "c1 = " << c1 << endl; cout << "c2 = " << c2 << endl; cout << "toeplitz(c1, c2) =" << endl << toeplitz(c1, c2) << endl; cout << "toeplitz(c1, c1) =" << endl << toeplitz(c1, c1) << endl; cout << "toeplitz(c1) =" << endl << toeplitz(c1) << endl << endl; return 0; } itpp-4.3.1/tests/specmat_test.ref000066400000000000000000000034621216575753400170520ustar00rootroot00000000000000================================= Test of specmat routines ================================= b1 = [0 0 1 1 0 1 0] b2 = [1 0 0 1 1 0 0 1 1 0 0 0 0] toeplitz(b1, b2) = [[0 0 0 1 1 0 0 1 1 0 0 0 0] [0 0 0 0 1 1 0 0 1 1 0 0 0] [1 0 0 0 0 1 1 0 0 1 1 0 0] [1 1 0 0 0 0 1 1 0 0 1 1 0] [0 1 1 0 0 0 0 1 1 0 0 1 1] [1 0 1 1 0 0 0 0 1 1 0 0 1] [0 1 0 1 1 0 0 0 0 1 1 0 0]] toeplitz(b1) = [[0 0 1 1 0 1 0] [0 0 0 1 1 0 1] [1 0 0 0 1 1 0] [1 1 0 0 0 1 1] [0 1 1 0 0 0 1] [1 0 1 1 0 0 0] [0 1 0 1 1 0 0]] v1 = [-0.869 -0.050 0.800 1.028 -0.900] v2 = [-0.228 -1.837 0.051 1.441 -1.481 1.075 -0.397] toeplitz(v1, v2) = [[-0.869 -1.837 0.051 1.441 -1.481 1.075 -0.397] [-0.050 -0.869 -1.837 0.051 1.441 -1.481 1.075] [0.800 -0.050 -0.869 -1.837 0.051 1.441 -1.481] [1.028 0.800 -0.050 -0.869 -1.837 0.051 1.441] [-0.900 1.028 0.800 -0.050 -0.869 -1.837 0.051]] toeplitz(v1) = [[-0.869 -0.050 0.800 1.028 -0.900] [-0.050 -0.869 -0.050 0.800 1.028] [0.800 -0.050 -0.869 -0.050 0.800] [1.028 0.800 -0.050 -0.869 -0.050] [-0.900 1.028 0.800 -0.050 -0.869]] c1 = [0.361+0.780i 0.644+0.794i 1.033-0.191i -0.711+1.324i] c2 = [0.350+0.510i 0.174+0.475i -0.708-0.127i] toeplitz(c1, c2) = [[0.361+0.780i 0.174+0.475i -0.708-0.127i] [0.644+0.794i 0.361+0.780i 0.174+0.475i] [1.033-0.191i 0.644+0.794i 0.361+0.780i] [-0.711+1.324i 1.033-0.191i 0.644+0.794i]] toeplitz(c1, c1) = [[0.361+0.780i 0.644+0.794i 1.033-0.191i -0.711+1.324i] [0.644+0.794i 0.361+0.780i 0.644+0.794i 1.033-0.191i] [1.033-0.191i 0.644+0.794i 0.361+0.780i 0.644+0.794i] [-0.711+1.324i 1.033-0.191i 0.644+0.794i 0.361+0.780i]] toeplitz(c1) = [[0.361+0.780i 0.644+0.794i 1.033-0.191i -0.711+1.324i] [0.644-0.794i 0.361+0.780i 0.644+0.794i 1.033-0.191i] [1.033+0.191i 0.644-0.794i 0.361+0.780i 0.644+0.794i] [-0.711-1.324i 1.033+0.191i 0.644-0.794i 0.361+0.780i]] itpp-4.3.1/tests/stat_test.cpp000066400000000000000000000056401216575753400163770ustar00rootroot00000000000000/*! * \file * \brief Miscellaneous statistical routines test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { cout << "=================================" << endl; cout << " Test of statistical routines " << endl; cout << "=================================" << endl; vec a = randn(5); cout << "a = " << a << endl << endl; cout << "max(a) = " << max(a) << endl; cout << "min(a) = " << min(a) << endl; cout << "mean(a) = " << mean(a) << endl; cout << "geometric_mean(abs(a)) = " << geometric_mean(abs(a)) << endl; cout << "norm(a) = " << norm(a) << endl; cout << "norm(a, 2) = " << norm(a, 2) << endl; cout << "norm(a, 1) = " << norm(a, 1) << endl; cout << "norm(a, \"fro\") = " << norm(a, "fro") << endl; cout << "energy(a) = " << energy(a) << endl; cout << "variance(a) = " << variance(a) << endl; cout << "moment(a, 1) = " << round_to_zero(moment(a, 1)) << endl; cout << "moment(a, 2) = " << moment(a, 2) << endl; cout << "moment(a, 3) = " << moment(a, 3) << endl; cout << "skewness(a) = " << skewness(a) << endl; cout << "kurtosisexcess(a) = " << kurtosisexcess(a) << endl; cout << "kurtosis(a) = " << kurtosis(a) << endl << endl; mat A = randn(5, 5); cout << "A = " << A << endl << endl; cout << "max(A) = " << max(A) << endl; cout << "max(A, 1) = " << max(A, 1) << endl; cout << "max(A, 2) = " << max(A, 2) << endl; cout << "min(A) = " << min(A) << endl; cout << "min(A, 1) = " << min(A, 1) << endl; cout << "min(A, 2) = " << min(A, 2) << endl; cout << "mean(A) = " << mean(A) << endl; cout << "geometric_mean(abs(A)) = " << geometric_mean(abs(A)) << endl; cout << "norm(A) = " << norm(A) << endl; cout << "norm(A, 2) = " << norm(A, 2) << endl; cout << "norm(A, 1) = " << norm(A, 1) << endl; cout << "norm(A, \"fro\") = " << norm(A, "fro") << endl << endl; return 0; } itpp-4.3.1/tests/stat_test.ref000066400000000000000000000023251216575753400163660ustar00rootroot00000000000000================================= Test of statistical routines ================================= a = [-0.283885 1.36446 0.906001 1.24942 1.55783] max(a) = 1.55783 min(a) = -0.283885 mean(a) = 0.958766 geometric_mean(abs(a)) = 0.926599 norm(a) = 2.59828 norm(a, 2) = 2.59828 norm(a, 1) = 5.3616 norm(a, "fro") = 2.59828 energy(a) = 6.75107 variance(a) = 0.538728 moment(a, 1) = 0 moment(a, 2) = 0.430982 moment(a, 3) = -0.322541 skewness(a) = -1.21597 kurtosisexcess(a) = -0.977874 kurtosis(a) = 2.02213 A = [[0.56497 -1.0746 -0.732016 -0.869443 -0.227649] [-0.596145 2.36476 -2.10553 -0.0504762 -1.83729] [-1.19732 2.36508 -0.923457 0.799682 0.0511841] [-1.26756 1.22804 -1.89227 1.02849 1.44132] [-0.300385 0.234136 -0.664315 -0.900489 -1.48058]] max(A) = [0.56497 2.36508 -0.664315 1.02849 1.44132] max(A, 1) = [0.56497 2.36508 -0.664315 1.02849 1.44132] max(A, 2) = [0.56497 2.36476 2.36508 1.44132 0.234136] min(A) = [-1.26756 -1.0746 -2.10553 -0.900489 -1.83729] min(A, 1) = [-1.26756 -1.0746 -2.10553 -0.900489 -1.83729] min(A, 2) = [-1.0746 -2.10553 -1.19732 -1.89227 -1.48058] mean(A) = -0.241675 geometric_mean(abs(A)) = 0.748042 norm(A) = 5.02569 norm(A, 2) = 5.02569 norm(A, 1) = 7.26662 norm(A, "fro") = 6.20633 itpp-4.3.1/tests/stc_test.cpp000066400000000000000000000215351216575753400162160ustar00rootroot00000000000000/*! * \file * \brief STC class test program * \author Bogdan Cristea * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2011 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include "itpp/itcomm.h" //returns true if the absolute difference of all elements of matrices is below err bool near(const itpp::cmat &M1, const itpp::cmat &M2, double err) { if (M1.rows() != M2.rows() || M1.cols() != M2.cols()) { return false; } register int n, k; for (n = 0; n < M1.rows(); ++n) { for (k = 0; k < M1.cols(); ++k) { if (std::abs(M1(n,k)-M2(n,k)) >= err) { return false; } } } return true; } int main(void) { int em_antenna = 2; int channel_uses = 2; const int const_size = 4;//QAM const double abs_err = 1e-12; std::cout << "Space Time Code class test started" << std::endl; std::cout << "Checking V-BLAST" << std::endl; std::string code_name("V-BLAST_MxN"); //should succeed itpp::STC stc(code_name, const_size, em_antenna, channel_uses); //check parameters if (2 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (2 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } //check generated matrices itpp::cmat ref_vblast("1 0; 0 0; 0 1; 0 0; 0 0; 1 0; 0 0; 0 1"); if (!near(ref_vblast, stc.get_1st_gen_matrix(), abs_err) || !near(ref_vblast, stc.get_2nd_gen_matrix(), abs_err)) { std::cout << "Generator matrices are different" << std::endl; std::cout << "ref_vblast = " << ref_vblast << std::endl; std::cout << "A = " << stc.get_1st_gen_matrix() << std::endl; } std::cout << "Checking improved V-BLAST" << std::endl; code_name = "imp_V-BLAST_MxN"; //should succeed stc.setup(code_name, const_size, em_antenna, channel_uses); //check parameters if (2 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (2 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } //check generated matrices itpp::cmat ref_imp_vblast("1 0; 0 1; 0 1; 1 0; 1 0; 0 -1; 0 1; -1 0"); ref_imp_vblast /= std::sqrt(2.0); if (!near(ref_imp_vblast, stc.get_1st_gen_matrix(), abs_err) || !near(ref_imp_vblast, stc.get_2nd_gen_matrix(), abs_err)) { std::cout << "Generator matrices are different" << std::endl; std::cout << "ref_imp_vblast = " << ref_imp_vblast << std::endl; std::cout << "A = " << stc.get_1st_gen_matrix() << std::endl; } std::cout << "Checking Alamouti code" << std::endl; code_name = "Alamouti_2xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (2 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (2 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (2 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } //check generated matrices itpp::cmat ref_A("1 0; 0 1; 0 1; -1 0"); itpp::cmat ref_B("1 0; 0 -1; 0 1; 1 0"); if (!near(ref_A, stc.get_1st_gen_matrix(), abs_err) || !near(ref_B, stc.get_2nd_gen_matrix(), abs_err)) { std::cout << "Generator matrices are different" << std::endl; std::cout << "ref_A = " << ref_A << std::endl; std::cout << "A = " << stc.get_1st_gen_matrix() << std::endl; std::cout << "ref_B = " << ref_B << std::endl; std::cout << "B = " << stc.get_2nd_gen_matrix() << std::endl; } std::cout << "Checking switched Alamouti code" << std::endl; code_name = "Switched_Alamouti_4xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (4 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (4 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking double Alamouti code" << std::endl; code_name = "Double_Alamouti_4xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (4 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (2 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking Jafarkhani code" << std::endl; code_name = "Jafarkhani_4xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (4 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (4 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking Golden code" << std::endl; code_name = "Golden_2x2"; //should succeed stc.setup(code_name, const_size); //check parameters if (2 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (2 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking Damen code" << std::endl; code_name = "Damen_2x2"; //should succeed stc.setup(code_name, const_size); //check parameters if (2 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (2 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking orthogonal code 3xN" << std::endl; code_name = "34ortho_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (3 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (4 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (3 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking 36 LD code 3xN" << std::endl; code_name = "36LD_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (3 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (4 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (4 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking 37 LD code 3xN" << std::endl; code_name = "37LD_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (3 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (6 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (6 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Checking 39 LD code 3xN" << std::endl; code_name = "39LD_3xN"; //should succeed stc.setup(code_name, const_size); //check parameters if (3 != stc.get_nb_emission_antenna()) { std::cout << "Number of emission antenna is wrong" << std::endl; } if (6 != stc.get_channel_uses()) { std::cout << "Channel uses is wrong" << std::endl; } if (6 != stc.get_nb_symbols_per_block()) { std::cout << "Number of symbols per block is wrong" << std::endl; } std::cout << "Space Time Code class test finished" << std::endl; return EXIT_SUCCESS; } itpp-4.3.1/tests/stc_test.ref000066400000000000000000000005561216575753400162100ustar00rootroot00000000000000Space Time Code class test started Checking V-BLAST Checking improved V-BLAST Checking Alamouti code Checking switched Alamouti code Checking double Alamouti code Checking Jafarkhani code Checking Golden code Checking Damen code Checking orthogonal code 3xN Checking 36 LD code 3xN Checking 37 LD code 3xN Checking 39 LD code 3xN Space Time Code class test finished itpp-4.3.1/tests/svd_test.cpp000066400000000000000000000036541216575753400162230ustar00rootroot00000000000000/*! * \file * \brief SVD decomposition test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "================================" << endl; cout << " Test of svd routines " << endl; cout << "================================" << endl; { cout << "Real matrix" << endl; mat A = randn(5, 5); mat U, V; vec S; svd(A, U, S, V); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - U*diag(S)*V^T) = " << round_to_zero(norm(A - U * diag(S) * transpose(V))) << endl; } { cout << endl << "Complex matrix" << endl; cmat A = randn_c(5, 5); cmat U, V; vec S; svd(A, U, S, V); cout << "A = " << round_to_zero(A) << endl; cout << "norm(A - U*diag(S)*V^H) = " << round_to_zero(norm(A - U * diag(S) * hermitian_transpose(V))) << endl; } return 0; } itpp-4.3.1/tests/svd_test.ref000066400000000000000000000016361216575753400162130ustar00rootroot00000000000000================================ Test of svd routines ================================ Real matrix A = [[-0.283885 0.56497 -1.0746 -0.732016 -0.869443] [1.36446 -0.596145 2.36476 -2.10553 -0.0504762] [0.906001 -1.19732 2.36508 -0.923457 0.799682] [1.24942 -1.26756 1.22804 -1.89227 1.02849] [1.55783 -0.300385 0.234136 -0.664315 -0.900489]] norm(A - U*diag(S)*V^T) = 0 Complex matrix A = [[-0.160972-1.29916i 0.794379+1.03288i -0.127081+0.388325i 1.13396-0.225782i 0.562993-0.0690923i] [0.0361926+1.01917i -0.190616-0.710921i -0.572027-1.62447i 1.07734-0.884797i -0.822132+0.953281i] [-1.04693+0.760191i 1.32367+0.349763i -0.320883+0.1836i 0.465648-0.60769i -0.128067+0.278311i] [-0.280465+0.361084i 0.510483+0.174148i -1.02371+0.214321i 0.0533137-0.121635i 0.598587-0.190616i] [0.780099+0.643584i 0.475202-0.708159i -0.98353+0.261137i -0.848777-1.28903i -0.13041+0.0775548i]] norm(A - U*diag(S)*V^H) = 0 itpp-4.3.1/tests/timer_test.cpp000066400000000000000000000037701216575753400165460ustar00rootroot00000000000000/*! * \file * \brief Timer classes test program * \author Thomas Eriksson, Tony Ottosson, Tobias Ringstrom and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace std; using namespace itpp; int main() { const double period = 2.0; const double relative_error = 0.05; CPU_Timer t1; Real_Timer t2; t1.start(); while (t1.get_time() < period) ; t1.stop(); tic(); t2.start(); while (t2.get_time() < period) ; t2.stop(); double t3 = toc(); if (fabs(t1.get_time() - period) <= relative_error * period) cout << "CPU_Timer is OK" << endl; else cout << "CPU_Timer difference: " << fabs(t1.get_time() - period) << " > " << relative_error * period << endl; if (fabs(t2.get_time() - period) <= relative_error * period) cout << "Real_Timer is OK" << endl; else cout << "Real_Timer difference: " << fabs(t1.get_time() - period) << " > " << relative_error * period << endl; if (t3 >= t2.get_time()) cout << "tic() and toc() are OK" << endl; return 0; } itpp-4.3.1/tests/timer_test.ref000066400000000000000000000000701216575753400165260ustar00rootroot00000000000000CPU_Timer is OK Real_Timer is OK tic() and toc() are OK itpp-4.3.1/tests/transforms_test.cpp000066400000000000000000000072451216575753400176250ustar00rootroot00000000000000/*! * \file * \brief Transforms test program * \author Tony Ottosson, Thomas Eriksson, Simon Wood and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { cout << "========================" << endl; cout << " Test of Transforms " << endl; cout << "========================" << endl << endl; int N, s; { vec x, z; cvec y; N = 16; x = randn(N); cout << "Test 1: FFT/IFFT; Real input vector x; N = " << N << endl << " fft_real(x, y), ifft_real(y, z):" << endl << endl; cout << "x = " << round_to_zero(x) << endl; fft_real(x, y); cout << "y = " << round_to_zero(y) << endl; ifft_real(y, z); cout << "z = " << round_to_zero(z) << endl << endl; N = 15; s = N - 4; x = randn(s); cout << "Test 2: FFT/IFFT; Real input vector x of size s = " << s << "; N = " << N << endl << " y = fft_real(x, N), z = ifft_real(y, N):" << endl << endl; cout << "x = " << round_to_zero(x) << endl; y = fft_real(x, N); cout << "y = " << round_to_zero(y) << endl; z = ifft_real(y, N); cout << "z = " << round_to_zero(z.left(s)) << endl << endl; } { cvec x, y, z; N = 16; x = randn_c(N); cout << "Test 3: FFT/IFFT; Complex input vector x; N = " << N << endl << " fft(x, y), ifft(y, z):" << endl << endl; cout << "x = " << round_to_zero(x) << endl; fft(x, y); cout << "y = " << round_to_zero(y) << endl; ifft(y, z); cout << "z = " << round_to_zero(z) << endl << endl; N = 16; s = N - 7; x = randn_c(s); cout << "Test 4: FFT/IFFT; Complex input vector x of size s = " << s << "; N = " << N << endl << " y = fft(x, N), z = ifft(y, N):" << endl << endl; cout << "x = " << round_to_zero(x) << endl; y = fft(x, N); cout << "y = " << round_to_zero(y) << endl; z = ifft(y, N); cout << "z = " << round_to_zero(z.left(s)) << endl << endl; } { vec x, y, z; N = 8; x = randn(N); cout << "Test 5: DCT/IDCT; Real input vector; N = " << N << endl << " dct(x, y), idct(y, z):" << endl << endl; cout << "x = " << round_to_zero(x) << endl; dct(x, y); cout << "y = " << round_to_zero(y) << endl; idct(y, z); cout << "z = " << round_to_zero(z) << endl << endl; N = 11; x = randn(N); cout << "Test 6: DCT/IDCT; Real input vector; N = " << N << endl << " dct(x, y), idct(y, z):" << endl << endl; cout << "x = " << round_to_zero(x) << endl; dct(x, y); cout << "y = " << round_to_zero(y) << endl; idct(y, z); cout << "z = " << round_to_zero(z) << endl; } return 0; } itpp-4.3.1/tests/transforms_test.ref000066400000000000000000000073451216575753400176200ustar00rootroot00000000000000======================== Test of Transforms ======================== Test 1: FFT/IFFT; Real input vector x; N = 16 fft_real(x, y), ifft_real(y, z): x = [-0.283885 1.36446 0.906001 1.24942 1.55783 0.56497 -0.596145 -1.19732 -1.26756 -0.300385 -1.0746 2.36476 2.36508 1.22804 0.234136 -0.732016] y = [6.38278+0i 4.7662+1.17784i -9.90964-3.59783i 0.229095-3.40945i 2.90207-1.17225i -2.23693-0.168158i -1.03906-3.21101i 1.17635+1.19015i -2.70109+0i 1.17635-1.19015i -1.03906+3.21101i -2.23693+0.168158i 2.90207+1.17225i 0.229095+3.40945i -9.90964+3.59783i 4.7662-1.17784i] z = [-0.283885 1.36446 0.906001 1.24942 1.55783 0.56497 -0.596145 -1.19732 -1.26756 -0.300385 -1.0746 2.36476 2.36508 1.22804 0.234136 -0.732016] Test 2: FFT/IFFT; Real input vector x of size s = 11; N = 15 y = fft_real(x, N), z = ifft_real(y, N): x = [-2.10553 -0.923457 -1.89227 -0.664315 -0.869443 -0.0504762 0.799682 1.02849 -0.900489 -0.227649 -1.83729] y = [-7.64275+0i -3.97384+0.725989i 0.0998153+6.08693i -2.40579-1.33773i -0.590899+0.736742i 0.524654-0.209181i -3.75607+0.0946051i -1.86799-3.32209i -1.86799+3.32209i -3.75607-0.0946051i 0.524654+0.209181i -0.590899-0.736742i -2.40579+1.33773i 0.0998153-6.08693i -3.97384-0.725989i] z = [-2.10553 -0.923457 -1.89227 -0.664315 -0.869443 -0.0504762 0.799682 1.02849 -0.900489 -0.227649 -1.83729] Test 3: FFT/IFFT; Complex input vector x; N = 16 fft(x, y), ifft(y, z): x = [0.0361926+1.01917i -1.04693+0.760191i -0.280465+0.361084i 0.780099+0.643584i 0.794379+1.03288i -0.190616-0.710921i 1.32367+0.349763i 0.510483+0.174148i 0.475202-0.708159i -0.127081+0.388325i -0.572027-1.62447i -0.320883+0.1836i -1.02371+0.214321i -0.98353+0.261137i 1.13396-0.225782i 1.07734-0.884797i] y = [1.58608+1.23407i 2.12877-0.701598i 2.36908+3.21464i 1.57954+2.72041i -0.740883+7.09282i 0.434121+2.93678i 3.54754-3.49113i -2.71384+3.78872i 2.18832-0.396461i 2.39633+1.83351i -3.66236+1.53323i -0.616777+1.69575i -1.90528-1.69757i -3.441-4.43175i 0.708659-5.00151i -3.27921+5.9768i] z = [0.0361926+1.01917i -1.04693+0.760191i -0.280465+0.361084i 0.780099+0.643584i 0.794379+1.03288i -0.190616-0.710921i 1.32367+0.349763i 0.510483+0.174148i 0.475202-0.708159i -0.127081+0.388325i -0.572027-1.62447i -0.320883+0.1836i -1.02371+0.214321i -0.98353+0.261137i 1.13396-0.225782i 1.07734-0.884797i] Test 4: FFT/IFFT; Complex input vector x of size s = 9; N = 16 y = fft(x, N), z = ifft(y, N): x = [0.465648-0.60769i 0.0533137-0.121635i -0.848777-1.28903i 0.562993-0.0690923i -0.822132+0.953281i -0.128067+0.278311i 0.598587-0.190616i -0.13041+0.0775548i -0.185926-0.664453i] y = [-0.434771-1.63337i 0.145768-0.410177i -0.745112-1.57574i -1.01347+0.670635i -0.144008+1.66812i 4.12192+1.47161i 2.17582-4.11225i -0.536654-1.77432i -1.15043-1.96364i -1.07547+0.968401i 0.751997+0.0196147i 0.364406-0.294163i -0.440435+0.653445i 3.2272+1.48574i 2.22471-3.23333i -0.0211103-1.66363i] z = [0.465648-0.60769i 0.0533137-0.121635i -0.848777-1.28903i 0.562993-0.0690923i -0.822132+0.953281i -0.128067+0.278311i 0.598587-0.190616i -0.13041+0.0775548i -0.185926-0.664453i] Test 5: DCT/IDCT; Real input vector; N = 8 dct(x, y), idct(y, z): x = [0.462237 0.849141 -0.309417 -0.115989 -0.49744 0.312621 0.897405 0.1234] y = [0.608804 0.0105139 0.88747 0.344656 -0.628456 0.215698 -0.575888 -0.399204] z = [0.462237 0.849141 -0.309417 -0.115989 -0.49744 0.312621 0.897405 0.1234] Test 6: DCT/IDCT; Real input vector; N = 11 dct(x, y), idct(y, z): x = [-0.421365 0.419113 1.27429 -0.32882 1.36355 1.18344 -0.675009 -0.901661 -1.76627 0.480208 0.0332149] y = [0.199208 1.14122 -0.47119 -1.7833 0.977654 -0.382525 -1.3101 -0.319838 -0.226145 1.49614 -0.101762] z = [-0.421365 0.419113 1.27429 -0.32882 1.36355 1.18344 -0.675009 -0.901661 -1.76627 0.480208 0.0332149] itpp-4.3.1/tests/turbo_test.cpp000066400000000000000000000331321216575753400165540ustar00rootroot00000000000000/*! * \file * \brief Turbo encoder/decoder class test program * \author Pal Frenger and Erik G. Larsson * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include using namespace itpp; using namespace std; int main() { Turbo_Codec turbo; ivec gen(2); gen(0) = 07; gen(1) = 05; int constraint_length = 3; int block_length = 400; ivec interleaver_sequence = wcdma_turbo_interleaver_sequence(block_length); int iterations = 8; string metric = "LOGMAX"; double logmax_scale_factor = 0.7; bool adaptive_stop = true; turbo.set_parameters(gen, gen, constraint_length, interleaver_sequence, iterations, metric, logmax_scale_factor, adaptive_stop); int num_blocks = 50; bmat puncture_matrix = "1 1;1 1;1 1"; Punctured_Turbo_Codec pturbo_ref; pturbo_ref.set_parameters(gen, gen, constraint_length, interleaver_sequence, puncture_matrix, iterations, metric, logmax_scale_factor, adaptive_stop); vec EbN0db = "0.0 0.5 1.0 1.5 2.0"; double A = 1.0; double Ts = 1.0; double Ec = A * A * Ts; double r = block_length / (3.0 * block_length + 8.0); // 8 tailbits double Eb = Ec / r; vec EbN0 = pow(10.0, 0.1 * EbN0db); vec N0 = Eb * pow(EbN0, -1.0); vec sigma2 = N0 / 2; ivec nrof_used_iterations; vec symbols, received; bvec input, coded_bits, decoded_bits, transmitted; bvec decoded_bits_p; Normal_RNG noise_src; RNG_reset(12345); BPSK bpsk; BERC berc; cout << "=============================================" << endl; cout << " Starting Simulation " << endl; cout << " Bit error rate as a function of Eb/N0 " << endl; cout << "=============================================" << endl; cout << " Block length = " << block_length << endl; cout << " Generator polynomials = " << std::oct << gen << std::dec << endl; cout << " Max number of Iterations = " << iterations << endl; cout << " Adaptive stop = " << adaptive_stop << endl; cout << " Eb/N0 = " << EbN0db << " [dB]" << endl; cout << " Turbo encoder rate 1/3 (plus tail bits)" << endl; cout << "=============================================" << endl; mat err = zeros(4, EbN0db.length()); mat cor = zeros(4, EbN0db.length()); mat ber = zeros(4, EbN0db.length()); mat avg_nrof_iterations = zeros(4, EbN0db.length()); LLR_calc_unit lowresllrcalc(10, 7, 9); // table with low resolution Array timer(4); for(int i = 0; i < 4; i++) { timer(i).reset(); } for(int i = 0; i < EbN0db.length(); i++) { cout << "Now simulating EbN0db = " << EbN0db(i) << endl; noise_src.setup(0.0, sigma2(i)); turbo.set_awgn_channel_parameters(Ec, N0(i)); pturbo_ref.set_awgn_channel_parameters(Ec, N0(i)); input = randb(block_length * num_blocks); turbo.encode(input, transmitted); bpsk.modulate_bits(transmitted, symbols); received = symbols + noise_src(transmitted.length()); // -- logmax decoding -- turbo.set_metric("LOGMAX", 1.0); timer(0).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(0).stop(); pturbo_ref.set_metric("LOGMAX", 1.0); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); if(decoded_bits != decoded_bits_p) { cout << "(Un-)Punctured_Turbo_Codec does not output the same decoded bits as turbo code: LOGMAX" << endl; } berc.clear(); berc.count(input, decoded_bits); err(0, i) = berc.get_errors(); cor(0, i) = berc.get_corrects(); ber(0, i) = berc.get_errorrate(); avg_nrof_iterations(0, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- logmap decoding -- turbo.set_metric("LOGMAP", 1.0); timer(1).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(1).stop(); pturbo_ref.set_metric("LOGMAP", 1.0); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); if(decoded_bits != decoded_bits_p) { cout << "(Un-)Punctured_Turbo_Codec does not output the same decoded bits as turbo code: LOGMAP" << endl; } berc.clear(); berc.count(input, decoded_bits); err(1, i) = berc.get_errors(); cor(1, i) = berc.get_corrects(); ber(1, i) = berc.get_errorrate(); avg_nrof_iterations(1, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, default resolution -- turbo.set_metric("TABLE", 1.0); timer(2).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(2).stop(); pturbo_ref.set_metric("TABLE", 1.0); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); if(decoded_bits != decoded_bits_p) { cout << "(Un-)Punctured_Turbo_Codec does not output the same decoded bits as turbo code: TABLE" << endl; } berc.clear(); berc.count(input, decoded_bits); err(2, i) = berc.get_errors(); cor(2, i) = berc.get_corrects(); ber(2, i) = berc.get_errorrate(); avg_nrof_iterations(2, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, low resolution -- turbo.set_metric("TABLE", 1.0, lowresllrcalc); timer(3).start(); turbo.decode(received, decoded_bits, nrof_used_iterations); timer(3).stop(); pturbo_ref.set_metric("TABLE", 1.0, lowresllrcalc); pturbo_ref.decode(received, decoded_bits_p, nrof_used_iterations); if(decoded_bits != decoded_bits_p) { cout << "(Un-)Punctured_Turbo_Codec does not output the same decoded bits as turbo code: TABLE low_res LLR calc" << endl; } berc.clear(); berc.count(input, decoded_bits); err(3, i) = berc.get_errors(); cor(3, i) = berc.get_corrects(); ber(3, i) = berc.get_errorrate(); avg_nrof_iterations(3, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); } cout << "Results: (1st row: logmax, 2nd row: logmap, 3rd row: qllr, default resolution, 4th row: qllr, low resolution" << endl; cout << "Bit error rate: " << endl; cout << "ber = " << ber << endl; cout << "Average numer of iterations used: " << endl; cout << avg_nrof_iterations << endl; cout << "Number of bit errors counted: " << endl; cout << "err = " << err << endl; cout << "Number of correct bits counted: " << endl; cout << "cor = " << cor << endl; /* ###################################### * # now test for punctured turbo codec # * ###################################### */ puncture_matrix = "1 1;1 0;0 1"; Punctured_Turbo_Codec pturbo; pturbo.set_parameters(gen, gen, constraint_length, interleaver_sequence, puncture_matrix, iterations, metric, logmax_scale_factor, adaptive_stop); r = pturbo.get_rate(); Eb = Ec / r; N0 = Eb * pow(EbN0, -1.0); sigma2 = N0 / 2; cout << endl; cout << "=============================================" << endl; cout << " Starting Simulation for Punctured Turbo Code" << endl; cout << " Bit error rate as a function of Eb/N0 " << endl; cout << "=============================================" << endl; cout << " Block length = " << block_length << endl; cout << " Generator polynomials = " << std::oct << gen << std::dec << endl; cout << " Max number of Iterations = " << iterations << endl; cout << " Adaptive stop = " << adaptive_stop << endl; cout << " Eb/N0 = " << EbN0db << " [dB]" << endl; cout << " Turbo encoder rate 1/3 (plus tail bits)" << endl; cout << "=============================================" << endl; err.zeros(); cor.zeros(); ber.zeros(); avg_nrof_iterations.zeros(); for(int i = 0; i < 4; i++) { timer(i).reset(); } for(int i = 0; i < EbN0db.length(); i++) { cout << "Now simulating EbN0db = " << EbN0db(i) << endl; noise_src.setup(0.0, sigma2(i)); pturbo.set_awgn_channel_parameters(Ec, N0(i)); input = randb(block_length * num_blocks); pturbo.encode(input, transmitted); bpsk.modulate_bits(transmitted, symbols); received = symbols + noise_src(transmitted.length()); // -- logmax decoding -- pturbo.set_metric("LOGMAX", 1.0); timer(0).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(0).stop(); berc.clear(); berc.count(input, decoded_bits); err(0, i) = berc.get_errors(); cor(0, i) = berc.get_corrects(); ber(0, i) = berc.get_errorrate(); avg_nrof_iterations(0, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- logmap decoding -- pturbo.set_metric("LOGMAP", 1.0); timer(1).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(1).stop(); berc.clear(); berc.count(input, decoded_bits); err(1, i) = berc.get_errors(); cor(1, i) = berc.get_corrects(); ber(1, i) = berc.get_errorrate(); avg_nrof_iterations(1, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, default resolution -- pturbo.set_metric("TABLE", 1.0); timer(2).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(2).stop(); berc.clear(); berc.count(input, decoded_bits); err(2, i) = berc.get_errors(); cor(2, i) = berc.get_corrects(); ber(2, i) = berc.get_errorrate(); avg_nrof_iterations(2, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); // -- QLLR decoding, low resolution -- pturbo.set_metric("TABLE", 1.0, lowresllrcalc); timer(3).start(); pturbo.decode(received, decoded_bits, nrof_used_iterations); timer(3).stop(); berc.clear(); berc.count(input, decoded_bits); err(3, i) = berc.get_errors(); cor(3, i) = berc.get_corrects(); ber(3, i) = berc.get_errorrate(); avg_nrof_iterations(3, i) = static_cast(sum(nrof_used_iterations)) / length(nrof_used_iterations); } cout << "Results: (1st row: logmax, 2nd row: logmap, 3rd row: qllr, default resolution, 4th row: qllr, low resolution" << endl; cout << "Bit error rate: " << endl; cout << "ber = " << ber << endl; cout << "Average numer of iterations used: " << endl; cout << avg_nrof_iterations << endl; cout << "Number of bit errors counted: " << endl; cout << "err = " << err << endl; cout << "Number of correct bits counted: " << endl; cout << "cor = " << cor << endl; /* // The test program cannot print this out, but on my system // the QLLR based decoder is about 8 times faster than logmap. -EGL cout << "Timers: "; for (int i=0; i<4; i++) { cout << timer(i).get_time() << " "; } cout << endl; */ //test interleavers cout << "\n=============================================" << endl; cout << " Starting Simulation for Interleavers " << endl; cout << "=============================================" << endl; ivec interleaver; ivec block_lengths = "40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 " "160 168 176 184 192 200 208 216 224 232 240 248 256 264 272 280 288 296 " "304 312 320 328 336 344 352 360 368 376 384 392 400 " "408 416 424 432 440 448 456 464 472 480 488 496 504 512 528 544 560 576 " "592 608 624 640 656 672 688 704 720 736 752 768 784 " "800 816 832 848 864 880 896 912 928 944 960 976 992 1008 1024 1056 1088 " "1120 1152 1184 1216 1248 1280 1312 1344 1376 1408 " "1440 1472 1504 1536 1568 1600 1632 1664 1696 1728 1760 1792 1824 1856 1888 " "1920 1952 1984 2016 2048 2112 2176 2240 2304 2368 " "2432 2496 2560 2624 2688 2752 2816 2880 2944 3008 3072 3136 3200 3264 3328 " "3392 3456 3520 3584 3648 3712 3776 3840 3904 3968 " "4032 4096 4160 4224 4288 4352 4416 4480 4544 4608 4672 4736 4800 4864 4928 " "4992 5056 5120 5184 5248 5312 5376 5440 5504 5568 " "5632 5696 5760 5824 5888 5952 6016 6080 6144"; for(int i = 0; i < block_lengths.length(); ++i) { if(5114 >= block_lengths[i]) { //use allowed lengths interleaver = wcdma_turbo_interleaver_sequence(block_lengths[i]); sort(interleaver); for(int j = 0; j < block_lengths[i]; ++j) { if(j != interleaver[j]) { cout << "WCDMA: wrong value for intl length " << block_lengths[i] << endl; break; } } } interleaver = lte_turbo_interleaver_sequence(block_lengths[i]); sort(interleaver); for(int j = 0; j < block_lengths[i]; ++j) { if(j != interleaver[j]) { cout << "LTE: wrong value for intl length " << block_lengths[i] << endl; break; } } } return 0; } itpp-4.3.1/tests/turbo_test.ref000066400000000000000000000050701216575753400165460ustar00rootroot00000000000000============================================= Starting Simulation Bit error rate as a function of Eb/N0 ============================================= Block length = 400 Generator polynomials = [7 5] Max number of Iterations = 8 Adaptive stop = 1 Eb/N0 = [0 0.5 1 1.5 2] [dB] Turbo encoder rate 1/3 (plus tail bits) ============================================= Now simulating EbN0db = 0 Now simulating EbN0db = 0.5 Now simulating EbN0db = 1 Now simulating EbN0db = 1.5 Now simulating EbN0db = 2 Results: (1st row: logmax, 2nd row: logmap, 3rd row: qllr, default resolution, 4th row: qllr, low resolution Bit error rate: ber = [[0.1174 0.0586 0.005 0.00065 0] [0.0518 0.02005 0.0017 0 0] [0.0522 0.0199 0.0017 0 0] [0.05495 0.01905 0.0017 0 0]] Average numer of iterations used: [[7.7 7.04 4.7 3.46 3.02] [7.16 6.06 4.12 3.24 3] [7.2 6.06 4.08 3.24 3] [7.26 6.1 4.06 3.22 3.06]] Number of bit errors counted: err = [[2348 1172 100 13 0] [1036 401 34 0 0] [1044 398 34 0 0] [1099 381 34 0 0]] Number of correct bits counted: cor = [[17652 18828 19900 19987 20000] [18964 19599 19966 20000 20000] [18956 19602 19966 20000 20000] [18901 19619 19966 20000 20000]] ============================================= Starting Simulation for Punctured Turbo Code Bit error rate as a function of Eb/N0 ============================================= Block length = 400 Generator polynomials = [7 5] Max number of Iterations = 8 Adaptive stop = 1 Eb/N0 = [0 0.5 1 1.5 2] [dB] Turbo encoder rate 1/3 (plus tail bits) ============================================= Now simulating EbN0db = 0 Now simulating EbN0db = 0.5 Now simulating EbN0db = 1 Now simulating EbN0db = 1.5 Now simulating EbN0db = 2 Results: (1st row: logmax, 2nd row: logmap, 3rd row: qllr, default resolution, 4th row: qllr, low resolution Bit error rate: ber = [[0.1489 0.0907 0.0519 0.00355 0.00195] [0.1068 0.0428 0.0242 0.0002 0] [0.10685 0.04285 0.02435 0.0002 0] [0.10745 0.04645 0.0244 0.00035 0]] Average numer of iterations used: [[8 7.74 6.92 4.42 3.26] [6.38 7.26 6.18 4.08 3.32] [6.48 7.2 6.2 4.08 3.3] [7.88 7.44 6.42 4.02 3.28]] Number of bit errors counted: err = [[2978 1814 1038 71 39] [2136 856 484 4 0] [2137 857 487 4 0] [2149 929 488 7 0]] Number of correct bits counted: cor = [[17022 18186 18962 19929 19961] [17864 19144 19516 19996 20000] [17863 19143 19513 19996 20000] [17851 19071 19512 19993 20000]] ============================================= Starting Simulation for Interleavers ============================================= itpp-4.3.1/tests/vec_test.cpp000066400000000000000000000234471216575753400162060ustar00rootroot00000000000000/*! * \file * \brief Vector class test program * \author Tony Ottosson and Adam Piatyszek * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; template void common_operators(const Vec &a, const Vec &b, T c) { cout.setf(ios::fixed); cout.precision(4); cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "c = " << c << endl; cout << "a+b = " << a + b << endl; cout << "a+c = " << a + c << endl; cout << "c+a = " << c + a << endl; Vec a2 = a; a2 += b; cout << "a+=b; a = " << a2 << endl; a2 = a; a2 += c; cout << "a+=c; a = " << a2 << endl; cout << "a-b = " << a - b << endl; cout << "a-c = " << a - c << endl; cout << "c-a = " << c - a << endl; a2 = a; a2 -= b; cout << "a-=b; a = " << a2 << endl; a2 = a; a2 -= c; cout << "a-=c; a = " << a2 << endl; cout << "-a = " << -a << endl; cout << "a*b = " << a*b << endl; cout << "dot(a,b) = " << dot(a, b) << endl; cout << "outer_product(a,b) = " << outer_product(a, b) << endl; cout << "a*c = " << a*c << endl; cout << "c*a = " << c*a << endl; a2 = a; a2 *= c; cout << "a*=c; a = " << a2 << endl; cout << "elem_mult(a,b) = " << elem_mult(a, b) << endl; Vec x1; elem_mult_out(a, b, x1); cout << "elem_mult_out(a,b,x); x = " << x1 << endl; Vec b2 = b; elem_mult_inplace(a, b2); cout << "elem_mult_inplace(a,b); b = " << b2 << endl; cout << "elem_mult_sum(a,b) = " << elem_mult_sum(a, b) << endl; cout << "a/c = " << a / c << endl; cout << "c/a = " << c / a << endl; a2 = a; a2 /= c; cout << "a/=c; a = " << a2 << endl; a2 = a; a2 /= b; cout << "a/=b; a = " << a2 << endl; cout << "elem_div(a,b) = " << elem_div(a, b) << endl; Vec x2; elem_div_out(a, b, x2); cout << "elem_div_out(a,b,x); x = " << x2 << endl; cout << "elem_div_sum(a,b) = " << elem_div_sum(a, b) << endl; cout << "concat(a,b) = " << concat(a, b) << endl; cout << "concat(a,c) = " << concat(a, c) << endl; cout << "concat(c,a) = " << concat(c, a) << endl; cout << "concat(a,b,a) = " << concat(a, b, a) << endl; cout << "concat(a,b,a,b) = " << concat(a, b, a, b) << endl; cout << "concat(a,b,a,b,a) = " << concat(a, b, a, b, a) << endl; cout << "a.T() = " << a.T() << endl; cout << "a.H() = " << a.H() << endl; cout << "a.size() = " << a.size() << endl; a2 = a; a2.set_size(a2.size() + 3, true); cout << "a.set_size(a.size()+3, true); a = " << a2 << endl; a2.set_size(a2.size() - 6, true); cout << "a.set_size(a.size()-6, true); a = " << a2 << endl; cout << "a(5) = " << a(5) << endl; cout << "a.get(5) = " << a.get(5) << endl; cout << "a(0,5) = " << a(0, 5) << endl; cout << "a.get(0,5) = " << a.get(0, 5) << endl; cout << "a(6,-1) = " << a(6, -1) << endl; ivec idx_list = "0 5 6 7"; cout << "idx_list = " << idx_list << endl; cout << "a(idx_list) = " << a(idx_list) << endl; cout << "a.get(idx_list) = " << a.get(idx_list) << endl; bvec bin_list = "1 0 0 0 0 1 1 1 0 0"; cout << "bin_list = " << bin_list << endl; cout << "a(bin_list) = " << a(bin_list) << endl; cout << "a.get(bin_list) = " << a.get(bin_list) << endl; cout << "a.right(3) = " << a.right(3) << endl; cout << "a.left(4) = " << a.left(4) << endl; cout << "a.mid(3,2) = " << a.mid(3, 2) << endl; a2 = a; cout << "a.split(0) = " << a2.split(0) << "; a = " << a2 << endl; a2 = a; cout << "a.split(a.size()) = " << a2.split(a2.size()) << "; a = " << a2 << endl; a2 = a; cout << "a.split(4) = " << a2.split(4) << "; a = " << a2 << endl; a2(5) = a(6); cout << "a(5) = a(6); a = " << a2 << endl; a2 = a; a2.shift_left(c, 2); cout << "a.shift_left(c,2) = " << a2 << endl; a2 = a; a2.shift_right(c); cout << "a.shift_right(c) = " << a2 << endl; a2 = a; a2.shift_left(b.mid(0, 2)); cout << "a.shift_left(b.mid(0,2)) = " << a2 << endl; a2 = a; a2.shift_right(b.right(5)); cout << "a.shift_right(b.right(5)) = " << a2 << endl; a2 = a; a2.set_subvector(0, b); cout << "a.set_subvector(0, b) = " << a2 << endl; a2 = a; a2.set_subvector(4, b(3, 5)); cout << "a.set_subvector(4, b(3,5)) = " << a2 << endl; a2 = a; a2.replace_mid(4, b(3, 5)); cout << "a.replace_mid(4, b(3,5)) = " << a2 << endl; a2 = a; a2.del(6); cout << "a.del(6) = " << a2 << endl; a2 = a; a2.del(3, 9); cout << "a.del(3,9) = " << a2 << endl; a2 = a; a2.ins(0, c); cout << "a.ins(0,c) = " << a2 << endl; a2 = a; a2.ins(2, c); cout << "a.ins(2,c) = " << a2 << endl; a2 = a; a2.ins(10, c); cout << "a.ins(10,c) = " << a2 << endl; a2 = a; a2.ins(3, b(0, 2)); cout << "a.ins(3, b(0,2)) = " << a2 << endl; a2 = a; a2.zeros(); cout << "a.zeros(); a = " << a2 << endl; a2 = a; a2.ones(); cout << "a.ones(); a = " << a2 << endl; a2 = a; a2 = c; cout << "a = c; a = " << a2 << endl; a2 = a; a2 = b(0, 4); cout << "a = b(0,4); a = " << a2 << endl; a2 = a; a2 = b.T(); cout << "a = b.T(); a = " << a2 << endl; a2 = a; a2 = b.T().T(); cout << "a = b.T().T(); a = " << a2 << endl << endl; } template void logical_operators(const Vec &a, const Vec &b, T c) { cout << "(a == c) = " << (a == c) << endl; cout << "(a != c) = " << (a != c) << endl; cout << "(a <= c) = " << (a <= c) << endl; cout << "(a >= c) = " << (a >= c) << endl; cout << "(a < c) = " << (a < c) << endl; cout << "(a > c) = " << (a > c) << endl; cout << "(a == b) = " << (a == b) << endl; cout << "(a != b) = " << (a != b) << endl; Vec a2 = a; cout << "a2 = a; (a2 == a) = " << (a2 == a) << endl; cout << "a2 = a; (a2 != a) = " << (a2 != a) << endl << endl; } int main() { cout << "=============================" << endl << " Testing Vec (bvec)" << endl << "=============================" << endl; bvec bv1 = randb(10); bvec bv2 = randb(10); bin bx = randb(); common_operators(bv1, bv2, bx); logical_operators(bv1, bv2, bx); cout << "=============================" << endl << " Testing Vec (ivec)" << endl << "=============================" << endl; ivec iv1 = randi(10, 1, 9); ivec iv2 = randi(10, 1, 9); int ix = randi(1, 9); common_operators(iv1, iv2, ix); logical_operators(iv1, iv2, ix); cout << "===============================" << endl << " Testing Vec (vec)" << endl << "===============================" << endl; vec dv1 = randu(10); vec dv2 = randu(10); double dx = randu(); common_operators(dv1, dv2, dx); logical_operators(dv1, dv2, dx); cout << "===============================================" << endl << " Testing Vec > (cvec)" << endl << "===============================================" << endl; cvec cv1 = randn_c(10); cvec cv2 = randn_c(10); complex cx = randn_c(); common_operators(cv1, cv2, cx); cout << "(a == c) = " << (cv1 == cx) << endl; cout << "(a != c) = " << (cv1 != cx) << endl << endl; // Test vectror initialisation with string vec v = "23.3 1232.7 0.111 1.525 0.333"; cout << "Testing double vector initialisation with: " "\"23.3 1232.7 0.111 1.525 0.333\":" << endl << "v = " << v << endl; v = "-10.000 :.5:-4.5 1.33e+1, -.9, 1e0:1.5:1E+1"; cout << "Testing double vector initialisation with: " "\"-10.000 :.5:-4.5 1.33e+1, -.9, 1e0:1.5:1E+1\":" << endl << "v = " << v << endl; ivec iv = "0xA :-0x1: -010"; cout << "Testing int vector initialisation with: \"0xA :-0x1: -010\":" << endl << "iv = " << iv << endl; iv = "-5:3:9, 7, 1:10"; cout << "Testing int vector initialisation with: \"-5:3:9, 7, 1:10\":" << endl << "iv = " << iv << endl; svec sv = "3 0xF -10, 0133 0177, 0x0 "; cout << "Testing short int vector initialisation with: \"3 0xF -10, 0133 0177, 0x0 \":" << endl << "sv = " << sv << endl; cvec cv = " (0.3, 0.4) .2-.01i, 1e-3+0.25i"; cout << "Testing complex vector initialisation with: \" (0.3, 0.4) .2-.01i, 1e-3+0.25i\":" << endl << "cv = " << cv << endl; bvec bv = "1 1 0,1 1 , 0 ,1 "; cout << "Testing bit vector initialisation with: \"1 1 0,1 1 , 0 ,1 \":" << endl << "bv = " << bv << endl << endl; // Test of rem: v = "1.0 2.0 3.4 -4.5 6.7"; double y = 0.76; cout << "v = " << v << endl; cout << "y = " << y << endl; cout << "rem(v, y) = " << rem(v, y) << endl; cout << "rem(10, v) = " << rem(10, v) << endl; mat M = "1.0 2.3; 4.5 -6.7"; cout << "M = " << M << endl; cout << "rem(M, y) = " << rem(M, y) << endl; cout << "rem(10, M) = " << rem(10, M) << endl << endl; // Test of all and any: bvec b1 = "0 0 0 0 0 0 0 1 0 0"; bvec b2 = "0 0 0 0 0 0 0 0 0 0"; bvec b3 = "1 1 1 1 1 1 1 1 1 1 1 1 1"; bvec b4 = "1 1 1 1 1 1 1 1 1 1 1 0 1"; cout << "any(b1) = " << any(b1) << endl; cout << "any(b2) = " << any(b2) << endl; cout << "all(b3) = " << all(b3) << endl; cout << "all(b4) = " << all(b4) << endl; return 0; } itpp-4.3.1/tests/vec_test.ref000066400000000000000000000723221216575753400161740ustar00rootroot00000000000000============================= Testing Vec (bvec) ============================= a = [0 0 1 1 0 1 0 1 0 0] b = [1 1 0 0 1 1 0 0 0 0] c = 0 a+b = [1 1 1 1 1 0 0 1 0 0] a+c = [0 0 1 1 0 1 0 1 0 0] c+a = [0 0 1 1 0 1 0 1 0 0] a+=b; a = [1 1 1 1 1 0 0 1 0 0] a+=c; a = [0 0 1 1 0 1 0 1 0 0] a-b = [1 1 1 1 1 0 0 1 0 0] a-c = [0 0 1 1 0 1 0 1 0 0] c-a = [0 0 1 1 0 1 0 1 0 0] a-=b; a = [1 1 1 1 1 0 0 1 0 0] a-=c; a = [0 0 1 1 0 1 0 1 0 0] -a = [0 0 1 1 0 1 0 1 0 0] a*b = 1 dot(a,b) = 1 outer_product(a,b) = [[0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [1 1 0 0 1 1 0 0 0 0] [1 1 0 0 1 1 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [1 1 0 0 1 1 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [1 1 0 0 1 1 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0]] a*c = [0 0 0 0 0 0 0 0 0 0] c*a = [0 0 0 0 0 0 0 0 0 0] a*=c; a = [0 0 0 0 0 0 0 0 0 0] elem_mult(a,b) = [0 0 0 0 0 1 0 0 0 0] elem_mult_out(a,b,x); x = [0 0 0 0 0 1 0 0 0 0] elem_mult_inplace(a,b); b = [0 0 0 0 0 1 0 0 0 0] elem_mult_sum(a,b) = 1 a/c = [0 0 1 1 0 1 0 1 0 0] c/a = [0 0 1 1 0 1 0 1 0 0] a/=c; a = [0 0 1 1 0 1 0 1 0 0] a/=b; a = [1 1 1 1 1 1 0 1 0 0] elem_div(a,b) = [1 1 1 1 1 1 0 1 0 0] elem_div_out(a,b,x); x = [1 1 1 1 1 1 0 1 0 0] elem_div_sum(a,b) = 1 concat(a,b) = [0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0] concat(a,c) = [0 0 1 1 0 1 0 1 0 0 0] concat(c,a) = [0 0 0 1 1 0 1 0 1 0 0] concat(a,b,a) = [0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0] concat(a,b,a,b) = [0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0] concat(a,b,a,b,a) = [0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0] a.T() = [[0 0 1 1 0 1 0 1 0 0]] a.H() = [[0 0 1 1 0 1 0 1 0 0]] a.size() = 10 a.set_size(a.size()+3, true); a = [0 0 1 1 0 1 0 1 0 0 0 0 0] a.set_size(a.size()-6, true); a = [0 0 1 1 0 1 0] a(5) = 1 a.get(5) = 1 a(0,5) = [0 0 1 1 0 1] a.get(0,5) = [0 0 1 1 0 1] a(6,-1) = [0 1 0 0] idx_list = [0 5 6 7] a(idx_list) = [0 1 0 1] a.get(idx_list) = [0 1 0 1] bin_list = [1 0 0 0 0 1 1 1 0 0] a(bin_list) = [0 1 0 1] a.get(bin_list) = [0 1 0 1] a.right(3) = [1 0 0] a.left(4) = [0 0 1 1] a.mid(3,2) = [1 0] a.split(0) = []; a = [0 0 1 1 0 1 0 1 0 0] a.split(a.size()) = [0 0 1 1 0 1 0 1 0 0]; a = [] a.split(4) = [0 0 1 1]; a = [0 1 0 1 0 0] a(5) = a(6); a = [0 1 0 1 0 0] a.shift_left(c,2) = [1 1 0 1 0 1 0 0 0 0] a.shift_right(c) = [0 0 0 1 1 0 1 0 1 0] a.shift_left(b.mid(0,2)) = [1 1 0 1 0 1 0 0 1 1] a.shift_right(b.right(5)) = [1 0 0 0 0 0 0 1 1 0] a.set_subvector(0, b) = [1 1 0 0 1 1 0 0 0 0] a.set_subvector(4, b(3,5)) = [0 0 1 1 0 1 1 1 0 0] a.replace_mid(4, b(3,5)) = [0 0 1 1 0 1 1 1 0 0] a.del(6) = [0 0 1 1 0 1 1 0 0] a.del(3,9) = [0 0 1] a.ins(0,c) = [0 0 0 1 1 0 1 0 1 0 0] a.ins(2,c) = [0 0 0 1 1 0 1 0 1 0 0] a.ins(10,c) = [0 0 1 1 0 1 0 1 0 0 0] a.ins(3, b(0,2)) = [0 0 1 1 1 0 1 0 1 0 1 0 0] a.zeros(); a = [0 0 0 0 0 0 0 0 0 0] a.ones(); a = [1 1 1 1 1 1 1 1 1 1] a = c; a = [0 0 0 0 0 0 0 0 0 0] a = b(0,4); a = [1 1 0 0 1] a = b.T(); a = [1 1 0 0 1 1 0 0 0 0] a = b.T().T(); a = [1 1 0 0 1 1 0 0 0 0] (a == c) = [1 1 0 0 1 0 1 0 1 1] (a != c) = [0 0 1 1 0 1 0 1 0 0] (a <= c) = [1 1 0 0 1 0 1 0 1 1] (a >= c) = [1 1 1 1 1 1 1 1 1 1] (a < c) = [0 0 0 0 0 0 0 0 0 0] (a > c) = [0 0 1 1 0 1 0 1 0 0] (a == b) = 0 (a != b) = 1 a2 = a; (a2 == a) = 1 a2 = a; (a2 != a) = 0 ============================= Testing Vec (ivec) ============================= a = [1 5 4 5 9 7 9 5 6 4] b = [5 6 2 1 3 5 9 2 2 3] c = 8 a+b = [6 11 6 6 12 12 18 7 8 7] a+c = [9 13 12 13 17 15 17 13 14 12] c+a = [9 13 12 13 17 15 17 13 14 12] a+=b; a = [6 11 6 6 12 12 18 7 8 7] a+=c; a = [9 13 12 13 17 15 17 13 14 12] a-b = [-4 -1 2 4 6 2 0 3 4 1] a-c = [-7 -3 -4 -3 1 -1 1 -3 -2 -4] c-a = [7 3 4 3 -1 1 -1 3 2 4] a-=b; a = [-4 -1 2 4 6 2 0 3 4 1] a-=c; a = [-7 -3 -4 -3 1 -1 1 -3 -2 -4] -a = [-1 -5 -4 -5 -9 -7 -9 -5 -6 -4] a*b = 225 dot(a,b) = 225 outer_product(a,b) = [[5 6 2 1 3 5 9 2 2 3] [25 30 10 5 15 25 45 10 10 15] [20 24 8 4 12 20 36 8 8 12] [25 30 10 5 15 25 45 10 10 15] [45 54 18 9 27 45 81 18 18 27] [35 42 14 7 21 35 63 14 14 21] [45 54 18 9 27 45 81 18 18 27] [25 30 10 5 15 25 45 10 10 15] [30 36 12 6 18 30 54 12 12 18] [20 24 8 4 12 20 36 8 8 12]] a*c = [8 40 32 40 72 56 72 40 48 32] c*a = [8 40 32 40 72 56 72 40 48 32] a*=c; a = [8 40 32 40 72 56 72 40 48 32] elem_mult(a,b) = [5 30 8 5 27 35 81 10 12 12] elem_mult_out(a,b,x); x = [5 30 8 5 27 35 81 10 12 12] elem_mult_inplace(a,b); b = [5 30 8 5 27 35 81 10 12 12] elem_mult_sum(a,b) = 225 a/c = [0 0 0 0 1 0 1 0 0 0] c/a = [8 1 2 1 0 1 0 1 1 2] a/=c; a = [0 0 0 0 1 0 1 0 0 0] a/=b; a = [0 0 2 5 3 1 1 2 3 1] elem_div(a,b) = [0 0 2 5 3 1 1 2 3 1] elem_div_out(a,b,x); x = [0 0 2 5 3 1 1 2 3 1] elem_div_sum(a,b) = 18 concat(a,b) = [1 5 4 5 9 7 9 5 6 4 5 6 2 1 3 5 9 2 2 3] concat(a,c) = [1 5 4 5 9 7 9 5 6 4 8] concat(c,a) = [8 1 5 4 5 9 7 9 5 6 4] concat(a,b,a) = [1 5 4 5 9 7 9 5 6 4 5 6 2 1 3 5 9 2 2 3 1 5 4 5 9 7 9 5 6 4] concat(a,b,a,b) = [1 5 4 5 9 7 9 5 6 4 5 6 2 1 3 5 9 2 2 3 1 5 4 5 9 7 9 5 6 4 5 6 2 1 3 5 9 2 2 3] concat(a,b,a,b,a) = [1 5 4 5 9 7 9 5 6 4 5 6 2 1 3 5 9 2 2 3 1 5 4 5 9 7 9 5 6 4 5 6 2 1 3 5 9 2 2 3 1 5 4 5 9 7 9 5 6 4] a.T() = [[1 5 4 5 9 7 9 5 6 4]] a.H() = [[1 5 4 5 9 7 9 5 6 4]] a.size() = 10 a.set_size(a.size()+3, true); a = [1 5 4 5 9 7 9 5 6 4 0 0 0] a.set_size(a.size()-6, true); a = [1 5 4 5 9 7 9] a(5) = 7 a.get(5) = 7 a(0,5) = [1 5 4 5 9 7] a.get(0,5) = [1 5 4 5 9 7] a(6,-1) = [9 5 6 4] idx_list = [0 5 6 7] a(idx_list) = [1 7 9 5] a.get(idx_list) = [1 7 9 5] bin_list = [1 0 0 0 0 1 1 1 0 0] a(bin_list) = [1 7 9 5] a.get(bin_list) = [1 7 9 5] a.right(3) = [5 6 4] a.left(4) = [1 5 4 5] a.mid(3,2) = [5 9] a.split(0) = []; a = [1 5 4 5 9 7 9 5 6 4] a.split(a.size()) = [1 5 4 5 9 7 9 5 6 4]; a = [] a.split(4) = [1 5 4 5]; a = [9 7 9 5 6 4] a(5) = a(6); a = [9 7 9 5 6 9] a.shift_left(c,2) = [4 5 9 7 9 5 6 4 8 8] a.shift_right(c) = [8 1 5 4 5 9 7 9 5 6] a.shift_left(b.mid(0,2)) = [4 5 9 7 9 5 6 4 5 6] a.shift_right(b.right(5)) = [5 9 2 2 3 1 5 4 5 9] a.set_subvector(0, b) = [5 6 2 1 3 5 9 2 2 3] a.set_subvector(4, b(3,5)) = [1 5 4 5 1 3 5 5 6 4] a.replace_mid(4, b(3,5)) = [1 5 4 5 1 3 5 5 6 4] a.del(6) = [1 5 4 5 9 7 5 6 4] a.del(3,9) = [1 5 4] a.ins(0,c) = [8 1 5 4 5 9 7 9 5 6 4] a.ins(2,c) = [1 5 8 4 5 9 7 9 5 6 4] a.ins(10,c) = [1 5 4 5 9 7 9 5 6 4 8] a.ins(3, b(0,2)) = [1 5 4 5 6 2 5 9 7 9 5 6 4] a.zeros(); a = [0 0 0 0 0 0 0 0 0 0] a.ones(); a = [1 1 1 1 1 1 1 1 1 1] a = c; a = [8 8 8 8 8 8 8 8 8 8] a = b(0,4); a = [5 6 2 1 3] a = b.T(); a = [5 6 2 1 3 5 9 2 2 3] a = b.T().T(); a = [5 6 2 1 3 5 9 2 2 3] (a == c) = [0 0 0 0 0 0 0 0 0 0] (a != c) = [1 1 1 1 1 1 1 1 1 1] (a <= c) = [1 1 1 1 0 1 0 1 1 1] (a >= c) = [0 0 0 0 1 0 1 0 0 0] (a < c) = [1 1 1 1 0 1 0 1 1 1] (a > c) = [0 0 0 0 1 0 1 0 0 0] (a == b) = 0 (a != b) = 1 a2 = a; (a2 == a) = 1 a2 = a; (a2 != a) = 0 =============================== Testing Vec (vec) =============================== a = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] b = [0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790] c = 0.9167 a+b = [0.7820 0.9445 1.0516 0.7621 0.6376 0.8981 1.4784 1.0168 0.4520 0.7219] a+c = [0.9348 0.9406 1.5296 1.6617 1.3386 1.0665 1.6324 1.8156 0.9415 1.4596] c+a = [0.9348 0.9406 1.5296 1.6617 1.3386 1.0665 1.6324 1.8156 0.9415 1.4596] a+=b; a = [0.7820 0.9445 1.0516 0.7621 0.6376 0.8981 1.4784 1.0168 0.4520 0.7219] a+=c; a = [0.9348 0.9406 1.5296 1.6617 1.3386 1.0665 1.6324 1.8156 0.9415 1.4596] a-b = [-0.7458 -0.8966 0.1742 0.7278 0.2062 -0.5984 -0.0468 0.7811 -0.4024 0.3640] a-c = [-0.8986 -0.8927 -0.3038 -0.1717 -0.4948 -0.7668 -0.2009 -0.0178 -0.8919 -0.3738] c-a = [0.8986 0.8927 0.3038 0.1717 0.4948 0.7668 0.2009 0.0178 0.8919 0.3738] a-=b; a = [-0.7458 -0.8966 0.1742 0.7278 0.2062 -0.5984 -0.0468 0.7811 -0.4024 0.3640] a-=c; a = [-0.8986 -0.8927 -0.3038 -0.1717 -0.4948 -0.7668 -0.2009 -0.0178 -0.8919 -0.3738] -a = [-0.0181 -0.0240 -0.6129 -0.7450 -0.4219 -0.1498 -0.7158 -0.8989 -0.0248 -0.5429] a*b = 1.2802 dot(a,b) = 1.2802 outer_product(a,b) = [[0.0138 0.0167 0.0079 0.0003 0.0039 0.0136 0.0138 0.0021 0.0077 0.0032] [0.0183 0.0221 0.0105 0.0004 0.0052 0.0179 0.0183 0.0028 0.0102 0.0043] [0.4682 0.5642 0.2689 0.0105 0.1322 0.4586 0.4674 0.0722 0.2618 0.1097] [0.5691 0.6858 0.3268 0.0128 0.1607 0.5575 0.5681 0.0878 0.3182 0.1333] [0.3223 0.3884 0.1851 0.0072 0.0910 0.3157 0.3218 0.0497 0.1802 0.0755] [0.1145 0.1379 0.0657 0.0026 0.0323 0.1121 0.1143 0.0177 0.0640 0.0268] [0.5468 0.6589 0.3140 0.0123 0.1544 0.5356 0.5458 0.0844 0.3058 0.1281] [0.6867 0.8275 0.3943 0.0154 0.1939 0.6726 0.6855 0.1059 0.3840 0.1609] [0.0189 0.0228 0.0109 0.0004 0.0053 0.0185 0.0189 0.0029 0.0106 0.0044] [0.4148 0.4998 0.2382 0.0093 0.1171 0.4063 0.4140 0.0640 0.2319 0.0972]] a*c = [0.0166 0.0220 0.5618 0.6829 0.3868 0.1373 0.6561 0.8240 0.0227 0.4977] c*a = [0.0166 0.0220 0.5618 0.6829 0.3868 0.1373 0.6561 0.8240 0.0227 0.4977] a*=c; a = [0.0166 0.0220 0.5618 0.6829 0.3868 0.1373 0.6561 0.8240 0.0227 0.4977] elem_mult(a,b) = [0.0138 0.0221 0.2689 0.0128 0.0910 0.1121 0.5458 0.1059 0.0106 0.0972] elem_mult_out(a,b,x); x = [0.0138 0.0221 0.2689 0.0128 0.0910 0.1121 0.5458 0.1059 0.0106 0.0972] elem_mult_inplace(a,b); b = [0.0138 0.0221 0.2689 0.0128 0.0910 0.1121 0.5458 0.1059 0.0106 0.0972] elem_mult_sum(a,b) = 1.2802 a/c = [0.0198 0.0261 0.6686 0.8127 0.4603 0.1635 0.7808 0.9806 0.0270 0.5923] c/a = [50.6102 38.2470 1.4956 1.2305 2.1726 6.1179 1.2807 1.0198 36.9849 1.6884] a/=c; a = [0.0198 0.0261 0.6686 0.8127 0.4603 0.1635 0.7808 0.9806 0.0270 0.5923] a/=b; a = [0.0237 0.0260 1.3971 43.4708 1.9560 0.2002 0.9386 7.6271 0.0580 3.0338] elem_div(a,b) = [0.0237 0.0260 1.3971 43.4708 1.9560 0.2002 0.9386 7.6271 0.0580 3.0338] elem_div_out(a,b,x); x = [0.0237 0.0260 1.3971 43.4708 1.9560 0.2002 0.9386 7.6271 0.0580 3.0338] elem_div_sum(a,b) = 58.7313 concat(a,b) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790] concat(a,c) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.9167] concat(c,a) = [0.9167 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] concat(a,b,a) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] concat(a,b,a,b) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790] concat(a,b,a,b,a) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] a.T() = [[0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429]] a.H() = [[0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429]] a.size() = 10 a.set_size(a.size()+3, true); a = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.0000 0.0000 0.0000] a.set_size(a.size()-6, true); a = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158] a(5) = 0.1498 a.get(5) = 0.1498 a(0,5) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498] a.get(0,5) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498] a(6,-1) = [0.7158 0.8989 0.0248 0.5429] idx_list = [0 5 6 7] a(idx_list) = [0.0181 0.1498 0.7158 0.8989] a.get(idx_list) = [0.0181 0.1498 0.7158 0.8989] bin_list = [1 0 0 0 0 1 1 1 0 0] a(bin_list) = [0.0181 0.1498 0.7158 0.8989] a.get(bin_list) = [0.0181 0.1498 0.7158 0.8989] a.right(3) = [0.8989 0.0248 0.5429] a.left(4) = [0.0181 0.0240 0.6129 0.7450] a.mid(3,2) = [0.7450 0.4219] a.split(0) = []; a = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] a.split(a.size()) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429]; a = [] a.split(4) = [0.0181 0.0240 0.6129 0.7450]; a = [0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] a(5) = a(6); a = [0.4219 0.1498 0.7158 0.8989 0.0248 0.7158] a.shift_left(c,2) = [0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.9167 0.9167] a.shift_right(c) = [0.9167 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248] a.shift_left(b.mid(0,2)) = [0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.7639 0.9206] a.shift_right(b.right(5)) = [0.7483 0.7626 0.1179 0.4272 0.1790 0.0181 0.0240 0.6129 0.7450 0.4219] a.set_subvector(0, b) = [0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790] a.set_subvector(4, b(3,5)) = [0.0181 0.0240 0.6129 0.7450 0.0171 0.2157 0.7483 0.8989 0.0248 0.5429] a.replace_mid(4, b(3,5)) = [0.0181 0.0240 0.6129 0.7450 0.0171 0.2157 0.7483 0.8989 0.0248 0.5429] a.del(6) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.8989 0.0248 0.5429] a.del(3,9) = [0.0181 0.0240 0.6129] a.ins(0,c) = [0.9167 0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] a.ins(2,c) = [0.0181 0.0240 0.9167 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] a.ins(10,c) = [0.0181 0.0240 0.6129 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429 0.9167] a.ins(3, b(0,2)) = [0.0181 0.0240 0.6129 0.7639 0.9206 0.4387 0.7450 0.4219 0.1498 0.7158 0.8989 0.0248 0.5429] a.zeros(); a = [0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000] a.ones(); a = [1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000] a = c; a = [0.9167 0.9167 0.9167 0.9167 0.9167 0.9167 0.9167 0.9167 0.9167 0.9167] a = b(0,4); a = [0.7639 0.9206 0.4387 0.0171 0.2157] a = b.T(); a = [0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790] a = b.T().T(); a = [0.7639 0.9206 0.4387 0.0171 0.2157 0.7483 0.7626 0.1179 0.4272 0.1790] (a == c) = [0 0 0 0 0 0 0 0 0 0] (a != c) = [1 1 1 1 1 1 1 1 1 1] (a <= c) = [1 1 1 1 1 1 1 1 1 1] (a >= c) = [0 0 0 0 0 0 0 0 0 0] (a < c) = [1 1 1 1 1 1 1 1 1 1] (a > c) = [0 0 0 0 0 0 0 0 0 0] (a == b) = 0 (a != b) = 1 a2 = a; (a2 == a) = 1 a2 = a; (a2 != a) = 0 =============================================== Testing Vec > (cvec) =============================================== a = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] b = [-0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i] c = -0.3598+0.6133i a+b = [0.2469-0.6897i -0.2984+0.0994i -0.2142-1.2018i 0.2650+0.2273i 0.0789+0.7208i 0.8361+1.1151i 0.1213-0.8282i -1.3793+0.4171i -0.1624-0.8460i -0.5362+1.2215i] a+c = [0.1059+0.0056i -0.3065+0.4917i -1.2086-0.6757i 0.2032+0.5442i -1.1819+1.5666i -0.4878+0.8916i 0.2388+0.4227i -0.4902+0.6909i -0.5457-0.0511i -0.0329+1.2138i] c+a = [0.1059+0.0056i -0.3065+0.4917i -1.2086-0.6757i 0.2032+0.5442i -1.1819+1.5666i -0.4878+0.8916i 0.2388+0.4227i -0.4902+0.6909i -0.5457-0.0511i -0.0329+1.2138i] a+=b; a = [0.2469-0.6897i -0.2984+0.0994i -0.2142-1.2018i 0.2650+0.2273i 0.0789+0.7208i 0.8361+1.1151i 0.1213-0.8282i -1.3793+0.4171i -0.1624-0.8460i -0.5362+1.2215i] a+=c; a = [0.1059+0.0056i -0.3065+0.4917i -1.2086-0.6757i 0.2032+0.5442i -1.1819+1.5666i -0.4878+0.8916i 0.2388+0.4227i -0.4902+0.6909i -0.5457-0.0511i -0.0329+1.2138i] a-b = [0.6844-0.5257i 0.4051-0.3427i -1.4833-1.3763i 0.8609-0.3654i -1.7232+1.1858i -1.0922-0.5585i 1.0759+0.4470i 1.1185-0.2620i -0.2094-0.4829i 1.1899-0.0206i] a-c = [0.8254-1.2210i 0.4131-0.7350i -0.4890-1.9024i 0.9228-0.6824i -0.4624+0.3400i 0.2317-0.3350i 0.9584-0.8039i 0.2294-0.5358i 0.1738-1.2778i 0.6866-0.0129i] c-a = [-0.8254+1.2210i -0.4131+0.7350i 0.4890+1.9024i -0.9228+0.6824i 0.4624-0.3400i -0.2317+0.3350i -0.9584+0.8039i -0.2294+0.5358i -0.1738+1.2778i -0.6866+0.0129i] a-=b; a = [0.6844-0.5257i 0.4051-0.3427i -1.4833-1.3763i 0.8609-0.3654i -1.7232+1.1858i -1.0922-0.5585i 1.0759+0.4470i 1.1185-0.2620i -0.2094-0.4829i 1.1899-0.0206i] a-=c; a = [0.8254-1.2210i 0.4131-0.7350i -0.4890-1.9024i 0.9228-0.6824i -0.4624+0.3400i 0.2317-0.3350i 0.9584-0.8039i 0.2294-0.5358i 0.1738-1.2778i 0.6866-0.0129i] -a = [-0.4656+0.6077i -0.0533+0.1216i 0.8488+1.2890i -0.5630+0.0691i 0.8221-0.9533i 0.1281-0.2783i -0.5986+0.1906i 0.1304-0.0776i 0.1859+0.6645i -0.3269-0.6004i] a*b = -2.6432-0.0729i dot(a,b) = -2.6432-0.0729i outer_product(a,b) = [[-0.1517+0.0948i -0.0295+0.3167i 0.3485-0.3450i 0.0414+0.3191i 0.2783-0.6558i 0.9575-0.1963i -0.6097-0.0068i -0.3752+0.9171i -0.0994-0.0988i -0.0245+0.8137i] [-0.0216+0.0222i 0.0081+0.0546i 0.0444-0.0725i 0.0202+0.0520i 0.0198-0.1220i 0.1532-0.0727i -0.1030+0.0241i -0.0253+0.1700i -0.0208-0.0125i 0.0295+0.1381i] [0.0800+0.3516i 0.5835+0.2658i -0.4261-0.8920i 0.6349+0.1325i -1.0645-0.9641i 0.2603-1.9531i -0.4167+1.1564i 1.4978+1.3217i -0.2539+0.1238i 1.5331+0.5854i] [-0.1288-0.0311i -0.1828+0.1488i 0.3633+0.0053i -0.1473+0.1874i 0.4912-0.1932i 0.6006+0.4045i -0.3128-0.3260i -0.6797+0.2775i 0.0007-0.1038i -0.4430+0.4093i] [0.2581-0.1411i 0.0785-0.5170i -0.6049+0.5332i -0.0376-0.5277i -0.5191+1.0501i -1.5904+0.2312i 1.0002+0.0692i 0.7031-1.4698i 0.1537+0.1716i 0.1175-1.3334i] [0.0508-0.0504i -0.0165-0.1262i -0.1056+0.1654i -0.0443-0.1209i -0.0507+0.2806i -0.3564+0.1612i 0.2386-0.0512i 0.0654-0.3911i 0.0475+0.0298i -0.0623-0.3197i] [-0.1466-0.0074i -0.1684+0.1994i 0.3965-0.0687i -0.1219+0.2342i 0.4950-0.3109i 0.7367+0.3171i -0.4072-0.2907i -0.6829+0.4413i -0.0205-0.1131i -0.3982+0.5363i] [0.0349-0.0063i 0.0287-0.0561i -0.0895+0.0378i 0.0159-0.0618i -0.0995+0.1002i -0.1906-0.0344i 0.1117+0.0461i 0.1365-0.1411i 0.0110+0.0255i 0.0644-0.1479i] [-0.0138+0.1606i 0.2123+0.1926i -0.0600-0.4379i 0.2523+0.1429i -0.3220-0.5555i 0.3768-0.7962i -0.3349+0.4357i 0.4578+0.7667i -0.1250+0.0181i 0.5731+0.4580i] [-0.0223-0.1582i -0.2477-0.1389i 0.1550+0.4095i -0.2753-0.0820i 0.4341+0.4650i -0.1873+0.8524i 0.2268-0.4950i -0.6121-0.6389i 0.1167-0.0452i -0.6550-0.3152i]] a*c = [0.2052+0.5042i 0.0554+0.0765i 1.0960-0.0568i -0.1602+0.3702i -0.2889-0.8472i -0.1246-0.1787i -0.0984+0.4357i -0.0006-0.1079i 0.4744+0.1250i -0.4859-0.0156i] c*a = [0.2052+0.5042i 0.0554+0.0765i 1.0960-0.0568i -0.1602+0.3702i -0.2889-0.8472i -0.1246-0.1787i -0.0984+0.4357i -0.0006-0.1079i 0.4744+0.1250i -0.4859-0.0156i] a*=c; a = [0.2052+0.5042i 0.0554+0.0765i 1.0960-0.0568i -0.1602+0.3702i -0.2889-0.8472i -0.1246-0.1787i -0.0984+0.4357i -0.0006-0.1079i 0.4744+0.1250i -0.4859-0.0156i] elem_mult(a,b) = [-0.1517+0.0948i 0.0081+0.0546i -0.4261-0.8920i -0.1473+0.1874i -0.5191+1.0501i -0.3564+0.1612i -0.4072-0.2907i 0.1365-0.1411i -0.1250+0.0181i -0.6550-0.3152i] elem_mult_out(a,b,x); x = [-0.1517+0.0948i 0.0081+0.0546i -0.4261-0.8920i -0.1473+0.1874i -0.5191+1.0501i -0.3564+0.1612i -0.4072-0.2907i 0.1365-0.1411i -0.1250+0.0181i -0.6550-0.3152i] elem_mult_inplace(a,b); b = [-0.1517+0.0948i 0.0081+0.0546i -0.4261-0.8920i -0.1473+0.1874i -0.5191+1.0501i -0.3564+0.1612i -0.4072-0.2907i 0.1365-0.1411i -0.1250+0.0181i -0.6550-0.3152i] elem_mult_sum(a,b) = -2.6432-0.0729i a/c = [-1.0685-0.1324i -0.1855+0.0219i -0.9597+1.9468i -0.4844-0.6338i 1.7414+0.3190i 0.4287-0.0427i -0.6572-0.5905i 0.1869+0.1030i -0.6737+0.6983i 0.4958-0.8237i] c/a = [-0.9217+0.1142i -5.3173-0.6272i -0.2037-0.4132i -0.7613+0.9960i 0.5556-0.1018i 2.3096+0.2299i -0.8419+0.7565i 4.1042-2.2623i -0.7155-0.7417i 0.5364+0.8912i] a/=c; a = [-1.0685-0.1324i -0.1855+0.0219i -0.9597+1.9468i -0.4844-0.6338i 1.7414+0.3190i 0.4287-0.0427i -0.6572-0.5905i 0.1869+0.1030i -0.6737+0.6983i 0.4958-0.8237i] a/=b; a = [-0.9532+3.1348i -0.2644+0.1796i -1.5869-1.8132i -1.0658-0.8282i -1.1114+0.7712i 0.0671+0.2304i -0.2588+0.7451i 0.1130-0.0314i 3.4702-1.4734i 0.0803-0.6379i] elem_div(a,b) = [-0.9532+3.1348i -0.2644+0.1796i -1.5869-1.8132i -1.0658-0.8282i -1.1114+0.7712i 0.0671+0.2304i -0.2588+0.7451i 0.1130-0.0314i 3.4702-1.4734i 0.0803-0.6379i] elem_div_out(a,b,x); x = [-0.9532+3.1348i -0.2644+0.1796i -1.5869-1.8132i -1.0658-0.8282i -1.1114+0.7712i 0.0671+0.2304i -0.2588+0.7451i 0.1130-0.0314i 3.4702-1.4734i 0.0803-0.6379i] elem_div_sum(a,b) = -1.5100+0.2770i concat(a,b) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i] concat(a,c) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.3598+0.6133i] concat(c,a) = [-0.3598+0.6133i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] concat(a,b,a) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] concat(a,b,a,b) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i] concat(a,b,a,b,a) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.T() = [[0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i]] a.H() = [[0.4656+0.6077i 0.0533+0.1216i -0.8488+1.2890i 0.5630+0.0691i -0.8221-0.9533i -0.1281-0.2783i 0.5986+0.1906i -0.1304-0.0776i -0.1859+0.6645i 0.3269-0.6004i]] a.size() = 10 a.set_size(a.size()+3, true); a = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i] a.set_size(a.size()-6, true); a = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i] a(5) = -0.1281+0.2783i a.get(5) = -0.1281+0.2783i a(0,5) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i] a.get(0,5) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i] a(6,-1) = [0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] idx_list = [0 5 6 7] a(idx_list) = [0.4656-0.6077i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i] a.get(idx_list) = [0.4656-0.6077i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i] bin_list = [1 0 0 0 0 1 1 1 0 0] a(bin_list) = [0.4656-0.6077i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i] a.get(bin_list) = [0.4656-0.6077i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i] a.right(3) = [-0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.left(4) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i] a.mid(3,2) = [0.5630-0.0691i -0.8221+0.9533i] a.split(0) = []; a = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.split(a.size()) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i]; a = [] a.split(4) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i]; a = [-0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a(5) = a(6); a = [-0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.5986-0.1906i] a.shift_left(c,2) = [-0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.3598+0.6133i -0.3598+0.6133i] a.shift_right(c) = [-0.3598+0.6133i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i] a.shift_left(b.mid(0,2)) = [-0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.2188-0.0820i -0.3517+0.2211i] a.shift_right(b.right(5)) = [0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i] a.set_subvector(0, b) = [-0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i] a.set_subvector(4, b(3,5)) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.replace_mid(4, b(3,5)) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.del(6) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.del(3,9) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i] a.ins(0,c) = [-0.3598+0.6133i 0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.ins(2,c) = [0.4656-0.6077i 0.0533-0.1216i -0.3598+0.6133i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.ins(10,c) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i -0.3598+0.6133i] a.ins(3, b(0,2)) = [0.4656-0.6077i 0.0533-0.1216i -0.8488-1.2890i -0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i 0.5630-0.0691i -0.8221+0.9533i -0.1281+0.2783i 0.5986-0.1906i -0.1304+0.0776i -0.1859-0.6645i 0.3269+0.6004i] a.zeros(); a = [0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i] a.ones(); a = [1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i 1.0000+0.0000i] a = c; a = [-0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i -0.3598+0.6133i] a = b(0,4); a = [-0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i] a = b.T(); a = [-0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i] a = b.T().T(); a = [-0.2188-0.0820i -0.3517+0.2211i 0.6346+0.0873i -0.2980+0.2964i 0.9011-0.2325i 0.9642+0.8368i -0.4773-0.6376i -1.2489+0.3396i 0.0235-0.1815i -0.8631+0.6211i] (a == c) = [0 0 0 0 0 0 0 0 0 0] (a != c) = [1 1 1 1 1 1 1 1 1 1] Testing double vector initialisation with: "23.3 1232.7 0.111 1.525 0.333": v = [23.3000 1232.7000 0.1110 1.5250 0.3330] Testing double vector initialisation with: "-10.000 :.5:-4.5 1.33e+1, -.9, 1e0:1.5:1E+1": v = [-10.0000 -9.5000 -9.0000 -8.5000 -8.0000 -7.5000 -7.0000 -6.5000 -6.0000 -5.5000 -5.0000 -4.5000 13.3000 -0.9000 1.0000 2.5000 4.0000 5.5000 7.0000 8.5000 10.0000] Testing int vector initialisation with: "0xA :-0x1: -010": iv = [10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8] Testing int vector initialisation with: "-5:3:9, 7, 1:10": iv = [-5 -2 1 4 7 7 1 2 3 4 5 6 7 8 9 10] Testing short int vector initialisation with: "3 0xF -10, 0133 0177, 0x0 ": sv = [3 15 -10 91 127 0] Testing complex vector initialisation with: " (0.3, 0.4) .2-.01i, 1e-3+0.25i": cv = [0.3000+0.4000i 0.2000-0.0100i 0.0010+0.2500i] Testing bit vector initialisation with: "1 1 0,1 1 , 0 ,1 ": bv = [1 1 0 1 1 0 1] v = [1.0000 2.0000 3.4000 -4.5000 6.7000] y = 0.7600 rem(v, y) = [0.2400 0.4800 0.3600 -0.7000 0.6200] rem(10, v) = [0.0000 0.0000 3.2000 1.0000 3.3000] M = [[1.0000 2.3000] [4.5000 -6.7000]] rem(M, y) = [[0.2400 0.0200] [0.7000 -0.6200]] rem(10, M) = [[0.0000 0.8000] [1.0000 3.3000]] any(b1) = 1 any(b2) = 0 all(b3) = 1 all(b4) = 0 itpp-4.3.1/tests/window_test.cpp000066400000000000000000000044041216575753400167300ustar00rootroot00000000000000/*! * \file * \brief Windowing functions test program * \author Tony Ottosson, Tobias Ringstrom, Pal Frenger, Adam Piatyszek * and Kumar Appaiah * * ------------------------------------------------------------------------- * * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors) * * This file is part of IT++ - a C++ library of mathematical, signal * processing, speech processing, and communications classes and functions. * * IT++ is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * IT++ 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 General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with IT++. If not, see . * * ------------------------------------------------------------------------- */ #include #include using namespace itpp; using namespace std; int main() { // This is a hack for improper rounding under MinGW cout.setf(ios::fixed); cout.precision(8); cout << "================================" << endl; cout << " Test of window functions " << endl; cout << "================================" << endl; cout << "hamming(32) = " << hamming(32) << endl; cout << "hamming(128) = " << hamming(128) << endl; cout << "hanning(32) = " << hanning(32) << endl; cout << "hanning(128) = " << hanning(128) << endl; cout << "hann(32) = " << hann(32) << endl; cout << "hann(128) = " << hann(128) << endl; cout << "blackman(32) = " << blackman(32) << endl; cout << "blackman(128) = " << blackman(128) << endl; cout << "triang(32) = " << triang(32) << endl; cout << "triang(128) = " << triang(128) << endl; cout << "chebwin(32, 50) = " << chebwin(32, 50) << endl; cout << "chebwin(33, 20) = " << chebwin(33, 20) << endl; cout << "chebwin(127, 25) = " << chebwin(127, 25) << endl; cout << "chebwin(128, 25) = " << chebwin(128, 25) << endl; return 0; } itpp-4.3.1/tests/window_test.ref000066400000000000000000000305701216575753400167250ustar00rootroot00000000000000================================ Test of window functions ================================ hamming(32) = [0.08000000 0.08941623 0.11727941 0.16244882 0.22307522 0.29667656 0.38023958 0.47034322 0.56329862 0.65530016 0.74258131 0.82156875 0.88902874 0.94219944 0.97890406 0.99763989 0.99763989 0.97890406 0.94219944 0.88902874 0.82156875 0.74258131 0.65530016 0.56329862 0.47034322 0.38023958 0.29667656 0.22307522 0.16244882 0.11727941 0.08941623 0.08000000] hamming(128) = [0.08000000 0.08056285 0.08225002 0.08505738 0.08897806 0.09400246 0.10011830 0.10731060 0.11556177 0.12485160 0.13515738 0.14645387 0.15871343 0.17190607 0.18599949 0.20095922 0.21674863 0.23332909 0.25066003 0.26869903 0.28740195 0.30672302 0.32661496 0.34702909 0.36791545 0.38922293 0.41089938 0.43289177 0.45514627 0.47760842 0.50022325 0.52293542 0.54568935 0.56842936 0.59109980 0.61364519 0.63601036 0.65814057 0.67998167 0.70148022 0.72258359 0.74324016 0.76339936 0.78301186 0.80202967 0.82040626 0.83809664 0.85505753 0.87124742 0.88662669 0.90115771 0.91480492 0.92753491 0.93931655 0.95012099 0.95992179 0.96869497 0.97641907 0.98307517 0.98864700 0.99312091 0.99648596 0.99873391 0.99985927 0.99985927 0.99873391 0.99648596 0.99312091 0.98864700 0.98307517 0.97641907 0.96869497 0.95992179 0.95012099 0.93931655 0.92753491 0.91480492 0.90115771 0.88662669 0.87124742 0.85505753 0.83809664 0.82040626 0.80202967 0.78301186 0.76339936 0.74324016 0.72258359 0.70148022 0.67998167 0.65814057 0.63601036 0.61364519 0.59109980 0.56842936 0.54568935 0.52293542 0.50022325 0.47760842 0.45514627 0.43289177 0.41089938 0.38922293 0.36791545 0.34702909 0.32661496 0.30672302 0.28740195 0.26869903 0.25066003 0.23332909 0.21674863 0.20095922 0.18599949 0.17190607 0.15871343 0.14645387 0.13515738 0.12485160 0.11556177 0.10731060 0.10011830 0.09400246 0.08897806 0.08505738 0.08225002 0.08056285 0.08000000] hanning(32) = [0.00903565 0.03581603 0.07937323 0.13813298 0.20997155 0.29229249 0.38212053 0.47620904 0.57115742 0.66353398 0.75000000 0.82743037 0.89302655 0.94441772 0.97974649 0.99773596 0.99773596 0.97974649 0.94441772 0.89302655 0.82743037 0.75000000 0.66353398 0.57115742 0.47620904 0.38212053 0.29229249 0.20997155 0.13813298 0.07937323 0.03581603 0.00903565] hanning(128) = [0.00059297 0.00237048 0.00532832 0.00945946 0.01475410 0.02119970 0.02878096 0.03747990 0.04727588 0.05814568 0.07006350 0.08300109 0.09692775 0.11181046 0.12761391 0.14430062 0.16183100 0.18016349 0.19925459 0.21905903 0.23952983 0.26061844 0.28227483 0.30444764 0.32708428 0.35013106 0.37353331 0.39723552 0.42118149 0.44531440 0.46957701 0.49391179 0.51826101 0.54256692 0.56677186 0.59081843 0.61464958 0.63820880 0.66144020 0.68428869 0.70670006 0.72862116 0.75000000 0.77078587 0.79092946 0.81038300 0.82910034 0.84703710 0.86415072 0.88040062 0.89574824 0.91015720 0.92359331 0.93602470 0.94742189 0.95775785 0.96700805 0.97515057 0.98216608 0.98803794 0.99275223 0.99629777 0.99866614 0.99985173 0.99985173 0.99866614 0.99629777 0.99275223 0.98803794 0.98216608 0.97515057 0.96700805 0.95775785 0.94742189 0.93602470 0.92359331 0.91015720 0.89574824 0.88040062 0.86415072 0.84703710 0.82910034 0.81038300 0.79092946 0.77078587 0.75000000 0.72862116 0.70670006 0.68428869 0.66144020 0.63820880 0.61464958 0.59081843 0.56677186 0.54256692 0.51826101 0.49391179 0.46957701 0.44531440 0.42118149 0.39723552 0.37353331 0.35013106 0.32708428 0.30444764 0.28227483 0.26061844 0.23952983 0.21905903 0.19925459 0.18016349 0.16183100 0.14430062 0.12761391 0.11181046 0.09692775 0.08300109 0.07006350 0.05814568 0.04727588 0.03747990 0.02878096 0.02119970 0.01475410 0.00945946 0.00532832 0.00237048 0.00059297] hann(32) = [0.00000000 0.01023503 0.04052109 0.08961828 0.15551654 0.23551799 0.32634737 0.42428611 0.52532458 0.62532627 0.72019708 0.80605299 0.87937906 0.93717331 0.97706963 0.99743466 0.99743466 0.97706963 0.93717331 0.87937906 0.80605299 0.72019708 0.62532627 0.52532458 0.42428611 0.32634737 0.23551799 0.15551654 0.08961828 0.04052109 0.01023503 0.00000000] hann(128) = [0.00000000 0.00061179 0.00244567 0.00549715 0.00975876 0.01522007 0.02186772 0.02968544 0.03865409 0.04875174 0.05995367 0.07223246 0.08555808 0.09989790 0.11521684 0.13147741 0.14863981 0.16666206 0.18550003 0.20510764 0.22543690 0.24643807 0.26805974 0.29024901 0.31295157 0.33611188 0.35967324 0.38357801 0.40776768 0.43218306 0.45676440 0.48145154 0.50618408 0.53090148 0.55554326 0.58004912 0.60435908 0.62841366 0.65215399 0.67552198 0.69846043 0.72091321 0.74282539 0.76414333 0.78481486 0.80478941 0.82401809 0.84245384 0.86005154 0.87676814 0.89256273 0.90739665 0.92123360 0.93403973 0.94578368 0.95643673 0.96597280 0.97436855 0.98160345 0.98765978 0.99252273 0.99618039 0.99862382 0.99984703 0.99984703 0.99862382 0.99618039 0.99252273 0.98765978 0.98160345 0.97436855 0.96597280 0.95643673 0.94578368 0.93403973 0.92123360 0.90739665 0.89256273 0.87676814 0.86005154 0.84245384 0.82401809 0.80478941 0.78481486 0.76414333 0.74282539 0.72091321 0.69846043 0.67552198 0.65215399 0.62841366 0.60435908 0.58004912 0.55554326 0.53090148 0.50618408 0.48145154 0.45676440 0.43218306 0.40776768 0.38357801 0.35967324 0.33611188 0.31295157 0.29024901 0.26805974 0.24643807 0.22543690 0.20510764 0.18550003 0.16666206 0.14863981 0.13147741 0.11521684 0.09989790 0.08555808 0.07223246 0.05995367 0.04875174 0.03865409 0.02968544 0.02186772 0.01522007 0.00975876 0.00549715 0.00244567 0.00061179 0.00000000] blackman(32) = [-0.00000000 0.00375165 0.01563845 0.03740270 0.07146461 0.12028646 0.18564672 0.26795497 0.36573504 0.47537854 0.59122860 0.70600079 0.81149328 0.89949043 0.96273070 0.99579706 0.99579706 0.96273070 0.89949043 0.81149328 0.70600079 0.59122860 0.47537854 0.36573504 0.26795497 0.18564672 0.12028646 0.07146461 0.03740270 0.01563845 0.00375165 -0.00000000] blackman(128) = [-0.00000000 0.00022048 0.00088427 0.00199831 0.00357410 0.00562748 0.00817842 0.01125074 0.01487172 0.01907174 0.02388376 0.02934291 0.03548583 0.04235018 0.04997401 0.05839511 0.06765036 0.07777513 0.08880258 0.10076300 0.11368324 0.12758601 0.14248936 0.15840611 0.17534333 0.19330184 0.21227586 0.23225262 0.25321203 0.27512651 0.29796076 0.32167173 0.34620856 0.37151262 0.39751770 0.42415015 0.45132921 0.47896731 0.50697053 0.53523907 0.56366781 0.59214691 0.62056245 0.64879721 0.67673135 0.70424322 0.73121023 0.75750960 0.78301930 0.80761885 0.83119025 0.85361875 0.87479376 0.89460963 0.91296646 0.92977080 0.94493641 0.95838489 0.97004626 0.97985951 0.98777306 0.99374518 0.99774428 0.99974914 0.99974914 0.99774428 0.99374518 0.98777306 0.97985951 0.97004626 0.95838489 0.94493641 0.92977080 0.91296646 0.89460963 0.87479376 0.85361875 0.83119025 0.80761885 0.78301930 0.75750960 0.73121023 0.70424322 0.67673135 0.64879721 0.62056245 0.59214691 0.56366781 0.53523907 0.50697053 0.47896731 0.45132921 0.42415015 0.39751770 0.37151262 0.34620856 0.32167173 0.29796076 0.27512651 0.25321203 0.23225262 0.21227586 0.19330184 0.17534333 0.15840611 0.14248936 0.12758601 0.11368324 0.10076300 0.08880258 0.07777513 0.06765036 0.05839511 0.04997401 0.04235018 0.03548583 0.02934291 0.02388376 0.01907174 0.01487172 0.01125074 0.00817842 0.00562748 0.00357410 0.00199831 0.00088427 0.00022048 -0.00000000] triang(32) = [0.03125000 0.09375000 0.15625000 0.21875000 0.28125000 0.34375000 0.40625000 0.46875000 0.53125000 0.59375000 0.65625000 0.71875000 0.78125000 0.84375000 0.90625000 0.96875000 0.96875000 0.90625000 0.84375000 0.78125000 0.71875000 0.65625000 0.59375000 0.53125000 0.46875000 0.40625000 0.34375000 0.28125000 0.21875000 0.15625000 0.09375000 0.03125000] triang(128) = [0.00781250 0.02343750 0.03906250 0.05468750 0.07031250 0.08593750 0.10156250 0.11718750 0.13281250 0.14843750 0.16406250 0.17968750 0.19531250 0.21093750 0.22656250 0.24218750 0.25781250 0.27343750 0.28906250 0.30468750 0.32031250 0.33593750 0.35156250 0.36718750 0.38281250 0.39843750 0.41406250 0.42968750 0.44531250 0.46093750 0.47656250 0.49218750 0.50781250 0.52343750 0.53906250 0.55468750 0.57031250 0.58593750 0.60156250 0.61718750 0.63281250 0.64843750 0.66406250 0.67968750 0.69531250 0.71093750 0.72656250 0.74218750 0.75781250 0.77343750 0.78906250 0.80468750 0.82031250 0.83593750 0.85156250 0.86718750 0.88281250 0.89843750 0.91406250 0.92968750 0.94531250 0.96093750 0.97656250 0.99218750 0.99218750 0.97656250 0.96093750 0.94531250 0.92968750 0.91406250 0.89843750 0.88281250 0.86718750 0.85156250 0.83593750 0.82031250 0.80468750 0.78906250 0.77343750 0.75781250 0.74218750 0.72656250 0.71093750 0.69531250 0.67968750 0.66406250 0.64843750 0.63281250 0.61718750 0.60156250 0.58593750 0.57031250 0.55468750 0.53906250 0.52343750 0.50781250 0.49218750 0.47656250 0.46093750 0.44531250 0.42968750 0.41406250 0.39843750 0.38281250 0.36718750 0.35156250 0.33593750 0.32031250 0.30468750 0.28906250 0.27343750 0.25781250 0.24218750 0.22656250 0.21093750 0.19531250 0.17968750 0.16406250 0.14843750 0.13281250 0.11718750 0.10156250 0.08593750 0.07031250 0.05468750 0.03906250 0.02343750 0.00781250] chebwin(32, 50) = [0.05066443 0.06606943 0.10497972 0.15478981 0.21565675 0.28701938 0.36753634 0.45508472 0.54682510 0.63933249 0.72878615 0.81120512 0.88271105 0.93979671 0.97957695 1.00000000 1.00000000 0.97957695 0.93979671 0.88271105 0.81120512 0.72878615 0.63933249 0.54682510 0.45508472 0.36753634 0.28701938 0.21565675 0.15478981 0.10497972 0.06606943 0.05066443] chebwin(33, 20) = [1.56677606 0.43612100 0.49112890 0.54650110 0.60155649 0.65559419 0.70790584 0.75778846 0.80455735 0.84755887 0.88618280 0.91987396 0.94814295 0.97057557 0.98684093 0.99669794 1.00000000 0.99669794 0.98684093 0.97057557 0.94814295 0.91987396 0.88618280 0.84755887 0.80455735 0.75778846 0.70790584 0.65559419 0.60155649 0.54650110 0.49112890 0.43612100 1.56677606] chebwin(127, 25) = [2.80627838 0.28379647 0.29780485 0.31203524 0.32647609 0.34111535 0.35594050 0.37093856 0.38609612 0.40139932 0.41683391 0.43238525 0.44803833 0.46377779 0.47958794 0.49545281 0.51135612 0.52728135 0.54321176 0.55913036 0.57502004 0.59086348 0.60664326 0.62234187 0.63794169 0.65342508 0.66877439 0.68397195 0.69900016 0.71384147 0.72847843 0.74289370 0.75707013 0.77099071 0.78463866 0.79799743 0.81105075 0.82378262 0.83617737 0.84821968 0.85989459 0.87118755 0.88208441 0.89257149 0.90263557 0.91226391 0.92144430 0.93016505 0.93841505 0.94618372 0.95346113 0.96023790 0.96650532 0.97225529 0.97748040 0.98217387 0.98632963 0.98994228 0.99300712 0.99552018 0.99747819 0.99887858 0.99971955 1.00000000 0.99971955 0.99887858 0.99747819 0.99552018 0.99300712 0.98994228 0.98632963 0.98217387 0.97748040 0.97225529 0.96650532 0.96023790 0.95346113 0.94618372 0.93841505 0.93016505 0.92144430 0.91226391 0.90263557 0.89257149 0.88208441 0.87118755 0.85989459 0.84821968 0.83617737 0.82378262 0.81105075 0.79799743 0.78463866 0.77099071 0.75707013 0.74289370 0.72847843 0.71384147 0.69900016 0.68397195 0.66877439 0.65342508 0.63794169 0.62234187 0.60664326 0.59086348 0.57502004 0.55913036 0.54321176 0.52728135 0.51135612 0.49545281 0.47958794 0.46377779 0.44803833 0.43238525 0.41683391 0.40139932 0.38609612 0.37093856 0.35594050 0.34111535 0.32647609 0.31203524 0.29780485 0.28379647 2.80627838] chebwin(128, 25) = [2.82761354 0.28370485 0.29760123 0.31171632 0.32603887 0.34055711 0.35525884 0.37013139 0.38516169 0.40033623 0.41564112 0.43106209 0.44658450 0.46219339 0.47787346 0.49360915 0.50938459 0.52518367 0.54099005 0.55678721 0.57255843 0.58828682 0.60395540 0.61954706 0.63504462 0.65043087 0.66568854 0.68080039 0.69574922 0.71051786 0.72508926 0.73944646 0.75357265 0.76745118 0.78106561 0.79439972 0.80743754 0.82016335 0.83256177 0.84461773 0.85631651 0.86764377 0.87858557 0.88912838 0.89925915 0.90896528 0.91823465 0.92705566 0.93541726 0.94330891 0.95072067 0.95764316 0.96406763 0.96998592 0.97539051 0.98027451 0.98463170 0.98845652 0.99174407 0.99449016 0.99669127 0.99834457 0.99944796 1.00000000 1.00000000 0.99944796 0.99834457 0.99669127 0.99449016 0.99174407 0.98845652 0.98463170 0.98027451 0.97539051 0.96998592 0.96406763 0.95764316 0.95072067 0.94330891 0.93541726 0.92705566 0.91823465 0.90896528 0.89925915 0.88912838 0.87858557 0.86764377 0.85631651 0.84461773 0.83256177 0.82016335 0.80743754 0.79439972 0.78106561 0.76745118 0.75357265 0.73944646 0.72508926 0.71051786 0.69574922 0.68080039 0.66568854 0.65043087 0.63504462 0.61954706 0.60395540 0.58828682 0.57255843 0.55678721 0.54099005 0.52518367 0.50938459 0.49360915 0.47787346 0.46219339 0.44658450 0.43106209 0.41564112 0.40033623 0.38516169 0.37013139 0.35525884 0.34055711 0.32603887 0.31171632 0.29760123 0.28370485 2.82761354] itpp-4.3.1/win32/000077500000000000000000000000001216575753400134545ustar00rootroot00000000000000itpp-4.3.1/win32/Makefile.am000066400000000000000000000002321216575753400155050ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common SUBDIRS = itpp_acml_tests itpp_mkl_tests EXTRA_DIST = itpp_acml.sln itpp_acml.vcproj itpp_mkl.sln itpp_mkl.vcproj itpp-4.3.1/win32/Makefile.in000066400000000000000000000422711216575753400155270ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.common subdir = win32 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) SUBDIRS = itpp_acml_tests itpp_mkl_tests EXTRA_DIST = itpp_acml.sln itpp_acml.vcproj itpp_mkl.sln itpp_mkl.vcproj all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu win32/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu win32/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/win32/itpp_acml.sln000066400000000000000000000015401216575753400161420ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itpp_acml", "itpp_acml.vcxproj", "{C069ECD3-26E8-437C-8B20-3A5D68B22F2A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.ActiveCfg = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.Build.0 = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.ActiveCfg = Release|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_acml.vcproj000066400000000000000000000543161216575753400166620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml.vcxproj000066400000000000000000000437471216575753400170600ustar00rootroot00000000000000 Debug Win32 Release Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A} itpp_acml Win32Proj StaticLibrary MultiByte StaticLibrary MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)\lib\ $(ProjectName)_build\$(Configuration)\ $(SolutionDir)\lib\ $(ProjectName)_build\$(Configuration)\ AllRules.ruleset AllRules.ruleset itpp itpp Disabled ..;$(INCLUDE);%(AdditionalIncludeDirectories) _WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_ACML;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL true Level3 false EditAndContinue $(SolutionDir)\lib\itpp_debug.lib ..;$(INCLUDE);%(AdditionalIncludeDirectories) _WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_ACML;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 false ProgramDatabase $(SolutionDir)\lib\itpp.lib itpp-4.3.1/win32/itpp_acml.vs2005.sln000066400000000000000000000015411216575753400171010ustar00rootroot00000000000000Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itpp_acml", "itpp_acml.vs2005.vcproj", "{C069ECD3-26E8-437C-8B20-3A5D68B22F2A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.ActiveCfg = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.Build.0 = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.ActiveCfg = Release|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_acml.vs2005.vcproj000066400000000000000000000542551216575753400176220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/000077500000000000000000000000001216575753400166465ustar00rootroot00000000000000itpp-4.3.1/win32/itpp_acml_tests/Makefile.am000066400000000000000000000024661216575753400207120ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common EXTRA_DIST = \ itpp_acml_tests.sln \ array_test.vcproj \ bch_test.vcproj \ bessel_test.vcproj \ blas_test.vcproj \ channel_test.vcproj \ cholesky_test.vcproj \ circular_buffer_test.vcproj \ commfunc_test.vcproj \ convcode_test.vcproj \ converters_test.vcproj \ det_test.vcproj \ eigen_test.vcproj \ error_count_test.vcproj \ fastica_test.vcproj \ fastmath_test.vcproj \ filter_design_test.vcproj \ filter_test.vcproj \ fix_test.vcproj \ freq_filt_test.vcproj \ galois_test.vcproj \ gf2mat_test.vcproj \ histogram_test.vcproj \ integration_test.vcproj \ interleaver_test.vcproj \ inv_test.vcproj \ itfile_test.vcproj \ ldpc_test.vcproj \ llr_test.vcproj \ ls_solve_test.vcproj \ lu_test.vcproj \ matfunc_test.vcproj \ mat_test.vcproj \ modulator_nd_test.vcproj \ modulator_test.vcproj \ newton_search_test.vcproj \ parser_test.vcproj \ poly_test.vcproj \ pulse_shape_test.vcproj \ qr_test.vcproj \ rand_test.vcproj \ rec_syst_conv_code_test.vcproj \ reedsolomon_test.vcproj \ schur_test.vcproj \ sigfun_test.vcproj \ sort_test.vcproj \ source_test.vcproj \ sparse_test.vcproj \ specmat_test.vcproj \ stat_test.vcproj \ svd_test.vcproj \ timer_test.vcproj \ transforms_test.vcproj \ turbo_test.vcproj \ vec_test.vcproj \ window_test.vcproj itpp-4.3.1/win32/itpp_acml_tests/Makefile.in000066400000000000000000000264701216575753400207240ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.common subdir = win32/itpp_acml_tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) EXTRA_DIST = \ itpp_acml_tests.sln \ array_test.vcproj \ bch_test.vcproj \ bessel_test.vcproj \ blas_test.vcproj \ channel_test.vcproj \ cholesky_test.vcproj \ circular_buffer_test.vcproj \ commfunc_test.vcproj \ convcode_test.vcproj \ converters_test.vcproj \ det_test.vcproj \ eigen_test.vcproj \ error_count_test.vcproj \ fastica_test.vcproj \ fastmath_test.vcproj \ filter_design_test.vcproj \ filter_test.vcproj \ fix_test.vcproj \ freq_filt_test.vcproj \ galois_test.vcproj \ gf2mat_test.vcproj \ histogram_test.vcproj \ integration_test.vcproj \ interleaver_test.vcproj \ inv_test.vcproj \ itfile_test.vcproj \ ldpc_test.vcproj \ llr_test.vcproj \ ls_solve_test.vcproj \ lu_test.vcproj \ matfunc_test.vcproj \ mat_test.vcproj \ modulator_nd_test.vcproj \ modulator_test.vcproj \ newton_search_test.vcproj \ parser_test.vcproj \ poly_test.vcproj \ pulse_shape_test.vcproj \ qr_test.vcproj \ rand_test.vcproj \ rec_syst_conv_code_test.vcproj \ reedsolomon_test.vcproj \ schur_test.vcproj \ sigfun_test.vcproj \ sort_test.vcproj \ source_test.vcproj \ sparse_test.vcproj \ specmat_test.vcproj \ stat_test.vcproj \ svd_test.vcproj \ timer_test.vcproj \ transforms_test.vcproj \ turbo_test.vcproj \ vec_test.vcproj \ window_test.vcproj all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu win32/itpp_acml_tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu win32/itpp_acml_tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/win32/itpp_acml_tests/array_test.vcproj000066400000000000000000000045751216575753400222630ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/array_test.vs2005.vcproj000066400000000000000000000043371216575753400232150ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/bch_test.vcproj000066400000000000000000000045041216575753400216710ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/bch_test.vs2005.vcproj000066400000000000000000000043401216575753400226250ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/bessel_test.vcproj000066400000000000000000000045151216575753400224140ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/bessel_test.vs2005.vcproj000066400000000000000000000043511216575753400233500ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/blas_test.vcproj000066400000000000000000000045071216575753400220610ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/blas_test.vs2005.vcproj000066400000000000000000000043431216575753400230150ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/channel_test.vcproj000066400000000000000000000045201216575753400225430ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/channel_test.vs2005.vcproj000066400000000000000000000043541216575753400235060ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/cholesky_test.vcproj000066400000000000000000000045231216575753400227570ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/cholesky_test.vs2005.vcproj000066400000000000000000000043571216575753400237220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/circular_buffer_test.vcproj000066400000000000000000000045501216575753400242730ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/circular_buffer_test.vs2005.vcproj000066400000000000000000000044041216575753400252270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/commfunc_test.vcproj000066400000000000000000000045231216575753400227450ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/commfunc_test.vs2005.vcproj000066400000000000000000000043571216575753400237100ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/convcode_test.vcproj000066400000000000000000000045231216575753400227360ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/convcode_test.vs2005.vcproj000066400000000000000000000043571216575753400237010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/converters_test.vcproj000066400000000000000000000045311216575753400233270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/converters_test.vs2005.vcproj000066400000000000000000000043651216575753400242720ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/demapper_test.vcproj000066400000000000000000000043471216575753400227370ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/demapper_test.vcxproj000066400000000000000000000074311216575753400231240ustar00rootroot00000000000000 Release Win32 demapper_test {0BD6BF14-C97C-441A-A8FA-08337186CAA7} cholesky_test Win32Proj Application Unicode true <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)\..\bin\ $(ProjectName)_build\$(Configuration)\ false AllRules.ruleset ..\..;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;HAVE_ACML;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase itpp.lib;libacml_dll.lib;%(AdditionalDependencies) ..\lib;$(LIB);%(AdditionalLibraryDirectories) uuid.lib;%(IgnoreSpecificDefaultLibraries) false Console true true false MachineX86 cd ..\bin $(ProjectName).exe > $(ProjectName).tmp fc /L $(ProjectName).tmp ..\..\tests\$(ProjectName).ref itpp-4.3.1/win32/itpp_acml_tests/demapper_test.vs2005.vcproj000066400000000000000000000043121216575753400236650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/det_test.vcproj000066400000000000000000000045041216575753400217110ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/det_test.vs2005.vcproj000066400000000000000000000043401216575753400226450ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/eigen_test.vcproj000066400000000000000000000045121216575753400222230ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/eigen_test.vs2005.vcproj000066400000000000000000000043461216575753400231660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/error_count_test.vcproj000066400000000000000000000045341216575753400235010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/error_count_test.vs2005.vcproj000066400000000000000000000043701216575753400244350ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/exit_test.vcproj000066400000000000000000000045251216575753400221110ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/exit_test.vs2005.vcproj000066400000000000000000000043611216575753400230450ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/fastica_test.vcproj000066400000000000000000000046531216575753400225540ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/fastica_test.vs2005.vcproj000066400000000000000000000045071216575753400235100ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/fastmath_test.vcproj000066400000000000000000000045231216575753400227450ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/fastmath_test.vs2005.vcproj000066400000000000000000000043571216575753400237100ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/filter_design_test.vcproj000066400000000000000000000045421216575753400237550ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/filter_design_test.vs2005.vcproj000066400000000000000000000043761216575753400247200ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/filter_test.vcproj000066400000000000000000000045151216575753400224240ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/filter_test.vs2005.vcproj000066400000000000000000000043511216575753400233600ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/fix_test.vcproj000066400000000000000000000045041216575753400217230ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/fix_test.vs2005.vcproj000066400000000000000000000043401216575753400226570ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/freq_filt_test.vcproj000066400000000000000000000045261216575753400231140ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/freq_filt_test.vs2005.vcproj000066400000000000000000000043621216575753400240500ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/galois_test.vcproj000066400000000000000000000045151216575753400224150ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/galois_test.vs2005.vcproj000066400000000000000000000043511216575753400233510ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/gf2mat_test.vcproj000066400000000000000000000045151216575753400223170ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/gf2mat_test.vs2005.vcproj000066400000000000000000000043511216575753400232530ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/histogram_test.vcproj000066400000000000000000000045261216575753400231360ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/histogram_test.vs2005.vcproj000066400000000000000000000043621216575753400240720ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/integration_test.vcproj000066400000000000000000000045341216575753400234630ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/integration_test.vs2005.vcproj000066400000000000000000000043701216575753400244170ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/interleaver_test.vcproj000066400000000000000000000045341216575753400234600ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/interleaver_test.vs2005.vcproj000066400000000000000000000043701216575753400244140ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/inv_test.vcproj000066400000000000000000000045041216575753400217310ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/inv_test.vs2005.vcproj000066400000000000000000000043401216575753400226650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/itfile_test.vcproj000066400000000000000000000046141216575753400224130ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/itfile_test.vs2005.vcproj000066400000000000000000000044501216575753400233470ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/itpp_acml_tests.sln000066400000000000000000000446341216575753400225710ustar00rootroot00000000000000Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "array_test", "array_test.vcxproj", "{AB324343-29E3-431D-BC7E-ACC0F120EA1F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bch_test", "bch_test.vcxproj", "{41BD8F10-920D-4713-8F5E-8959B2633E3B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bessel_test", "bessel_test.vcxproj", "{2273E479-3717-4C95-8F29-F51ECFB5E5DA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blas_test", "blas_test.vcxproj", "{EEE76A9C-DA87-4AA4-8D4B-F8D7AA262B94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "channel_test", "channel_test.vcxproj", "{952EDE50-F86C-4BBA-8473-60557274F728}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cholesky_test", "cholesky_test.vcxproj", "{4CE6C6BC-DF7F-4E1D-9C9E-3E70292C5E18}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "circular_buffer_test", "circular_buffer_test.vcxproj", "{18BFF682-EEE7-4610-A4EF-B9BF43CFCCBE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commfunc_test", "commfunc_test.vcxproj", "{F4223302-F344-4679-9AB3-7E05B246234C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convcode_test", "convcode_test.vcxproj", "{567352BE-6E47-41F6-A108-6CDF72A793A8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converters_test", "converters_test.vcxproj", "{91100FCA-5C7E-4474-8FA1-2AE8BA65E50A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "det_test", "det_test.vcxproj", "{E09A270A-B39C-46A0-A2D9-BB1CA73FA583}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eigen_test", "eigen_test.vcxproj", "{B1A9829A-2E18-47A0-B130-200217E2DF58}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_count_test", "error_count_test.vcxproj", "{D8C4991E-6EE0-4FDF-BA13-CB7A7DD43A26}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastica_test", "fastica_test.vcxproj", "{B4965981-07ED-46F9-80BF-70CC83D1C334}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastmath_test", "fastmath_test.vcxproj", "{8EB01DCE-B272-4DAF-B7A6-5188D95547EB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_design_test", "filter_design_test.vcxproj", "{DD06025C-4221-468D-8922-0A863A9F562B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_test", "filter_test.vcxproj", "{573493FC-2B17-41BF-911A-498D4D2A32A3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fix_test", "fix_test.vcxproj", "{9E64DD56-EB89-41E2-8CB8-85E1CEF07D70}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freq_filt_test", "freq_filt_test.vcxproj", "{9173A049-1BBC-4B36-9AD4-4F057409DC8A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "galois_test", "galois_test.vcxproj", "{97649EB3-2A63-48A8-BFC2-13B04A7F571F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gf2mat_test", "gf2mat_test.vcxproj", "{08E8CA57-1B2B-4291-B3BD-C22550EEEF17}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "histogram_test", "histogram_test.vcxproj", "{31A4AFE5-645C-4228-9872-66B91A5496A7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "integration_test", "integration_test.vcxproj", "{D617AA55-2E8B-4975-A00B-C8597751BB72}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interleaver_test", "interleaver_test.vcxproj", "{892CDD19-5BF1-429A-8530-ECB22E3A460C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inv_test", "inv_test.vcxproj", "{FD34B40D-B00E-4CE8-A1F0-8FF5FE644D27}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itfile_test", "itfile_test.vcxproj", "{22A5632F-6A8B-488D-AFFB-1CFB89FAD9AE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldpc_test", "ldpc_test.vcxproj", "{CFC1D71D-7B08-46A9-8B7C-05CB309A2E90}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llr_test", "llr_test.vcxproj", "{2ADD7EA3-4792-4333-A216-47D4A7D783D0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ls_solve_test", "ls_solve_test.vcxproj", "{ACE5C953-039C-405B-BD78-E34F2C75AE60}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lu_test", "lu_test.vcxproj", "{F02D7874-C0D3-428B-98F1-4ADA5E6F1469}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mat_test", "mat_test.vcxproj", "{B718295A-69D7-446C-9489-81C1E1CDB0D6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matfunc_test", "matfunc_test.vcxproj", "{8B34055D-68BE-425C-99AC-CF27028CEB0C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_nd_test", "modulator_nd_test.vcxproj", "{911ADB34-1EC4-4C07-B1B0-58EBE5180363}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_test", "modulator_test.vcxproj", "{D300D428-59C5-455B-A7D3-BCF87B213761}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newton_search_test", "newton_search_test.vcxproj", "{6815E4AB-B733-4EA5-96A7-0BB9B5CFC655}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parser_test", "parser_test.vcxproj", "{CDE9956E-568A-4DAB-9969-B3CBEBC40146}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "poly_test", "poly_test.vcxproj", "{32C228B7-5900-4644-9F44-CB8182B60CD1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pulse_shape_test", "pulse_shape_test.vcxproj", "{F28D1100-38CC-4E96-ACC6-9F71594EF785}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qr_test", "qr_test.vcxproj", "{9555D8DD-E728-4BB0-BB18-F0DAB0D4F7F3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rand_test", "rand_test.vcxproj", "{0F537FA9-43C4-4759-91C4-42E4D9C38CEA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_syst_conv_code_test", "rec_syst_conv_code_test.vcxproj", "{7AB5C3A0-98D7-45CE-AB85-C83A0AB61A83}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reedsolomon_test", "reedsolomon_test.vcxproj", "{AF1F2B10-605C-4FD7-852F-707B0E1E1472}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schur_test", "schur_test.vcxproj", "{7876CA75-88FE-4AE3-B1DE-F9F63BD62605}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sigfun_test", "sigfun_test.vcxproj", "{57040B97-9804-4633-A2EA-D1AFDAD8F113}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sort_test", "sort_test.vcxproj", "{F0B330F3-4B93-4A9E-8E2A-53895729BD8A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "source_test", "source_test.vcxproj", "{905F0008-94D4-43AB-BECB-60AB2AEA2706}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparse_test", "sparse_test.vcxproj", "{7BDC3BB9-BFEC-4643-BBFE-56C7A78B8AEE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stat_test", "stat_test.vcxproj", "{C489E9D6-6D42-4F31-82E9-7C8E4DB4530A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "svd_test", "svd_test.vcxproj", "{4FEE5C77-7BFE-443C-AA01-7732BCB15B14}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_test", "timer_test.vcxproj", "{9E0137C0-4E7E-4AF0-8605-2DE85349C5AD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transforms_test", "transforms_test.vcxproj", "{C0377CCE-AEE3-4229-8FF9-D65F9ACD4936}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turbo_test", "turbo_test.vcxproj", "{BBEBFB37-0F75-439A-9279-60795AB7E3BB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vec_test", "vec_test.vcxproj", "{3BBEB751-ED7D-4F12-BCC8-F32E5260A1F7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window_test", "window_test.vcxproj", "{C197BE16-B494-49E8-9B5F-1BA62C74E37F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "specmat_test", "specmat_test.vcxproj", "{062A36E3-705D-400F-93B7-3C9951379F9D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exit_test", "exit_test.vcxproj", "{C56040CA-7630-4BB1-A775-7B8B923457C0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "siso_test", "siso_test.vcxproj", "{F77FC112-C5D9-4CE0-AA4C-324C3EC483DD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linspace_test", "linspace_test.vcxproj", "{59D32E37-C079-4194-8B3E-DA7BD88B814E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stc_test", "stc_test.vcxproj", "{440CA06E-4CDA-4F40-A560-F4E8F07404C0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demapper_test", "demapper_test.vcxproj", "{0BD6BF14-C97C-441A-A8FA-08337186CAA7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AB324343-29E3-431D-BC7E-ACC0F120EA1F}.Release|Win32.ActiveCfg = Release|Win32 {AB324343-29E3-431D-BC7E-ACC0F120EA1F}.Release|Win32.Build.0 = Release|Win32 {41BD8F10-920D-4713-8F5E-8959B2633E3B}.Release|Win32.ActiveCfg = Release|Win32 {41BD8F10-920D-4713-8F5E-8959B2633E3B}.Release|Win32.Build.0 = Release|Win32 {2273E479-3717-4C95-8F29-F51ECFB5E5DA}.Release|Win32.ActiveCfg = Release|Win32 {2273E479-3717-4C95-8F29-F51ECFB5E5DA}.Release|Win32.Build.0 = Release|Win32 {EEE76A9C-DA87-4AA4-8D4B-F8D7AA262B94}.Release|Win32.ActiveCfg = Release|Win32 {EEE76A9C-DA87-4AA4-8D4B-F8D7AA262B94}.Release|Win32.Build.0 = Release|Win32 {952EDE50-F86C-4BBA-8473-60557274F728}.Release|Win32.ActiveCfg = Release|Win32 {952EDE50-F86C-4BBA-8473-60557274F728}.Release|Win32.Build.0 = Release|Win32 {4CE6C6BC-DF7F-4E1D-9C9E-3E70292C5E18}.Release|Win32.ActiveCfg = Release|Win32 {4CE6C6BC-DF7F-4E1D-9C9E-3E70292C5E18}.Release|Win32.Build.0 = Release|Win32 {18BFF682-EEE7-4610-A4EF-B9BF43CFCCBE}.Release|Win32.ActiveCfg = Release|Win32 {18BFF682-EEE7-4610-A4EF-B9BF43CFCCBE}.Release|Win32.Build.0 = Release|Win32 {F4223302-F344-4679-9AB3-7E05B246234C}.Release|Win32.ActiveCfg = Release|Win32 {F4223302-F344-4679-9AB3-7E05B246234C}.Release|Win32.Build.0 = Release|Win32 {567352BE-6E47-41F6-A108-6CDF72A793A8}.Release|Win32.ActiveCfg = Release|Win32 {567352BE-6E47-41F6-A108-6CDF72A793A8}.Release|Win32.Build.0 = Release|Win32 {91100FCA-5C7E-4474-8FA1-2AE8BA65E50A}.Release|Win32.ActiveCfg = Release|Win32 {91100FCA-5C7E-4474-8FA1-2AE8BA65E50A}.Release|Win32.Build.0 = Release|Win32 {E09A270A-B39C-46A0-A2D9-BB1CA73FA583}.Release|Win32.ActiveCfg = Release|Win32 {E09A270A-B39C-46A0-A2D9-BB1CA73FA583}.Release|Win32.Build.0 = Release|Win32 {B1A9829A-2E18-47A0-B130-200217E2DF58}.Release|Win32.ActiveCfg = Release|Win32 {B1A9829A-2E18-47A0-B130-200217E2DF58}.Release|Win32.Build.0 = Release|Win32 {D8C4991E-6EE0-4FDF-BA13-CB7A7DD43A26}.Release|Win32.ActiveCfg = Release|Win32 {D8C4991E-6EE0-4FDF-BA13-CB7A7DD43A26}.Release|Win32.Build.0 = Release|Win32 {B4965981-07ED-46F9-80BF-70CC83D1C334}.Release|Win32.ActiveCfg = Release|Win32 {B4965981-07ED-46F9-80BF-70CC83D1C334}.Release|Win32.Build.0 = Release|Win32 {8EB01DCE-B272-4DAF-B7A6-5188D95547EB}.Release|Win32.ActiveCfg = Release|Win32 {8EB01DCE-B272-4DAF-B7A6-5188D95547EB}.Release|Win32.Build.0 = Release|Win32 {DD06025C-4221-468D-8922-0A863A9F562B}.Release|Win32.ActiveCfg = Release|Win32 {DD06025C-4221-468D-8922-0A863A9F562B}.Release|Win32.Build.0 = Release|Win32 {573493FC-2B17-41BF-911A-498D4D2A32A3}.Release|Win32.ActiveCfg = Release|Win32 {573493FC-2B17-41BF-911A-498D4D2A32A3}.Release|Win32.Build.0 = Release|Win32 {9E64DD56-EB89-41E2-8CB8-85E1CEF07D70}.Release|Win32.ActiveCfg = Release|Win32 {9E64DD56-EB89-41E2-8CB8-85E1CEF07D70}.Release|Win32.Build.0 = Release|Win32 {9173A049-1BBC-4B36-9AD4-4F057409DC8A}.Release|Win32.ActiveCfg = Release|Win32 {9173A049-1BBC-4B36-9AD4-4F057409DC8A}.Release|Win32.Build.0 = Release|Win32 {97649EB3-2A63-48A8-BFC2-13B04A7F571F}.Release|Win32.ActiveCfg = Release|Win32 {97649EB3-2A63-48A8-BFC2-13B04A7F571F}.Release|Win32.Build.0 = Release|Win32 {08E8CA57-1B2B-4291-B3BD-C22550EEEF17}.Release|Win32.ActiveCfg = Release|Win32 {08E8CA57-1B2B-4291-B3BD-C22550EEEF17}.Release|Win32.Build.0 = Release|Win32 {31A4AFE5-645C-4228-9872-66B91A5496A7}.Release|Win32.ActiveCfg = Release|Win32 {31A4AFE5-645C-4228-9872-66B91A5496A7}.Release|Win32.Build.0 = Release|Win32 {D617AA55-2E8B-4975-A00B-C8597751BB72}.Release|Win32.ActiveCfg = Release|Win32 {D617AA55-2E8B-4975-A00B-C8597751BB72}.Release|Win32.Build.0 = Release|Win32 {892CDD19-5BF1-429A-8530-ECB22E3A460C}.Release|Win32.ActiveCfg = Release|Win32 {892CDD19-5BF1-429A-8530-ECB22E3A460C}.Release|Win32.Build.0 = Release|Win32 {FD34B40D-B00E-4CE8-A1F0-8FF5FE644D27}.Release|Win32.ActiveCfg = Release|Win32 {FD34B40D-B00E-4CE8-A1F0-8FF5FE644D27}.Release|Win32.Build.0 = Release|Win32 {22A5632F-6A8B-488D-AFFB-1CFB89FAD9AE}.Release|Win32.ActiveCfg = Release|Win32 {22A5632F-6A8B-488D-AFFB-1CFB89FAD9AE}.Release|Win32.Build.0 = Release|Win32 {CFC1D71D-7B08-46A9-8B7C-05CB309A2E90}.Release|Win32.ActiveCfg = Release|Win32 {CFC1D71D-7B08-46A9-8B7C-05CB309A2E90}.Release|Win32.Build.0 = Release|Win32 {2ADD7EA3-4792-4333-A216-47D4A7D783D0}.Release|Win32.ActiveCfg = Release|Win32 {2ADD7EA3-4792-4333-A216-47D4A7D783D0}.Release|Win32.Build.0 = Release|Win32 {ACE5C953-039C-405B-BD78-E34F2C75AE60}.Release|Win32.ActiveCfg = Release|Win32 {ACE5C953-039C-405B-BD78-E34F2C75AE60}.Release|Win32.Build.0 = Release|Win32 {F02D7874-C0D3-428B-98F1-4ADA5E6F1469}.Release|Win32.ActiveCfg = Release|Win32 {F02D7874-C0D3-428B-98F1-4ADA5E6F1469}.Release|Win32.Build.0 = Release|Win32 {B718295A-69D7-446C-9489-81C1E1CDB0D6}.Release|Win32.ActiveCfg = Release|Win32 {B718295A-69D7-446C-9489-81C1E1CDB0D6}.Release|Win32.Build.0 = Release|Win32 {8B34055D-68BE-425C-99AC-CF27028CEB0C}.Release|Win32.ActiveCfg = Release|Win32 {8B34055D-68BE-425C-99AC-CF27028CEB0C}.Release|Win32.Build.0 = Release|Win32 {911ADB34-1EC4-4C07-B1B0-58EBE5180363}.Release|Win32.ActiveCfg = Release|Win32 {911ADB34-1EC4-4C07-B1B0-58EBE5180363}.Release|Win32.Build.0 = Release|Win32 {D300D428-59C5-455B-A7D3-BCF87B213761}.Release|Win32.ActiveCfg = Release|Win32 {D300D428-59C5-455B-A7D3-BCF87B213761}.Release|Win32.Build.0 = Release|Win32 {6815E4AB-B733-4EA5-96A7-0BB9B5CFC655}.Release|Win32.ActiveCfg = Release|Win32 {6815E4AB-B733-4EA5-96A7-0BB9B5CFC655}.Release|Win32.Build.0 = Release|Win32 {CDE9956E-568A-4DAB-9969-B3CBEBC40146}.Release|Win32.ActiveCfg = Release|Win32 {CDE9956E-568A-4DAB-9969-B3CBEBC40146}.Release|Win32.Build.0 = Release|Win32 {32C228B7-5900-4644-9F44-CB8182B60CD1}.Release|Win32.ActiveCfg = Release|Win32 {32C228B7-5900-4644-9F44-CB8182B60CD1}.Release|Win32.Build.0 = Release|Win32 {F28D1100-38CC-4E96-ACC6-9F71594EF785}.Release|Win32.ActiveCfg = Release|Win32 {F28D1100-38CC-4E96-ACC6-9F71594EF785}.Release|Win32.Build.0 = Release|Win32 {9555D8DD-E728-4BB0-BB18-F0DAB0D4F7F3}.Release|Win32.ActiveCfg = Release|Win32 {9555D8DD-E728-4BB0-BB18-F0DAB0D4F7F3}.Release|Win32.Build.0 = Release|Win32 {0F537FA9-43C4-4759-91C4-42E4D9C38CEA}.Release|Win32.ActiveCfg = Release|Win32 {0F537FA9-43C4-4759-91C4-42E4D9C38CEA}.Release|Win32.Build.0 = Release|Win32 {7AB5C3A0-98D7-45CE-AB85-C83A0AB61A83}.Release|Win32.ActiveCfg = Release|Win32 {7AB5C3A0-98D7-45CE-AB85-C83A0AB61A83}.Release|Win32.Build.0 = Release|Win32 {AF1F2B10-605C-4FD7-852F-707B0E1E1472}.Release|Win32.ActiveCfg = Release|Win32 {AF1F2B10-605C-4FD7-852F-707B0E1E1472}.Release|Win32.Build.0 = Release|Win32 {7876CA75-88FE-4AE3-B1DE-F9F63BD62605}.Release|Win32.ActiveCfg = Release|Win32 {7876CA75-88FE-4AE3-B1DE-F9F63BD62605}.Release|Win32.Build.0 = Release|Win32 {57040B97-9804-4633-A2EA-D1AFDAD8F113}.Release|Win32.ActiveCfg = Release|Win32 {57040B97-9804-4633-A2EA-D1AFDAD8F113}.Release|Win32.Build.0 = Release|Win32 {F0B330F3-4B93-4A9E-8E2A-53895729BD8A}.Release|Win32.ActiveCfg = Release|Win32 {F0B330F3-4B93-4A9E-8E2A-53895729BD8A}.Release|Win32.Build.0 = Release|Win32 {905F0008-94D4-43AB-BECB-60AB2AEA2706}.Release|Win32.ActiveCfg = Release|Win32 {905F0008-94D4-43AB-BECB-60AB2AEA2706}.Release|Win32.Build.0 = Release|Win32 {7BDC3BB9-BFEC-4643-BBFE-56C7A78B8AEE}.Release|Win32.ActiveCfg = Release|Win32 {7BDC3BB9-BFEC-4643-BBFE-56C7A78B8AEE}.Release|Win32.Build.0 = Release|Win32 {C489E9D6-6D42-4F31-82E9-7C8E4DB4530A}.Release|Win32.ActiveCfg = Release|Win32 {C489E9D6-6D42-4F31-82E9-7C8E4DB4530A}.Release|Win32.Build.0 = Release|Win32 {4FEE5C77-7BFE-443C-AA01-7732BCB15B14}.Release|Win32.ActiveCfg = Release|Win32 {4FEE5C77-7BFE-443C-AA01-7732BCB15B14}.Release|Win32.Build.0 = Release|Win32 {9E0137C0-4E7E-4AF0-8605-2DE85349C5AD}.Release|Win32.ActiveCfg = Release|Win32 {9E0137C0-4E7E-4AF0-8605-2DE85349C5AD}.Release|Win32.Build.0 = Release|Win32 {C0377CCE-AEE3-4229-8FF9-D65F9ACD4936}.Release|Win32.ActiveCfg = Release|Win32 {C0377CCE-AEE3-4229-8FF9-D65F9ACD4936}.Release|Win32.Build.0 = Release|Win32 {BBEBFB37-0F75-439A-9279-60795AB7E3BB}.Release|Win32.ActiveCfg = Release|Win32 {BBEBFB37-0F75-439A-9279-60795AB7E3BB}.Release|Win32.Build.0 = Release|Win32 {3BBEB751-ED7D-4F12-BCC8-F32E5260A1F7}.Release|Win32.ActiveCfg = Release|Win32 {3BBEB751-ED7D-4F12-BCC8-F32E5260A1F7}.Release|Win32.Build.0 = Release|Win32 {C197BE16-B494-49E8-9B5F-1BA62C74E37F}.Release|Win32.ActiveCfg = Release|Win32 {C197BE16-B494-49E8-9B5F-1BA62C74E37F}.Release|Win32.Build.0 = Release|Win32 {062A36E3-705D-400F-93B7-3C9951379F9D}.Release|Win32.ActiveCfg = Release|Win32 {062A36E3-705D-400F-93B7-3C9951379F9D}.Release|Win32.Build.0 = Release|Win32 {C56040CA-7630-4BB1-A775-7B8B923457C0}.Release|Win32.ActiveCfg = Release|Win32 {C56040CA-7630-4BB1-A775-7B8B923457C0}.Release|Win32.Build.0 = Release|Win32 {F77FC112-C5D9-4CE0-AA4C-324C3EC483DD}.Release|Win32.ActiveCfg = Release|Win32 {F77FC112-C5D9-4CE0-AA4C-324C3EC483DD}.Release|Win32.Build.0 = Release|Win32 {59D32E37-C079-4194-8B3E-DA7BD88B814E}.Release|Win32.ActiveCfg = Release|Win32 {59D32E37-C079-4194-8B3E-DA7BD88B814E}.Release|Win32.Build.0 = Release|Win32 {440CA06E-4CDA-4F40-A560-F4E8F07404C0}.Release|Win32.ActiveCfg = Release|Win32 {440CA06E-4CDA-4F40-A560-F4E8F07404C0}.Release|Win32.Build.0 = Release|Win32 {0BD6BF14-C97C-441A-A8FA-08337186CAA7}.Release|Win32.ActiveCfg = Release|Win32 {0BD6BF14-C97C-441A-A8FA-08337186CAA7}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_acml_tests/itpp_acml_tests.vs2005.sln000066400000000000000000000450131216575753400235170ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "array_test", "array_test.vs2005.vcproj", "{AB324343-29E3-431D-BC7E-ACC0F120EA1F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window_test", "window_test.vs2005.vcproj", "{C197BE16-B494-49E8-9B5F-1BA62C74E37F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bch_test", "bch_test.vs2005.vcproj", "{41BD8F10-920D-4713-8F5E-8959B2633E3B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bessel_test", "bessel_test.vs2005.vcproj", "{2273E479-3717-4C95-8F29-F51ECFB5E5DA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blas_test", "blas_test.vs2005.vcproj", "{EEE76A9C-DA87-4AA4-8D4B-F8D7AA262B94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "channel_test", "channel_test.vs2005.vcproj", "{952EDE50-F86C-4BBA-8473-60557274F728}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cholesky_test", "cholesky_test.vs2005.vcproj", "{4CE6C6BC-DF7F-4E1D-9C9E-3E70292C5E18}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "circular_buffer_test", "circular_buffer_test.vs2005.vcproj", "{18BFF682-EEE7-4610-A4EF-B9BF43CFCCBE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commfunc_test", "commfunc_test.vs2005.vcproj", "{F4223302-F344-4679-9AB3-7E05B246234C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convcode_test", "convcode_test.vs2005.vcproj", "{567352BE-6E47-41F6-A108-6CDF72A793A8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converters_test", "converters_test.vs2005.vcproj", "{91100FCA-5C7E-4474-8FA1-2AE8BA65E50A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demapper_test", "demapper_test.vs2005.vcproj", "{C96D9B07-A753-47E8-8E75-47CF10622E46}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "det_test", "det_test.vs2005.vcproj", "{E09A270A-B39C-46A0-A2D9-BB1CA73FA583}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eigen_test", "eigen_test.vs2005.vcproj", "{B1A9829A-2E18-47A0-B130-200217E2DF58}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_count_test", "error_count_test.vs2005.vcproj", "{D8C4991E-6EE0-4FDF-BA13-CB7A7DD43A26}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exit_test", "exit_test.vs2005.vcproj", "{C56040CA-7630-4BB1-A775-7B8B923457C0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastica_test", "fastica_test.vs2005.vcproj", "{B4965981-07ED-46F9-80BF-70CC83D1C334}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastmath_test", "fastmath_test.vs2005.vcproj", "{8EB01DCE-B272-4DAF-B7A6-5188D95547EB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_design_test", "filter_design_test.vs2005.vcproj", "{DD06025C-4221-468D-8922-0A863A9F562B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_test", "filter_test.vs2005.vcproj", "{573493FC-2B17-41BF-911A-498D4D2A32A3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fix_test", "fix_test.vs2005.vcproj", "{9E64DD56-EB89-41E2-8CB8-85E1CEF07D70}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freq_filt_test", "freq_filt_test.vs2005.vcproj", "{9173A049-1BBC-4B36-9AD4-4F057409DC8A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "galois_test", "galois_test.vs2005.vcproj", "{97649EB3-2A63-48A8-BFC2-13B04A7F571F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gf2mat_test", "gf2mat_test.vs2005.vcproj", "{08E8CA57-1B2B-4291-B3BD-C22550EEEF17}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "histogram_test", "histogram_test.vs2005.vcproj", "{31A4AFE5-645C-4228-9872-66B91A5496A7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "integration_test", "integration_test.vs2005.vcproj", "{D617AA55-2E8B-4975-A00B-C8597751BB72}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interleaver_test", "interleaver_test.vs2005.vcproj", "{892CDD19-5BF1-429A-8530-ECB22E3A460C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inv_test", "inv_test.vs2005.vcproj", "{FD34B40D-B00E-4CE8-A1F0-8FF5FE644D27}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itfile_test", "itfile_test.vs2005.vcproj", "{22A5632F-6A8B-488D-AFFB-1CFB89FAD9AE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldpc_test", "ldpc_test.vs2005.vcproj", "{CFC1D71D-7B08-46A9-8B7C-05CB309A2E90}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linspace_test", "linspace_test.vs2005.vcproj", "{60010E6F-238C-4304-9091-E67974C64498}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llr_test", "llr_test.vs2005.vcproj", "{2ADD7EA3-4792-4333-A216-47D4A7D783D0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ls_solve_test", "ls_solve_test.vs2005.vcproj", "{ACE5C953-039C-405B-BD78-E34F2C75AE60}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lu_test", "lu_test.vs2005.vcproj", "{F02D7874-C0D3-428B-98F1-4ADA5E6F1469}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mat_test", "mat_test.vs2005.vcproj", "{B718295A-69D7-446C-9489-81C1E1CDB0D6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matfunc_test", "matfunc_test.vs2005.vcproj", "{8B34055D-68BE-425C-99AC-CF27028CEB0C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_nd_test", "modulator_nd_test.vs2005.vcproj", "{911ADB34-1EC4-4C07-B1B0-58EBE5180363}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_test", "modulator_test.vs2005.vcproj", "{D300D428-59C5-455B-A7D3-BCF87B213761}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newton_search_test", "newton_search_test.vs2005.vcproj", "{6815E4AB-B733-4EA5-96A7-0BB9B5CFC655}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parser_test", "parser_test.vs2005.vcproj", "{CDE9956E-568A-4DAB-9969-B3CBEBC40146}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "poly_test", "poly_test.vs2005.vcproj", "{32C228B7-5900-4644-9F44-CB8182B60CD1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pulse_shape_test", "pulse_shape_test.vs2005.vcproj", "{F28D1100-38CC-4E96-ACC6-9F71594EF785}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qr_test", "qr_test.vs2005.vcproj", "{9555D8DD-E728-4BB0-BB18-F0DAB0D4F7F3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rand_test", "rand_test.vs2005.vcproj", "{0F537FA9-43C4-4759-91C4-42E4D9C38CEA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_syst_conv_code_test", "rec_syst_conv_code_test.vs2005.vcproj", "{7AB5C3A0-98D7-45CE-AB85-C83A0AB61A83}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reedsolomon_test", "reedsolomon_test.vs2005.vcproj", "{AF1F2B10-605C-4FD7-852F-707B0E1E1472}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schur_test", "schur_test.vs2005.vcproj", "{7876CA75-88FE-4AE3-B1DE-F9F63BD62605}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sigfun_test", "sigfun_test.vs2005.vcproj", "{57040B97-9804-4633-A2EA-D1AFDAD8F113}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "siso_test", "siso_test.vs2005.vcproj", "{F77FC112-C5D9-4CE0-AA4C-324C3EC483DD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sort_test", "sort_test.vs2005.vcproj", "{F0B330F3-4B93-4A9E-8E2A-53895729BD8A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "source_test", "source_test.vs2005.vcproj", "{905F0008-94D4-43AB-BECB-60AB2AEA2706}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparse_test", "sparse_test.vs2005.vcproj", "{7BDC3BB9-BFEC-4643-BBFE-56C7A78B8AEE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "specmat_test", "specmat_test.vs2005.vcproj", "{062A36E3-705D-400F-93B7-3C9951379F9D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stat_test", "stat_test.vs2005.vcproj", "{C489E9D6-6D42-4F31-82E9-7C8E4DB4530A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stc_test", "stc_test.vs2005.vcproj", "{44D886A6-52E2-43F2-B95F-194B7AA54FF2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "svd_test", "svd_test.vs2005.vcproj", "{4FEE5C77-7BFE-443C-AA01-7732BCB15B14}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_test", "timer_test.vs2005.vcproj", "{9E0137C0-4E7E-4AF0-8605-2DE85349C5AD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transforms_test", "transforms_test.vs2005.vcproj", "{C0377CCE-AEE3-4229-8FF9-D65F9ACD4936}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turbo_test", "turbo_test.vs2005.vcproj", "{BBEBFB37-0F75-439A-9279-60795AB7E3BB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vec_test", "vec_test.vs2005.vcproj", "{3BBEB751-ED7D-4F12-BCC8-F32E5260A1F7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AB324343-29E3-431D-BC7E-ACC0F120EA1F}.Release|Win32.ActiveCfg = Release|Win32 {AB324343-29E3-431D-BC7E-ACC0F120EA1F}.Release|Win32.Build.0 = Release|Win32 {C197BE16-B494-49E8-9B5F-1BA62C74E37F}.Release|Win32.ActiveCfg = Release|Win32 {C197BE16-B494-49E8-9B5F-1BA62C74E37F}.Release|Win32.Build.0 = Release|Win32 {41BD8F10-920D-4713-8F5E-8959B2633E3B}.Release|Win32.ActiveCfg = Release|Win32 {41BD8F10-920D-4713-8F5E-8959B2633E3B}.Release|Win32.Build.0 = Release|Win32 {2273E479-3717-4C95-8F29-F51ECFB5E5DA}.Release|Win32.ActiveCfg = Release|Win32 {2273E479-3717-4C95-8F29-F51ECFB5E5DA}.Release|Win32.Build.0 = Release|Win32 {EEE76A9C-DA87-4AA4-8D4B-F8D7AA262B94}.Release|Win32.ActiveCfg = Release|Win32 {EEE76A9C-DA87-4AA4-8D4B-F8D7AA262B94}.Release|Win32.Build.0 = Release|Win32 {952EDE50-F86C-4BBA-8473-60557274F728}.Release|Win32.ActiveCfg = Release|Win32 {952EDE50-F86C-4BBA-8473-60557274F728}.Release|Win32.Build.0 = Release|Win32 {4CE6C6BC-DF7F-4E1D-9C9E-3E70292C5E18}.Release|Win32.ActiveCfg = Release|Win32 {4CE6C6BC-DF7F-4E1D-9C9E-3E70292C5E18}.Release|Win32.Build.0 = Release|Win32 {18BFF682-EEE7-4610-A4EF-B9BF43CFCCBE}.Release|Win32.ActiveCfg = Release|Win32 {18BFF682-EEE7-4610-A4EF-B9BF43CFCCBE}.Release|Win32.Build.0 = Release|Win32 {F4223302-F344-4679-9AB3-7E05B246234C}.Release|Win32.ActiveCfg = Release|Win32 {F4223302-F344-4679-9AB3-7E05B246234C}.Release|Win32.Build.0 = Release|Win32 {567352BE-6E47-41F6-A108-6CDF72A793A8}.Release|Win32.ActiveCfg = Release|Win32 {567352BE-6E47-41F6-A108-6CDF72A793A8}.Release|Win32.Build.0 = Release|Win32 {91100FCA-5C7E-4474-8FA1-2AE8BA65E50A}.Release|Win32.ActiveCfg = Release|Win32 {91100FCA-5C7E-4474-8FA1-2AE8BA65E50A}.Release|Win32.Build.0 = Release|Win32 {C96D9B07-A753-47E8-8E75-47CF10622E46}.Release|Win32.ActiveCfg = Release|Win32 {C96D9B07-A753-47E8-8E75-47CF10622E46}.Release|Win32.Build.0 = Release|Win32 {E09A270A-B39C-46A0-A2D9-BB1CA73FA583}.Release|Win32.ActiveCfg = Release|Win32 {E09A270A-B39C-46A0-A2D9-BB1CA73FA583}.Release|Win32.Build.0 = Release|Win32 {B1A9829A-2E18-47A0-B130-200217E2DF58}.Release|Win32.ActiveCfg = Release|Win32 {B1A9829A-2E18-47A0-B130-200217E2DF58}.Release|Win32.Build.0 = Release|Win32 {D8C4991E-6EE0-4FDF-BA13-CB7A7DD43A26}.Release|Win32.ActiveCfg = Release|Win32 {D8C4991E-6EE0-4FDF-BA13-CB7A7DD43A26}.Release|Win32.Build.0 = Release|Win32 {C56040CA-7630-4BB1-A775-7B8B923457C0}.Release|Win32.ActiveCfg = Release|Win32 {C56040CA-7630-4BB1-A775-7B8B923457C0}.Release|Win32.Build.0 = Release|Win32 {B4965981-07ED-46F9-80BF-70CC83D1C334}.Release|Win32.ActiveCfg = Release|Win32 {B4965981-07ED-46F9-80BF-70CC83D1C334}.Release|Win32.Build.0 = Release|Win32 {8EB01DCE-B272-4DAF-B7A6-5188D95547EB}.Release|Win32.ActiveCfg = Release|Win32 {8EB01DCE-B272-4DAF-B7A6-5188D95547EB}.Release|Win32.Build.0 = Release|Win32 {DD06025C-4221-468D-8922-0A863A9F562B}.Release|Win32.ActiveCfg = Release|Win32 {DD06025C-4221-468D-8922-0A863A9F562B}.Release|Win32.Build.0 = Release|Win32 {573493FC-2B17-41BF-911A-498D4D2A32A3}.Release|Win32.ActiveCfg = Release|Win32 {573493FC-2B17-41BF-911A-498D4D2A32A3}.Release|Win32.Build.0 = Release|Win32 {9E64DD56-EB89-41E2-8CB8-85E1CEF07D70}.Release|Win32.ActiveCfg = Release|Win32 {9E64DD56-EB89-41E2-8CB8-85E1CEF07D70}.Release|Win32.Build.0 = Release|Win32 {9173A049-1BBC-4B36-9AD4-4F057409DC8A}.Release|Win32.ActiveCfg = Release|Win32 {9173A049-1BBC-4B36-9AD4-4F057409DC8A}.Release|Win32.Build.0 = Release|Win32 {97649EB3-2A63-48A8-BFC2-13B04A7F571F}.Release|Win32.ActiveCfg = Release|Win32 {97649EB3-2A63-48A8-BFC2-13B04A7F571F}.Release|Win32.Build.0 = Release|Win32 {08E8CA57-1B2B-4291-B3BD-C22550EEEF17}.Release|Win32.ActiveCfg = Release|Win32 {08E8CA57-1B2B-4291-B3BD-C22550EEEF17}.Release|Win32.Build.0 = Release|Win32 {31A4AFE5-645C-4228-9872-66B91A5496A7}.Release|Win32.ActiveCfg = Release|Win32 {31A4AFE5-645C-4228-9872-66B91A5496A7}.Release|Win32.Build.0 = Release|Win32 {D617AA55-2E8B-4975-A00B-C8597751BB72}.Release|Win32.ActiveCfg = Release|Win32 {D617AA55-2E8B-4975-A00B-C8597751BB72}.Release|Win32.Build.0 = Release|Win32 {892CDD19-5BF1-429A-8530-ECB22E3A460C}.Release|Win32.ActiveCfg = Release|Win32 {892CDD19-5BF1-429A-8530-ECB22E3A460C}.Release|Win32.Build.0 = Release|Win32 {FD34B40D-B00E-4CE8-A1F0-8FF5FE644D27}.Release|Win32.ActiveCfg = Release|Win32 {FD34B40D-B00E-4CE8-A1F0-8FF5FE644D27}.Release|Win32.Build.0 = Release|Win32 {22A5632F-6A8B-488D-AFFB-1CFB89FAD9AE}.Release|Win32.ActiveCfg = Release|Win32 {22A5632F-6A8B-488D-AFFB-1CFB89FAD9AE}.Release|Win32.Build.0 = Release|Win32 {CFC1D71D-7B08-46A9-8B7C-05CB309A2E90}.Release|Win32.ActiveCfg = Release|Win32 {CFC1D71D-7B08-46A9-8B7C-05CB309A2E90}.Release|Win32.Build.0 = Release|Win32 {60010E6F-238C-4304-9091-E67974C64498}.Release|Win32.ActiveCfg = Release|Win32 {60010E6F-238C-4304-9091-E67974C64498}.Release|Win32.Build.0 = Release|Win32 {2ADD7EA3-4792-4333-A216-47D4A7D783D0}.Release|Win32.ActiveCfg = Release|Win32 {2ADD7EA3-4792-4333-A216-47D4A7D783D0}.Release|Win32.Build.0 = Release|Win32 {ACE5C953-039C-405B-BD78-E34F2C75AE60}.Release|Win32.ActiveCfg = Release|Win32 {ACE5C953-039C-405B-BD78-E34F2C75AE60}.Release|Win32.Build.0 = Release|Win32 {F02D7874-C0D3-428B-98F1-4ADA5E6F1469}.Release|Win32.ActiveCfg = Release|Win32 {F02D7874-C0D3-428B-98F1-4ADA5E6F1469}.Release|Win32.Build.0 = Release|Win32 {B718295A-69D7-446C-9489-81C1E1CDB0D6}.Release|Win32.ActiveCfg = Release|Win32 {B718295A-69D7-446C-9489-81C1E1CDB0D6}.Release|Win32.Build.0 = Release|Win32 {8B34055D-68BE-425C-99AC-CF27028CEB0C}.Release|Win32.ActiveCfg = Release|Win32 {8B34055D-68BE-425C-99AC-CF27028CEB0C}.Release|Win32.Build.0 = Release|Win32 {911ADB34-1EC4-4C07-B1B0-58EBE5180363}.Release|Win32.ActiveCfg = Release|Win32 {911ADB34-1EC4-4C07-B1B0-58EBE5180363}.Release|Win32.Build.0 = Release|Win32 {D300D428-59C5-455B-A7D3-BCF87B213761}.Release|Win32.ActiveCfg = Release|Win32 {D300D428-59C5-455B-A7D3-BCF87B213761}.Release|Win32.Build.0 = Release|Win32 {6815E4AB-B733-4EA5-96A7-0BB9B5CFC655}.Release|Win32.ActiveCfg = Release|Win32 {6815E4AB-B733-4EA5-96A7-0BB9B5CFC655}.Release|Win32.Build.0 = Release|Win32 {CDE9956E-568A-4DAB-9969-B3CBEBC40146}.Release|Win32.ActiveCfg = Release|Win32 {CDE9956E-568A-4DAB-9969-B3CBEBC40146}.Release|Win32.Build.0 = Release|Win32 {32C228B7-5900-4644-9F44-CB8182B60CD1}.Release|Win32.ActiveCfg = Release|Win32 {32C228B7-5900-4644-9F44-CB8182B60CD1}.Release|Win32.Build.0 = Release|Win32 {F28D1100-38CC-4E96-ACC6-9F71594EF785}.Release|Win32.ActiveCfg = Release|Win32 {F28D1100-38CC-4E96-ACC6-9F71594EF785}.Release|Win32.Build.0 = Release|Win32 {9555D8DD-E728-4BB0-BB18-F0DAB0D4F7F3}.Release|Win32.ActiveCfg = Release|Win32 {9555D8DD-E728-4BB0-BB18-F0DAB0D4F7F3}.Release|Win32.Build.0 = Release|Win32 {0F537FA9-43C4-4759-91C4-42E4D9C38CEA}.Release|Win32.ActiveCfg = Release|Win32 {0F537FA9-43C4-4759-91C4-42E4D9C38CEA}.Release|Win32.Build.0 = Release|Win32 {7AB5C3A0-98D7-45CE-AB85-C83A0AB61A83}.Release|Win32.ActiveCfg = Release|Win32 {7AB5C3A0-98D7-45CE-AB85-C83A0AB61A83}.Release|Win32.Build.0 = Release|Win32 {AF1F2B10-605C-4FD7-852F-707B0E1E1472}.Release|Win32.ActiveCfg = Release|Win32 {AF1F2B10-605C-4FD7-852F-707B0E1E1472}.Release|Win32.Build.0 = Release|Win32 {7876CA75-88FE-4AE3-B1DE-F9F63BD62605}.Release|Win32.ActiveCfg = Release|Win32 {7876CA75-88FE-4AE3-B1DE-F9F63BD62605}.Release|Win32.Build.0 = Release|Win32 {57040B97-9804-4633-A2EA-D1AFDAD8F113}.Release|Win32.ActiveCfg = Release|Win32 {57040B97-9804-4633-A2EA-D1AFDAD8F113}.Release|Win32.Build.0 = Release|Win32 {F77FC112-C5D9-4CE0-AA4C-324C3EC483DD}.Release|Win32.ActiveCfg = Release|Win32 {F77FC112-C5D9-4CE0-AA4C-324C3EC483DD}.Release|Win32.Build.0 = Release|Win32 {F0B330F3-4B93-4A9E-8E2A-53895729BD8A}.Release|Win32.ActiveCfg = Release|Win32 {F0B330F3-4B93-4A9E-8E2A-53895729BD8A}.Release|Win32.Build.0 = Release|Win32 {905F0008-94D4-43AB-BECB-60AB2AEA2706}.Release|Win32.ActiveCfg = Release|Win32 {905F0008-94D4-43AB-BECB-60AB2AEA2706}.Release|Win32.Build.0 = Release|Win32 {7BDC3BB9-BFEC-4643-BBFE-56C7A78B8AEE}.Release|Win32.ActiveCfg = Release|Win32 {7BDC3BB9-BFEC-4643-BBFE-56C7A78B8AEE}.Release|Win32.Build.0 = Release|Win32 {062A36E3-705D-400F-93B7-3C9951379F9D}.Release|Win32.ActiveCfg = Release|Win32 {062A36E3-705D-400F-93B7-3C9951379F9D}.Release|Win32.Build.0 = Release|Win32 {C489E9D6-6D42-4F31-82E9-7C8E4DB4530A}.Release|Win32.ActiveCfg = Release|Win32 {C489E9D6-6D42-4F31-82E9-7C8E4DB4530A}.Release|Win32.Build.0 = Release|Win32 {44D886A6-52E2-43F2-B95F-194B7AA54FF2}.Release|Win32.ActiveCfg = Release|Win32 {44D886A6-52E2-43F2-B95F-194B7AA54FF2}.Release|Win32.Build.0 = Release|Win32 {4FEE5C77-7BFE-443C-AA01-7732BCB15B14}.Release|Win32.ActiveCfg = Release|Win32 {4FEE5C77-7BFE-443C-AA01-7732BCB15B14}.Release|Win32.Build.0 = Release|Win32 {9E0137C0-4E7E-4AF0-8605-2DE85349C5AD}.Release|Win32.ActiveCfg = Release|Win32 {9E0137C0-4E7E-4AF0-8605-2DE85349C5AD}.Release|Win32.Build.0 = Release|Win32 {C0377CCE-AEE3-4229-8FF9-D65F9ACD4936}.Release|Win32.ActiveCfg = Release|Win32 {C0377CCE-AEE3-4229-8FF9-D65F9ACD4936}.Release|Win32.Build.0 = Release|Win32 {BBEBFB37-0F75-439A-9279-60795AB7E3BB}.Release|Win32.ActiveCfg = Release|Win32 {BBEBFB37-0F75-439A-9279-60795AB7E3BB}.Release|Win32.Build.0 = Release|Win32 {3BBEB751-ED7D-4F12-BCC8-F32E5260A1F7}.Release|Win32.ActiveCfg = Release|Win32 {3BBEB751-ED7D-4F12-BCC8-F32E5260A1F7}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_acml_tests/ldpc_test.vcproj000066400000000000000000000045071216575753400220620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/ldpc_test.vs2005.vcproj000066400000000000000000000043431216575753400230160ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/linspace_test.vcproj000066400000000000000000000046031216575753400227330ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/linspace_test.vs2005.vcproj000066400000000000000000000043451216575753400236740ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/llr_test.vcproj000066400000000000000000000045041216575753400217260ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/llr_test.vs2005.vcproj000066400000000000000000000043401216575753400226620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/ls_solve_test.vcproj000066400000000000000000000045231216575753400227640ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/ls_solve_test.vs2005.vcproj000066400000000000000000000043571216575753400237270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/lu_test.vcproj000066400000000000000000000045011216575753400215520ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/lu_test.vs2005.vcproj000066400000000000000000000043351216575753400225150ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/mat_test.vcproj000066400000000000000000000045041216575753400217160ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/mat_test.vs2005.vcproj000066400000000000000000000043401216575753400226520ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/matfunc_test.vcproj000066400000000000000000000045201216575753400225700ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/matfunc_test.vs2005.vcproj000066400000000000000000000043541216575753400235330ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/modulator_nd_test.vcproj000066400000000000000000000045371216575753400236320ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/modulator_nd_test.vs2005.vcproj000066400000000000000000000043731216575753400245660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/modulator_test.vcproj000066400000000000000000000045261216575753400231470ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/modulator_test.vs2005.vcproj000066400000000000000000000043621216575753400241030ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/newton_search_test.vcproj000066400000000000000000000045421216575753400237760ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/newton_search_test.vs2005.vcproj000066400000000000000000000043761216575753400247410ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/parser_test.vcproj000066400000000000000000000046151216575753400224340ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/parser_test.vs2005.vcproj000066400000000000000000000044511216575753400233700ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/poly_test.vcproj000066400000000000000000000045071216575753400221230ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/poly_test.vs2005.vcproj000066400000000000000000000043431216575753400230570ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/pulse_shape_test.vcproj000066400000000000000000000045341216575753400234500ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/pulse_shape_test.vs2005.vcproj000066400000000000000000000043701216575753400244040ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/qr_test.vcproj000066400000000000000000000045011216575753400215540ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/qr_test.vs2005.vcproj000066400000000000000000000043351216575753400225170ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/rand_test.vcproj000066400000000000000000000045071216575753400220640ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/rand_test.vs2005.vcproj000066400000000000000000000043431216575753400230200ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/rec_syst_conv_code_test.vcproj000066400000000000000000000045611216575753400250120ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/rec_syst_conv_code_test.vs2005.vcproj000066400000000000000000000044151216575753400257460ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/reedsolomon_test.vcproj000066400000000000000000000045341216575753400234660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/reedsolomon_test.vs2005.vcproj000066400000000000000000000043701216575753400244220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/schur_test.vcproj000066400000000000000000000045121216575753400222600ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/schur_test.vs2005.vcproj000066400000000000000000000043461216575753400232230ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/sigfun_test.vcproj000066400000000000000000000045151216575753400224320ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/sigfun_test.vs2005.vcproj000066400000000000000000000043511216575753400233660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/siso_test.vcproj000066400000000000000000000045251216575753400221150ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/siso_test.vs2005.vcproj000066400000000000000000000043611216575753400230510ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/sort_test.vcproj000066400000000000000000000045071216575753400221270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/sort_test.vs2005.vcproj000066400000000000000000000043431216575753400230630ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/source_test.vcproj000066400000000000000000000045151216575753400224370ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/source_test.vs2005.vcproj000066400000000000000000000043511216575753400233730ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/sparse_test.vcproj000066400000000000000000000045151216575753400224340ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/sparse_test.vs2005.vcproj000066400000000000000000000043511216575753400233700ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/specmat_test.vcproj000066400000000000000000000045201216575753400225670ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/specmat_test.vs2005.vcproj000066400000000000000000000043541216575753400235320ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/stat_test.vcproj000066400000000000000000000045071216575753400221130ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/stat_test.vs2005.vcproj000066400000000000000000000043431216575753400230470ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/stc_test.vcproj000066400000000000000000000045671216575753400217370ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/stc_test.vs2005.vcproj000066400000000000000000000043311216575753400226620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/svd_test.vcproj000066400000000000000000000045041216575753400217310ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/svd_test.vs2005.vcproj000066400000000000000000000043401216575753400226650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/timer_test.vcproj000066400000000000000000000045121216575753400222540ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/timer_test.vs2005.vcproj000066400000000000000000000043461216575753400232170ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/transforms_test.vcproj000066400000000000000000000045311216575753400233330ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/transforms_test.vs2005.vcproj000066400000000000000000000043651216575753400242760ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/turbo_test.vcproj000066400000000000000000000045121216575753400222670ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/turbo_test.vs2005.vcproj000066400000000000000000000043461216575753400232320ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/vec_test.vcproj000066400000000000000000000045041216575753400217120ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/vec_test.vs2005.vcproj000066400000000000000000000042731216575753400226530ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/window_test.vcproj000066400000000000000000000045151216575753400224460ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_acml_tests/window_test.vs2005.vcproj000066400000000000000000000043511216575753400234020ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl.sln000066400000000000000000000015361216575753400160160ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itpp_mkl", "itpp_mkl.vcxproj", "{C069ECD3-26E8-437C-8B20-3A5D68B22F2A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.ActiveCfg = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.Build.0 = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.ActiveCfg = Release|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_mkl.vcproj000066400000000000000000000542601216575753400165270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl.vcxproj000066400000000000000000000436701216575753400167220ustar00rootroot00000000000000 Debug Win32 Release Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A} Win32Proj StaticLibrary MultiByte StaticLibrary MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)\lib\ $(ProjectName)_build\$(Configuration)\ $(SolutionDir)\lib\ $(ProjectName)_build\$(Configuration)\ AllRules.ruleset AllRules.ruleset itpp itpp Disabled ..;$(INCLUDE);%(AdditionalIncludeDirectories) _WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_MKL;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL true Level3 false EditAndContinue $(SolutionDir)\lib\itpp_debug.lib ..;$(INCLUDE);%(AdditionalIncludeDirectories) _WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_MKL;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 false ProgramDatabase $(SolutionDir)\lib\itpp.lib itpp-4.3.1/win32/itpp_mkl.vs2005.sln000066400000000000000000000015431216575753400167520ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itpp_mkl", "itpp_mkl.vs2005.vcproj", "{C069ECD3-26E8-437C-8B20-3A5D68B22F2A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.ActiveCfg = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Debug|Win32.Build.0 = Debug|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.ActiveCfg = Release|Win32 {C069ECD3-26E8-437C-8B20-3A5D68B22F2A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_mkl.vs2005.vcproj000066400000000000000000000542601216575753400174650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/000077500000000000000000000000001216575753400165155ustar00rootroot00000000000000itpp-4.3.1/win32/itpp_mkl_tests/Makefile.am000066400000000000000000000024651216575753400205600ustar00rootroot00000000000000include $(top_srcdir)/Makefile.common EXTRA_DIST = \ itpp_mkl_tests.sln \ array_test.vcproj \ bch_test.vcproj \ bessel_test.vcproj \ blas_test.vcproj \ channel_test.vcproj \ cholesky_test.vcproj \ circular_buffer_test.vcproj \ commfunc_test.vcproj \ convcode_test.vcproj \ converters_test.vcproj \ det_test.vcproj \ eigen_test.vcproj \ error_count_test.vcproj \ fastica_test.vcproj \ fastmath_test.vcproj \ filter_design_test.vcproj \ filter_test.vcproj \ fix_test.vcproj \ freq_filt_test.vcproj \ galois_test.vcproj \ gf2mat_test.vcproj \ histogram_test.vcproj \ integration_test.vcproj \ interleaver_test.vcproj \ inv_test.vcproj \ itfile_test.vcproj \ ldpc_test.vcproj \ llr_test.vcproj \ ls_solve_test.vcproj \ lu_test.vcproj \ matfunc_test.vcproj \ mat_test.vcproj \ modulator_nd_test.vcproj \ modulator_test.vcproj \ newton_search_test.vcproj \ parser_test.vcproj \ poly_test.vcproj \ pulse_shape_test.vcproj \ qr_test.vcproj \ rand_test.vcproj \ rec_syst_conv_code_test.vcproj \ reedsolomon_test.vcproj \ schur_test.vcproj \ sigfun_test.vcproj \ sort_test.vcproj \ source_test.vcproj \ sparse_test.vcproj \ specmat_test.vcproj \ stat_test.vcproj \ svd_test.vcproj \ timer_test.vcproj \ transforms_test.vcproj \ turbo_test.vcproj \ vec_test.vcproj \ window_test.vcproj itpp-4.3.1/win32/itpp_mkl_tests/Makefile.in000066400000000000000000000264641216575753400205760ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.common subdir = win32/itpp_mkl_tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_blas.m4 \ $(top_srcdir)/m4/acx_fft.m4 $(top_srcdir)/m4/acx_lapack.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/itpp/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLAS_LIBS = @BLAS_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXFLAGS_DEBUG = @CXXFLAGS_DEBUG@ CXXFLAGS_OPT = @CXXFLAGS_OPT@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPLICIT_LIBS = @EXPLICIT_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ FFT_LIBS = @FFT_LIBS@ FGREP = @FGREP@ FLIBS = @FLIBS@ GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_LIBS = @LAPACK_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NO_UNDEFINED = @NO_UNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_DEBUG = @PACKAGE_DEBUG@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PRIVATE_LIBS = @PRIVATE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_ok = @doxygen_ok@ dvidir = @dvidir@ dvips_ok = @dvips_ok@ exec_prefix = @exec_prefix@ gs_ok = @gs_ok@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ latex_ok = @latex_ok@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) EXTRA_DIST = \ itpp_mkl_tests.sln \ array_test.vcproj \ bch_test.vcproj \ bessel_test.vcproj \ blas_test.vcproj \ channel_test.vcproj \ cholesky_test.vcproj \ circular_buffer_test.vcproj \ commfunc_test.vcproj \ convcode_test.vcproj \ converters_test.vcproj \ det_test.vcproj \ eigen_test.vcproj \ error_count_test.vcproj \ fastica_test.vcproj \ fastmath_test.vcproj \ filter_design_test.vcproj \ filter_test.vcproj \ fix_test.vcproj \ freq_filt_test.vcproj \ galois_test.vcproj \ gf2mat_test.vcproj \ histogram_test.vcproj \ integration_test.vcproj \ interleaver_test.vcproj \ inv_test.vcproj \ itfile_test.vcproj \ ldpc_test.vcproj \ llr_test.vcproj \ ls_solve_test.vcproj \ lu_test.vcproj \ matfunc_test.vcproj \ mat_test.vcproj \ modulator_nd_test.vcproj \ modulator_test.vcproj \ newton_search_test.vcproj \ parser_test.vcproj \ poly_test.vcproj \ pulse_shape_test.vcproj \ qr_test.vcproj \ rand_test.vcproj \ rec_syst_conv_code_test.vcproj \ reedsolomon_test.vcproj \ schur_test.vcproj \ sigfun_test.vcproj \ sort_test.vcproj \ source_test.vcproj \ sparse_test.vcproj \ specmat_test.vcproj \ stat_test.vcproj \ svd_test.vcproj \ timer_test.vcproj \ transforms_test.vcproj \ turbo_test.vcproj \ vec_test.vcproj \ window_test.vcproj all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu win32/itpp_mkl_tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu win32/itpp_mkl_tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: itpp-4.3.1/win32/itpp_mkl_tests/array_test.vcproj000066400000000000000000000045671216575753400221330ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/array_test.vs2005.vcproj000066400000000000000000000043561216575753400230650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/bch_test.vcproj000066400000000000000000000045611216575753400215430ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/bch_test.vs2005.vcproj000066400000000000000000000044151216575753400224770ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/bessel_test.vcproj000066400000000000000000000045721216575753400222660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/bessel_test.vs2005.vcproj000066400000000000000000000044261216575753400232220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/blas_test.vcproj000066400000000000000000000045641216575753400217330ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/blas_test.vs2005.vcproj000066400000000000000000000044201216575753400226600ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/channel_test.vcproj000066400000000000000000000045751216575753400224240ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/channel_test.vs2005.vcproj000066400000000000000000000044311216575753400233510ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/cholesky_test.vcproj000066400000000000000000000046001216575753400226220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/cholesky_test.vs2005.vcproj000066400000000000000000000044341216575753400235650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/circular_buffer_test.vcproj000066400000000000000000000046251216575753400241450ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/circular_buffer_test.vs2005.vcproj000066400000000000000000000044611216575753400251010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/commfunc_test.vcproj000066400000000000000000000046001216575753400226100ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/commfunc_test.vs2005.vcproj000066400000000000000000000044341216575753400235530ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/convcode_test.vcproj000066400000000000000000000046001216575753400226010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/convcode_test.vs2005.vcproj000066400000000000000000000044341216575753400235440ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/converters_test.vcproj000066400000000000000000000046061216575753400232010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/converters_test.vs2005.vcproj000066400000000000000000000044421216575753400241350ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/demapper_test.vcproj000066400000000000000000000044131216575753400226000ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/demapper_test.vcxproj000066400000000000000000000075031216575753400227730ustar00rootroot00000000000000 Release Win32 demapper_test {51E721EB-DBFD-4F64-8848-1F7055958DDD} array_test Win32Proj Application Unicode true <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)\..\bin\ $(ProjectName)_build\$(Configuration)\ false AllRules.ruleset ..\..;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;HAVE_MKL;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase itpp.lib;mkl_intel_c_dll.lib;mkl_core_dll.lib;mkl_intel_thread_dll.lib;%(AdditionalDependencies) ..\lib;$(LIB);%(AdditionalLibraryDirectories) uuid.lib;%(IgnoreSpecificDefaultLibraries) false Console true true false MachineX86 cd ..\bin $(ProjectName).exe > $(ProjectName).tmp fc /L $(ProjectName).tmp ..\..\tests\$(ProjectName).ref itpp-4.3.1/win32/itpp_mkl_tests/demapper_test.vs2005.vcproj000066400000000000000000000043641216575753400235430ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/det_test.vcproj000066400000000000000000000045611216575753400215630ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/det_test.vs2005.vcproj000066400000000000000000000044151216575753400225170ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/eigen_test.vcproj000066400000000000000000000045671216575753400221040ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/eigen_test.vs2005.vcproj000066400000000000000000000044231216575753400230310ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/error_count_test.vcproj000066400000000000000000000046111216575753400233440ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/error_count_test.vs2005.vcproj000066400000000000000000000044451216575753400243070ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/exit_test.vcproj000066400000000000000000000046011216575753400217530ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/exit_test.vs2005.vcproj000066400000000000000000000044351216575753400227160ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/fastica_test.vcproj000066400000000000000000000047301216575753400224170ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/fastica_test.vs2005.vcproj000066400000000000000000000045641216575753400233620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/fastmath_test.vcproj000066400000000000000000000046001216575753400226100ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/fastmath_test.vs2005.vcproj000066400000000000000000000044341216575753400235530ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/filter_design_test.vcproj000066400000000000000000000046171216575753400236270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/filter_design_test.vs2005.vcproj000066400000000000000000000044531216575753400245630ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/filter_test.vcproj000066400000000000000000000045721216575753400222760ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/filter_test.vs2005.vcproj000066400000000000000000000044261216575753400232320ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/fix_test.vcproj000066400000000000000000000045611216575753400215750ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/fix_test.vs2005.vcproj000066400000000000000000000044151216575753400225310ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/freq_filt_test.vcproj000066400000000000000000000046031216575753400227570ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/freq_filt_test.vs2005.vcproj000066400000000000000000000044371216575753400237220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/galois_test.vcproj000066400000000000000000000045721216575753400222670ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/galois_test.vs2005.vcproj000066400000000000000000000044261216575753400232230ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/gf2mat_test.vcproj000066400000000000000000000045721216575753400221710ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/gf2mat_test.vs2005.vcproj000066400000000000000000000044261216575753400231250ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/histogram_test.vcproj000066400000000000000000000046031216575753400230010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/histogram_test.vs2005.vcproj000066400000000000000000000044371216575753400237440ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/integration_test.vcproj000066400000000000000000000046111216575753400233260ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/integration_test.vs2005.vcproj000066400000000000000000000044451216575753400242710ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/interleaver_test.vcproj000066400000000000000000000046111216575753400233230ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/interleaver_test.vs2005.vcproj000066400000000000000000000044451216575753400242660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/inv_test.vcproj000066400000000000000000000045611216575753400216030ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/inv_test.vs2005.vcproj000066400000000000000000000044151216575753400225370ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/itfile_test.vcproj000066400000000000000000000046711216575753400222650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/itfile_test.vs2005.vcproj000066400000000000000000000045251216575753400232210ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/itpp_mkl_tests.sln000066400000000000000000000446341216575753400223070ustar00rootroot00000000000000Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "array_test", "array_test.vcxproj", "{DB816023-6103-4696-8A96-A08C611686D5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bch_test", "bch_test.vcxproj", "{4AF082AF-33FD-44F7-915D-7D9041BA51CC}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bessel_test", "bessel_test.vcxproj", "{CD5F15E7-9A8B-4541-B585-2278EC085ABE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blas_test", "blas_test.vcxproj", "{2EE0FBD8-8E13-45F8-AA1F-69166DBBC962}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "channel_test", "channel_test.vcxproj", "{459FB4C7-3296-45E5-AADF-FB70D3C1FB98}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cholesky_test", "cholesky_test.vcxproj", "{383F7A78-4B0D-464D-A74E-677DF2FE54B0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "circular_buffer_test", "circular_buffer_test.vcxproj", "{8C452E2A-3E2B-498C-83A0-02B7C8634C21}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commfunc_test", "commfunc_test.vcxproj", "{F41A4FE9-2A3F-416C-98B2-48F154759E36}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convcode_test", "convcode_test.vcxproj", "{9AC48C64-667C-4565-B5E8-40EB3953A210}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converters_test", "converters_test.vcxproj", "{171DD07C-D8D5-4785-BD41-FAF305418AFA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "det_test", "det_test.vcxproj", "{5F7CBB54-691A-41E9-B3E3-1729A0F27270}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eigen_test", "eigen_test.vcxproj", "{F72A58FD-0626-4EA0-A68D-55F9F1FA5C5F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_count_test", "error_count_test.vcxproj", "{7E3A017E-FCAB-4EC9-B2EC-79FE4B455DF1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastica_test", "fastica_test.vcxproj", "{4974EB00-48BF-41EA-A795-ED29E3BF3896}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastmath_test", "fastmath_test.vcxproj", "{3375DB59-41CA-4708-9AF5-E360B70B8599}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_design_test", "filter_design_test.vcxproj", "{13191F1F-2F16-4FCD-8D06-0CB27413C300}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_test", "filter_test.vcxproj", "{669B28CD-0202-420D-94C7-FB95971D6912}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fix_test", "fix_test.vcxproj", "{7DA783FE-ADA2-4F3C-8AA4-D24C180BFE7F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freq_filt_test", "freq_filt_test.vcxproj", "{83DFD33A-63D0-416A-85D2-A2F12B93CB8C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "galois_test", "galois_test.vcxproj", "{7BD0F563-5364-427F-B749-C09392C3B02E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gf2mat_test", "gf2mat_test.vcxproj", "{478CC216-BFAB-4EC5-8E49-497537148FD1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "histogram_test", "histogram_test.vcxproj", "{CD53C9A2-CEC1-4B62-8C5D-13C21D8036FA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "integration_test", "integration_test.vcxproj", "{0A804DD1-9018-4FB4-8836-ABC08A5D6BC8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interleaver_test", "interleaver_test.vcxproj", "{C95C619E-EF97-487F-B5B6-40C48A8BAC85}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inv_test", "inv_test.vcxproj", "{A2ED166B-55E2-40A8-B22B-BA483AB03B45}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itfile_test", "itfile_test.vcxproj", "{C638AD7F-77E6-4077-8873-D7E6F5E4980E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldpc_test", "ldpc_test.vcxproj", "{AB7856FC-ABED-431E-85BA-8D29C31ED85C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llr_test", "llr_test.vcxproj", "{FC63261F-53AA-409F-AC88-7527BAE5F359}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ls_solve_test", "ls_solve_test.vcxproj", "{082892A8-F8AF-42D9-9627-178240B94AA1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lu_test", "lu_test.vcxproj", "{9BE8FCAA-686D-4A74-BE8B-68A342DE3AF7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mat_test", "mat_test.vcxproj", "{058CEF60-2688-4FF1-8534-17F4D5759E0F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matfunc_test", "matfunc_test.vcxproj", "{B2A118C1-664D-470B-A55F-EC3006D837BA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_nd_test", "modulator_nd_test.vcxproj", "{B9A801F2-F606-4E00-B3F7-B48523048592}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_test", "modulator_test.vcxproj", "{24F91236-C5CF-4A80-97BE-40C6BAFBE98F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newton_search_test", "newton_search_test.vcxproj", "{A303E789-3E74-43D6-A280-446524E31A87}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parser_test", "parser_test.vcxproj", "{DFFA018C-C44C-4ECA-9686-85C8A796E670}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "poly_test", "poly_test.vcxproj", "{DF8E09E9-FCC6-4DDE-B7F8-5BC01A038B42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pulse_shape_test", "pulse_shape_test.vcxproj", "{D4224715-8E45-41A0-9001-F543D76E1C08}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qr_test", "qr_test.vcxproj", "{CD79906E-45B6-4FA2-9F66-B529CC1ED744}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rand_test", "rand_test.vcxproj", "{06DB2114-6A98-40D8-A415-A48BF7CEE41F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_syst_conv_code_test", "rec_syst_conv_code_test.vcxproj", "{77E8D358-0544-4E6F-A038-931617D2C3BC}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reedsolomon_test", "reedsolomon_test.vcxproj", "{539F9ADE-6993-4A16-89E0-1272EB64EA2F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schur_test", "schur_test.vcxproj", "{415F8FC5-400B-46AB-9F8F-7EBE9B1DCEE1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sigfun_test", "sigfun_test.vcxproj", "{0977E61F-2089-44A1-BB40-3260FC8CFFE5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sort_test", "sort_test.vcxproj", "{F41C6022-45E0-4DD6-8A5D-D3A3E6CADF1B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "source_test", "source_test.vcxproj", "{B5A5CB87-AAB0-4363-82E1-96AEE1BCD329}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparse_test", "sparse_test.vcxproj", "{CE73B853-7A40-4E84-8E4E-2F39839DDED9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stat_test", "stat_test.vcxproj", "{CF0535F0-5DB9-4BBF-8A22-49570159F726}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "svd_test", "svd_test.vcxproj", "{02FCB11F-9BF4-4A31-8B56-F5B4A51CF0C6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_test", "timer_test.vcxproj", "{EC03AB60-5DA1-404C-B64F-24C2E6AE6D02}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transforms_test", "transforms_test.vcxproj", "{220097AE-2157-43ED-B32E-88B7AD4900BE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turbo_test", "turbo_test.vcxproj", "{812223B3-B705-4810-AA6F-C99EF06C91E5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vec_test", "vec_test.vcxproj", "{8DBBC02B-B39B-4C2D-A649-765C9EA3D30C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window_test", "window_test.vcxproj", "{4626D22F-6C55-477B-B7AD-80299630DF74}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "specmat_test", "specmat_test.vcxproj", "{363A6A3B-3D91-43C8-A6EA-A274E4BC0A29}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exit_test", "exit_test.vcxproj", "{5C5A29CB-18C9-4B4A-8970-99C769BE49D8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "siso_test", "siso_test.vcxproj", "{CB20AE57-7D67-453E-A85C-522A8CA95E23}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linspace_test", "linspace_test.vcxproj", "{73073C92-1EC5-4962-BFB1-77E4C4604912}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stc_test", "stc_test.vcxproj", "{E1636C16-BFE5-492D-B64A-A5F4E1C832FE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demapper_test", "demapper_test.vcxproj", "{51E721EB-DBFD-4F64-8848-1F7055958DDD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DB816023-6103-4696-8A96-A08C611686D5}.Release|Win32.ActiveCfg = Release|Win32 {DB816023-6103-4696-8A96-A08C611686D5}.Release|Win32.Build.0 = Release|Win32 {4AF082AF-33FD-44F7-915D-7D9041BA51CC}.Release|Win32.ActiveCfg = Release|Win32 {4AF082AF-33FD-44F7-915D-7D9041BA51CC}.Release|Win32.Build.0 = Release|Win32 {CD5F15E7-9A8B-4541-B585-2278EC085ABE}.Release|Win32.ActiveCfg = Release|Win32 {CD5F15E7-9A8B-4541-B585-2278EC085ABE}.Release|Win32.Build.0 = Release|Win32 {2EE0FBD8-8E13-45F8-AA1F-69166DBBC962}.Release|Win32.ActiveCfg = Release|Win32 {2EE0FBD8-8E13-45F8-AA1F-69166DBBC962}.Release|Win32.Build.0 = Release|Win32 {459FB4C7-3296-45E5-AADF-FB70D3C1FB98}.Release|Win32.ActiveCfg = Release|Win32 {459FB4C7-3296-45E5-AADF-FB70D3C1FB98}.Release|Win32.Build.0 = Release|Win32 {383F7A78-4B0D-464D-A74E-677DF2FE54B0}.Release|Win32.ActiveCfg = Release|Win32 {383F7A78-4B0D-464D-A74E-677DF2FE54B0}.Release|Win32.Build.0 = Release|Win32 {8C452E2A-3E2B-498C-83A0-02B7C8634C21}.Release|Win32.ActiveCfg = Release|Win32 {8C452E2A-3E2B-498C-83A0-02B7C8634C21}.Release|Win32.Build.0 = Release|Win32 {F41A4FE9-2A3F-416C-98B2-48F154759E36}.Release|Win32.ActiveCfg = Release|Win32 {F41A4FE9-2A3F-416C-98B2-48F154759E36}.Release|Win32.Build.0 = Release|Win32 {9AC48C64-667C-4565-B5E8-40EB3953A210}.Release|Win32.ActiveCfg = Release|Win32 {9AC48C64-667C-4565-B5E8-40EB3953A210}.Release|Win32.Build.0 = Release|Win32 {171DD07C-D8D5-4785-BD41-FAF305418AFA}.Release|Win32.ActiveCfg = Release|Win32 {171DD07C-D8D5-4785-BD41-FAF305418AFA}.Release|Win32.Build.0 = Release|Win32 {5F7CBB54-691A-41E9-B3E3-1729A0F27270}.Release|Win32.ActiveCfg = Release|Win32 {5F7CBB54-691A-41E9-B3E3-1729A0F27270}.Release|Win32.Build.0 = Release|Win32 {F72A58FD-0626-4EA0-A68D-55F9F1FA5C5F}.Release|Win32.ActiveCfg = Release|Win32 {F72A58FD-0626-4EA0-A68D-55F9F1FA5C5F}.Release|Win32.Build.0 = Release|Win32 {7E3A017E-FCAB-4EC9-B2EC-79FE4B455DF1}.Release|Win32.ActiveCfg = Release|Win32 {7E3A017E-FCAB-4EC9-B2EC-79FE4B455DF1}.Release|Win32.Build.0 = Release|Win32 {4974EB00-48BF-41EA-A795-ED29E3BF3896}.Release|Win32.ActiveCfg = Release|Win32 {4974EB00-48BF-41EA-A795-ED29E3BF3896}.Release|Win32.Build.0 = Release|Win32 {3375DB59-41CA-4708-9AF5-E360B70B8599}.Release|Win32.ActiveCfg = Release|Win32 {3375DB59-41CA-4708-9AF5-E360B70B8599}.Release|Win32.Build.0 = Release|Win32 {13191F1F-2F16-4FCD-8D06-0CB27413C300}.Release|Win32.ActiveCfg = Release|Win32 {13191F1F-2F16-4FCD-8D06-0CB27413C300}.Release|Win32.Build.0 = Release|Win32 {669B28CD-0202-420D-94C7-FB95971D6912}.Release|Win32.ActiveCfg = Release|Win32 {669B28CD-0202-420D-94C7-FB95971D6912}.Release|Win32.Build.0 = Release|Win32 {7DA783FE-ADA2-4F3C-8AA4-D24C180BFE7F}.Release|Win32.ActiveCfg = Release|Win32 {7DA783FE-ADA2-4F3C-8AA4-D24C180BFE7F}.Release|Win32.Build.0 = Release|Win32 {83DFD33A-63D0-416A-85D2-A2F12B93CB8C}.Release|Win32.ActiveCfg = Release|Win32 {83DFD33A-63D0-416A-85D2-A2F12B93CB8C}.Release|Win32.Build.0 = Release|Win32 {7BD0F563-5364-427F-B749-C09392C3B02E}.Release|Win32.ActiveCfg = Release|Win32 {7BD0F563-5364-427F-B749-C09392C3B02E}.Release|Win32.Build.0 = Release|Win32 {478CC216-BFAB-4EC5-8E49-497537148FD1}.Release|Win32.ActiveCfg = Release|Win32 {478CC216-BFAB-4EC5-8E49-497537148FD1}.Release|Win32.Build.0 = Release|Win32 {CD53C9A2-CEC1-4B62-8C5D-13C21D8036FA}.Release|Win32.ActiveCfg = Release|Win32 {CD53C9A2-CEC1-4B62-8C5D-13C21D8036FA}.Release|Win32.Build.0 = Release|Win32 {0A804DD1-9018-4FB4-8836-ABC08A5D6BC8}.Release|Win32.ActiveCfg = Release|Win32 {0A804DD1-9018-4FB4-8836-ABC08A5D6BC8}.Release|Win32.Build.0 = Release|Win32 {C95C619E-EF97-487F-B5B6-40C48A8BAC85}.Release|Win32.ActiveCfg = Release|Win32 {C95C619E-EF97-487F-B5B6-40C48A8BAC85}.Release|Win32.Build.0 = Release|Win32 {A2ED166B-55E2-40A8-B22B-BA483AB03B45}.Release|Win32.ActiveCfg = Release|Win32 {A2ED166B-55E2-40A8-B22B-BA483AB03B45}.Release|Win32.Build.0 = Release|Win32 {C638AD7F-77E6-4077-8873-D7E6F5E4980E}.Release|Win32.ActiveCfg = Release|Win32 {C638AD7F-77E6-4077-8873-D7E6F5E4980E}.Release|Win32.Build.0 = Release|Win32 {AB7856FC-ABED-431E-85BA-8D29C31ED85C}.Release|Win32.ActiveCfg = Release|Win32 {AB7856FC-ABED-431E-85BA-8D29C31ED85C}.Release|Win32.Build.0 = Release|Win32 {FC63261F-53AA-409F-AC88-7527BAE5F359}.Release|Win32.ActiveCfg = Release|Win32 {FC63261F-53AA-409F-AC88-7527BAE5F359}.Release|Win32.Build.0 = Release|Win32 {082892A8-F8AF-42D9-9627-178240B94AA1}.Release|Win32.ActiveCfg = Release|Win32 {082892A8-F8AF-42D9-9627-178240B94AA1}.Release|Win32.Build.0 = Release|Win32 {9BE8FCAA-686D-4A74-BE8B-68A342DE3AF7}.Release|Win32.ActiveCfg = Release|Win32 {9BE8FCAA-686D-4A74-BE8B-68A342DE3AF7}.Release|Win32.Build.0 = Release|Win32 {058CEF60-2688-4FF1-8534-17F4D5759E0F}.Release|Win32.ActiveCfg = Release|Win32 {058CEF60-2688-4FF1-8534-17F4D5759E0F}.Release|Win32.Build.0 = Release|Win32 {B2A118C1-664D-470B-A55F-EC3006D837BA}.Release|Win32.ActiveCfg = Release|Win32 {B2A118C1-664D-470B-A55F-EC3006D837BA}.Release|Win32.Build.0 = Release|Win32 {B9A801F2-F606-4E00-B3F7-B48523048592}.Release|Win32.ActiveCfg = Release|Win32 {B9A801F2-F606-4E00-B3F7-B48523048592}.Release|Win32.Build.0 = Release|Win32 {24F91236-C5CF-4A80-97BE-40C6BAFBE98F}.Release|Win32.ActiveCfg = Release|Win32 {24F91236-C5CF-4A80-97BE-40C6BAFBE98F}.Release|Win32.Build.0 = Release|Win32 {A303E789-3E74-43D6-A280-446524E31A87}.Release|Win32.ActiveCfg = Release|Win32 {A303E789-3E74-43D6-A280-446524E31A87}.Release|Win32.Build.0 = Release|Win32 {DFFA018C-C44C-4ECA-9686-85C8A796E670}.Release|Win32.ActiveCfg = Release|Win32 {DFFA018C-C44C-4ECA-9686-85C8A796E670}.Release|Win32.Build.0 = Release|Win32 {DF8E09E9-FCC6-4DDE-B7F8-5BC01A038B42}.Release|Win32.ActiveCfg = Release|Win32 {DF8E09E9-FCC6-4DDE-B7F8-5BC01A038B42}.Release|Win32.Build.0 = Release|Win32 {D4224715-8E45-41A0-9001-F543D76E1C08}.Release|Win32.ActiveCfg = Release|Win32 {D4224715-8E45-41A0-9001-F543D76E1C08}.Release|Win32.Build.0 = Release|Win32 {CD79906E-45B6-4FA2-9F66-B529CC1ED744}.Release|Win32.ActiveCfg = Release|Win32 {CD79906E-45B6-4FA2-9F66-B529CC1ED744}.Release|Win32.Build.0 = Release|Win32 {06DB2114-6A98-40D8-A415-A48BF7CEE41F}.Release|Win32.ActiveCfg = Release|Win32 {06DB2114-6A98-40D8-A415-A48BF7CEE41F}.Release|Win32.Build.0 = Release|Win32 {77E8D358-0544-4E6F-A038-931617D2C3BC}.Release|Win32.ActiveCfg = Release|Win32 {77E8D358-0544-4E6F-A038-931617D2C3BC}.Release|Win32.Build.0 = Release|Win32 {539F9ADE-6993-4A16-89E0-1272EB64EA2F}.Release|Win32.ActiveCfg = Release|Win32 {539F9ADE-6993-4A16-89E0-1272EB64EA2F}.Release|Win32.Build.0 = Release|Win32 {415F8FC5-400B-46AB-9F8F-7EBE9B1DCEE1}.Release|Win32.ActiveCfg = Release|Win32 {415F8FC5-400B-46AB-9F8F-7EBE9B1DCEE1}.Release|Win32.Build.0 = Release|Win32 {0977E61F-2089-44A1-BB40-3260FC8CFFE5}.Release|Win32.ActiveCfg = Release|Win32 {0977E61F-2089-44A1-BB40-3260FC8CFFE5}.Release|Win32.Build.0 = Release|Win32 {F41C6022-45E0-4DD6-8A5D-D3A3E6CADF1B}.Release|Win32.ActiveCfg = Release|Win32 {F41C6022-45E0-4DD6-8A5D-D3A3E6CADF1B}.Release|Win32.Build.0 = Release|Win32 {B5A5CB87-AAB0-4363-82E1-96AEE1BCD329}.Release|Win32.ActiveCfg = Release|Win32 {B5A5CB87-AAB0-4363-82E1-96AEE1BCD329}.Release|Win32.Build.0 = Release|Win32 {CE73B853-7A40-4E84-8E4E-2F39839DDED9}.Release|Win32.ActiveCfg = Release|Win32 {CE73B853-7A40-4E84-8E4E-2F39839DDED9}.Release|Win32.Build.0 = Release|Win32 {CF0535F0-5DB9-4BBF-8A22-49570159F726}.Release|Win32.ActiveCfg = Release|Win32 {CF0535F0-5DB9-4BBF-8A22-49570159F726}.Release|Win32.Build.0 = Release|Win32 {02FCB11F-9BF4-4A31-8B56-F5B4A51CF0C6}.Release|Win32.ActiveCfg = Release|Win32 {02FCB11F-9BF4-4A31-8B56-F5B4A51CF0C6}.Release|Win32.Build.0 = Release|Win32 {EC03AB60-5DA1-404C-B64F-24C2E6AE6D02}.Release|Win32.ActiveCfg = Release|Win32 {EC03AB60-5DA1-404C-B64F-24C2E6AE6D02}.Release|Win32.Build.0 = Release|Win32 {220097AE-2157-43ED-B32E-88B7AD4900BE}.Release|Win32.ActiveCfg = Release|Win32 {220097AE-2157-43ED-B32E-88B7AD4900BE}.Release|Win32.Build.0 = Release|Win32 {812223B3-B705-4810-AA6F-C99EF06C91E5}.Release|Win32.ActiveCfg = Release|Win32 {812223B3-B705-4810-AA6F-C99EF06C91E5}.Release|Win32.Build.0 = Release|Win32 {8DBBC02B-B39B-4C2D-A649-765C9EA3D30C}.Release|Win32.ActiveCfg = Release|Win32 {8DBBC02B-B39B-4C2D-A649-765C9EA3D30C}.Release|Win32.Build.0 = Release|Win32 {4626D22F-6C55-477B-B7AD-80299630DF74}.Release|Win32.ActiveCfg = Release|Win32 {4626D22F-6C55-477B-B7AD-80299630DF74}.Release|Win32.Build.0 = Release|Win32 {363A6A3B-3D91-43C8-A6EA-A274E4BC0A29}.Release|Win32.ActiveCfg = Release|Win32 {363A6A3B-3D91-43C8-A6EA-A274E4BC0A29}.Release|Win32.Build.0 = Release|Win32 {5C5A29CB-18C9-4B4A-8970-99C769BE49D8}.Release|Win32.ActiveCfg = Release|Win32 {5C5A29CB-18C9-4B4A-8970-99C769BE49D8}.Release|Win32.Build.0 = Release|Win32 {CB20AE57-7D67-453E-A85C-522A8CA95E23}.Release|Win32.ActiveCfg = Release|Win32 {CB20AE57-7D67-453E-A85C-522A8CA95E23}.Release|Win32.Build.0 = Release|Win32 {73073C92-1EC5-4962-BFB1-77E4C4604912}.Release|Win32.ActiveCfg = Release|Win32 {73073C92-1EC5-4962-BFB1-77E4C4604912}.Release|Win32.Build.0 = Release|Win32 {E1636C16-BFE5-492D-B64A-A5F4E1C832FE}.Release|Win32.ActiveCfg = Release|Win32 {E1636C16-BFE5-492D-B64A-A5F4E1C832FE}.Release|Win32.Build.0 = Release|Win32 {51E721EB-DBFD-4F64-8848-1F7055958DDD}.Release|Win32.ActiveCfg = Release|Win32 {51E721EB-DBFD-4F64-8848-1F7055958DDD}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_mkl_tests/itpp_mkl_tests.vs2005.sln000066400000000000000000000450131216575753400232350ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "array_test", "array_test.vs2005.vcproj", "{DB816023-6103-4696-8A96-A08C611686D5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bch_test", "bch_test.vs2005.vcproj", "{4AF082AF-33FD-44F7-915D-7D9041BA51CC}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bessel_test", "bessel_test.vs2005.vcproj", "{CD5F15E7-9A8B-4541-B585-2278EC085ABE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blas_test", "blas_test.vs2005.vcproj", "{2EE0FBD8-8E13-45F8-AA1F-69166DBBC962}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "channel_test", "channel_test.vs2005.vcproj", "{459FB4C7-3296-45E5-AADF-FB70D3C1FB98}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cholesky_test", "cholesky_test.vs2005.vcproj", "{383F7A78-4B0D-464D-A74E-677DF2FE54B0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "circular_buffer_test", "circular_buffer_test.vs2005.vcproj", "{8C452E2A-3E2B-498C-83A0-02B7C8634C21}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commfunc_test", "commfunc_test.vs2005.vcproj", "{F41A4FE9-2A3F-416C-98B2-48F154759E36}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convcode_test", "convcode_test.vs2005.vcproj", "{9AC48C64-667C-4565-B5E8-40EB3953A210}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converters_test", "converters_test.vs2005.vcproj", "{171DD07C-D8D5-4785-BD41-FAF305418AFA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demapper_test", "demapper_test.vs2005.vcproj", "{7574FC04-A65C-4C57-AA75-C755D95E4097}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "det_test", "det_test.vs2005.vcproj", "{5F7CBB54-691A-41E9-B3E3-1729A0F27270}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eigen_test", "eigen_test.vs2005.vcproj", "{F72A58FD-0626-4EA0-A68D-55F9F1FA5C5F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_count_test", "error_count_test.vs2005.vcproj", "{7E3A017E-FCAB-4EC9-B2EC-79FE4B455DF1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exit_test", "exit_test.vs2005.vcproj", "{5C5A29CB-18C9-4B4A-8970-99C769BE49D8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastica_test", "fastica_test.vs2005.vcproj", "{4974EB00-48BF-41EA-A795-ED29E3BF3896}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastmath_test", "fastmath_test.vs2005.vcproj", "{3375DB59-41CA-4708-9AF5-E360B70B8599}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_design_test", "filter_design_test.vs2005.vcproj", "{13191F1F-2F16-4FCD-8D06-0CB27413C300}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fix_test", "fix_test.vs2005.vcproj", "{7DA783FE-ADA2-4F3C-8AA4-D24C180BFE7F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freq_filt_test", "freq_filt_test.vs2005.vcproj", "{83DFD33A-63D0-416A-85D2-A2F12B93CB8C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "galois_test", "galois_test.vs2005.vcproj", "{7BD0F563-5364-427F-B749-C09392C3B02E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gf2mat_test", "gf2mat_test.vs2005.vcproj", "{478CC216-BFAB-4EC5-8E49-497537148FD1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "histogram_test", "histogram_test.vs2005.vcproj", "{CD53C9A2-CEC1-4B62-8C5D-13C21D8036FA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "integration_test", "integration_test.vs2005.vcproj", "{0A804DD1-9018-4FB4-8836-ABC08A5D6BC8}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interleaver_test", "interleaver_test.vs2005.vcproj", "{C95C619E-EF97-487F-B5B6-40C48A8BAC85}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inv_test", "inv_test.vs2005.vcproj", "{A2ED166B-55E2-40A8-B22B-BA483AB03B45}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "itfile_test", "itfile_test.vs2005.vcproj", "{C638AD7F-77E6-4077-8873-D7E6F5E4980E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldpc_test", "ldpc_test.vs2005.vcproj", "{AB7856FC-ABED-431E-85BA-8D29C31ED85C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linspace_test", "linspace_test.vs2005.vcproj", "{782D8748-2FEB-4BEC-A643-C7CB93AA47B9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llr_test", "llr_test.vs2005.vcproj", "{FC63261F-53AA-409F-AC88-7527BAE5F359}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ls_solve_test", "ls_solve_test.vs2005.vcproj", "{082892A8-F8AF-42D9-9627-178240B94AA1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lu_test", "lu_test.vs2005.vcproj", "{9BE8FCAA-686D-4A74-BE8B-68A342DE3AF7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mat_test", "mat_test.vs2005.vcproj", "{058CEF60-2688-4FF1-8534-17F4D5759E0F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matfunc_test", "matfunc_test.vs2005.vcproj", "{B2A118C1-664D-470B-A55F-EC3006D837BA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_nd_test", "modulator_nd_test.vs2005.vcproj", "{B9A801F2-F606-4E00-B3F7-B48523048592}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modulator_test", "modulator_test.vs2005.vcproj", "{24F91236-C5CF-4A80-97BE-40C6BAFBE98F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newton_search_test", "newton_search_test.vs2005.vcproj", "{A303E789-3E74-43D6-A280-446524E31A87}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parser_test", "parser_test.vs2005.vcproj", "{DFFA018C-C44C-4ECA-9686-85C8A796E670}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "poly_test", "poly_test.vs2005.vcproj", "{DF8E09E9-FCC6-4DDE-B7F8-5BC01A038B42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pulse_shape_test", "pulse_shape_test.vs2005.vcproj", "{D4224715-8E45-41A0-9001-F543D76E1C08}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qr_test", "qr_test.vs2005.vcproj", "{CD79906E-45B6-4FA2-9F66-B529CC1ED744}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rand_test", "rand_test.vs2005.vcproj", "{06DB2114-6A98-40D8-A415-A48BF7CEE41F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_syst_conv_code_test", "rec_syst_conv_code_test.vs2005.vcproj", "{77E8D358-0544-4E6F-A038-931617D2C3BC}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reedsolomon_test", "reedsolomon_test.vs2005.vcproj", "{539F9ADE-6993-4A16-89E0-1272EB64EA2F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schur_test", "schur_test.vs2005.vcproj", "{415F8FC5-400B-46AB-9F8F-7EBE9B1DCEE1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sigfun_test", "sigfun_test.vs2005.vcproj", "{0977E61F-2089-44A1-BB40-3260FC8CFFE5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "siso_test", "siso_test.vs2005.vcproj", "{CB20AE57-7D67-453E-A85C-522A8CA95E23}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sort_test", "sort_test.vs2005.vcproj", "{F41C6022-45E0-4DD6-8A5D-D3A3E6CADF1B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparse_test", "sparse_test.vs2005.vcproj", "{CE73B853-7A40-4E84-8E4E-2F39839DDED9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "source_test", "source_test.vs2005.vcproj", "{B5A5CB87-AAB0-4363-82E1-96AEE1BCD329}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "specmat_test", "specmat_test.vs2005.vcproj", "{363A6A3B-3D91-43C8-A6EA-A274E4BC0A29}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stat_test", "stat_test.vs2005.vcproj", "{CF0535F0-5DB9-4BBF-8A22-49570159F726}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stc_test", "stc_test.vs2005.vcproj", "{C8A509B5-2DC8-4D1B-80F3-5FB13F1ADC21}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "svd_test", "svd_test.vs2005.vcproj", "{02FCB11F-9BF4-4A31-8B56-F5B4A51CF0C6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_test", "timer_test.vs2005.vcproj", "{EC03AB60-5DA1-404C-B64F-24C2E6AE6D02}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transforms_test", "transforms_test.vs2005.vcproj", "{220097AE-2157-43ED-B32E-88B7AD4900BE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turbo_test", "turbo_test.vs2005.vcproj", "{812223B3-B705-4810-AA6F-C99EF06C91E5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vec_test", "vec_test.vs2005.vcproj", "{8DBBC02B-B39B-4C2D-A649-765C9EA3D30C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window_test", "window_test.vs2005.vcproj", "{4626D22F-6C55-477B-B7AD-80299630DF74}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter_test", "filter_test.vs2005.vcproj", "{669B28CD-0202-420D-94C7-FB95971D6912}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DB816023-6103-4696-8A96-A08C611686D5}.Release|Win32.ActiveCfg = Release|Win32 {DB816023-6103-4696-8A96-A08C611686D5}.Release|Win32.Build.0 = Release|Win32 {4AF082AF-33FD-44F7-915D-7D9041BA51CC}.Release|Win32.ActiveCfg = Release|Win32 {4AF082AF-33FD-44F7-915D-7D9041BA51CC}.Release|Win32.Build.0 = Release|Win32 {CD5F15E7-9A8B-4541-B585-2278EC085ABE}.Release|Win32.ActiveCfg = Release|Win32 {CD5F15E7-9A8B-4541-B585-2278EC085ABE}.Release|Win32.Build.0 = Release|Win32 {2EE0FBD8-8E13-45F8-AA1F-69166DBBC962}.Release|Win32.ActiveCfg = Release|Win32 {2EE0FBD8-8E13-45F8-AA1F-69166DBBC962}.Release|Win32.Build.0 = Release|Win32 {459FB4C7-3296-45E5-AADF-FB70D3C1FB98}.Release|Win32.ActiveCfg = Release|Win32 {459FB4C7-3296-45E5-AADF-FB70D3C1FB98}.Release|Win32.Build.0 = Release|Win32 {383F7A78-4B0D-464D-A74E-677DF2FE54B0}.Release|Win32.ActiveCfg = Release|Win32 {383F7A78-4B0D-464D-A74E-677DF2FE54B0}.Release|Win32.Build.0 = Release|Win32 {8C452E2A-3E2B-498C-83A0-02B7C8634C21}.Release|Win32.ActiveCfg = Release|Win32 {8C452E2A-3E2B-498C-83A0-02B7C8634C21}.Release|Win32.Build.0 = Release|Win32 {F41A4FE9-2A3F-416C-98B2-48F154759E36}.Release|Win32.ActiveCfg = Release|Win32 {F41A4FE9-2A3F-416C-98B2-48F154759E36}.Release|Win32.Build.0 = Release|Win32 {9AC48C64-667C-4565-B5E8-40EB3953A210}.Release|Win32.ActiveCfg = Release|Win32 {9AC48C64-667C-4565-B5E8-40EB3953A210}.Release|Win32.Build.0 = Release|Win32 {171DD07C-D8D5-4785-BD41-FAF305418AFA}.Release|Win32.ActiveCfg = Release|Win32 {171DD07C-D8D5-4785-BD41-FAF305418AFA}.Release|Win32.Build.0 = Release|Win32 {7574FC04-A65C-4C57-AA75-C755D95E4097}.Release|Win32.ActiveCfg = Release|Win32 {7574FC04-A65C-4C57-AA75-C755D95E4097}.Release|Win32.Build.0 = Release|Win32 {5F7CBB54-691A-41E9-B3E3-1729A0F27270}.Release|Win32.ActiveCfg = Release|Win32 {5F7CBB54-691A-41E9-B3E3-1729A0F27270}.Release|Win32.Build.0 = Release|Win32 {F72A58FD-0626-4EA0-A68D-55F9F1FA5C5F}.Release|Win32.ActiveCfg = Release|Win32 {F72A58FD-0626-4EA0-A68D-55F9F1FA5C5F}.Release|Win32.Build.0 = Release|Win32 {7E3A017E-FCAB-4EC9-B2EC-79FE4B455DF1}.Release|Win32.ActiveCfg = Release|Win32 {7E3A017E-FCAB-4EC9-B2EC-79FE4B455DF1}.Release|Win32.Build.0 = Release|Win32 {5C5A29CB-18C9-4B4A-8970-99C769BE49D8}.Release|Win32.ActiveCfg = Release|Win32 {5C5A29CB-18C9-4B4A-8970-99C769BE49D8}.Release|Win32.Build.0 = Release|Win32 {4974EB00-48BF-41EA-A795-ED29E3BF3896}.Release|Win32.ActiveCfg = Release|Win32 {4974EB00-48BF-41EA-A795-ED29E3BF3896}.Release|Win32.Build.0 = Release|Win32 {3375DB59-41CA-4708-9AF5-E360B70B8599}.Release|Win32.ActiveCfg = Release|Win32 {3375DB59-41CA-4708-9AF5-E360B70B8599}.Release|Win32.Build.0 = Release|Win32 {13191F1F-2F16-4FCD-8D06-0CB27413C300}.Release|Win32.ActiveCfg = Release|Win32 {13191F1F-2F16-4FCD-8D06-0CB27413C300}.Release|Win32.Build.0 = Release|Win32 {7DA783FE-ADA2-4F3C-8AA4-D24C180BFE7F}.Release|Win32.ActiveCfg = Release|Win32 {7DA783FE-ADA2-4F3C-8AA4-D24C180BFE7F}.Release|Win32.Build.0 = Release|Win32 {83DFD33A-63D0-416A-85D2-A2F12B93CB8C}.Release|Win32.ActiveCfg = Release|Win32 {83DFD33A-63D0-416A-85D2-A2F12B93CB8C}.Release|Win32.Build.0 = Release|Win32 {7BD0F563-5364-427F-B749-C09392C3B02E}.Release|Win32.ActiveCfg = Release|Win32 {7BD0F563-5364-427F-B749-C09392C3B02E}.Release|Win32.Build.0 = Release|Win32 {478CC216-BFAB-4EC5-8E49-497537148FD1}.Release|Win32.ActiveCfg = Release|Win32 {478CC216-BFAB-4EC5-8E49-497537148FD1}.Release|Win32.Build.0 = Release|Win32 {CD53C9A2-CEC1-4B62-8C5D-13C21D8036FA}.Release|Win32.ActiveCfg = Release|Win32 {CD53C9A2-CEC1-4B62-8C5D-13C21D8036FA}.Release|Win32.Build.0 = Release|Win32 {0A804DD1-9018-4FB4-8836-ABC08A5D6BC8}.Release|Win32.ActiveCfg = Release|Win32 {0A804DD1-9018-4FB4-8836-ABC08A5D6BC8}.Release|Win32.Build.0 = Release|Win32 {C95C619E-EF97-487F-B5B6-40C48A8BAC85}.Release|Win32.ActiveCfg = Release|Win32 {C95C619E-EF97-487F-B5B6-40C48A8BAC85}.Release|Win32.Build.0 = Release|Win32 {A2ED166B-55E2-40A8-B22B-BA483AB03B45}.Release|Win32.ActiveCfg = Release|Win32 {A2ED166B-55E2-40A8-B22B-BA483AB03B45}.Release|Win32.Build.0 = Release|Win32 {C638AD7F-77E6-4077-8873-D7E6F5E4980E}.Release|Win32.ActiveCfg = Release|Win32 {C638AD7F-77E6-4077-8873-D7E6F5E4980E}.Release|Win32.Build.0 = Release|Win32 {AB7856FC-ABED-431E-85BA-8D29C31ED85C}.Release|Win32.ActiveCfg = Release|Win32 {AB7856FC-ABED-431E-85BA-8D29C31ED85C}.Release|Win32.Build.0 = Release|Win32 {782D8748-2FEB-4BEC-A643-C7CB93AA47B9}.Release|Win32.ActiveCfg = Release|Win32 {782D8748-2FEB-4BEC-A643-C7CB93AA47B9}.Release|Win32.Build.0 = Release|Win32 {FC63261F-53AA-409F-AC88-7527BAE5F359}.Release|Win32.ActiveCfg = Release|Win32 {FC63261F-53AA-409F-AC88-7527BAE5F359}.Release|Win32.Build.0 = Release|Win32 {082892A8-F8AF-42D9-9627-178240B94AA1}.Release|Win32.ActiveCfg = Release|Win32 {082892A8-F8AF-42D9-9627-178240B94AA1}.Release|Win32.Build.0 = Release|Win32 {9BE8FCAA-686D-4A74-BE8B-68A342DE3AF7}.Release|Win32.ActiveCfg = Release|Win32 {9BE8FCAA-686D-4A74-BE8B-68A342DE3AF7}.Release|Win32.Build.0 = Release|Win32 {058CEF60-2688-4FF1-8534-17F4D5759E0F}.Release|Win32.ActiveCfg = Release|Win32 {058CEF60-2688-4FF1-8534-17F4D5759E0F}.Release|Win32.Build.0 = Release|Win32 {B2A118C1-664D-470B-A55F-EC3006D837BA}.Release|Win32.ActiveCfg = Release|Win32 {B2A118C1-664D-470B-A55F-EC3006D837BA}.Release|Win32.Build.0 = Release|Win32 {B9A801F2-F606-4E00-B3F7-B48523048592}.Release|Win32.ActiveCfg = Release|Win32 {B9A801F2-F606-4E00-B3F7-B48523048592}.Release|Win32.Build.0 = Release|Win32 {24F91236-C5CF-4A80-97BE-40C6BAFBE98F}.Release|Win32.ActiveCfg = Release|Win32 {24F91236-C5CF-4A80-97BE-40C6BAFBE98F}.Release|Win32.Build.0 = Release|Win32 {A303E789-3E74-43D6-A280-446524E31A87}.Release|Win32.ActiveCfg = Release|Win32 {A303E789-3E74-43D6-A280-446524E31A87}.Release|Win32.Build.0 = Release|Win32 {DFFA018C-C44C-4ECA-9686-85C8A796E670}.Release|Win32.ActiveCfg = Release|Win32 {DFFA018C-C44C-4ECA-9686-85C8A796E670}.Release|Win32.Build.0 = Release|Win32 {DF8E09E9-FCC6-4DDE-B7F8-5BC01A038B42}.Release|Win32.ActiveCfg = Release|Win32 {DF8E09E9-FCC6-4DDE-B7F8-5BC01A038B42}.Release|Win32.Build.0 = Release|Win32 {D4224715-8E45-41A0-9001-F543D76E1C08}.Release|Win32.ActiveCfg = Release|Win32 {D4224715-8E45-41A0-9001-F543D76E1C08}.Release|Win32.Build.0 = Release|Win32 {CD79906E-45B6-4FA2-9F66-B529CC1ED744}.Release|Win32.ActiveCfg = Release|Win32 {CD79906E-45B6-4FA2-9F66-B529CC1ED744}.Release|Win32.Build.0 = Release|Win32 {06DB2114-6A98-40D8-A415-A48BF7CEE41F}.Release|Win32.ActiveCfg = Release|Win32 {06DB2114-6A98-40D8-A415-A48BF7CEE41F}.Release|Win32.Build.0 = Release|Win32 {77E8D358-0544-4E6F-A038-931617D2C3BC}.Release|Win32.ActiveCfg = Release|Win32 {77E8D358-0544-4E6F-A038-931617D2C3BC}.Release|Win32.Build.0 = Release|Win32 {539F9ADE-6993-4A16-89E0-1272EB64EA2F}.Release|Win32.ActiveCfg = Release|Win32 {539F9ADE-6993-4A16-89E0-1272EB64EA2F}.Release|Win32.Build.0 = Release|Win32 {415F8FC5-400B-46AB-9F8F-7EBE9B1DCEE1}.Release|Win32.ActiveCfg = Release|Win32 {415F8FC5-400B-46AB-9F8F-7EBE9B1DCEE1}.Release|Win32.Build.0 = Release|Win32 {0977E61F-2089-44A1-BB40-3260FC8CFFE5}.Release|Win32.ActiveCfg = Release|Win32 {0977E61F-2089-44A1-BB40-3260FC8CFFE5}.Release|Win32.Build.0 = Release|Win32 {CB20AE57-7D67-453E-A85C-522A8CA95E23}.Release|Win32.ActiveCfg = Release|Win32 {CB20AE57-7D67-453E-A85C-522A8CA95E23}.Release|Win32.Build.0 = Release|Win32 {F41C6022-45E0-4DD6-8A5D-D3A3E6CADF1B}.Release|Win32.ActiveCfg = Release|Win32 {F41C6022-45E0-4DD6-8A5D-D3A3E6CADF1B}.Release|Win32.Build.0 = Release|Win32 {CE73B853-7A40-4E84-8E4E-2F39839DDED9}.Release|Win32.ActiveCfg = Release|Win32 {CE73B853-7A40-4E84-8E4E-2F39839DDED9}.Release|Win32.Build.0 = Release|Win32 {B5A5CB87-AAB0-4363-82E1-96AEE1BCD329}.Release|Win32.ActiveCfg = Release|Win32 {B5A5CB87-AAB0-4363-82E1-96AEE1BCD329}.Release|Win32.Build.0 = Release|Win32 {363A6A3B-3D91-43C8-A6EA-A274E4BC0A29}.Release|Win32.ActiveCfg = Release|Win32 {363A6A3B-3D91-43C8-A6EA-A274E4BC0A29}.Release|Win32.Build.0 = Release|Win32 {CF0535F0-5DB9-4BBF-8A22-49570159F726}.Release|Win32.ActiveCfg = Release|Win32 {CF0535F0-5DB9-4BBF-8A22-49570159F726}.Release|Win32.Build.0 = Release|Win32 {C8A509B5-2DC8-4D1B-80F3-5FB13F1ADC21}.Release|Win32.ActiveCfg = Release|Win32 {C8A509B5-2DC8-4D1B-80F3-5FB13F1ADC21}.Release|Win32.Build.0 = Release|Win32 {02FCB11F-9BF4-4A31-8B56-F5B4A51CF0C6}.Release|Win32.ActiveCfg = Release|Win32 {02FCB11F-9BF4-4A31-8B56-F5B4A51CF0C6}.Release|Win32.Build.0 = Release|Win32 {EC03AB60-5DA1-404C-B64F-24C2E6AE6D02}.Release|Win32.ActiveCfg = Release|Win32 {EC03AB60-5DA1-404C-B64F-24C2E6AE6D02}.Release|Win32.Build.0 = Release|Win32 {220097AE-2157-43ED-B32E-88B7AD4900BE}.Release|Win32.ActiveCfg = Release|Win32 {220097AE-2157-43ED-B32E-88B7AD4900BE}.Release|Win32.Build.0 = Release|Win32 {812223B3-B705-4810-AA6F-C99EF06C91E5}.Release|Win32.ActiveCfg = Release|Win32 {812223B3-B705-4810-AA6F-C99EF06C91E5}.Release|Win32.Build.0 = Release|Win32 {8DBBC02B-B39B-4C2D-A649-765C9EA3D30C}.Release|Win32.ActiveCfg = Release|Win32 {8DBBC02B-B39B-4C2D-A649-765C9EA3D30C}.Release|Win32.Build.0 = Release|Win32 {4626D22F-6C55-477B-B7AD-80299630DF74}.Release|Win32.ActiveCfg = Release|Win32 {4626D22F-6C55-477B-B7AD-80299630DF74}.Release|Win32.Build.0 = Release|Win32 {669B28CD-0202-420D-94C7-FB95971D6912}.Release|Win32.ActiveCfg = Release|Win32 {669B28CD-0202-420D-94C7-FB95971D6912}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal itpp-4.3.1/win32/itpp_mkl_tests/ldpc_test.vcproj000066400000000000000000000045641216575753400217340ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/ldpc_test.vs2005.vcproj000066400000000000000000000044201216575753400226610ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/linspace_test.vcproj000066400000000000000000000046001216575753400225770ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/linspace_test.vs2005.vcproj000066400000000000000000000043671216575753400235470ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/llr_test.vcproj000066400000000000000000000045611216575753400216000ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/llr_test.vs2005.vcproj000066400000000000000000000044151216575753400225340ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/ls_solve_test.vcproj000066400000000000000000000046001216575753400226270ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/ls_solve_test.vs2005.vcproj000066400000000000000000000044341216575753400235720ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/lu_test.vcproj000066400000000000000000000045561216575753400214330ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/lu_test.vs2005.vcproj000066400000000000000000000044121216575753400223600ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/mat_test.vcproj000066400000000000000000000045611216575753400215700ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/mat_test.vs2005.vcproj000066400000000000000000000044151216575753400225240ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/matfunc_test.vcproj000066400000000000000000000045751216575753400224510ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/matfunc_test.vs2005.vcproj000066400000000000000000000044311216575753400233760ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/modulator_nd_test.vcproj000066400000000000000000000046141216575753400234750ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/modulator_nd_test.vs2005.vcproj000066400000000000000000000044501216575753400244310ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/modulator_test.vcproj000066400000000000000000000046031216575753400230120ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/modulator_test.vs2005.vcproj000066400000000000000000000044371216575753400237550ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/newton_search_test.vcproj000066400000000000000000000046171216575753400236500ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/newton_search_test.vs2005.vcproj000066400000000000000000000044531216575753400246040ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/parser_test.vcproj000066400000000000000000000046721216575753400223060ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/parser_test.vs2005.vcproj000066400000000000000000000045261216575753400232420ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/poly_test.vcproj000066400000000000000000000045641216575753400217750ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/poly_test.vs2005.vcproj000066400000000000000000000044201216575753400227220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/pulse_shape_test.vcproj000066400000000000000000000046111216575753400233130ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/pulse_shape_test.vs2005.vcproj000066400000000000000000000044451216575753400242560ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/qr_test.vcproj000066400000000000000000000045561216575753400214350ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/qr_test.vs2005.vcproj000066400000000000000000000044121216575753400223620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/rand_test.vcproj000066400000000000000000000045641216575753400217360ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/rand_test.vs2005.vcproj000066400000000000000000000044201216575753400226630ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/rec_syst_conv_code_test.vcproj000066400000000000000000000046361216575753400246640ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/rec_syst_conv_code_test.vs2005.vcproj000066400000000000000000000044721216575753400256200ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/reedsolomon_test.vcproj000066400000000000000000000046111216575753400233310ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/reedsolomon_test.vs2005.vcproj000066400000000000000000000044451216575753400242740ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/schur_test.vcproj000066400000000000000000000045671216575753400221410ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/schur_test.vs2005.vcproj000066400000000000000000000044231216575753400230660ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/sigfun_test.vcproj000066400000000000000000000045721216575753400223040ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/sigfun_test.vs2005.vcproj000066400000000000000000000044261216575753400232400ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/siso_test.vcproj000066400000000000000000000046011216575753400217570ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/siso_test.vs2005.vcproj000066400000000000000000000044351216575753400227220ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/sort_test.vcproj000066400000000000000000000045641216575753400220010ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/sort_test.vs2005.vcproj000066400000000000000000000044201216575753400227260ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/source_test.vcproj000066400000000000000000000045721216575753400223110ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/source_test.vs2005.vcproj000066400000000000000000000044261216575753400232450ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/sparse_test.vcproj000066400000000000000000000045721216575753400223060ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/sparse_test.vs2005.vcproj000066400000000000000000000044261216575753400232420ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/specmat_test.vcproj000066400000000000000000000045751216575753400224500ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/specmat_test.vs2005.vcproj000066400000000000000000000044311216575753400233750ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/stat_test.vcproj000066400000000000000000000045641216575753400217650ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/stat_test.vs2005.vcproj000066400000000000000000000044201216575753400227120ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/stc_test.vcproj000066400000000000000000000045611216575753400216000ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/stc_test.vs2005.vcproj000066400000000000000000000043501216575753400225320ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/svd_test.vcproj000066400000000000000000000045611216575753400216030ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/svd_test.vs2005.vcproj000066400000000000000000000044151216575753400225370ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/timer_test.vcproj000066400000000000000000000045671216575753400221350ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/timer_test.vs2005.vcproj000066400000000000000000000044231216575753400230620ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/transforms_test.vcproj000066400000000000000000000046061216575753400232050ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/transforms_test.vs2005.vcproj000066400000000000000000000044421216575753400241410ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/turbo_test.vcproj000066400000000000000000000045671216575753400221500ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/turbo_test.vs2005.vcproj000066400000000000000000000044231216575753400230750ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/vec_test.vcproj000066400000000000000000000045611216575753400215640ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/vec_test.vs2005.vcproj000066400000000000000000000044151216575753400225200ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/window_test.vcproj000066400000000000000000000045721216575753400223200ustar00rootroot00000000000000 itpp-4.3.1/win32/itpp_mkl_tests/window_test.vs2005.vcproj000066400000000000000000000044261216575753400232540ustar00rootroot00000000000000