accessing-pieces-arrays/quickref.tex
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 13 Oct 2010 11:13:46 +0530
changeset 314 11869b16d86b
parent 285 7c4855fb8e5f
permissions -rw-r--r--
Getting started with sagenotebook LO - script and questions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
285
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     1
\textbf{Accessing parts of arrays}
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     2
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     3
\lstinline|C[i-1, j-1]| to access element i, j in C (mxn).
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     4
\lstinline|C[i-1]| to access i^{th} row
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     5
\lstinline|C[:, j-1]| to access j^{th} column
217
b595f90016c5 Changed structure of my scripts.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
285
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     7
Assigning to accessed elements, changes them. 
217
b595f90016c5 Changed structure of my scripts.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
285
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     9
\lstinline|A[m:n:o]| accesses the rows from \lstinline|m|
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    10
to \lstinline|n| (excluded) in steps of \lstinline|o|
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    11
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    12
Similarly, \lstinline|C[m:n:o, p:q:r]|