function shapelets_polar_matrix, n_max, $
CALCULATE=calculate,$
C2P=c2p, $
P2C=p2c, $
INVERSE=inverse, $
N1=n1, $
N2=n2
;$Id: shapelets_c2p.pro, v2$
;
; Copyright © 2005 Richard Massey and Alexandre Refregier.
;
; This file is a part of the Shapelets analysis code.
; www.astro.caltech.edu/~rjm/shapelets/
;
; The Shapelets code is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public Licence as published
; by the Free Software Foundation; either version 2 of the Licence, or
; (at your option) any later version.
;
; The Shapelets code is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public Licence for more details.
;
; You should have received a copy of the GNU General Public Licence
; along with the Shapelets code; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
;
;+
; NAME:
; SHAPELETS_POLAR_MATRIX
;
; CATEGORY:
; Shapelets.
;
; PURPOSE:
; Calculates a matrix to convert Cartesian shapelet coefficients to their
; equivalent polar shapelet representation.
;
; INPUTS:
; N_MAX - The maximum order used in the shapelet expansion.
;
; OPTIONAL INPUTS:
; N1 and N2 - The shapelet coefficients are rearranged and stored in a
; 1D array, even if the basis functions are 2D. This
; simplifies many tasks, including the conversion from
; Cartesian to polar shapelets, which then has a 2D matrix.
; These vectors specify the order in which the shapelet
; coefficients are stored. For polar shapelets, we assume the
; convention nl=n2 and nr=n1. If this is not set, the default
; order is assumed. Note that this is much faster, because
; the matrix can then be read from a pre-calculated look-up
; table.
;
; KEYWORD PARAMETERS:
; CALCULATE - By default, the matrix is just read in from a
; pre-calculated look-up table. Setting this option forces
; the routine to calculate the matrix anew.
; C2P - Calculate the matrix to convert from Cartesian to polar
; shapelet representation. This is the default option.
; P2C - Calculate the matrix to convert from polar to Cartesian
; shapelet representation.
; INVERT - A synonym for P2C (works interchangeably).
;
; OUTPUTS:
; MATRIX - The requested conversion matrix. It is independent of beta
; etc, so once it has been calculated, simply use e.g.
; polar_coeffs=matrix#cartesian_coeffs
;
; NOTES:
; A vector of polar shapelet coefficients may be indexed using:
; shapelets_make_nvec,n_max,n_r,n_l,n_coeffs
; n=n_r+n_l
; m=n_r-n_l
; or
; shapelets_make_nvec,n_max,n,m,n_coeffs,/POLAR
;
; MODIFICATION HISTORY:
; Mar 06 - Values in look-up table hard-wired to n_max=30 by Joel Berge.
; Jul 05 - Noticed should be using la_invert to invert complex matrices.
; Apr 05 - Faster calculation & look-up tables (using invert) added by RM.
; Feb 02 - Written by Richard Massey.
;-
COMPILE_OPT idl2
; Work out what n_max was and set up index variables
if keyword_set(n1) and keyword_set(n2) then begin
n_max=max(n1+n2)
n_coeffs=n_elements(n1)
Return to the shapelets web page or the code help menu.
Last modified on 2nd Mar 2009 by
Richard Massey.