text:
"""
    OSRAxisEnumToName(OGRAxisOrientation eOrientation) -> const char *

Return the string representation for the OGRAxisOrientation enumeration.

### Returns
an internal string
"""
function axisenumtoname(eOrientation::OGRAxisOrientation)
    unsafe_string(ccall((:OSRAxisEnumToName, libgdal), Cstring, (OGRAxisOrientation,), eOrientation))
end

"""
    OSRNewSpatialReference(const char * pszWKT) -> OGRSpatialReferenceH

Constructor.
"""
function newspatialreference(arg1)
    checknull(ccall((:OSRNewSpatialReference, libgdal), Ptr{OGRSpatialReferenceH}, (Cstring,), arg1))
end

"""
    OSRCloneGeogCS(OGRSpatialReferenceH hSource) -> OGRSpatialReferenceH

Make a duplicate of the GEOGCS node of this OGRSpatialReference object.
"""
function clonegeogcs(arg1::Ref{OGRSpatialReferenceH})
    checknull(ccall((:OSRCloneGeogCS, libgdal), Ptr{OGRSpatialReferenceH}, (Ptr{Void},), arg1))
end

"""
    OSRClone(OGRSpatialReferenceH hSRS) -> OGRSpatialReferenceH

Make a duplicate of this OGRSpatialReference.
"""
function clone(arg1::Ref{OGRSpatialReferenceH})
    checknull(ccall((:OSRClone, libgdal), Ptr{OGRSpatialReferenceH}, (Ptr{Void},), arg1))
end

"""
    OSRDestroySpatialReference(OGRSpatialReferenceH hSRS) -> void

OGRSpatialReference destructor.

### Parameters
* **hSRS**: the object to delete
"""
function destroyspatialreference(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRDestroySpatialReference, libgdal), Void, (Ptr{Void},), arg1)
end

"""
    OSRReference(OGRSpatialReferenceH hSRS) -> int

Increments the reference count by one.
"""
function reference(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRReference, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRDereference(OGRSpatialReferenceH hSRS) -> int

Decrements the reference count by one.
"""
function dereference(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRDereference, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRRelease(OGRSpatialReferenceH hSRS) -> void

Decrements the reference count by one, and destroy if zero.
"""
function release(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRRelease, libgdal), Void, (Ptr{Void},), arg1)
end

"""
    OSRValidate(OGRSpatialReferenceH) -> OGRErr

Validate SRS tokens.
"""
function validate(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRValidate, libgdal), OGRErr, (Ptr{Void},), arg1)
end

"""
    OSRFixupOrdering(OGRSpatialReferenceH hSRS) -> OGRErr

Correct parameter ordering to match CT Specification.
"""
function fixupordering(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRFixupOrdering, libgdal), OGRErr, (Ptr{Void},), arg1)
end

"""
    OSRFixup(OGRSpatialReferenceH hSRS) -> OGRErr

Fixup as needed.
"""
function fixup(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRFixup, libgdal), OGRErr, (Ptr{Void},), arg1)
end

"""
    OSRStripCTParms(OGRSpatialReferenceH hSRS) -> OGRErr

Strip OGC CT Parameters.
"""
function stripctparms(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRStripCTParms, libgdal), OGRErr, (Ptr{Void},), arg1)
end

"""
    OSRImportFromEPSG(OGRSpatialReferenceH hSRS,
                      int nCode) -> OGRErr

Initialize SRS based on EPSG GCS or PCS code.
"""
function importfromepsg(arg1::Ref{OGRSpatialReferenceH}, arg2::Integer)
    ccall((:OSRImportFromEPSG, libgdal), OGRErr, (Ptr{Void}, Cint), arg1, arg2)
end

"""
    OSRImportFromEPSGA(OGRSpatialReferenceH hSRS,
                       int nCode) -> OGRErr

Initialize SRS based on EPSG GCS or PCS code.
"""
function importfromepsga(arg1::Ref{OGRSpatialReferenceH}, arg2::Integer)
    ccall((:OSRImportFromEPSGA, libgdal), OGRErr, (Ptr{Void}, Cint), arg1, arg2)
end

"""
    OSRImportFromWkt(OGRSpatialReferenceH hSRS,
                     char ** ppszInput) -> OGRErr

Import from WKT string.
"""
function importfromwkt(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromWkt, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRImportFromProj4(OGRSpatialReferenceH,
                       const char *) -> OGRErr

Import PROJ.4 coordinate string.
"""
function importfromproj4(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromProj4, libgdal), OGRErr, (Ptr{Void}, Cstring), arg1, arg2)
end

"""
    OSRImportFromESRI(OGRSpatialReferenceH,
                      char **) -> OGRErr

Import coordinate system from ESRI .prj format(s).
"""
function importfromesri(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromESRI, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRImportFromPCI(OGRSpatialReferenceH hSRS,
                     const char *,
                     const char *,
                     double *) -> OGRErr

Import coordinate system from PCI projection definition.
"""
function importfrompci(hSRS::Ref{OGRSpatialReferenceH}, arg1, arg2, arg3)
    ccall((:OSRImportFromPCI, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Ptr{Cdouble}), hSRS, arg1, arg2, arg3)
end

"""
    OSRImportFromUSGS(OGRSpatialReferenceH,
                      long,
                      long,
                      double *,
                      long) -> OGRErr

Import coordinate system from USGS projection definition.
"""
function importfromusgs(arg1::Ref{OGRSpatialReferenceH}, arg2::Clong, arg3::Clong, arg4, arg5::Clong)
    ccall((:OSRImportFromUSGS, libgdal), OGRErr, (Ptr{Void}, Clong, Clong, Ptr{Cdouble}, Clong), arg1, arg2, arg3, arg4, arg5)
end

"""
    OSRImportFromXML(OGRSpatialReferenceH,
                     const char *) -> OGRErr

Import coordinate system from XML format (GML only currently).
"""
function importfromxml(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromXML, libgdal), OGRErr, (Ptr{Void}, Cstring), arg1, arg2)
end

"""
    OSRImportFromDict(OGRSpatialReferenceH,
                      const char *,
                      const char *) -> OGRErr

Read SRS from WKT dictionary.

### Parameters
* **hSRS**: spatial reference system handle.
* **pszDictFile**: the name of the dictionary file to load.
* **pszCode**: the code to lookup in the dictionary.

### Returns
OGRERR_NONE on success, or OGRERR_SRS_UNSUPPORTED if the code isn't found, and OGRERR_SRS_FAILURE if something more dramatic goes wrong.
"""
function importfromdict(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3)
    ccall((:OSRImportFromDict, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring), arg1, arg2, arg3)
end

"""
    OSRImportFromPanorama(OGRSpatialReferenceH,
                          long,
                          long,
                          long,
                          double *) -> OGRErr

Import coordinate system from "Panorama" GIS projection definition.
"""
function importfrompanorama(arg1::Ref{OGRSpatialReferenceH}, arg2::Clong, arg3::Clong, arg4::Clong, arg5)
    ccall((:OSRImportFromPanorama, libgdal), OGRErr, (Ptr{Void}, Clong, Clong, Clong, Ptr{Cdouble}), arg1, arg2, arg3, arg4, arg5)
end

"""
    OSRImportFromOzi(OGRSpatialReferenceH,
                     const char *const *) -> OGRErr

Import coordinate system from OziExplorer projection definition.

### Parameters
* **hSRS**: spatial reference object.
* **papszLines**: Map file lines. This is an array of strings containing the whole OziExplorer .MAP file. The array is terminated by a NULL pointer.

### Returns
OGRERR_NONE on success or an error code in case of failure.
"""
function importfromozi(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromOzi, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRImportFromMICoordSys(OGRSpatialReferenceH hSRS,
                            const char * pszCoordSys) -> OGRErr

Import Mapinfo style CoordSys definition.
"""
function importfrommicoordsys(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromMICoordSys, libgdal), OGRErr, (Ptr{Void}, Cstring), arg1, arg2)
end

"""
    OSRImportFromERM(OGRSpatialReferenceH,
                     const char *,
                     const char *,
                     const char *) -> OGRErr

Create OGR WKT from ERMapper projection definitions.
"""
function importfromerm(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3, arg4)
    ccall((:OSRImportFromERM, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Cstring), arg1, arg2, arg3, arg4)
end

"""
    OSRImportFromUrl(OGRSpatialReferenceH hSRS,
                     const char * pszUrl) -> OGRErr

Set spatial reference from a URL.
"""
function importfromurl(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRImportFromUrl, libgdal), OGRErr, (Ptr{Void}, Cstring), arg1, arg2)
end

"""
    OSRExportToWkt(OGRSpatialReferenceH hSRS,
                   char ** ppszReturn) -> OGRErr

Convert this SRS into WKT format.
"""
function exporttowkt(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRExportToWkt, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRExportToPrettyWkt(OGRSpatialReferenceH hSRS,
                         char ** ppszReturn,
                         int bSimplify) -> OGRErr

Convert this SRS into a nicely formatted WKT string for display to a person.
"""
function exporttoprettywkt(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3::Integer)
    ccall((:OSRExportToPrettyWkt, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}, Cint), arg1, arg2, arg3)
end

"""
    OSRExportToProj4(OGRSpatialReferenceH,
                     char **) -> OGRErr

Export coordinate system in PROJ.4 format.
"""
function exporttoproj4(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRExportToProj4, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRExportToPCI(OGRSpatialReferenceH,
                   char **,
                   char **,
                   double **) -> OGRErr

Export coordinate system in PCI projection definition.
"""
function exporttopci(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3, arg4)
    ccall((:OSRExportToPCI, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}, Ptr{Cstring}, Ptr{Ptr{Cdouble}}), arg1, arg2, arg3, arg4)
end

"""
    OSRExportToUSGS(OGRSpatialReferenceH,
                    long *,
                    long *,
                    double **,
                    long *) -> OGRErr

Export coordinate system in USGS GCTP projection definition.
"""
function exporttousgs(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3, arg4, arg5)
    ccall((:OSRExportToUSGS, libgdal), OGRErr, (Ptr{Void}, Ptr{Clong}, Ptr{Clong}, Ptr{Ptr{Cdouble}}, Ptr{Clong}), arg1, arg2, arg3, arg4, arg5)
end

"""
    OSRExportToXML(OGRSpatialReferenceH,
                   char **,
                   const char *) -> OGRErr

Export coordinate system in XML format.
"""
function exporttoxml(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3)
    ccall((:OSRExportToXML, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}, Cstring), arg1, arg2, arg3)
end

"""
    OSRExportToPanorama(OGRSpatialReferenceH,
                        long *,
                        long *,
                        long *,
                        long *,
                        double *) -> OGRErr

Export coordinate system in "Panorama" GIS projection definition.
"""
function exporttopanorama(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3, arg4, arg5, arg6)
    ccall((:OSRExportToPanorama, libgdal), OGRErr, (Ptr{Void}, Ptr{Clong}, Ptr{Clong}, Ptr{Clong}, Ptr{Clong}, Ptr{Cdouble}), arg1, arg2, arg3, arg4, arg5, arg6)
end

"""
    OSRExportToMICoordSys(OGRSpatialReferenceH hSRS,
                          char ** ppszReturn) -> OGRErr

Export coordinate system in Mapinfo style CoordSys format.
"""
function exporttomicoordsys(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRExportToMICoordSys, libgdal), OGRErr, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRExportToERM(OGRSpatialReferenceH,
                   char *,
                   char *,
                   char *) -> OGRErr

Convert coordinate system to ERMapper format.
"""
function exporttoerm(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3, arg4)
    ccall((:OSRExportToERM, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Cstring), arg1, arg2, arg3, arg4)
end

"""
    OSRMorphToESRI(OGRSpatialReferenceH) -> OGRErr

Convert in place to ESRI WKT format.
"""
function morphtoesri(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRMorphToESRI, libgdal), OGRErr, (Ptr{Void},), arg1)
end

"""
    OSRMorphFromESRI(OGRSpatialReferenceH) -> OGRErr

Convert in place from ESRI WKT format.
"""
function morphfromesri(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRMorphFromESRI, libgdal), OGRErr, (Ptr{Void},), arg1)
end

