sparsersb-1.0.5/0000755000000000000000000000000013066547510011716 5ustar0000000000000000sparsersb-1.0.5/COPYING0000644000000000000000000010451313066547510012755 0ustar0000000000000000 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 . sparsersb-1.0.5/DESCRIPTION0000644000000000000000000000103413066547510013422 0ustar0000000000000000Name: sparsersb Version: 1.0.5 Date: 2017-03-29 Author: Michele Martone Maintainer: Michele Martone Title: Interface to the librsb package implementing the RSB sparse matrix format. Description: Interface to the librsb package implementing the RSB sparse matrix format for fast shared-memory sparse matrix computations. Depends: octave (>= 4.0.0) License: GPLv3+ Url: http://librsb.sourceforge.net/ Categories: Sparse Matrix Computations BuildRequires: librsb sparsersb-1.0.5/INDEX0000644000000000000000000000015413066547510012510 0ustar0000000000000000sparsersb >> Interface to the librsb package implementing the RSB sparse matrix format. Support sparsersb sparsersb-1.0.5/NEWS0000644000000000000000000000442313066547510012420 0ustar0000000000000000Summary of important user-visible changes for releases of the sparsersb package =============================================================================== sparsersb-1.0.5 Release Date: 2017-03-29 =============================================================================== ** Intended to be used with the latest librsb-1.2.0. ** - tests won't use quit(): might emit exception according to bug #49271 =============================================================================== sparsersb-1.0.4 Release Date: 2017-03-25 =============================================================================== ** Intended to be used with the latest librsb-1.2.0. ** - test script now uses ilu() instead of obsolete luinc() =============================================================================== sparsersb-1.0.3 Release Date: 2017-03-24 =============================================================================== ** Intended to be used with the latest librsb-1.2.0. ** - "symmetric" RSB representation supported ** - improved documentation (including a few typos) ** - improved demos (demo sparsersb) ** - improved tests (test sparsersb) ** - improved error messages =============================================================================== sparsersb-1.0.2 Release Date: 2016-10-03 =============================================================================== ** Intended to be used with the latest librsb-1.2.0. ** - builds even if octave built with --enable-64, but limited to matrices ** which would fit when using a normal setup. =============================================================================== sparsersb-1.0.1 Release Date: 2016-08-01 =============================================================================== ** Intended to be used with the latest librsb-1.2.0. ** Changed sparsersb's `configure --help': ** - options to build librsb from a tarball (via configure or LIBRSB_TARBALL) ** - options to use librsb-config ** - options to override librsb-config ** - you can override the default C++11 flag =============================================================================== sparsersb-1.0.0 Release Date: 2015-05-31 =============================================================================== ** First Packaged Release. Intended to work with librsb-1.2. sparsersb-1.0.5/bin/0000755000000000000000000000000013066547510012466 5ustar0000000000000000sparsersb-1.0.5/bin/demo_sparsersb.m0000755000000000000000000001330313066547510015657 0ustar0000000000000000# # Copyright (C) 2011-2017 Michele Martone # # 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 . # if length(getenv("SPARSERSB_TEST")) == 0 ; pkg load sparsersb ; end disp " ***********************************************************************" disp "** A usage example of sparsersb. **" disp "** A case large enough for 'sparsersb' to likely outperform 'sparse'. **" disp "** p.s.: Invoke 'demo sparsersb' to get just a first working overview. **" disp " ***********************************************************************" bs=100; # block size bo=10; # block overlap bc=700; # block count # bs=2; # block size # bo=1; # block overlap # bc=2; # block count nr=bs+(bc-1)*(bs-bo); nc=nr; disp "Constructing coefficients for a sparse diagonal blocks matrix." printf ("Will use %d blocks each wide %d and overlapping %d.\n", bc, bs, bo); ai=[]; aj=[]; av=[]; for i=1:bc # randomly generate block thr=0.3; b=rand(bs)+bc*eye(bs); b=b+b'; [bi,bj,bv]=find(b>thr); io=(i-1)*(bs-bo); # i offset jo=(i-1)*(bs-bo); # j offset ai=[ai;bi+io]; aj=[aj;bj+jo]; av=[av;bv ]; endfor nz=length(av); printf ("Obtained %.3e nonzeroes in a %d x %d matrix, average %.1e nonzeroes/row. \n", nz, nr, nc, nz/nr ); disp "Assembling a 'sparse' matrix..." tic; ao=sparse(ai,aj,av); printf ("Assembled 'sparse' in %.1es.\n", toc); disp "Assembling a 'sparsersb' matrix..." tic; ar=sparsersb(ai,aj,av); nsb=str2num(sparsersb(ar,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); printf ("Assembled 'sparsersb' in %.1es (%d RSB blocks).\n", toc, nsb); # Uncomment to get more information: # printf ("RSB matrix specific info: %s.\n", ds=sparsersb(ar,"get")); # Uncomment the following to render the RSB blocks structure to a file. # sparsersb(ar,"render","demo_sparsersb_matrix.eps") maxt=4; nrhs=1; x=ones(nc,nrhs); y=ones(nr,nrhs); disp " ** Testing matrix-vector multiplication ********************************" disp "Benchmarking 'sparse' matrix-vector multiply..." nt=0;tic; while (toc < maxt) nt++;y+=ao*x; end ot=dt=toc;ot/=nt; printf ("Performed %8d 'sparse' matrix-vector multiplications in %.1es, %.2es each on average.\n", nt, dt, ot); disp "Benchmarking 'sparsersb' matrix-vector multiply..." nt=0;tic; while (toc < maxt) nt++;y+=ar*x; end rt=dt=toc;rt/=nt; printf ("Performed %8d 'sparsersb' matrix-vector multiplications in %.1es, %.2es each on average.\n", nt, dt, rt); printf ("So 'sparsersb' is %.2ex times as fast as 'sparse'.\n", ot/rt); disp "Attempting autotuning 'sparsersb' matrix..." tic; tr=sparsersb(ar,"autotune","n",nrhs); nnb=str2num(sparsersb(tr,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); dt=toc; if ( nnb != nsb ) printf ("Performed autotuning in %.2es (%d -> %d RSB blocks).\n", dt, nsb, nnb); # Uncomment to get more information: # printf ("RSB matrix specific info: %s.\n", ds=sparsersb(tr,"get")); disp "Benchmarking 'sparsersb' matrix-matrix multiply..." nt=0;tic; while (toc < maxt) nt++;y+=ar*x; end rt=dt=toc;rt/=nt; printf ("Performed %8d 'sparsersb' matrix-vector multiplications in %.1es, %.2es each on average.\n", nt, dt, rt); printf ("So 'sparsersb' is %.2ex times as fast as 'sparse'.\n", ot/rt); else printf ("Autotuning procedure did not change the matrix.\n", dt, nsb, nnb); end disp " ** Testing matrix-matrix multiplication (rhs matrix is multi-vector) ***" nrhs=5; x=ones(nc,nrhs); y=ones(nr,nrhs); disp "Benchmarking 'sparse' matrix-matrix multiply..." nt=0;tic; while (toc < maxt) nt++;y+=ao*x; end ot=dt=toc;ot/=nt; printf ("Performed %8d 'sparse' matrix-matrix multiplications in %.1es, %.2es each on average.\n", nt, dt, ot); disp "Benchmarking 'sparsersb' matrix-matrix multiply..." nt=0;tic; while (toc < maxt) nt++;y+=ar*x; end rt=dt=toc;rt/=nt; printf ("Performed %8d 'sparsersb' matrix-matrix multiplications in %.1es, %.2es each on average.\n", nt, dt, rt); printf ("So 'sparsersb' is %.2ex times as fast as 'sparse'.\n", ot/rt); disp "Attempting autotuning 'sparsersb' matrix..." tic; tr=sparsersb(ar,"autotune","n",nrhs); nnb=str2num(sparsersb(tr,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); dt=toc; if ( nnb != nsb ) printf ("Performed autotuning in %.2es (%d -> %d RSB blocks).\n", dt, nsb, nnb); # Uncomment to get more information: # printf ("RSB matrix specific info: %s.\n", ds=sparsersb(tr,"get")); disp "Benchmarking 'sparsersb' matrix-matrix multiply..." nt=0;tic; while (toc < maxt) nt++;y+=ar*x; end rt=dt=toc;rt/=nt; printf ("Performed %8d 'sparsersb' matrix-matrix multiplications in %.1es, %.2es each on average.\n", nt, dt, rt); printf ("So 'sparsersb' is %.2ex times as fast as 'sparse'.\n", ot/rt); else printf ("Autotuning procedure did not change the matrix.\n", dt, nsb, nnb); end disp " ***********************************************************************" disp "** You can adapt this benchmark to test your matrices so to check if **" disp "** they get multiplied faster with 'sparsersb' than with 'sparse'. **" disp " ***********************************************************************" sparsersb-1.0.5/bin/lsbench.m0000644000000000000000000000723113066547510014265 0ustar0000000000000000# # Copyright (C) 2011-2017 Michele Martone # # 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 . # # # Linear Solvers benchmark demos using sparsersb. # # TODO: this file shall host some linear system solution benchmarks using sparsersb. # It may serve as a reference point when profiling sparsersb/librsb. # Please note that sparsersb is optimized for large matrices. # 1; # This is a script disp " ***********************************************************************" disp "** Usage example of sparsersb solving linear systems with GMRES. **" disp "** Matrices large enough for 'sparsersb' to likely outperform 'sparse'.**" disp "** p.s.: Invoke 'demo sparsersb' to get just a first working overview. **" disp " ***********************************************************************" function lsb_compare(A) n=rows(A); maxit = n; b = ones (n, 1); P = diag (diag (A)); [i,j,v]=find(sparse(A)); minres=1e-7; disp " ***********************************************************************" printf("Solving a random system of %d equations, %d nonzeroes.\n",n,nnz(A)); disp " ***********************************************************************" tic; Ao = sparse (i,j,v,n,n);obt=toc; onz=nnz(Ao); tic; [X, FLAG, RELRES, ITER] = gmres (Ao, b, [], minres, maxit, P); odt=toc; cs="Octave "; onv=norm(Ao*X-b); oRELRES=RELRES; printf("%s took %.2e = %.2e + %.2e s and gave residual %g, flag %d, error norm %g.\n",cs,obt+odt,obt,odt,RELRES,FLAG,onv); tic; Ar = sparsersb (i,j,v,n,n);rbt=toc; #tic; Ar = sparsersb (Ao);rbt=toc; rnz=nnz(Ar); tic; [X, FLAG, RELRES, ITER] = gmres (Ar, b, [], minres, maxit, P); rdt=toc; cs="sparsersb"; rnv=norm(Ar*X-b); printf("%s took %.2e = %.2e + %.2e s and gave residual %g, flag %d, error norm %g.\n",cs,rbt+rdt,rbt,rdt,RELRES,FLAG,rnv); if (onz != rnz) printf("Error: seems like matrices don't match: %d vs %d nonzeroes!\n",onz,rnz); quit(1); else end if (RELRES>minres ) && (oRELRES %.1es) \n (matrix construction: %.1ex, %d iterations: %.1ex).\n",(obt+odt)/(rbt+rdt),(obt+odt),(rbt+rdt),(obt)/(rbt),iters,(odt)/(rdt)); #if (obt+odt)/(rbt+rdt) > 1.0 # printf("overall: %.1ex\n",(obt+odt)/(rbt+rdt)); #end end printf("\n"); end # This one is based on what Carlo De Falco once posted on the octave-dev mailing list: # (he used n=1000, k=15) # Toy size. #n = 4; #k = 1; #A= sqrt(k) * eye (n) + sprandn (n, n, .9); #lsb_compare(A); # Toy size. #n = 100; #k = 5; #A= sqrt(k) * eye (n) + sprandn (n, n, .8); #lsb_compare(A); n = 2000; k = 1000; A= sqrt(k) * eye (n) + sprandn (n, n, .4); lsb_compare(A); n = 5000; k = 1500; A= sqrt(k) * eye (n) + sprandn (n, n, .2); lsb_compare(A); disp "All done." disp "Notice how for large matrices the matrix construction is slower..." disp "... but multiplications are faster !" disp " ***********************************************************************" sparsersb-1.0.5/bin/obench.m0000644000000000000000000000663613066547510014115 0ustar0000000000000000# # Copyright (C) 2011-2017 Michele Martone # # 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 . # 1; # This is a script if length(getenv("SPARSERSB_TEST")) == 0 ; pkg load sparsersb ; end disp " ***********************************************************************" disp "** A small 'sparse' vs 'sparsersb' benchmark. **" disp "** On a few sample problems, tests: **" disp "** - matrix-vector multiplication (SPMV) **" disp "** - matrix-vector multiplication transposed (SPMV_T) **" disp "** - sparse matrix-spares matrix multiplication (SPGEMM) **" disp "** - and shows speedup ('RSB SPEEDUP' column) **" disp "** p.s.: Invoke 'demo sparsersb' to get just a first working overview. **" disp " ***********************************************************************" disp "OP ROWS COLUMNS NONZEROES OPTIME MFLOPS RSB SPEEDUP IMPLEMENTATION" cmt="#"; #for n_=1:6*0+1 for n_=1:6 for ro=0:1 n=n_*1000; m=k=n; # making vectors b=linspace(1,1,n)'; ox=linspace(1,1,n)'; bx=linspace(1,1,n)'; # making matrices r=(rand(n)>.6); om=sparse(r); nz=nnz(om); M=10^6; if ro==1 printf("%s%s\n",cmt," reordering with colamd..."); pct=-time; p=colamd(om); pct+=time; pat=-time; om=om(:,p); pat+=time; # TODO: use an array to select/specify the different reordering algorithms # printf("%g\t%g\t(%s)\n",(nz/M)/pct,(nz/M)/pat,"mflops for pct/pat"); printf("# ...colamd took %.1es (%.1e nnz/s), ",pct,nz/pct); printf( " permutation took %.1es (%.1e nnz/s)\n",pat,nz/pat); else printf("%s%s\n",cmt," testing with no reordering"); end #bm=sparsevbr(om); bm=sparsersb(sparse(om)); #bm=sparsersb3(sparse(om)); # stats flops=2*nz; ## spmv ot=-time; ox=om*b; ot+=time; # bt=-time; bx=bm*b; bt+=time; t=ot; p=["octave-",version]; mflops=(flops/M)/t; printf("%s\t%d\t%d\t%d\t%.1es\t%g\t%.1ex\t%s\n","SPMV ",m,k,nz,t,mflops,1 ,p); t=bt; p=["RSB"]; mflops=(flops/M)/t; printf("%s\t%d\t%d\t%d\t%.1es\t%g\t%.1ex\t%s\n","SPMV ",m,k,nz,t,mflops,ot/bt,p); ## spmvt ot=-time; ox=om.'*b; ot+=time; # bt=-time; bx=bm.'*b; bt+=time; t=ot; p=["octave-",version]; mflops=(flops/M)/t; printf("%s\t%d\t%d\t%d\t%.1es\t%g\t%.1ex\t%s\n","SPMV_T",m,k,nz,t,mflops,1 ,p); t=bt; p=["RSB"]; mflops=(flops/M)/t; printf("%s\t%d\t%d\t%d\t%.1es\t%g\t%.1ex\t%s\n","SPMV_T",m,k,nz,t,mflops,ot/bt,p); ## spgemm ot=-time; ox=om*om; ot+=time; # bt=-time; bx=bm*bm; bt+=time; t=ot; p=["octave-",version]; printf("%s\t%d\t%d\t%d\t%.1es\t\t%.1ex\t%s\n","SPGEMM",m,k,nz,t,1, p); t=bt; p=["RSB"]; printf("%s\t%d\t%d\t%d\t%.1es\t\t%.1ex\t%s\n","SPGEMM",m,k,nz,t,ot/bt,p); endfor endfor disp " ***********************************************************************" sparsersb-1.0.5/bin/octavebench.m0000755000000000000000000001362413066547510015136 0ustar0000000000000000#!/usr/bin/octave -q # # Copyright (C) 2011-2017 Michele Martone # # 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 . # 1; # This is a script # a benchmark program for octave/matlab # TODO: fix output format # TODO: correct symmetric / hermitian matrices handling # TODO: sound, time-and-runs-based benchmarking criteria if length(getenv("SPARSERSB_TEST")) == 0 ; pkg load sparsersb ; end disp " ***********************************************************************" disp "** A small 'sparse' vs 'sparsersb' test / benchmark. **" disp "** This is meant to be a demo, but not really an example. **" disp "** You can invoke it supplying a Matrix Market matrix (e.g. pd.mtx). **" disp "** Without arguments, will generate a test matrix. **" disp "** p.s.: Invoke 'demo sparsersb' to get just a first working overview. **" disp " ***********************************************************************" n=10; function printbenchline(matrixname,opname,sw,times,nnz,tottime,mxxops,bpnz,msstr) printf("FIXME (temporary format)\n"); printf("%s %s %s %d %d %.4f %10.2f %.4f %s\n",matrixname,opname,sw,times,nnz,tottime,mxxops,bpnz,msstr); end if nargin <= 0 # DGEMV benchmark disp "** Will generate a matrix... **" for o=1024:1024 #for o=1024:256:2048*2 m=rand(o); v=linspace(1,1,o)'; tic(); for i=1:n; m*v; end t=toc(); Mflops=n*2.0*nnz(m)/(10^6 * t); dgemvmflops=Mflops; printf("%d GEMV for order %d in %g secs, so %10f Mflops\n",n,o,t,n*2.0*o*o/(10^6 * t)); end disp " ***********************************************************************" else # nargin > 0 # if nargin > 0, we continue want_sparsersb_io=1; if want_sparsersb_io != 1 source("ext/mminfo.m"); source("ext/mmread.m"); source("ext/mmwrite.m"); end #matrices=ls("*.mtx")'; f=1; uc=2; # only 2 for the moment being. while f<=nargin MB=1024*1024; printf("** Will read Matrix Market matrix file %s ...\n",f); mmn=cell2mat(argv()(f))'; mn=strtrim(mmn'); tic(); #nm=mmread(mn); if want_sparsersb_io == 1 [nm,nrows,ncols,entries,rep,field,symm]=sparsersb(mn); nm=sparse(nm); if (symm=='S') uc+=1; end else [nm,nrows,ncols,entries,rep,field,symm]=mmread(mn); #if(symm=="symmetric")uc+=2;endif if(strcmp(symm,"symmetric"))uc+=1;endif end disp " " wr=0 ; # write rendering to file if wr==1 sparsersb(sparsersb(nm),"render",[mn,"-original.eps"]); pct=-time; #p=colamd(nm); p=colperm(nm); pct+=time; pat=-time; nm=nm(:,p); pat+=time; #sparsersb(sparsersb(nm),"render",[mn,"-colamd.eps"]) sparsersb(sparsersb(nm),"render",[mn,"-colperm.eps"]); end fsz=stat(mn).size; rt=toc(); [ia,ja,va]=find(nm); printf("%s: %.2f MBytes read in %.4f s (%10.2f MB/s)\n",mn,fsz/MB,rt,fsz/(rt*MB)); #ia=ia'; ja=ja'; va=va'; sep=" "; csvlstring=sprintf("#mn entries nrows ncols"); csvdstring=sprintf("%%:%s%s%d%s%d%s%d",mn,sep,entries,sep,nrows,sep,ncols); for ski=1:uc oppnz=1; # FIXME: what about handling symmetry ? sparsekw="sparse"; if(ski==2)sparsekw="sparsersb";endif if(ski==3); oppnz=2; sparsekw="sparsersb"; tic(); [nm]=sparsersb(mn); rt=toc(); sparsersb(nm,"info") printf("%s: %.2f MBytes read by librsb in %.4f s (%10.2f MB/s)\n",mn,fsz/MB,rt,fsz/(rt*MB)); endif if(ski==4); nm=tril(nm); endif [ia,ja,va]=find(nm); rnz=nnz(nm); printf(" *** Benchmarking '%s'.\n",sparsekw); # printf("symmetry ? %d\n",issymmetric(sparse(nm))); mrc=rows(nm); mcc=columns(nm); if(ski!=3); tic(); eval(["for i=1:n; om=",sparsekw,"(ia,ja,va,mrc,mcc,\"summation\"); end"]); printf(" *** Benchmarking '%s' instantiation from 'ia,ja,va'.\n",sparsekw); at=toc(); #if(ski==2) tic(); nm=sparsersb(om,"autotune","N");om=nm; att=toc(); ;endif mnz=nnz(om); amflops=n*(mnz/(10^6 * at)); printf("%s '%s' %d Instantiations for %d nnz in %.4f secs, so %10.2f nnz/s\n",mn,sparsekw,n,rnz,at,amflops); else mnz=rnz; end if(ski==2) nsb=str2num(sparsersb(om,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); printf (" ** Assembled 'sparsersb' matrix has %d RSB blocks.\n", nsb); endif #rm=sparsersb(ia,ja,va);# UNFINISHED r=linspace(1,1,size(om,1))'; v=linspace(1,1,size(om,2))'; printf(" *** Benchmarking '%s' SPMV..\n",sparsekw); tic(); for i=1:n; r+=om *v; end; umt=toc(); UMflops=oppnz*n*2.0*mnz/(10^6 * umt); printf("%s '%s' %d SPMV for %d nnz in %.4f secs, so %10.2f Mflops\n",mn,sparsekw,n,mnz,umt, UMflops); bpnz=-1; # FIXME: bytes per nonzero! msstr="?";# FIXME: matrix structure string! # FIXME: finish the following! #printbenchline(mn',"SPMV",sparsekw,n,mnz,umt, UMflops,bpnz,msstr); # tmp=r;r=v;v=tmp; printf(" *** Benchmarking %s SPMV_T..\n",sparsekw); tic(); for i=1:n; r+=om.'*v; end; tmt=toc(); TMflops=oppnz*n*2.0*mnz/(10^6 * tmt); printf("%s '%s' %d spMVT for %d nnz in %.4f secs, so %10.2f Mflops\n",mn,sparsekw,n,mnz,tmt, TMflops); if(ski<3); csvlstring=sprintf("%s%s",csvlstring," n at amflops umt UMflops tmt TMflops"); csvdstring=sprintf("%s%s%d%s%f%s%f%s%f%s%f%s%f%s%f",csvdstring,sep,n,sep,at,sep,amflops,sep,umt,sep,UMflops,sep,tmt,sep,TMflops); endif disp " " end ++f; # Uncomment following lines for benchmark-oriented output: #printf("%s\n",csvlstring); #printf("%s\n",csvdstring); end disp " ***********************************************************************" endif # nargin > 0 sparsersb-1.0.5/bin/pd.mtx0000644000000000000000000000125313066547510013624 0ustar0000000000000000%%MatrixMarket matrix coordinate real general % a positive definitive matrix, as in % http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/lpp/essl.html.en_US/html/essl43.html % * * % | 99 12 13 14 15 16 | % | 12 99 12 13 14 15 | % | 13 12 99 12 13 14 | % | 14 13 12 99 12 13 | % | 15 14 13 12 99 12 | % | 16 15 14 13 12 99 | % * * 6 6 36 1 1 99 1 2 12 1 3 13 1 4 14 1 5 15 1 6 16 2 1 12 2 2 99 2 3 12 2 4 13 2 5 14 2 6 15 3 1 13 3 2 12 3 3 99 3 4 12 3 5 13 3 6 14 4 1 14 4 2 13 4 3 12 4 4 99 4 5 12 4 6 13 5 1 15 5 2 14 5 3 13 5 4 12 5 5 99 5 6 12 6 1 16 6 2 15 6 3 14 6 4 13 6 5 12 6 6 99 sparsersb-1.0.5/bin/ufsolve.m0000755000000000000000000000620713066547510014337 0ustar0000000000000000# # Copyright (C) 2011-2017 Michele Martone # # 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 . # # # This program shall attempt solution of a problem saved in the MATLAB # format as for the University of Florida collection. # # One with a problem structured as in e.g.: # http://www.cise.ufl.edu/research/sparse/mat/Hamm/memplus.mat # http://www.cise.ufl.edu/research/sparse/mat/Schenk_ISEI/barrier2-9.mat # # s=load("~/barrier2-9.mat"); 1; # This is a script if length(getenv("SPARSERSB_TEST")) == 0 ; pkg load sparsersb ; end disp " ***********************************************************************" disp "** A usage example of sparsersb. **" disp "** You can supply 'sparsersb' matrices to iterative method routines. **" disp "** If the matrix is large enough, this shall secure good performance **" disp "** of matrix-vector multiply: up to you to find method+linear system ! **" disp "** p.s.: Invoke 'demo sparsersb' to get just a first working overview. **" disp " ***********************************************************************" s=load(argv(){length(argv())}); n=rows(s.Problem.A); minres=1e-3; #maxit = n; maxit = 100; b=s.Problem.b; oct_A=sparse(s.Problem.A); rsb_A=sparsersb(s.Problem.A); printf (" **** Loaded a %d x %d matrix with %.3e nonzeroes ****\n", n, columns(s.Problem.A), nnz(s.Problem.A) ); X0=[]; RELRES=2*minres; TOTITER=0; M1=[]; M2=[]; M1=sparse(diag(s.Problem.A)\ones(n,1)); M2=sparse(diag(ones(n,1))); nsb=str2num(sparsersb(rsb_A,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); printf (" **** The 'sparsersb' matrix consists of %d RSB blocks. ****\n", nsb); disp " *********** Invoking pcg using a 'sparse' matrix ******************* "; tic; [X1, FLAG, RELRES, ITER] = pcg (oct_A, b, minres, maxit, M1,M2,X0); odt=toc; toc disp " *********** Invoking pcg using a 'sparsersb' matrix ******************* "; tic; [X1, FLAG, RELRES, ITER] = pcg (rsb_A, b, minres, maxit, M1,M2,X0); odt=toc; toc disp " ** Attempting autotuning 'sparsersb' matrix (pays off on the long run * "; tic; rsb_A=sparsersb(rsb_A,"autotune","n",1); toc; nsb=str2num(sparsersb(rsb_A,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); printf (" **** The 'sparsersb' matrix consists of %d RSB blocks now. **** \n", nsb); disp " ****** Invoking pcg using a 'sparsersb' matrix (might be faster now) *** "; tic; [X1, FLAG, RELRES, ITER] = pcg (rsb_A, b, minres, maxit, M1,M2,X0); odt=toc; toc disp " *********************************************************************** "; quit(1); sparsersb-1.0.5/doc/0000755000000000000000000000000013066547510012463 5ustar0000000000000000sparsersb-1.0.5/doc/README0000644000000000000000000000315213066547510013344 0ustar0000000000000000 ================================================================================ This (sparsersb) is a plugin to interface the "librsb" high performance sparse matrix library to GNU Octave. Author: Michele MARTONE ================================================================================ Build / use instructions (using pkg): To use the configure auto-detected librsb from within Octave: > pkg -local -verbose install sparsersb-1.0.5.tar.gz > pkg load sparsersb > help sparsersb Alternatively: tar czf sparsersb-1.0.5.tar.gz cd sparsersb-1.0.5/src ./configure make make check It is possible to provide the configure script with a librsb sources archive you have downloaded separately and make it build on the fly for you and use it; e.g.: ./configure --with-librsb-tarball=$HOME/librsb-1.2.0.tar.gz or setting: export LIBRSB_TARBALL=$HOME/librsb-1.2.0.tar.gz before entering in Octave and building with pkg: > pkg -local -verbose install sparsersb-1.0.5.tar.gz On many systems, you will have to build librsb with the PIC (-fPIC on GCC) option or you will get link time problems. More configure options: ./configure --help Usage instructions without using pkg: # go to the directory where sparsersb.oct is located and run Octave: octave # you can use the sparsersb function, starting with e.g.: > help sparsersb Check out http://librsb.sf.net for the latest librsb release, http://octave.sourceforge.net/sparsersb/ for the latest sparsersb release and http://hg.code.sf.net/p/octave/sparsersb/ for the latest repository version. ================================================================================ sparsersb-1.0.5/doc/sparsersb.txt0000644000000000000000000001254213066547510015234 0ustar0000000000000000 -- Loadable Function: S = sparsersb (A) -- Loadable Function: S = sparsersb (I, J, SV, M, N) -- Loadable Function: S = sparsersb (I, J, SV, M, N, NZMAX) -- Loadable Function: S = sparsersb (I, J, SV) -- Loadable Function: S = sparsersb (M, N) -- Loadable Function: S = sparsersb (I, J, SV, M, N, "unique") -- Loadable Function: sparsersb ("set", OPN, OPV) -- Loadable Function: V = sparsersb (S, "get", MIF) -- Loadable Function: V = sparsersb (S, QS) -- Loadable Function: sparsersb (A,"save",MTXFILENAME) -- Loadable Function: [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb (MTXFILENAME[, MTXTYPESTRING]) -- Loadable Function: sparsersb (S,"render", FILENAME[, RWIDTH, RHEIGHT]) -- Loadable Function: [O =] sparsersb (S,"autotune"[, TRANSA, NRHS, MAXR, TMAX, TN, SF]) Create or manipulate sparse matrices using the RSB format provided by librsb, as similarly as possible to `sparse'. If A is a full matrix, convert it to a sparse matrix representation, removing all zero values in the process. Given the integer index vectors I and J, and a 1-by-`nnz' vector of real or complex values SV, construct the sparse matrix `S(I(K),J(K)) = SV(K)' with overall dimensions M and N. The argument `NZMAX' is ignored but accepted for compatibility with MATLAB and `sparsersb'. If M or N are not specified their values are derived from the maximum index in the vectors I and J as given by `M = max (I)', `N = max (J)'. Can load a matrix from a Matrix Market matrix file named MTXFILENAME. The optional argument MTXTYPESTRING can specify either real ("D") or complex ("Z") type. Default is real. In the case MTXFILENAME is "?", a string listing the available numerical types with BLAS-style characters will be returned. If the file turns out to contain a Matrix Market dense vector, this will be loaded. If "save" is specified, saves a sparse RSB matrix as a Matrix Market matrix file named MTXFILENAME. *Note*: if multiple values are specified with the same I, J indices, the corresponding values in SV will be added. The following are all equivalent: s = sparsersb (i, j, s, m, n) s = sparsersb (i, j, s, m, n, "summation") s = sparsersb (i, j, s, m, n, "sum") If the optional "unique" keyword is specified, then if more than two values are specified for the same I, J indices, only the last value will be used. `sparsersb (M, N)' will create an empty MxN sparse matrix and is equivalent to `sparsersb ([], [], [], M, N)'. If M or N are not specified, then `M = max (I)', `N = max (J)'. If OPN is a string representing a valid librsb option name and OPV is a string representing a valid librsb option value, these will be passed to the `rsb_lib_set_opt_str()' function. If MIF is a string specifying a valid librsb matrix info string (valid for librsb's `rsb_mtx_get_info_from_string()'), then the corresponding value will be returned for matrix `S', in string `V'. If MIF is the an empty string (""), matrix structure information will be returned. As of librsb-1.2, these is debug or internal information. E.g. for 'RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T', a string with the count of internal RSB blocks will be returned. If S is a sparsersb matrix and QS is a string, QS shall be interpreted as a query string about matrix S. String `V' will be returned with query results. *Note*: this feature is to be completed and its syntax reserved for future use. In this version, whatever the value of QS, a general matrix information string will be returned (like sparsersb(S,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T") ). If S is a sparsersb matrix and the "render" keyword is specified, and FILENAME is a string, A will be rendered as an Encapsulated Postscript file FILENAME. Optionally, width and height can be specified in `RWIDTH, RHEIGHT'. Defaults are 512. If S is a sparsersb matrix and the "autotune" keyword is specified, autotuning of the matrix will take place, with SpMV and autotuning parameters. After the "autotune" string, the remaining parameters are optional. Parameter TRANSA specifies whether to tune for untransposed ("N") or transposed ("T"); NRHS the number of right hand sides; MAXR the number of tuning rounds; TMAX the threads to use. If giving an output argument O, that will be assigned to the autotuned matrix, and the input one A will remain unchanged. See librsb documentation for `rsb_tune_spmm' to learn more. Long (64 bit) index support is partial: if Octave has been configured for 64 bit indices, sparsersb will correctly handle and convert matrices/indices that would fit in a 32 bit indices setup, failing on 'larger' ones. Please note that on `sparsersb' type variables are available most, but not all of the operators available for `full' or `sparse' typed variables. See also: full, sparse. Additional help for built-in functions and operators is available in the online version of the manual. Use the command 'doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. sparsersb-1.0.5/inst/0000755000000000000000000000000013066547510012673 5ustar0000000000000000sparsersb-1.0.5/inst/matlabbench.m0000644000000000000000000000372713066547510015322 0ustar0000000000000000# # Copyright (C) 2011-2015 Michele Martone # # 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 . # # Undocumented # function mbench(fname) function matlabbench(fname) addpath ext/ mp=matlabpath(); n=10; for f=1:nargin MB=1024*1024; mmn=fname'; mn=strtrim(mmn'); tic(); matlabpath('ext'); mn; nm=mmreadm(mn); matlabpath(mp); %fsz=stat(mn).size; rnz=nnz(nm); rt=toc(); [ia,ja,va]=find(nm); %printf('%s: %.2f MBytes read in %.4f s (%10.2f MB/s)\n',mn',fsz/MB,rt,fsz/(rt*MB)); %ia=ia'; ja=ja'; va=va'; for ski=1:1 % FIXME: what about symmetry ? sparsekw='sparse'; if(ski==2)sparsekw='sparsersb';end tic(); for i=1:n; om=sparse(ia,ja,va); end at=toc(); mnz=nnz(om); amflops=n*2.0*mnz/(10^6 * at); %printf('%s (%s) %d spBLD for %d nnz in %.4f secs, so %10.2f Mflops\n',mn',sparsekw,n,rnz,at,amflops); amflops %rm=sparsersb(ia,ja,va);% UNFINISHED v=linspace(1,1,size(om,1))'; r=v; tic(); for i=1:n r=r+om*v; end ; umt=toc(); UMflops=n*2.0*mnz/(10^6 * umt); UMflops %printf('%s (%s) %d spMV for %d nnz in %.4f secs, so %10.2f Mflops\n',mn',sparsekw,n,mnz,umt, UMflops); tic(); for i=1:n r=r+om.'*v; end ; tmt=toc(); TMflops=n*2.0*mnz/(10^6 * tmt); TMflops %printf('%s (%s) %d spMV for %d nnz in %.4f secs, so %10.2f Mflops\n',mn',sparsekw,n,mnz,tmt, TMflops); end end %printf('benchmark terminated successfully\n'); quit end sparsersb-1.0.5/inst/sparsersbbench.m0000755000000000000000000001347513066547510016072 0ustar0000000000000000#!/usr/bin/octave -q # # Copyright (C) 2011-2016 Michele Martone # # 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 . # # TODO: document this file's functions so they get installed and are properly usable. # TODO: sprand should not be used in a consistent way 1; # This is a script. if length(getenv("SPARSERSB_TEST")) == 0 ; pkg load sparsersb ; end function dt=sparsersbbench__(precmd,cmd,postcmd,mint) # .. eval(precmd); nops=0; tic(); do ++nops; eval(cmd); until ((dt=toc())>=mint) dt/=nops; eval(postcmd); end function speedup=sparsersbbench_(gprecmd,precmd,cmd,postcmd,gpostcmd,mint) # ... rprecmd=strrep(precmd,"sparsersb","sparse"); rcmd=strrep(cmd,"sparsersb","sparse"); rpostcmd=strrep(postcmd,"sparsersb","sparse"); dots=";"; once=[precmd,dots,cmd,dots,postcmd]; #eval(once); printf("iterating %s\n",once); # dots="..."; predots=sprintf(";tic;do;"); postdots=sprintf(";until ((dt=toc())>=%f);",mint); all=[gprecmd,dots,precmd,predots,cmd,postdots,postcmd,dots,gpostcmd]; # printf("will see speedup for %s\n",all); printf("#%s #-> speedup is...",all); dtr=sparsersbbench__([gprecmd,"", precmd,""], cmd,[ postcmd,":",gpostcmd],mint); dto=sparsersbbench__([gprecmd,"",rprecmd,""],rcmd,[rpostcmd,":",gpostcmd],mint); speedup=dto/dtr; printf("%.2f\n",speedup); # printf("%.2f speedup for %s\n",speedup,all); end function sparsersbbench_battery(mstring,mint) rinitstr=["A=sparsersb(",mstring,");nr=size(A)(1);nc=size(A)(2);"]; finitstr=["A=full(",mstring,");"]; cinitstr=["M=sparse(",mstring,");[ia,ja,va]=find(M);nr=size(M)(1);nc=size(M)(2);"]; sparsersbbench_("",[rinitstr,""],"A.*=2.0;","clear A","",mint); sparsersbbench_("",[rinitstr,""],"A.*=2.5;","clear A","",mint); sparsersbbench_("",[rinitstr,""],"A./=2.0;","clear A","",mint); sparsersbbench_("",[rinitstr,""],"A./=2.5;","clear A","",mint); #sparsersbbench_("",[rinitstr,""],"A.*=0.0;","clear A","",mint); #sparsersbbench_("",[rinitstr,""],"A./=0.0;","clear A","",mint); sparsersbbench_("",[rinitstr,""],"A.^=2.5;","clear A","",mint); sparsersbbench_("",[rinitstr,""],"A.^=2.0;","clear A","",mint); sparsersbbench_("",[rinitstr,""],"A.^=0.5;","clear A","",mint); sparsersbbench_("",[cinitstr,""],"C=sparsersb(ia,ja,va,nr,nc);clear C;","clear A C ia ja va","",mint); sparsersbbench_("",[cinitstr,""],"C=sparsersb(ia,ja,va);clear C;","clear A C ia ja va","",mint); sparsersbbench_("",[cinitstr,""],"C=sparsersb(ja,ia,va);clear C;","clear A C ia ja va","",mint); sparsersbbench_("",[finitstr,""],"C=sparsersb(A);clear C;","clear A C","",mint); sparsersbbench_("",[rinitstr,""],"C=A; ;clear C;","clear A C","",mint); sparsersbbench_("",[rinitstr,""],"C=A.'; ;clear C;","clear A C","",mint); sparsersbbench_("",[rinitstr,""],"C=transpose(A);clear C;","clear A C","",mint); for nrhs=1:3 nrhss=sprintf("%d",nrhs); sparsersbbench_("",[rinitstr,"C=ones(nr,",nrhss,");B=C;"],"C=A*B;","clear A B C","",mint); sparsersbbench_("",[rinitstr,"C=ones(nr,",nrhss,");B=C;"],"C=A.'*B;","clear A B C","",mint); eval(finitstr); if (tril(A)==A) || (triu(A)==A) sparsersbbench_("",[rinitstr,"C=ones(nr,",nrhss,");B=C;"],"C=A\\B;","clear A B C","",mint); sparsersbbench_("",[rinitstr,"C=ones(nr,",nrhss,");B=C;"],"C=A.'\\B;","clear A B C","",mint); end end clear A; sparsersbbench_("",[rinitstr,"D=ones(nr,1);"],"D=diag(A);","clear A D","",mint); sparsersbbench_("",[rinitstr,"B=A;"],"C=A+B;","clear A B C","",mint); sparsersbbench_("",[rinitstr,"B=A;"],"C=A.'+B;","clear A B C","",mint); sparsersbbench_("",[rinitstr,"B=A;"],"C=A*B;clear C","clear A B C","",mint); sparsersbbench_("",[rinitstr,"B=A;"],"C=A.'*B;clear C","clear A B C","",mint); end btime=1.0; if false ; # shall use: [x, flag, prec_res_norm, itcnt] sparsersbbench_("n=1000; k=15; oA=k*eye(n)+sprandn(n,n,.2); b=ones(n,1); P=diag(diag(oA));","A=sparsersb(oA);","[x, flag] = gmres (A, b, [], 1e-7, n, P);","clear b P","clear oA",btime); sparsersbbench_("n=2000; k=150; oA=k*eye(n)+sprandn(n,n,.2); b=ones(n,1); P=diag(diag(oA));","A=sparsersb(oA);","[x, flag] = gmres (A, b, [], 1e-7, n, P);","clear b P","clear oA",btime); sparsersbbench_("n=4000; k=1500; oA=k*eye(n)+sprandn(n,n,.2); b=ones(n,1); P=diag(diag(oA));","A=sparsersb(oA);","[x, flag] = gmres (A, b, [], 1e-7, n, P);","clear b P","clear oA",btime); sparsersbbench_("n=6000; k=3500; oA=k*eye(n)+sprandn(n,n,.2); b=ones(n,1); P=diag(diag(oA));","A=sparsersb(oA);","[x, flag] = gmres (A, b, [], 1e-7, n, P);","clear b P","clear oA",btime); end #for diml=0:0 for diml=1:11 #for diml=11:11 #for diml=3:3 #for cadd=1:1 #for cadd=0:0 for cadd=0:1 btime=1.0; if(diml<7)btime=0.1;end dim=2^diml; #is=sprintf("ones(%d)",dim); cmul=sprintf("(1+i*%d)",cadd); is=sprintf("ones(%d).*%s",dim,cmul); sparsersbbench_battery(is,btime) is=sprintf("tril(ones(%d).*%s)",dim,cmul); sparsersbbench_battery(is,btime) is=sprintf("diag(ones(%d,1)).*%s",dim,cmul); sparsersbbench_battery(is,btime) # FIXME: follow non repeatable experiments :) is=sprintf("(diag(ones(%d,1))+sprand(%d,%d,0.1)).*%s",dim,dim,dim,cmul); sparsersbbench_battery(is,btime) is=sprintf("(diag(ones(%d,1))+sprand(%d,%d,0.4)).*%s",dim,dim,dim,cmul); sparsersbbench_battery(is,btime) # FIXME: need a non-square matrices testing-benchmarking snippet end end printf "All done." sparsersb-1.0.5/inst/sparsersbtester.m0000644000000000000000000002754713066547510016323 0ustar0000000000000000#!/usr/bin/octave -q # # Copyright (C) 2011-2017 Michele Martone # # 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 . # # # A comparative tester for sparsersb. # # TODO: # # - shall integrate with the rsb.m tester # - isequal(find(a),find(b)) only checks for pattern! # - isequal(sparsersb(..),sparsersb(..)) is unfinished ! # - need NZMAX as last arg testing # - in sparsersb, the == operator is not yet handled natively # - need testing for find(M,?) # - seems like non-square matrices are not tested # - shall test +-, &=, --, ++, .', ./, .\, /, -, +, .*, ./, .^, +0, ==, <=, >=, >, <, |, & # 1; # This is a script. function ase=are_spm_equal(OM,XM) if(nnz(XM)!=nnz(OM));ase=0; return; end if(columns(XM)!=columns(OM));ase=0; return; end if(rows(XM)!=rows(OM));ase=0; return; end if(length(XM)!=length(OM));ase=0; return; end if(size(XM)!=size(OM));ase=0; return; end if(full(XM)!=full(OM));ase=0; return; end if((3*XM)!=(3*OM));ase=0; return; end if((XM/2)!=(OM/2));ase=0; return; end #if((XM.^2)!=(OM.^2));ase=0; return; end if((-XM)!=(-OM));ase=0; return; end for ri=1:rows(XM) if(XM(ri,:)!=OM(ri,:));ase=0; return; end end for ci=1:columns(XM) if(XM(:,ci)!=OM(:,ci));ase=0; return; end end for ri=1:rows(XM) for ci=1:columns(XM) if(XM(ri,ci)!=OM(ri,ci));ase=0; return; end end end ase=1; if(XM(:,:)!=OM(:,:));ase=0; return; end [oi,oj,ov]=find(OM); [xi,xj,xv]=find(XM); ase&=isequal(oi,xi); ase&=isequal(oj,xj); ase&=isequal(ov,xv); end # are_spm_equal function testmsg(match,tname,erreason) if(match>0) printf(" [*] %s test passed",tname) elseif(match==0) printf(" [!] %s test failed",tname) else printf(" [~] %s ",tname) end if(nargin<3) printf(".\n") else printf(" ().\n",erreason) end end # testmsg function match=testinfo(OM,XM) printf("will test types \"%s\" and \"%s\"\n",typeinfo(OM),typeinfo(XM)) match=1; end # testinfo function match=testdims(OM,XM) match=1; match&=(rows(OM)==rows(XM)); match&=(columns(OM)==columns(XM)); match&=(nnz(OM)==nnz(XM)); testmsg(match,"dimensions"); end # testdims function match=testsprsb(OM,XM) match=1; # FIXME: shall see in detail whether there are not too many conversions here.. [oi,oj,ov]=find(OM); RM=sparsersb(oi,oj,ov); match&=isequal(find(RM),find(OM)); match&=isequal(find(RM),find(XM)); clear RM; RM=sparsersb(oi,oj,ov,size(OM)(1),size(OM)(2)); match&=isequal(find(RM),find(OM)); match&=isequal(find(RM),find(XM)); clear RM; RM=sparsersb(full(OM)); match&=isequal(find(RM),find(OM)); match&=isequal(find(RM),find(XM)); clear RM; RM=sparsersb([oi;1;1],[oj;1;1],[ov;-1;1]); match&=isequal(find(RM),find(OM)); match&=isequal(find(RM),find(XM)); clear RM; nr=max(oi); nc=max(oj); RM=sparsersb([oi;1;1],[oj;1;1],[ov;-1;1],nr,nc,"sum") match&=are_spm_equal(RM,OM); match&=are_spm_equal(RM,XM); clear RM; RM=sparsersb([oi;1;1],[oj;1;1],[ov;-2;1],nr,nc,"sum"); match&=!are_spm_equal(RM,OM); match&=!are_spm_equal(RM,XM); clear RM; RM=sparsersb([oi;nr+1;nr+1],[oj;nc+1;nc+1],[ov;-1;1],nr+1,nc+1,"unique"); match&=!are_spm_equal(RM,OM); match&=!are_spm_equal(RM,XM); clear RM; testmsg(match,"constructors"); end # testsprsb function match=testfind(OM,XM) match=1; match&=isequal(find(OM),find(XM)); match&=isequal(([oi,oj]=find(OM)),([xi,xj]=find(XM))); match&=isequal(([oi,oj,ov]=find(OM)),([xi,xj,xv]=find(XM))); match&=isequal(nonzeros(OM),nonzeros(XM)); testmsg(match,"find"); end # testfind function match=testasgn(OM,XM) match=1; nr=rows(OM); nc=columns(OM); for i=1:nr for j=1:nc #printf("%d %d / %d %d\n", i,j,nr,nc) #OM, XM #printf("%d %d %d\n", i,j,XM(i,j)); if(XM(i,j)) nv=rand(1); OM(i,j)=nv; XM(i,j)=nv; end #OM, XM #exit endfor endfor for i=1:nr for j=1:nc if(OM(i,j))match&=isequal(OM(i,j),XM(i,j)); end; endfor endfor testmsg(match,"asgn"); end # testasgn function match=testelms(OM,XM) match=1; nr=rows(OM); nc=columns(OM); for i=1:nr for j=1:nc if(OM(i,j)!=XM(i,j)); match*=0; end endfor endfor testmsg(match,"elems"); end # testelms function match=testdiag(OM,XM) #sparse(spdiag(OM)) #sparse(spdiag(XM)) #match=(sparse(spdiag(OM))==sparse(spdiag(XM))) #OM,XM #diag(OM) #diag(XM) match=1; if(diag(OM)==diag(XM));match=1;else match=0;end #match=(diag(OM)==diag(XM)); # TODO: understand why the following syntax is problematic ! #match=(spdiag(OM)==spdiag(XM)); testmsg(match,"diagonal"); end # testdiag function match=testpcgm(OM,XM) # FIXME! This test ignores OM and XM ! match=1; tol=1e-10; A=sparse ([11,12;21,23]);X=[11;22];B=A*X;X=[0;0]; [OX, OFLAG, ORELRES, OITER, ORESVEC, OEIGEST]=pcg(A,B); A=sparsersb([11,12;21,23]);X=[11;22];B=A*X;X=[0;0]; [XX, XFLAG, XRELRES, XITER, XRESVEC, XEIGEST]=pcg(A,B); match&=(OFLAG==XFLAG);# FIXME: a very loose check! match&=(OITER==XITER);# FIXME: a very loose check! # # http://www.gnu.org/software/octave/doc/interpreter/Iterative-Techniques.html#Iterative-Techniques #n = 10; n = 10+size(XM)(1,1) clear A OX XX; A = diag (sparse (1:n)); #A = A + A'; b = rand (n, 1); opts.droptol=1.e-3; [l, u] = ilu (A); [OX, OFLAG, ORELRES, OITER, ORESVEC, OEIGEST]= pcg ( A ,b); [XX, XFLAG, XRELRES, XITER, XRESVEC, XEIGEST]= pcg (sparsersb(A),b); match&=(norm(OX-XX)2) M endif match=1; if nnz(OM)>0 match&=testsprsb(OM,XM); end match&=testinfo(OM,XM); match&=testdims(OM,XM); match&=testdiag(OM,XM); match&=testfind(OM,XM); match&=testelms(OM,XM); match&=testasgn(OM,XM); if nnz(OM)>1 if have_working_ilu() match&=testpcgm(OM,XM); match&=testpcrm(OM,XM); else testmsg(-1,"ilu does not work; probably UMFPACK is not installed: skipping some tests.") endif match&=testmult(OM,XM); match&=testspsv(OM,XM); match&=testnorm(OM,XM); end match&=testscal(OM,XM); match&=testadds(OM,XM); testmsg(match,"overall (for this matrix)"); end # tests match=1; mtn=1; if (strchr(sparsersb("?"),"Z")>0) mtn++; endif for mti=1:mtn wc=(mti==2); dim=3; #M=(rand(dim)>.8)*rand(dim);M(1,1)=11; M=[0]; OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM); for k=1:6 M=[eye(k)]; if(wc)M+=M*i;end OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM,M); end #M=zeros(4)+sparse([1,2,3,2,4],[1,2,3,1,4],[11,22,33,21,44]); #if(wc)M+=M*i;end #OM=sparse(M); XM=sparsersb(M); #match&=tests(OM,XM); for k=3:6 M=zeros(k)+sparse([linspace(1,k,k),2],[linspace(1,k,k),1],[11*linspace(1,k,k),21]); if(wc)M+=M*i;end OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM); end #M=tril(ones(10))+100*diag(10); #OM=sparse(M); XM=sparsersb(M); #match&=tests(OM,XM); #M=hilb(10)+100*diag(10); #OM=sparse(M); XM=sparsersb(M); #match&=tests(OM,XM); M=diag(10); if(wc)M+=M*i;end OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM); #M=diag(10)+sparse([1,10],[10,10],[.1,1]); #OM=sparse(M); XM=sparsersb(M); #match&=tests(OM,XM); end if(match) printf("All tests passed.\n"); else printf("Failure while performing tests!\n");end # FIXME: shall print a report in case of failure. #M=zeros(3)+sparse([1,2,3],[1,2,3],[11,22,33]); #M=sparse([1,2,3],[1,2,3],[11,22,33]); #XM=sparsepsb(M); # # # exit # # XM # find(XM) # [i,j]=find(XM) # # exit # sparsersb-1.0.5/src/0000755000000000000000000000000013066547510012505 5ustar0000000000000000sparsersb-1.0.5/src/Makeconf.in0000644000000000000000000000027013066547510014557 0ustar0000000000000000OCTAVE = @OCTAVE@ CXXFLAGS = @CXXFLAGS@ MKOCTFILE = @MKOCTFILE@ -v SPARSERSB_CXXFLAGS = @SPARSERSB_CXXFLAGS@ SPARSERSB_LDFLAGS = @SPARSERSB_LDFLAGS@ SPARSERSB_CXX11= @SPARSERSB_CXX11@ sparsersb-1.0.5/src/Makefile0000644000000000000000000000740113066547510014147 0ustar0000000000000000sinclude Makeconf # Makeconf is created by the configure script. # You can also not use it but set explicitly the following: CXXFLAGS=$(SPARSERSB_CXXFLAGS) LFLAGS=$(shell $(MKOCTFILE) -p LFLAGS) $(SPARSERSB_LDFLAGS) CXXFLAGS_CXX11=$(SPARSERSB_CXX11) .PHONY: all check SPARSERSB_OCT=sparsersb.oct all: $(SPARSERSB_OCT) tags: *.cc ctags * #library: # true # if test "$(RSBLIBDIR)" = $(shell pwd)/../lib ; then \ # # echo "Will build librsb so to have RSBINCDIR=$(RSBINCDIR) and RSBLIBDIR=$(RSBLIBDIR)"; \ # # make -C $(RSBLIBDIR) ; fi $(SPARSERSB_OCT): sparsersb.cc LFLAGS="$(LFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CXXFLAGS_CXX11)" $(MKOCTFILE) -D'RSB_SPARSERSB_LABEL=sparsersb' -o $@ $< rtest: $(SPARSERSB_OCT) SPARSERSB_TEST=1 $(OCTAVE) --norc --silent ../inst/sparsersbtester.m SPARSERSB_TEST=1 $(OCTAVE) --norc --silent ../bin/octavebench.m ../bin/pd.mtx SPARSERSB_TEST=1 $(OCTAVE) --norc --silent ../bin/octavebench.m bench: $(SPARSERSB_OCT) SPARSERSB_TEST=1 $(OCTAVE) --norc --silent ../bin/obench.m SPARSERSB_TEST=1 $(OCTAVE) --norc --silent ../bin/lsbench.m SPARSERSB_TEST=1 $(OCTAVE) --norc --silent ../inst/sparsersbbench.m itests: tests SPARSERSB_TEST=1 $(OCTAVE) --norc --silent --eval 'demo sparsersb' tests: rtest check: tests clean: -$(RM) *.o octave-core core *.oct *~ tags # This is expected to work on author's machine. #dist_old: # echo "warning: we are making a tarball out of SVN repositories: NOT this checked out copy." # rm -fR $(PACKAGE_NAME) # svn export `svn info | grep URL | sed 's/^.* //;s/src$$//'g` $(PACKAGE_NAME) # cd $(PACKAGE_NAME)/src && sh autogen.sh && cd - # rm -fR $(PACKAGE_NAME)/src/old # rm -fR $(PACKAGE_NAME)/src/TODO.txt # rm -fR $(PACKAGE_NAME)/src/oldjunk # tar czf $(PACKAGE_NAME).tgz $(PACKAGE_NAME) # tar tzf $(PACKAGE_NAME).tgz SPARSERSB=sparsersb-1.0.5 ARCHIVE=$(HOME)/src/sparsersb-archives GPGSIGNCMD=gpg -sbav -u 1DBB555AEA359B8AAF0C6B88E0E669C8EF1258B8 help: @echo "# As a user, './configure ... .; make;' shall suffice." @echo "# If you are developing, you might be interested in 'make' followed by either of dist, sdist, sign, tarballs, html-doc." dist: tarballs html-doc sdist: sign tarballs html-doc sign: tarballs html-doc $(GPGSIGNCMD) $(ARCHIVE)/$(SPARSERSB).tar.gz gpg --verify $(ARCHIVE)/$(SPARSERSB).tar.gz.asc $(GPGSIGNCMD) $(ARCHIVE)/sparsersb-html.tar.gz gpg --verify $(ARCHIVE)/sparsersb-html.tar.gz.asc tarballs: rm -f $(ARCHIVE)/$(SPARSERSB).tar hg archive -t tar $(ARCHIVE)/$(SPARSERSB).tar --exclude '*.hgignore' -X ".hg*" rm -f ../../$(SPARSERSB) ln -s `pwd`/.. ../../$(SPARSERSB) cd ../.. && tar rf $(ARCHIVE)/$(SPARSERSB).tar --add-file $(SPARSERSB)/src/configure cd ../.. && tar f $(ARCHIVE)/$(SPARSERSB).tar \ --delete $(SPARSERSB)/.hg_archival.txt --delete $(SPARSERSB)/.hgtags --delete $(SPARSERSB)/.hgignore #tar tvf $(SPARSERSB).tar gzip -f $(ARCHIVE)/$(SPARSERSB).tar tar tvzf $(ARCHIVE)/$(SPARSERSB).tar.gz html-doc: rm -fR ./octfiles-tmp ./sparsersb-html $(SPARSERSB) mkdir -p ./octfiles-tmp #tar xvzf $(ARCHIVE)/$(SPARSERSB).tar.gz # If missing.. pkg install -forge generate_html $(OCTAVE) --norc --eval 'pkg prefix ./octfiles-tmp ; echo on; diary sparsersb-diary-install.log; more off; pkg install -verbose '$(ARCHIVE)/$(SPARSERSB).tar.gz'; echo off; pkg load generate_html; generate_package_html ("sparsersb", "sparsersb-html", "octave-forge")' tar czf $(ARCHIVE)/sparsersb-html.tar.gz sparsersb-html echo "You maybe want to remove dirs: ./octfiles-tmp ./sparsersb-html $(SPARSERSB)" ls -l $(ARCHIVE)/sparsersb-html.tar.gz $(ARCHIVE)/$(SPARSERSB).tar.gz md5sum $(ARCHIVE)/sparsersb-html.tar.gz $(ARCHIVE)/$(SPARSERSB).tar.gz cd $(ARCHIVE)/ doc: $(SPARSERSB_OCT) $(OCTAVE) --norc -q --eval 'help sparsersb' | grep -v 'is a function from the' > ../doc/sparsersb.txt sparsersb-1.0.5/src/autogen.sh0000755000000000000000000000002413066547510014502 0ustar0000000000000000#! /bin/sh autoconf sparsersb-1.0.5/src/configure0000755000000000000000000042140713066547510014424 0ustar0000000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for octave sparsersb package 1.0.5. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='octave sparsersb package' PACKAGE_TARNAME='octave-sparsersb-package' PACKAGE_VERSION='1.0.5' PACKAGE_STRING='octave sparsersb package 1.0.5' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS TARGETS EGREP GREP CXXCPP HAVE_LIBRSB_CONFIG LIBRSB_TARBALL SPARSERSB_CXX11 SPARSERSB_CXXFLAGS SPARSERSB_LDFLAGS MKOCTFILE OCTAVE OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_static_librsb with_librsb_tarball with_librsb_conf ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC MKOCTFILE OCTAVE SPARSERSB_LDFLAGS SPARSERSB_CXXFLAGS SPARSERSB_CXX11 LIBRSB_TARBALL CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures octave sparsersb package 1.0.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/octave-sparsersb-package] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of octave sparsersb package 1.0.5:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-static-librsb=yes|no Whether to use static linking with the librsb-conf script. (recommended: yes). --with-librsb-tarball=... Will use specified user provided librsb tarball (e.g. librsb-1.2.0.tar.gz) to build a local librsb installation. You can specify LIBRSB_CFLAGS to customize. With this option --with-librsb-conf will be ignored. --with-librsb-conf=... Path to the librsb-conf program which will be used to recover SPARSERSB_CXXFLAGS and SPARSERSB_LDFLAGS (unless specified explicitly). Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MKOCTFILE The mkoctfile executable OCTAVE The octave executable SPARSERSB_LDFLAGS Linking flags for sparsersb SPARSERSB_CXXFLAGS C++ compilation flags for sparsersb SPARSERSB_CXX11 C++11 additional compilation flags for sparsersb LIBRSB_TARBALL Environment variable equivalent for --with-librsb-tarball=.. CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF octave sparsersb package configure 1.0.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_mongrel # ac_fn_cxx_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_cxx_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run # ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_cxx_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_compile # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by octave sparsersb package $as_me 1.0.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Checks for programs. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 $as_echo_n "checking whether the C++ compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 $as_echo_n "checking for C++ compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}octave", so it can be a program name with args. set dummy ${ac_tool_prefix}octave; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCTAVE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCTAVE"; then ac_cv_prog_OCTAVE="$OCTAVE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCTAVE="${ac_tool_prefix}octave" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCTAVE=$ac_cv_prog_OCTAVE if test -n "$OCTAVE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE" >&5 $as_echo "$OCTAVE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCTAVE"; then ac_ct_OCTAVE=$OCTAVE # Extract the first word of "octave", so it can be a program name with args. set dummy octave; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCTAVE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCTAVE"; then ac_cv_prog_ac_ct_OCTAVE="$ac_ct_OCTAVE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OCTAVE="octave" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCTAVE=$ac_cv_prog_ac_ct_OCTAVE if test -n "$ac_ct_OCTAVE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCTAVE" >&5 $as_echo "$ac_ct_OCTAVE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCTAVE" = x; then OCTAVE="none" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCTAVE=$ac_ct_OCTAVE fi else OCTAVE="$ac_cv_prog_OCTAVE" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mkoctfile", so it can be a program name with args. set dummy ${ac_tool_prefix}mkoctfile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MKOCTFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MKOCTFILE"; then ac_cv_prog_MKOCTFILE="$MKOCTFILE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MKOCTFILE="${ac_tool_prefix}mkoctfile" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MKOCTFILE=$ac_cv_prog_MKOCTFILE if test -n "$MKOCTFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKOCTFILE" >&5 $as_echo "$MKOCTFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MKOCTFILE"; then ac_ct_MKOCTFILE=$MKOCTFILE # Extract the first word of "mkoctfile", so it can be a program name with args. set dummy mkoctfile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MKOCTFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MKOCTFILE"; then ac_cv_prog_ac_ct_MKOCTFILE="$ac_ct_MKOCTFILE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MKOCTFILE="mkoctfile" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MKOCTFILE=$ac_cv_prog_ac_ct_MKOCTFILE if test -n "$ac_ct_MKOCTFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MKOCTFILE" >&5 $as_echo "$ac_ct_MKOCTFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MKOCTFILE" = x; then MKOCTFILE="none" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MKOCTFILE=$ac_ct_MKOCTFILE fi else MKOCTFILE="$ac_cv_prog_MKOCTFILE" fi if test "$MKOCTFILE" = "none" ; then as_fn_error $? "mkoctfile required to install $PACKAGE_NAME" "$LINENO" 5 fi # Checks for librsb have_rsb=no librsb_conf='no' librsb_conf_static='no' # internal # Check whether --with-static-librsb was given. if test "${with_static_librsb+set}" = set; then : withval=$with_static_librsb; librsb_conf_static=$withval; if x"$librsb_conf_static" != xyes -a x"$librsb_conf_static" != xno ; then as_fn_error $? "--static-librsb=yes or --static-librsb=no !! " "$LINENO" 5 fi fi # BEGIN tarball-based on-the-fly install of librsb # Check whether --with-librsb-tarball was given. if test "${with_librsb_tarball+set}" = set; then : withval=$with_librsb_tarball; librsb_tarball=$withval else librsb_tarball=no fi if test x"$LIBRSB_TARBALL" != "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Detected user-set LIBRSB_TARBALL=... variable; equivalent to --with-librsb-tarball=... ." >&5 $as_echo "$as_me: Detected user-set LIBRSB_TARBALL=... variable; equivalent to --with-librsb-tarball=... ." >&6;} librsb_tarball="$LIBRSB_TARBALL" else { $as_echo "$as_me:${as_lineno-$LINENO}: No user-set LIBRSB_TARBALL environment variable detected (set it to build using a custom librsb tarball)." >&5 $as_echo "$as_me: No user-set LIBRSB_TARBALL environment variable detected (set it to build using a custom librsb tarball)." >&6;} fi if test x"$librsb_tarball" != x"no" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Will create a local librsb build from user provided \"$librsb_tarball\" tarball. Will use default LIBRSB_CFLAGS." >&5 $as_echo "$as_me: Will create a local librsb build from user provided \"$librsb_tarball\" tarball. Will use default LIBRSB_CFLAGS." >&6;} test -f ${librsb_tarball} || as_fn_error $? "Are you sure of having file $librsb_tarball ?" "$LINENO" 5 tar xzf "$librsb_tarball" || as_fn_error $? "Error uncompressing \"$librsb_tarball\" ?" "$LINENO" 5 librsb_dir=`basename $librsb_tarball` librsb_dir=${librsb_dir/.tar.gz/} test -d "$librsb_dir" || as_fn_error $? "Error accessing \"$librsb_dir\" -- are you sure you provided a valid librsb tarball ?" "$LINENO" 5 LIBRSB_PREFIX="`pwd`/local" cd "$librsb_dir" || as_fn_error $? "Error entering \"$librsb_dir\" -- are you sure you provided a valid librsb tarball ?" "$LINENO" 5 # LIBRSB_CFLAGS="${LIBRSB_CFLAGS:--O3 -fPIC}" { $as_echo "$as_me:${as_lineno-$LINENO}: Stepped in \"$librsb_dir\"." >&5 $as_echo "$as_me: Stepped in \"$librsb_dir\"." >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: Configuring with LIBRSB_CFLAGS=$LIBRSB_CFLAGS " >&5 $as_echo "$as_me: Configuring with LIBRSB_CFLAGS=$LIBRSB_CFLAGS " >&6;} ./configure OCTAVE='false' CFLAGS="${LIBRSB_CFLAGS}" --prefix="${LIBRSB_PREFIX}" --disable-fortran-examples --disable-c-examples { $as_echo "$as_me:${as_lineno-$LINENO}: Configured successfully." >&5 $as_echo "$as_me: Configured successfully." >&6;} make || as_fn_error $? "Make step failed !" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: Built successfully." >&5 $as_echo "$as_me: Built successfully." >&6;} make install || as_fn_error $? "Make step failed !" "$LINENO" 5 cd - librsb_conf="${LIBRSB_PREFIX}"/bin/librsb-config test -f ${librsb_conf} || as_fn_error $? "Temporary librsb installation config file ${librsb_conf} not executable ? Something went wrong with the install ?!" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: Temporary librsb installation in ${LIBRSB_PREFIX} done." >&5 $as_echo "$as_me: Temporary librsb installation in ${LIBRSB_PREFIX} done." >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: Forcing static linking due to temporary librsb." >&5 $as_echo "$as_me: Forcing static linking due to temporary librsb." >&6;} librsb_conf_static='yes' else { $as_echo "$as_me:${as_lineno-$LINENO}: No librsb tarball provided: following the default procedure." >&5 $as_echo "$as_me: No librsb tarball provided: following the default procedure." >&6;} true; fi # END tarball-based on-the-fly install of librsb if test x"$librsb_conf" = x"no" ; then # Check whether --with-librsb-conf was given. if test "${with_librsb_conf+set}" = set; then : withval=$with_librsb_conf; librsb_conf=$withval else librsb_conf=no fi else { $as_echo "$as_me:${as_lineno-$LINENO}: Using ${librsb_conf} config file from the local librsb installation." >&5 $as_echo "$as_me: Using ${librsb_conf} config file from the local librsb installation." >&6;} fi if test x"$librsb_conf" != x"no" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Using user provided $librsb_conf script for librsb." >&5 $as_echo "$as_me: Using user provided $librsb_conf script for librsb." >&6;} else # Extract the first word of "librsb-config", so it can be a program name with args. set dummy librsb-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_HAVE_LIBRSB_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAVE_LIBRSB_CONFIG"; then ac_cv_prog_HAVE_LIBRSB_CONFIG="$HAVE_LIBRSB_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_LIBRSB_CONFIG="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_HAVE_LIBRSB_CONFIG" && ac_cv_prog_HAVE_LIBRSB_CONFIG="no" fi fi HAVE_LIBRSB_CONFIG=$ac_cv_prog_HAVE_LIBRSB_CONFIG if test -n "$HAVE_LIBRSB_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_LIBRSB_CONFIG" >&5 $as_echo "$HAVE_LIBRSB_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$HAVE_LIBRSB_CONFIG" != x"no"; then librsb_conf=librsb-config fi fi if test x"$SPARSERSB_CXXFLAGS" != "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Using user set SPARSERSB_CXXFLAGS..." >&5 $as_echo "$as_me: Using user set SPARSERSB_CXXFLAGS..." >&6;} else if test x"$librsb_conf" != x"no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Setting SPARSERSB_CXXFLAGS from $librsb_conf --I_opts..." >&5 $as_echo "$as_me: Setting SPARSERSB_CXXFLAGS from $librsb_conf --I_opts..." >&6;} SPARSERSB_CXXFLAGS="`$librsb_conf --I_opts`" fi fi if test -x `which $OCTAVE-cli` ; then OCTAVE_CLI="$OCTAVE-cli"; else OCTAVE_CLI="$OCTAVE"; fi SPARSERSB_USE_64BIT_IDX=`$OCTAVE_CLI --no-line-editing -qf --eval 'printf ("%i", sizemax() > intmax ("int32"))'` if test x"$SPARSERSB_USE_64BIT_IDX" = x"1" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Adding -D RSBOI_DETECTED_LONG_IDX to SPARSERSB_CXXFLAGS ..." >&5 $as_echo "$as_me: Adding -D RSBOI_DETECTED_LONG_IDX to SPARSERSB_CXXFLAGS ..." >&6;} SPARSERSB_CXXFLAGS="$SPARSERSB_CXXFLAGS -D RSBOI_DETECTED_LONG_IDX=1" fi if test x"$SPARSERSB_LDFLAGS" != "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Using user set SPARSERSB_LDFLAGS..." >&5 $as_echo "$as_me: Using user set SPARSERSB_LDFLAGS..." >&6;} else if test x"$librsb_conf" != x"no"; then if test x"$librsb_conf_static" = x"no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Setting SPARSERSB_LDFLAGS from --L_opts --libs" >&5 $as_echo "$as_me: Setting SPARSERSB_LDFLAGS from --L_opts --libs" >&6;} SPARSERSB_LDFLAGS="`$librsb_conf --L_opts --libs`" else { $as_echo "$as_me:${as_lineno-$LINENO}: Setting SPARSERSB_LDFLAGS from --static --libs --extra_libs" >&5 $as_echo "$as_me: Setting SPARSERSB_LDFLAGS from --static --libs --extra_libs" >&6;} SPARSERSB_LDFLAGS="`$librsb_conf --static --libs --extra_libs`" fi fi fi if test x"$SPARSERSB_CXXFLAGS" = "x" ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_cxx_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in rsb.h do : ac_fn_cxx_check_header_mongrel "$LINENO" "rsb.h" "ac_cv_header_rsb_h" "$ac_includes_default" if test "x$ac_cv_header_rsb_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_RSB_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing rsb_lib_init" >&5 $as_echo_n "checking for library containing rsb_lib_init... " >&6; } if ${ac_cv_search_rsb_lib_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char rsb_lib_init (); int main () { return rsb_lib_init (); ; return 0; } _ACEOF for ac_lib in '' rsb; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_search_rsb_lib_init=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_rsb_lib_init+:} false; then : break fi done if ${ac_cv_search_rsb_lib_init+:} false; then : else ac_cv_search_rsb_lib_init=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_rsb_lib_init" >&5 $as_echo "$ac_cv_search_rsb_lib_init" >&6; } ac_res=$ac_cv_search_rsb_lib_init if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" SPARSERSB_CXXFLAGS=" " fi fi done fi if test x"$SPARSERSB_LDFLAGS" = "x" ; then for ac_header in rsb.h do : ac_fn_cxx_check_header_mongrel "$LINENO" "rsb.h" "ac_cv_header_rsb_h" "$ac_includes_default" if test "x$ac_cv_header_rsb_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_RSB_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing rsb_lib_init" >&5 $as_echo_n "checking for library containing rsb_lib_init... " >&6; } if ${ac_cv_search_rsb_lib_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char rsb_lib_init (); int main () { return rsb_lib_init (); ; return 0; } _ACEOF for ac_lib in '' rsb; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO"; then : ac_cv_search_rsb_lib_init=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_rsb_lib_init+:} false; then : break fi done if ${ac_cv_search_rsb_lib_init+:} false; then : else ac_cv_search_rsb_lib_init=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_rsb_lib_init" >&5 $as_echo "$ac_cv_search_rsb_lib_init" >&6; } ac_res=$ac_cv_search_rsb_lib_init if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" SPARSERSB_LDFLAGS="-lrsb" fi fi done fi if test x"$SPARSERSB_CXXFLAGS" = "x" ; then as_fn_error $? "$PACKAGE_NAME SPARSERSB_CXXFLAGS (librsb not detected)!" "$LINENO" 5 fi if test x"$SPARSERSB_LDFLAGS" = "x" ; then as_fn_error $? "$PACKAGE_NAME requires SPARSERSB_LDFLAGS (librsb not detected)!" "$LINENO" 5 fi have_rsb=yes { $as_echo "$as_me:${as_lineno-$LINENO}: SPARSERSB_CXXFLAGS is $SPARSERSB_CXXFLAGS" >&5 $as_echo "$as_me: SPARSERSB_CXXFLAGS is $SPARSERSB_CXXFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: SPARSERSB_LDFLAGS is $SPARSERSB_LDFLAGS" >&5 $as_echo "$as_me: SPARSERSB_LDFLAGS is $SPARSERSB_LDFLAGS" >&6;} # TODO: alternative: build librsb with SPARSERSB_LIBRSB_TARBALL # TODO: alternative: --with-librsb=tarball will skip all checks and use that tarball if test "$have_rsb" != "yes" ; then as_fn_error $? "$PACKAGE_NAME requires librsb library" "$LINENO" 5 fi SPARSERSB_CXX11="-std=gnu++11" ac_config_files="$ac_config_files Makeconf" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by octave sparsersb package $as_me 1.0.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ octave sparsersb package config.status 1.0.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makeconf") CONFIG_FILES="$CONFIG_FILES Makeconf" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: $PACKAGE_NAME is configured with: SPARSERSB_LDFLAGS: $SPARSERSB_LDFLAGS SPARSERSB_CXXFLAGS: $SPARSERSB_CXXFLAGS SPARSERSB_CXX11: $SPARSERSB_CXX11 OCTAVE: $OCTAVE MKOCTFILE: $MKOCTFILE You can build it with 'make' and after on, test with 'make tests'. " >&5 $as_echo "$as_me: $PACKAGE_NAME is configured with: SPARSERSB_LDFLAGS: $SPARSERSB_LDFLAGS SPARSERSB_CXXFLAGS: $SPARSERSB_CXXFLAGS SPARSERSB_CXX11: $SPARSERSB_CXX11 OCTAVE: $OCTAVE MKOCTFILE: $MKOCTFILE You can build it with 'make' and after on, test with 'make tests'. " >&6;} sparsersb-1.0.5/src/configure.ac0000644000000000000000000001613013066547510014774 0ustar0000000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) AC_INIT([octave sparsersb package], [1.0.5]) dnl AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CXX AC_LANG(C++) AC_CHECK_TOOL([OCTAVE], [octave], [none]) AC_CHECK_TOOL([MKOCTFILE], [mkoctfile], [none]) AC_ARG_VAR([MKOCTFILE],[The mkoctfile executable]) AC_ARG_VAR([OCTAVE],[The octave executable]) AC_ARG_VAR([SPARSERSB_LDFLAGS],[Linking flags for sparsersb]) AC_ARG_VAR([SPARSERSB_CXXFLAGS],[C++ compilation flags for sparsersb]) AC_ARG_VAR([SPARSERSB_CXX11],[C++11 additional compilation flags for sparsersb]) AC_ARG_VAR([LIBRSB_TARBALL],[Environment variable equivalent for --with-librsb-tarball=..]) if [ test "$MKOCTFILE" = "none" ]; then AC_MSG_ERROR([mkoctfile required to install $PACKAGE_NAME]) fi # Checks for librsb have_rsb=no librsb_conf='no' librsb_conf_static='no' # internal AC_ARG_WITH(static-librsb, [ --with-static-librsb=[yes|no] Whether to use static linking with the librsb-conf script. (recommended: yes).], [ librsb_conf_static=$withval; if x"$librsb_conf_static" != xyes -a x"$librsb_conf_static" != xno ; then AC_MSG_ERROR([--static-librsb=yes or --static-librsb=no !! ]) fi ], [ ]) # BEGIN tarball-based on-the-fly install of librsb AC_ARG_WITH(librsb-tarball, [ --with-librsb-tarball=... Will use specified user provided librsb tarball (e.g. librsb-1.2.0.tar.gz) to build a local librsb installation. You can specify LIBRSB_CFLAGS to customize. With this option --with-librsb-conf will be ignored.], [ librsb_tarball=$withval ], [ librsb_tarball=no ]) if [ test x"$LIBRSB_TARBALL" != "x" ]; then AC_MSG_NOTICE([Detected user-set LIBRSB_TARBALL=... variable; equivalent to --with-librsb-tarball=... .]) librsb_tarball="$LIBRSB_TARBALL" else AC_MSG_NOTICE([No user-set LIBRSB_TARBALL environment variable detected (set it to build using a custom librsb tarball).]) fi if test x"$librsb_tarball" != x"no" ; then dnl AC_MSG_WARN([...]) AC_MSG_NOTICE([Will create a local librsb build from user provided "$librsb_tarball" tarball. Will use default LIBRSB_CFLAGS.]) test -f ${librsb_tarball} || AC_MSG_ERROR([Are you sure of having file $librsb_tarball ?]) tar xzf "$librsb_tarball" || AC_MSG_ERROR([Error uncompressing "$librsb_tarball" ?]) librsb_dir=`basename $librsb_tarball` librsb_dir=${librsb_dir/.tar.gz/} test -d "$librsb_dir" || AC_MSG_ERROR([Error accessing "$librsb_dir" -- are you sure you provided a valid librsb tarball ?]) dnl LIBRSB_PREFIX="${LIBRSB_PREFIX:-`pwd`/local}" LIBRSB_PREFIX="`pwd`/local" cd "$librsb_dir" || AC_MSG_ERROR([Error entering "$librsb_dir" -- are you sure you provided a valid librsb tarball ?]) # LIBRSB_CFLAGS="${LIBRSB_CFLAGS:--O3 -fPIC}" AC_MSG_NOTICE([Stepped in "$librsb_dir".]) dnl AC_MSG_NOTICE([Configuring with LIBRSB_PREFIX=$LIBRSB_PREFIX ]) AC_MSG_NOTICE([Configuring with LIBRSB_CFLAGS=$LIBRSB_CFLAGS ]) ./configure OCTAVE='false' CFLAGS="${LIBRSB_CFLAGS}" --prefix="${LIBRSB_PREFIX}" --disable-fortran-examples --disable-c-examples AC_MSG_NOTICE([Configured successfully.]) make || AC_MSG_ERROR([Make step failed !]) AC_MSG_NOTICE([Built successfully.]) make install || AC_MSG_ERROR([Make step failed !]) cd - librsb_conf="${LIBRSB_PREFIX}"/bin/librsb-config test -f ${librsb_conf} || AC_MSG_ERROR([Temporary librsb installation config file ${librsb_conf} not executable ? Something went wrong with the install ?!]) AC_MSG_NOTICE([Temporary librsb installation in ${LIBRSB_PREFIX} done.]) AC_MSG_NOTICE([Forcing static linking due to temporary librsb.]) librsb_conf_static='yes' else AC_MSG_NOTICE([No librsb tarball provided: following the default procedure.]) true; fi # END tarball-based on-the-fly install of librsb if test x"$librsb_conf" = x"no" ; then AC_ARG_WITH(librsb-conf, [ --with-librsb-conf=... Path to the librsb-conf program which will be used to recover SPARSERSB_CXXFLAGS and SPARSERSB_LDFLAGS (unless specified explicitly).], [ librsb_conf=$withval ], [ librsb_conf=no ]) else AC_MSG_NOTICE([Using ${librsb_conf} config file from the local librsb installation.]) fi if test x"$librsb_conf" != x"no" ; then AC_MSG_NOTICE([Using user provided $librsb_conf script for librsb.]) else dnl AC_MSG_NOTICE([Probing for a librsb-config script...]) AC_CHECK_PROG([HAVE_LIBRSB_CONFIG], [librsb-config], [yes], [no]) if [test "x$HAVE_LIBRSB_CONFIG" != x"no"]; then librsb_conf=librsb-config fi fi if [test x"$SPARSERSB_CXXFLAGS" != "x" ]; then AC_MSG_NOTICE([Using user set SPARSERSB_CXXFLAGS...]) else if [test x"$librsb_conf" != x"no"]; then AC_MSG_NOTICE([Setting SPARSERSB_CXXFLAGS from $librsb_conf --I_opts...]) SPARSERSB_CXXFLAGS="`$librsb_conf --I_opts`" fi fi if test -x `which $OCTAVE-cli` ; then OCTAVE_CLI="$OCTAVE-cli"; else OCTAVE_CLI="$OCTAVE"; fi SPARSERSB_USE_64BIT_IDX=`$OCTAVE_CLI --no-line-editing -qf --eval 'printf ("%i", sizemax() > intmax ("int32"))'` if [test x"$SPARSERSB_USE_64BIT_IDX" = x"1" ]; then AC_MSG_NOTICE([Adding -D RSBOI_DETECTED_LONG_IDX to SPARSERSB_CXXFLAGS ...]) SPARSERSB_CXXFLAGS="$SPARSERSB_CXXFLAGS -D RSBOI_DETECTED_LONG_IDX=1" fi if [test x"$SPARSERSB_LDFLAGS" != "x" ]; then AC_MSG_NOTICE([Using user set SPARSERSB_LDFLAGS...]) else if [test x"$librsb_conf" != x"no"]; then if [test x"$librsb_conf_static" = x"no"]; then AC_MSG_NOTICE([Setting SPARSERSB_LDFLAGS from --L_opts --libs]) SPARSERSB_LDFLAGS="`$librsb_conf --L_opts --libs`" else AC_MSG_NOTICE([Setting SPARSERSB_LDFLAGS from --static --libs --extra_libs]) SPARSERSB_LDFLAGS="`$librsb_conf --static --libs --extra_libs`" fi fi fi if [test x"$SPARSERSB_CXXFLAGS" = "x" ]; then AC_CHECK_HEADERS([rsb.h], [AC_SEARCH_LIBS([rsb_lib_init], [rsb], [SPARSERSB_CXXFLAGS=" "], [])], [] ) fi if [test x"$SPARSERSB_LDFLAGS" = "x" ]; then AC_CHECK_HEADERS([rsb.h], [AC_SEARCH_LIBS([rsb_lib_init], [rsb], [SPARSERSB_LDFLAGS="-lrsb"], [])], [] ) fi if [test x"$SPARSERSB_CXXFLAGS" = "x" ]; then AC_MSG_ERROR([$PACKAGE_NAME SPARSERSB_CXXFLAGS (librsb not detected)!]) fi if [test x"$SPARSERSB_LDFLAGS" = "x" ]; then AC_MSG_ERROR([$PACKAGE_NAME requires SPARSERSB_LDFLAGS (librsb not detected)!]) fi have_rsb=yes AC_MSG_NOTICE([SPARSERSB_CXXFLAGS is $SPARSERSB_CXXFLAGS]) AC_MSG_NOTICE([SPARSERSB_LDFLAGS is $SPARSERSB_LDFLAGS]) # TODO: alternative: build librsb with SPARSERSB_LIBRSB_TARBALL # TODO: alternative: --with-librsb=tarball will skip all checks and use that tarball if [ test "$have_rsb" != "yes" ]; then AC_MSG_ERROR([$PACKAGE_NAME requires librsb library]) fi AC_SUBST(OCTAVE) AC_SUBST(TARGETS) AC_SUBST(SPARSERSB_CXXFLAGS) AC_SUBST(SPARSERSB_CXX11, ["-std=gnu++11"]) AC_SUBST(SPARSERSB_LDFLAGS) AC_CONFIG_FILES([Makeconf]) AC_OUTPUT AC_MSG_NOTICE([ $PACKAGE_NAME is configured with: SPARSERSB_LDFLAGS: $SPARSERSB_LDFLAGS SPARSERSB_CXXFLAGS: $SPARSERSB_CXXFLAGS SPARSERSB_CXX11: $SPARSERSB_CXX11 OCTAVE: $OCTAVE MKOCTFILE: $MKOCTFILE dnl LIBS: $LIBS dnl CXXFLAGS: $CXXFLAGS $DEFS dnl TARGETS: $TARGETS You can build it with 'make' and after on, test with 'make tests'. ]) sparsersb-1.0.5/src/ext/0000755000000000000000000000000013066547510013305 5ustar0000000000000000sparsersb-1.0.5/src/ext/gettok.m0000644000000000000000000000121713066547510014761 0ustar0000000000000000function [word, remainder] = gettok(string) % % function [word, remainder] = gettok(string) % % Retrieves the first blank separated token from the string. % si = findstr(string,' '); lstring=length(string); lsi=length(si); if ( lsi == 0 ) word=string; remainder=''; return end firstb=si(1); if ( firstb > 1 ) word=string(1:firstb-1); remainder=string(firstb+1:lstring); return; end tmp=1; while ( tmp < lsi ) if ( si(tmp+1) == si(tmp)+1 ) tmp=tmp+1; else break; end end if ( tmp == lstring ) word=-1; remainder=string; return; end word=string(si(tmp)+1:si(tmp+1)-1); remainder=string(si(tmp+1)+1:lstring); sparsersb-1.0.5/src/ext/mminfo.m0000644000000000000000000000624613066547510014760 0ustar0000000000000000function [rows, cols, entries, rep, field, symm] = mminfo(filename) % % function [rows, cols, entries, rep, field, symmetry] = mminfo(filename) % % Reads the contents of the Matrix Market file 'filename' % and extracts size and storage information. % % In the case of coordinate matrices, entries refers to the % number of coordinate entries stored in the file. The number % of non-zero entries in the final matrix cannot be determined % until the data is read (and symmetrized, if necessary). % % In the case of array matrices, entries is the product % rows*cols, regardless of whether symmetry was used to % store the matrix efficiently. % % mmfile = fopen(filename,'r'); if ( mmfile == -1 ) disp(filename); error('File not found'); end; header = fgets(mmfile); if (header == -1 ) error('Empty file.') end % NOTE: If using a version of Matlab for which strtok is not % defined, substitute 'gettok' for 'strtok' in the % following lines, and download gettok.m from the % Matrix Market site. [head0,header] = strtok(header); % see note above [head1,header] = strtok(header); [rep,header] = strtok(header); [field,header] = strtok(header); [symm,header] = strtok(header); head1 = lower(head1); rep = lower(rep); field = lower(field); symm = lower(symm); if ( length(symm) == 0 ) disp('Not enough words in header line.') disp('Recognized format: ') disp('%%MatrixMarket matrix representation field symmetry') error('Check header line.') end if ( ~ strcmp(head0,'%%MatrixMarket') ) error('Not a valid MatrixMarket header.') end if ( ~ strcmp(head1,'matrix') ) disp(['This seems to be a MatrixMarket ',head1,' file.']); disp('This function only knows how to read MatrixMarket matrix files.'); disp(' '); error(' '); end % Read through comments, ignoring them commentline = fgets(mmfile); while length(commentline) > 0 & commentline(1) == '%', commentline = fgets(mmfile); end % Read size information, then branch according to % sparse or dense format if ( strcmp(rep,'coordinate')) % read matrix given in sparse % coordinate matrix format [sizeinfo,count] = sscanf(commentline,'%d%d%d'); while ( count == 0 ) commentline = fgets(mmfile); if (commentline == -1 ) error('End-of-file reached before size information was found.') end [sizeinfo,count] = sscanf(commentline,'%d%d%d'); if ( count > 0 & count ~= 3 ) error('Invalid size specification line.') end end rows = sizeinfo(1); cols = sizeinfo(2); entries = sizeinfo(3); elseif ( strcmp(rep,'array') ) % read matrix given in dense % array (column major) format [sizeinfo,count] = sscanf(commentline,'%d%d'); while ( count == 0 ) commentline = fgets(mmfile); if (commentline == -1 ) error('End-of-file reached before size information was found.') end [sizeinfo,count] = sscanf(commentline,'%d%d'); if ( count > 0 & count ~= 2 ) error('Invalid size specification line.') end end rows = sizeinfo(1); cols = sizeinfo(2); entries = rows*cols; end fclose(mmfile); % Done. sparsersb-1.0.5/src/ext/mmread.m0000644000000000000000000001777513066547510014751 0ustar0000000000000000# 20070301 # Slightly modified by Michele Martone for handling complex dense arrays with parenthesis,too # But there still a bug (original!): the first line MUST be space terminated.. function [A,rows,cols,entries,rep,field,symm] = mmread(filename) % % function [A] = mmread(filename) % % function [A,rows,cols,entries,rep,field,symm] = mmread(filename) % % Reads the contents of the Matrix Market file 'filename' % into the matrix 'A'. 'A' will be either sparse or full, % depending on the Matrix Market format indicated by % 'coordinate' (coordinate sparse storage), or % 'array' (dense array storage). The data will be duplicated % as appropriate if symmetry is indicated in the header. % % Optionally, size information about the matrix can be % obtained by using the return values rows, cols, and % entries, where entries is the number of nonzero entries % in the final matrix. Type information can also be retrieved % using the optional return values rep (representation), field, % and symm (symmetry). % mmfile = fopen(filename,'rb');#'b' added by MM if ( mmfile == -1 ) disp(filename); error('File not found'); end; header = fgets(mmfile); if (header == -1 ) error('Empty file.') end % NOTE: If using a version of Matlab for which strtok is not % defined, substitute 'gettok' for 'strtok' in the % following lines, and download gettok.m from the % Matrix Market site. [head0,header] = strtok(header); % see note above [head1,header] = strtok(header); [rep,header] = strtok(header); [field,header] = strtok(header); [symm,header] = strtok(header); head1 = lower(head1); rep = lower(rep); field = lower(field); symm = lower(symm); if ( length(symm) == 0 ) disp(['Not enough words in header line of file ',filename]) disp('Recognized format: ') disp('%%MatrixMarket matrix representation field symmetry') error('Check header line.') end if ( ~ strcmp(head0,'%%MatrixMarket') ) error('Not a valid MatrixMarket header.') end if ( ~ strcmp(head1,'matrix') ) disp(['This seems to be a MatrixMarket ',head1,' file.']); disp('This function only knows how to read MatrixMarket matrix files.'); disp(' '); error(' '); end % Read through comments, ignoring them commentline = fgets(mmfile); while length(commentline) > 0 & commentline(1) == '%', commentline = fgets(mmfile); end % Read size information, then branch according to % sparse or dense format if ( strcmp(rep,'coordinate')) % read matrix given in sparse % coordinate matrix format [sizeinfo,count] = sscanf(commentline,'%d%d%d'); while ( count == 0 ) commentline = fgets(mmfile); if (commentline == -1 ) error('End-of-file reached before size information was found.') end [sizeinfo,count] = sscanf(commentline,'%d%d%d'); if ( count > 0 & count ~= 3 ) error('Invalid size specification line.') end end rows = sizeinfo(1); cols = sizeinfo(2); entries = sizeinfo(3); if ( strcmp(field,'real') ) % real valued entries: [T,count] = fscanf(mmfile,'%f',3); T = [T; fscanf(mmfile,'%f')]; if ( size(T) ~= 3*entries ) message = ... str2mat('Data file does not contain expected amount of data.',... 'Check that number of data lines matches nonzero count.'); disp(message); error('Invalid data.'); end T = reshape(T,3,entries)'; A = sparse(T(:,1), T(:,2), T(:,3), rows , cols); elseif ( strcmp(field,'complex')) % complex valued entries: T = fscanf(mmfile,'%f',4); T = [T; fscanf(mmfile,'%f')]; if ( size(T) ~= 4*entries ) message = ... str2mat('Data file does not contain expected amount of data.',... 'Check that number of data lines matches nonzero count.'); disp(message); error('Invalid data.'); end T = reshape(T,4,entries)'; A = sparse(T(:,1), T(:,2), T(:,3) + T(:,4)*sqrt(-1), rows , cols); elseif ( strcmp(field,'pattern')) % pattern matrix (no values given): T = fscanf(mmfile,'%f',2); T = [T; fscanf(mmfile,'%f')]; if ( size(T) ~= 2*entries ) message = ... str2mat('Data file does not contain expected amount of data.',... 'Check that number of data lines matches nonzero count.'); disp(message); error('Invalid data.'); end T = reshape(T,2,entries)'; A = sparse(T(:,1), T(:,2), ones(entries,1) , rows , cols); end elseif ( strcmp(rep,'array') ) % read matrix given in dense % array (column major) format [sizeinfo,count] = sscanf(commentline,'%d%d'); while ( count == 0 ) commentline = fgets(mmfile); if (commentline == -1 ) error('End-of-file reached before size information was found.') end [sizeinfo,count] = sscanf(commentline,'%d%d'); if ( count > 0 & count ~= 2 ) error('Invalid size specification line.') end end rows = sizeinfo(1); cols = sizeinfo(2); entries = rows*cols; if ( strcmp(field,'real') ) % real valued entries: A = fscanf(mmfile,'%f',1); A = [A; fscanf(mmfile,'%f')]; if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) for j=1:cols-1, currenti = j*rows; A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))]; end elseif ( ~ strcmp(symm,'general') ) disp('Unrecognized symmetry') disp(symm) disp('Recognized choices:') disp(' symmetric') disp(' hermitian') disp(' skew-symmetric') disp(' general') error('Check symmetry specification in header.'); end A = reshape(A,rows,cols); elseif ( strcmp(field,'complex')) % complx valued entries: %tmpr = fscanf(mmfile,'%f',1); %tmpi = fscanf(mmfile,'%f',1); % no braindead code please.. [tmpr,_c] = fscanf(mmfile,'%f',1); [tmpi,_c] = fscanf(mmfile,'%f',1); if(_c!=1) fscanf(mmfile,'('); [tmpr,_c] = fscanf(mmfile,'%f' ,1); fscanf(mmfile,','); [tmpi,_c] = fscanf(mmfile,'%f',1); fscanf(mmfile,')'); endif A=reshape(zeros(entries,1).+0*i,entries,1); % A = tmpr+tmpi*i; A(1) = tmpr+tmpi*i; % for j=1:entries-1 for j=2:entries % now the algorithm is slightly different! [tmpr,_c] = fscanf(mmfile,'%f',1); [tmpi,_c] = fscanf(mmfile,'%f',1); if(_c!=1) fscanf(mmfile,'('); [tmpr,_c] = fscanf(mmfile,'%f' ,1); fscanf(mmfile,','); [tmpi,_c] = fscanf(mmfile,'%f',1); fscanf(mmfile,')'); endif % A = [A; tmpr + tmpi*i] % <- braindead code! A(j)=tmpr+tmpi*i; % printf("%f,%f",A(j)); end if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) for j=1:cols-1, currenti = j*rows; A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))]; end elseif ( strcmp(symm,'general') ) %elseif ( ~ strcmp(symm,'general') ) disp('Unrecognized symmetry') disp(symm) disp('Recognized choices:') disp(' symmetric') disp(' hermitian') disp(' skew-symmetric') disp(' general') error('Check symmetry specification in header.'); end A = reshape(A,rows,cols); elseif ( strcmp(field,'pattern')) % pattern (makes no sense for dense) disp('Matrix type:',field) error('Pattern matrix type invalid for array storage format.'); else % Unknown matrix type disp('Matrix type:',field) error('Invalid matrix type specification. Check header against MM documentation.'); end end % % If symmetric, skew-symmetric or Hermitian, duplicate lower % triangular part and modify entries as appropriate: % if ( strcmp(symm,'symmetric') ) A = A + A.' - diag(diag(A)); entries = nnz(A); elseif ( strcmp(symm,'hermitian') ) A = A + A' - diag(diag(A)); entries = nnz(A); elseif ( strcmp(symm,'skew-symmetric') ) A = A - A'; entries = nnz(A); end fclose(mmfile); % Done. sparsersb-1.0.5/src/ext/mmreadm.m0000644000000000000000000002010113066547510015077 0ustar0000000000000000% 20111022 % Slightly modified by Michele Martone for Matlab at IPP MPG. % 20070301 % Slightly modified by Michele Martone for handling complex dense arrays with parenthesis,too % But there still a bug (original!): the first line MUST be space terminated.. function [A,rows,cols,entries,rep,field,symm] = mmreadm(filename) % % function [A] = mmreadm(filename) % % function [A,rows,cols,entries,rep,field,symm] = mmreadm(filename) % % Reads the contents of the Matrix Market file 'filename' % into the matrix 'A'. 'A' will be either sparse or full, % depending on the Matrix Market format indicated by % 'coordinate' (coordinate sparse storage), or % 'array' (dense array storage). The data will be duplicated % as appropriate if symmetry is indicated in the header. % % Optionally, size information about the matrix can be % obtained by using the return values rows, cols, and % entries, where entries is the number of nonzero entries % in the final matrix. Type information can also be retrieved % using the optional return values rep (representation), field, % and symm (symmetry). % mmfile = fopen(filename,'rb');%'b' added by MM if ( mmfile == -1 ) disp(filename); error('File not found'); end; header = fgets(mmfile); if (header == -1 ) error('Empty file.') end % NOTE: If using a version of Matlab for which strtok is not % defined, substitute 'gettok' for 'strtok' in the % following lines, and download gettok.m from the % Matrix Market site. [head0,header] = gettok(header); % see note above [head1,header] = gettok(header); [rep,header] = gettok(header); [field,header] = gettok(header); [symm,header] = gettok(header); head1 = lower(head1); rep = lower(rep); field = lower(field); symm = lower(symm); if ( length(symm) == 0 ) disp(['Not enough words in header line of file ',filename]) disp('Recognized format: ') disp('%%MatrixMarket matrix representation field symmetry') error('Check header line.') end if ( ~ strcmp(head0,'%%MatrixMarket') ) error('Not a valid MatrixMarket header.') end if ( ~ strcmp(head1,'matrix') ) disp(['This seems to be a MatrixMarket ',head1,' file.']); disp('This function only knows how to read MatrixMarket matrix files.'); disp(' '); error(' '); end % Read through comments, ignoring them commentline = fgets(mmfile); while length(commentline) > 0 & commentline(1) == '%', commentline = fgets(mmfile); end % Read size information, then branch according to % sparse or dense format if ( strcmp(rep,'coordinate')) % read matrix given in sparse % coordinate matrix format [sizeinfo,count] = sscanf(commentline,'%d%d%d'); while ( count == 0 ) commentline = fgets(mmfile); if (commentline == -1 ) error('End-of-file reached before size information was found.') end [sizeinfo,count] = sscanf(commentline,'%d%d%d'); if ( count > 0 & count ~= 3 ) error('Invalid size specification line.') end end rows = sizeinfo(1); cols = sizeinfo(2); entries = sizeinfo(3); if ( strcmp(field,'real') ) % real valued entries: [T,count] = fscanf(mmfile,'%f',3); T = [T; fscanf(mmfile,'%f')]; if ( size(T) ~= 3*entries ) message = ... str2mat('Data file does not contain expected amount of data.',... 'Check that number of data lines matches nonzero count.'); disp(message); error('Invalid data.'); end T = reshape(T,3,entries)'; A = sparse(T(:,1), T(:,2), T(:,3), rows , cols); elseif ( strcmp(field,'complex')) % complex valued entries: T = fscanf(mmfile,'%f',4); T = [T; fscanf(mmfile,'%f')]; if ( size(T) ~= 4*entries ) message = ... str2mat('Data file does not contain expected amount of data.',... 'Check that number of data lines matches nonzero count.'); disp(message); error('Invalid data.'); end T = reshape(T,4,entries)'; A = sparse(T(:,1), T(:,2), T(:,3) + T(:,4)*sqrt(-1), rows , cols); elseif ( strcmp(field,'pattern')) % pattern matrix (no values given): T = fscanf(mmfile,'%f',2); T = [T; fscanf(mmfile,'%f')]; if ( size(T) ~= 2*entries ) message = ... str2mat('Data file does not contain expected amount of data.',... 'Check that number of data lines matches nonzero count.'); disp(message); error('Invalid data.'); end T = reshape(T,2,entries)'; A = sparse(T(:,1), T(:,2), ones(entries,1) , rows , cols); end elseif ( strcmp(rep,'array') ) % read matrix given in dense % array (column major) format [sizeinfo,count] = sscanf(commentline,'%d%d'); while ( count == 0 ) commentline = fgets(mmfile); if (commentline == -1 ) error('End-of-file reached before size information was found.') end [sizeinfo,count] = sscanf(commentline,'%d%d'); if ( count > 0 & count ~= 2 ) error('Invalid size specification line.') end end rows = sizeinfo(1); cols = sizeinfo(2); entries = rows*cols; if ( strcmp(field,'real') ) % real valued entries: A = fscanf(mmfile,'%f',1); A = [A; fscanf(mmfile,'%f')]; if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) for j=1:cols-1, currenti = j*rows; A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))]; end elseif ( ~ strcmp(symm,'general') ) disp('Unrecognized symmetry') disp(symm) disp('Recognized choices:') disp(' symmetric') disp(' hermitian') disp(' skew-symmetric') disp(' general') error('Check symmetry specification in header.'); end A = reshape(A,rows,cols); elseif ( strcmp(field,'complex')) % complx valued entries: %tmpr = fscanf(mmfile,'%f',1); %tmpi = fscanf(mmfile,'%f',1); % no braindead code please.. [tmpr,c] = fscanf(mmfile,'%f',1); [tmpi,c] = fscanf(mmfile,'%f',1); if(ne(c,1)) fscanf(mmfile,'('); [tmpr,c] = fscanf(mmfile,'%f' ,1); fscanf(mmfile,','); [tmpi,c] = fscanf(mmfile,'%f',1); fscanf(mmfile,')'); end A=reshape(zeros(entries,1) +0*i,entries,1); % A = tmpr+tmpi*i; A(1) = tmpr+tmpi*i; % for j=1:entries-1 for j=2:entries % now the algorithm is slightly different! [tmpr,c] = fscanf(mmfile,'%f',1); [tmpi,c] = fscanf(mmfile,'%f',1); if(ne(c,1)) fscanf(mmfile,'('); [tmpr,c] = fscanf(mmfile,'%f' ,1); fscanf(mmfile,','); [tmpi,c] = fscanf(mmfile,'%f',1); fscanf(mmfile,')'); end % A = [A; tmpr + tmpi*i] % <- braindead code! A(j)=tmpr+tmpi*i; % printf("%f,%f",A(j)); end if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) for j=1:cols-1, currenti = j*rows; A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))]; end elseif ( strcmp(symm,'general') ) %elseif ( ~ strcmp(symm,'general') ) disp('Unrecognized symmetry') disp(symm) disp('Recognized choices:') disp(' symmetric') disp(' hermitian') disp(' skew-symmetric') disp(' general') error('Check symmetry specification in header.'); end A = reshape(A,rows,cols); elseif ( strcmp(field,'pattern')) % pattern (makes no sense for dense) disp('Matrix type:',field) error('Pattern matrix type invalid for array storage format.'); else % Unknown matrix type disp('Matrix type:',field) error('Invalid matrix type specification. Check header against MM documentation.'); end end % % If symmetric, skew-symmetric or Hermitian, duplicate lower % triangular part and modify entries as appropriate: % if ( strcmp(symm,'symmetric') ) A = A + A.' - diag(diag(A)); entries = nnz(A); elseif ( strcmp(symm,'hermitian') ) A = A + A' - diag(diag(A)); entries = nnz(A); elseif ( strcmp(symm,'skew-symmetric') ) A = A - A'; entries = nnz(A); end fclose(mmfile); % Done. sparsersb-1.0.5/src/ext/mmwrite.m0000644000000000000000000001532413066547510015154 0ustar0000000000000000function [ err ] = mmwrite(filename,A,comment,field,precision) % % Function: mmwrite(filename,A,comment,field,precision) % % Writes the sparse or dense matrix A to a Matrix Market (MM) % formatted file. % % Required arguments: % % filename - destination file % % A - sparse or full matrix % % Optional arguments: % % comment - matrix of comments to prepend to % the MM file. To build a comment matrix, % use str2mat. For example: % % comment = str2mat(' Comment 1' ,... % ' Comment 2',... % ' and so on.',... % ' to attach a date:',... % [' ',date]); % If ommitted, a single line date stamp comment % will be included. % % field - 'real' % 'complex' % 'integer' % 'pattern' % If ommitted, data will determine type. % % precision - number of digits to display for real % or complex values % If ommitted, full working precision is used. % if ( nargin == 5) precision = 16; elseif ( nargin == 4) precision = 16; elseif ( nargin == 3) mattype = 'real'; % placeholder, will check after FIND-ing A precision = 16; elseif ( nargin == 2) comment = ''; % Check whether there is an imaginary part: mattype = 'real'; % placeholder, will check after FIND-ing A precision = 16; end mmfile = fopen([filename],'wb');#'b' added by MM if ( mmfile == -1 ) error('Cannot open file for output'); end; [M,N] = size(A); %%%%%%%%%%%%% This part for sparse matrices %%%%%%%%%%%%%%%% if ( issparse(A) ) [I,J,V] = find(A); if ( sum(abs(imag(nonzeros(V)))) > 0 ) Vreal = 0; else Vreal = 1; end if ( ~ strcmp(mattype,'pattern') & Vreal ) mattype = 'real'; elseif ( ~ strcmp(mattype,'pattern') ) mattype = 'complex'; end % % Determine symmetry: % if ( M ~= N ) symm = 'general'; issymm = 0; NZ = length(V); else issymm = 1; NZ = length(V); for i=1:NZ if ( A(J(i),I(i)) ~= V(i) ) issymm = 0; break; end end if ( issymm ) symm = 'symmetric'; ATEMP = tril(A); [I,J,V] = find(ATEMP); NZ = nnz(ATEMP); else isskew = 1; for i=1:NZ if ( A(J(i),I(i)) ~= - V(i) ) isskew = 0; break; end end if ( isskew ) symm = 'skew-symmetric'; ATEMP = tril(A); [I,J,V] = find(ATEMP); NZ = nnz(ATEMP); elseif ( strcmp(mattype,'complex') ) isherm = 1; for i=1:NZ if ( A(J(i),I(i)) ~= conj(V(i)) ) isherm = 0; break; end end if ( isherm ) symm = 'hermitian'; ATEMP = tril(A); [I,J,V] = find(ATEMP); NZ = nnz(ATEMP); else symm = 'general'; NZ = nnz(A); end else symm = 'general'; NZ = nnz(A); end end end % Sparse coordinate format: rep = 'coordinate'; fprintf(mmfile,'%%%%MatrixMarket matrix %s %s %s\n',rep,mattype,symm); [MC,NC] = size(comment); if ( MC == 0 ) fprintf(mmfile,'%% Generated %s\n',[date]); else for i=1:MC, fprintf(mmfile,'%%%s\n',comment(i,:)); end end fprintf(mmfile,'%d %d %d\n',M,N,NZ); cplxformat = sprintf('%%d %%d %% .%dg %% .%dg\n',precision,precision); realformat = sprintf('%%d %%d %% .%dg\n',precision); if ( strcmp(mattype,'real') ) for i=1:NZ fprintf(mmfile,realformat,I(i),J(i),V(i)); end; elseif ( strcmp(mattype,'complex') ) for i=1:NZ fprintf(mmfile,cplxformat,I(i),J(i),real(V(i)),imag(V(i))); end; elseif ( strcmp(mattype,'pattern') ) for i=1:NZ fprintf(mmfile,'%d %d\n',I(i),J(i)); end; else err = -1; disp('Unsupported mattype:') mattype end; %%%%%%%%%%%%% This part for dense matrices %%%%%%%%%%%%%%%% else if ( sum(abs(imag(nonzeros(A)))) > 0 ) Areal = 0; else Areal = 1; end if ( ~strcmp(mattype,'pattern') & Areal ) mattype = 'real'; elseif ( ~strcmp(mattype,'pattern') ) mattype = 'complex'; end % % Determine symmetry: % if ( M ~= N ) issymm = 0; symm = 'general'; else issymm = 1; for j=1:N for i=j+1:N if (A(i,j) ~= A(j,i) ) issymm = 0; break; end end if ( ~ issymm ) break; end end if ( issymm ) symm = 'symmetric'; else isskew = 1; for j=1:N for i=j+1:N if (A(i,j) ~= - A(j,i) ) isskew = 0; break; end end if ( ~ isskew ) break; end end if ( isskew ) symm = 'skew-symmetric'; elseif ( strcmp(mattype,'complex') ) isherm = 1; for j=1:N for i=j+1:N if (A(i,j) ~= conj(A(j,i)) ) isherm = 0; break; end end if ( ~ isherm ) break; end end if ( isherm ) symm = 'hermitian'; else symm = 'general'; end else symm = 'general'; end end end % Dense array format: rep = 'array'; [MC,NC] = size(comment); fprintf(mmfile,'%%%%MatrixMarket matrix %s %s %s\n',rep,mattype,symm); for i=1:MC, fprintf(mmfile,'%%%s\n',comment(i,:)); end; fprintf(mmfile,'%d %d\n',M,N); cplxformat = sprintf('%% .%dg %% .%dg\n', precision,precision); realformat = sprintf('%% .%dg\n', precision); if ( ~ strcmp(symm,'general') ) rowloop = 'j'; else rowloop = '1'; end if ( strcmp(mattype,'real') ) for j=1:N for i=eval(rowloop):M fprintf(mmfile,realformat,A(i,j)); end end elseif ( strcmp(mattype,'complex') ) for j=1:N for i=eval(rowloop):M fprintf(mmfile,cplxformat,real(A(i,j)),imag(A(i,j))); end end elseif ( strcmp(mattype,'pattern') ) err = -2 disp('Pattern type inconsistant with dense matrix') else err = -2 disp('Unknown matrix type:') mattype end end fclose(mmfile); sparsersb-1.0.5/src/matlabbench.sh0000755000000000000000000000030113066547510015276 0ustar0000000000000000#!/bin/bash if test $# != 1 ; then echo "Please supply a single Matrix Market file name at the command line." ; exit; fi matlab -nojvm -nodisplay -nodesktop -nosplash -r "matlabbench('"$1"')" sparsersb-1.0.5/src/sparsersb.cc0000644000000000000000000030605513066547510015031 0ustar0000000000000000/* Copyright (C) 2011-2017 Michele Martone 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 . */ /* * TODO wishlist (patches are welcome!): * adapt to when octave_idx_type is 64 bit long * rsb_file_vec_save (1.1) * all *.m files shall go to inst/ * switch to using bootstrap.sh (instead autogen.sh) and configure.ac with environment variables, so it can be called from pkg install sparsersb-1.0.5.tar.gz * produce ../doc/sparsersb.txi; can use get_help_text * put to ./devel/ what is not to be distributed * make or configure should fail on missing library (actually it does not) * spfind in order to update easily and quickly nonzeroes * need A(IA,JA,VA)=nVA * shall add "load"; implicit filename based is confusing * shall rename "load"/"save" to "loadMatrixMarket"/... or something explicit * save/load capability (in own, rsb format) * should not rely on string_value().c_str() --- stack corruption danger! * ("get","RSB_IO_WANT_...") is not yet available * (.) is incomplete. it is needed by trace() * (:,:) , (:,p) ... do not work, test with octave's bicg, bicgstab, cgs, ... * hints about how to influence caching blocking policy * compound_binary_op * for thorough testing, see Octave's test/build_sparse_tests.sh * introspection functionality (bytes/nnz, or sparsersb(rsbmat,"inquire: subm") ) * sparsersb(rsbmat,"benchmark") * sparsersb(rsbmat,"test") * minimize data copies * subsref, dotref, subsasgn are incomplete: need error messages there * in full_value(), bool arg is ignored * symmetry support is incomplete (scarcely defined) * document the semantics of the update and access operators * define more operators (e.g.: scaling) for 'complex' * create a single standard error macro for constructors * test sistematically all constructors * often missing array lenghts/type checks * may define as map (see is_map) so that "a.type = ..." can work * is_struct, find_nonzero_elem_idx are undefined * are octave_triangular_conv, default_numeric_conversion_function ok ? * error reporting is insufficient * update to symmetric be forbidden or rather trigger a conversion ? * after file read, return various structural info * norm computation * reformat code for readability * warnings about incomplete complex implementation may be overzealous. * need matrix exponentiation through conversion to octave format. * Note: although librsb has been optimized for performance, sparsersb is not. * Developer notes: http://www.gnu.org/software/octave/doc/interpreter/index.html http://www.gnu.org/software/octave/doc/interpreter/Oct_002dFiles.html#Oct_002dFiles http://octave.sourceforge.net/developers.html */ #define RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE 1 #include #include #include #include #include #include #include #if RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE #include // std::setprecision #endif #include //#define RSBOI_VERBOSE_CONFIG 1 /* poor man's trace facility */ #ifdef RSBOI_VERBOSE_CONFIG /* poor man's trace facility */ #if (RSBOI_VERBOSE_CONFIG>0) #define RSBOI_VERBOSE RSBOI_VERBOSE_CONFIG #endif #endif #define RSBOI_USE_PATCH_38143 ( defined(OCTAVE_MAJOR_VERSION) && (OCTAVE_MAJOR_VERSION>=4) ) /* See http://savannah.gnu.org/bugs/?48335#comment5 */ #if 0 #define RSBOI_WARN( MSG ) \ octave_stdout << "Warning in "<<__func__<<"(), in file "<<__FILE__<<" at line "<<__LINE__<<":\n" << MSG; #define RSBOI_FIXME( MSG ) RSBOI_WARN( MSG )/* new */ #else #define RSBOI_WARN( MSG ) #endif #define RSBOI_TODO( MSG ) RSBOI_WARN( MSG )/* new */ #define RSBOI_FIXME( MSG ) RSBOI_WARN( "FIXME: "MSG )/* new */ #define RSBOI_PRINTF( ... ) printf( __VA_ARGS__ ) #if RSBOI_VERBOSE //printf("In file %20s (in %s) at line %10d:\n",__FILE__,__func__,__LINE__), #define RSBOI_DEBUG_NOTICE( ... ) \ printf("In %s(), in file %s at line %10d:\n",__func__,__FILE__,__LINE__), \ printf( __VA_ARGS__ ) //#define RSBOI_ERROR( ... ) \ printf("In %s(), in file %s at line %10d:\n",__func__,__FILE__,__LINE__), \ printf( __VA_ARGS__ ) #define RSBOI_ERROR( MSG ) \ octave_stdout << "In "<<__func__<<"(), in file "<<__FILE__<<" at line "<<__LINE__<<":\n"<=201103L) ) #if RSBOI_USE_CXX11 #define RSBOI_NULL nullptr #else /* RSBOI_USE_CXX11 */ #define RSBOI_NULL NULL #endif /* RSBOI_USE_CXX11 */ #define RSBOI_INFOBUF 256 #define RSBOI_WANT_SYMMETRY 1 #define RSBOI_WANT_PRINT_DETAIL 0 #define RSBOI_WANT_PRINT_COMPLEX_OR_REAL 0 #define RSBOI_WANT_SUBSREF 1 #define RSBOI_WANT_HEAVY_DEBUG 0 #define RSBOI_WANT_VECLOAD_INSTEAD_MTX 1 #define RSBOI_WANT_MTX_LOAD 1 #define RSBOI_WANT_MTX_SAVE 1 #define RSBOI_WANT_POW 1 #define RSBOI_WANT_QSI 1 /* query string interface */ //#define RSBOI_PERROR(E) rsb_perror(E) #define RSBOI_PERROR(E) if(RSBOI_SOME_ERROR(E)) rsboi_strerr(E) #ifdef RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX #include #include #endif #ifndef RSBOI_RSB_MATRIX_SOLVE #define RSBOI_RSB_MATRIX_SOLVE(V1,V2) RSBOI_0_ERROR(RSBOI_0_NOTERRMSG) /* any solution routine shall attached here */ #endif #if 1 extern "C" { rsb_err_t rsb_dump_postscript_from_mtx_t(const struct rsb_mtx_t *mtxAp, rsb_blk_idx_t br, rsb_blk_idx_t bc, int width, int height, rsb_bool_t all_nnz); } extern "C" { rsb_err_t rsb_dump_postscript_recursion_from_mtx_t(const struct rsb_mtx_t *mtxAp, rsb_blk_idx_t br, rsb_blk_idx_t bc, int width, int height, rsb_flags_t flags, rsb_bool_t want_blocks, rsb_bool_t z_dump , rsb_bool_t want_nonzeros ); } #endif #if RSBOI_WANT_HEAVY_DEBUG extern "C" { rsb_bool_t rsb_is_correctly_built_rcsr_matrix(const struct rsb_mtx_t *mtxAp); // forward declaration } #endif #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) extern "C" { int rsb_do_get_nnz_element(struct rsb_mtx_t *,void*,void*,void*,int); } #endif #if RSBOI_WANT_DOUBLE_COMPLEX #define RSBOI_BINOP_PREVAILING_TYPE(V1,V2) (((V1).is_complex_type()||(V2).is_complex_type())?RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX:RSB_NUMERICAL_TYPE_DOUBLE) #else #define RSBOI_BINOP_PREVAILING_TYPE(V1,V2) RSBOI_TYPECODE #endif #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) #define RSBOI_10100_DOCH \ "@deftypefnx {Loadable Function} " RSBOI_FNS " (@var{S},\"render\", @var{filename}[, @var{rWidth}, @var{rHeight}])\n"\ "@deftypefnx {Loadable Function} {[@var{O} =]} " RSBOI_FNS " (@var{S},\"autotune\"[, @var{transA}, @var{nrhs}, @var{maxr}, @var{tmax}, @var{tn}, @var{sf}])\n"\ /* #define RSBOI_10100_DOC "If @var{S} is a " RSBOI_FNS " matrix and one of the \"render\",\"renderb\",\"renders\" keywords ... */ #define RSBOI_10100_DOC \ \ "If @var{S} is a " RSBOI_FNS " matrix and the \"render\" keyword is specified, and @var{filename} is a string, @var{A} will be rendered as an Encapsulated Postscript file @var{filename}. Optionally, width and height can be specified in @code{@var{rWidth}, @var{rHeight}}. Defaults are 512.\n"\ "\n"\ \ "If @var{S} is a " RSBOI_FNS " matrix and the \"autotune\" keyword is specified, autotuning of the matrix will take place, with SpMV and autotuning parameters. After the \"autotune\" string, the remaining parameters are optional. Parameter @var{transA} specifies whether to tune for untransposed (\"N\") or transposed (\"T\"); @var{nrhs} the number of right hand sides; @var{maxr} the number of tuning rounds; @var{tmax} the threads to use. If giving an output argument @var{O}, that will be assigned to the autotuned matrix, and the input one @var{A} will remain unchanged. See librsb documentation for @code{rsb_tune_spmm} to learn more.\n" #else #define RSBOI_10100_DOC "" #define RSBOI_10100_DOCH "" #endif #define RSBOI_VERSION 100005 /* e.g. 100005 means 1.0.5 */ #if defined(USE_64_BIT_IDX_T) || defined(OCTAVE_ENABLE_64) || defined(RSBOI_DETECTED_LONG_IDX) /* 4.1.0+ / 4.0.3 / any */ #define RSBOI_O64_R32 1 #else /* USE_64_BIT_IDX_T */ #define RSBOI_O64_R32 0 #endif /* USE_64_BIT_IDX_T */ #define RSBOI_SIZEMAX RSB_MAX_MATRIX_DIM /* Upper limit to librsb matrix dimension. */ static rsb_err_t rsboi_idxv_overflow( const idx_vector & IM, const idx_vector & JM) { rsb_err_t errval = RSB_ERR_NO_ERROR; if( IM.extent(0) > RSBOI_SIZEMAX || JM.extent(0) > RSBOI_SIZEMAX ) errval = RSB_ERR_LIMITS; return errval; } #if RSBOI_O64_R32 static rsb_err_t rsboi_idx_overflow( rsb_err_t *errvalp, octave_idx_type idx1, octave_idx_type idx2=0, octave_idx_type idx3=0) { rsb_err_t errval = RSB_ERR_NO_ERROR; if( idx1 > RSBOI_SIZEMAX || idx2 > RSBOI_SIZEMAX || idx3 > RSBOI_SIZEMAX ) errval = RSB_ERR_LIMITS; if( errvalp ) *errvalp = errval; return errval; } static void rsboi_oi2ri( octave_idx_type * IP, rsb_nnz_idx_t nnz) { // octave_idx_type -> rsb_coo_idx_t rsb_coo_idx_t * RP = (rsb_coo_idx_t *) IP; const octave_idx_type * OP = (const octave_idx_type*) IP; rsb_nnz_idx_t nzi; for(nzi=0;nzi octave_idx_type const rsb_coo_idx_t * RP = (const rsb_coo_idx_t *) IP; octave_idx_type * OP = (octave_idx_type*) IP; rsb_nnz_idx_t nzi; for(nzi=0;nzimtxAp = RSBOI_NULL; } octave_sparsersb_mtx (const octave_sparse_matrix &sm) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); } #if RSBOI_WANT_MTX_LOAD octave_sparsersb_mtx (const std::string &mtxfilename, rsb_type_t typecode = RSBOI_TYPECODE) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(!(this->mtxAp = rsb_file_mtx_load(mtxfilename.c_str(),RSBOI_RF,typecode,&errval))) #if RSBOI_WANT_VECLOAD_INSTEAD_MTX /* no problem */; #else RSBOI_ERROR(RSBOI_0_ALERRMSG); RSBOI_PERROR(errval); if(!this->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); #endif } #endif //void alloc_rsb_mtx_from_coo_copy(const idx_vector &IM, const idx_vector &JM, const void * SMp, octave_idx_type nrA, octave_idx_type ncA, bool iscomplex=false, rsb_flags_t eflags=RSBOI_DCF) void alloc_rsb_mtx_from_coo_copy(idx_vector & IM, idx_vector & JM, const void * SMp, octave_idx_type nrA, octave_idx_type ncA, bool iscomplex=false, rsb_flags_t eflags=RSBOI_DCF) { octave_idx_type nnzA = IM.length(); rsb_err_t errval = RSB_ERR_NO_ERROR; #if RSBOI_WANT_DOUBLE_COMPLEX rsb_type_t typecode = iscomplex?RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX:RSB_NUMERICAL_TYPE_DOUBLE; #else /* RSBOI_WANT_DOUBLE_COMPLEX */ rsb_type_t typecode = RSBOI_TYPECODE; #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ const octave_idx_type *IA = RSBOI_NULL,*JA = RSBOI_NULL; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); #if RSBOI_WANT_SYMMETRY /* shall verify if any symmetry is present */ #endif IA = (const octave_idx_type*)IM.raw(); JA = (const octave_idx_type*)JM.raw(); //RSB_DO_FLAG_ADD(eflags,rsb_util_determine_uplo_flags(IA,JA,nnzA)); if( (nrA==0 || ncA==0) && RSBOI_SOME_ERROR(errval=rsboi_idxv_overflow( IM, JM ))) goto err; if(!(this->mtxAp = rsboi_mtx_alloc_from_coo_const(SMp,(octave_idx_type*)IA,(octave_idx_type*)JA,nnzA,typecode,nrA,ncA,RSBOI_RB,RSBOI_CB,RSBOI_RF|eflags ,&errval))) RSBOI_ERROR(RSBOI_0_ALERRMSG); //RSBOI_MP(this->mtxAp); err: RSBOI_PERROR(errval); if(!this->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); } #if RSBOI_WANT_DOUBLE_COMPLEX octave_sparsersb_mtx (idx_vector &IM, idx_vector &JM, const ComplexMatrix &SM, octave_idx_type nrA, octave_idx_type ncA, rsb_flags_t eflags) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); this->alloc_rsb_mtx_from_coo_copy(IM,JM,SM.data(),nrA,ncA,true,eflags); } #endif octave_sparsersb_mtx (idx_vector &IM, idx_vector &JM, const Matrix &SM, octave_idx_type nrA, octave_idx_type ncA, rsb_flags_t eflags) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); this->alloc_rsb_mtx_from_coo_copy(IM,JM,SM.data(),nrA,ncA,false,eflags); } void alloc_rsb_mtx_from_csc_copy(const SparseMatrix &sm) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); rsb_nnz_idx_t nnzA = 0; Array IA( dim_vector(1,sm.nnz()) ); Array JA( dim_vector(1,sm.nnz()) ); rsb_err_t errval = RSB_ERR_NO_ERROR; /* bool islowtri=sm.is_lower_triangular(),isupptri=sm.is_upper_triangular(); */ rsb_flags_t eflags = RSBOI_RF; rsb_type_t typecode = RSB_NUMERICAL_TYPE_DOUBLE; octave_idx_type nrA = sm.rows (), ncA = sm.cols (); #if RSBOI_WANT_SYMMETRY if(sm.is_symmetric()) RSB_DO_FLAG_ADD(eflags,RSB_FLAG_LOWER_SYMMETRIC|RSB_FLAG_TRIANGULAR); #endif if(!(this->mtxAp = rsboi_mtx_alloc_from_csc_const(sm.data(),sm.ridx(),sm.cidx(), nnzA=sm.nnz(),typecode, nrA, ncA, RSBOI_RB, RSBOI_CB, eflags,&errval))) RSBOI_ERROR(RSBOI_0_ALLERRMSG); RSBOI_PERROR(errval); if(!this->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); } octave_sparsersb_mtx (const Matrix &m) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); SparseMatrix sm(m); this->alloc_rsb_mtx_from_csc_copy(sm); } #if RSBOI_WANT_DOUBLE_COMPLEX void alloc_rsb_mtx_from_csc_copy(const SparseComplexMatrix &sm) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); octave_idx_type nrA = sm.rows (); octave_idx_type ncA = sm.cols (); octave_idx_type nnzA = 0; Array IA( dim_vector(1,sm.nnz()) ); Array JA( dim_vector(1,sm.nnz()) ); rsb_err_t errval = RSB_ERR_NO_ERROR; /* bool islowtri=sm.is_lower_triangular(),isupptri=sm.is_upper_triangular(); */ rsb_flags_t eflags = RSBOI_RF; rsb_type_t typecode = RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX; #if RSBOI_WANT_SYMMETRY if(sm.is_hermitian()) RSB_DO_FLAG_ADD(eflags,RSB_FLAG_LOWER_HERMITIAN|RSB_FLAG_TRIANGULAR); #endif if(!(this->mtxAp = rsboi_mtx_alloc_from_csc_const(sm.data(),sm.ridx(),sm.cidx(), nnzA=sm.nnz(),typecode, nrA, ncA, RSBOI_RB, RSBOI_CB, eflags,&errval))) RSBOI_ERROR(RSBOI_0_ALLERRMSG); RSBOI_PERROR(errval); if(!this->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); } octave_sparsersb_mtx (const ComplexMatrix &cm) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); this->alloc_rsb_mtx_from_csc_copy(SparseComplexMatrix(cm)); } octave_sparsersb_mtx (const SparseComplexMatrix &sm, rsb_type_t typecode = RSBOI_TYPECODE) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); this->alloc_rsb_mtx_from_csc_copy(sm); } #endif octave_sparsersb_mtx (const SparseMatrix &sm, rsb_type_t typecode = RSBOI_TYPECODE) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); this->alloc_rsb_mtx_from_csc_copy(sm); } octave_sparsersb_mtx (struct rsb_mtx_t *mtxBp) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX), mtxAp(mtxBp) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(!this->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); } octave_sparsersb_mtx (const octave_sparsersb_mtx& T) : octave_sparse_matrix (T) { rsb_err_t errval = RSB_ERR_NO_ERROR; struct rsb_mtx_t *mtxBp = RSBOI_NULL; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_SAME_TYPE,RSB_TRANSPOSITION_N,RSBOI_NULL,T.mtxAp,RSBOI_EXPF); this->mtxAp = mtxBp; }; octave_idx_type length (void) const { return this->nnz(); } octave_idx_type nelem (void) const { return this->nnz(); } octave_idx_type numel (void) const { return this->nnz(); } octave_idx_type nnz (void) const { rsb_nnz_idx_t nnzA = 0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_NNZ__TO__RSB_NNZ_INDEX_T,&nnzA); return nnzA;} dim_vector dims (void) const { return (dim_vector(this->rows(),this->cols())); } octave_idx_type dim1 (void) const { return this->rows(); } octave_idx_type dim2 (void) const { return this->cols(); } octave_idx_type rows (void) const { rsb_coo_idx_t Anr=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_ROWS__TO__RSB_COO_INDEX_T,&Anr); return Anr;} octave_idx_type cols (void) const { rsb_coo_idx_t Anc=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_COLS__TO__RSB_COO_INDEX_T,&Anc); return Anc;} rsb_flags_t rsbflags(void) const { rsb_flags_t Aflags=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_FLAGS__TO__RSB_FLAGS_T,&Aflags); return Aflags;} rsb_type_t rsbtype(void) const { rsb_type_t Atype=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_TYPECODE__TO__RSB_TYPE_T,&Atype); return Atype;} //octave_idx_type rows (void) const { RSBOI_0_EMCHECK(this->mtxAp);return this->mtxAp->nrA; } //octave_idx_type cols (void) const { RSBOI_0_EMCHECK(this->mtxAp);return this->mtxAp->ncA; } octave_idx_type columns (void) const { return this->cols(); } octave_idx_type nzmax (void) const { return this->nnz(); } octave_idx_type capacity (void) const { return this->nnz(); } size_t byte_size (void) const { RSBOI_0_EMCHECK(this->mtxAp);size_t so=0;rsb_mtx_get_info(this->mtxAp,RSB_MIF_TOTAL_SIZE__TO__SIZE_T,&so);return so; } virtual ~octave_sparsersb_mtx (void) { RSBOI_DEBUG_NOTICE("destroying librsb matrix %p\n",this->mtxAp); RSBOI_DESTROY(this->mtxAp); } virtual octave_base_value *clone (void) const { RSBOI_DEBUG_NOTICE("cloning librsb matrix %p\n",this->mtxAp); return new octave_sparsersb_mtx (*this); } virtual octave_base_value *empty_clone (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return new octave_sparsersb_mtx (); } #if 0 octave_value do_index_op(const octave_value_list& idx, bool resize_ok) { ... } #endif virtual SparseMatrix sparse_matrix_value(bool = false)const { struct rsboi_coo_matrix_t rcm; rsb_err_t errval = RSB_ERR_NO_ERROR; rsb_nnz_idx_t nnzA,nzi; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_0_EMCHECK(this->mtxAp); nnzA = this->nnz(); Array IA( dim_vector(1,nnzA) ); Array JA( dim_vector(1,nnzA) ); Array VA( dim_vector(1,nnzA) ); rcm.IA = (octave_idx_type*)IA.data(),rcm.JA = (octave_idx_type*)JA.data(); if(!this->is_real_type()) { Array VAC( dim_vector(1,nnzA) ); RSBOI_T* VAp = ((RSBOI_T*)VA.data()); rcm.VA = (RSBOI_T*)VAC.data(); #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? shall we expand symmetry or not ? */ #endif /* FIXME: shall use some librsb's dedicated call for this */ errval = rsboi_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); for(nzi=0;nzimtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); } rcm.nrA = this->rows(); rcm.ncA = this->cols(); return SparseMatrix(VA,IA,JA,rcm.nrA,rcm.ncA); } virtual Matrix matrix_value(bool = false)const { RSBOI_FIXME("inefficient!"); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); Matrix cm = this->sparse_matrix_value().matrix_value(); return cm; } virtual octave_value full_value(void)const { RSBOI_FIXME("inefficient!"); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(this->is_real_type()) return this->matrix_value(); else return this->complex_matrix_value(); } #if RSBOI_WANT_DOUBLE_COMPLEX virtual ComplexMatrix complex_matrix_value(bool = false)const { RSBOI_FIXME("inefficient!"); octave_sparse_complex_matrix ocm = this->sparse_complex_matrix_value(); ComplexMatrix cm = ocm.complex_matrix_value(); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return cm; } virtual SparseComplexMatrix sparse_complex_matrix_value(bool = false)const { struct rsboi_coo_matrix_t rcm; rsb_err_t errval = RSB_ERR_NO_ERROR; rsb_nnz_idx_t nnzA,nzi; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_0_EMCHECK(this->mtxAp); nnzA = this->nnz(); Array IA( dim_vector(1,nnzA) ); Array JA( dim_vector(1,nnzA) ); Array VA( dim_vector(1,nnzA) ); RSBOI_T* VAp = ((RSBOI_T*)VA.data()); rcm.IA = (octave_idx_type*)IA.data(),rcm.JA = (octave_idx_type*)JA.data(); rcm.VA = VAp; errval = rsboi_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? shall we expand symmetry or not ? */ #endif /* FIXME: shall use some librsb's dedicated call for this */ if(this->is_real_type()) for(nzi=0;nzirows(); rcm.ncA = this->cols(); return SparseComplexMatrix(VA,IA,JA,rcm.nrA,rcm.ncA); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ //octave_value::assign_op, int, int, octave_value (&)(const octave_base_value&, const octave_base_value&) //octave_value::assign_op, int, int, octave_value (&) //octave_value assign_op (const octave_base_value&, const octave_base_value&) {} // octave_value::assign_op octave_value::binary_op_to_assign_op (binary_op op) { assign_op retval; return retval; } #if RSBOI_WANT_SUBSREF octave_value subsref (const std::string &type, const std::list& idx) { octave_value retval; int skip = 1; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); rsb_err_t errval = RSB_ERR_NO_ERROR; switch (type[0]) { case '(': if (type.length () == 1) { octave_idx_type n_idx = idx.front().length (); if (n_idx == 1 ) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); idx_vector i = idx.front() (0).index_vector (); #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER< 10100) octave_idx_type ii = i(0); RSBOI_ERROR(""); #elif defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) octave_idx_type ii = i(0); RSBOI_DEBUG_NOTICE("get_element (%d)\n",ii); if(is_real_type()) { RSBOI_T rv; errval = rsb_do_get_nnz_element(this->mtxAp,&rv,RSBOI_NULL,RSBOI_NULL,ii); retval = rv; } else { Complex rv; errval = rsb_do_get_nnz_element(this->mtxAp,&rv,RSBOI_NULL,RSBOI_NULL,ii); retval = rv; } if(RSBOI_SOME_ERROR(errval)) { if(ii>=this->nnz() || ii<0) error ("trying accessing element %d: index out of bounds !",ii+1); else error ("trying accessing element %d: this seems bug!",ii+1); } #endif } else if (n_idx == 2 ) { idx_vector i = idx.front() (0).index_vector (); if (! error_state) { #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? */ #endif if(is_real_type()) { idx_vector j = idx.front() (1).index_vector (); RSBOI_T rv; rsb_coo_idx_t ii = -1, jj = -1; ii = i(0); jj = j(0); RSBOI_DEBUG_NOTICE("get_elements (%d %d)\n",ii,jj); errval = rsb_mtx_get_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); retval = rv; if (! error_state) ; } else { idx_vector j = idx.front() (1).index_vector (); Complex rv; rsb_coo_idx_t ii =-1, jj = -1; ii = i(0); jj = j(0); RSBOI_DEBUG_NOTICE("get_elements (%d %d) complex\n",ii,jj); errval = rsb_mtx_get_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); retval = rv; if (! error_state) ; } } } } break; case '.': RSBOI_DEBUG_NOTICE("UNFINISHED\n"); break; case '{': error ("%s cannot be indexed with %c", type_name().c_str(), type[0]); break; default: panic_impossible (); } if (! error_state) retval = retval.next_subsref (type, idx, skip); return retval; } #else /* RSBOI_WANT_SUBSREF */ /* FIXME: need an alternative, bogus implementation of subsref */ #endif /* RSBOI_WANT_SUBSREF */ octave_value_list dotref (const octave_value_list& idx) { octave_value_list retval; std::string nm = idx(0).string_value (); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); /* if (nm == "type") if (isupper ()) retval = octave_value ("Upper"); else retval = octave_value ("Lower"); else*/ error ("%s can indexed with .%s", type_name().c_str(), nm.c_str()); return retval; } bool is_map (void) const { return true; } bool is_sparse_type (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return true; } bool is_real_type (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return this->rsbtype()==RSB_NUMERICAL_TYPE_DOUBLE?true:false; } bool is_diagonal (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_DIAGONAL)?true:false; }/* FIXME: new: not sure whether this is ever called */ bool is_lower_triangular (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_LOWER_TRIANGULAR)?true:false; }/* FIXME: new: not sure whether this is ever called */ bool is_upper_triangular (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_UPPER_TRIANGULAR)?true:false; }/* FIXME: new: not sure whether this is ever called */ bool is_complex_type (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return !is_real_type(); } bool is_bool_type (void) const { return false; } bool is_integer_type (void) const { return false; } bool is_square (void) const { return this->rows()==this->cols(); } bool is_empty (void) const { return false; } /* bool is__symmetric (void) const { if(RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC))return true; return false; }*/ /* new */ /* bool is__hermitian (void) const { if(RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_HERMITIAN))return true; return false; }*/ /* new */ std::string get_symmetry (void) const { return (RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC)?"S": (RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_HERMITIAN)?"H":"U")); } bool is__triangular (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(this->mtxAp #if RSBOI_WANT_SYMMETRY && ((!RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC)) || RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_DIAGONAL)) #endif ) { return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_TRIANGULAR)?RSB_BOOL_TRUE:RSB_BOOL_FALSE; } else return RSB_BOOL_FALSE; } // int is_struct (void) const { return false; } bool save_ascii (std::ostream& os) { error("save_ascii() " RSBOI_0_NIYERRMSG); return false; } bool load_ascii (std::istream& is) { error("load_ascii() " RSBOI_0_NIYERRMSG); return false; } bool save_binary (std::ostream& os, bool& save_as_floats) { error("save_binary() " RSBOI_0_NIYERRMSG); return false; } bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { error("load_binary() " RSBOI_0_NIYERRMSG); return false; } octave_value subsasgn (const std::string& type, const std::list& idx, const octave_value& rhs) { octave_value retval; rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); switch (type[0]) { case '(': { if (type.length () == 1) { //retval = numeric_assign (type, idx, rhs); //RSBOI_DEBUG_NOTICE("UNFINISHED\n"); octave_idx_type n_idx = idx.front().length (); switch (n_idx) { case 0: retval = matrix; RSBOI_DEBUG_NOTICE("UNFINISHED\n"); break; case 1: { RSBOI_DEBUG_NOTICE("UNFINISHED\n"); idx_vector i = idx.front()(0).index_vector (); if (! error_state) ;//retval = octave_value (matrix.index (i, resize_ok)); } break; default: { if (n_idx == 2 ) { idx_vector i = idx.front() (0).index_vector (); idx_vector j = idx.front() (1).index_vector (); #if 0 // for op_el_div_eq and op_el_mul_eq std :: cout << "ic2 " << i.is_colon() << "\n" ; if( i.is_colon() && !j.is_colon() ) { ComplexMatrix cm = rhs.complex_matrix_value(); std :: cout << " : , .\n"; errval=rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); } if(!i.is_colon() && j.is_colon() ) { std :: cout << " . , :\n"; } if( i.is_colon() && j.is_colon() ) { std :: cout << " : , :\n"; } #endif if (! error_state) { if(is_real_type()) { rsb_err_t errval = RSB_ERR_NO_ERROR; rsb_coo_idx_t ii = -1, jj = -1; RSBOI_T rv = rhs.double_value(); ii = i(0); jj = j(0); RSBOI_DEBUG_NOTICE("update elements (%d %d)\n",ii,jj); #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? */ #endif errval = rsb_mtx_set_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); RSBOI_PERROR(errval); /* FIXME: I am unsure, here */ //retval=rhs.double_value(); // this does not match octavej //retval=octave_value(this); retval = octave_value(this->clone()); // matches but .. heavy ?! if (! error_state) ;//retval = octave_value (matrix.index (i, j, resize_ok)); } else { rsb_err_t errval = RSB_ERR_NO_ERROR; rsb_coo_idx_t ii = -1, jj = -1; Complex rv = rhs.complex_value(); ii = i(0); jj = j(0); RSBOI_DEBUG_NOTICE("update elements (%d %d) complex\n",ii,jj); #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? */ #endif errval = rsb_mtx_set_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); RSBOI_PERROR(errval); /* FIXME: I am unsure, here */ //retval=rhs.double_value(); // this does not match octavej //retval=octave_value(this); retval = octave_value(this->clone()); // matches but .. heavy ?! if (! error_state) ;//retval = octave_value (matrix.index (i, j, resize_ok)); } // class octave_map; // retval = octave_map(); // RSBOI_DEBUG_NOTICE("UNFINISHED: set %d %d <- %lg\n",ii,jj,rhs.double_value()); } } } break; } } else if (type.length () == 2) { std::list::const_iterator p = idx.begin (); octave_value_list key_idx = *++p; std::string key = key_idx(0).string_value (); RSBOI_DEBUG_NOTICE("UNFINISHED\n"); if (key == "type") error ("use 'sparse_rsb' to set type"); else error ("%s can indexed with .%s", type_name().c_str(), key.c_str()); } else error ("in indexed assignment of %s, illegal assignment", type_name().c_str ()); } break; case '.': { octave_value_list key_idx = idx.front (); std::string key = key_idx(0).string_value (); RSBOI_DEBUG_NOTICE("UNFINISHED\n"); if (key == "type") error ("use 'sparse_rsb' to set matrix type"); else error ("%s can indexed with .%s", type_name().c_str(), key.c_str()); } break; case '{': RSBOI_DEBUG_NOTICE("UNFINISHED\n"); error ("%s cannot be indexed with %c", type_name().c_str (), type[0]); break; default: panic_impossible (); } return retval; } octave_base_value *try_narrowing_conversion (void) { octave_base_value *retval = 0; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); return retval; } /* type_conv_fcn numeric_conversion_function (void) const { } */ type_conv_info numeric_conversion_function (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return default_numeric_conversion_function; } std::string get_info_string() { char ss[RSBOI_INFOBUF]; rsb_mtx_get_info_str(this->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); return ss; } #if defined(OCTAVE_MAJOR_VERSION) && (OCTAVE_MAJOR_VERSION>=4) void print (std::ostream& os, bool pr_as_read_syntax = false) #else /* OCTAVE_MAJOR_VERSION */ void print (std::ostream& os, bool pr_as_read_syntax = false) const #endif /* OCTAVE_MAJOR_VERSION */ { RSBOI_FIXME("what to do with pr_as_read_syntax ?"); struct rsboi_coo_matrix_t rcm; rsb_err_t errval = RSB_ERR_NO_ERROR; rsb_nnz_idx_t nnzA = this->nnz(),nzi; bool ic = this->is_real_type()?false:true; Array IA( dim_vector(1,nnzA) ); Array JA( dim_vector(1,nnzA) ); Array VA( dim_vector(1,(ic?2:1)*nnzA) ); std::string c = ic ? "complex" : "real"; #if RSBOI_WANT_PRINT_DETAIL char ss[RSBOI_INFOBUF]; rsb_mtx_get_info_str(this->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); #endif RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); rcm.VA = (RSBOI_T*)VA.data(),rcm.IA = (octave_idx_type*)IA.data(),rcm.JA = (octave_idx_type*)JA.data(); #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? */ #endif if(rcm.VA==RSBOI_NULL) nnzA = 0; else errval = rsboi_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); rcm.nrA = this->rows(); rcm.ncA = this->cols(); double pct = 100.0*(((RSBOI_T)nnzA)/((RSBOI_T)rcm.nrA))/rcm.ncA; octave_stdout<rsbflags(),RSB_FLAG_SYMMETRIC)?"H":"U")) // FIXME: need a mechanism to print out these flags from rsb itself #endif ; #if RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE /* straight from Octave's src/ov-base-sparse.cc */ if (nnzA > 0) { int prec = 2; if (pct == 100) prec = 3; else { if (pct > 99.9) prec = 4; else if (pct > 99) prec = 3; if (pct > 99.99) pct = 99.99; } octave_stdout << " [" << std::setprecision (prec) << pct << "%]"; } #else octave_stdout << " ["< "<<((RSBOI_T*)rcm.VA)[2*nzi+0]<<" + " <<((RSBOI_T*)rcm.VA)[2*nzi+1]<<"i\n"; else for(nzi=0;nzi "<<((RSBOI_T*)rcm.VA)[nzi]<<"\n"; newline(os); RSBIO_NULL_STATEMENT_FOR_COMPILER_HAPPINESS } octave_value diag (octave_idx_type k) const { octave_value retval; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_0_EMCHECK(this->mtxAp); if(k!=0) { error("only main diagonal extraction is supported !"); } if(this->is_square()) { rsb_err_t errval = RSB_ERR_NO_ERROR; //RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(this->is_real_type()) { Matrix DA(this->rows(),1); errval = rsb_mtx_get_vec(this->mtxAp,(RSBOI_T*)DA.data(),RSB_EXTF_DIAG); retval = (DA); } else { ComplexMatrix DA(this->rows(),1); errval = rsb_mtx_get_vec(this->mtxAp,(RSBOI_T*)DA.data(),RSB_EXTF_DIAG); retval = (DA); } } else { error(RSBOI_0_NSQERRMSG); } return retval; } octave_value rsboi_get_scaled_copy_inv(const RSBOI_T alpha)const { RSBOI_T one = 1.0; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return rsboi_get_scaled_copy(one/alpha);/* FIXME: is this correct ? */ } #if RSBOI_WANT_DOUBLE_COMPLEX octave_value rsboi_get_scaled_copy_inv(const Complex alpha)const { Complex one = 1.0; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return rsboi_get_scaled_copy(one/alpha);/* FIXME: is this correct ? */ } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ octave_value rsboi_get_scaled_copy(const RSBOI_T alpha, rsb_trans_t transA=RSB_TRANSPOSITION_N)const { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); struct rsb_mtx_t *mtxBp = RSBOI_NULL; if(is_real_type()) { errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_SAME_TYPE,transA, &alpha,this->mtxAp,RSBOI_EXPF); } else #if RSBOI_WANT_DOUBLE_COMPLEX { Complex calpha;calpha+=alpha; errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_SAME_TYPE,transA,&calpha,this->mtxAp,RSBOI_EXPF); } #else /* RSBOI_WANT_DOUBLE_COMPLEX */ {RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG);} #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ return new octave_sparsersb_mtx( mtxBp ); } #if RSBOI_WANT_DOUBLE_COMPLEX octave_value rsboi_get_scaled_copy(const Complex alpha)const { rsb_err_t errval = RSB_ERR_NO_ERROR; octave_sparsersb_mtx *m = RSBOI_NULL; struct rsb_mtx_t *mtxBp = RSBOI_NULL; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX,RSB_TRANSPOSITION_N,&alpha,this->mtxAp,RSBOI_EXPF); m = new octave_sparsersb_mtx( mtxBp ); return m; } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ octave_value scale_rows(const octave_matrix&v2, bool want_div=false) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(this->is_real_type()) { const Matrix rm = want_div?1.0/v2.matrix_value ():v2.matrix_value (); octave_idx_type b_nc = rm.cols (); octave_idx_type b_nr = rm.rows (); octave_idx_type ldb = b_nr; octave_idx_type ldc = this->columns(); octave_idx_type nrhs = b_nc; Matrix retval(ldc,nrhs,RSBOI_ZERO); if(this->rows()!=b_nr) { error("matrices dimensions do not match!\n"); return Matrix(); } errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,rm.data()); RSBOI_PERROR(errval); return retval; } else { const ComplexMatrix cm = want_div?1.0/v2.complex_matrix_value ():v2.complex_matrix_value (); octave_idx_type b_nc = cm.cols (); octave_idx_type b_nr = cm.rows (); octave_idx_type ldb = b_nr; octave_idx_type ldc = this->columns(); octave_idx_type nrhs = b_nc; ComplexMatrix retval(ldc,nrhs,RSBOI_ZERO); if(this->rows()!=b_nr) { error("matrices dimensions do not match!\n"); return ComplexMatrix(); } errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); RSBOI_PERROR(errval); return retval; } } octave_value rsboi_spmm(const octave_matrix&v2, bool do_trans=false)const { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); rsb_trans_t transA = do_trans ? RSB_TRANSPOSITION_T : RSB_TRANSPOSITION_N; if(this->is_real_type()) { const Matrix b = v2.matrix_value (); octave_idx_type b_nc = b.cols (); octave_idx_type b_nr = b.rows (); octave_idx_type ldb = b_nr; octave_idx_type ldc = do_trans?this->columns():this->rows(); octave_idx_type nrhs = b_nc; Matrix retval(ldc,nrhs,RSBOI_ZERO); // if(this->columns()!=b_nr) { error("matrices dimensions do not match!\n"); return Matrix(); } if(( do_trans)&&(this->rows() !=b_nr)) { error("matrix rows count does not match operand rows!\n"); return Matrix(); } if((!do_trans)&&(this->columns()!=b_nr)) { error("matrix columns count does not match operand rows!\n"); return Matrix(); } errval = rsb_spmm(transA,&rsboi_pone,this->mtxAp,nrhs,RSB_OI_DMTXORDER,(RSBOI_T*)b.data(),ldb,&rsboi_zero,(RSBOI_T*)retval.data(),ldc); RSBOI_PERROR(errval); return retval; } else { const ComplexMatrix b = v2.complex_matrix_value (); octave_idx_type b_nc = b.cols (); octave_idx_type b_nr = b.rows (); octave_idx_type ldb = b_nr; octave_idx_type ldc = do_trans?this->columns():this->rows(); octave_idx_type nrhs = b_nc; ComplexMatrix retval(ldc,nrhs,RSBOI_ZERO); if(( do_trans)&&(this->rows() !=b_nr)) { error("matrix rows count does not match operand rows!\n"); return Matrix(); } if((!do_trans)&&(this->columns()!=b_nr)) { error("matrix columns count does not match operand rows!\n"); return Matrix(); } errval = rsb_spmm(transA,&rsboi_pone,this->mtxAp,nrhs,RSB_OI_DMTXORDER,(RSBOI_T*)b.data(),ldb,&rsboi_zero,(RSBOI_T*)retval.data(),ldc); RSBOI_PERROR(errval); return retval; } } #if RSBOI_WANT_DOUBLE_COMPLEX octave_value rsboi_spmm(const octave_complex_matrix&v2, bool do_trans=false)const { /* TODO: to avoid e.g. v2.complex_matrix_value, one may use: dim_vector dv = v2.dims(); ... dv(ndims) ... */ rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); rsb_trans_t transA = do_trans == true ? RSB_TRANSPOSITION_T : RSB_TRANSPOSITION_N; struct rsb_mtx_t *mtxCp = RSBOI_NULL; const ComplexMatrix b = v2.complex_matrix_value (); octave_idx_type b_nc = b.cols (); octave_idx_type b_nr = b.rows (); octave_idx_type ldb = b_nr; octave_idx_type ldc = do_trans?this->columns():this->rows(); octave_idx_type nrhs = b_nc; ComplexMatrix retval(ldc,nrhs,RSBOI_ZERO); /* zeroing is in principle unnecessary (we zero in rsb_spmm), but otherwise data may not be allocated. */ RSBOI_T* Cp =(RSBOI_T*)retval.data(); RSBOI_T* Bp =(RSBOI_T*)b.data(); if(this->is_real_type()) errval = rsb_mtx_clone(&mtxCp,RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX,RSB_TRANSPOSITION_N,RSBOI_NULL,this->mtxAp,RSBOI_EXPF); else mtxCp = this->mtxAp; if(RSBOI_SOME_ERROR(errval)) goto err; if(( do_trans)&&(this->rows() !=b_nr)) { error("matrix rows count does not match operand rows!\n"); return Matrix(); } if((!do_trans)&&(this->columns()!=b_nr)) { error("matrix columns count does not match operand rows!\n"); return Matrix(); } errval = rsb_spmm(transA,&rsboi_pone,mtxCp,nrhs,RSB_OI_DMTXORDER,Bp,ldb,&rsboi_zero,Cp,ldc); if(this->is_real_type()) RSBOI_DESTROY(mtxCp); err: RSBOI_PERROR(errval); return retval; } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ octave_value rsboi_spmsp(const octave_sparsersb_mtx&v2)const { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); octave_sparsersb_mtx*sm = new octave_sparsersb_mtx(); octave_value retval = sm; #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? */ #endif /* FIXME: what if they are not both of the same type ? it would be nice to have a conversion.. */ sm->mtxAp = rsb_spmsp(RSBOI_BINOP_PREVAILING_TYPE(*this,v2),RSB_TRANSPOSITION_N,&rsboi_pone,this->mtxAp,RSB_TRANSPOSITION_N,&rsboi_pone,v2.mtxAp,&errval); RSBOI_PERROR(errval); if(!sm->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); return retval; } octave_value rsboi_sppsp(const RSBOI_T*betap, const octave_sparsersb_mtx&v2)const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); octave_sparsersb_mtx*sm = new octave_sparsersb_mtx(); octave_value retval = sm; rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_FIXME(""); #if RSBOI_WANT_SYMMETRY /* FIXME: and now ? */ #endif sm->mtxAp = rsb_sppsp(RSBOI_BINOP_PREVAILING_TYPE(*this,v2),RSB_TRANSPOSITION_N,&rsboi_pone,this->mtxAp,RSB_TRANSPOSITION_N,betap,v2.mtxAp,&errval); RSBOI_PERROR(errval); if(!sm->mtxAp) RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); return retval; } octave_value cp_ubop(enum rsb_elopf_t opf, void*alphap=RSBOI_NULL)const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); rsb_err_t errval = RSB_ERR_NO_ERROR; octave_sparsersb_mtx *m = new octave_sparsersb_mtx(*this); if(!m)return m; errval = rsb_mtx_upd_values(m->mtxAp,opf,alphap); RSBOI_PERROR(errval); return m; } private: public: DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };/* end of class octave_sparsersb_mtx definition */ #if 0 octave_value_list find_nonzero_elem_idx (const class octave_sparsersb_mtx & nda, int nargout, octave_idx_type n_to_find, int direction) { // useless octave_value retval; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return retval; } #endif #if RSBOI_USE_PATCH_38143 #define RSBOI_CAST_CONV_ARG(ARGT) /* Seems like in 4.1.0+ CAST_CONV_ARG is not there. */ \ ARGT v = dynamic_cast< ARGT > (a) #define RSBOI_CAST_UNOP_ARG(ARGT) /* Seems like in 4.1.0+ CAST_UNOP_ARG is not there. */ \ RSBOI_CAST_CONV_ARG(ARGT) #define RSB_CAST_BINOP_ARGS(ARGT_V1, ARGT_V2); /* Seems like in 4.1.0+ CAST_BINOP_ARGS is not there. */ \ ARGT_V1 v1 = dynamic_cast< ARGT_V1 > (a1); \ ARGT_V2 v2 = dynamic_cast< ARGT_V2 > (a2); #else /* RSBOI_USE_PATCH_38143 */ #define RSBOI_CAST_CONV_ARG CAST_CONV_ARG #define RSBOI_CAST_UNOP_ARG CAST_UNOP_ARG #define RSB_CAST_BINOP_ARGS CAST_BINOP_ARGS #endif /* RSBOI_USE_PATCH_38143 */ static octave_base_value *default_numeric_conversion_function (const octave_base_value& a) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_CONV_ARG (const octave_sparsersb_mtx&); RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_WARN(RSBOI_0_UNFFEMSG); if(v.is_real_type()) return new octave_sparse_matrix (v.sparse_matrix_value()); else return new octave_sparse_complex_matrix (v.sparse_complex_matrix_value()); } DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparsersb_mtx, RSB_OI_TYPEINFO_STRING, RSB_OI_TYPEINFO_TYPE) DEFCONV (octave_triangular_conv, octave_sparsersb_mtx, matrix) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_CAST_CONV_ARG (const octave_sparsersb_mtx&); return new octave_sparse_matrix (v.matrix_value ()); } #if 0 DEFCONV (octave_sparse_rsb_to_octave_sparse_conv, sparse_rsb_mtx, sparse_matrix) { RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_CONV_ARG (const octave_sparsersb_mtx&); return new octave_sparse_matrix (v.matrix_value ()); } #endif DEFUNOP (uplus, sparse_rsb_mtx) { RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_UNOP_ARG (const octave_sparsersb_mtx&); return new octave_sparsersb_mtx (v); } #if 0 DEFUNOP (op_incr, sparse_rsb_mtx) { RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_UNOP_ARG (const octave_sparsersb_mtx&); const octave_idx_type rn = v.mtxAp->nrA,cn = v.mtxAp->ncA; Matrix v2(rn,cn); octave_value retval = v2; rsb_err_t errval = RSB_ERR_NO_ERROR; errval|=rsb_mtx_add_to_dense(&rsboi_pone,v.mtxAp,rn,rn,cn,RSB_BOOL_TRUE,(RSBOI_T*)v2.data()); //v = octave_ma(idx, v2.matrix_value()); return v2; } DEFUNOP (op_decr, sparse_rsb_mtx) { RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_UNOP_ARG (const octave_sparsersb_mtx&); const octave_idx_type rn = v.mtxAp->nrA, cn = v.mtxAp->ncA; Matrix v2(rn,cn); octave_value retval = v2; rsb_err_t errval = RSB_ERR_NO_ERROR; errval|=rsb_mtx_add_to_dense(&rsboi_pone,v.mtxAp,rn,rn,cn,RSB_BOOL_TRUE,(RSBOI_T*)v2.data()); //v = octave_ma(idx, v2.matrix_value()); return v2; } #endif DEFUNOP (uminus, sparse_rsb_mtx) { RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_UNOP_ARG (const octave_sparsersb_mtx&); return v.cp_ubop(RSB_ELOPF_NEG); } DEFUNOP (transpose, sparse_rsb_mtx) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_UNOP_ARG (const octave_sparsersb_mtx&); return v.rsboi_get_scaled_copy(rsboi_pone[0],RSB_TRANSPOSITION_T); } DEFUNOP (htranspose, sparse_rsb_mtx) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_CAST_UNOP_ARG (const octave_sparsersb_mtx&); return v.rsboi_get_scaled_copy(rsboi_pone[0],RSB_TRANSPOSITION_C); } octave_value rsboi_spsm(const octave_sparsersb_mtx&v1, const octave_matrix&v2, rsb_trans_t transA) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(v1.is_complex_type()) { ComplexMatrix retval = v2.complex_matrix_value(); octave_idx_type b_nc = retval.cols (); octave_idx_type b_nr = retval.rows (); octave_idx_type ldb = b_nr; octave_idx_type ldc = v1.rows(); octave_idx_type nrhs = b_nc; octave_idx_type nels = retval.rows()*retval.cols(); errval = rsb_spsm(transA,&rsboi_pone,v1.mtxAp,nrhs,RSB_OI_DMTXORDER,&rsboi_zero,(const RSBOI_T*)retval.data(),ldb,(RSBOI_T*)retval.data(),ldc); if(RSBOI_SOME_ERROR(errval)) { if(errval == RSB_ERR_INVALID_NUMERICAL_DATA) { RSBOI_PERROR(errval);// FIXME: need a specific error message here } else { RSBOI_PERROR(errval);// FIXME: generic case, here } for(octave_idx_type i=0;imtxAp,&alpha); errval = rsb_elemental_op(this->mtxAp,RSB_ELOPF_MUL,&alpha); RSBOI_PERROR(errval); return errval; } rsb_err_t rsboi_scale(Complex alpha) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); //errval = rsb_elemental_scale(this->mtxAp,&alpha); errval = rsb_elemental_op(this->mtxAp,RSB_ELOPF_MUL,&alpha); RSBOI_PERROR(errval); return errval; } DEFASSIGNOP(rsb_op_div_eq_s, sparse_rsb_mtx, scalar) { RSB_CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_scalar&); octave_value retval; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_PERROR(v1.rsboi_scale_inv(v2.scalar_value())); retval = v1.matrix_value(); return retval; } rsb_err_t rsboi_scale_inv(RSBOI_T alpha) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); //errval = rsb_elemental_scale_inv(this->mtxAp,&alpha); errval = rsb_elemental_op(this->mtxAp,RSB_ELOPF_DIV,&alpha); RSBOI_PERROR(errval); return errval; } rsb_err_t rsboi_scale_inv(Complex alpha) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); //errval = rsb_elemental_scale_inv(this->mtxAp,&alpha); errval = rsb_elemental_op(this->mtxAp,RSB_ELOPF_DIV,&alpha); RSBOI_PERROR(errval); return errval; } #endif DEFBINOP(rsb_el_mul_s, sparse_rsb_mtx, scalar) { RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return v1.rsboi_get_scaled_copy(v2.scalar_value()); } #if RSBOI_WANT_DOUBLE_COMPLEX DEFBINOP(rsb_el_mul_c, sparse_rsb_mtx, complex) { RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_complex&); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return v1.rsboi_get_scaled_copy(v2.complex_value()); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ DEFBINOP(rsb_el_div_s, sparse_rsb_mtx, scalar) { RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return v1.rsboi_get_scaled_copy_inv(v2.scalar_value()); } #if RSBOI_WANT_DOUBLE_COMPLEX DEFBINOP(rsb_el_div_c, sparse_rsb_mtx, complex) { RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_complex&); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return v1.rsboi_get_scaled_copy_inv(v2.complex_value()); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ #if RSBOI_WANT_DOUBLE_COMPLEX #if 0 DEFASSIGNOP(rsb_op_el_div_eq, sparse_rsb_mtx, scalar) { RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); std::cout << "rsb_op_el_div_eq!\n"; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return v1.rsboi_get_scaled_copy_inv(v2.complex_value()); } #endif DEFASSIGNOP(rsb_op_el_mul_eq_sc, sparse_rsb_mtx, matrix) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSB_CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_matrix&); return v1.scale_rows(v2,false); } DEFASSIGNOP(rsb_op_el_div_eq_sc, sparse_rsb_mtx, matrix) { rsb_err_t errval = RSB_ERR_NO_ERROR; RSB_CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_matrix&); return v1.scale_rows(v2,true); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ DEFBINOP(el_pow, sparse_rsb_mtx, scalar) { RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSBOI_T alpha = v2.scalar_value(); return v1.cp_ubop(RSB_ELOPF_POW,&alpha); } #ifdef RSB_FULLY_IMPLEMENTED DEFASSIGNOP (assigns, sparse_rsb_mtx, scalar) { RSB_CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_scalar&); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); v1.assign(idx, v2.matrix_value()); RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); return octave_value(); } #endif DEFBINOP(op_sub, sparse_rsb_mtx, sparse_rsb_mtx) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_sparsersb_mtx&); return v1.rsboi_sppsp(&rsboi_mone[0],v2); } DEFBINOP(op_add, sparse_rsb_mtx, sparse_rsb_mtx) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_sparsersb_mtx&); return v1.rsboi_sppsp(&rsboi_pone[0],v2); } DEFBINOP(op_spmul, sparse_rsb_mtx, sparse_rsb_mtx) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_sparsersb_mtx&); return v1.rsboi_spmsp(v2); } DEFBINOP(op_mul, sparse_rsb_mtx, matrix) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_matrix&); return v1.rsboi_spmm(v2, false); } DEFBINOP(op_trans_mul, sparse_rsb_mtx, matrix) { // ".'*" operator RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_matrix&); return v1.rsboi_spmm(v2, true); } #if RSBOI_WANT_DOUBLE_COMPLEX DEFBINOP(op_c_mul, sparse_rsb_mtx, matrix) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_complex_matrix&); return v1.rsboi_spmm(v2, false); } DEFBINOP(op_c_trans_mul, sparse_rsb_mtx, matrix) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); RSB_CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_complex_matrix&); return v1.rsboi_spmm(v2, true); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ static void install_sparsersb_ops (void) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); #ifdef RSB_FULLY_IMPLEMENTED /* boolean pattern-based not */ INSTALL_UNOP (op_not, octave_sparsersb_mtx, op_not); /* to-dense operations */ INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_scalar, assigns); /* ? */ INSTALL_UNOP (op_uplus, octave_sparsersb_mtx, uplus); /* elemental comparison, evaluate to sparse or dense boolean matrices */ INSTALL_BINOP (op_eq, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_le, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_lt, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_ge, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_gt, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_ne, octave_sparsersb_mtx, , ); /* pure elemental; scalar and sparse arguments ?! */ // ? INSTALL_BINOP (op_el_ldiv, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_el_ldiv_eq, octave_sparsersb_mtx, , ); // errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); INSTALL_BINOP (op_el_mul_eq, octave_sparsersb_mtx, , ); // diagonal subst ?? INSTALL_BINOP (op_el_and, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_el_or, octave_sparsersb_mtx, , ); /* shift operations: they may be left out from the implementation */ INSTALL_BINOP (op_lshift, octave_sparsersb_mtx, , ); INSTALL_BINOP (op_rshift, octave_sparsersb_mtx, , ); #endif // INSTALL_ASSIGNOP (op_el_div_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_div_eq_sc); // errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); // INSTALL_ASSIGNOP (op_el_mul_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_mul_eq_sc); //INSTALL_WIDENOP (octave_sparsersb_mtx, octave_sparse_matrix,octave_sparse_rsb_to_octave_sparse_conv);/* a DEFCONV .. */ //INSTALL_ASSIGNCONV (octave_sparsersb_mtx, octave_sparse_matrix,octave_sparse_matrix);/* .. */ // no need for the following: need a good conversion function, though //INSTALL_UNOP (op_incr, octave_sparsersb_mtx, op_incr); //INSTALL_UNOP (op_decr, octave_sparsersb_mtx, op_decr); INSTALL_BINOP (op_el_mul, octave_sparsersb_mtx, octave_scalar, rsb_el_mul_s); #if RSBOI_WANT_DOUBLE_COMPLEX INSTALL_BINOP (op_el_mul, octave_sparsersb_mtx, octave_complex, rsb_el_mul_c); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ // INSTALL_ASSIGNOP (op_mul_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_mul_eq_s); // 20110313 not effective // INSTALL_ASSIGNOP (op_div_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_div_eq_s); // 20110313 not effective INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_scalar, rsb_el_div_s); #if RSBOI_WANT_DOUBLE_COMPLEX INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_complex, rsb_el_div_c); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ INSTALL_BINOP (op_el_pow, octave_sparsersb_mtx, octave_scalar, el_pow); INSTALL_UNOP (op_uminus, octave_sparsersb_mtx, uminus); INSTALL_BINOP (op_ldiv, octave_sparsersb_mtx, octave_matrix, ldiv); INSTALL_BINOP (op_el_ldiv, octave_sparsersb_mtx, octave_matrix, el_ldiv); INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_matrix, div); INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_scalar, rsb_s_div); #if RSBOI_WANT_DOUBLE_COMPLEX INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_complex, rsb_c_div); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_scalar, rsb_s_mul); #if RSBOI_WANT_DOUBLE_COMPLEX INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_complex, rsb_c_mul); INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_mul); INSTALL_BINOP (op_trans_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_trans_mul); INSTALL_BINOP (op_ldiv, octave_sparsersb_mtx, octave_complex_matrix, c_ldiv); INSTALL_BINOP (op_trans_ldiv, octave_sparsersb_mtx, octave_complex_matrix, trans_c_ldiv); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ #if RSBOI_WANT_POW INSTALL_BINOP (op_pow, octave_sparsersb_mtx, octave_scalar, rsb_s_pow); #endif /* RSBOI_WANT_POW */ INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_matrix, el_div); INSTALL_UNOP (op_transpose, octave_sparsersb_mtx, transpose); INSTALL_UNOP (op_hermitian, octave_sparsersb_mtx, htranspose); INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_sparse_matrix, assign); INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_matrix, assignm); INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_matrix, op_mul); //INSTALL_BINOP (op_pow, octave_sparsersb_mtx, octave_matrix, op_pow); INSTALL_BINOP (op_sub, octave_sparsersb_mtx, octave_sparsersb_mtx, op_sub); INSTALL_BINOP (op_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_add); //INSTALL_BINOP (op_trans_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_trans_add); INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_sparsersb_mtx, op_spmul); INSTALL_BINOP (op_trans_mul, octave_sparsersb_mtx, octave_matrix, op_trans_mul); INSTALL_BINOP (op_trans_ldiv, octave_sparsersb_mtx, octave_matrix, trans_ldiv); //INSTALL_BINOP (op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans); //INSTALL_BINOP (op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans); //INSTALL_BINOP (op_herm_mul, octave_sparsersb_mtx, octave_matrix, op_herm_mul); //INSTALL_BINOP (op_mul_herm, octave_sparsersb_mtx, octave_matrix, op_mul_herm); //INSTALL_BINOP (op_el_not_and, octave_sparsersb_mtx, octave_matrix, op_el_not_and); //INSTALL_BINOP (op_el_not_or , octave_sparsersb_mtx, octave_matrix, op_el_not_or ); //INSTALL_BINOP (op_el_and_not, octave_sparsersb_mtx, octave_matrix, op_el_and_not); //INSTALL_BINOP (op_el_or _not, octave_sparsersb_mtx, octave_matrix, op_el_or _not); } static void install_sparse_rsb (void) { static bool rsboi_initialized = false; RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); if(!rsboi_initialized) { rsb_err_t errval = RSB_ERR_NO_ERROR; if(sparsersb_tester() == false) { RSBOI_ERROR(""); goto err; } if(RSBOI_SOME_ERROR(errval = rsb_lib_init(RSB_NULL_INIT_OPTIONS))) { RSBOI_FIXME("temporary style of error handling"); RSBOI_PERROR(errval); RSBOI_ERROR(""); goto err; } rsboi_initialized = true; } else ;/* already initialized */ if (!rsboi_sparse_rsb_loaded) { octave_sparsersb_mtx::register_type (); install_sparsersb_ops (); rsboi_sparse_rsb_loaded = true; mlock(); } return; err: RSBIO_NULL_STATEMENT_FOR_COMPILER_HAPPINESS } DEFUN_DLD (RSB_SPARSERSB_LABEL, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{a})\n\ @deftypefnx {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n})\n\ @deftypefnx {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\ @deftypefnx {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{i}, @var{j}, @var{sv})\n\ @deftypefnx {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{m}, @var{n})\n\ @deftypefnx {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, \"unique\")\n\ @deftypefnx {Loadable Function} " RSBOI_FNS " (\"set\", @var{opn}, @var{opv})\n\ @deftypefnx {Loadable Function} {@var{v} =} " RSBOI_FNS " (@var{S}, \"get\", @var{mif})\n\ @deftypefnx {Loadable Function} {@var{v} =} " RSBOI_FNS " (@var{S}, @var{QS})\n\ @deftypefnx {Loadable Function} " RSBOI_FNS " (@var{a},\"save\",@var{mtxfilename})\n\ @deftypefnx {Loadable Function} {[@var{S}, @var{nrows}, @var{ncols}, @var{nnz}, @var{repinfo}, @var{field}, @var{symmetry}] =} " RSBOI_FNS " (@var{mtxfilename}[, @var{mtxtypestring}])\n\ " RSBOI_10100_DOCH ""\ \ "\n"\ "Create or manipulate sparse matrices using the RSB format provided by librsb, as similarly as possible to @code{sparse}.\n"\ "\n"\ "If @var{a} is a full matrix, convert it to a sparse matrix representation,\n\ removing all zero values in the process.\n"\ "\n\ Given the integer index vectors @var{i} and @var{j}, and a 1-by-@code{nnz}\n\ vector of real or complex values @var{sv}, construct the sparse matrix\n\ @code{S(@var{i}(@var{k}),@var{j}(@var{k})) = @var{sv}(@var{k})} with overall\n\ dimensions @var{m} and @var{n}. \n\ \nThe argument\n\ @code{@var{nzmax}} is ignored but accepted for compatibility with @sc{Matlab} and @code{sparsersb}.\n\ \n\ If @var{m} or @var{n} are not specified their values are derived from the\n\ maximum index in the vectors @var{i} and @var{j} as given by\n\ @code{@var{m} = max (@var{i})}, @code{@var{n} = max (@var{j})}.\n\ \n\ \ Can load a matrix from a Matrix Market matrix file named @var{mtxfilename}. The optional argument @var{mtxtypestring} can specify either real (\"D\") or complex (\"Z\") type. Default is real.\n"\ "In the case @var{mtxfilename} is \"" RSBOI_LIS "\", a string listing the available numerical types with BLAS-style characters will be returned. If the file turns out to contain a Matrix Market dense vector, this will be loaded.\n"\ \ \ "\n\ \ If \"save\" is specified, saves a sparse RSB matrix as a Matrix Market matrix file named @var{mtxfilename}.\n"\ "\n\ \ @strong{Note}: if multiple values are specified with the same\n\ @var{i}, @var{j} indices, the corresponding values in @var{sv} will\n\ be added.\n\ \n\ The following are all equivalent:\n\ \n\ @example\n\ @group\n\ s = " RSBOI_FNS " (i, j, s, m, n)\n\ s = " RSBOI_FNS " (i, j, s, m, n, \"summation\")\n\ s = " RSBOI_FNS " (i, j, s, m, n, \"sum\")\n"\ /*"s = " RSBOI_FNS " (i, j, s, \"summation\")\n"*/\ /*"s = " RSBOI_FNS " (i, j, s, \"sum\")\n"*/\ "@end group\n\ @end example\n\ \n\ \ If the optional \"unique\" keyword is specified, then if more than two values are specified for the\n\ same @var{i}, @var{j} indices, only the last value will be used.\n\ \n\ @code{" RSBOI_FNS " (@var{m}, @var{n})} will create an empty @var{m}x@var{n} sparse\n\ matrix and is equivalent to @code{" RSBOI_FNS " ([], [], [], @var{m}, @var{n})}.\n\ \n\ \ \n\ \ If @var{m} or @var{n} are not specified, then @code{@var{m} = max (@var{i})}, @code{@var{n} = max (@var{j})}.\n\ \n\ \ If @var{opn} is a string representing a valid librsb option name and @var{opv} is a string representing a valid librsb option value, these will be passed to the @code{rsb_lib_set_opt_str()} function.\n\ \n\ \ If @var{mif} is a string specifying a valid librsb matrix info string (valid for librsb's @code{rsb_mtx_get_info_from_string()}), then the corresponding value will be returned for matrix @code{@var{S}}, in string @code{@var{v}}. If @var{mif} is the an empty string (\"\"), matrix structure information will be returned. As of librsb-1.2, these is debug or internal information. E.g. for 'RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T', a string with the count of internal RSB blocks will be returned.\n\ \n"\ \ /*"If @var{S} is a " RSBOI_FNS " matrix and @var{QS} is a string, @var{QS} will be interpreted as a query string about matrix @var{S}. String @code{@var{v}} will be returned. See librsb's @code{rsb_mtx_get_info_str()}.\n\ @strong{Note}: this feature is still incomplete, and whatever the value of @var{QS}, a general information string will be returned.\n"*/\ \ "If @var{S} is a " RSBOI_FNS " matrix and @var{QS} is a string, @var{QS} shall be interpreted as a query string about matrix @var{S}. String @code{@var{v}} will be returned with query results. \n @strong{Note}: this feature is to be completed and its syntax reserved for future use. In this version, whatever the value of @var{QS}, a general matrix information string will be returned (like " RSBOI_FNS "(@var{S},\"get\",\"RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T\") ).\n"\ "\n"\ /*If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\ to have a common size.\n*/ RSBOI_10100_DOC ""\ "\n\ Long (64 bit) index support is partial: if Octave has been configured for 64 bit indices, " RSBOI_FNS " will correctly handle and convert matrices/indices that would fit in a 32 bit indices setup, failing on 'larger' ones. \n\ \n\ Please note that on @code{" RSBOI_FNS "} type variables are available most, but not all of the operators available for @code{full} or @code{sparse} typed variables.\n\ \n\ @seealso{full, sparse}\n\ @end deftypefn") { int nargin = args.length (); octave_value_list retval; octave_sparsersb_mtx*osmp = RSBOI_NULL; bool ic0 = nargin>0?(args(0).is_complex_type()):false; bool ic3 = nargin>2?(args(2).is_complex_type()):false; bool isr = (nargin>0 && args(0).type_name()==RSB_OI_TYPEINFO_STRING); RSBOI_DEBUG_NOTICE("in sparsersb()\n"); if(ic0) { RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); } if(isr) osmp = ((octave_sparsersb_mtx*)(args(0).internal_rep())); if(ic3 || ic0) #if RSBOI_WANT_DOUBLE_COMPLEX RSBOI_WARN(RSBOI_0_UNCFEMSG); #else /* RSBOI_WANT_DOUBLE_COMPLEX */ RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ install_sparse_rsb(); if( nargin == 3 && args(0).is_string() && args(0).string_value()=="set" && args(1).is_string() && args(2).is_string()) { // sparsersb ("set", OPN, OPV) rsb_err_t errval = RSB_ERR_NO_ERROR; const char *os = args(1).string_value().c_str(); const char *ov = args(2).string_value().c_str(); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); errval = rsb_lib_set_opt_str(os,ov); if(RSBOI_SOME_ERROR(errval)) { error("failed setting option %s to %s (error %d)!",os,ov,errval); goto err; } goto ret; } if( nargin >= 2 && args(0).is_string() && args(0).string_value()=="set" /* && args(1).is_string() */ ) { // sparsersb ("set", XXX) error("did you intend to set librsb options ? use the correct syntax then ! (third argument missing)"); goto errp; } if( nargin == 2 && args(0).is_string() && args(0).string_value()=="get" && args(1).is_string() ) { // sparsersb ("get", XXX) /* FIXME: unfinished feature ! */ RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); error("getting library options still unimplemented!"); goto errp; } #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) if (nargin >= 2 && isr && args(1).is_string() && args(1).string_value()=="autotune") { // sparsersb (S,"autotune"[, TRANSA, NRHS, MAXR, TMAX, TN, SF]) rsb_err_t errval = RSB_ERR_NO_ERROR; /* these are user settable */ rsb_coo_idx_t nrhs = 0; rsb_int_t maxr = 1; rsb_time_t tmax = 2.0; rsb_int_t tn = 0; rsb_real_t sf = 1.0; rsb_trans_t transA = RSB_TRANSPOSITION_N; /* TODO: these shall also be user settable */ const void *alphap = RSBOI_NULL; const void *betap = RSBOI_NULL; /* these not */ rsb_flags_t order = RSB_OI_DMTXORDER; const void * Bp = RSBOI_NULL; rsb_nnz_idx_t ldB = 0; rsb_nnz_idx_t ldC = 0; void * Cp = RSBOI_NULL; if (nargin > 2) transA = RSB_CHAR_AS_TRANSPOSITION(args(2).string_value()[0]); if (nargin > 3) nrhs = args(3).scalar_value(); if (nargin > 4) maxr = args(4).scalar_value(); if (nargin > 5) tmax = args(5).scalar_value(); if (nargin > 6) tn = args(6).scalar_value(); if (nargin > 7) sf = args(7).scalar_value(); // ... if(!osmp || !osmp->mtxAp) RSBOI_0_INTERRMSGSTMT(goto ret) if(nargout) { struct rsb_mtx_t *mtxAp = RSBOI_NULL; errval = rsb_mtx_clone(&mtxAp,RSB_NUMERICAL_TYPE_SAME_TYPE,RSB_TRANSPOSITION_N,RSBOI_NULL,osmp->mtxAp,RSBOI_EXPF); errval = rsb_tune_spmm(&mtxAp,&sf,&tn,maxr,tmax,transA,alphap,RSBOI_NULL,nrhs,order,Bp,ldB,betap,Cp,ldC); retval.append(new octave_sparsersb_mtx(mtxAp)); } else errval = rsb_tune_spmm(&osmp->mtxAp,&sf,&tn,maxr,tmax,transA,alphap,RSBOI_NULL/*osmp->mtxAp*/,nrhs,order,Bp,ldB,betap,Cp,ldC); /* FIXME: serious error handling missing here */ goto ret; } #endif #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) if (nargin >= 3 && isr && args(1).is_string() && args(1).string_value().substr(0,6)=="render" && args(2).is_string()) { // sparsersb (S,"render", FILENAME[, RWIDTH, RHEIGHT]) rsb_err_t errval = RSB_ERR_NO_ERROR; std::string rmf = args(2).string_value(); rsb_coo_idx_t pmWidth = 512, pmHeight = 512; /* Care to update the documentation when changing these. */ rsb_flags_t marf = RSB_MARF_EPS; /* may tell the user to supply a sparsersb matrix in case input is not 'sparse' */ if (nargin > 3) pmWidth = args(3).scalar_value(); if (nargin > 4) pmHeight = args(4).scalar_value(); if(!osmp || !osmp->mtxAp) RSBOI_0_INTERRMSGSTMT(goto ret) if( args(1).string_value() == "renders") marf = RSB_MARF_EPS_S; if( args(1).string_value() == "renderb") marf = RSB_MARF_EPS_B; errval = rsb_mtx_rndr(rmf.c_str(),osmp->mtxAp,pmWidth,pmHeight,marf); /* FIXME: serious error handling still missing here */ if(RSBOI_SOME_ERROR(errval)) retval.append(std::string("Error returned from rsb_mtx_rndr()")); goto ret; } #endif #if RSBOI_WANT_MTX_SAVE if (nargin == 3 && isr && args(1).is_string() && args(1).string_value()=="save" && args(2).is_string()) { // sparsersb (A,"save",MTXFILENAME) rsb_file_mtx_save(osmp->mtxAp,args(2).string_value().c_str()); /* TODO: error handling */ goto ret; } #endif if (nargin == 3 && isr && args(1).is_string() && args(1).string_value()=="get" && args(2).is_string()) { // sparsersb (S, "get", MIF) // For any version of lirsb, you can get valid values with e.g.: // grep RSB_MIF path-to/rsb.h | sed 's/^[, ]*//g;s/\([A-Z_]\+\).*<\(.\+\)(.*$/\1: \2/g;s/$/;/g' rsb_err_t errval = RSB_ERR_NO_ERROR; /* rsb_real_t miv = RSBOI_ZERO;*/ /* FIXME: this is extreme danger! */ char is[RSBOI_INFOBUF]; char ss[RSBOI_INFOBUF]; if(!osmp || !osmp->mtxAp) RSBOI_0_INTERRMSGSTMT(goto ret) if(strlen(args(2).string_value().c_str())==0) strncpy(is,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",sizeof(is)); else strncpy(is,args(2).string_value().c_str(),sizeof(is)); errval = rsb_mtx_get_info_str(osmp->mtxAp,is,ss,RSBOI_INFOBUF); if(!RSBOI_SOME_ERROR(errval)) { retval.append(octave_value(ss)); goto ret; } /* FIXME: serious error handling missing here */ if(RSBOI_SOME_ERROR(errval)) retval.append(std::string("Error returned from rsb_mtx_get_info_from_string()")); /* else retval.append(octave_value(miv));*/ goto ret; } if ( nargin >= 3 && isr && args(1).is_string() && args(1).string_value()=="get" /* && args(1).is_string() */ ) { // sparsersb (S, "get", MIF, XXX) error("did you intend to get matrices information ? use the correct syntax then !"); goto errp; } if ( nargin == 1 || nargin == 2 ) { rsb_type_t typecode = RSBOI_TYPECODE; if (nargin >= 2)/* FIXME: this is weird ! */ #if RSBOI_WANT_DOUBLE_COMPLEX typecode = RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX; #else /* RSBOI_WANT_DOUBLE_COMPLEX */ RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ if (nargin == 2 && isr && args(1).is_string()) #if RSBOI_WANT_QSI { // sparsersb (S, QS) char ss[RSBOI_INFOBUF]; rsb_err_t errval = RSB_ERR_NO_ERROR; if(!osmp || !osmp->mtxAp) RSBOI_0_INTERRMSGSTMT(goto ret) errval = rsb_mtx_get_info_str(osmp->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); if(!RSBOI_SOME_ERROR(errval)) retval.append(ss); /* TODO, FIXME: to add interpretation (we are ignoring args(1) !): this is to be extended. */ RSBOI_WARN(RSBOI_0_UNFFEMSG);/* FIXME: this is yet unfinished */ // octave_stdout << "Matrix information (in the future, supplementary information may be returned, as more inquiry functionality will be implemented):\n" << ss << "\n"; /* FIXME: shall not print out, but rather return the info as a string*/ //retval.append("place info string here !\n"); goto ret; } #else /* RSBOI_WANT_QSI */ { // sparsersb (S, QS) error("invocation error !"); goto errp; } #endif /* RSBOI_WANT_QSI */ else if(args(0).is_sparse_type()) { // sparsersb (sparse(...), ...) if( isr ) { RSBOI_WARN(RSBOI_0_UNFFEMSG); retval.append(osmp = (octave_sparsersb_mtx*)(args(0).get_rep()).clone()); } else { if(!ic0) { const SparseMatrix m = args(0).sparse_matrix_value(); if (error_state) goto err; retval.append(osmp = new octave_sparsersb_mtx(m,typecode)); } #if RSBOI_WANT_DOUBLE_COMPLEX else { const SparseComplexMatrix m = args(0).sparse_complex_matrix_value(); if (error_state) goto err; retval.append(osmp = new octave_sparsersb_mtx(m,typecode)); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ } } else if(args(0).is_string()) { // sparsersb (MTXFILENAME) const std::string mtxfilename = args(0).string_value(); if (error_state) goto err; if(mtxfilename == RSBOI_LIS) { //retval.append(RSB_NUMERICAL_TYPE_PREPROCESSOR_SYMBOLS); #if RSBOI_WANT_DOUBLE_COMPLEX retval.append("D Z"); #else /* RSBOI_WANT_DOUBLE_COMPLEX */ retval.append("D"); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ goto ret; } else { // [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb (MTXFILENAME) rsb_type_t typecode = RSBOI_TYPECODE; RSBOI_WARN(RSBOI_0_UNFFEMSG); RSBOI_WARN("shall set the type, here"); if(nargin>1 && args(1).is_string()) { const std::string mtxtypestring = args(1).string_value(); if(mtxtypestring == "complex" || mtxtypestring == "Z") #if RSBOI_WANT_DOUBLE_COMPLEX typecode = RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX; #else RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG); #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ if(mtxtypestring == "real" || mtxtypestring=="D") typecode = RSB_NUMERICAL_TYPE_DOUBLE; } #if RSBOI_WANT_MTX_LOAD osmp = new octave_sparsersb_mtx(mtxfilename,typecode); #else /* RSBOI_WANT_DOUBLE_COMPLEX */ goto ret; /* TODO: need error message here */ #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ if(osmp->mtxAp) retval.append(osmp); else delete osmp; #if RSBOI_WANT_VECLOAD_INSTEAD_MTX if(!osmp->mtxAp) { rsb_nnz_idx_t n = 0; rsb_file_vec_load(mtxfilename.c_str(),typecode,RSBOI_NULL,&n); if(n<1) { // error("are you sure you passed a valid Matrix Market vector file ?"); goto err; } if(typecode == RSB_NUMERICAL_TYPE_DOUBLE) { Matrix retvec(n,1,RSBOI_ZERO); rsb_file_vec_load(mtxfilename.c_str(),typecode,(RSBOI_T*)retvec.data(),&n); retval.append(retvec); } #if RSBOI_WANT_DOUBLE_COMPLEX else if(typecode == RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX) { ComplexMatrix retvec(n,1,RSBOI_ZERO); rsb_file_vec_load(mtxfilename.c_str(),typecode,(RSBOI_T*)retvec.data(),&n); retval.append(retvec); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ goto ret; } #endif if(nargout) nargout--; if(nargout) retval.append(osmp->rows()),--nargout; if(nargout) retval.append(osmp->cols()),--nargout; if(nargout) retval.append(osmp->nnz()),--nargout; if(nargout) retval.append(osmp->get_info_string()),--nargout; if(nargout) retval.append((!osmp->is_complex_type())?"real":"complex"),--nargout; if(nargout) retval.append(osmp->get_symmetry()),--nargout; } } else { if (nargin == 2 && args(0).is_scalar_type() && args(1).is_scalar_type() ) { // sparsersb (M, N) const SparseMatrix m = args(0).sparse_matrix_value(); retval.append(osmp = new octave_sparsersb_mtx(SparseMatrix(args(0).scalar_value(),args(1).scalar_value()))); } else { // sparsersb (A, XXX) if(!ic0) { Matrix m = args(0).matrix_value(); if (error_state) goto err; retval.append(osmp = new octave_sparsersb_mtx(m)); } #if RSBOI_WANT_DOUBLE_COMPLEX else { ComplexMatrix m = args(0).complex_matrix_value(); if (error_state) goto err; retval.append(osmp = new octave_sparsersb_mtx(m)); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ if(nargin >= 2) { error("when initializing from a single matrix, no need for second argument !"); goto errp; } } } } else if (nargin >= 3 && nargin <= 7 && !(args(0).is_string() || args(1).is_string() || args(2).is_string() ) ) { // sparsersb (I, J, SV, M, N, "unique") rsb_flags_t eflags = RSBOI_DCF; rsb_flags_t sflags = RSB_FLAG_NOFLAGS; octave_idx_type nrA = 0, ncA = 0; int sai = 0; // string argument index if (nargin > 3) { if ( nargin < 5) { if(nargin == 4 && args(3).is_string()) goto checked; RSBOI_EERROR(RSBOI_0_BADINVOERRMSG); goto errp; } /* FIXME: integer_type should be also supported here: shouldn't it ?*/ if( (!args(3).is_scalar_type()) || (!args(4).is_scalar_type())) { RSBOI_EERROR(RSBOI_0_BADINVOERRMSG); goto errp; } if( nargin > 5 && ((!args(5).is_string()) && (!args(5).is_scalar_type()))) { RSBOI_EERROR(RSBOI_0_BADINVOERRMSG); goto errp; } } checked: if (nargin >= 5 ) { nrA = args(3).scalar_value();/* FIXME: need index value here! */ ncA = args(4).scalar_value(); if(nrA<=0 || ncA<=0) { RSBOI_EERROR(RSBOI_O_NPMSERR); goto errp; } } if (nargin >= 6 && args(5).is_string()) sai = 5; else if (nargin == 4 && args(3).is_string()) sai = 3; for(;sai>0 && sai= 6 && args(5).is_integer_type()) { /* we ignore this value for MATLAB compatibility */ } if (error_state) goto ret; if(!ic3) { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); idx_vector iv = args(0).index_vector (); idx_vector jv = args(1).index_vector (); retval.append(osmp = new octave_sparsersb_mtx( iv, jv, args(2).matrix_value(),nrA,ncA,eflags )); } #if RSBOI_WANT_DOUBLE_COMPLEX else { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); idx_vector iv = args(0).index_vector (); idx_vector jv = args(1).index_vector (); retval.append(osmp = new octave_sparsersb_mtx( iv, jv, args(2).complex_matrix_value(),nrA,ncA,eflags )); } #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ } else goto errp; if(!osmp) { RSBOI_WARN(RSBOI_0_NEEDERR); RSBOI_DEBUG_NOTICE(RSBOI_0_FATALNBMSG); } #if RSBOI_WANT_HEAVY_DEBUG if(!rsb_is_correctly_built_rcsr_matrix(osmp->mtxAp)) // function non in rsb.h's API { RSBOI_WARN(RSBOI_0_NEEDERR); RSBOI_DEBUG_NOTICE(RSBOI_0_UNCBERR); } #endif goto err; errp: print_usage (); err: ret: return retval; } /* %!test %! #help sparsersb %! s=sparsersb([2]), assert(s==2), assert(s!=1) %!test %! s=sparsersb([1,2],[1,1],[11,21],2,2 ), assert(nnz(s)==2) %!test %! s=sparsersb([1,2],[1,1],[11,21],2,2,-1 ), assert(nnz(s)==2) %!test %! s=sparsersb([1,2],[1,1],[11,21] ), assert(nnz(s)==2) %!test %! s=sparsersb(10,10 ), assert(nnz(s)==0) %!test %! s=sparsersb([1,1],[1,1],[11,21] ), assert(nnz(s)==1), assert(s(1,1)==32) %!test %! s=sparsersb([1,1],[1,1],[11,21],2,2,"unique"), assert(nnz(s)==1), assert(s(1,1)==21) %!test %! sparsersb("set","RSB_IO_WANT_VERBOSE_TUNING","1") %!test %! # sparsersb("get","RSB_IO_WANT_VERBOSE_TUNING","1") # FIXME %!test %! sparsersb(sparsersb([11,0;21,22]),"RSB_MIF_TOTAL_SIZE__TO__SIZE_T") %!test %! sparsersb(sparsersb([11,0;21,22]),"save","sparsersb_temporary_matrix_file.mtx") %!test %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx" ); assert(NROWS==2);assert(NCOLS==2);assert(NNZ==3);assert(FIELD=="real" );assert(SYMMETRY=='U'); %!test %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx", "Z"); assert(NROWS==2);assert(NCOLS==2);assert(NNZ==3);assert(FIELD=="complex");assert(SYMMETRY=='U'); %!test %! rrm=sparsersb(sprand(1000,1000,0.001)); sparsersb(rrm,"render", "sparsersb_temporary_render.eps" ,1024,1024); %! # sparsersb(rrm,"renderb", "sparsersb_temporary_renderb.eps"); sparsersb(rrm,"renders", "sparsersb_temporary_renders.eps"); # FIXME %!test %! sparsersb(sparsersb(sprand(100,100,0.4)),"autotune","n",20,4,1,1,1) */ /* %!demo %! # You can use 'sparsersb' just like 'sparse' in the most of cases: %! R=(rand(3)>.6) %! # R = %! # %! # 0 0 0 %! # 0 0 0 %! # 1 0 1 %! # %! A_octave=sparse(R) %! # A_octave = %! # %! # Compressed Column Sparse (rows = 3, cols = 3, nnz = 2 [22%]) %! # %! # (3, 1) -> 1 %! # (3, 3) -> 1 %! # %! A_librsb=sparsersb(R) %! # A_librsb = %! # %! # Recursive Sparse Blocks (rows = 3, cols = 3, nnz = 2, symm = U [22%]) %! # %! # (3, 1) -> 1 %! # (3, 3) -> 1 %! # %! # test sparsersb %! # ... %! # help sparsersb %!demo %! # The interface of 'sparsersb' is almost like the one of 'sparse'. %! sparsersb([2]); # 1x1 matrix %! sparsersb([1,2],[1,1],[11,21] ); # 2x1 matrix %! sparsersb([1,2],[1,1],[11,21],2,2); # 2x2 matrix %! sparsersb([1,2,2 ],[1,1,2 ],[11,21, 22],2,2); # 2x2 lower triangular %! sparsersb([1,2,2,2],[1,1,2,2],[11,21,11,11],2,2); # 2x2 lower triangular, last element ignored %! sparsersb([1,2,2,2],[1,1,2,2],[11,21,11,11],2,2,"unique"); # 2x2 lower triangular, last element ignored %! sparsersb([1,2,2,2],[1,1,2,2],[11,21,11,11],2,2,"sum"); # 2x2 lower triangular, last two elements summed %! %! # But it has a extensions, like symmetric and hermitian matrices. %! sparsersb([1,2,2 ],[1,1,2 ],[11,21 , 22],2,2,"general"); # 2x2 lower tringular %! sparsersb([1,2,2 ],[1,1,2 ],[11,21 , 22],2,2,"symmetric"); # 2x2 symmetric (only lower triangle stored) %! sparsersb([1,2,2 ],[1,1,2 ],[11,21i, 22],2,2,"hermitian"); # 2x2 hermitian (only lower triangle stored) %!demo %! # Any 'sparse' or 'dense' matrix can be converted to 'sparsersb'. %! d=sparsersb( [1,2;3,4] ); %! s=sparsersb(sparse([1,2;3,4])); %! %! # Many matrix operators are active, e.g.: +,*,-,/,\ among others... %! s+d; %! s*d; %! s-d; %! s/d; %! s\[1;1]; %! # ... %!demo %! # On large matrices 'sparsersb' is supposed to be faster than 'sparse' in sparse matrix-vector multiplication: %! M=10000;N=10000;P=100 / M; %! s=sparse(sprand(M,N,P)); %! r=sparsersb(s); %! x=ones(M,1); %! assert(nnz(s)==nnz(r)) %! %! printf("Here, a %.2e x %.2e matrix with %.2e nonzeroes.\n",M,N,nnz(s)) %! tic(); %! sc=0; %! while(toc()<3) %! s*x; %! sc=sc+1; %! endwhile %! st=toc()/sc; %! printf("Each multiplication with 'sparse' took %.1es.\n",st); %! %! tic(); %! rc=0; %! while(toc()<3) %! r*x; %! rc=rc+1; %! endwhile %! rt=toc()/rc; %! printf("Each multiplication with 'sparsersb' took %.3es, this is %.4g%% of the time taken by 'sparse'.\n",rt,100*rt/st); %! %! # 'sparsersb' has an 'empirical online auto-tuning' function %! nsb=str2num(sparsersb(r,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); %! # after 'autotuning' for a specific operation, this will perform faster %! tic; %! r=sparsersb(r,"autotune","n",1); %! toc; %! nnb=str2num(sparsersb(r,"get","RSB_MIF_LEAVES_COUNT__TO__RSB_BLK_INDEX_T")); %! printf ("Autotuning took %.2es (%d -> %d RSB blocks).\n", toc, nsb, nnb); %! tic(); %! rc=0; %! while(toc()<3) %! r*x; %! rc=rc+1; %! endwhile %! rt=toc()/rc; %! printf("Each 'optimized' multiplication with 'sparsersb' took %.3es, this is %.4g%% of the time taken by 'sparse'.\n",rt,100*rt/st); %!demo %! # 'sparsersb' can render matrices into Encapsulated Postscript files: %! rm = sparsersb(sprand(100000,100000,.0001)); %! sparsersb(rm,'render','sptest.eps') %%!demo */