encyclopegia.org

Rank (computer programming)

In computer programming, rank with no further specifications is usually a synonym for (or refers to) "number of dimensions"; thus, a two-dimensional array has rank two, a three-dimensional array has rank three and so on. Strictly, no formal definition can be provided which applies to every programming language, since each of them has its own concepts, semantics and terminology; the term may not even be applicable or, to the contrary, applied with a very specific meaning in the context of a given language. In the case of APL the notion applies to every operand; and dyads ("binary functions") have a left rank and a right rank. The box below instead shows how rank of a type and rank of an array expression could be defined (in a semi-formal style) for C++ and illustrates a simple way to calculate them at compile time.…

In computer programming, rank with no further specifications is usually a synonym for (or refers to) "number of dimensions"; thus, a two-dimensional array has rank two, a three-dimensional array has rank three and so on. Strictly, no formal definition can be provided which applies to every programming language, since each of them has its own concepts, semantics and terminology; the term may not even be applicable or, to the contrary, applied with a very specific meaning in the context of a given language. In the case of APL the notion applies to every operand; and dyads ("binary functions") have a left rank and a right rank. The box below instead shows how rank of a type and rank of an array expression could be defined (in a semi-formal style) for C++ and illustrates a simple way to calculate them at compile time. include include /* Rank of a type * ------------- * * Let the rank of a type T be the number of its dimensions if * it is an array; zero otherwise (which is the usual convention) */ template struct rank { static const std::size_t value = 0; }; template struct rank { static const std::size_t value = 1 + rank ::value; }; template constexpr auto rank_v = rank ::value; /* Rank of an expression * * Let the rank of an expression be the rank of its type */ template using unqualified_t = std::remove_cv_t >; template auto rankof(T&& expr) { return rank_v >; } Given the code above the rank of a type T can be calculated at compile time by rank ::value or the shorter form rank_v Calculating the rank of an expression can be done using rankof(expr) ==See also== Rank (linear algebra), for a definition of rank as applied to matrices Rank (J programming language), a concept of the same name in the J programming language

References

  1. Vocabulary_with_defintions · retrieved 2026-11-18 · rev 1274076977
    Cite this reference

    MLA "Vocabulary_with_defintions." 2026-11-18. https://files.schudio.com/federation-of-boldmere-schools/files/documents/Vocabulary_with_defintions.docx. Accessed 24 November 2026.

    Chicago "Vocabulary_with_defintions." 2026-11-18. https://files.schudio.com/federation-of-boldmere-schools/files/documents/Vocabulary_with_defintions.docx.

    APA encyclopegia.org. (2026). Vocabulary_with_defintions. Retrieved November 24, 2026, from https://files.schudio.com/federation-of-boldmere-schools/files/documents/Vocabulary_with_defintions.docx

Cite this article

MLA

"Rank (computer programming)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/rank-computer-programming. Accessed 24 November 2026.

Chicago

"Rank (computer programming)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/rank-computer-programming.

APA

encyclopegia.org. (2025). Rank (computer programming). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/rank-computer-programming

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

computer

stub · references available

computer mouse

stub · references available

Category:Programming languages

stub · references available

IBM Personal Computer XT

stub · references available

rank of a group

stub · references available

chemical computer

stub · references available

computer worm

stub · references available

programming paradigm

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1274076977 · 0.5 · snapshot enwiki-001274076977

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.