"""
    OSRSetAttrValue(OGRSpatialReferenceH hSRS,
                    const char * pszPath,
                    const char * pszValue) -> OGRErr

Set attribute value in spatial reference.
"""
function setattrvalue(hSRS::Ref{OGRSpatialReferenceH}, pszNodePath, pszNewNodeValue)
    ccall((:OSRSetAttrValue, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring), hSRS, pszNodePath, pszNewNodeValue)
end

"""
    OSRGetAttrValue(OGRSpatialReferenceH hSRS,
                    const char * pszKey,
                    int iChild) -> const char *

Fetch indicated attribute of named node.
"""
function getattrvalue(hSRS::Ref{OGRSpatialReferenceH}, pszName, iChild::Integer)
    unsafe_string(ccall((:OSRGetAttrValue, libgdal), Cstring, (Ptr{Void}, Cstring, Cint), hSRS, pszName, iChild))
end

"""
    OSRSetAngularUnits(OGRSpatialReferenceH hSRS,
                       const char * pszUnits,
                       double dfInRadians) -> OGRErr

Set the angular units for the geographic coordinate system.
"""
function setangularunits(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3::Real)
    ccall((:OSRSetAngularUnits, libgdal), OGRErr, (Ptr{Void}, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetAngularUnits(OGRSpatialReferenceH hSRS,
                       char ** ppszName) -> double

Fetch angular geographic coordinate system units.
"""
function getangularunits(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRGetAngularUnits, libgdal), Cdouble, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRSetLinearUnits(OGRSpatialReferenceH hSRS,
                      const char * pszUnits,
                      double dfInMeters) -> OGRErr

Set the linear units for the projection.
"""
function setlinearunits(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3::Real)
    ccall((:OSRSetLinearUnits, libgdal), OGRErr, (Ptr{Void}, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRSetTargetLinearUnits(OGRSpatialReferenceH hSRS,
                            const char * pszTargetKey,
                            const char * pszUnits,
                            double dfInMeters) -> OGRErr

Set the linear units for the target node.
"""
function settargetlinearunits(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3, arg4::Real)
    ccall((:OSRSetTargetLinearUnits, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Cdouble), arg1, arg2, arg3, arg4)
end

"""
    OSRSetLinearUnitsAndUpdateParameters(OGRSpatialReferenceH hSRS,
                                         const char * pszUnits,
                                         double dfInMeters) -> OGRErr

Set the linear units for the projection.
"""
function setlinearunitsandupdateparameters(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3::Real)
    ccall((:OSRSetLinearUnitsAndUpdateParameters, libgdal), OGRErr, (Ptr{Void}, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetLinearUnits(OGRSpatialReferenceH hSRS,
                      char ** ppszName) -> double

Fetch linear projection units.
"""
function getlinearunits(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRGetLinearUnits, libgdal), Cdouble, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRGetTargetLinearUnits(OGRSpatialReferenceH hSRS,
                            const char * pszTargetKey,
                            char ** ppszName) -> double

Fetch linear projection units.
"""
function gettargetlinearunits(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3)
    ccall((:OSRGetTargetLinearUnits, libgdal), Cdouble, (Ptr{Void}, Cstring, Ptr{Cstring}), arg1, arg2, arg3)
end

"""
    OSRGetPrimeMeridian(OGRSpatialReferenceH hSRS,
                        char ** ppszName) -> double

Fetch prime meridian info.
"""
function getprimemeridian(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRGetPrimeMeridian, libgdal), Cdouble, (Ptr{Void}, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRIsGeographic(OGRSpatialReferenceH hSRS) -> int

Check if geographic coordinate system.
"""
function isgeographic(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsGeographic, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRIsLocal(OGRSpatialReferenceH hSRS) -> int

Check if local coordinate system.
"""
function islocal(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsLocal, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRIsProjected(OGRSpatialReferenceH hSRS) -> int

Check if projected coordinate system.
"""
function isprojected(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsProjected, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRIsCompound(OGRSpatialReferenceH hSRS) -> int

Check if the coordinate system is compound.
"""
function iscompound(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsCompound, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRIsGeocentric(OGRSpatialReferenceH hSRS) -> int

Check if geocentric coordinate system.
"""
function isgeocentric(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsGeocentric, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRIsVertical(OGRSpatialReferenceH hSRS) -> int

Check if vertical coordinate system.
"""
function isvertical(arg1::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsVertical, libgdal), Cint, (Ptr{Void},), arg1)
end

"""
    OSRIsSameGeogCS(OGRSpatialReferenceH hSRS1,
                    OGRSpatialReferenceH hSRS2) -> int

Do the GeogCS'es match?
"""
function issamegeogcs(arg1::Ref{OGRSpatialReferenceH}, arg2::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsSameGeogCS, libgdal), Cint, (Ptr{Void}, Ptr{Void}), arg1, arg2)
end

"""
    OSRIsSameVertCS(OGRSpatialReferenceH hSRS1,
                    OGRSpatialReferenceH hSRS2) -> int

Do the VertCS'es match?
"""
function issamevertcs(arg1::Ref{OGRSpatialReferenceH}, arg2::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsSameVertCS, libgdal), Cint, (Ptr{Void}, Ptr{Void}), arg1, arg2)
end

"""
    OSRIsSame(OGRSpatialReferenceH hSRS1,
              OGRSpatialReferenceH hSRS2) -> int

Do these two spatial references describe the same system ?
"""
function issame(arg1::Ref{OGRSpatialReferenceH}, arg2::Ref{OGRSpatialReferenceH})
    ccall((:OSRIsSame, libgdal), Cint, (Ptr{Void}, Ptr{Void}), arg1, arg2)
end

"""
    OSRSetLocalCS(OGRSpatialReferenceH hSRS,
                  const char * pszName) -> OGRErr

Set the user visible LOCAL_CS name.
"""
function setlocalcs(hSRS::Ref{OGRSpatialReferenceH}, pszName)
    ccall((:OSRSetLocalCS, libgdal), OGRErr, (Ptr{Void}, Cstring), hSRS, pszName)
end

"""
    OSRSetProjCS(OGRSpatialReferenceH hSRS,
                 const char * pszName) -> OGRErr

Set the user visible PROJCS name.
"""
function setprojcs(hSRS::Ref{OGRSpatialReferenceH}, pszName)
    ccall((:OSRSetProjCS, libgdal), OGRErr, (Ptr{Void}, Cstring), hSRS, pszName)
end

"""
    OSRSetGeocCS(OGRSpatialReferenceH hSRS,
                 const char * pszName) -> OGRErr

Set the user visible PROJCS name.
"""
function setgeoccs(hSRS::Ref{OGRSpatialReferenceH}, pszName)
    ccall((:OSRSetGeocCS, libgdal), OGRErr, (Ptr{Void}, Cstring), hSRS, pszName)
end

"""
    OSRSetWellKnownGeogCS(OGRSpatialReferenceH hSRS,
                          const char * pszName) -> OGRErr

Set a GeogCS based on well known name.
"""
function setwellknowngeogcs(hSRS::Ref{OGRSpatialReferenceH}, pszName)
    ccall((:OSRSetWellKnownGeogCS, libgdal), OGRErr, (Ptr{Void}, Cstring), hSRS, pszName)
end

"""
    OSRSetFromUserInput(OGRSpatialReferenceH hSRS,
                        const char * pszDef) -> OGRErr

Set spatial reference from various text formats.
"""
function setfromuserinput(hSRS::Ref{OGRSpatialReferenceH}, arg1)
    ccall((:OSRSetFromUserInput, libgdal), OGRErr, (Ptr{Void}, Cstring), hSRS, arg1)
end

"""
    OSRCopyGeogCSFrom(OGRSpatialReferenceH hSRS,
                      const OGRSpatialReferenceH hSrcSRS) -> OGRErr

Copy GEOGCS from another OGRSpatialReference.
"""
function copygeogcsfrom(hSRS::Ref{OGRSpatialReferenceH}, hSrcSRS::Ref{OGRSpatialReferenceH})
    ccall((:OSRCopyGeogCSFrom, libgdal), OGRErr, (Ptr{Void}, Ptr{Void}), hSRS, hSrcSRS)
end

"""
    OSRSetTOWGS84(OGRSpatialReferenceH hSRS,
                  double dfDX,
                  double dfDY,
                  double dfDZ,
                  double dfEX,
                  double dfEY,
                  double dfEZ,
                  double dfPPM) -> OGRErr

Set the Bursa-Wolf conversion to WGS84.
"""
function settowgs84(hSRS::Ref{OGRSpatialReferenceH}, arg1::Real, arg2::Real, arg3::Real, arg4::Real, arg5::Real, arg6::Real, arg7::Real)
    ccall((:OSRSetTOWGS84, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
end

"""
    OSRGetTOWGS84(OGRSpatialReferenceH hSRS,
                  double * padfCoeff,
                  int nCoeffCount) -> OGRErr

Fetch TOWGS84 parameters, if available.
"""
function gettowgs84(hSRS::Ref{OGRSpatialReferenceH}, arg1, arg2::Integer)
    ccall((:OSRGetTOWGS84, libgdal), OGRErr, (Ptr{Void}, Ptr{Cdouble}, Cint), hSRS, arg1, arg2)
end

"""
    OSRSetCompoundCS(OGRSpatialReferenceH hSRS,
                     const char * pszName,
                     OGRSpatialReferenceH hHorizSRS,
                     OGRSpatialReferenceH hVertSRS) -> OGRErr

Setup a compound coordinate system.
"""
function setcompoundcs(hSRS::Ref{OGRSpatialReferenceH}, pszName, hHorizSRS::Ref{OGRSpatialReferenceH}, hVertSRS::Ref{OGRSpatialReferenceH})
    ccall((:OSRSetCompoundCS, libgdal), OGRErr, (Ptr{Void}, Cstring, Ptr{Void}, Ptr{Void}), hSRS, pszName, hHorizSRS, hVertSRS)
end

"""
    OSRSetGeogCS(OGRSpatialReferenceH hSRS,
                 const char * pszGeogName,
                 const char * pszDatumName,
                 const char * pszSpheroidName,
                 double dfSemiMajor,
                 double dfInvFlattening,
                 const char * pszPMName,
                 double dfPMOffset,
                 const char * pszAngularUnits,
                 double dfConvertToRadians) -> OGRErr

Set geographic coordinate system.
"""
function setgeogcs(hSRS::Ref{OGRSpatialReferenceH}, pszGeogName, pszDatumName, pszEllipsoidName, dfSemiMajor::Real, dfInvFlattening::Real, pszPMName, dfPMOffset::Real, pszUnits, dfConvertToRadians::Real)
    ccall((:OSRSetGeogCS, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Cstring, Cdouble, Cdouble, Cstring, Cdouble, Cstring, Cdouble), hSRS, pszGeogName, pszDatumName, pszEllipsoidName, dfSemiMajor, dfInvFlattening, pszPMName, dfPMOffset, pszUnits, dfConvertToRadians)
end

"""
    OSRSetVertCS(OGRSpatialReferenceH hSRS,
                 const char * pszVertCSName,
                 const char * pszVertDatumName,
                 int nVertDatumType) -> OGRErr

Setup the vertical coordinate system.
"""
function setvertcs(hSRS::Ref{OGRSpatialReferenceH}, pszVertCSName, pszVertDatumName, nVertDatumType::Integer)
    ccall((:OSRSetVertCS, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Cint), hSRS, pszVertCSName, pszVertDatumName, nVertDatumType)
end

"""
    OSRGetSemiMajor(OGRSpatialReferenceH hSRS,
                    OGRErr * pnErr) -> double

Get spheroid semi major axis.
"""
function getsemimajor(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRGetSemiMajor, libgdal), Cdouble, (Ptr{Void}, Ptr{OGRErr}), arg1, arg2)
end

"""
    OSRGetSemiMinor(OGRSpatialReferenceH hSRS,
                    OGRErr * pnErr) -> double

Get spheroid semi minor axis.
"""
function getsemiminor(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRGetSemiMinor, libgdal), Cdouble, (Ptr{Void}, Ptr{OGRErr}), arg1, arg2)
end

"""
    OSRGetInvFlattening(OGRSpatialReferenceH hSRS,
                        OGRErr * pnErr) -> double

Get spheroid inverse flattening.
"""
function getinvflattening(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRGetInvFlattening, libgdal), Cdouble, (Ptr{Void}, Ptr{OGRErr}), arg1, arg2)
end

"""
    OSRSetAuthority(OGRSpatialReferenceH hSRS,
                    const char * pszTargetKey,
                    const char * pszAuthority,
                    int nCode) -> OGRErr

Set the authority for a node.
"""
function setauthority(hSRS::Ref{OGRSpatialReferenceH}, pszTargetKey, pszAuthority, nCode::Integer)
    ccall((:OSRSetAuthority, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, Cint), hSRS, pszTargetKey, pszAuthority, nCode)
end

"""
    OSRGetAuthorityCode(OGRSpatialReferenceH hSRS,
                        const char * pszTargetKey) -> const char *

Get the authority code for a node.
"""
function getauthoritycode(hSRS::Ref{OGRSpatialReferenceH}, pszTargetKey)
    unsafe_string(ccall((:OSRGetAuthorityCode, libgdal), Cstring, (Ptr{Void}, Cstring), hSRS, pszTargetKey))
end

"""
    OSRGetAuthorityName(OGRSpatialReferenceH hSRS,
                        const char * pszTargetKey) -> const char *

Get the authority name for a node.
"""
function getauthorityname(hSRS::Ref{OGRSpatialReferenceH}, pszTargetKey)
    unsafe_string(ccall((:OSRGetAuthorityName, libgdal), Cstring, (Ptr{Void}, Cstring), hSRS, pszTargetKey))
end

"""
    OSRSetProjection(OGRSpatialReferenceH hSRS,
                     const char * pszProjection) -> OGRErr

Set a projection name.
"""
function setprojection(arg1::Ref{OGRSpatialReferenceH}, arg2)
    ccall((:OSRSetProjection, libgdal), OGRErr, (Ptr{Void}, Cstring), arg1, arg2)
end

"""
    OSRSetProjParm(OGRSpatialReferenceH hSRS,
                   const char * pszParmName,
                   double dfValue) -> OGRErr

Set a projection parameter value.
"""
function setprojparm(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3::Real)
    ccall((:OSRSetProjParm, libgdal), OGRErr, (Ptr{Void}, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetProjParm(OGRSpatialReferenceH hSRS,
                   const char * pszName,
                   double dfDefaultValue,
                   OGRErr * pnErr) -> double

Fetch a projection parameter value.
"""
function getprojparm(hSRS::Ref{OGRSpatialReferenceH}, pszParmName, dfDefault::Real, arg1)
    ccall((:OSRGetProjParm, libgdal), Cdouble, (Ptr{Void}, Cstring, Cdouble, Ptr{OGRErr}), hSRS, pszParmName, dfDefault, arg1)
end

"""
    OSRSetNormProjParm(OGRSpatialReferenceH hSRS,
                       const char * pszParmName,
                       double dfValue) -> OGRErr

Set a projection parameter with a normalized value.
"""
function setnormprojparm(arg1::Ref{OGRSpatialReferenceH}, arg2, arg3::Real)
    ccall((:OSRSetNormProjParm, libgdal), OGRErr, (Ptr{Void}, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetNormProjParm(OGRSpatialReferenceH hSRS,
                       const char * pszName,
                       double dfDefaultValue,
                       OGRErr * pnErr) -> double

This function is the same as OGRSpatialReference::
"""
function getnormprojparm(hSRS::Ref{OGRSpatialReferenceH}, pszParmName, dfDefault::Real, arg1)
    ccall((:OSRGetNormProjParm, libgdal), Cdouble, (Ptr{Void}, Cstring, Cdouble, Ptr{OGRErr}), hSRS, pszParmName, dfDefault, arg1)
end

"""
    OSRSetUTM(OGRSpatialReferenceH hSRS,
              int nZone,
              int bNorth) -> OGRErr

Set UTM projection definition.
"""
function setutm(hSRS::Ref{OGRSpatialReferenceH}, nZone::Integer, bNorth::Integer)
    ccall((:OSRSetUTM, libgdal), OGRErr, (Ptr{Void}, Cint, Cint), hSRS, nZone, bNorth)
end

"""
    OSRGetUTMZone(OGRSpatialReferenceH hSRS,
                  int * pbNorth) -> int

Get utm zone information.
"""
function getutmzone(hSRS::Ref{OGRSpatialReferenceH}, pbNorth)
    ccall((:OSRGetUTMZone, libgdal), Cint, (Ptr{Void}, Ptr{Cint}), hSRS, pbNorth)
end

"""
    OSRSetStatePlane(OGRSpatialReferenceH hSRS,
                     int nZone,
                     int bNAD83) -> OGRErr

Set State Plane projection definition.
"""
function setstateplane(hSRS::Ref{OGRSpatialReferenceH}, nZone::Integer, bNAD83::Integer)
    ccall((:OSRSetStatePlane, libgdal), OGRErr, (Ptr{Void}, Cint, Cint), hSRS, nZone, bNAD83)
end

"""
    OSRSetStatePlaneWithUnits(OGRSpatialReferenceH hSRS,
                              int nZone,
                              int bNAD83,
                              const char * pszOverrideUnitName,
                              double dfOverrideUnit) -> OGRErr

Set State Plane projection definition.
"""
function setstateplanewithunits(hSRS::Ref{OGRSpatialReferenceH}, nZone::Integer, bNAD83::Integer, pszOverrideUnitName, dfOverrideUnit::Real)
    ccall((:OSRSetStatePlaneWithUnits, libgdal), OGRErr, (Ptr{Void}, Cint, Cint, Cstring, Cdouble), hSRS, nZone, bNAD83, pszOverrideUnitName, dfOverrideUnit)
end

"""
    OSRAutoIdentifyEPSG(OGRSpatialReferenceH hSRS) -> OGRErr

Set EPSG authority info if possible.
"""
function autoidentifyepsg(hSRS::Ref{OGRSpatialReferenceH})
    ccall((:OSRAutoIdentifyEPSG, libgdal), OGRErr, (Ptr{Void},), hSRS)
end

"""
    OSREPSGTreatsAsLatLong(OGRSpatialReferenceH hSRS) -> int

This function returns TRUE if EPSG feels this geographic coordinate system should be treated as having lat/long coordinate ordering.
"""
function epsgtreatsaslatlong(hSRS::Ref{OGRSpatialReferenceH})
    ccall((:OSREPSGTreatsAsLatLong, libgdal), Cint, (Ptr{Void},), hSRS)
end

"""
    OSREPSGTreatsAsNorthingEasting(OGRSpatialReferenceH hSRS) -> int

This function returns TRUE if EPSG feels this geographic coordinate system should be treated as having northing/easting coordinate ordering.
"""
function epsgtreatsasnorthingeasting(hSRS::Ref{OGRSpatialReferenceH})
    ccall((:OSREPSGTreatsAsNorthingEasting, libgdal), Cint, (Ptr{Void},), hSRS)
end

"""
    OSRGetAxis(OGRSpatialReferenceH hSRS,
               const char * pszTargetKey,
               int iAxis,
               OGRAxisOrientation * peOrientation) -> const char *

Fetch the orientation of one axis.
"""
function getaxis(hSRS::Ref{OGRSpatialReferenceH}, pszTargetKey, iAxis::Integer, peOrientation)
    unsafe_string(ccall((:OSRGetAxis, libgdal), Cstring, (Ptr{Void}, Cstring, Cint, Ptr{OGRAxisOrientation}), hSRS, pszTargetKey, iAxis, peOrientation))
end

"""
    OSRSetAxes(OGRSpatialReferenceH hSRS,
               const char * pszTargetKey,
               const char * pszXAxisName,
               OGRAxisOrientation eXAxisOrientation,
               const char * pszYAxisName,
               OGRAxisOrientation eYAxisOrientation) -> OGRErr

Set the axes for a coordinate system.
"""
function setaxes(hSRS::Ref{OGRSpatialReferenceH}, pszTargetKey, pszXAxisName, eXAxisOrientation::OGRAxisOrientation, pszYAxisName, eYAxisOrientation::OGRAxisOrientation)
    ccall((:OSRSetAxes, libgdal), OGRErr, (Ptr{Void}, Cstring, Cstring, OGRAxisOrientation, Cstring, OGRAxisOrientation), hSRS, pszTargetKey, pszXAxisName, eXAxisOrientation, pszYAxisName, eYAxisOrientation)
end

"""
    OSRSetACEA(OGRSpatialReferenceH hSRS,
               double dfStdP1,
               double dfStdP2,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Albers Conic Equal Area.
"""
function setacea(hSRS::Ref{OGRSpatialReferenceH}, dfStdP1::Real, dfStdP2::Real, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetACEA, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetAE(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Azimuthal Equidistant.
"""
function setae(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetAE, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetBonne(OGRSpatialReferenceH hSRS,
                double dfStdP1,
                double dfCentralMeridian,
                double dfFalseEasting,
                double dfFalseNorthing) -> OGRErr

Bonne.
"""
function setbonne(hSRS::Ref{OGRSpatialReferenceH}, dfStandardParallel::Real, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetBonne, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStandardParallel, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetCEA(OGRSpatialReferenceH hSRS,
              double dfStdP1,
              double dfCentralMeridian,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Cylindrical Equal Area.
"""
function setcea(hSRS::Ref{OGRSpatialReferenceH}, dfStdP1::Real, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetCEA, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetCS(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Cassini-Soldner.
"""
function setcs(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetCS, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEC(OGRSpatialReferenceH hSRS,
             double dfStdP1,
             double dfStdP2,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Equidistant Conic.
"""
function setec(hSRS::Ref{OGRSpatialReferenceH}, dfStdP1::Real, dfStdP2::Real, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetEC, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEckert(OGRSpatialReferenceH hSRS,
                 int nVariation,
                 double dfCentralMeridian,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Eckert I-VI.
"""
function seteckert(hSRS::Ref{OGRSpatialReferenceH}, nVariation::Integer, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetEckert, libgdal), OGRErr, (Ptr{Void}, Cint, Cdouble, Cdouble, Cdouble), hSRS, nVariation, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEckertIV(OGRSpatialReferenceH hSRS,
                   double dfCentralMeridian,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Eckert IV.
"""
function seteckertiv(hSRS::Ref{OGRSpatialReferenceH}, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetEckertIV, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEckertVI(OGRSpatialReferenceH hSRS,
                   double dfCentralMeridian,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Eckert VI.
"""
function seteckertvi(hSRS::Ref{OGRSpatialReferenceH}, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetEckertVI, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEquirectangular(OGRSpatialReferenceH hSRS,
                          double dfCenterLat,
                          double dfCenterLong,
                          double dfFalseEasting,
                          double dfFalseNorthing) -> OGRErr

Equirectangular.
"""
function setequirectangular(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetEquirectangular, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEquirectangular2(OGRSpatialReferenceH hSRS,
                           double dfCenterLat,
                           double dfCenterLong,
                           double dfStdParallel1,
                           double dfFalseEasting,
                           double dfFalseNorthing) -> OGRErr

Equirectangular generalized form.
"""
function setequirectangular2(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfPseudoStdParallel1::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetEquirectangular2, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfPseudoStdParallel1, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGS(OGRSpatialReferenceH hSRS,
             double dfCentralMeridian,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Gall Stereograpic.
"""
function setgs(hSRS::Ref{OGRSpatialReferenceH}, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetGS, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGH(OGRSpatialReferenceH hSRS,
             double dfCentralMeridian,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Goode Homolosine.
"""
function setgh(hSRS::Ref{OGRSpatialReferenceH}, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetGH, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetIGH(OGRSpatialReferenceH hSRS) -> OGRErr

Interrupted Goode Homolosine.
"""
function setigh(hSRS::Ref{OGRSpatialReferenceH})
    ccall((:OSRSetIGH, libgdal), OGRErr, (Ptr{Void},), hSRS)
end

"""
    OSRSetGEOS(OGRSpatialReferenceH hSRS,
               double dfCentralMeridian,
               double dfSatelliteHeight,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

GEOS - Geostationary Satellite View.
"""
function setgeos(hSRS::Ref{OGRSpatialReferenceH}, dfCentralMeridian::Real, dfSatelliteHeight::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetGEOS, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfSatelliteHeight, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGaussSchreiberTMercator(OGRSpatialReferenceH hSRS,
                                  double dfCenterLat,
                                  double dfCenterLong,
                                  double dfScale,
                                  double dfFalseEasting,
                                  double dfFalseNorthing) -> OGRErr

Gauss Schreiber Transverse Mercator.
"""
function setgaussschreibertmercator(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetGaussSchreiberTMercator, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGnomonic(OGRSpatialReferenceH hSRS,
                   double dfCenterLat,
                   double dfCenterLong,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Gnomonic.
"""
function setgnomonic(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetGnomonic, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetOM(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfAzimuth,
             double dfRectToSkew,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Oblique Mercator (aka HOM (variant B)
"""
function setom(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfAzimuth::Real, dfRectToSkew::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetOM, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfRectToSkew, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetHOM(OGRSpatialReferenceH hSRS,
              double dfCenterLat,
              double dfCenterLong,
              double dfAzimuth,
              double dfRectToSkew,
              double dfScale,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Set a Hotine Oblique Mercator projection using azimuth angle.
"""
function sethom(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfAzimuth::Real, dfRectToSkew::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetHOM, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfRectToSkew, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetHOMAC(OGRSpatialReferenceH hSRS,
                double dfCenterLat,
                double dfCenterLong,
                double dfAzimuth,
                double dfRectToSkew,
                double dfScale,
                double dfFalseEasting,
                double dfFalseNorthing) -> OGRErr

Set an Oblique Mercator projection using azimuth angle.
"""
function sethomac(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfAzimuth::Real, dfRectToSkew::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetHOMAC, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfRectToSkew, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetHOM2PNO(OGRSpatialReferenceH hSRS,
                  double dfCenterLat,
                  double dfLat1,
                  double dfLong1,
                  double dfLat2,
                  double dfLong2,
                  double dfScale,
                  double dfFalseEasting,
                  double dfFalseNorthing) -> OGRErr

Set a Hotine Oblique Mercator projection using two points on projection centerline.
"""
function sethom2pno(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfLat1::Real, dfLong1::Real, dfLat2::Real, dfLong2::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetHOM2PNO, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfLat1, dfLong1, dfLat2, dfLong2, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetIWMPolyconic(OGRSpatialReferenceH hSRS,
                       double dfLat1,
                       double dfLat2,
                       double dfCenterLong,
                       double dfFalseEasting,
                       double dfFalseNorthing) -> OGRErr

International Map of the World Polyconic.
"""
function setiwmpolyconic(hSRS::Ref{OGRSpatialReferenceH}, dfLat1::Real, dfLat2::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetIWMPolyconic, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfLat1, dfLat2, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetKrovak(OGRSpatialReferenceH hSRS,
                 double dfCenterLat,
                 double dfCenterLong,
                 double dfAzimuth,
                 double dfPseudoStdParallel1,
                 double dfScale,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Krovak Oblique Conic Conformal.
"""
function setkrovak(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfAzimuth::Real, dfPseudoStdParallelLat::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetKrovak, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfPseudoStdParallelLat, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLAEA(OGRSpatialReferenceH hSRS,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Lambert Azimuthal Equal-Area.
"""
function setlaea(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetLAEA, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLCC(OGRSpatialReferenceH hSRS,
              double dfStdP1,
              double dfStdP2,
              double dfCenterLat,
              double dfCenterLong,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Lambert Conformal Conic.
"""
function setlcc(hSRS::Ref{OGRSpatialReferenceH}, dfStdP1::Real, dfStdP2::Real, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetLCC, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLCC1SP(OGRSpatialReferenceH hSRS,
                 double dfCenterLat,
                 double dfCenterLong,
                 double dfScale,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Lambert Conformal Conic 1SP.
"""
function setlcc1sp(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetLCC1SP, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLCCB(OGRSpatialReferenceH hSRS,
               double dfStdP1,
               double dfStdP2,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Lambert Conformal Conic (Belgium)
"""
function setlccb(hSRS::Ref{OGRSpatialReferenceH}, dfStdP1::Real, dfStdP2::Real, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetLCCB, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMC(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Miller Cylindrical.
"""
function setmc(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetMC, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMercator(OGRSpatialReferenceH hSRS,
                   double dfCenterLat,
                   double dfCenterLong,
                   double dfScale,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Mercator.
"""
function setmercator(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetMercator, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMercator2SP(OGRSpatialReferenceH hSRS,
                      double dfStdP1,
                      double dfCenterLat,
                      double dfCenterLong,
                      double dfFalseEasting,
                      double dfFalseNorthing) -> OGRErr

Mercator 2SP.
"""
function setmercator2sp(hSRS::Ref{OGRSpatialReferenceH}, dfStdP1::Real, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetMercator2SP, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMollweide(OGRSpatialReferenceH hSRS,
                    double dfCentralMeridian,
                    double dfFalseEasting,
                    double dfFalseNorthing) -> OGRErr

Mollweide.
"""
function setmollweide(hSRS::Ref{OGRSpatialReferenceH}, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetMollweide, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetNZMG(OGRSpatialReferenceH hSRS,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

New Zealand Map Grid.
"""
function setnzmg(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetNZMG, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetOS(OGRSpatialReferenceH hSRS,
             double dfOriginLat,
             double dfCMeridian,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Oblique Stereographic.
"""
function setos(hSRS::Ref{OGRSpatialReferenceH}, dfOriginLat::Real, dfCMeridian::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetOS, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfOriginLat, dfCMeridian, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetOrthographic(OGRSpatialReferenceH hSRS,
                       double dfCenterLat,
                       double dfCenterLong,
                       double dfFalseEasting,
                       double dfFalseNorthing) -> OGRErr

Orthographic.
"""
function setorthographic(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetOrthographic, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetPolyconic(OGRSpatialReferenceH hSRS,
                    double dfCenterLat,
                    double dfCenterLong,
                    double dfFalseEasting,
                    double dfFalseNorthing) -> OGRErr

Polyconic.
"""
function setpolyconic(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetPolyconic, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetPS(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Polar Stereographic.
"""
function setps(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetPS, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetRobinson(OGRSpatialReferenceH hSRS,
                   double dfCenterLong,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Robinson.
"""
function setrobinson(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetRobinson, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetSinusoidal(OGRSpatialReferenceH hSRS,
                     double dfCenterLong,
                     double dfFalseEasting,
                     double dfFalseNorthing) -> OGRErr

Sinusoidal.
"""
function setsinusoidal(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetSinusoidal, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetStereographic(OGRSpatialReferenceH hSRS,
                        double dfOriginLat,
                        double dfCMeridian,
                        double dfScale,
                        double dfFalseEasting,
                        double dfFalseNorthing) -> OGRErr

Stereographic.
"""
function setstereographic(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetStereographic, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetSOC(OGRSpatialReferenceH hSRS,
              double dfLatitudeOfOrigin,
              double dfCentralMeridian,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Swiss Oblique Cylindrical.
"""
function setsoc(hSRS::Ref{OGRSpatialReferenceH}, dfLatitudeOfOrigin::Real, dfCentralMeridian::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetSOC, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfLatitudeOfOrigin, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTM(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Transverse Mercator.
"""
function settm(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetTM, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTMVariant(OGRSpatialReferenceH hSRS,
                    const char * pszVariantName,
                    double dfCenterLat,
                    double dfCenterLong,
                    double dfScale,
                    double dfFalseEasting,
                    double dfFalseNorthing) -> OGRErr

Transverse Mercator variant.
"""
function settmvariant(hSRS::Ref{OGRSpatialReferenceH}, pszVariantName, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetTMVariant, libgdal), OGRErr, (Ptr{Void}, Cstring, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, pszVariantName, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTMG(OGRSpatialReferenceH hSRS,
              double dfCenterLat,
              double dfCenterLong,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Tunesia Mining Grid.
"""
function settmg(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetTMG, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTMSO(OGRSpatialReferenceH hSRS,
               double dfCenterLat,
               double dfCenterLong,
               double dfScale,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Transverse Mercator (South Oriented)
"""
function settmso(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real, dfScale::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetTMSO, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTPED(OGRSpatialReferenceH hSRS,
               double dfLat1,
               double dfLong1,
               double dfLat2,
               double dfLong2,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

TPED (Two Point Equi Distant)
"""
function settped(hSRS::Ref{OGRSpatialReferenceH}, dfLat1::Real, dfLong1::Real, dfLat2::Real, dfLong2::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetTPED, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfLat1, dfLong1, dfLat2, dfLong2, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetVDG(OGRSpatialReferenceH hSRS,
              double dfCentralMeridian,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

VanDerGrinten.
"""
function setvdg(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLong::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetVDG, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetWagner(OGRSpatialReferenceH hSRS,
                 int nVariation,
                 double dfCenterLat,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Wagner I  VII.
"""
function setwagner(hSRS::Ref{OGRSpatialReferenceH}, nVariation::Integer, dfCenterLat::Real, dfFalseEasting::Real, dfFalseNorthing::Real)
    ccall((:OSRSetWagner, libgdal), OGRErr, (Ptr{Void}, Cint, Cdouble, Cdouble, Cdouble), hSRS, nVariation, dfCenterLat, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetQSC(OGRSpatialReferenceH hSRS,
              double dfCenterLat,
              double dfCenterLong) -> OGRErr

Quadrilateralized Spherical Cube.
"""
function setqsc(hSRS::Ref{OGRSpatialReferenceH}, dfCenterLat::Real, dfCenterLong::Real)
    ccall((:OSRSetQSC, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong)
end

"""
    OSRSetSCH(OGRSpatialReferenceH hSRS,
              double dfPegLat,
              double dfPegLong,
              double dfPegHeading,
              double dfPegHgt) -> OGRErr

Spherical, Cross-track, Height.
"""
function setsch(hSRS::Ref{OGRSpatialReferenceH}, dfPegLat::Real, dfPegLong::Real, dfPegHeading::Real, dfPegHgt::Real)
    ccall((:OSRSetSCH, libgdal), OGRErr, (Ptr{Void}, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfPegLat, dfPegLong, dfPegHeading, dfPegHgt)
end

"""
    OSRCalcInvFlattening(double dfSemiMajor,
                         double dfSemiMinor) -> double

Compute inverse flattening from semi-major and semi-minor axis.

### Parameters
* **dfSemiMajor**: Semi-major axis length.
* **dfSemiMinor**: Semi-minor axis length.

### Returns
inverse flattening, or 0 if both axis are equal.
"""
function calcinvflattening(dfSemiMajor::Real, dfSemiMinor::Real)
    ccall((:OSRCalcInvFlattening, libgdal), Cdouble, (Cdouble, Cdouble), dfSemiMajor, dfSemiMinor)
end

"""
    OSRCalcSemiMinorFromInvFlattening(double dfSemiMajor,
                                      double dfInvFlattening) -> double

Compute semi-minor axis from semi-major axis and inverse flattening.

### Parameters
* **dfSemiMajor**: Semi-major axis length.
* **dfInvFlattening**: Inverse flattening or 0 for sphere.

### Returns
semi-minor axis
"""
function calcsemiminorfrominvflattening(dfSemiMajor::Real, dfInvFlattening::Real)
    ccall((:OSRCalcSemiMinorFromInvFlattening, libgdal), Cdouble, (Cdouble, Cdouble), dfSemiMajor, dfInvFlattening)
end

"""
    OSRCleanup(void) -> void

Cleanup cached SRS related memory.
"""
function cleanup()
    ccall((:OSRCleanup, libgdal), Void, ())
end

"""
    OCTNewCoordinateTransformation(OGRSpatialReferenceH hSourceSRS,
                                   OGRSpatialReferenceH hTargetSRS) -> OGRCoordinateTransformationH

Create transformation object.

### Parameters
* **hSourceSRS**: source spatial reference system.
* **hTargetSRS**: target spatial reference system.

### Returns
NULL on failure or a ready to use transformation object.
"""
function octnewcoordinatetransformation(hSourceSRS::Ref{OGRSpatialReferenceH}, hTargetSRS::Ref{OGRSpatialReferenceH})
    checknull(ccall((:OCTNewCoordinateTransformation, libgdal), Ptr{OGRCoordinateTransformationH}, (Ptr{Void}, Ptr{Void}), hSourceSRS, hTargetSRS))
end

"""
    OCTDestroyCoordinateTransformation(OGRCoordinateTransformationH hCT) -> void

OGRCoordinateTransformation destructor.

### Parameters
* **hCT**: the object to delete
"""
function octdestroycoordinatetransformation(arg1::Ref{OGRCoordinateTransformationH})
    ccall((:OCTDestroyCoordinateTransformation, libgdal), Void, (Ptr{Void},), arg1)
end

"""
    OCTTransform(OGRCoordinateTransformationH hTransform,
                 int nCount,
                 double * x,
                 double * y,
                 double * z) -> int

Transform an array of points.

### Parameters
* **hTransform**: Transformation object
* **nCount**: Number of points
* **x**: Array of nCount x values.
* **y**: Array of nCount y values.
* **z**: Array of nCount z values.

### Returns
TRUE or FALSE
"""
function octtransform(hCT::Ref{OGRCoordinateTransformationH}, nCount::Integer, x, y, z)
    ccall((:OCTTransform, libgdal), Cint, (Ptr{Void}, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), hCT, nCount, x, y, z)
end

"""
    OCTTransformEx(OGRCoordinateTransformationH hTransform,
                   int nCount,
                   double * x,
                   double * y,
                   double * z,
                   int * pabSuccess) -> int

Transform an array of points.

### Parameters
* **hTransform**: Transformation object
* **nCount**: Number of points
* **x**: Array of nCount x values.
* **y**: Array of nCount y values.
* **z**: Array of nCount z values.
* **pabSuccess**: Output array of nCount value that will be set to TRUE/FALSE

### Returns
TRUE or FALSE
"""
function octtransformex(hCT::Ref{OGRCoordinateTransformationH}, nCount::Integer, x, y, z, pabSuccess)
    ccall((:OCTTransformEx, libgdal), Cint, (Ptr{Void}, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cint}), hCT, nCount, x, y, z, pabSuccess)
end

"""
    OCTProj4Normalize(const char * pszProj4Src) -> char *
"""
function octproj4normalize(pszProj4Src)
    unsafe_string(ccall((:OCTProj4Normalize, libgdal), Cstring, (Cstring,), pszProj4Src))
end

"""
    OCTCleanupProjMutex() -> void
"""
function octcleanupprojmutex()
    ccall((:OCTCleanupProjMutex, libgdal), Void, ())
end

"""
    OPTGetProjectionMethods() -> char **

Fetch list of possible projection methods.

### Returns
Returns NULL terminated list of projection methods. This should be freed with CSLDestroy() when no longer needed.
"""
function optgetprojectionmethods()
    unsafe_loadstringlist(ccall((:OPTGetProjectionMethods, libgdal), Ptr{Cstring}, ()))
end

"""
    OPTGetParameterList(const char * pszProjectionMethod,
                        char ** ppszUserName) -> char **

Fetch the parameters for a given projection method.

### Parameters
* **pszProjectionMethod**: internal name of projection methods to fetch the parameters for, such as "Transverse_Mercator" (SRS_PT_TRANSVERSE_MERCATOR).
* **ppszUserName**: pointer in which to return a user visible name for the projection name. The returned string should not be modified or freed by the caller. Legal to pass in NULL if user name not required.

### Returns
returns a NULL terminated list of internal parameter names that should be freed by the caller when no longer needed. Returns NULL if projection method is unknown.
"""
function optgetparameterlist(pszProjectionMethod, ppszUserName)
    unsafe_loadstringlist(ccall((:OPTGetParameterList, libgdal), Ptr{Cstring}, (Cstring, Ptr{Cstring}), pszProjectionMethod, ppszUserName))
end

"""
    OPTGetParameterInfo(const char * pszProjectionMethod,
                        const char * pszParameterName,
                        char ** ppszUserName,
                        char ** ppszType,
                        double * pdfDefaultValue) -> int

Fetch information about a single parameter of a projection method.

### Parameters
* **pszProjectionMethod**: name of projection method for which the parameter applies. Not currently used, but in the future this could affect defaults. This is the internal projection method name, such as "Tranverse_Mercator".
* **pszParameterName**: name of the parameter to fetch information about. This is the internal name such as "central_meridian" (SRS_PP_CENTRAL_MERIDIAN).
* **ppszUserName**: location at which to return the user visible name for the parameter. This pointer may be NULL to skip the user name. The returned name should not be modified or freed.
* **ppszType**: location at which to return the parameter type for the parameter. This pointer may be NULL to skip. The returned type should not be modified or freed. The type values are described above.
* **pdfDefaultValue**: location at which to put the default value for this parameter. The pointer may be NULL.

### Returns
TRUE if parameter found, or FALSE otherwise.
"""
function optgetparameterinfo(pszProjectionMethod, pszParameterName, ppszUserName, ppszType, pdfDefaultValue)
    ccall((:OPTGetParameterInfo, libgdal), Cint, (Cstring, Cstring, Ptr{Cstring}, Ptr{Cstring}, Ptr{Cdouble}), pszProjectionMethod, pszParameterName, ppszUserName, ppszType, pdfDefaultValue)
end


text:
# This file should be placed in the user home directory and named '.garamondrc.jl'
# for the statements in it to take effect.
#
# Note: Any modification of this file will trigger a re-compilation of
#       Garamond as the file is directly compiled into the engine.
const PDFTOTEXT_PROGRAM = "/usr/bin/pdftotext"  # program to convert PDFs to text
const MAX_EDIT_DISTANCE = 1  # maximum edit distance for which to return suggestions
const MAX_MATCHES = 1_000  # maximum number of matches that can be retrned
const MAX_SUGGESTIONS = 1  # maximum number of overall suggestions

ext: jl


text:
type PKContext
    data::Ptr{Void}

    function PKContext()
        ctx = new()
        ctx.data = Libc.malloc(32)

        ccall((:mbedtls_pk_init, MBED_CRYPTO), Void, (Ptr{Void},), ctx.data)

        finalizer(ctx,ctx->begin
            ccall((:mbedtls_pk_free, MBED_CRYPTO), Void, (Ptr{Void},), ctx.data)
            Libc.free(ctx.data)
        end)

        ctx
    end
end

function parse_keyfile!(ctx::PKContext, path, password="")
    @err_check ccall((:mbedtls_pk_parse_keyfile, MBED_CRYPTO), Cint,
        (Ptr{Void}, Cstring, Cstring),
        ctx.data, path, password)
end

function parse_keyfile(path, password="")
    ctx = PKContext()
    parse_keyfile!(ctx, path, password)
    ctx
end

function parse_public_keyfile!(ctx::PKContext, path)
    @err_check ccall((:mbedtls_pk_parse_public_keyfile, MBED_TLS), Cint,
        (Ptr{Void}, Cstring),
        ctx.data, path)
end

function parse_key!(ctx::PKContext, key, maybe_pw::Nullable = Nullable())
    key_bs = String(key)
    if isnull(maybe_pw)
        pw = C_NULL
        pw_size = 0
    else
        pw = String(get(maybe_pw))
        pw_size = sizeof(pw)  # Might be off-by-one
    end
    @err_check ccall((:mbedtls_pk_parse_key, MBED_TLS), Cint,
        (Ptr{Void}, Ptr{Void}, Csize_t, Ptr{Void}, Csize_t),
        ctx.data, key_bs, sizeof(key_bs)+1, pw, pw_size)
end

parse_key!(ctx::PKContext, key, pw) = parse_key!(ctx, key, Nullable(pw))

function bitlength(ctx::PKContext)
    sz = ccall((:mbedtls_pk_get_bitlen, MBED_CRYPTO), Csize_t,
        (Ptr{Void},), ctx.data)
    sz >= 0 || mbed_err(sz)
    Int(sz)
end

function decrypt!(ctx::PKContext, input, output, rng)
    outlen_ref = Ref{Cint}(0)
    @err_check ccall((:mbedtls_pk_decrypt, MBED_CRYPTO), Cint,
        (Ptr{Void}, Ptr{UInt8}, Csize_t, Ptr{Void}, Ref{Cint}, Csize_t, Ptr{Void}, Ptr{Void}),
        ctx.data, input, sizeof(input), output, outlen_ref, sizeof(output), c_rng, pointer_from_objref(rng))
    outlen = outlen_ref[]
    Int(outlen)
end

function encrypt!(ctx::PKContext, input, output, rng)
    outlen_ref = Ref{Cint}(0)
    @err_check ccall((:mbedtls_pk_encrypt, MBED_CRYPTO), Cint,
        (Ptr{Void}, Ptr{UInt8}, Csize_t, Ptr{Void}, Ref{Cint}, Csize_t, Ptr{Void}, Ptr{Void}),
        ctx.data, input, sizeof(input), output, outlen_ref, sizeof(output), c_rng, pointer_from_objref(rng))
    outlen = outlen_ref[]
    Int(outlen)
end

function sign!(ctx::PKContext, hash_alg::MDKind, hash, output, rng)
    outlen_ref = Ref{Cint}(sizeof(output))
    @err_check ccall((:mbedtls_pk_sign, MBED_CRYPTO), Cint,
        (Ptr{Void}, Cint, Ptr{UInt8}, Csize_t, Ptr{UInt8}, Ref{Cint}, Ptr{Void}, Ptr{Void}),
        ctx.data, hash_alg, hash, sizeof(hash), output, outlen_ref, c_rng, pointer_from_objref(rng))
    outlen = outlen_ref[]
    Int(outlen)
end

function get_name(ctx::PKContext)
    ptr = ccall((:mbedtls_pk_get_name, MBED_CRYPTO), Ptr{Cchar}, (Ptr{Void},), ctx.data)
    unsafe_string(convert(Ptr{UInt8}, ptr))
end


text:
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Artifacts, Test, Base.BinaryPlatforms
using Artifacts: with_artifacts_directory, pack_platform!, unpack_platform

# prepare for the package tests by ensuring the required artifacts are downloaded now
artifacts_dir = mktempdir()
run(addenv(`$(Base.julia_cmd()) --color=no $(joinpath(@__DIR__, "refresh_artifacts.jl")) $(artifacts_dir)`, "TERM"=>"dumb"))

@testset "Artifact Paths" begin
    mktempdir() do tempdir
        with_artifacts_directory(tempdir) do
            hash = Base.SHA1("0"^40)
            paths = Artifacts.artifact_paths(hash)
            @test length(paths) == 1
            @test startswith(first(paths), tempdir)

            @test !artifact_exists(hash)
            mkpath(first(paths))
            @test artifact_exists(hash)
            @test artifact_path(hash) == first(paths)
        end
    end
end

@testset "Serialization Tools" begin
    # First, some basic tests
    meta = Dict()
    pack_platform!(meta, Platform("i686", "linux"))
    @test meta["os"] == "linux"
    @test meta["arch"] == "i686"
    @test meta["libc"] == "glibc"

    meta = Dict()
    pack_platform!(meta, Platform("armv7l", "linux"; libc="musl"))
    @test meta["os"] == "linux"
    @test meta["arch"] == "armv7l"
    @test meta["libc"] == "musl"

    meta = Dict()
    pack_platform!(meta, Platform("x86_64", "windows"; libgfortran_version=v"3"))
    @test meta["os"] == "windows"
    @test meta["arch"] == "x86_64"
    @test meta["libgfortran_version"] == "3.0.0"

    meta = Dict()
    pack_platform!(meta, Platform("aarch64", "macOS"))
    @test meta == Dict("os" => "macos", "arch" => "aarch64")

    # Next, fuzz it out!  Ensure that we exactly reconstruct our platforms!
    platforms = Platform[]
    for libgfortran_version in (v"3", v"4", v"5", nothing),
        libstdcxx_version in (v"3.4.11", v"3.4.19", nothing),
        cxxstring_abi in ("cxx03", "cxx11", nothing)

        for arch in ("x86_64", "i686", "aarch64", "armv7l"),
            libc in ("glibc", "musl")

            push!(platforms, Platform(arch, "linux"; libc, libgfortran_version, libstdcxx_version, cxxstring_abi))
        end
        push!(platforms, Platform("x86_64", "windows"; libgfortran_version, libstdcxx_version, cxxstring_abi))
        push!(platforms, Platform("i686", "windows"; libgfortran_version, libstdcxx_version, cxxstring_abi))
        push!(platforms, Platform("x86_64", "macOS"; libgfortran_version, libstdcxx_version, cxxstring_abi))
        push!(platforms, Platform("aarch64", "macOS"; libgfortran_version, libstdcxx_version, cxxstring_abi))
        push!(platforms, Platform("x86_64", "FreeBSD"; libgfortran_version, libstdcxx_version, cxxstring_abi))
    end

    for p in platforms
        meta = Dict()
        pack_platform!(meta, p)
        @test unpack_platform(meta, "foo", "<in-memory-Artifacts.toml>") == p

        # Test that some things raise warnings
        bad_meta = copy(meta)
        delete!(bad_meta, "os")
        @test_logs (:error, r"Invalid artifacts file") unpack_platform(bad_meta, "foo", "")

        bad_meta = copy(meta)
        delete!(bad_meta, "arch")
        @test_logs (:error, r"Invalid artifacts file") unpack_platform(bad_meta, "foo", "")
    end
end

@testset "Artifact Slash-indexing" begin
    with_artifacts_directory(artifacts_dir) do
        exeext = Sys.iswindows() ? ".exe" : ""

        # simple lookup, gives us the directory for `c_simple` for the current architecture
        c_simple_dir = artifact"c_simple"
        @test isdir(c_simple_dir)
        c_simple_exe_path = joinpath(c_simple_dir, "bin", "c_simple$(exeext)")
        @test isfile(c_simple_exe_path)

        # Simple slash-indexed lookup
        c_simple_bin_path = artifact"c_simple/bin"
        @test isdir(c_simple_bin_path)
        # Test that forward and backward slash are equivalent
        @test artifact"c_simple\\bin" == artifact"c_simple/bin"

        # Dynamically-computed lookup; not done at compile-time
        generate_artifact_name() = "c_simple"
        c_simple_dir = @artifact_str(generate_artifact_name())
        @test isdir(c_simple_dir)
        c_simple_exe_path = joinpath(c_simple_dir, "bin", "c_simple$(exeext)")
        @test isfile(c_simple_exe_path)

        # Dynamically-computed slash-indexing:
        generate_bin_path(pathsep) = "c_simple$(pathsep)bin$(pathsep)c_simple$(exeext)"
        @test isfile(@artifact_str(generate_bin_path("/")))
        @test isfile(@artifact_str(generate_bin_path("\\")))
    end
end

@testset "@artifact_str Platform passing" begin
    with_artifacts_directory(artifacts_dir) do
        win64 = Platform("x86_64", "windows")
        mac64 = Platform("x86_64", "macos")
        @test basename(@artifact_str("c_simple", win64)) == "444cecb70ff39e8961dd33e230e151775d959f37"
        @test basename(@artifact_str("c_simple", mac64)) == "7ba74e239348ea6c060f994c083260be3abe3095"
    end
end

@testset "select_downloadable_artifacts()" begin
    arm_linux = Platform("armv7l", "linux")
    artifacts = select_downloadable_artifacts(joinpath(@__DIR__, "Artifacts.toml"); platform=arm_linux)
    @test length(keys(artifacts)) == 1
    @test artifacts["c_simple"]["git-tree-sha1"] == "0c509b3302db90a9393d6036c3ffcd14d190523d"

    artifacts = select_downloadable_artifacts(joinpath(@__DIR__, "Artifacts.toml"); platform=arm_linux, include_lazy=true)
    @test length(keys(artifacts)) == 2
    @test artifacts["c_simple"]["git-tree-sha1"] == "0c509b3302db90a9393d6036c3ffcd14d190523d"
    @test artifacts["socrates"]["git-tree-sha1"] == "43563e7631a7eafae1f9f8d9d332e3de44ad7239"
end

@testset "@artifact_str install errors" begin
    mktempdir() do tempdir
        with_artifacts_directory(tempdir) do
            ex = @test_throws ErrorException artifact"c_simple"
            @test startswith(ex.value.msg, "Artifact \"c_simple\" was not installed correctly. ")
            ex = @test_throws ErrorException artifact"socrates"
            @test startswith(ex.value.msg, "Artifact \"socrates\" is a lazy artifact; ")
        end
    end
end

max_stars_repo_name: dmageeLANL/julia

max_issues_repo_name: dmageeLANL/julia

max_forks_repo_name: dmageeLANL/julia


text:
module FunctionalDataUtils

using Distributed, Statistics

LOGFILE = ""
LOGTOFILE = false

function __init__()
    global LOGFILE
    LOGFILE = joinpath(pwd(), "julia.log")
end

FDU = FunctionalDataUtils
export FDU

import FunctionalData.apply
using FunctionalData#, Colors
using SHA

include("computing.jl")
include("numerical.jl")
include("computervision.jl")
include("graphics.jl")
include("machinelearning.jl")
# include("matlab.jl")
include("output.jl")
include("utils.jl")
include("system.jl")
include("sampler.jl")

end # module


text:
##
reload("MetabolicFluxAnalysis")
using MetabolicFluxAnalysis

# load file
fluxi_1_f = open("datasets/complete_mfa/cmfa_01.fluxi")
fluxi_1_s = readstring(fluxi_1_f)
fluxi1 = MetabolicFluxAnalysis.parseFluxi( fluxi_1_s )

# create an evaluator for the forward simulation
ilee_1 = MetabolicFluxAnalysis.create_julia_ile_evaluator( fluxi1.net , fluxi1.substrate_configs["SC_Conf_C1"] ,fluxi1.measurements["Data_Exp_01"] )

ocl_devices = OpenCL.cl.devices()
ocl_device  = ocl_devices[3]
print("\nOpenCL Device: $(ocl_device)\n")
ilee_2 = MetabolicFluxAnalysis.create_opencl_ile_evaluator( fluxi1.net , fluxi1.substrate_configs["SC_Conf_C1"] ,fluxi1.measurements["Data_Exp_01"] , MetabolicFluxAnalysis.OCLContext(ocl_device))

f = open("cl_kernel_01.ocl","w")
write(f,ilee_2.code)

constraints_config_01 = ["Constraints_FixedRatios","Constraints_BiomassRatios","Constraints_Measurements_01","Constraints_IrreversibilityPublication"]
constraints_01 = reduce( (x,y)->[x;y] , map( x -> fluxi1.linear_constraints[x] , constraints_config_01 ) )
fp1 = MetabolicFluxAnalysis.get_flux_polyhedron( fluxi1.net , constraints_01 , max_val=2000 )

# parametrize the flux polytope
rfd_parametrization = MetabolicFluxAnalysis.get_rounded_fulldimensional_parametrization( fp1 ; remove_red_constr=1)

@assert MetabolicFluxAnalysis.isinside( rfd_parametrization.p_opt , rfd_parametrization.cheby_p_opt[:,:] )
print("Flux Polytop has dimension $(size(rfd_parametrization.p_opt.G,2))")

xx = MetabolicFluxAnalysis.sample_unif_hr( rfd_parametrization.p_opt , rfd_parametrization.cheby_p_opt , 5000 , 1000 );
xx_flux = MetabolicFluxAnalysis.eval_opt2raw(rfd_parametrization,xx)

tic()
@profile sse_xx = MetabolicFluxAnalysis.eval_flux2sse( ilee_1 , xx_flux )
toc()


text:
module test_loltools_championmasteryv4

using Test
using LOLTools.ChampionMasteryV4

include("helpers.jl")

struct CMController <: ApplicationController
    conn::Conn
end

function by_summoner_id(c::CMController)
    # @info :c c.params.encryptedSummonerId
    render(JSON, [(a=1,)])
end

routes() do
    get("/lol/champion-mastery/v4/champion-masteries/by-summoner/:encryptedSummonerId", CMController, by_summoner_id)
end

api_key = ""
platform = "kr"
encryptedSummonerId = "id"
ChampionMasteryV4.by_summoner_id(api_key, platform, encryptedSummonerId; action=mock_action)

end # module test_loltools_championmasteryv4


text:
const x = 5

# @assert macro checks the supplied conditional expression, with the expression
# returned in the failed-assertion message
@assert x == 42
# ERROR: LoadError: AssertionError: x == 42

# Julia also has type assertions of the form, x::Type which can be appended to
# variable for type-checking at any point
x::String
# ERROR: LoadError: TypeError: in typeassert, expected String, got Int64

max_stars_repo_name: ethansaxenian/RosettaDecode

max_issues_repo_name: ethansaxenian/RosettaDecode

max_forks_repo_name: ethansaxenian/RosettaDecode


text:
using Documenter, CTMCEnsemble

makedocs(
    modules=[CTMCEnsemble]
)

deploydocs(
    deps   = Deps.pip("mkdocs", "python-markdown-math"),
    repo   = "github.com/innerlee/CTMCEnsemble.jl.git",
    julia  = "release",
    osname = "osx"
)


text:
module COFF

using StructIO

# Bring in ObjectFile definitions
using ObjectFile
importall ObjectFile

# Load in imported C #define constants
include("constants.jl")

# Start to bring in concrete types, in the order they're needed
include("COFFHeader.jl")
include("COFFOptionalHeader.jl")
include("COFFHandle.jl")
include("COFFSection.jl")
include("COFFStrTab.jl")
include("COFFSymbol.jl")
include("COFFDynamicLink.jl")

end # module COFF


text:
using MOCNeutronTransport
using Plots
pyplot()
T = Float64
Nsoln = 20
Nset = [ 1, 2, 3, 4, 5, 10, 15, 20]
f = arc_length

p₁ = Point_2D(T, 0)
p₂ = Point_2D(T, 2)
p₃ = Point_2D(T, 1.5, 1)
q = QuadraticSegment_2D(p₁, p₂, p₃)

soln = f(q; N=Nsoln)
err = [abs(soln - f(q; N = n)) for n = Nset]
plot(Nset[1:length(Nset)-1],
     err[1:length(Nset)-1],
     title = "Quadrature Points vs QuadraticSegment_2D arc_length error (Nsoln = $Nsoln)",
     yaxis=:log)
#     xaxis=:log)
xlabel!("Quadrature Points")
ylabel!("arc_length error")

max_stars_repo_name: KyleVaughn/MOCNeutronTransport

max_issues_repo_name: KyleVaughn/MOCNeutronTransport

max_forks_repo_name: KyleVaughn/MOCNeutronTransport


text:
"""
The GEOTRACES transects are not necessarily ordered in a nice way for plotting

Here is some predefined functionality to plot them nicely ordered

The code used for each transect was close to
```
cruise_list = unique(GEOTRACES.list_of_cruises())
ct = GEOTRACES.cruisetrack(c)
# Plot with rainbow to help seeing the problematic "jumps"
plot([(st.lon, st.lat) for st in ct.stations], m=:circle, zcolor=mod.(1:length(ct),10), color=:rainbow)
ic = sortperm(ct)
# Plot again after reordering
plot([(st.lon, st.lat) for st in ct.stations[ic]], m=:circle, zcolor=mod.(1:length(ct),10), color=:rainbow)

```

"""


text:
using Test, AdvancedHMC
using Random
include("common.jl")

ϵ = 0.01
lf = Leapfrog(ϵ)

θ_init = randn(D)
h = Hamiltonian(UnitEuclideanMetric(D), logπ, ∂logπ∂θ)
prop = NUTS(Leapfrog(find_good_eps(h, θ_init)))
r_init = AdvancedHMC.rand_momentum(h)

@testset "Passing random number generator" begin
    for seed in [1234, 5678, 90]
        rng = MersenneTwister(seed)
        θ1, r1 = AdvancedHMC.transition(rng, prop, h, θ_init, r_init)

        rng = MersenneTwister(seed)
        θ2, r2 = AdvancedHMC.transition(rng, prop, h, θ_init, r_init)

        @test θ1 == θ2
        @test r1 == r2
    end
end


text:
### A Pluto.jl notebook ###
# v0.14.7

using Markdown
using InteractiveUtils

# ╔═╡ e166839c-7451-471f-b10f-3cc8d3d751f3
begin
	using PlutoUI, Plots, LinearAlgebra, Statistics, DelimitedFiles, Clustering, DataFrames
	import Random, CSV
	plotly()
end

# ╔═╡ d6b500f1-5d54-4cdb-8d74-56e8a9ab367e
# For binder, uncomment this cell ...
#=
begin
	import Pkg
    Pkg.activate(mktempdir())
    Pkg.add([
		Pkg.PackageSpec(name="PlutoUI"),
        Pkg.PackageSpec(name="Plots"),
		Pkg.PackageSpec(name="Statistics"),
		Pkg.PackageSpec(name="DelimitedFiles"),
		Pkg.PackageSpec(name="Distributions"),
		Pkg.PackageSpec(name="Clustering"),
		Pkg.PackageSpec(name="CSV"),
		Pkg.PackageSpec(name="DataFrames")
    ])
end
=#

# ╔═╡ c810e2a4-03a5-4d19-8717-3de25f013269
TableOfContents(title="📚 Table of Contents", aside=true)

# ╔═╡ d7ef9ec9-1acf-48e6-bfbc-55ec01b36b0b
md"""
# Principal Component Analysis

PCA is an orthogonal linear transformation that transforms the data to a new coordinate system such that the greatest variance by some projection of the data comes to lie on the first coordinate (called the first principal component), the second greatest variance on the second coordinate, and so on. PCA analysis is perfromed either using EVD of the covariance matrix or the SVD of the mean-centered data.

__Prerequisites__

The reader should be familiar with linear algebra and statistics concepts.

__Competences__

The reader should be able to perform PCA on a given data set.

__References__

For more details see

* [Principal Component Analysis](https://en.wikipedia.org/wiki/Principal_component_analysis),
* [L. I. Smith, A tutorial on Principal Components Analysis](http://www.cs.otago.ac.nz/cosc453/student_tutorials/principal_components.pdf),
* [J. Shlens, A Tutorial on Principal Components Analysis](http://arxiv.org/abs/1404.1100).

"""

# ╔═╡ 728f10ec-2843-41ae-ae8e-c913155fe303
md"""
## Definitions

A __data matrix__ is a matrix $X\in\mathbb{R}^{m\times n}$, where each column corresponds to a feature (say, certain gene), and each row correspond to an observation (say, individual).

A __mean__ of a vector $x\in\mathbb{R}^{n}$ is $\mu(x)=\displaystyle \frac{x_1+x_2+\cdots x_n}{n}$.

A __standard deviation__  of a vector $x$ is $\sigma(x)=\displaystyle \sqrt{\frac{\sum_{i=1}^n (x_i-\mu(x))^2}{n-1}}$. A __variance__ of a vector $x$ is $\mathop{\mathrm{var}}(x)=\sigma^2(x)$.

A __vector of means__ of a data matrix $X$ is a row-vector of means of the columns of $X$, $\mu(X)=\begin{bmatrix}\mu(X_{:,1}) & \mu(X_{:,2}) & \ldots & \mu(X_{:,n})\end{bmatrix}$.

A __zero-mean centered data matrix__ is a matrix $\bar X$ obtained from a data matrix $X$ by subtracting from each column the mean of this column,

$$
\bar X= \begin{bmatrix} X_{:,1}-\mu(X_{:,1}) & X_{:,2}-\mu(X_{:,2}) & \cdots &
X_{:,n}-\mu(X_{:,n}) \end{bmatrix}\equiv
X-\mathbf{1}\mu(X),$$

where $\mathbf{1}=[1,1,\ldots,1]^T$.

A __covariance matrix__ of a data matrix $X$ is a matrix

$$
\mathop{\mathrm{cov}}(X)=\displaystyle \frac{1}{n-1}[X-\mathbf{1}\mu(X)]^T[X-\mathbf{1}\mu(X)]
\equiv \frac{\bar X^T \bar X}{n-1}.$$
"""

# ╔═╡ 1eec2efb-62b7-493b-8a9c-d3784d2e7825
md"""
## Facts

Given a data matrix $X$, let $\mathop{\mathrm{cov}}(X)=U\Lambda U^T$ be the EVD with non-increasingly ordered eigenvalues, $\lambda_1\geq \lambda_2\geq \cdots \geq \lambda_n$.

1.  $\mathop{\mathrm{cov}}(X)$  is a symmetric PSD matrix.

2.  $\mathop{\mathrm{cov}}(X)=\mathop{\mathrm{cov}}(\bar X)$.

3. Let $T=\bar X U$. The columns of $T$ are the __principal components__ of $\bar X$. In particular:
    1. The first principal component of $\bar X$ (or $X$) is the first column, $T_{:,1}$. It is a projection of the zero-mean centered data set $\bar X$ on the line defined by $U_{:,1}$. This is the direction along which the data have the largest variance.
    2. The second column (the second principal component), $T_{:,1}$, is a projection of $\bar X$ on the line defined by $U_{:,2}$, which is orthogonal to the first projection. This is direction with the largest variance _after_ subtracting the first principal component from $\bar X$.
    3. The $k$-th principal component is the direction with the largest variance _after_ subtracting the first $k-1$ principal components from $\bar X$, that is, the first principal component of the matrix

$$
\hat X=\bar X-\sum_{i=1}^{k-1} \bar X U_{:,i} U_{:,i}^T.$$

4. Let $\bar X=\bar U \Sigma V^T$ be the SVD of $\bar X$. Then $V=U$ and $T=\bar U\Sigma V^T V\equiv \bar U \Sigma$.

5. Reconstruction of the principal components is the following:
    1. Full reconstruction is $X=T U^T +\mathbf{1} \mu(X)$.
    2. Reconstruction from the first $k$ principal components is

$$\tilde X =T U_{:,1:k}^T +\mathbf{1} \mu(X).$$

6. Partial reconstructions can help obtaining various insights about the data. For example, the rows of the matrix $T_{:,1:k}$ can be clustered by the $k$-means algorithm, and the points defined by first three columns of $T$ can be plotted to visualize projections of clusters. Afterwards, the computed clusters can be mapped back to original data.

7. Heuristical guess for number of important clusters is given be the location of the "knee" in the plot of the singular values of $\bar X$.
"""

# ╔═╡ 63929a68-2407-4b46-80bc-91c5da382931
md"""

## Examples

### Elliptical data set

We generate a "quasi" elliptical set of points and compute its principal components.
"""

# ╔═╡ 1c25240c-d396-4661-b3f3-fd2b30876a00
begin
	# Generate data points
	Random.seed!(456)
	n=3
	m=500
	ax=[8,3,1]
	X=Array{Float64}(undef,m,n)
	for i=1:n
	    X[:,i]=Random.rand!(X[:,i])*ax[i]
	end
	# Parameters
	u=(rand(m).-0.5)*π
	v=(rand(m).-0.5)*2*π
	for i=1:m
	    X[i,1]=X[i,1]*cos(u[i])*cos(v[i])
	    X[i,2]=X[i,2]*cos(u[i])*sin(v[i])
	    X[i,3]=X[i,3]*sin(u[i])
	end
end

# ╔═╡ 61435c77-989b-4490-ba29-acc23420d021
X₀=copy(X)

# ╔═╡ 4bb4a5d4-4cfd-4ddc-b3a8-6b59f1e6f562
sum(abs.(X₀),dims=1)

# ╔═╡ 9ce6a3e8-b706-4014-92e9-4c03b5eb381b
# Plot the set
scatter(X₀[:,1],X₀[:,2],X₀[:,3],legend=false,ms=2,aspect_ratio=:equal,xlabel="x")

# ╔═╡ 7f033a55-ebf3-4265-85c1-f3358d165ab9
# Compute the means. How good is the RNG?
μ₀=mean(X₀,dims=1)

# ╔═╡ f427adaa-c41f-4017-ada6-cd018bbc642c
begin
	# Subtract the means, rotate by a random orthogonal matrix Q and
	# translate by S
	Q,r=qr(rand(3,3))
	S=[3,-2,4]
	X₁=(X₀.-μ₀)*Q .+S'
	scatter(X₁[:,1],X₁[:,2],X₁[:,3],legend=false,ms=2,aspect_ratio=:equal,xlabel="x")
end

# ╔═╡ 66a8e281-4709-4548-b13b-5dd5c23805e6
C₁=cov(X₁)

# ╔═╡ 685bdf11-79bd-4070-9b30-3dfa0341e779
μ₁=mean(X₁,dims=1)

# ╔═╡ 5533faf5-7847-468b-bd62-244b2581cad6
# Fact 2
cov(X₁.-μ₁), (X₁.-μ₁)'*(X₁.-μ₁)/(m-1)

# ╔═╡ db7e0f78-0a05-4719-81f1-cd007ff1163b
# Principal components, evals are non-decreasing
λ₁,U₁=eigen(C₁)

# ╔═╡ 0e179343-1f3e-4b5f-8560-c5acbfa8f6e6
begin
	# Largest principal component
	T₁=(X₁.-μ₁)*U₁[:,3]
	p₁=scatter(T₁,zero(T₁),marker=:plus,ms=2)
	p₂=scatter(T₁)
	plot(p₁,p₂,layout=(1,2),legend=false,m=:plus,ms=2)
end

# ╔═╡ 5b208afb-13cc-4937-82f8-df67830a4914
begin
	# Two largest principal components
	T₂=(X₁.-μ₁)*U₁[:,[3,2]]
	scatter(T₂[:,1],T₂[:,2],legend=false,m=:plus,ms=2,ratio=:equal)
end

# ╔═╡ d2dacf61-8728-4046-9dae-0bafe842cebf
begin
	# All  three principal components
	T₃=(X₁.-μ₁)*U₁[:,[3,2,1]]
	scatter(T₃[:,1],T₃[:,2],T₃[:,3],legend=false,m=:plus,ms=2,ratio=:equal)
end

# ╔═╡ e1b16942-6e32-45f6-a3c8-eb259ccd9e5b
begin
	# Fact 5 - Recovery of the largest component
	Y₁=T₁*U₁[:,3]'.+μ₁
	scatter(Y₁[:,1],Y₁[:,2],Y₁[:,3],legend=false,m=:plus,ms=2,ratio=:equal)
end

# ╔═╡ 56ddc45c-9b40-4c76-8ea1-8235f9690d73
begin
	# Recovery of the two largest components
	Y₂=T₂*U₁[:,[3,2]]'.+μ₁
	scatter(Y₂[:,1],Y₂[:,2],Y₂[:,3],legend=false,m=:plus,ms=2,ratio=:equal)
end

# ╔═╡ d06b73ae-1556-4c04-8f39-b7b12ae5bc72
begin
	# Recovery of all three components (exact)
	Y₃=T₃*U₁[:,[3,2,1]]'.+μ₁
	scatter(Y₃[:,1],Y₃[:,2],Y₃[:,3],legend=false,m=:plus,ms=2,ratio=:equal)
	scatter!(X₁[:,1],X₁[:,2],X₁[:,3],legend=false,m=:circle,ms=2,mc=:red,ratio=:equal)
end

# ╔═╡ e50ce490-bf7e-40b0-9dd5-7e2ee5a057cb
# Fact 4 - PCA using SVD
function PCA(X::Array{T}, k::Int) where T
    μ=mean(X,dims=1)
    U=svd(X.-μ)
    U.U[:,1:k]*Diagonal(U.S[1:k])
end

# ╔═╡ 12580ca2-5703-4933-ae1a-eb69c3e22109
begin
	T₁s=PCA(X,1)
	[T₁s T₁]
end

# ╔═╡ 38318bfc-d72a-4da0-9862-235fb43f7c61
begin
	# The two largest components using SVD
	T₂s=PCA(X,2)
	[T₂s T₂]
end

# ╔═╡ ff6f6c9f-0e14-47a5-8bcf-29337a45d042
md"""
### Real data 1

We will cluster three datasets from [Workshop "Principal Manifolds-2006"](http://www.ihes.fr/~zinovyev/princmanif2006/):

Data set | # of genes (m) | # of samples (n)
:---:|---:|---:
D1 | 17816 | 286
D2 | 3036 | 40
D3 | 10383| 103
"""

# ╔═╡ 8c5c604c-5043-4dd0-a604-99c958860c14
# Data set D₁
# readdlm("files/d1.txt")

# ╔═╡ 73c0571b-60c9-4a85-bbfa-39a6f42192a2
D₁=map(Float64,readdlm("files/d1.txt")[2:end,2:end])

# ╔═╡ d70d8dd7-a9a5-48bf-8a1b-789d02c35d02
sizeof(D₁)

# ╔═╡ 21bc5eee-ebd9-4192-a240-59cd3f4a33b2
# Fact 7 - Plot σ's and observe the knee
scatter(svdvals(D₁.-mean(D₁,dims=1)),leg=false,ms=2)

# ╔═╡ 83660bc1-8116-476e-9c88-0ea176120875
begin
	# PCA on D₁, keep 20 singular values
	k₁=20
	T=PCA(D₁,k₁)
end

# ╔═╡ 500d16ac-0dbe-4815-8fbb-922adf751d9f
# Find k clusters
out=kmeans(T',k₁);

# ╔═╡ 8c6255cb-60f4-4c63-b4b2-e403d74360e1
# Plot points defined by the first three principal components
function Plot(C::Vector, T::Array, k::Int)
    P=Array{Any}(undef,k)
	scatter(legend=false)
    for j=1:k
        P[j]=T[C.==j,1:3]
        scatter!(P[j][:,1],P[j][:,2],P[j][:,3],ms=2)
    end
	scatter!()
end

# ╔═╡ dff6d995-3753-4c70-b286-dd5aaf7f6461
Plot(out.assignments,T,k₁)

# ╔═╡ 54d17292-195e-4ad4-8848-c725d1cbf8bf
md"
### Real data 2
"

# ╔═╡ e133dab4-f9fe-47ed-a9a5-2644c1a954c9
# Data set D₂
D₂=readdlm("files/d2fn.txt")

# ╔═╡ 69016fc2-4249-4ce8-9d02-4371ba4ac6d7
# Plot σ's and observe knee
scatter(svdvals(D₂.-mean(D₂,dims=1)),leg=false,ms=2)

# ╔═╡ d5713d68-6413-4873-9d40-d8a5134ceb3d
begin
	k₂=5
	T²=PCA(D₂,k₂)
	out₂=kmeans(T²',k₂)
	Plot(out₂.assignments,T²,k₂)
end

# ╔═╡ 60d2fab0-9951-48b1-a9e4-81ff10b1bf40
md"""

### Real data 3

We use the package [CSV.jl](https://github.com/JuliaData/CSV.jl) and replace the "NULL" string with `missing`.
"""

# ╔═╡ dcef3495-9a8b-4e7f-bbda-865cac3e894e
sf = CSV.read("files/d3efn.txt",DataFrame,header=0,missingstring="NULL")

# ╔═╡ 5cabfc3e-54a1-40aa-8979-bc5cc10d2ffd
# sf[:,103]

# ╔═╡ 53191664-ec06-441c-b1ee-5ee8034c4984
typeof(sf)

# ╔═╡ 9ab1ba2b-30fd-4cca-be25-3090608d18be
# Set missing values to zero
D₃=coalesce.(Matrix(sf[:,1:end-1]),0.0)

# ╔═╡ a4ea64d4-57f3-4d43-9083-3e52b8e213d7
# Plot σ's and observe knee
scatter(svdvals(D₃.-mean(D₃,dims=1)),leg=false,ms=2)

# ╔═╡ d6143ca0-ba0e-406a-8b3f-fbcd348777bb
begin
	k₃=10
	T³=PCA(D₃,k₃)
	out₃=kmeans(T³',k₃)
	Plot(out₃.assignments,T³,k₃)
end

# ╔═╡ 2a85afb0-a3e8-477b-bc9b-e97701c40eae
begin
	# Clustering the transpose
	k₄=20
	T⁴=PCA(Matrix(D₃'),k₄)
	out₄=kmeans(T⁴',k₄)
	Plot(out₄.assignments,T⁴,k₄)
end

# ╔═╡ Cell order:
# ╠═d6b500f1-5d54-4cdb-8d74-56e8a9ab367e
# ╠═e166839c-7451-471f-b10f-3cc8d3d751f3
# ╠═c810e2a4-03a5-4d19-8717-3de25f013269
# ╟─d7ef9ec9-1acf-48e6-bfbc-55ec01b36b0b
# ╟─728f10ec-2843-41ae-ae8e-c913155fe303
# ╟─1eec2efb-62b7-493b-8a9c-d3784d2e7825
# ╟─63929a68-2407-4b46-80bc-91c5da382931
# ╠═1c25240c-d396-4661-b3f3-fd2b30876a00
# ╠═61435c77-989b-4490-ba29-acc23420d021
# ╠═4bb4a5d4-4cfd-4ddc-b3a8-6b59f1e6f562
# ╠═9ce6a3e8-b706-4014-92e9-4c03b5eb381b
# ╠═7f033a55-ebf3-4265-85c1-f3358d165ab9
# ╠═f427adaa-c41f-4017-ada6-cd018bbc642c
# ╠═66a8e281-4709-4548-b13b-5dd5c23805e6
# ╠═685bdf11-79bd-4070-9b30-3dfa0341e779
# ╠═5533faf5-7847-468b-bd62-244b2581cad6
# ╠═db7e0f78-0a05-4719-81f1-cd007ff1163b
# ╠═0e179343-1f3e-4b5f-8560-c5acbfa8f6e6
# ╠═5b208afb-13cc-4937-82f8-df67830a4914
# ╠═d2dacf61-8728-4046-9dae-0bafe842cebf
# ╠═e1b16942-6e32-45f6-a3c8-eb259ccd9e5b
# ╠═56ddc45c-9b40-4c76-8ea1-8235f9690d73
# ╠═d06b73ae-1556-4c04-8f39-b7b12ae5bc72
# ╠═e50ce490-bf7e-40b0-9dd5-7e2ee5a057cb
# ╠═12580ca2-5703-4933-ae1a-eb69c3e22109
# ╠═38318bfc-d72a-4da0-9862-235fb43f7c61
# ╟─ff6f6c9f-0e14-47a5-8bcf-29337a45d042
# ╠═8c5c604c-5043-4dd0-a604-99c958860c14
# ╠═73c0571b-60c9-4a85-bbfa-39a6f42192a2
# ╠═d70d8dd7-a9a5-48bf-8a1b-789d02c35d02
# ╠═21bc5eee-ebd9-4192-a240-59cd3f4a33b2
# ╠═83660bc1-8116-476e-9c88-0ea176120875
# ╠═500d16ac-0dbe-4815-8fbb-922adf751d9f
# ╠═8c6255cb-60f4-4c63-b4b2-e403d74360e1
# ╠═dff6d995-3753-4c70-b286-dd5aaf7f6461
# ╟─54d17292-195e-4ad4-8848-c725d1cbf8bf
# ╠═e133dab4-f9fe-47ed-a9a5-2644c1a954c9
# ╠═69016fc2-4249-4ce8-9d02-4371ba4ac6d7
# ╠═d5713d68-6413-4873-9d40-d8a5134ceb3d
# ╟─60d2fab0-9951-48b1-a9e4-81ff10b1bf40
# ╠═dcef3495-9a8b-4e7f-bbda-865cac3e894e
# ╠═5cabfc3e-54a1-40aa-8979-bc5cc10d2ffd
# ╠═53191664-ec06-441c-b1ee-5ee8034c4984
# ╠═9ab1ba2b-30fd-4cca-be25-3090608d18be
# ╠═a4ea64d4-57f3-4d43-9083-3e52b8e213d7
# ╠═d6143ca0-ba0e-406a-8b3f-fbcd348777bb
# ╠═2a85afb0-a3e8-477b-bc9b-e97701c40eae

max_stars_repo_path: src/Module C - Applications/L16 Principal Component Analysis.jl

max_stars_repo_name: ivanslapnicar/GIAN-Applied-NLA-Course

max_issues_repo_name: ivanslapnicar/GIAN-Applied-NLA-Course

max_forks_repo_name: ivanslapnicar/GIAN-Applied-NLA-Course


text:
const config = Dict(:multiplication => :fast)

struct MultiplicationType{T} end

get_multiplication_mode() = config

"""
    set_multiplication_mode(multype)

Sets the algorithm used to perform matrix multiplication with interval matrices.

### Input

- `multype` -- symbol describing the algorithm used
   - `:slow` -- uses traditional matrix multiplication algorithm.
   - `:fast` -- computes an enclosure of the matrix product using the midpoint-radius
                notation of the matrix [[RUM10]](@ref).

### Notes

- By default, `:fast` is used.
- Using `fast` is generally significantly faster, but it may return larger intervals,
  especially if midpoint and radius have the same order of magnitude
    (50% overestimate at most) [[RUM99]](@ref).
"""
function set_multiplication_mode(multype)
    multype in (:fast, :slow) || throw(ArgumentError("$multype is not a valid input."))

    type = MultiplicationType{multype}()
    @eval *(A::IntervalMatrix, B::IntervalMatrix) = *($type, A, B)

    @eval *(A::AbstractMatrix, B::IntervalMatrix) = *($type, A, B)

    @eval *(A::IntervalMatrix, B::AbstractMatrix) = *($type, A, B)

    config[:multiplication] = multype
end

*(::MultiplicationType{:slow}, A::IntervalMatrix, B::IntervalMatrix) = IntervalMatrix(A.mat * B.mat)
*(::MultiplicationType{:slow}, A::AbstractMatrix, B::IntervalMatrix) = IntervalMatrix(A * B.mat)
*(::MultiplicationType{:slow}, A::IntervalMatrix, B::AbstractMatrix) = IntervalMatrix(A.mat * B)

function *(::MultiplicationType{:fast},
           A::AbstractIntervalMatrix{Interval{T}},
           B::AbstractIntervalMatrix{Interval{T}}) where {T}

    Ainf = inf(A)
    Asup = sup(A)
    Binf = inf(B)
    Bsup = sup(B)

    mA, mB, R, Csup = setrounding(T, RoundUp) do
        mA = Ainf + 0.5 * (Asup - Ainf)
        mB = Binf + 0.5 * (Bsup - Binf)

        rA = mA - Ainf
        rB = mB - Binf

        R = abs.(mA) * rB + rA * (abs.(mB) + rB)
        Csup = mA * mB + R

        return mA, mB, R, Csup
    end

    Cinf = setrounding(T, RoundDown) do
        mA * mB - R
    end

    return IntervalMatrix(Interval.(Cinf, Csup))
end

function *(::MultiplicationType{:fast},
    A::AbstractMatrix{T},
    B::AbstractIntervalMatrix{Interval{T}}) where {T}

    Binf = inf(B)
    Bsup = sup(B)

    mB, R, Csup = setrounding(T, RoundUp) do
        mB = Binf + 0.5 * (Bsup - Binf)

        rB = mB - Binf

        R = abs.(A) * rB
        Csup = A * mB + R

        return mB, R, Csup
    end

    Cinf = setrounding(T, RoundDown) do
        A * mB - R
    end

    return IntervalMatrix(Interval.(Cinf, Csup))
end

function *(::MultiplicationType{:fast},
    A::AbstractIntervalMatrix{Interval{T}},
    B::AbstractMatrix{T}) where {T}

    Ainf = inf(A)
    Asup = sup(A)

    mA, R, Csup = setrounding(T, RoundUp) do
        mA = Ainf + 0.5 * (Asup - Ainf)

        rA = mA - Ainf

        R = rA * abs.(B)
        Csup = mA * B + R

        return mA, R, Csup
    end

    Cinf = setrounding(T, RoundDown) do
        mA * B - R
    end

    return IntervalMatrix((Interval.(Cinf, Csup)))
end

# function *(::MultiplicationType{:rank1},
#            A::AbstractMatrix{Interval{T}},
#            B::AbstractMatrix{Interval{T}}) where {T<:Real}

#     Ainf = inf.(A)
#     Asup = sup.(A)
#     Binf = inf.(B)
#     Bsup = sup.(B)

#     n = size(A, 2)

#     Csup =  zeros(T, (size(A,1), size(B,2)))
#     Cinf = zeros(T, size(A, 1), size(B, 2))

#     Cinf = setrounding(T, RoundDown) do
#         for i in 1:n
#             Cinf .+= min.(view(Ainf, :, i) * view(Binf, i, :)',
#                           view(Ainf, :, i) * view(Bsup, i, :)',
#                           view(Asup, :, i) * view(Binf, i, :)',
#                           view(Asup, :, i) * view(Bsup, i, :)')
#         end
#         return Cinf
#     end

#     Csup = setrounding(T, RoundUp) do
#         for i in 1:n
#             Csup .+= max.(view(Ainf, :, i) * view(Binf, i, :)',
#                           view(Ainf, :, i) * view(Bsup, i, :)',
#                           view(Asup, :, i) * view(Binf, i, :)',
#                           view(Asup, :, i) * view(Bsup, i, :)')
#         end
#         return Csup
#     end

#     return Interval.(Cinf, Csup)

# end