HOME

TheInfoList



OR:

In
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
, 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 A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
, since each of them has its own concepts,
semantics Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy Philosophy (f ...
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
dyad Dyad or dyade may refer to: Arts and entertainment * Dyad (music), a set of two notes or pitches * ''Dyad'' (novel), by Michael Brodsky, 1989 * ''Dyad'' (video game), 2012 * ''Dyad 1909'' and ''Dyad 1929'', ballets by Wayne McGregor Other uses ...
s ("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 ; template struct rank ; 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) 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) In linear algebra, the rank of a matrix is the dimension of the vector space generated (or spanned) by its columns. p. 48, § 1.16 This corresponds to the maximal number of linearly independent columns of . This, in turn, is identical to the dime ...
, for a definition of ''rank'' as applied to
matrices Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** ''The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchis ...
*
Rank (J programming language) Rank is a generalization of looping as used in scalar (non-array-oriented) programming languages. It is also a generalization of '' mapcar'' in the language ''Lisp'' and ''map'' in modern functional programming languages, and a generalization of ...
, a concept of the same name in the
J programming language The J programming language, developed in the early 1990s by Kenneth E. Iverson and Roger Hui, is an array programming language based primarily on APL (also by Iverson). To avoid repeating the APL special-character problem, J uses only the basic ...
Arrays Programming language topics {{Compu-lang-stub