跳蚤长什么样| 数农是什么| 容易长痣是什么原因| 低血钾是什么原因引起的| 离异什么意思| 各什么己| 眼皮肿什么原因引起的| 语什么心什么| 支架后吃什么药| 冠冕堂皇什么意思| 右脸麻木是什么原因| 有朝一日是什么生肖| 天花是什么病| 线性是什么意思| 肌酐什么意思| 舌苔白厚腻吃什么药| 老实的动物是什么生肖| 水的ph值是什么意思| 什么蔬菜是温性的| 头七有什么讲究| 天台是什么意思| 下嘴唇跳动是什么原因| 尿道感染吃什么药好| 智齿疼吃什么药最管用| hbv病毒是什么意思| 孕妇羊水少吃什么补的快| 39年属什么生肖| 鱼在鱼缸底部不动为什么| 只吐不拉是什么原因| 实蛋是什么| 倒打一耙的前一句是什么| 记忆是什么意思| 肾虚有什么症状| 男生做爱什么感觉| 一身傲骨是什么意思| 舌头白苔厚是什么原因| 为什么会流鼻血什么原因引起的| 七月十日是什么日子| 福利姬什么意思| 口苦口干是什么原因引起的| 5月28日什么星座| 脖子发麻是什么原因| 叶酸什么时间吃最好| 相形见拙什么意思| 过敏性结膜炎用什么药| 备皮是什么意思| 韭菜什么时候种最合适| 朔字五行属什么| 哪吒是一个什么样的人| 乳酸菌是什么菌| 上嘴唇长痘痘是什么原因| 送哥们什么礼物好| 疖肿什么意思| 很容易饿是什么原因| 天秤女喜欢什么样的男生| ds是什么意思| 梅毒螺旋体抗体阳性是什么意思| 桃胶和什么相克| 吃地瓜叶有什么好处和坏处| 检查幽门螺旋杆菌挂什么科| pct偏高说明什么| 鼻子干痒是什么原因| 万人空巷是什么意思| 右手大拇指抖动是什么原因| 南瓜和什么相克| 升白细胞的针剂叫什么| 新生儿足底采血检查什么项目| 箬叶和粽叶有什么区别| 补血吃什么药最快最好| 8月11号是什么星座| 指甲盖凹陷是什么原因| 紫花地丁有什么功效| sle是什么病的缩写| 马后面是什么生肖| 睡觉时间长是什么原因| 澳大利亚人说什么语言| 四大才子是什么生肖| 院感是什么意思| 双下肢水肿是什么原因| dmd是什么病| 知趣是什么意思| 什么微风| 男士内裤什么材质的好| 耳朵听不清楚是什么原因| 奶粉结块是什么原因| 心情沉重是什么意思| 田螺的血是什么颜色| dunhill是什么品牌| 行尸走肉什么意思| 高血压会引起什么并发症| 情商高是什么意思| 72年属鼠是什么命| 数字是什么意思| g点是什么| 高血糖主食吃什么好| 黑色代表什么| 黄褐斑是什么引起的| 金钱草有什么功效| 农村合作医疗什么时候交| 什么花适合室内养| 书房字画写什么内容好| 肝脑涂地是什么意思| 黑松露什么味道| 牙疼有什么好办法| 2333是什么意思| 迷茫什么意思| 今天生猪什么价| 请佛像回家有什么讲究| 吃什么主食减肥最快| 大便是红色的是什么原因| 身体皮肤痒是什么原因| 膝盖疼痛挂什么科| 9月24号什么星座| 代言人是什么意思| 莫言是什么意思| 角的大小与什么有关与什么无关| 先天性巨结肠有什么症状| 什么叫有氧运动和无氧运动| 狗狗打疫苗前后要注意什么| 乙型肝炎e抗体阳性是什么意思| 什么生肖站着睡觉| 阳性血是什么意思| iga肾病是什么病| alk是什么意思| 用苦良心是什么意思| 2月15是什么星座| 孤独症有什么表现| 考验是什么意思| 九月十三号是什么星座| 过敏性咳嗽有什么症状| 细菌性结膜炎用什么眼药水| 尿路感染不能吃什么东西| 吃什么排宿便清肠彻底| 头顶痛是什么原因| 实操是什么意思| 人打嗝是什么原因| 硬汉是什么意思| 胸痛什么原因| 云南古代叫什么| ysl属于什么档次| 渗液是什么意思| 12月13日是什么日子| 毛骨悚然是什么意思| 陈皮泡水喝有什么功效| 植物光合作用产生什么| 巨婴是什么意思| 头骨凹陷是什么原因| 做胃镜前要注意什么| 为什么医生说直肠炎不用吃药| 孕妇吃葡萄对胎儿有什么好处| 半身不遂的前兆是什么症状| 突然血糖高是什么原因引起的| 便秘吃什么最快排便| 三板斧是什么意思| 蚂蚁喜欢吃什么| 水痘不能吃什么| 押韵是什么意思| 喝玉米水有什么好处| 数字2代表什么意思| 6月25什么星座| romantic什么意思| 何首乌泡酒有什么作用| 长期打嗝是什么原因| 精字五行属什么| 什么茶减肥效果好| 肩周炎是什么引起的| 咲念什么| 二月初四是什么星座| 舌头有裂纹是什么原因| 宇字属于五行属什么| 总钙是什么意思| 洗耳恭听是什么意思| 安乃近又叫什么名| ggdb是什么牌子| 妙手回春是什么意思| 四月初四是什么节日| 左眼皮一直跳什么原因| 生理是什么意思| 阿司匹林不能和什么药一起吃| 双鱼座的幸运石是什么| 香菜什么时候种植最好| 不排卵是什么原因造成| 朋友圈提到了我是什么意思| 1968年猴是什么命| 吃什么可以养肝| 南什么北什么| 处女膜破了什么症状| 母亲节一般送什么礼物| pep是什么意思| 纸老虎是什么意思| 用什么香皂洗脸可以祛痘| 收缩压偏高是什么意思| 脉细是什么意思| 索条影是什么意思| 高级别上皮内瘤变是什么意思| plein是什么牌子| 流鼻涕打喷嚏吃什么药| 老是胃疼是什么原因| 属鸡的是什么星座| 银五行属性是什么| 尿素氮偏高是什么意思| 农历四月是什么月| 一直放屁什么原因| 大芒果是什么品种| 么么什么意思| 大拇指抖动是什么原因引起的| 酸梅汤不适合什么人喝| 人参果长什么样| 湿疹用什么药膏| 八四年属什么生肖| 11.28什么星座| 外阴瘙痒用什么药膏擦| 为什么耳鸣一直不停| 手一直抖是什么原因| hpv51阳性是什么意思| 佛心是什么意思| 宫外孕什么症状| 红色加绿色等于什么颜色| 蹲久了站起来头晕是什么原因| 性激素是查什么| 什么东西越热越爱出来| 慢性胰腺炎吃什么药效果最好| 长一智的上一句是什么| 莲雾是什么水果| 用劲的近义词是什么| 怀孕初期吃什么| 孕妇能吃什么水果| 女生补气血吃什么好| 胎儿左心室灶状强回声是什么意思| 一什么瓦| 2016年属猴是什么命| 羊内腰和外腰分别是什么| 尔时是什么意思| 板蓝根长什么样| 推迟月经吃什么药| 抽动症是什么原因造成的| 上传下达什么意思| 什么条件| 孕妇手肿是什么原因| 股票pb是什么意思| 公积金取出来有什么影响| 哥弟属于什么档次| 斯文败类是什么意思| 莫西沙星片主治什么病| 舌头有齿痕是什么原因| 一直呕吐是什么原因| 自主意识是什么意思| 睾丸扭转有什么症状| 白细胞30是什么意思| ih医学上是什么意思| 金骏眉茶是什么茶| 衣服38码相当于什么码| 尿酸高注意什么| 老放屁吃什么药| 黑枸杞泡水喝有什么作用和功效| 饷是什么意思| 鼻子长痘是什么原因| 人参适合什么人吃| 宫缩是什么感觉| 荨麻疹吃什么药管用| 12生肖为什么没有猫| 郡肝是什么部位| 指甲硬是什么原因| 乳糖不耐受是什么意思| 百度Jump to content

