FUNCTION calculate_outer_product_of_two_vectors, vec1, vec2, status, danidl_cppcode, INTEGER_OUTPUT = integer_output, NO_PAR_CHECK = no_par_check
; Description: This function calculates the outer product of two input vectors "vec1" and "vec2"
; not necessarily of the same length. The outer product of two vectors V1 and V2,
; of length M and N elements respectively, is the MxN matrix A defined by:
;
; A_ij = V1_i*V2_j
;
; where V1_i and V2_j are the ith and jth elements of the vectors V1 and V2
; respectively, and the (i,j) indexes refer to the ith column and jth row of A,
; following IDL's convention of treating arrays as images. To access the ith
; row and jth column, simply use A[j,i].
; This module will use C++ code if possible to achieve a faster execution than
; the default IDL code. The C++ code can be up to a factor of ~2 times faster
; than the IDL code in this case.
;
; Input Parameters:
;
; vec1 - INTEGER/LONG/FLOAT/DOUBLE SCALAR/VECTOR - A scalar number or a vector of numbers
; with "nv1" elements.
; vec2 - INTEGER/LONG/FLOAT/DOUBLE SCALAR/VECTOR - A scalar number or a vector of numbers
; with "nv2" elements.
; status - ANY - A variable which will be used to contain the output status of the function
; on returning (see output parameters below).
; danidl_cppcode - STRING - The full directory path indicating where the DanIDL C++ code is
; installed. The shared library of DanIDL C++ routines should exist
; as "/dist/libDanIDL.so" within the installation.
;
; Output Parameters:
;
; status - INTEGER - If the function successfully calculated the outer product, then "status"
; is returned with a value of "1", otherwise it is returned with a value of
; "0".
;
; Return Value:
;
; The return value is a "nv1" by "nv2" element array of DOUBLE type numbers representing the
; outer product matrix of the two vectors "vec1" and "vec2".
;
; Keywords:
;
; If the keyword INTEGER_OUTPUT is set (as "/INTEGER_OUTPUT"), then the module will convert
; the elements of the input parameters "vec1" and "vec2" into LONG type integers, and it will
; use them to calculate the outer product matrix as a "nv1" by "nv2" element array of LONG
; type integers instead of DOUBLE type numbers.
;
; If the keyword NO_PAR_CHECK is set (as "/NO_PAR_CHECK"), then the function will not perform
; parameter checking on the input parameters, reducing function overheads.
;
; Author: Dan Bramich (dan.bramich@hotmail.co.uk)
;
; History:
;
; 24/10/2010 - Module created (dmb).
;Set the default output parameter values
;Perform parameter checking if not instructed otherwise
;Check that "vec1" contains numbers of the correct type
;Check that "vec1" is a scalar or vector
;Check that "vec2" contains numbers of the correct type
;Check that "vec2" is a scalar or vector
;Determine if the shared library of DanIDL C++ routines is installed
;If the shared library of DanIDL C++ routines is installed, then use the C++ code to speed up
;the calculation of the outer product
;Calculate the outer product
;If the shared library of DanIDL C++ routines is not installed, then use the default IDL code
;Calculate the outer product
;Set "status" to "1"
;Return the outer product