Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • b7953a0
  • /
  • model.jl
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:e91fe7aa6b1123e184744b2a3ba649cc1c1d0477
directory badge Iframe embedding
swh:1:dir:b7953a0181984616831ccdfbbba622e10eb82cca
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
model.jl
# This file contains types and structures for DEA model
"""
    AbstractDEAModel
An abstract type representing a DEA model.
"""
abstract type AbstractDEAModel end

"""
    nbos(model::Abstract DEAModel)
Return number of observations of a DEA model.
"""
nobs(model::AbstractDEAModel) = model.n

"""
    ninputs(model::AbstractDEAModel)
Return number of inputs of a DEA model.
"""
ninputs(model::AbstractDEAModel) = model.m

"""
    noutputs(model::AbstractDEAModel)
Return number of outputs of a DEA model.
"""
noutputs(model::AbstractDEAModel) = model.s

"""
    names(model::AbstractDEAModel)
Return the names of the decision making units (DMUs)
"""
function Base.names(model::AbstractDEAModel)

    xnobs = nobs(model)

    if isdefined(model, :dmunames)

        if model.dmunames === nothing
            # If model have no names, return numeric sequence
            retnames = ["$i" for i in 1:xnobs]
        else
            xnameslength = length(model.dmunames)

            if xnameslength == xnobs
                retnames = model.dmunames
            elseif xnameslength < xnobs
                # If length of names is lower than number of observations, append numbers to match
                @warn("Length of names lower than number of observations")
                retnames = [model.dmunames; ["$i" for i in (xnameslength + 1):xnobs]]
            elseif xnameslength > xnobs
                # If length of names is greater than number of observations, split
                @warn("Length of names greater than number of observations")
                retnames = model.dmunames[1:xnobs]
            end
        end
    else
        # Return numeric sequence
        retnames = ["$i" for i in 1:xnobs]
    end

    return retnames
end

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API