住建部确定2018年安全生产工作五大要点

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Meno25 (talk | contribs) at 08:58, 12 June 2023 (update link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
百度 恒大农牧在整合从田头到餐桌的全产业链优势同时,还不断加强从产地源头到包装物流的全过程品控管理,率先在业内应用一瓶一码、一袋一码一罐一码二维码溯源技术,建立全产品质量追溯体系,确保每一款食品的高品质。

In computer science, array is a data type that represents a collection of elements (values or variables), each selected by one or more indices (identifying keys) that can be computed at run time during program execution. Such a collection is usually called an array variable or array value.[1] By analogy with the mathematical concepts vector and matrix, array types with one and two indices are often called vector type and matrix type, respectively. More generally, a multidimensional array type can be called a tensor type, by analogy with the physical concept, tensor.[2]

Language support for array types may include certain built-in array data types, some syntactic constructions (array type constructors) that the programmer may use to define such types and declare array variables, and special notation for indexing array elements.[1] For example, in the Pascal programming language, the declaration type MyTable = array [1..4,1..2] of integer, defines a new array data type called MyTable. The declaration var A: MyTable then defines a variable A of that type, which is an aggregate of eight elements, each being an integer variable identified by two indices. In the Pascal program, those elements are denoted A[1,1], A[1,2], A[2,1], …, A[4,2].[3] Special array types are often defined by the language's standard libraries.

Dynamic lists are also more common and easier to implement[dubiousdiscuss] than dynamic arrays. Array types are distinguished from record types mainly because they allow the element indices to be computed at run time, as in the Pascal assignment A[I,J] := A[N-I,2*J]. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array variable.

In more theoretical contexts, especially in type theory and in the description of abstract algorithms, the terms "array" and "array type" sometimes refer to an abstract data type (ADT) also called abstract array or may refer to an associative array, a mathematical model with the basic operations and behavior of a typical array type in most languages — basically, a collection of elements that are selected by indices computed at run-time.

Depending on the language, array types may overlap (or be identified with) other data types that describe aggregates of values, such as lists and strings. Array types are often implemented by array data structures, but sometimes by other means, such as hash tables, linked lists, or search trees.

History

Heinz Rutishauser's programming language Superplan (1949–1951) included multi-dimensional arrays. Rutishauser however although describing how a compiler for his language should be built, did not implement one.

Assembly languages and low-level languages like BCPL[4] generally have no syntactic support for arrays.

Because of the importance of array structures for efficient computation, the earliest high-level programming languages, including FORTRAN (1957), COBOL (1960), and Algol 60 (1960), provided support for multi-dimensional arrays.

Abstract arrays

An array data structure can be mathematically modeled as an abstract data structure (an abstract array) with two operations

get(A, I): the data stored in the element of the array A whose indices are the integer tuple I.
set(A,I,V): the array that results by setting the value of that element to V.

These operations are required to satisfy the axioms[5]

get(set(A,I, V), I) = V
get(set(A,I, V), J) = get(A, J) if I ≠ J

for any array state A, any value V, and any tuples I, J for which the operations are defined.

The first axiom means that each element behaves like a variable. The second axiom means that elements with distinct indices behave as disjoint variables, so that storing a value in one element does not affect the value of any other element.

These axioms do not place any constraints on the set of valid index tuples I, therefore this abstract model can be used for triangular matrices and other oddly-shaped arrays.

Implementations

In order to effectively implement variables of such types as array structures (with indexing done by pointer arithmetic), many languages restrict the indices to integer data types (or other types that can be interpreted as integers, such as bytes and enumerated types), and require that all elements have the same data type and storage size. Most of those languages also restrict each index to a finite interval of integers, that remains fixed throughout the lifetime of the array variable. In some compiled languages, in fact, the index ranges may have to be known at compile time.

On the other hand, some programming languages provide more liberal array types, that allow indexing by arbitrary values, such as floating-point numbers, strings, objects, references, etc.. Such index values cannot be restricted to an interval, much less a fixed interval. So, these languages usually allow arbitrary new elements to be created at any time. This choice precludes the implementation of array types as array data structures. That is, those languages use array-like syntax to implement a more general associative array semantics, and must therefore be implemented by a hash table or some other search data structure.

Language support

Multi-dimensional arrays

The number of indices needed to specify an element is called the dimension, dimensionality, or rank of the array type. (This nomenclature conflicts with the concept of dimension in linear algebra, which expresses the shape of a matrix. Thus, an array of numbers with 5 rows and 4 columns, hence 20 elements, is said to have dimension 2 in computing contexts, but represents a matrix that is said to be 4×5-dimensional. Also, the computer science meaning of "rank" conflicts with the notion of tensor rank, which is a generalization of the linear algebra concept of rank of a matrix.)

A two-dimensional array stored as a one-dimensional array of one-dimensional arrays (rows).
A two-dimensional array stored as a one-dimensional array of one-dimensional arrays (rows).

Many languages support only one-dimensional arrays. In those languages, a multi-dimensional array is typically represented by an Iliffe vector, a one-dimensional array of references to arrays of one dimension less. A two-dimensional array, in particular, would be implemented as a vector of pointers to its rows. Thus an element in row i and column j of an array A would be accessed by double indexing (A[i][j] in typical notation). This way of emulating multi-dimensional arrays allows the creation of jagged arrays, where each row may have a different size — or, in general, where the valid range of each index depends on the values of all preceding indices.

This representation for multi-dimensional arrays is quite prevalent in C and C++ software. However, C and C++ will use a linear indexing formula for multi-dimensional arrays that are declared with compile time constant size, e.g. by int A[10][20] or int A[m][n], instead of the traditional int **A.[6]

Indexing notation

Most programming languages that support arrays support the store and select operations, and have special syntax for indexing. Early languages used parentheses, e.g. A(i,j), as in FORTRAN; others choose square brackets, e.g. A[i,j] or A[i][j], as in Algol 60 and Pascal (to distinguish from the use of parentheses for function calls).

Index types

Array data types are most often implemented as array structures: with the indices restricted to integer (or totally ordered) values, index ranges fixed at array creation time, and multilinear element addressing. This was the case in most "third generation" languages, and is still the case of most systems programming languages such as Ada, C, and C++. In some languages, however, array data types have the semantics of associative arrays, with indices of arbitrary type and dynamic element creation. This is the case in some scripting languages such as Awk and Lua, and of some array types provided by standard C++ libraries.

Bounds checking

Some languages (like Pascal and Modula) perform bounds checking on every access, raising an exception or aborting the program when any index is out of its valid range. Compilers may allow these checks to be turned off to trade safety for speed. Other languages (like FORTRAN and C) trust the programmer and perform no checks. Good compilers may also analyze the program to determine the range of possible values that the index may have, and this analysis may lead to bounds-checking elimination.

Index origin

Some languages, such as C, provide only zero-based array types, for which the minimum valid value for any index is 0. This choice is convenient for array implementation and address computations. With a language such as C, a pointer to the interior of any array can be defined that will symbolically act as a pseudo-array that accommodates negative indices. This works only because C does not check an index against bounds when used.

Other languages provide only one-based array types, where each index starts at 1; this is the traditional convention in mathematics for matrices and mathematical sequences. A few languages, such as Pascal and Lua, support n-based array types, whose minimum legal indices are chosen by the programmer. The relative merits of each choice have been the subject of heated debate. Zero-based indexing can avoid off-by-one or fencepost errors,[7] specifically a 0-based for (i = 0; i < 5; i += 1) iterates (5-0) times, whereas in the equivalent 1-based half-open range for (i = 1; i < 6; i += 1) the 6 is itself a potential such error, typically requiring length() + 1, and the 1-based inclusive range for (i = 1; i <= 5; i+= 1) iterates (5-1)+1 times.

Highest index

The relation between numbers appearing in an array declaration and the index of that array's last element also varies by language. In many languages (such as C), one should specify the number of elements contained in the array; whereas in others (such as Pascal and Visual Basic .NET) one should specify the numeric value of the index of the last element. Needless to say, this distinction is immaterial in languages where the indices start at 1, such as Lua.

Array algebra

Some programming languages support array programming, where operations and functions defined for certain data types are implicitly extended to arrays of elements of those types. Thus one can write A+B to add corresponding elements of two arrays A and B. Usually these languages provide both the element-by-element multiplication and the standard matrix product of linear algebra, and which of these is represented by the * operator varies by language.

Languages providing array programming capabilities have proliferated since the innovations in this area of APL. These are core capabilities of domain-specific languages such as GAUSS, IDL, Matlab, and Mathematica. They are a core facility in newer languages, such as Julia and recent versions of Fortran. These capabilities are also provided via standard extension libraries for other general purpose programming languages (such as the widely used NumPy library for Python).

String types and arrays

Many languages provide a built-in string data type, with specialized notation ("string literals") to build values of that type. In some languages (such as C), a string is just an array of characters, or is handled in much the same way. Other languages, like Pascal, may provide vastly different operations for strings and arrays.

Array index range queries

Some programming languages provide operations that return the size (number of elements) of a vector, or, more generally, range of each index of an array. In C and C++ arrays do not support the size function, so programmers often have to declare separate variable to hold the size, and pass it to procedures as a separate parameter.

Elements of a newly created array may have undefined values (as in C), or may be defined to have a specific "default" value such as 0 or a null pointer (as in Java).

In C++ a std::vector object supports the store, select, and append operations with the performance characteristics discussed above. Vectors can be queried for their size and can be resized. Slower operations like inserting an element in the middle are also supported.

Slicing

An array slicing operation takes a subset of the elements of an array-typed entity (value or variable) and then assembles them as another array-typed entity, possibly with other indices. If array types are implemented as array structures, many useful slicing operations (such as selecting a sub-array, swapping indices, or reversing the direction of the indices) can be performed very efficiently by manipulating the dope vector of the structure. The possible slicings depend on the implementation details: for example, FORTRAN allows slicing off one column of a matrix variable, but not a row, and treat it as a vector; whereas C allow slicing off a row from a matrix, but not a column.

On the other hand, other slicing operations are possible when array types are implemented in other ways.

Resizing

Some languages allow dynamic arrays (also called resizable, growable, or extensible): array variables whose index ranges may be expanded at any time after creation, without changing the values of its current elements.

For one-dimensional arrays, this facility may be provided as an operation "append(A,x)" that increases the size of the array A by one and then sets the value of the last element to x. Other array types (such as Pascal strings) provide a concatenation operator, which can be used together with slicing to achieve that effect and more. In some languages, assigning a value to an element of an array automatically extends the array, if necessary, to include that element. In other array types, a slice can be replaced by an array of different size, with subsequent elements being renumbered accordingly — as in Python's list assignment "A[5:5] = [10,20,30]", that inserts three new elements (10,20, and 30) before element "A[5]". Resizable arrays are conceptually similar to lists, and the two concepts are synonymous in some languages.

An extensible array can be implemented as a fixed-size array, with a counter that records how many elements are actually in use. The append operation merely increments the counter; until the whole array is used, when the append operation may be defined to fail. This is an implementation of a dynamic array with a fixed capacity, as in the string type of Pascal. Alternatively, the append operation may re-allocate the underlying array with a larger size, and copy the old elements to the new area.

See also

References

  1. ^ a b Robert W. Sebesta (2001) Concepts of Programming Languages. Addison-Wesley. 4th edition (1998), 5th edition (2001), ISBN 9780201385960
  2. ^ "Introduction to Tensors | TensorFlow Core". TensorFlow.
  3. ^ K. Jensen and Niklaus Wirth, PASCAL User Manual and Report. Springer. Paperback edition (2007) 184 pages, ISBN 978-3540069508
  4. ^ John Mitchell, Concepts of Programming Languages. Cambridge University Press.
  5. ^ Lukham, Suzuki (1979), "Verification of array, record, and pointer operations in Pascal". ACM Transactions on Programming Languages and Systems 1 (2), 226–244.
  6. ^ Brian W. Kernighan and Dennis M. Ritchie (1988), The C programming Language. Prentice-Hall, p. 81.
  7. ^ Edsger W. Dijkstra, "Why numbering should start at zero"
检察院是做什么的 胡同是什么意思 水杯用什么材质的好 去取环前需做什么准备 驿是什么意思
剑桥英语和新概念英语有什么区别 叶凡为什么要找荒天帝 夏天摆摊适合卖什么 md是什么意思 胆红素偏高有什么危害
半夜脚抽筋是什么原因 拔智齿当天可以吃什么 肠息肉是什么 洋字五行属什么 艾滋病会有什么症状
皮肤细菌感染用什么药 胎动在肚脐周围是什么胎位 江西庐山产什么茶 04年属猴的是什么命 夏天不出汗是什么原因
peace什么意思bjcbxg.com 掌中宝是什么部位hcv8jop8ns8r.cn 为什么睡不着觉会胡思乱想hcv8jop7ns4r.cn 甲氨蝶呤是什么药hcv8jop8ns0r.cn 泌乳素过高女性会出现什么症状hcv9jop4ns6r.cn
l读什么hcv8jop7ns2r.cn 膝盖疼痛什么原因hcv9jop0ns5r.cn 梦到两条蛇预示着什么ff14chat.com 臆想症是什么意思bjcbxg.com 种植什么好hcv7jop9ns7r.cn
阳虚吃什么好hcv8jop5ns7r.cn 舌头麻木是什么原因引起hcv7jop9ns6r.cn 鹤字五行属什么hcv9jop5ns1r.cn 东倒西歪是什么意思hcv8jop3ns5r.cn r一谷氨酰转移酶高说明什么hcv8jop4ns3r.cn
名字为什么不能叫安然hcv9jop1ns7r.cn 双下肢静脉彩超主要检查什么hcv9jop1ns4r.cn 人心隔肚皮什么意思hcv8jop8ns2r.cn 睾丸隐痛什么原因wzqsfys.com 肠胃感冒什么症状hcv9jop5ns7r.cn
百度