page89.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 46 行
HTML
46 行
<HTML><HEAD><TITLE>Multi-Dimensional Arrays</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html2231" HREF="page90.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html2229" HREF="page81.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html2223" HREF="page88.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html2233" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION004200000000000000000">Multi-Dimensional Arrays</A></H1><A NAME="secfdsmultid"> </A><P>A <em>multi-dimensional array</em><A NAME=2849> </A>of dimension <I>n</I>(i.e., an <I>n</I>-dimensional array or simply <I>n</I>-D array)is a collection of items which is accessed via <I>n</I> subscript expressions.For example, the <IMG WIDTH=43 HEIGHT=28 ALIGN=MIDDLE ALT="tex2html_wrap_inline60455" SRC="img593.gif" > elementof a two-dimensional array <tt>x</tt>is accessed by writing <tt>x[i,j]</tt>.<P>Python does not provide built-in support for multi-dimensional arrays.In this section,we will examine the implementation of a multi-dimensional array class,<tt>MultiDimensionalArray</tt>,that is based on the one-dimensional array class discussedin Section <A HREF="page82.html#secfdsarrays"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<P><BR> <HR><UL> <LI> <A NAME="tex2html2234" HREF="page90.html#SECTION004210000000000000000">Array Subscript Calculations</A><LI> <A NAME="tex2html2235" HREF="page91.html#SECTION004220000000000000000">An Implementation</A><LI> <A NAME="tex2html2236" HREF="page92.html#SECTION004230000000000000000"><tt>MultiDimensionalArray</tt> class <tt>__init__</tt> Method</A><LI> <A NAME="tex2html2237" HREF="page93.html#SECTION004240000000000000000"><tt>MultiDimensionalArray</tt> class <tt>__getitem__</tt> and <tt>__setitem__</tt> Methods</A><LI> <A NAME="tex2html2238" HREF="page94.html#SECTION004250000000000000000">Matrices</A><LI> <A NAME="tex2html2239" HREF="page95.html#SECTION004260000000000000000">Dense Matrices</A><LI> <A NAME="tex2html2240" HREF="page96.html#SECTION004270000000000000000">Canonical Matrix Multiplication</A></UL><HR><A NAME="tex2html2231" HREF="page90.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html2229" HREF="page81.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html2223" HREF="page88.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html2233" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright © 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a> All rights reserved.</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?