├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── doc ├── .gitignore ├── FinalPapers │ └── gpsf_report1_arxiv_2017_10_06.zip ├── bib.bib ├── eig_notes.md ├── figures │ ├── .gitignore │ └── gpsf_report1_figures.m ├── gpsf_report1.pdf ├── gpsf_report1.tex └── gpsf_report1_analytical_code.nb └── src └── matlab ├── matlab_addpath_prol_src.m ├── matlab_example.m ├── polynomials ├── prolate_JacobiP_ex.m ├── prolate_ZernikeNorm_ex.m ├── prolate_ZernikeNorm_ex_fromJacobi.m └── prolate_xdZernikeNorm_coef.m ├── prolate_crea.m ├── prolate_ev.m └── service ├── prolate_analyticgam.m ├── prolate_crea_eigRatios.m ├── prolate_diffop_mat_full.m ├── prolate_diffop_mat_tridiag.m └── prolate_numericalgam.m /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | We welcome contributions to the code and theoretical background. 2 | The latex source of the report is available in this repository. 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The following license applies to the implementation source code: 2 | 3 | 4 | GNU GENERAL PUBLIC LICENSE 5 | Version 3, 29 June 2007 6 | 7 | Copyright (C) 2007 Free Software Foundation, Inc. 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | 11 | Preamble 12 | 13 | The GNU General Public License is a free, copyleft license for 14 | software and other kinds of works. 15 | 16 | The licenses for most software and other practical works are designed 17 | to take away your freedom to share and change the works. By contrast, 18 | the GNU General Public License is intended to guarantee your freedom to 19 | share and change all versions of a program--to make sure it remains free 20 | software for all its users. We, the Free Software Foundation, use the 21 | GNU General Public License for most of our software; it applies also to 22 | any other work released this way by its authors. You can apply it to 23 | your programs, too. 24 | 25 | When we speak of free software, we are referring to freedom, not 26 | price. Our General Public Licenses are designed to make sure that you 27 | have the freedom to distribute copies of free software (and charge for 28 | them if you wish), that you receive source code or can get it if you 29 | want it, that you can change the software or use pieces of it in new 30 | free programs, and that you know you can do these things. 31 | 32 | To protect your rights, we need to prevent others from denying you 33 | these rights or asking you to surrender the rights. Therefore, you have 34 | certain responsibilities if you distribute copies of the software, or if 35 | you modify it: responsibilities to respect the freedom of others. 36 | 37 | For example, if you distribute copies of such a program, whether 38 | gratis or for a fee, you must pass on to the recipients the same 39 | freedoms that you received. You must make sure that they, too, receive 40 | or can get the source code. And you must show them these terms so they 41 | know their rights. 42 | 43 | Developers that use the GNU GPL protect your rights with two steps: 44 | (1) assert copyright on the software, and (2) offer you this License 45 | giving you legal permission to copy, distribute and/or modify it. 46 | 47 | For the developers' and authors' protection, the GPL clearly explains 48 | that there is no warranty for this free software. For both users' and 49 | authors' sake, the GPL requires that modified versions be marked as 50 | changed, so that their problems will not be attributed erroneously to 51 | authors of previous versions. 52 | 53 | Some devices are designed to deny users access to install or run 54 | modified versions of the software inside them, although the manufacturer 55 | can do so. This is fundamentally incompatible with the aim of 56 | protecting users' freedom to change the software. The systematic 57 | pattern of such abuse occurs in the area of products for individuals to 58 | use, which is precisely where it is most unacceptable. Therefore, we 59 | have designed this version of the GPL to prohibit the practice for those 60 | products. If such problems arise substantially in other domains, we 61 | stand ready to extend this provision to those domains in future versions 62 | of the GPL, as needed to protect the freedom of users. 63 | 64 | Finally, every program is threatened constantly by software patents. 65 | States should not allow patents to restrict development and use of 66 | software on general-purpose computers, but in those that do, we wish to 67 | avoid the special danger that patents applied to a free program could 68 | make it effectively proprietary. To prevent this, the GPL assures that 69 | patents cannot be used to render the program non-free. 70 | 71 | The precise terms and conditions for copying, distribution and 72 | modification follow. 73 | 74 | TERMS AND CONDITIONS 75 | 76 | 0. Definitions. 77 | 78 | "This License" refers to version 3 of the GNU General Public License. 79 | 80 | "Copyright" also means copyright-like laws that apply to other kinds of 81 | works, such as semiconductor masks. 82 | 83 | "The Program" refers to any copyrightable work licensed under this 84 | License. Each licensee is addressed as "you". "Licensees" and 85 | "recipients" may be individuals or organizations. 86 | 87 | To "modify" a work means to copy from or adapt all or part of the work 88 | in a fashion requiring copyright permission, other than the making of an 89 | exact copy. The resulting work is called a "modified version" of the 90 | earlier work or a work "based on" the earlier work. 91 | 92 | A "covered work" means either the unmodified Program or a work based 93 | on the Program. 94 | 95 | To "propagate" a work means to do anything with it that, without 96 | permission, would make you directly or secondarily liable for 97 | infringement under applicable copyright law, except executing it on a 98 | computer or modifying a private copy. Propagation includes copying, 99 | distribution (with or without modification), making available to the 100 | public, and in some countries other activities as well. 101 | 102 | To "convey" a work means any kind of propagation that enables other 103 | parties to make or receive copies. Mere interaction with a user through 104 | a computer network, with no transfer of a copy, is not conveying. 105 | 106 | An interactive user interface displays "Appropriate Legal Notices" 107 | to the extent that it includes a convenient and prominently visible 108 | feature that (1) displays an appropriate copyright notice, and (2) 109 | tells the user that there is no warranty for the work (except to the 110 | extent that warranties are provided), that licensees may convey the 111 | work under this License, and how to view a copy of this License. If 112 | the interface presents a list of user commands or options, such as a 113 | menu, a prominent item in the list meets this criterion. 114 | 115 | 1. Source Code. 116 | 117 | The "source code" for a work means the preferred form of the work 118 | for making modifications to it. "Object code" means any non-source 119 | form of a work. 120 | 121 | A "Standard Interface" means an interface that either is an official 122 | standard defined by a recognized standards body, or, in the case of 123 | interfaces specified for a particular programming language, one that 124 | is widely used among developers working in that language. 125 | 126 | The "System Libraries" of an executable work include anything, other 127 | than the work as a whole, that (a) is included in the normal form of 128 | packaging a Major Component, but which is not part of that Major 129 | Component, and (b) serves only to enable use of the work with that 130 | Major Component, or to implement a Standard Interface for which an 131 | implementation is available to the public in source code form. A 132 | "Major Component", in this context, means a major essential component 133 | (kernel, window system, and so on) of the specific operating system 134 | (if any) on which the executable work runs, or a compiler used to 135 | produce the work, or an object code interpreter used to run it. 136 | 137 | The "Corresponding Source" for a work in object code form means all 138 | the source code needed to generate, install, and (for an executable 139 | work) run the object code and to modify the work, including scripts to 140 | control those activities. However, it does not include the work's 141 | System Libraries, or general-purpose tools or generally available free 142 | programs which are used unmodified in performing those activities but 143 | which are not part of the work. For example, Corresponding Source 144 | includes interface definition files associated with source files for 145 | the work, and the source code for shared libraries and dynamically 146 | linked subprograms that the work is specifically designed to require, 147 | such as by intimate data communication or control flow between those 148 | subprograms and other parts of the work. 149 | 150 | The Corresponding Source need not include anything that users 151 | can regenerate automatically from other parts of the Corresponding 152 | Source. 153 | 154 | The Corresponding Source for a work in source code form is that 155 | same work. 156 | 157 | 2. Basic Permissions. 158 | 159 | All rights granted under this License are granted for the term of 160 | copyright on the Program, and are irrevocable provided the stated 161 | conditions are met. This License explicitly affirms your unlimited 162 | permission to run the unmodified Program. The output from running a 163 | covered work is covered by this License only if the output, given its 164 | content, constitutes a covered work. This License acknowledges your 165 | rights of fair use or other equivalent, as provided by copyright law. 166 | 167 | You may make, run and propagate covered works that you do not 168 | convey, without conditions so long as your license otherwise remains 169 | in force. You may convey covered works to others for the sole purpose 170 | of having them make modifications exclusively for you, or provide you 171 | with facilities for running those works, provided that you comply with 172 | the terms of this License in conveying all material for which you do 173 | not control copyright. Those thus making or running the covered works 174 | for you must do so exclusively on your behalf, under your direction 175 | and control, on terms that prohibit them from making any copies of 176 | your copyrighted material outside their relationship with you. 177 | 178 | Conveying under any other circumstances is permitted solely under 179 | the conditions stated below. Sublicensing is not allowed; section 10 180 | makes it unnecessary. 181 | 182 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 183 | 184 | No covered work shall be deemed part of an effective technological 185 | measure under any applicable law fulfilling obligations under article 186 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 187 | similar laws prohibiting or restricting circumvention of such 188 | measures. 189 | 190 | When you convey a covered work, you waive any legal power to forbid 191 | circumvention of technological measures to the extent such circumvention 192 | is effected by exercising rights under this License with respect to 193 | the covered work, and you disclaim any intention to limit operation or 194 | modification of the work as a means of enforcing, against the work's 195 | users, your or third parties' legal rights to forbid circumvention of 196 | technological measures. 197 | 198 | 4. Conveying Verbatim Copies. 199 | 200 | You may convey verbatim copies of the Program's source code as you 201 | receive it, in any medium, provided that you conspicuously and 202 | appropriately publish on each copy an appropriate copyright notice; 203 | keep intact all notices stating that this License and any 204 | non-permissive terms added in accord with section 7 apply to the code; 205 | keep intact all notices of the absence of any warranty; and give all 206 | recipients a copy of this License along with the Program. 207 | 208 | You may charge any price or no price for each copy that you convey, 209 | and you may offer support or warranty protection for a fee. 210 | 211 | 5. Conveying Modified Source Versions. 212 | 213 | You may convey a work based on the Program, or the modifications to 214 | produce it from the Program, in the form of source code under the 215 | terms of section 4, provided that you also meet all of these conditions: 216 | 217 | a) The work must carry prominent notices stating that you modified 218 | it, and giving a relevant date. 219 | 220 | b) The work must carry prominent notices stating that it is 221 | released under this License and any conditions added under section 222 | 7. This requirement modifies the requirement in section 4 to 223 | "keep intact all notices". 224 | 225 | c) You must license the entire work, as a whole, under this 226 | License to anyone who comes into possession of a copy. This 227 | License will therefore apply, along with any applicable section 7 228 | additional terms, to the whole of the work, and all its parts, 229 | regardless of how they are packaged. This License gives no 230 | permission to license the work in any other way, but it does not 231 | invalidate such permission if you have separately received it. 232 | 233 | d) If the work has interactive user interfaces, each must display 234 | Appropriate Legal Notices; however, if the Program has interactive 235 | interfaces that do not display Appropriate Legal Notices, your 236 | work need not make them do so. 237 | 238 | A compilation of a covered work with other separate and independent 239 | works, which are not by their nature extensions of the covered work, 240 | and which are not combined with it such as to form a larger program, 241 | in or on a volume of a storage or distribution medium, is called an 242 | "aggregate" if the compilation and its resulting copyright are not 243 | used to limit the access or legal rights of the compilation's users 244 | beyond what the individual works permit. Inclusion of a covered work 245 | in an aggregate does not cause this License to apply to the other 246 | parts of the aggregate. 247 | 248 | 6. Conveying Non-Source Forms. 249 | 250 | You may convey a covered work in object code form under the terms 251 | of sections 4 and 5, provided that you also convey the 252 | machine-readable Corresponding Source under the terms of this License, 253 | in one of these ways: 254 | 255 | a) Convey the object code in, or embodied in, a physical product 256 | (including a physical distribution medium), accompanied by the 257 | Corresponding Source fixed on a durable physical medium 258 | customarily used for software interchange. 259 | 260 | b) Convey the object code in, or embodied in, a physical product 261 | (including a physical distribution medium), accompanied by a 262 | written offer, valid for at least three years and valid for as 263 | long as you offer spare parts or customer support for that product 264 | model, to give anyone who possesses the object code either (1) a 265 | copy of the Corresponding Source for all the software in the 266 | product that is covered by this License, on a durable physical 267 | medium customarily used for software interchange, for a price no 268 | more than your reasonable cost of physically performing this 269 | conveying of source, or (2) access to copy the 270 | Corresponding Source from a network server at no charge. 271 | 272 | c) Convey individual copies of the object code with a copy of the 273 | written offer to provide the Corresponding Source. This 274 | alternative is allowed only occasionally and noncommercially, and 275 | only if you received the object code with such an offer, in accord 276 | with subsection 6b. 277 | 278 | d) Convey the object code by offering access from a designated 279 | place (gratis or for a charge), and offer equivalent access to the 280 | Corresponding Source in the same way through the same place at no 281 | further charge. You need not require recipients to copy the 282 | Corresponding Source along with the object code. If the place to 283 | copy the object code is a network server, the Corresponding Source 284 | may be on a different server (operated by you or a third party) 285 | that supports equivalent copying facilities, provided you maintain 286 | clear directions next to the object code saying where to find the 287 | Corresponding Source. Regardless of what server hosts the 288 | Corresponding Source, you remain obligated to ensure that it is 289 | available for as long as needed to satisfy these requirements. 290 | 291 | e) Convey the object code using peer-to-peer transmission, provided 292 | you inform other peers where the object code and Corresponding 293 | Source of the work are being offered to the general public at no 294 | charge under subsection 6d. 295 | 296 | A separable portion of the object code, whose source code is excluded 297 | from the Corresponding Source as a System Library, need not be 298 | included in conveying the object code work. 299 | 300 | A "User Product" is either (1) a "consumer product", which means any 301 | tangible personal property which is normally used for personal, family, 302 | or household purposes, or (2) anything designed or sold for incorporation 303 | into a dwelling. In determining whether a product is a consumer product, 304 | doubtful cases shall be resolved in favor of coverage. For a particular 305 | product received by a particular user, "normally used" refers to a 306 | typical or common use of that class of product, regardless of the status 307 | of the particular user or of the way in which the particular user 308 | actually uses, or expects or is expected to use, the product. A product 309 | is a consumer product regardless of whether the product has substantial 310 | commercial, industrial or non-consumer uses, unless such uses represent 311 | the only significant mode of use of the product. 312 | 313 | "Installation Information" for a User Product means any methods, 314 | procedures, authorization keys, or other information required to install 315 | and execute modified versions of a covered work in that User Product from 316 | a modified version of its Corresponding Source. The information must 317 | suffice to ensure that the continued functioning of the modified object 318 | code is in no case prevented or interfered with solely because 319 | modification has been made. 320 | 321 | If you convey an object code work under this section in, or with, or 322 | specifically for use in, a User Product, and the conveying occurs as 323 | part of a transaction in which the right of possession and use of the 324 | User Product is transferred to the recipient in perpetuity or for a 325 | fixed term (regardless of how the transaction is characterized), the 326 | Corresponding Source conveyed under this section must be accompanied 327 | by the Installation Information. But this requirement does not apply 328 | if neither you nor any third party retains the ability to install 329 | modified object code on the User Product (for example, the work has 330 | been installed in ROM). 331 | 332 | The requirement to provide Installation Information does not include a 333 | requirement to continue to provide support service, warranty, or updates 334 | for a work that has been modified or installed by the recipient, or for 335 | the User Product in which it has been modified or installed. Access to a 336 | network may be denied when the modification itself materially and 337 | adversely affects the operation of the network or violates the rules and 338 | protocols for communication across the network. 339 | 340 | Corresponding Source conveyed, and Installation Information provided, 341 | in accord with this section must be in a format that is publicly 342 | documented (and with an implementation available to the public in 343 | source code form), and must require no special password or key for 344 | unpacking, reading or copying. 345 | 346 | 7. Additional Terms. 347 | 348 | "Additional permissions" are terms that supplement the terms of this 349 | License by making exceptions from one or more of its conditions. 350 | Additional permissions that are applicable to the entire Program shall 351 | be treated as though they were included in this License, to the extent 352 | that they are valid under applicable law. If additional permissions 353 | apply only to part of the Program, that part may be used separately 354 | under those permissions, but the entire Program remains governed by 355 | this License without regard to the additional permissions. 356 | 357 | When you convey a copy of a covered work, you may at your option 358 | remove any additional permissions from that copy, or from any part of 359 | it. (Additional permissions may be written to require their own 360 | removal in certain cases when you modify the work.) You may place 361 | additional permissions on material, added by you to a covered work, 362 | for which you have or can give appropriate copyright permission. 363 | 364 | Notwithstanding any other provision of this License, for material you 365 | add to a covered work, you may (if authorized by the copyright holders of 366 | that material) supplement the terms of this License with terms: 367 | 368 | a) Disclaiming warranty or limiting liability differently from the 369 | terms of sections 15 and 16 of this License; or 370 | 371 | b) Requiring preservation of specified reasonable legal notices or 372 | author attributions in that material or in the Appropriate Legal 373 | Notices displayed by works containing it; or 374 | 375 | c) Prohibiting misrepresentation of the origin of that material, or 376 | requiring that modified versions of such material be marked in 377 | reasonable ways as different from the original version; or 378 | 379 | d) Limiting the use for publicity purposes of names of licensors or 380 | authors of the material; or 381 | 382 | e) Declining to grant rights under trademark law for use of some 383 | trade names, trademarks, or service marks; or 384 | 385 | f) Requiring indemnification of licensors and authors of that 386 | material by anyone who conveys the material (or modified versions of 387 | it) with contractual assumptions of liability to the recipient, for 388 | any liability that these contractual assumptions directly impose on 389 | those licensors and authors. 390 | 391 | All other non-permissive additional terms are considered "further 392 | restrictions" within the meaning of section 10. If the Program as you 393 | received it, or any part of it, contains a notice stating that it is 394 | governed by this License along with a term that is a further 395 | restriction, you may remove that term. If a license document contains 396 | a further restriction but permits relicensing or conveying under this 397 | License, you may add to a covered work material governed by the terms 398 | of that license document, provided that the further restriction does 399 | not survive such relicensing or conveying. 400 | 401 | If you add terms to a covered work in accord with this section, you 402 | must place, in the relevant source files, a statement of the 403 | additional terms that apply to those files, or a notice indicating 404 | where to find the applicable terms. 405 | 406 | Additional terms, permissive or non-permissive, may be stated in the 407 | form of a separately written license, or stated as exceptions; 408 | the above requirements apply either way. 409 | 410 | 8. Termination. 411 | 412 | You may not propagate or modify a covered work except as expressly 413 | provided under this License. Any attempt otherwise to propagate or 414 | modify it is void, and will automatically terminate your rights under 415 | this License (including any patent licenses granted under the third 416 | paragraph of section 11). 417 | 418 | However, if you cease all violation of this License, then your 419 | license from a particular copyright holder is reinstated (a) 420 | provisionally, unless and until the copyright holder explicitly and 421 | finally terminates your license, and (b) permanently, if the copyright 422 | holder fails to notify you of the violation by some reasonable means 423 | prior to 60 days after the cessation. 424 | 425 | Moreover, your license from a particular copyright holder is 426 | reinstated permanently if the copyright holder notifies you of the 427 | violation by some reasonable means, this is the first time you have 428 | received notice of violation of this License (for any work) from that 429 | copyright holder, and you cure the violation prior to 30 days after 430 | your receipt of the notice. 431 | 432 | Termination of your rights under this section does not terminate the 433 | licenses of parties who have received copies or rights from you under 434 | this License. If your rights have been terminated and not permanently 435 | reinstated, you do not qualify to receive new licenses for the same 436 | material under section 10. 437 | 438 | 9. Acceptance Not Required for Having Copies. 439 | 440 | You are not required to accept this License in order to receive or 441 | run a copy of the Program. Ancillary propagation of a covered work 442 | occurring solely as a consequence of using peer-to-peer transmission 443 | to receive a copy likewise does not require acceptance. However, 444 | nothing other than this License grants you permission to propagate or 445 | modify any covered work. These actions infringe copyright if you do 446 | not accept this License. Therefore, by modifying or propagating a 447 | covered work, you indicate your acceptance of this License to do so. 448 | 449 | 10. Automatic Licensing of Downstream Recipients. 450 | 451 | Each time you convey a covered work, the recipient automatically 452 | receives a license from the original licensors, to run, modify and 453 | propagate that work, subject to this License. You are not responsible 454 | for enforcing compliance by third parties with this License. 455 | 456 | An "entity transaction" is a transaction transferring control of an 457 | organization, or substantially all assets of one, or subdividing an 458 | organization, or merging organizations. If propagation of a covered 459 | work results from an entity transaction, each party to that 460 | transaction who receives a copy of the work also receives whatever 461 | licenses to the work the party's predecessor in interest had or could 462 | give under the previous paragraph, plus a right to possession of the 463 | Corresponding Source of the work from the predecessor in interest, if 464 | the predecessor has it or can get it with reasonable efforts. 465 | 466 | You may not impose any further restrictions on the exercise of the 467 | rights granted or affirmed under this License. For example, you may 468 | not impose a license fee, royalty, or other charge for exercise of 469 | rights granted under this License, and you may not initiate litigation 470 | (including a cross-claim or counterclaim in a lawsuit) alleging that 471 | any patent claim is infringed by making, using, selling, offering for 472 | sale, or importing the Program or any portion of it. 473 | 474 | 11. Patents. 475 | 476 | A "contributor" is a copyright holder who authorizes use under this 477 | License of the Program or a work on which the Program is based. The 478 | work thus licensed is called the contributor's "contributor version". 479 | 480 | A contributor's "essential patent claims" are all patent claims 481 | owned or controlled by the contributor, whether already acquired or 482 | hereafter acquired, that would be infringed by some manner, permitted 483 | by this License, of making, using, or selling its contributor version, 484 | but do not include claims that would be infringed only as a 485 | consequence of further modification of the contributor version. For 486 | purposes of this definition, "control" includes the right to grant 487 | patent sublicenses in a manner consistent with the requirements of 488 | this License. 489 | 490 | Each contributor grants you a non-exclusive, worldwide, royalty-free 491 | patent license under the contributor's essential patent claims, to 492 | make, use, sell, offer for sale, import and otherwise run, modify and 493 | propagate the contents of its contributor version. 494 | 495 | In the following three paragraphs, a "patent license" is any express 496 | agreement or commitment, however denominated, not to enforce a patent 497 | (such as an express permission to practice a patent or covenant not to 498 | sue for patent infringement). To "grant" such a patent license to a 499 | party means to make such an agreement or commitment not to enforce a 500 | patent against the party. 501 | 502 | If you convey a covered work, knowingly relying on a patent license, 503 | and the Corresponding Source of the work is not available for anyone 504 | to copy, free of charge and under the terms of this License, through a 505 | publicly available network server or other readily accessible means, 506 | then you must either (1) cause the Corresponding Source to be so 507 | available, or (2) arrange to deprive yourself of the benefit of the 508 | patent license for this particular work, or (3) arrange, in a manner 509 | consistent with the requirements of this License, to extend the patent 510 | license to downstream recipients. "Knowingly relying" means you have 511 | actual knowledge that, but for the patent license, your conveying the 512 | covered work in a country, or your recipient's use of the covered work 513 | in a country, would infringe one or more identifiable patents in that 514 | country that you have reason to believe are valid. 515 | 516 | If, pursuant to or in connection with a single transaction or 517 | arrangement, you convey, or propagate by procuring conveyance of, a 518 | covered work, and grant a patent license to some of the parties 519 | receiving the covered work authorizing them to use, propagate, modify 520 | or convey a specific copy of the covered work, then the patent license 521 | you grant is automatically extended to all recipients of the covered 522 | work and works based on it. 523 | 524 | A patent license is "discriminatory" if it does not include within 525 | the scope of its coverage, prohibits the exercise of, or is 526 | conditioned on the non-exercise of one or more of the rights that are 527 | specifically granted under this License. You may not convey a covered 528 | work if you are a party to an arrangement with a third party that is 529 | in the business of distributing software, under which you make payment 530 | to the third party based on the extent of your activity of conveying 531 | the work, and under which the third party grants, to any of the 532 | parties who would receive the covered work from you, a discriminatory 533 | patent license (a) in connection with copies of the covered work 534 | conveyed by you (or copies made from those copies), or (b) primarily 535 | for and in connection with specific products or compilations that 536 | contain the covered work, unless you entered into that arrangement, 537 | or that patent license was granted, prior to 28 March 2007. 538 | 539 | Nothing in this License shall be construed as excluding or limiting 540 | any implied license or other defenses to infringement that may 541 | otherwise be available to you under applicable patent law. 542 | 543 | 12. No Surrender of Others' Freedom. 544 | 545 | If conditions are imposed on you (whether by court order, agreement or 546 | otherwise) that contradict the conditions of this License, they do not 547 | excuse you from the conditions of this License. If you cannot convey a 548 | covered work so as to satisfy simultaneously your obligations under this 549 | License and any other pertinent obligations, then as a consequence you may 550 | not convey it at all. For example, if you agree to terms that obligate you 551 | to collect a royalty for further conveying from those to whom you convey 552 | the Program, the only way you could satisfy both those terms and this 553 | License would be to refrain entirely from conveying the Program. 554 | 555 | 13. Use with the GNU Affero General Public License. 556 | 557 | Notwithstanding any other provision of this License, you have 558 | permission to link or combine any covered work with a work licensed 559 | under version 3 of the GNU Affero General Public License into a single 560 | combined work, and to convey the resulting work. The terms of this 561 | License will continue to apply to the part which is the covered work, 562 | but the special requirements of the GNU Affero General Public License, 563 | section 13, concerning interaction through a network will apply to the 564 | combination as such. 565 | 566 | 14. Revised Versions of this License. 567 | 568 | The Free Software Foundation may publish revised and/or new versions of 569 | the GNU General Public License from time to time. Such new versions will 570 | be similar in spirit to the present version, but may differ in detail to 571 | address new problems or concerns. 572 | 573 | Each version is given a distinguishing version number. If the 574 | Program specifies that a certain numbered version of the GNU General 575 | Public License "or any later version" applies to it, you have the 576 | option of following the terms and conditions either of that numbered 577 | version or of any later version published by the Free Software 578 | Foundation. If the Program does not specify a version number of the 579 | GNU General Public License, you may choose any version ever published 580 | by the Free Software Foundation. 581 | 582 | If the Program specifies that a proxy can decide which future 583 | versions of the GNU General Public License can be used, that proxy's 584 | public statement of acceptance of a version permanently authorizes you 585 | to choose that version for the Program. 586 | 587 | Later license versions may give you additional or different 588 | permissions. However, no additional obligations are imposed on any 589 | author or copyright holder as a result of your choosing to follow a 590 | later version. 591 | 592 | 15. Disclaimer of Warranty. 593 | 594 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 595 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 596 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 597 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 598 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 599 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 600 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 601 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 602 | 603 | 16. Limitation of Liability. 604 | 605 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 606 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 607 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 608 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 609 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 610 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 611 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 612 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 613 | SUCH DAMAGES. 614 | 615 | 17. Interpretation of Sections 15 and 16. 616 | 617 | If the disclaimer of warranty and limitation of liability provided 618 | above cannot be given local legal effect according to their terms, 619 | reviewing courts shall apply local law that most closely approximates 620 | an absolute waiver of all civil liability in connection with the 621 | Program, unless a warranty or assumption of liability accompanies a 622 | copy of the Program in return for a fee. 623 | 624 | END OF TERMS AND CONDITIONS 625 | 626 | How to Apply These Terms to Your New Programs 627 | 628 | If you develop a new program, and you want it to be of the greatest 629 | possible use to the public, the best way to achieve this is to make it 630 | free software which everyone can redistribute and change under these terms. 631 | 632 | To do so, attach the following notices to the program. It is safest 633 | to attach them to the start of each source file to most effectively 634 | state the exclusion of warranty; and each file should have at least 635 | the "copyright" line and a pointer to where the full notice is found. 636 | 637 | {one line to give the program's name and a brief idea of what it does.} 638 | Copyright (C) {year} {name of author} 639 | 640 | This program is free software: you can redistribute it and/or modify 641 | it under the terms of the GNU General Public License as published by 642 | the Free Software Foundation, either version 3 of the License, or 643 | (at your option) any later version. 644 | 645 | This program is distributed in the hope that it will be useful, 646 | but WITHOUT ANY WARRANTY; without even the implied warranty of 647 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 648 | GNU General Public License for more details. 649 | 650 | You should have received a copy of the GNU General Public License 651 | along with this program. If not, see . 652 | 653 | Also add information on how to contact you by electronic and paper mail. 654 | 655 | If the program does terminal interaction, make it output a short 656 | notice like this when it starts in an interactive mode: 657 | 658 | {project} Copyright (C) {year} {fullname} 659 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 660 | This is free software, and you are welcome to redistribute it 661 | under certain conditions; type `show c' for details. 662 | 663 | The hypothetical commands `show w' and `show c' should show the appropriate 664 | parts of the General Public License. Of course, your program's commands 665 | might be different; for a GUI interface, you would use an "about box". 666 | 667 | You should also get your employer (if you work as a programmer) or school, 668 | if any, to sign a "copyright disclaimer" for the program, if necessary. 669 | For more information on this, and how to apply and follow the GNU GPL, see 670 | . 671 | 672 | The GNU General Public License does not permit incorporating your program 673 | into proprietary programs. If your program is a subroutine library, you 674 | may consider it more useful to permit linking proprietary applications with 675 | the library. If this is what you want to do, use the GNU Lesser General 676 | Public License instead of this License. But first, please read 677 | . 678 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PROL 2 | **Code for Computing Generalized Prolate Spheroidal Functions (GPSF)** 3 | 4 | **For the 1-D version**, see: [Prol 1-D](http://github.com/lederman/Prol_1D) 5 | 6 | 7 | The numerical methods for this code are described in: [Numerical Algorithms for the Computation of Generalized Prolate Spheroidal Functions](https://arxiv.org/abs/1710.02874) (the latex source is available and is being updated at in the /doc folder). 8 | 9 | A secondary goal of this project is to develop methodology for cross-validation of key results using both analytical computational validating (here, using Mathematica) and numerical validation. 10 | 11 | Code License: GNU General Public License v3.0 (see LICENSE file). 12 | 13 | 14 | # Project Status 15 | **This code is under development** and it is still being tested. 16 | The current version does not implement the classic one-dimensional Prolate Spheroidal Wave Functions (PSWF), which we plan to add in the future. 17 | Currently, only a MATLAB implementation is available. We plan to add a more comprehensive implementation in FORTRAN, and interfaces for Julia and Python. 18 | 19 | # Documentation 20 | 21 | The numerical methods are described in a paper which is available, along with the associated LaTeX code in the /doc folder of this project. The report is also available on arXiv (https://arxiv.org/abs/1710.02874). 22 | 23 | The code which reproduces the figures in the report is available in the /doc/figures folder 24 | 25 | # "Open Source Proof" 26 | 27 | To make the analytical expressions more convenient for analytical verification by the readers, we provide experimental Mathematica code that confirms some of the analytical relations which have been obtained in other ways. Where we have not been able to use Mathematica to verify the most general form of the relations that we have derived, we demonstrate some results with specific choice of parameters, which the user can change easily. Furthermore, where possible, we generate the expression in the paper, and some limited pieces of the code, directly from the relations that are verified in the Mathematica code to reduce the possibility of typos and incompatible notation. 28 | Ultimately, the goal of this experiment is to develop methodology that would allow to confirm key results in papers using both an analytical computational tool and a numerical computational tool, and to verify the compatibility between the expressions. 29 | 30 | # Caveats 31 | 32 | * The classic 1-D Prolate Spheroidal Wave Functions (PSWF) have not been implemented in this code yet. 33 | * The code is still under development, and has not been stress-tested yet. 34 | * For technical reasons, accuracy testing will only be available with the FORTRAN implementation. 35 | * To make the code more readable, the preliminary MATLAB implementation relies on the eigenvector decomposition in MATLAB which poses several potential problems in scaling and porting to other languages and other versions of MATLAB. There are several obvious downsides to using the standard eig, but there are more subtle considerations discussed in [eig notes](doc/eig_notes.md) in the documentation folder. If you attempt to port the code and encounter any loss of precision, please note the comments in that part of the code and the notes in the documentation folder. This dependency will be removed in future versions. 36 | 37 | # Contributing to this Project 38 | 39 | We welcome contributions to the code and theoretical background. 40 | The latex source of the report is available in this repository. 41 | 42 | # Citation 43 | Please cite: Roy R. Lederman. [Numerical Algorithms for the Computation of Generalized Prolate Spheroidal Functions](https://arxiv.org/abs/1710.02874) (2017) arXiv:1710.02874 44 | 45 | 46 | # Additional resources 47 | * Slepian, David. "Prolate spheroidal wave functions, Fourier analysis and uncertainty—IV: extensions to many dimensions; generalized prolate spheroidal functions." Bell Labs Technical Journal 43.6 (1964): 3009-3057. 48 | * Serkh, Kirill. On generalized prolate spheroidal functions. Technical Report TR-1519, Department of Mathematics, Yale University, 2015. 49 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.blg 3 | *.bbl 4 | *.log 5 | *.out 6 | *.tex~ 7 | -------------------------------------------------------------------------------- /doc/FinalPapers/gpsf_report1_arxiv_2017_10_06.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lederman/Prol/cebd18cf7f1a9bced304c5671fb2a31c57cad0db/doc/FinalPapers/gpsf_report1_arxiv_2017_10_06.zip -------------------------------------------------------------------------------- /doc/bib.bib: -------------------------------------------------------------------------------- 1 | 2 | @article{greengard2017generalized, 3 | title={On generalized prolate spheroidal functions}, 4 | author={Greengard, Philip and Serkh, Kirill}, 5 | year={2017}, 6 | journal={Manuscript in preparation} 7 | } 8 | 9 | 10 | 11 | @techreport{serkh2015generalized, 12 | title={On generalized prolate spheroidal functions}, 13 | author={Serkh, Kirill}, 14 | year={2015}, 15 | institution={Technical Report TR-1519, Department of Mathematics, Yale University} 16 | } 17 | 18 | 19 | 20 | 21 | 22 | @article{landa2017steerable, 23 | title={Steerable Principal Components for Space-Frequency Localized Images}, 24 | author={Landa, Boris and Shkolnisky, Yoel}, 25 | journal={SIAM Journal on Imaging Sciences}, 26 | volume={10}, 27 | number={2}, 28 | pages={508--534}, 29 | year={2017}, 30 | publisher={SIAM} 31 | } 32 | 33 | @article{landa2017approximation, 34 | title={Approximation scheme for essentially bandlimited and space-concentrated functions on a disk}, 35 | author={Landa, Boris and Shkolnisky, Yoel}, 36 | journal={Applied and Computational Harmonic Analysis}, 37 | volume={43}, 38 | number={3}, 39 | pages={381--403}, 40 | year={2017}, 41 | publisher={Elsevier} 42 | } 43 | 44 | 45 | 46 | 47 | @article{lederman2017lower, 48 | title={Lower Bounds for Truncated {F}ourier and {L}aplace Transforms}, 49 | author={Lederman, Roy R. and Steinerberger, Stefan}, 50 | journal={Integral Equations and Operator Theory}, 51 | volume={87}, 52 | number={4}, 53 | pages={529--543}, 54 | year={2017}, 55 | publisher={Springer} 56 | } 57 | 58 | 59 | 60 | 61 | 62 | @article{shkolnisky2007prolate, 63 | title={Prolate spheroidal wave functions on a disc—integration and approximation of two-dimensional bandlimited functions}, 64 | author={Shkolnisky, Yoel}, 65 | journal={Applied and Computational Harmonic Analysis}, 66 | volume={22}, 67 | number={2}, 68 | pages={235--256}, 69 | year={2007}, 70 | publisher={Elsevier} 71 | } 72 | 73 | @article{shkolnisky2006approximation, 74 | title={Approximation of bandlimited functions}, 75 | author={Shkolnisky, Yoel and Tygert, Mark and Rokhlin, Vladimir}, 76 | journal={Applied and Computational Harmonic Analysis}, 77 | volume={21}, 78 | number={3}, 79 | pages={413--420}, 80 | year={2006}, 81 | publisher={Elsevier} 82 | } 83 | 84 | @article{xiao2003high, 85 | title={High-frequency asymptotic expansions for certain prolate spheroidal wave functions}, 86 | author={Xiao, Hong and Rokhlin, Vladimir}, 87 | journal={Journal of Fourier Analysis and Applications}, 88 | volume={9}, 89 | number={6}, 90 | pages={575--596}, 91 | year={2003}, 92 | publisher={Springer} 93 | } 94 | 95 | 96 | @article{rokhlin2007approximate, 97 | title={Approximate formulae for certain prolate spheroidal wave functions valid for large values of both order and band-limit}, 98 | author={Rokhlin, Vladimir and Xiao, Hong}, 99 | journal={Applied and Computational Harmonic Analysis}, 100 | volume={22}, 101 | number={1}, 102 | pages={105--123}, 103 | year={2007}, 104 | publisher={Elsevier} 105 | } 106 | 107 | 108 | @article{osipov2017evaluation, 109 | title={Evaluation of small elements of the eigenvectors of certain symmetric tridiagonal matrices with high relative accuracy}, 110 | author={Osipov, Andrei}, 111 | journal={Applied and Computational Harmonic Analysis}, 112 | volume={43}, 113 | number={2}, 114 | pages={173--211}, 115 | year={2017}, 116 | publisher={Elsevier} 117 | } 118 | 119 | 120 | @article{osipov2013prolate, 121 | title={Prolate spheroidal wave functions of order zero}, 122 | author={Osipov, Andrei and Rokhlin, Vladimir and Xiao, Hong}, 123 | journal={Springer Ser. Appl. Math. Sci}, 124 | volume={187}, 125 | year={2013}, 126 | publisher={Springer} 127 | } 128 | 129 | @article{xiao2001prolate, 130 | title={Prolate spheroidal wavefunctions, quadrature and interpolation}, 131 | author={Xiao, Hong and Rokhlin, Vladimir and Yarvin, Norman}, 132 | journal={Inverse problems}, 133 | volume={17}, 134 | number={4}, 135 | pages={805}, 136 | year={2001}, 137 | publisher={IOP Publishing} 138 | } 139 | 140 | @article{landau1961prolate, 141 | title={Prolate spheroidal wave functions, Fourier analysis and uncertainty—II}, 142 | author={Landau, Henry J and Pollak, Henry O}, 143 | journal={Bell Labs Technical Journal}, 144 | volume={40}, 145 | number={1}, 146 | pages={65--84}, 147 | year={1961}, 148 | publisher={Wiley Online Library} 149 | } 150 | 151 | 152 | @article{slepian1961prolate, 153 | title={Prolate spheroidal wave functions, {F}ourier analysis and uncertainty {- I}}, 154 | author={Slepian, David and Pollak, Henry O}, 155 | journal={Bell Labs Technical Journal}, 156 | volume={40}, 157 | number={1}, 158 | pages={43--63}, 159 | year={1961}, 160 | publisher={Wiley Online Library} 161 | } 162 | 163 | @article{slepian1964prolate, 164 | title={Prolate spheroidal wave functions, {F}ourier analysis and uncertainty {- IV}: extensions to many dimensions; generalized prolate spheroidal functions}, 165 | author={Slepian, David}, 166 | journal={Bell Labs Technical Journal}, 167 | volume={43}, 168 | number={6}, 169 | pages={3009--3057}, 170 | year={1964}, 171 | publisher={Wiley Online Library} 172 | } 173 | 174 | 175 | 176 | 177 | @book{abramowitz1964handbook, 178 | title={Handbook of mathematical functions: with formulas, graphs, and mathematical tables}, 179 | author={Abramowitz, Milton and Stegun, Irene A}, 180 | year={1966}, 181 | publisher={National Bureau of Standards, New York} 182 | } 183 | 184 | 185 | 186 | 187 | @article{bertero1985commuting, 188 | title={Commuting differential operators for the finite {L}aplace transform}, 189 | author={Bertero, Mario and Grunbaum, F. Alberto}, 190 | journal={Inverse Problems}, 191 | volume={1}, 192 | number={3}, 193 | pages={181}, 194 | year={1985}, 195 | publisher={IOP Publishing} 196 | } 197 | 198 | 199 | @article{LedermanLaplace2, 200 | author = {Roy R. Lederman and Vladimir Rokhlin}, 201 | title = {On the Analytical and Numerical Properties of the Truncated {L}aplace Transform {I}.}, 202 | journal = {SIAM Journal on Numerical Analysis}, 203 | volume = {53}, 204 | number = {3}, 205 | pages = {1214-1235}, 206 | year = {2015}, 207 | doi = {10.1137/140990681}, 208 | 209 | URL = { 210 | https://doi.org/10.1137/140990681 211 | 212 | }, 213 | eprint = { 214 | https://doi.org/10.1137/140990681 215 | 216 | } 217 | 218 | } 219 | 220 | 221 | 222 | 223 | @article{LedermanLaplace1, 224 | author = {Roy R. Lederman and Vladimir Rokhlin}, 225 | title = {On the Analytical and Numerical Properties of the Truncated {L}aplace Transform. Part {II}}, 226 | journal = {SIAM Journal on Numerical Analysis}, 227 | volume = {54}, 228 | number = {2}, 229 | pages = {665-687}, 230 | year = {2016}, 231 | doi = {10.1137/15M1028583}, 232 | 233 | URL = { 234 | https://doi.org/10.1137/15M1028583 235 | 236 | }, 237 | eprint = { 238 | https://doi.org/10.1137/15M1028583 239 | 240 | } 241 | 242 | } 243 | 244 | 245 | @phdthesis{LedermanLaplace2014, 246 | title = {On the Analytical and Numerical Properties of the Truncated {L}aplace Transform}, 247 | author = {Roy R. Lederman}, 248 | url = {http://cpsc.yale.edu/sites/default/files/files/tr1490.pdf}, 249 | year = {2014}, 250 | date = {2014-05-00}, 251 | number = {1497}, 252 | institution = {YALE/DCS}, 253 | school = {Yale University}, 254 | keywords = {Harmonic Analysis, Laplace Transform, Numerical Analysis, Signal Processing, SVD, Truncated Laplace Transform}, 255 | pubstate = {published}, 256 | tppubtype = {phdthesis} 257 | } 258 | 259 | 260 | 261 | @article{lederman2017continuously, 262 | title={Continuously heterogeneous hyper-objects in cryo-EM and 3-D movies of many temporal dimensions}, 263 | author={Lederman, Roy R. and Singer, Amit}, 264 | journal={arXiv preprint arXiv:1704.02899}, 265 | year={2017} 266 | } 267 | 268 | @article{lederman2016representation, 269 | title={A representation theory perspective on simultaneous alignment and classification}, 270 | author={Lederman, Roy R. and Singer, Amit}, 271 | journal={arXiv preprint arXiv:1607.03464}, 272 | year={2016} 273 | } 274 | 275 | -------------------------------------------------------------------------------- /doc/eig_notes.md: -------------------------------------------------------------------------------- 1 | # A Note on Eigendecomposition 2 | 3 | ## General comments 4 | 5 | The preliminary version of this code uses Matlab's eigendecomposition for readability. This particular implementation of eigndecomposition is not ideal for the task for several obvious reasons 6 | * It requires us to construct the full matrix, although the matrix is tridiagonal, and although matlab uses the tridiagonal structure internally. 7 | * We do not need all the eigenvectors, only the smaller ones in magnitude. 8 | There is another, more subtle reason, discussed next. 9 | 10 | ## Not all equals are equal 11 | 12 | Generally speaking, the eigenvectors in an eigendecomposition are computed up to some accuracy ε, 13 | in the sense that if v is the correct normalized eigenvector and \||v-u\||<ε (in the natural l2 norm), then the vector u is considered to be an accurate solution. 14 | In a well-conditioned problem, ε is "machine precision" at best (roughly 10-16). 15 | Therefore, if some entry of the eigenvector v is much smaller than ε, we might as well set it to zero; 16 | Suppose that the first element v(0) in the the eigenvector v is 10-30. Obviously, we can set u(0)=0 and still have u being a numerically accurate eigenvector. 17 | 18 | However, it has been shown in \[1\] that in some cases is it possible to achieve much higher accuracy in the computation of certain elements of the eigenvectors. 19 | This fact turns out to be very useful in several different computations associated with the eigenvalues of prolates. 20 | While many eigendecomposition algorithms obtain accurate eignvectors, not all algorithms retrieve these small elements to the desired accuracy, thus adversely effecting our computation. 21 | In this sense, many algorithms produce numerically "equal" eigenvectors (up to machine precision and sign/phase), but not all have this special property. 22 | In the preliminary version of this code, we use matlab's eigendecomposition in order to make the code more readable. We use an inverse power method step obtain an eigenvector with the desired properties (in some regimes) from the original eigenvector computed by matlab. 23 | In future versions we will replace this operation with an independent eigendecomposition. 24 | 25 | 26 | \[1\] Osipov, Andrei. "Small coordinates of eigenvectors of certain symmetric tridiagonal matrices: numerical evaluation and error analysis." (2014). 27 | 28 | -------------------------------------------------------------------------------- /doc/figures/.gitignore: -------------------------------------------------------------------------------- 1 | *.m~ 2 | -------------------------------------------------------------------------------- /doc/figures/gpsf_report1_figures.m: -------------------------------------------------------------------------------- 1 | % 2 | % prol 3 | % Demosntration code for computing generalized prolate spheroidal functions. 4 | % (Matlab(R) version) 5 | % 6 | % Author: Roy R. Lederman 7 | % http://roy.lederman.name/ 8 | % http://github.com/lederman/prol 9 | % 10 | % This code generates the figures for the paper gpsf_report1.tex 11 | % 12 | 13 | 14 | 15 | function gpsf_report1_figures() 16 | 17 | % run matlab_addpath_prol_src() in /src/matlab before running this code. 18 | 19 | file_header = 'gpsf_report1_' 20 | report_part001(file_header) 21 | 22 | 23 | 24 | end 25 | 26 | 27 | 28 | function report_part001(file_header) 29 | 30 | % 31 | % sample eigenvalues figures 32 | % 33 | c=pi*20; 34 | D=3; 35 | h1=figure; % eigenvalues magnitude |\nu| 36 | h2=figure; % eigenvalues magnitude is close to one: |1-|\nu|| 37 | matdim = 800; 38 | minEigenvalRatio = 10^-40; 39 | prolate_crea_options.isfixfirst = 1; 40 | Ns = [0:5:20]; 41 | for j1=1:length(Ns) 42 | N=Ns(j1); 43 | tic 44 | [prolate_dat, iserr , ~] = prolate_crea(c,D,N,minEigenvalRatio, matdim, prolate_crea_options); 45 | toc 46 | figure(h1) 47 | semilogy([0:prolate_dat.num_prols-1],(abs(prolate_dat.nu)),'LineWidth',3) 48 | hold on 49 | figure(h2) 50 | semilogy([0:prolate_dat.num_prols-1],max(abs(1-abs(prolate_dat.nu)),10^-20),'LineWidth',3) 51 | % the max is taken to avoid log(0) when |\nu| = 1 exactly. 52 | hold on 53 | end 54 | figure(h1) 55 | ylim([10^-30,3]) 56 | xlabel('n') 57 | lgd=legend(num2str(Ns')); 58 | %title(lgd,'N=') 59 | set(gca,'FontSize', 12); 60 | ylabel('|\nu_n|','FontSize', 14) 61 | 62 | print([file_header,'D3_eigenvals.png'],'-dpng') 63 | 64 | 65 | figure(h2) 66 | ylim([10^-16,3]) 67 | xlabel('n') 68 | lgd=legend(num2str(Ns')); 69 | %title(lgd,'N=') 70 | set(gca,'FontSize', 12); 71 | ylabel('|1-|\nu_n||','FontSize', 14) 72 | 73 | print([file_header,'D3_eigenvals_to_one.png'],'-dpng') 74 | 75 | 76 | 77 | % 78 | % Without fixing the coefficients of the first eigenvector 79 | % 80 | h1=figure; 81 | h2=figure; 82 | prolate_crea_options.isfixfirst = 0; 83 | Ns = [0:3:20]; 84 | for j1=1:length(Ns) 85 | N=Ns(j1); 86 | tic 87 | [prolate_dat, iserr , ~] = prolate_crea(c,D,N,minEigenvalRatio, matdim, prolate_crea_options); 88 | toc 89 | figure(h1) 90 | semilogy([0:prolate_dat.num_prols-1],(abs(prolate_dat.nu)),'LineWidth',3) 91 | hold on 92 | figure(h2) 93 | semilogy([0:prolate_dat.num_prols-1],abs(1-abs(prolate_dat.nu)),'LineWidth',3) 94 | hold on 95 | end 96 | figure(h1) 97 | ylim([10^-30,3]) 98 | xlabel('n') 99 | lgd=legend(num2str(Ns')); 100 | %title(lgd,'N=') 101 | set(gca,'FontSize', 12); 102 | ylabel('\nu_n','FontSize', 14) 103 | 104 | 105 | 106 | % 107 | % sample eigenfunctions figures 108 | % 109 | c= 20 * pi; 110 | D=3; 111 | N=0; 112 | matdim = 800; 113 | xx = linspace(0,1,1000); 114 | minEigenvalRatio = 10^-30; 115 | prolate_crea_options.isfixfirst = 1; 116 | 117 | 118 | tic 119 | [prolate_dat, iserr , ~] = prolate_crea(c,D,N,minEigenvalRatio, matdim, prolate_crea_options); 120 | toc 121 | tic 122 | [v] = prolate_ev(prolate_dat, [0:prolate_dat.num_prols-1], xx); 123 | toc 124 | h1 = figure; 125 | funcid = [0:1,2,5,10]; 126 | plot(xx,v(:,funcid+1),'LineWidth',2); 127 | xlabel('x') 128 | lgd=legend(num2str(funcid')); 129 | set(gca,'FontSize', 12); 130 | ylabel('\Phi_{N,n}(x)','FontSize', 14) 131 | 132 | print([file_header,'D3_N0_eigenfuncs.png'],'-dpng') 133 | 134 | % 135 | % 136 | % 137 | N=1; 138 | tic 139 | [prolate_dat, iserr , ~] = prolate_crea(c,D,N,minEigenvalRatio, matdim, prolate_crea_options); 140 | toc 141 | tic 142 | [v] = prolate_ev(prolate_dat, [0:prolate_dat.num_prols-1], xx); 143 | toc 144 | h1 = figure; 145 | funcid = [0:1,2,5,10]; 146 | plot(xx,v(:,funcid+1),'LineWidth',2); 147 | xlabel('x') 148 | lgd=legend(num2str(funcid')); 149 | set(gca,'FontSize', 12); 150 | ylabel('\Phi_{N,n}(x)','FontSize', 14) 151 | 152 | print([file_header,'D3_N1_eigenfuncs.png'],'-dpng') 153 | 154 | 155 | end 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /doc/gpsf_report1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lederman/Prol/cebd18cf7f1a9bced304c5671fb2a31c57cad0db/doc/gpsf_report1.pdf -------------------------------------------------------------------------------- /doc/gpsf_report1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt]{article} 2 | \usepackage{amsmath} 3 | \usepackage{mathtools} 4 | \usepackage{amssymb} 5 | 6 | \usepackage{bm} % bold math 7 | \usepackage{booktabs} % for line separators in tables 8 | 9 | \usepackage{hyperref} % URL 10 | 11 | 12 | % 13 | % Theorem types 14 | % 15 | \newtheorem{theorem}{Theorem} 16 | \newtheorem{corollary}[theorem]{Corollary} 17 | \newtheorem{lemma}[theorem]{Lemma} 18 | \newtheorem{observation}[theorem]{Observation} 19 | \newtheorem{proposition}[theorem]{Proposition} 20 | \newtheorem{definition}[theorem]{Definition} 21 | \newtheorem{claim}[theorem]{Claim} 22 | \newtheorem{fact}[theorem]{Fact} 23 | \newtheorem{assumption}[theorem]{Assumption} 24 | \newtheorem{remark}{Remark} 25 | 26 | % 27 | % Operators 28 | % 29 | \DeclareMathOperator*{\argmin}{arg\,min} 30 | \DeclareMathOperator*{\argmax}{arg\,max} 31 | 32 | \hypersetup{pdfauthor={Roy R. Lederman},pdftitle={Generalized Prolate Spheroidal Functions}} 33 | 34 | \title{Numerical Algorithms for the Computation of Generalized Prolate Spheroidal Functions} 35 | \date{\today} 36 | \author{Roy R. Lederman\\ \small The Program in Applied and Computational Mathematics\\ \small Princeton University} 37 | 38 | \begin{document} 39 | \maketitle 40 | 41 | 42 | % 43 | % 44 | % 45 | \begin{abstract} 46 | Generalized Prolate Spheroidal Functions (GPSF) are the eigenfunctions of the truncated Fourier transform, restricted to D-dimensional balls in the spatial domain and frequency domain. Despite their useful properties in many applications, GPSFs are often replaced by crude approximations. 47 | The purpose of this paper is to review the elements of computing GPSFs and associated eigenvalues. 48 | This paper is accompanied by open-source code. 49 | \end{abstract} 50 | {\bf Keywords:} Generalized Prolate Spheroidal Functions, GPSF, PSWF, Truncated Fourier Transform, Implementation. 51 | 52 | 53 | % 54 | % draft note for in-development versions. 55 | % 56 | %\begin{center} 57 | %{\Huge *** DRAFT ***} 58 | %\end{center} 59 | 60 | 61 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 62 | %%%%%%%%%% Introduction %%%%%%%%%%% 63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 64 | \section{Introduction}\label{sec:intro} 65 | 66 | Prolate Spheroidal Wave Functions (PSWF), the one-dimensional case of the GPSFs discussed in this paper, 67 | are the eigenfunctions of the truncated Fourier transform $F_c$, defined by the formula 68 | \begin{equation} 69 | \left(F_c\psi\right)(x) = \int_{-1}^1 e^{\mathrm{i} cxy} \psi(y) dy , 70 | \end{equation} 71 | %\begin{equation} 72 | % \alpha_n \psi_n(x) = \int_{-1}^1 e^{\mathrm{i} cxy} \psi_n(y) dy = \left(F_c\psi_n\right)(x) , 73 | %\end{equation} 74 | with $x \in [-1,1]$. 75 | In the classic work \cite{slepian1961prolate} by Slepian and Pollak it has been shown that the integral operator $F_c ^*F_c$ 76 | commutes with the differential operator $L_c$ defined by the formula 77 | \begin{equation} 78 | \left(L_c\psi\right)(x) = (1-x^2) \frac{d^2}{dx^2}\psi(x) - 2x \frac{d}{dx}\psi(x) -c^2 x^2 \psi(x). 79 | \end{equation} 80 | This remarkable property was subsequently used to infer many of the properties of PSWFs and to develop efficient and accurate methods for computing them in \cite{slepian1961prolate,xiao2001prolate,xiao2003high,rokhlin2007approximate,osipov2013prolate,lederman2017lower} among other works. 81 | This rare relation between an integral operator and a differential operator has been discovered and used for the analysis of the truncated Laplace transform as well (e.g. \cite{bertero1985commuting,LedermanLaplace2,lederman2017lower}). 82 | 83 | In subsequent work in \cite{slepian1964prolate}, Slepian discovered a similar relation associated with the general case of 84 | high dimensional Fourier transform, supported on the unit ball 85 | \begin{equation} 86 | \left( {F}_c \psi\right)({\bm x}) = \int_{|{\bm y}| \leq 1} e^{ \mathrm{i} c \left( {\bm{x}} \cdot {\bm{y}} \right) } \psi(\bm{y}) {d}\bm{y} , 87 | \end{equation} 88 | where ${\bm y}$ and ${\bm x}$ are vectors in $\mathbb{R}^D$, and $ |{\bm x}| \leq 1 $ . 89 | The eigenfunctions of this operator are the GPSFs. 90 | 91 | PSWFs have been useful in many applications in signal processing. Among their many useful properties, they are the optimal basis for representing functions whose energy is as concentrated as possible in the interval $[-1,1]$ in the spatial domain, and in the interval $[-c,c]$ in the frequency domain. 92 | GPSFs are known to be useful in many applications in signal processing and optics, however they have gained a reputation of being prohibitively difficult to compute, and in practice they are often replaced by crude approximations. 93 | 94 | The properties of GPSFs have been studied by Slepian in \cite{slepian1964prolate}. Many of the properties of the two-dimensional GPSFs, have been studied in \cite{shkolnisky2007prolate,shkolnisky2006approximation}. 95 | Recently, the more general GPSFs have been studied in \cite{serkh2015generalized}, and they are being studied in the upcoming \cite{greengard2017generalized}. 96 | However, we are not aware of a complete publicly available resource and code for efficient and accurate computation of GPSFs and their associated eigenvalues. 97 | 98 | The purpose of this paper is to review the essential results for computing GPSFs, and to introduce numerical code for computing GPSFs. 99 | We review results primarily from \cite{slepian1964prolate,shkolnisky2007prolate} and \cite{serkh2015generalized}, with some reformulation and generalization, as well as some unpublished results which Philip Greengard and Kirill Serkh have been generous to share with us from their upcoming \cite{greengard2017generalized}, and introduce additional results. 100 | 101 | 102 | The immediate motivation for this paper is the use of three-dimensional GPSFs for representing objects that are highly concentrated in both the spatial and frequency domains in cryo-electron microscopy (cryo-EM) applications (e.g. \cite{lederman2016representation,lederman2017continuously}). 103 | Indeed the two-dimensional GPSFs have been used successfully for the representation of images in cryo-EM in \cite{landa2017approximation,landa2017steerable}. 104 | 105 | A MATLAB\textsuperscript{TM} source code is available at \url{http://github.com/lederman/prol} together with the LaTeX source for this paper. FORTRAN code is under development. 106 | In addition, the URL above contains Mathematica\textsuperscript{TM} code which performs various levels of analytic verification of some of the equations in this paper after they have been derived in other means (an ``open-source proof''). 107 | 108 | The current paper and code are preliminary results of the ongoing project in \url{http://github.com/lederman/prol}. We welcome comments and contributions to the code and paper. 109 | 110 | This paper is organized as follows. Section \ref{sec:pre} briefly reviews standard definitions and results that are used in the paper. Section \ref{sec:analysis} presents the essential analytical results required for computing GPSFs. 111 | The algorithms based on these analytical results are presented in Section \ref{sec:alg}. 112 | Numerical results obtained with the publicly available code are presented in Section \ref{sec:results}. 113 | Finally, brief conclusions are presented in \ref{sec:conclusions}. 114 | 115 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 116 | %%%%%%%%%% Preliminaries %%%%%%%%%% 117 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 118 | \section{Preliminaries}\label{sec:pre} 119 | 120 | 121 | % 122 | % 123 | % 124 | %\subsection{Table of Notation} 125 | 126 | \begin{table}[htbp] 127 | \caption{Notation} 128 | \begin{center} 129 | \begin{tabular}{r p{10cm} } 130 | \toprule 131 | $c$ & band-limit, see, for example, Equation (\ref{eq:def:truncated_Fourier}). \\ 132 | $D$ & dimensionality. $D \ge 2$ is assumed.\\ 133 | $p$ & $p=D-2$ \\ 134 | $N$ & angular frequency, see, for example, Section \ref{sec:surfaceharmonics} and equations (\ref{eq:scaled_truncated_fourier_eig:separation}) and (\ref{eq:def:prol}) \\ 135 | $P^{(\alpha,\beta)}_n$ & Jacobi Polynomials (see Section \ref{sec:jacobi} )\\ 136 | $\overline{R_{\text{N,n}}^{\text{p}}}$ & normalized radial Zernike polynomials (see Section \ref{sec:zernike}) \\ 137 | $T_{\text{N,n}}^{\text{p}}$ & weighted radial Zernike polynomials (see Section \ref{sec:zernike}) \\ 138 | $J_n$ & Bessel functions of the first kind (see Section \ref{sec:bessel}) \\ 139 | $S_N^m({\bm \xi})$ & surface harmonics (see Section \ref{sec:surfaceharmonics}) \\ 140 | $\Gamma (n)$ & the gamma function. Defined in (\ref{eq:def:gammafunc})\\ 141 | $\mathcal{F}$ & Fourier transform. Defined in (\ref{eq:def:Fourier}) \\ 142 | $\mathcal{F}_c$ & truncated Fourier transform. Defined in (\ref{eq:def:truncated_Fourier}) \\ 143 | ${F}_c$ & scaled truncated Fourier transform. Defined in (\ref{eq:scaled_truncated_fourier}) \\ 144 | $M_{p,c,N}$ & the integral operator defined in (\ref{eq:operator_M}) \\ 145 | $L_{p,c,N}$ & the differential operator defined in (\ref{eq:operator_L}) \\ 146 | $B_{\text{N}}^{\text{p,c}}$ & the matrix form of the operator $L_{p,c,N}$ in the basis of weighted radial Zernike polynomials. Defined in (\ref{eq:Bmat_nn}) and (\ref{eq:Bmat_nm1n})\\ 147 | $\psi_{N,n,m}({\bm r})$ & GPSFs defined in (\ref{eq:def:prol}) \\ 148 | $\Phi_{N,n}(r)$ & radial GPSFs defined in (\ref{eq:def:radial_prol}) \\ 149 | $\varphi_{N,n}(r)$ & weighted radial GPSF defined in (\ref{eq:def:weighted_radial_prol}) \\ 150 | $\widetilde{\psi_{N,n,m}}({\bm r})$ & the ``eigenfunctions'' defined in (\ref{eq:def:tilde_psi}) \\ 151 | $\alpha_{N,n,m} = \alpha_{N,n}$ & the eigenvalues defined in (\ref{eq:alpha}) \\ 152 | $\beta_{N,n}$ & the eigenvalues defined in (\ref{eq:def:radial_prol}) \\ 153 | $\gamma_{N,n}$ & the eigenvalues defined in (\ref{eq:gamma}) \\ 154 | $\nu_{N,n}$ & the eigenvalues defined in (\ref{eq:nu}) \\ 155 | $\chi^{p,c,N}_n$ & the eigenvalues defined in (\ref{eq:operator_L:eig}) of the differential operator $L_{p,c,N}$ \\ 156 | \bottomrule 157 | \end{tabular} 158 | \end{center} 159 | \label{table;notation} 160 | \end{table} 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | % 171 | % 172 | % 173 | \subsection{Jacobi Polynomials}\label{sec:jacobi} 174 | The following are well-known properties of the Jacobi polynomials, denoted by $P_n^{(\alpha ,\beta )}(x)$. 175 | The standard definition of Jacobi polynomials, along with these properties and others, can be found, inter alia, in \cite{abramowitz1964handbook}. 176 | 177 | 178 | \begin{equation}\label{eq:jac1} 179 | (1-x) P_n^{(\alpha +1,\beta )}(x)=\frac{(n+\alpha +1) P_n^{(\alpha ,\beta )}(x)-(n+1) 180 | P_{n+1}^{(\alpha ,\beta )}(x)}{n+\frac{\alpha }{2}+\frac{\beta }{2}+1} 181 | \end{equation} 182 | 183 | \begin{equation}\label{eq:jac2} 184 | (n+\alpha +\beta ) P_n^{(\alpha ,\beta )}(x)=(2 n+\alpha +\beta ) P_n^{(\alpha ,\beta 185 | -1)}(x)-(n+\alpha ) P_{n-1}^{(\alpha ,\beta )}(x) 186 | \end{equation} 187 | 188 | \begin{equation}\label{eq:jac3} 189 | \frac{{d} P_n^{(\alpha ,\beta )}(x)}{{d} x}=\frac{1}{2} (n+\alpha +\beta +1) 190 | P_{n-1}^{(\alpha +1,\beta +1)}(x) 191 | \end{equation} 192 | 193 | \begin{equation}\label{eq:jac4} 194 | P_n^{(\alpha ,\beta )}(1) = \frac{\Gamma(n+\alpha+1)}{\Gamma(n+1)\Gamma(\alpha+1)} 195 | \end{equation} 196 | 197 | % 198 | % 199 | % 200 | \subsection{Radial Zernike Polynomials}\label{sec:zernike} 201 | 202 | The purpose of this section is to define the normalized radial Zernike polynomials. 203 | The properties of Zernike polynomials are discussed in further detail in \cite{slepian1964prolate,serkh2015generalized}. 204 | We note that slightly different definitions and normalization are used in different sources. 205 | 206 | In this paper, the normalized radial Zernike polynomials, denoted by $\overline{R_{\text{N,n}}^{\text{p}}}(x)$, are defined by the formula 207 | \begin{equation}\label{eq:def:norm_radial_zer} 208 | \overline{R_{\text{N,n}}^{\text{p}}}(x)=\sqrt{2} (-1)^n x^N \sqrt{2 n+N+\frac{p}{2}+1} 209 | P_n^{\left(N+\frac{p}{2},0\right)}\left(1-2 x^2\right), 210 | \end{equation} 211 | where $P_n^{(\alpha ,\beta )}(x)$ are the Jacobi polynomials. 212 | The normalized radial Zernike polynomials are orthonormal in the following sense: 213 | \begin{equation} 214 | \int_0^1 x^{p+1} \overline{R_{\text{N,n}}^{\text{p}}}(x) \overline{R_{\text{N,j}}^{\text{p}}}(x) \, dx = \delta_{n,j} . 215 | \end{equation} 216 | 217 | The weighted radial Zernike polynomials, denoted by $T_{\text{N,n}}^{\text{p}}(x)$, are defined by the formula 218 | \begin{equation}\label{eq:def:weighted_radial_zernike} 219 | T_{\text{N,n}}^{\text{p}}(x)=x^{\frac{p+1}{2}} \overline{R_{\text{N,n}}^{\text{p}}}(x), 220 | \end{equation} 221 | so that they are orthonormal in the following sense: 222 | \begin{equation} 223 | \int_0^1 {T_{\text{N,n}}^{\text{p}}}(x) {T_{\text{N,j}}^{\text{p}}}(x) \, dx = \delta_{n,j} . 224 | \end{equation} 225 | 226 | 227 | % 228 | % 229 | % 230 | \subsection{The Gamma Function} 231 | 232 | The standard gamma function, denoted by $\Gamma (z)$, is defined by the formula 233 | \begin{equation}\label{eq:def:gammafunc} 234 | \Gamma(z) = \int_0^\infty x^{z-1} e^{-x} dx. 235 | \end{equation} 236 | For a positive integer $n$, 237 | \begin{equation} 238 | \Gamma(n+1) = n!. 239 | \end{equation} 240 | 241 | 242 | % 243 | % 244 | % 245 | \subsection{Bessel Functions}\label{sec:bessel} 246 | 247 | The following are well-known properties of Bessel functions of the first kind, denoted by $J_n(x)$. 248 | The standard definition of Bessel functions can be found, inter alia, in \cite{abramowitz1964handbook}. 249 | 250 | 251 | \begin{equation} 252 | e^{\mathrm{i} z \cos{\varphi}} = \sum_{n=-\infty}^\infty \mathrm{i}^n J_n(z) e^{\mathrm{i} n \varphi} 253 | \end{equation} 254 | 255 | 256 | 257 | \begin{equation} 258 | J_n(z) = z^n \left(\frac{2^{-n}}{\Gamma (n+1)}+O\left(z^2\right)\right) 259 | \end{equation} 260 | 261 | % 262 | % 263 | % 264 | \subsection{Surface Harmonics }\label{sec:surfaceharmonics} 265 | 266 | In this section we presents properties of integrals on the surface of spheres, that are useful in the polar decomposition of functions 267 | in this paper. A comprehensive discussion of these properties can be found, inter alia, in \cite{slepian1964prolate,serkh2015generalized}. 268 | 269 | Let $S_N^m({\bm \xi})$ be the complete set of orthonormal surface harmonics of degree $N=0,1,2,\ldots$, with ${\bm \xi}$ a unit vectors in $D$ dimensions. 270 | For a hyper-sphere in $D=p+2$ dimensions, there are $h(N,p)$ orthonormal functions in the set, where 271 | \begin{equation}\label{eq:def:hnp} 272 | h(N,p) = (2N+p)\frac{(N+p-1)}{p! N!} 273 | \end{equation} 274 | with $h(N,p)=1$ in the case of $N=p=0$. 275 | 276 | \begin{remark} 277 | In the case of $D=2$, the surface harmonics $S_N^m({\bm \xi})$ are the Sine and Cosine functions or the complex exponentials of frequency $N$ (with the proper normalization), 278 | with $h(0,0)=1$ functions for the zero frequency, and $h(N,0)=2$ for the $N>0$ frequency. 279 | In the case of $D=3$, the surface harmonics are the spherical harmonics $Y_N^m$, with $h(N,0)=2N+1$ functions for the $N$ frequency. 280 | \end{remark} 281 | 282 | Suppose that ${\bm x}= r {\bm \xi}$ and ${\bm y}= r'{\bm n}$, where $r$ and $r'$ are non-negative scalars, and ${\bm \xi}$ and ${\bm n}$ are unit vectors in $D$ dimensions. 283 | Then, 284 | \begin{equation}\label{eq:exp_bessel} 285 | \int_\Omega e^{\mathrm{i} c r r' {\bm \xi} \cdot {\bm n}} S_N^m({\bm n}) d\Omega({\bm n}) = H^p_N(crr') S_N^m({\bm \xi}) 286 | \end{equation} 287 | where $ {\bm{x}} \cdot {\bm{t}} = \sum{x_i t_i} $ is the usual inner product, 288 | $\Omega$ is the surface, 289 | and 290 | \begin{equation} 291 | H^p_N(crr') = \mathrm{i}^N (2 \pi)^{1+p/2} \frac{J_{N+p/2}(crr')}{(crr')^{p/2}}, 292 | \end{equation} 293 | where $J_{N+p/2}$ are Bessel functions. 294 | A proof can be found in \cite{slepian1964prolate}. 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 304 | %%%%%%% Analytical Apparatus %%%%%% 305 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 306 | \section{Analytical Apparatus}\label{sec:analysis} 307 | 308 | % 309 | % 310 | % 311 | \subsection{The Truncated Fourier Transform and Associated Integral Operators}\label{sec:truncated_fourier} 312 | 313 | In this section we discuss standard definitions of the integral operators associated with GPSFs. 314 | A more detailed discussion of the operators can be found in \cite{slepian1964prolate,serkh2015generalized}. 315 | 316 | The unitary Fourier integral transform $\mathcal{F}$ in $D$ dimensions is defined by the formula 317 | \begin{equation}\label{eq:def:Fourier} 318 | \left(\mathcal{F} f \right)({\bm x}) = \left(\frac{1}{2 \pi }\right)^{D/2} \int_{\mathbb{R}^D} e^{ \mathrm{i} {\bm{x}} \cdot {\bm{t}} } f(t) {d}{\bm t} , 319 | \end{equation} 320 | where ${\bm t}$ and ${\bm x}$ are vectors, and $ {\bm{x}} \cdot {\bm{t}} = \sum{x_i t_i} $ is the usual inner product. 321 | 322 | The truncate Fourier transform $\mathcal{F}_c : L^2(B^D) \rightarrow L^2(c B^D)$ is the restriction of the domain of the Fourier Transform 323 | to functions supported on the unit ball $B^D$ of dimension $D$, centered at the origin, with the range truncated to the ball $c B^D$ of radius $c$, 324 | \begin{equation}\label{eq:def:truncated_Fourier} 325 | \mathcal{F}_c = {\bm 1}_{c B^D} \mathcal{F} {\bm 1}_{B^D} , 326 | \end{equation} 327 | where ${\bm 1}_{B^D}$ is the restriction operator. 328 | In other words, 329 | \begin{equation} 330 | \left(\mathcal{F}_c f \right)({\bm x}) = \left(\frac{1}{2 \pi }\right)^{D/2} \int_{\|{\bm t}\| \leq 1} e^{ \mathrm{i} {\bm{x}} \cdot {\bm{t}} } f(t) {d}{\bm t} , 331 | \end{equation} 332 | with ${\bm x}$ restricted to $\|{\bm x}\| \leq 1$. 333 | 334 | It is often convenient to scale the truncated Fourier transform to the form ${F}_c : L^2(B^D) \rightarrow L^2(B^D)$ defined by the equation 335 | \begin{equation}\label{eq:scaled_truncated_fourier} 336 | \left({F}_c \psi \right)(x) = \int_B e^{ \mathrm{i} c \left( {\bm{x}} \cdot {\bm{t}} \right) } \psi(\bm{t}) {d}\bm{t} . 337 | \end{equation} 338 | In this form, the domain and range are the same function spaces. 339 | The goal of this paper is to discuss the computation of the GPSFs which are the eigenfunctions of the operator ${F}_c$, 340 | and the associated eigenvalues, i.e. the functions $\psi$ and scalars $\alpha$ that satisfy 341 | \begin{equation}\label{eq:scaled_truncated_fourier_eig} 342 | \alpha \psi = {F}_c \psi . 343 | \end{equation} 344 | 345 | 346 | % 347 | % 348 | % 349 | 350 | Let $p=D-2$, ${\bm x}= r {\bm \xi}$ and ${\bm y}= r'{\bm n}$, where $r$ and $r'$ are non-negative real numbers, and ${\bm \xi}$ and ${\bm n}$ are unit vectors in $D$ dimensions. Substituting (\ref{eq:scaled_truncated_fourier}) into (\ref{eq:scaled_truncated_fourier_eig}) with this change of variables yields 351 | \begin{equation} 352 | \left( {F}_c \psi\right)(r {\bm \xi}) = \alpha \psi(r {\bm \xi}) = \int_0^1 dr' r'^{p+1} \int_\Omega e^{ \mathrm{i} c r r' \left( {\bm{\xi}} \cdot {\bm{n}} \right) } \psi(r' \bm{n}) {d}\Omega(\bm{n}) , 353 | \end{equation} 354 | and suggests a separation of variables $\psi(r {\bm \xi}) = \Phi(r) S_N^m({\bm \xi})$, such that 355 | \begin{equation}\label{eq:scaled_truncated_fourier_eig:separation} 356 | \left( {F}_c \psi\right)(r {\bm \xi}) = \alpha \Phi(r) S_N^m({\bm \xi}) = \int_0^1 dr' r'^{p+1} \Phi(r') \int_\Omega e^{ \mathrm{i} c r r' \left( {\bm{\xi}} \cdot {\bm{n}} \right) } S_N^m({\bm n})) {d}\Omega(\bm{n}) . 357 | \end{equation} 358 | Substituting (\ref{eq:exp_bessel}) into (\ref{eq:scaled_truncated_fourier_eig:separation}) yields 359 | \begin{equation} 360 | \left( {F}_c \psi\right)(r {\bm \xi}) = \alpha \Phi(r) S_N^m({\bm \xi}) = \mathrm{i}^N (2 \pi)^{1+p/2} \left( \int_0^1 \frac{J_{N+p/2}(crr')}{(crr')^{p/2}} \Phi(r') r'^{p+1} dr' \right) S_N^m({\bm \xi}). 361 | \end{equation} 362 | 363 | 364 | 365 | For a given dimension $D=p+2$ and $c>0$, the radial GPSFs, denoted by $\Phi_{N,n}$, are defined as the eigenfunctions of the radial operator, i.e. the solutions of the integral equation 366 | \begin{equation}\label{eq:def:radial_prol} 367 | \beta_{N,n} \Phi_{N,n}(r) = \int_0^1 \frac{J_{N+p/2}(crr')}{(crr')^{p/2}} \Phi_{N,n}(r') r'^{p+1} dr' 368 | \end{equation} 369 | with $\beta_{N,n}$ the eigenvalues of the operator. For each order $N$, the functions are organized so that $\beta_{N,n}>\beta_{N,n+1}$. 370 | Indeed, the GPSFs, denoted by $\psi_{N,n,m}$, are of the form 371 | \begin{equation}\label{eq:def:prol} 372 | \psi_{N,n,m}(r {\bm \xi}) = \Phi_{N,n}(r) S_N^m({\bm \xi}). 373 | \end{equation} 374 | These functions are the eigenfunctions of $F_c$ (see (\ref{eq:scaled_truncated_fourier_eig})), with the eigenvalues 375 | \begin{equation}\label{eq:alpha} 376 | \alpha_{N,n,m} = \alpha_{N,n} = \mathrm{i}^N (2 \pi)^{1+p/2} \beta_{N,n}, 377 | \end{equation} 378 | and with $N,n = 0,1,\ldots$, and $m=1,2,\ldots,h(N,p)$, where $h(N,p)$ is defined in (\ref{eq:def:hnp}). 379 | 380 | Finally, the weighted radial GPSFs, denoted by $\varphi_{N,n}(r)$, are defined by the formula 381 | \begin{equation}\label{eq:def:weighted_radial_prol} 382 | \varphi_{N,n}(r) = r^{\frac{p+1}{2}} \Phi_{N,n}(r). 383 | \end{equation} 384 | The weighted radial GPSFs satisfy the integral equation 385 | \begin{equation}\label{eq:weighted_radial_prol:eig} 386 | \gamma_{N,n} \varphi_{N,n}(r) = \int_0^1 {J_{N+p/2}(crr')} \sqrt{crr'} \varphi_{N,n}(r') dr' 387 | \end{equation} 388 | where 389 | \begin{equation}\label{eq:gamma} 390 | \gamma_{N,n} = \beta_{N,n} c^{\frac{p+1}{2}}. 391 | \end{equation} 392 | In other words, the weighted radial GPSFs are the eigenfunctions of the operator $M_{p,c,N}$, defined by the formula 393 | \begin{equation}\label{eq:operator_M} 394 | \left( M_{p,c,N} \varphi \right)(r) = \int_0^1 {J_{N+p/2}(crr')} \sqrt{crr'} \varphi(r') dr' . 395 | \end{equation} 396 | 397 | 398 | 399 | % 400 | % 401 | % 402 | \subsection{The Associated Differential Operator} 403 | 404 | In this section we summarize several properties of the differential operator 405 | $L_{p,c,N}$, defined by the formula 406 | \begin{equation}\label{eq:operator_L} 407 | \left( L_{p,c,N} \varphi \right)(x) = \left( \frac{d}{dx}(1-x^2)\frac{d}{dx}\varphi(x) \right) + \left( \frac{1/4-(N+p/2)^2}{x^2} -c^2 x^2\right)\varphi(x). 408 | \end{equation} 409 | 410 | 411 | In the classic work in \cite{slepian1964prolate}, 412 | Slepian found that the integral operator $M_{p,c,N}$, defined in (\ref{eq:operator_M}), commutes with the differential operator $L_{p,c,N}$, 413 | \begin{equation} 414 | M_{p,c,N} L_{p,c,N} \varphi = L_{p,c,N} M_{p,c,N} \varphi, 415 | \end{equation} 416 | so that they share the same eigenfunctions (but not eigenvalues). 417 | The eigendecomposition of $L_{p,c,N}$ is therefore 418 | \begin{equation}\label{eq:operator_L:eig} 419 | L_{p,c,N} \varphi_{N,n} = \chi^{p,c,N}_n \varphi_{N,n}, 420 | \end{equation} 421 | where $\varphi_{N,n}$ are the same functions defined in (\ref{eq:def:weighted_radial_prol}), 422 | and $\chi^{p,c,N}_n$ the eigenvalues of $L_{p,c,N}$. 423 | 424 | 425 | 426 | % 427 | % 428 | % 429 | \subsection{The Differential Operator in the Basis of Weighted Radial Zernike Polynomials} 430 | 431 | The purpose of this section is to discuss the differential operator $L_{p,c,N}$ (defined in (\ref{eq:operator_L})) in the context of the 432 | weighted radial Zernike polynomials $T_{\text{N,n}}^{\text{p}}$ (defined in (\ref{eq:def:weighted_radial_zernike})). 433 | The results in this section appear in slightly different forms, or for special cases, in \cite{slepian1964prolate,shkolnisky2007prolate,serkh2015generalized}. 434 | 435 | For given $p,c$ and $N$, we define the matrix elements $B_{\text{N}}^{\text{p,c}}(n,n)$ and $B_{\text{N}}^{\text{p,c}}(n-1,n)=B_{\text{N}}^{\text{p,c}}(n,n-1)$ 436 | (with $n=0,1,2,\ldots$) of the matrix $B_{\text{N}}^{\text{p,c}}$ by the formulas 437 | \begin{equation}\label{eq:Bmat_nm1n} 438 | \begin{split} 439 | B_{\text{N}}^{\text{p,c}}(n-1,n)&=B_{\text{N}}^{\text{p,c}}(n,n-1)= \\ 440 | &=-\frac{c^2 n \left(n+N+\frac{p}{2}\right)}{\sqrt{1-\frac{2}{2 n+N+\frac{p}{2}+1}} \left(2 n+N+\frac{p}{2}\right) \left(2 n+N+\frac{p}{2}+1\right)}, 441 | \end{split} 442 | \end{equation} 443 | where in the case of $n=0$ we set $B_{\text{N}}^{\text{p,c}}(n-1,n)=B_{\text{N}}^{\text{p,c}}(n,n-1)=0$, 444 | and 445 | \begin{equation}\label{eq:Bmat_nn} 446 | B_{\text{N}}^{\text{p,c}}(n,n)=-\left(\frac{\left(\left(2 n+N+\frac{p}{2}+1\right) 447 | \left(N+\frac{p}{2}\right)+2 (n+1) n\right) c^2}{\left(2 n+N+\frac{p}{2}\right) \left(2 448 | n+N+\frac{p}{2}+2\right)}+\kappa _{\text{N,n}}^{\text{p}}\right), 449 | \end{equation} 450 | where in the case of $N=p=n=0$, we define $B_{\text{0}}^{\text{0,c}}(0,0) = -\kappa _{\text{0,0}}^{\text{0}} + c^2/2$, 451 | and with $\kappa _{\text{N,n}}^{\text{p}}$ defined by the formula 452 | \begin{equation} 453 | \kappa _{\text{N,n}}^{\text{p}}=\left(2 n+N+\frac{p}{2}+\frac{1}{2}\right) \left(2 454 | n+N+\frac{p}{2}+\frac{3}{2}\right) . 455 | \end{equation} 456 | 457 | The differential operator $L_{p,c,N}$ (defined in (\ref{eq:operator_L})) applied to $T_{\text{N,n}}^{\text{p}}$ (defined in (\ref{eq:def:weighted_radial_zernike})) 458 | yields a linear combination of $T_{\text{N,n}}^{\text{p}},T_{\text{N,n+1}}^{\text{p}}$ and $T_{\text{N,n-1}}^{\text{p}}$ (or, in the case of $n=0$, a linear combination of 459 | $T_{\text{N,n}}^{\text{p}}$ and $T_{\text{N,n+1}}^{\text{p}}$), specified in the following equation: 460 | \begin{equation}\label{eq:L_T} 461 | \begin{split} 462 | & \left( L_{p,c,N} T_{\text{N,n}}^{\text{p}} \right)(x) = \\ 463 | & = \frac{{d} }{{d} x}\left(\left(1-x^2\right) \frac{{d} T_{\text{N,n}}^{\text{p}}(x)}{{d} x}\right)+\left(\frac{\frac{1}{4}-\left(N+\frac{p}{2}\right)^2}{x^2}-c^2 x^2\right) T_{\text{N,n}}^{\text{p}}(x) = \\ 464 | & = B_{\text{N}}^{\text{p,c}}(n,n-1) T_{\text{N,n-1}}^{\text{p}}(x)+B_{\text{N}}^{\text{p,c}}(n,n+1) T_{\text{N,n+1}}^{\text{p}}(x)+B_{\text{N}}^{\text{p,c}}(n,n) T_{\text{N,n}}^{\text{p}}(x) 465 | \end{split} 466 | \end{equation} 467 | An additional analytical verification of this equation is available in the online resources accompanying this paper. 468 | 469 | 470 | Suppose that ${\bm h}^{p,c,N,n}$ is the vector of coefficients of the weighted radial GPSF $\varphi_{N,n}(r)$ (defined in (\ref{eq:def:weighted_radial_prol})) 471 | expanded in the basis of weighted radial Zernike polynomials $T_{\text{N,n}}^{\text{p}}$ (defined in (\ref{eq:def:weighted_radial_zernike})), such that 472 | \begin{equation}\label{eq:weighted_prol_expand} 473 | \varphi_{N,n}(x) = \sum_{k=0}^{\infty} {h}^{p,c,N,n}_k T_{\text{N,k}}^{\text{p}}(x) , 474 | \end{equation} 475 | where ${h}^{p,c,N,n}_k$ are the elements of the vector ${\bm h}^{p,c,N,n}$ with $k=0,1,2,\ldots$. 476 | It follows from (\ref{eq:operator_L:eig}), (\ref{eq:L_T}) and (\ref{eq:weighted_prol_expand}) that 477 | ${\bm h}^{p,c,N,n}$ are the eigenvectors of the matrix $B_{\text{N}}^{\text{p,c}}$ (defined in (\ref{eq:Bmat_nn}) and (\ref{eq:Bmat_nm1n})), 478 | with the eigenvalues $\chi^{p,c,N}_n$, defined in (\ref{eq:operator_L:eig}): 479 | \begin{equation}\label{eq:operator_L:eig:mat} 480 | \chi^{p,c,N}_n {\bm h}^{p,c,N,n} = B_{\text{N}}^{\text{p,c}} {\bm h}^{p,c,N,n} . 481 | \end{equation} 482 | The eigenvectors are sorted so that $|\chi^{p,c,N}_0| < |\chi^{p,c,N}_1| < \ldots $. 483 | 484 | It follows from (\ref{eq:def:weighted_radial_zernike}), (\ref{eq:def:weighted_radial_prol}) and (\ref{eq:weighted_prol_expand}) that the expansion of radial GPSFs $\Phi_{N,n}$ (defined in (\ref{eq:def:radial_prol})), in the basis of normalized radial Zernike polynomials (defined in (\ref{eq:def:norm_radial_zer})) is 485 | \begin{equation}\label{eq:prol_expand} 486 | \Phi_{N,n}(x) = \sum_{k=0}^{\infty} {h}^{p,c,N,n}_k \overline{R_{\text{N,k}}^{\text{p}}}(x) . 487 | \end{equation} 488 | 489 | 490 | 491 | 492 | % 493 | % 494 | % 495 | \subsection{The Relation between $x \frac{{d} \overline{R_{\text{N,n}}^{\text{p}}}(x)}{{d} x}$ and $\overline{R_{\text{N,m}}^{\text{p}}}(x)$ }\label{sec:xdR} 496 | 497 | The purpose of this section is to present the relations between $x \frac{{d} \overline{R_{\text{N,n}}^{\text{p}}}(x)}{{d} x}$, 498 | $\overline{R_{\text{N,m}}^{\text{p}}}(x)$ and $P_{k}^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right)$ which yield an expansion of 499 | $x \frac{{d} \overline{R_{\text{N,n}}^{\text{p}}}(x)}{{d} x}$ as a linear combination of $\overline{R_{\text{N,m}}^{\text{p}}}(x)$, 500 | with $m=0,1,\ldots,n$. 501 | The following equations are obtained using (\ref{eq:jac1}), (\ref{eq:jac2}), (\ref{eq:jac3}) and (\ref{eq:def:norm_radial_zer}). 502 | An analytic verification of the formulas is available in the on-line resources. 503 | 504 | First, $x \frac{{d} \overline{R_{\text{N,n}}^{\text{p}}}(x)}{{d} x}$ is a linear combination of $\overline{R_{\text{N,n}}^{\text{p}}}(x)$ 505 | and $x^N P_{n-1}^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right)$, as specified by the formula 506 | \begin{equation} 507 | \begin{split} 508 | x &\frac{{d} \overline{R_{\text{N,n}}^{\text{p}}}(x)}{{d} x} = (2 n+N) \overline{R_{\text{N,n}}^{\text{p}}}(x) + \\ 509 | & \left((-1)^{n-1} x^N (2 (n+N)+p) \sqrt{2 \left(2 n+N+\frac{p}{2}+1\right)}\right) P_{n-1}^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right). 510 | \end{split} 511 | \end{equation} 512 | 513 | Next, $x^N P_n^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right)$ is a linear combination of $x^N P_{n-1}^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right)$ (with a lower index $n$) and $\overline{R_{\text{N,n}}^{\text{p}}}(x)$, as specified by the formula 514 | \begin{equation} 515 | \begin{split} 516 | &(-1)^n x^N P_n^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right)= \\ 517 | & \frac{(-1)^{n-1} \left(n+N+\frac{p}{2}\right) x^N P_{n-1}^{\left(N+\frac{p}{2},1\right)}\left(1-2 x^2\right) 518 | +\frac{ \sqrt{2 n+N+\frac{p}{2}+1}}{\sqrt{2}} \overline{R_{\text{N,n}}^{\text{p}}}(x)}{n+N+\frac{p}{2}+1}. 519 | \end{split} 520 | \end{equation} 521 | 522 | 523 | 524 | 525 | % 526 | % 527 | % 528 | \subsection{Recurrence Relations between the Eigenvalues of the Integral Operator} 529 | 530 | The following formula, due to \cite{serkh2015generalized,greengard2017generalized}, provides the ratio between the eigenvalues $\beta_{N,n}$, defined in (\ref{eq:def:radial_prol}) 531 | \begin{equation}\label{eq:eig:rec} 532 | \frac{\beta_{N,m}}{\beta_{N,n}} = \frac{\int_0^1 x \Phi_{N,n}'(x) \Phi_{N,m}(x) x^{p+1} dx }{\int_0^1 x \Phi_{N,m}'(x) \Phi_{N,n}(x) x^{p+1} dx} . 533 | \end{equation} 534 | 535 | 536 | % 537 | % 538 | % 539 | \subsection{Relation between Eigenvalues and Expansion Coefficients} 540 | 541 | The purpose of this section is to present a relation between the eigenvalues $\gamma_{N,n}$, defined in (\ref{eq:gamma}), and the elements ${h}^{p,c,N,n}_k$, defined in (\ref{eq:weighted_prol_expand}). 542 | This property is discussed in \cite{slepian1964prolate,serkh2015generalized,greengard2017generalized}. 543 | 544 | 545 | Substituting (\ref{eq:weighted_prol_expand}) into (\ref{eq:weighted_radial_prol:eig}) yields 546 | \begin{equation}\label{eq:weighted_radial_prol:eig:expand} 547 | \gamma_{N,n} \sum_{k=0}^{\infty} {h}^{p,c,N,n}_k T_{\text{N,n}}^{\text{p}}(y) = \int_0^1 {J_{N+p/2}(cxy)} \sqrt{cxy} \left(\sum_{k=0}^{\infty} {h}^{p,c,N,n}_k T_{\text{N,n}}^{\text{p}}(x) \right) dx . 548 | \end{equation} 549 | 550 | Multiplying the right hand side of (\ref{eq:weighted_radial_prol:eig:expand}) by $y^{-\left(N+\frac{p+1}{2}\right)} \Gamma \left(N+\frac{p}{2}+1\right)$, and considering only one element in the summation over $k$ yields 551 | \begin{equation}\label{eq:expand-eig:rhs} 552 | \begin{split} 553 | & y^{-\left(N+\frac{p+1}{2}\right)} \Gamma \left(N+\frac{p}{2}+1\right) \int_0^1 \sqrt{c x y} T_{\text{N,n}}^{\text{p}}(x) J_{N+\frac{p}{2}}(c x y) \, dx = \\ 554 | & = (-1)^n y^{-\left(N+\frac{p+1}{2}\right)} \Gamma \left(N+\frac{p}{2}+1\right) \sqrt{\frac{4 n+2 N+p+2}{c y}} J_{2 n+N+\frac{p}{2}+1}(c y) 555 | \end{split} 556 | \end{equation} 557 | (see analytic verification in the on-line resources). 558 | The expansion in a series around $y=0$ yields 559 | 560 | \begin{equation}\label{eq:expand-eig:rhs:0} 561 | \begin{split} 562 | &y^{-\left(\frac{p+1}{2}+N\right)} \Gamma \left(N+\frac{p}{2}+1\right) \int_0^1 T_{\text{N,n}}^{\text{p}}(x) J_{N+\frac{p}{2}}(c x y) \sqrt{c x y} \, dx = \\ 563 | &= y^{2 n} \left(\frac{2^{-2 n-N-\frac{p}{2}} c^{2 n+N+\frac{p}{2}+\frac{1}{2}} e^{i n \pi } \Gamma\left(N+\frac{p}{2}+1\right)}{\sqrt{4 n+2 N+p+2} \Gamma \left(2 n+N+\frac{p}{2}+1\right)}+O\left(y^1\right)\right) . 564 | \end{split} 565 | \end{equation} 566 | In other words, in the limit $y \rightarrow 0^+$, the coefficient ${h}^{p,c,N,n}_k$ controls the behavior of the right hand side of (\ref{eq:weighted_radial_prol:eig:expand}): 567 | \begin{equation}\label{eq:expand-eig:rhs:0:n0} 568 | \begin{split} 569 | y^{-\left(\frac{p+1}{2}+N\right)} \Gamma \left(N+\frac{p}{2}+1\right) & \int_0^1 T_{\text{N,0}}^{\text{p}}(x) J_{N+\frac{p}{2}}(c x y) \sqrt{c x y} \, dx = \\ 570 | & = \frac{2^{-N-\frac{p}{2}}c^{N+\frac{p}{2}+\frac{1}{2}}}{\sqrt{2 N+p+2}}+O\left(y^1\right) . 571 | \end{split} 572 | \end{equation} 573 | 574 | Multiplying the left hand side of (\ref{eq:weighted_radial_prol:eig:expand}) by $y^{-\left(N+\frac{p+1}{2}\right)} \Gamma \left(N+\frac{p}{2}+1\right)$, and considering only one element in the summation over $k$ as $y \rightarrow 0^+$ yields 575 | \begin{equation}\label{eq:expand-eig:lhs:0} 576 | \begin{split} 577 | \lim_{y\to 0} \, y^{-\left(N+\frac{p+1}{2}\right)} & \Gamma \left(N+\frac{p}{2}+1\right) T_{\text{N,n}}^{\text{p}}(y) = \\ 578 | & \frac{(-1)^n \sqrt{4 n+2 N+p+2} \Gamma \left(n+N+\frac{p}{2}+1\right)}{\Gamma (n+1)} 579 | \end{split} 580 | \end{equation} 581 | (see analytic verification in the on-line resources). 582 | 583 | It follows from (\ref{eq:expand-eig:rhs:0}) and (\ref{eq:expand-eig:lhs:0}) that the eigenvalue is related to the coefficients ${h}^{p,c,N,n}_k$ by the formula 584 | \begin{equation}\label{eq:expand-eig:gam} 585 | \gamma_{N,n} = \frac{2^{-N-\frac{p}{2}}c^{N+\frac{p}{2}+\frac{1}{2}} {h}^{p,c,N,n}_0 }{ \sqrt{2 N+p+2} \sum_{k=0}^{\infty} \left( \frac{(-1)^k \sqrt{4 k+2 N+p+2} \Gamma \left(k+N+\frac{p}{2}+1\right)}{\Gamma (k+1)} {h}^{p,c,N,n}_k \right) }. 586 | \end{equation} 587 | 588 | 589 | % 590 | % 591 | % 592 | \section{Relation to $\mathcal{F}_c$ and Concentration of Energy}\label{sec:native_unscaled} 593 | 594 | The eigenfunctions and eigenvalues of ${F}_c$ characterize the operator $\mathcal{F}_c$ through the functions 595 | $\widetilde{\psi_{N,n,m}}$ and scalars $\nu_{N,n}$ defined in this section; 596 | together with $\psi_{N,n,m}$, these are the singular functions and singular values of $\mathcal{F}_c$ up to phase). 597 | For a given $p$ and $c$, 598 | \begin{equation} 599 | \left( \mathcal{F}_c \psi_{N,n,m}\right) = \nu_{N,n} \widetilde{\psi_{N,n,m}} 600 | \end{equation} 601 | where, 602 | \begin{equation}\label{eq:def:tilde_psi} 603 | \widetilde{\psi_{N,n,m}}({\bm x}) = c^{-1/2} {\psi_{N,n,m}}({c^{-1}\bm x}), 604 | \end{equation} 605 | and 606 | \begin{equation}\label{eq:nu} 607 | \nu_{N,n} = \mathrm{i}^N c^{1/2} \gamma_{N,n} . 608 | \end{equation} 609 | %\begin{equation}\label{eq:nu} 610 | % \nu_{N,n} = \mathrm{i}^N c^{1-p/2} \gamma_{N,n} . 611 | %\end{equation} 612 | It is convenient to refer to $\psi_{N,n,m}$, $\widetilde{\psi_{N,n,m}}$ and $\nu_{N,n}$ as ``eigenfunctions'' and ``eigenvalues'' of the operator $\mathcal{F}_c$ because of their close relation to the eigenfunctions $\psi_{N,n,m}$ and eigenvalues $\alpha_{N,n},\beta_{N,n}$ and $\gamma_{N,n}$, although the domain of the operator $\mathcal{F}_c$ is different from its range. 613 | 614 | 615 | 616 | For a given $p,N$, and a growing $c$, the magnitude $|\nu_{N,n}|$ of the first few eigenvalues is very close to $1$. 617 | In fact, as $c$ grows, there is a growing number of eigenvalues that are numerically indistinguishable from $1$. 618 | After a certain number of eigenvalues that are very close to $1$, the eigenvalues decay super-algebraically. 619 | Some examples are presented in the numerical results. 620 | 621 | Consider the Fourier transform $g = \mathcal{F} \psi_{N,n,m}$ of a GPSF, 622 | and the truncated Fourier transform $g_c = \mathcal{F} \psi_{N,n,m}$. 623 | Since the Fourier transform is a unitary operation, and the GPSF is normalized $\|\psi_{N,n,m}\|_2^2=1$, 624 | we also have that 625 | \begin{equation} 626 | \| \mathcal{F} \psi_{N,n,m} \|_2^2 = \|g\|_2^2=1. 627 | \end{equation} 628 | Furthermore, since $\psi_{N,n,m}$ is supported on the unit ball by definition, we also have that within the ball $cB^D$ of band $c$, 629 | \begin{equation} 630 | g({\bm \omega}) = \left( \mathcal{F} \psi_{N,n,m}\right)({\bm \omega}) = g_c({\bm \omega}) = \left( \mathcal{F}_c \psi_{N,n,m}\right)({\bm \omega}) = \nu_{N,n} \widetilde{\psi_{N,n,m}}({\bm \omega}) ~~,~~ \|{\bm \omega}\| \leq c. 631 | \end{equation} 632 | Therefore, 633 | \begin{equation} 634 | \| \mathcal{F}_c \psi_{N,n,m} \|_2^2 = \|g_c\|_2^2= |\nu_{N,n}|^2. 635 | \end{equation} 636 | By definition, the function $g_c({\bm \omega}) = \left(\mathcal{F}_c \psi_{N,n,m}\right)({\bm \omega})$ is identically zero for $\|{\bm \omega}\| \geq c$. 637 | However, $g({\bm \omega})$ cannot be identically zero on the outside due to classic results in analysis that assert that functions cannot be compactly supported in both the spatial domain and frequency domain. The amount of energy that persists outside the band $c$ is 638 | \begin{equation} 639 | \| g-g_c \|_2^2 = 1-|\nu_{N,n}|^2. 640 | \end{equation} 641 | It follows that the first few GPSFs, with eigenvalues very close to $1$, are highly concentrated in both the spatial domain 642 | and the frequency domain. With a small abuse of terminology, we say that these functions are {\em numerically} compactly supported in both the spatial and frequency domains. Subsequent GPSFs with smaller eigenvalues have most of their energy concentrated outside the band $c$. In this sense, the first few GPSFs, with eigenvalues close to $1$, and a rather sharp threshold after which the eigenvalues become very small, are the optimal basis for representing functions that are highly concentrated in both the spatial and frequency domains. 643 | 644 | 645 | 646 | 647 | % 648 | % 649 | % 650 | %\subsection{Scaling} 651 | % 652 | % TBA: scaling of the eigenfunction, eigenvalues 653 | % 654 | 655 | 656 | 657 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 658 | %%%%%%%%%%%% Algorithms %%%%%%%%%%% 659 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 660 | \section{Algorithms}\label{sec:alg} 661 | 662 | 663 | % 664 | % 665 | % 666 | \subsection{Computation of GPSFs} 667 | 668 | The radial GPSFs, defined in (\ref{eq:def:radial_prol}), are obtained via the expansion (\ref{eq:prol_expand}), in the basis of normalized radial Zernike polynomials (defined in (\ref{eq:def:norm_radial_zer})). 669 | The coefficients of the expansion are the elements of the eigenvectors ${\bm h}^{p,c,N,n}$ of the matrix $B_{\text{N}}^{\text{p,c}}$ defined in (\ref{eq:Bmat_nn}) and (\ref{eq:Bmat_nm1n}). 670 | The eigenvalues $\chi^{p,c,N}_0$ of the matrix $B_{\text{N}}^{\text{p,c}}$ are sorted so that they grow in magnitude. 671 | We note that it is not necessary in general to compute all the eigenvectors of the matrix, 672 | individual eigenvectors can be found analogously to the procedure in \cite{LedermanLaplace2014}. 673 | 674 | In the present paper we do not discuss the decay of the elements ${h}^{p,c,N,n}_k$ of the eigenvectors in detail. These elements decay rapidly with $k$, and the matrix $B_{\text{N}}^{\text{p,c}}$ can be truncated without loss of numerical precision. 675 | In the current implementation we simply ensure that the dimensions of $B_{\text{N}}^{\text{p,c}}$ are sufficiently large to ensure a sufficient number of eigenfunctions and a sufficiently long expansion; 676 | the appropriate truncation will be discussed in future papers. 677 | 678 | The relation to the ``eigenfunctions'' of the more familiar unscaled Fourier transform 679 | if described in Section \ref{sec:native_unscaled}. 680 | The relation between these radial components of GPSFs and the GPSFs on the D-dimensional ball 681 | are discussed in Section \ref{sec:truncated_fourier}. 682 | 683 | \begin{remark} 684 | Obviously, the GPSFs computed through the eigendecomposition above have a degree of freedom in their sign (if $\Phi_{N,n}(x)$ is a normalized eigenfunction, then $-\Phi_{N,n}(x)$ is also a normalized eigenfunction). 685 | For the sake of consistency across different implementations, we remove the ambiguity by setting the sign of the first element ${h}^{p,c,N,n}_0$ of the eigenvectors to be positive for even $n$ and negative for odd $n$. 686 | \end{remark} 687 | 688 | \begin{remark}\label{remark:eig_alg} 689 | The sign standardization above, and the accurate computation of eigenvalues using (\ref{eq:gamma}) in the next section rely in some cases on obtaining relative precision in some elements of the eigenvectors ${\bm h}^{p,c,N,n}$. 690 | While relative precision can be obtained in the cases in question (see \cite{osipov2017evaluation}), not all eigedecomposition algorithms achieve it. 691 | \end{remark} 692 | 693 | % 694 | % 695 | % 696 | \subsection{Computation of the First Associated Eigenvalue} 697 | 698 | The first eigenvalue $\gamma_{N,0}$, defined in (\ref{eq:gamma}), is computed using the relation (\ref{eq:expand-eig:gam}), with $n=0$. 699 | Alternatively, it can often be computed via (\ref{eq:weighted_radial_prol:eig}) by numerical integration. 700 | 701 | 702 | 703 | 704 | % 705 | % 706 | % 707 | \subsection{Computation of Associated Eigenvalues} 708 | 709 | The expansion $\widetilde{{\bm h}^{p,c,N,n}}$ of $x \Phi_{N,n}'(x)$ such that 710 | \begin{equation} 711 | x \Phi_{N,n}'(x) = \sum_{k=0}^{\infty} \widetilde{{h}^{p,c,N,n}_k} \overline{R_{\text{N,k}}^{\text{p}}}(x) , 712 | \end{equation} 713 | is computed from the eigenvectors ${{\bm h}^{p,c,N,n}}$ recovered in previous steps of the algorithm, using the equations in Section \ref{sec:xdR}. 714 | 715 | It follows from (\ref{eq:eig:rec}) that the ratio between consecutive eigenvalues is related to the elements ${{\bm h}^{p,c,N,n}}$ of the expansion of $\Phi_{N,n}'(x)$ and the elements $\widetilde{{\bm h}^{p,c,N,n}}$ of the expansion of $x \Phi_{N,n}'(x)$ via the following formula 716 | \begin{equation} 717 | \frac{\gamma_{N,n+1}}{\gamma_{N,n}} = \frac{ \widetilde{{\bm h}^{p,c,N,n}}\cdot {{\bm h}^{p,c,N,n+1}} }{ \widetilde{{\bm h}^{p,c,N,n+1}}\cdot {{\bm h}^{p,c,N,n}} } , 718 | \end{equation} 719 | where $\cdot$ is the standard inner product between vectors. 720 | This ratio between consecutive eigenvalues is used to compute the subsequent eigenvalues once $\gamma_{N,0}$ is computed by the means described in the previous section. 721 | 722 | The other associated eigenvalues $\alpha_{N,n,m} = \alpha_{N,n}$, $\beta_{N,n}$ and 723 | $\nu_{N,n}$ are computed from $\gamma_{N,n}$ using equations (\ref{eq:alpha}), (\ref{eq:def:radial_prol}) and (\ref{eq:nu}). 724 | 725 | 726 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 727 | %%%%%%%%% Numerical Results %%%%%%% 728 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 729 | \section{Numerical Results}\label{sec:results} 730 | 731 | The algorithms describe above have been implemented in MATLAB\textsuperscript{TM}. 732 | The following figures are examples of GPSFs and associated eigenvalues. 733 | The code for reproducing these plots is available at \url{http://github.com/lederman/prol}. 734 | 735 | \begin{remark} 736 | For the sake of simplicity, the current MATLAB\textsuperscript{TM} implementation makes use of MATLAB's ``eig'' eigendecomposition. 737 | This subroutine retains relative precision only in certain elements, but not in all elements, as discussed in Remark \ref{remark:eig_alg}. 738 | The truncation is corrected for certain computations using an inverse power method step on the first eigenvector. 739 | For this reason and other reasons, future implementations will replace the eigendecomposition procedure. 740 | \end{remark} 741 | 742 | 743 | \begin{figure}[h] 744 | \includegraphics[width=\textwidth]{figures/gpsf_report1_D3_N0_eigenfuncs} 745 | \caption{Examples of radial GPSFs, with $D=3$, $c=20\pi$, and $N=0$. } 746 | \end{figure} 747 | 748 | 749 | \begin{figure}[h] 750 | \includegraphics[width=\textwidth]{figures/gpsf_report1_D3_N1_eigenfuncs} 751 | \caption{Examples of radial GPSFs, with $D=3$, $c=20\pi$ and $N=1$. } 752 | \end{figure} 753 | 754 | 755 | \begin{figure}[h] 756 | \includegraphics[width=\textwidth]{figures/gpsf_report1_D3_eigenvals} 757 | \caption{Magnitude of eigenvalues $|\nu_{N,n}|$, with $D=3$ and $c=20\pi$, for different values of $N$ } 758 | \end{figure} 759 | 760 | \begin{figure}[h] 761 | \includegraphics[width=\textwidth]{figures/gpsf_report1_D3_eigenvals_to_one} 762 | \caption{$1-|\nu_{N,n}|$, with $D=3$ and $c=20\pi$, for different values of $N$, demonstrating that the magnitude of the first eigenvalues is numerically indistinguishable from one. The difference from one in the first few eigenvalues is due to numerical precision. } 763 | \end{figure} 764 | 765 | 766 | \clearpage 767 | 768 | 769 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 770 | %%%%%%%%%%% Conclusions %%%%%%%%%%% 771 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 772 | \section{Conclusions}\label{sec:conclusions} 773 | 774 | In this paper we reviewed the essential results for numerical computation of the eigenfunctions of the 775 | truncated Fourier transform, which is restricted to the unit ball in the spatial domain and band-limited in the frequency domain. 776 | The paper is accompanied by an example implementation, available as an open-source project at \url{http://github.com/lederman/prol}. 777 | 778 | The code and paper are preliminary results of the ongoing project in \url{http://github.com/lederman/prol}. 779 | A more comprehensive code in additional languages is being developed. 780 | We welcome comments and contributions to both the code and the text through the open-source project. 781 | 782 | 783 | \section{Acknowledgements} 784 | 785 | We would like to thank Philip Greengard, Boris Landa and Kirill Serkh for their help. 786 | The author was partially supported by Award Number R01GM090200 from the NIGMS to Amit Singer. 787 | 788 | % 789 | % 790 | % 791 | \bibliography{bib}{} 792 | \bibliographystyle{plain} 793 | 794 | 795 | 796 | \end{document} 797 | -------------------------------------------------------------------------------- /src/matlab/matlab_addpath_prol_src.m: -------------------------------------------------------------------------------- 1 | % 2 | % Add to path 3 | % 4 | function matlab_addpath_prol_src() 5 | path_to_pkg = fileparts(mfilename('fullpath')); 6 | 7 | addp = @(d)(addpath(fullfile(path_to_pkg, d))); 8 | 9 | addp(''); 10 | addp('polynomials'); 11 | addp('service'); 12 | 13 | end 14 | -------------------------------------------------------------------------------- /src/matlab/matlab_example.m: -------------------------------------------------------------------------------- 1 | function matlab_example() 2 | % 3 | % Example for using the matlab version of this code. 4 | % 5 | 6 | % add to path 7 | matlab_addpath_prol_src(); 8 | 9 | % prolate parameters 10 | c=pi*20; % band limit 11 | D=3; % prolate on 3-D ball 12 | N = 1; % prolate angular frequency parameter: N=0,1,.... , see notes. 13 | 14 | minEigenvalRatio = 10^-40; % the truncation parameter. magnitude of the smallest eigenvalue that we would like to keep 15 | 16 | % technical parameters: 17 | matdim = 1000; % size of the matrix representation of the differential operator, see notes. If this is too small, a warning should appear. This will be removed in future versions. 18 | prolate_crea_options.isfixfirst = 1; % this option should be set to 1 for more accurate eigenvalues. 19 | 20 | % 21 | % 22 | % 23 | disp('Precomputation') 24 | tic 25 | [prolate_dat, iserr , ~] = prolate_crea(c,D,N,minEigenvalRatio, matdim, prolate_crea_options); 26 | toc 27 | if (iserr~=0) 28 | disp('An error has occured!'); 29 | end 30 | 31 | h0 = figure; 32 | semilogy([0:prolate_dat.num_prols-1],(abs(prolate_dat.nu)),'LineWidth',3) 33 | ylim([10^-30,3]) 34 | xlabel('n') 35 | set(gca,'FontSize', 12); 36 | ylabel('|\nu_n|','FontSize', 14) 37 | 38 | % 39 | % Additional eigenvalues (see documentation): 40 | % 41 | % The other versions of the integral operator eigenvalues are available 42 | % in prolate_dat.gam , prolate_dat.bet, prolate_dat.alp. 43 | % 44 | % The eigenvalues of the differential operator are availavle in 45 | % prolate_dat.chi 46 | % 47 | 48 | % 49 | % 50 | % 51 | disp('Evaulate radial part at given points') 52 | 53 | prol_ids = [0:prolate_dat.num_prols-1]; % ids of the prolates we wish to evalualte. Note that the index of the first prolate is 0. We evaluate all of the, and then display a selection below. 54 | xx = linspace(0,1,1000); % points where the prolate should be evaluated. Must be in [0,1]. 55 | 56 | tic 57 | [v] = prolate_ev(prolate_dat, prol_ids , xx); 58 | toc 59 | 60 | h1 = figure; 61 | funcid = [0:1,2,5,10]; 62 | funcid( funcid > prolate_dat.num_prols-1 ) = []; % remove indices that are out of range, in case the user changes the parameters of this example. 63 | plot(xx,v(:,funcid+1),'LineWidth',2); % +1 because the prolate indices start at 0 64 | xlabel('x') 65 | lgd=legend(num2str(funcid')); 66 | set(gca,'FontSize', 12); 67 | ylabel('\Phi_{N,n}(x)','FontSize', 14) 68 | 69 | 70 | 71 | end -------------------------------------------------------------------------------- /src/matlab/polynomials/prolate_JacobiP_ex.m: -------------------------------------------------------------------------------- 1 | function v = prolate_JacobiP_ex(a,b,cfsvec,xx) 2 | % 3 | % Evaluates functions expanded in Jacobi Polynomials P^{a,b}_n(x) (not normalized) 4 | % 5 | % v(i,j) = \sum_{q=0}^{k-1} cfsvec(q+1,j) P^{a,b}_q(x_i) 6 | % 7 | % Input: 8 | % * a,b : the a,b parameters of the Jacobi polynomials to use here. 9 | % * cfsvec : k x m matrix. 10 | % Columns of coefficients, each column has the k coefficients of an expansion 11 | % in Jacobi polynoimals of order k-1 for one of the m different functions. 12 | % * xx : a vector of length l. 13 | % each entry is a value of x where each one of the k expansions should be evaluated. 14 | % Output: 15 | % * v : l x m matrix. 16 | % The j-th column is the j-th function evaluated at the l points. 17 | % 18 | % 19 | 20 | xx = xx(:); 21 | 22 | jcm1 = 0*xx(:)+1; 23 | jc0 = 1/2*(a-b+(2+a+b)*xx(:)); 24 | jcp1 = 0*xx(:); 25 | if (size(cfsvec,1)>0) 26 | v= jcm1 *cfsvec(1,:); 27 | else 28 | v=zeros([length(xx),size(cfsvec,2)],class(xx)); 29 | end 30 | if size(cfsvec,1)>1 31 | v=v+jc0 * cfsvec(2,:); 32 | for k=1:size(cfsvec,1)-2 33 | jcp1(:) = (((2*k+a+b+1)*(a^2-b^2)+(2*k+a+b)*(2*k+a+b+1)*(2*k+a+b+2)*xx(:)).*jc0 -2*(k+a)*(k+b)*(2*k+a+b+2)*jcm1) / (2*(k+1)*(k+a+b+1)*(2*k+a+b)); 34 | jcm1(:) = jc0(:); 35 | jc0(:) = jcp1(:); 36 | v=v+jc0*cfsvec(k+2,:); 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/matlab/polynomials/prolate_ZernikeNorm_ex.m: -------------------------------------------------------------------------------- 1 | 2 | function v = prolate_ZernikeNorm_ex(p,N,cfsvec,xx) 3 | % 4 | % 5 | % Evaluates functions expanded in the basis of normalized Zernike 6 | % polynomials. 7 | % 8 | % v(i,j) = \sum_{q=0}^{k-1} cfsvec(q,j) \hat{R}_{N,n,p}_q(x_i) 9 | % 10 | % 11 | % Input: 12 | % * p,N : the p,N parameters of the Zernike polynomials to use here. 13 | % * cfsvec : k x m matrix. 14 | % Columns of coefficients, each column has the k coefficients of an expansion 15 | % in Zernike polynoimals of order k-1 for one of the m different functions. 16 | % * xx : a vector of length l. 17 | % each entry is a value of x where each one of the k expansions should be evaluated. 18 | % Output: 19 | % * v : l x m matrix. 20 | % The j-th column is the j-th function evaluated at the l points. 21 | % 22 | % 23 | 24 | v = prolate_ZernikeNorm_ex_fromJacobi(p,N,cfsvec,xx) ; 25 | 26 | 27 | end 28 | -------------------------------------------------------------------------------- /src/matlab/polynomials/prolate_ZernikeNorm_ex_fromJacobi.m: -------------------------------------------------------------------------------- 1 | 2 | function v = prolate_ZernikeNorm_ex_fromJacobi(p,N,cfsvec,xx) 3 | % 4 | % Evaluates functions expanded in the basis of normalized Zernike polynomials 5 | % using Jacobi polynomials. 6 | % 7 | % v(i,j) = \sum_{q=0}^{k-1} cfsvec(q,j) \hat{R}_{N,n,p}_q(x_i) 8 | % 9 | % Using Jacobi polynomials: 10 | % \hat{R}_{N,n,p}_q(x_i) = (-1)^n \sqrt{2(2n+N+p/2+1)} x^N P^{(N+p/2,0)}_n(1-2x^2) 11 | % 12 | % Input: 13 | % * p,N : the p,N parameters of the Zernike polynomials to use here. 14 | % * cfsvec : k x m matrix. 15 | % Columns of coefficients, each column has the k coefficients of an expansion 16 | % in Zernike polynoimals of order k-1 for one of the m different functions. 17 | % * xx : a vector of length l. 18 | % each entry is a value of x where each one of the k expansions should be evaluated. 19 | % Output: 20 | % * v : l x m matrix. 21 | % The j-th column is the j-th function evaluated at the l points. 22 | % 23 | % 24 | 25 | b=0; 26 | a=N+p/2; 27 | yy = 1-2 * xx(:).^2; 28 | 29 | K = size(cfsvec,1)-1; 30 | 31 | cfsvec_jac = cfsvec; 32 | cfsvec_jac = bsxfun(@times, (-1).^[0:K]', cfsvec_jac); 33 | cfsvec_jac = bsxfun(@times, sqrt(2*(2*[0:K]' + N + p/2 + 1)), cfsvec_jac); 34 | 35 | v = prolate_JacobiP_ex(a,b,cfsvec_jac,yy) ; 36 | 37 | v=bsxfun(@times, xx(:).^N , v); 38 | 39 | end 40 | -------------------------------------------------------------------------------- /src/matlab/polynomials/prolate_xdZernikeNorm_coef.m: -------------------------------------------------------------------------------- 1 | 2 | function dvec = prolate_xdZernikeNorm_coef(p,N,vec) 3 | % 4 | % Computes the expansion of xf'(x) in the basis of Zernike polynomials, 5 | % where f(x) is given in the basis of Zernike polynomials. 6 | % 7 | % Input: 8 | % * p,N : Prolate/Zernike parameters. 9 | % * vec : vector (or multiple vectors in multiple columns) of the 10 | % coefficients of funtions, expanded in the basis of Zernike polynomials. 11 | % 12 | % Output: 13 | % * dvec : vector (or multiple vectors in multiple columns) of the 14 | % coefficients of the expansion of xf'(x). 15 | % 16 | 17 | 18 | dvec = 0 * vec; 19 | tmpvec = vec; 20 | tmpjacvec = 0*vec; 21 | 22 | for n=size(vec,1)-1:-1:0 23 | dvec(n+1,:) = dvec(n+1,:) + sqrt(2*n + N + p/2 + 1)/sqrt(2)/(n + N + p/2 + 1) * tmpjacvec(n+1,:); 24 | dvec(n+1,:) = dvec(n+1,:) + (2*n+N) * (tmpvec(n+1,:)); 25 | 26 | if (n==0) 27 | break 28 | end 29 | tmpjacvec(n,:)= (n + N + p/2)/(n + N + p/2 + 1) * tmpjacvec(n+1,:); 30 | tmpjacvec(n,:) = tmpjacvec(n,:) + (2*(n + N) + p)* sqrt(2*(2*n + N + p/2 + 1)) * tmpvec(n+1,:); % Jacobi component 31 | end 32 | 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /src/matlab/prolate_crea.m: -------------------------------------------------------------------------------- 1 | 2 | function [prolate_dat, iserr , prolate_dat_tmp] = prolate_crea(c, D, N, minEigenvalRatio, matdim , prolate_crea_options) 3 | % 4 | % prolate_crea creates a data-structure for computing a family of 5 | % generalized prolate spheroidal functions for dimension D and order N. 6 | % 7 | % Input: 8 | % * c : prolate truncation frequency 9 | % * D : prolate dimension (D=p+2) 10 | % * N : prolate order 11 | % * minEigenvalRatio : keep only prolates the with eigenvalue \gamma s.t. 12 | % | \gamma_n | > c^{-1/2} * minEigenvalRatio . 13 | % The reason is that for small n and large c, c^{1/2}| \gamma_n | -> 1 14 | % * matdim : the dimensionality of teh matrix used in precomputation. 15 | % This is a technical parameter which will be removed in future versions. 16 | % If this number is too small, a warning will be generated. 17 | % If this number is too large, the precomputation can be slow. 18 | % * prolate_crea_options : optional patameters 19 | % isfast : run faster computation without fixing the eigenvectors? 20 | % This will be removed in future versions. 21 | % 22 | % Output: 23 | % * prolate_dat : data structure to be used in prolate_ev 24 | % * iserr : error code 25 | % 0 : no error 26 | % 1 : empty set of prolates. 27 | % 10 : matdim may be too small (based on number of prolates kept) 28 | % 100 : matdim may be too small (based on number of coefficients kept) 29 | % 30 | % 31 | 32 | % 33 | % TODO: 34 | % * Remove Matlab eig for more accurate computation of eigenvectors' 35 | % elements without the second pass on the eigenvectors. 36 | % * Introduce wrapper to compute matdim 37 | % * Introduce warpper to compute for all N. 38 | % * Add user control of accuracy. 39 | % 40 | 41 | assert(round(D)==D) % Integer dimension 42 | assert(D>1) % One dimensional case to be treated separately 43 | assert(c>0) % Physical c 44 | assert(N>=0) % Physical N 45 | assert(round(N)==N) 46 | 47 | assert(minEigenvalRatio<1) % otherwise, what is the point? 48 | assert(minEigenvalRatio > 0) % Eigenvalues must be truncated 49 | assert(matdim > 10) % The matrix for computing the coefficients cannot be too small 50 | 51 | isfast = 1; % don't bypass the eigenvector correction 52 | isfixfirst = 1; % don't bypass the eigenvector correction 53 | if exist('prolate_crea_options') 54 | if isfield(prolate_crea_options,'isfast') 55 | isfast = prolate_crea_options.isfast; 56 | end 57 | if isfield(prolate_crea_options,'isfixfirst') 58 | isfixfirst = prolate_crea_options.isfixfirst; 59 | end 60 | end 61 | 62 | 63 | 64 | % 65 | % Parameters 66 | % 67 | iserr = 0; 68 | prolate_dat.type = 2; 69 | prolate_dat.c = c; 70 | prolate_dat.D = D; 71 | prolate_dat.p = D-2; 72 | prolate_dat.N = N; 73 | prolate_dat.creaparam.minEigenvalRatio = minEigenvalRatio; 74 | prolate_dat.creaparam.matdim = matdim; 75 | 76 | prolate_dat.evparam.cfs_eps = eps(1.0)/100; 77 | 78 | % 79 | % differential equation eigenproblem in matrix form, the eigenvectors 80 | % ate the coefficients of the prolats. 81 | % 82 | 83 | % TODO: replace the full matrix operation. 84 | [mat, vdiag, voffdiag] = prolate_diffop_mat_full(prolate_dat.c, prolate_dat.p ,prolate_dat.N , prolate_dat.creaparam.matdim-1); 85 | 86 | [u,d] = eig(mat); 87 | % Note that Matlab eig truncates some small coefficients by setting them to 0. 88 | [eigvals,eigvals_order] = sort(diag(d),'descend'); 89 | eigvecs = u(:,eigvals_order); 90 | 91 | 92 | eigvecs = bsxfun(@times, eigvecs, sign(eigvecs(1,:)).*(-1).^[0:matdim-1] ); % standard sign. Assumes accurate first element. 93 | 94 | % 95 | % temporary data structure that stores data before truncation 96 | % 97 | prolate_dat_tmp = prolate_dat; 98 | prolate_dat_tmp.cfs = eigvecs; 99 | prolate_dat_tmp.diffeigs = eigvals; 100 | 101 | 102 | % fix the first eigenvector to reduce the scope of numerical inaccuracy 103 | % due to eigenvector truncation in Matlab's eig. 104 | if (isfixfirst==1) 105 | prolate_dat_tmp.cfs(:,1) = prolate_crea_fix_eigenvec(mat, prolate_dat_tmp , 1); 106 | end 107 | 108 | % compute the first eigenvalue 109 | %gam0num = prolate_numericalgam(prolate_dat_tmp, 0);% TODO: replace with approximate maximum using WKB and/or Newton method search. 110 | gam0 = prolate_analyticgam(prolate_dat_tmp, 0); 111 | % Compute the rest of the eigenvalues through recurrsion 112 | [ratios , ~] = prolate_crea_eigRatios(prolate_dat_tmp); 113 | prolate_dat_tmp.gams = gam0 * ratios; 114 | prolate_dat_tmp.nu_abs = abs(gam0 * ratios * prolate_dat.c^(1/2)); 115 | % Find where to truncate 116 | ids_prolate_to_discard = find( prolate_dat_tmp.nu_abs <= prolate_dat.creaparam.minEigenvalRatio ); 117 | ids_prolate_to_keep = [1:min(ids_prolate_to_discard)-1+1]; 118 | if (isempty(ids_prolate_to_keep)) 119 | warning('No prolates to keep'); 120 | iserr = 1; 121 | return 122 | end 123 | 124 | 125 | % Note that Matlab eig truncates the small coefficients by setting them to 0. 126 | abs_cfs = max( abs(prolate_dat_tmp.cfs (:,[1:ids_prolate_to_keep(end)])), [], 2) ; 127 | cfs_to_keep = find( abs_cfs >= prolate_dat.evparam.cfs_eps ); 128 | cfs_to_keep = [1:max(cfs_to_keep)]; 129 | 130 | % truncated coefficients 131 | prolate_dat.cfs = prolate_dat_tmp.cfs( 1:cfs_to_keep(end) , 1:ids_prolate_to_keep(end) ) ; 132 | 133 | % the various forms of the integral operator eigenvalues 134 | prolate_dat.gam = gam0 * ratios(1:ids_prolate_to_keep(end) ); 135 | prolate_dat.bet = prolate_dat.gam/(prolate_dat.c^((prolate_dat.p+1)/2)); 136 | prolate_dat.alp = prolate_dat.bet * (1i)^prolate_dat.N * (2*pi)^(1+prolate_dat.p/2); 137 | 138 | prolate_dat.nu = (1i)^prolate_dat.N * prolate_dat.c^(1/2) * prolate_dat.gam; 139 | 140 | % the differential operator eigenvalues 141 | prolate_dat.chi = eigvals(1:ids_prolate_to_keep(end)); 142 | 143 | prolate_dat.num_prols = ids_prolate_to_keep(end); 144 | 145 | % 146 | % Warnings 147 | % Take plenty of margin for the truncation. 148 | % 149 | if (ids_prolate_to_keep(end)+20 >= matdim) 150 | warning('prolate_crea: insufficient margin in matrix size (number of prolates)') 151 | iserr = iserr+10; 152 | end 153 | if (cfs_to_keep(end)+40 >= matdim) 154 | warning('prolate_crea: insufficient margin in matrix size (number of coefficients)') 155 | iserr = iserr+100; 156 | end 157 | 158 | 159 | 160 | end 161 | 162 | 163 | function v = prolate_crea_fix_eigenvec(mat, prolate_dat , jj) 164 | 165 | tmpmat = mat-eye(prolate_dat.creaparam.matdim)*... 166 | (prolate_dat.diffeigs(jj)+(prolate_dat.diffeigs(jj+1)-prolate_dat.diffeigs(jj))/10^5/(jj+1) ); 167 | v=tmpmat\prolate_dat.cfs(:,jj); 168 | v = v/norm(v); 169 | 170 | end -------------------------------------------------------------------------------- /src/matlab/prolate_ev.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | function [v] = prolate_ev(prolate_dat, prolate_ids, xx) 4 | % 5 | % Evaluates the prolate functions. 6 | % 7 | % Input: 8 | % * prolate_dat : precomputed data structure (prolate_crea). 9 | % * prolate_ids : which prolates to compute. vector of ids between 0 and prolate_dat.num_prols-1. 10 | % * xx : vector of points in the interval [0,1] where the prolates should be evaluated 11 | % Output: 12 | % * v : matrix of evaluate prolates. 13 | % each column refers to a different prolate, each row to a different coordinate. 14 | % 15 | % 16 | 17 | assert( prolate_dat.type == 2 ) 18 | 19 | v = prolate_ZernikeNorm_ex(prolate_dat.p,prolate_dat.N, prolate_dat.cfs(:,prolate_ids+1), xx) ; 20 | 21 | end 22 | 23 | -------------------------------------------------------------------------------- /src/matlab/service/prolate_analyticgam.m: -------------------------------------------------------------------------------- 1 | 2 | function gam = prolate_analyticgam(prolate_dat, n) 3 | % 4 | % Computation of the n-th eigenvalue of the integral operator. 5 | % Uses the data structure prolate_dat created by prolate_crea. 6 | % 7 | % Generally speaking, this function should only be used for computing the 8 | % eigenvalue for n=0 by prolate_crea. 9 | % 10 | % Input: 11 | % * prolate_dat : precomputed prolate information. 12 | % * n : the id of the eigenvalue to be computed. 13 | % This would usually be n=0. 14 | % Output: 15 | % * gam : the eigenvalue \gamma_n 16 | % 17 | 18 | % Todo: remove dependency on undocumented properties of the eigenvector 19 | % computation in matlab. 20 | 21 | % 22 | % Note: this function can be more sensitive to the truncation of the list 23 | % of coefficients. 24 | % 25 | 26 | % coefficients of the chosen prolate 27 | cfs = prolate_dat.cfs(:,n+1); 28 | 29 | % extract parameters 30 | N=prolate_dat.N; 31 | p=prolate_dat.p; 32 | c=prolate_dat.c; 33 | k=[0:length(cfs)-1]'; 34 | 35 | % parts of the computation 36 | cfs1 = (-1).^k .* sqrt(2+4*k+2*N+p) .* (2+2*N+p) /2; 37 | cfs2n = (N+p/2 + k); 38 | cfs2n(1) = gamma(1+ N+p/2 ); 39 | cfs2d = k; 40 | cfs2d(1) = 1; 41 | cfs2 = cumprod(cfs2n./cfs2d); 42 | 43 | % 44 | % Safety truncation to avoid inf. 45 | % 46 | mytrunc1 = find(abs(cfs2)>realmax*10^-10); 47 | mytrunc2 = find(abs(cfs)= prolate_dat.evparam.cfs_eps); 37 | idskeep=tmpkeep(end); 38 | vec((idskeep+1):end) = []; 39 | 40 | % 41 | % numerical integration: 42 | % 43 | 44 | % function to integrate 45 | fun = @(y) reshape( besselj(prolate_dat.N+prolate_dat.p/2, prolate_dat.c*xmax*y(:)).*sqrt(prolate_dat.c *xmax *y(:)) .*y(:).^((prolate_dat.p+1)/2) .* prolate_ZernikeNorm_ex(prolate_dat.p,prolate_dat.N, vec, y(:)) , size(y) ); 46 | % integration: 47 | %q1 = integral( fun,0,1 ); % matlab only 48 | q1 = quad( fun,0,1, eps(xmax_v)*2 ); % compatible with Octave 49 | 50 | % 51 | % The eigenvalue is the ratio: 52 | % 53 | gam = q1 / xmax_v; 54 | 55 | 56 | end 57 | 58 | --------------------------------------------------------------------------------