Need Explaination of simple matrix code?!?!?! Thx

Can someone plz explain this simple code to me!?!? im a noob.
I know that this code cycles through all the rows & columns of the given
matrix, but i get completely lost at this part:
s[row][col] = m[row + theRow][col + theCol] ;
Regards,
Slvr99
this code takes a matrix of integers M, and a
row and column index, and returns a new matrix that is the lower
right sub-matrix of M formed from that position. The header
of the method is as follows:
public static int[][] submatrix( int[][] m, int theRow, int theCol )
int[][] s; // RESULT: the submatrix of matrix m
int sRows; // INTERMEDIATE : number of rows in s
int sCols; // INTERMEDIATE : number of columns in s
int row; // INTERMEDIATE: index for row position in s
int col; // INTERMEDIATE: index for column position in s
sRows = m.length - theRow;
sCols = m[0].length - theCol;
s = new int[sRows][sCols];
for ( row = 0; row < sRows; row = row + 1 )
for ( col = 0; col < sCols; col = col + 1 )
s[row][col] = m[row + theRow][col + theCol] ;
return s;
}

It copies all the values as if [theRow, theCol] were one corner of the origin of matrix.
I suggest you try running this in a debugger and then you can see what it does line by line.

Similar Messages

  • Need Help With Simple ABAP Code

    Hello,
    I'm loading data from a DSO (ZDTBMAJ) to an Infocube (ZCBRAD06). I need help with ABAP code to some of the logic in Start Routine. DSO has 2 fields: ZOCTDLINX & ZOCBRDMAJ.
    1. Need to populate ZOCPRODCD & ZOCREFNUM fields in Infocube:
        Logic:-
        Lookup /BI0/PMATERIAL, if /BIC/ZOCBRDMAJ = /BIC/OIZOCBRDMAJ
        then /BIC/ZOCPRODCD = ZOCPRODCD in Infocube
               /BIC/ZOCREFNUM = ZOCREFNUM in Infocube         
    2. Need to populate 0G_CWWTER field in Infocube:
        Logic:
        Lookup /BIC/PZOCTDLINX, if /BIC/ZOCTDLINX = BIC/OIZOCTDLINX
        then G_CWWTER = 0G_CWWTER in Infocube.
    I would need to read single row at a time.
    Thanks!

    I resolved it.

  • Flash Matrix Code Tutorial Help Needed

    Please could someone help me out with this Flash problem, I would really appreciate it.
    I have followed the guide at this link to create a matrix code effect. The matrix code font file is available to download from this site also (mCode15).
    Once I get this file up and running and understand how it works, I'm going to tweak it somewhat to suit my needs.
    I am, however, experiencing some problems getting it to work as described in the tutorial. I have followed the tutorial to the letter, but when the flash movie file runs, only the glyph symbol that I used to create the_one and one_pod movie symbols is displayed in the code that scrolls down screen. I have embedded the font the way it describes and even added it to the library and set it to export for actionscript using the linkage option. But the matrix code that rains down is still only one symbol which never changes.
    Please please help me out with this as I'm slowly losing my sanity trying to figure it out. I am using Flash CS3 on a PC to do this and the file is set up up as action script 2.0.

    hi
    try asking in the AS2 forum; they will be better placed to help you - and post some of your code too rather than a link (you cant expect us to do all the work for you )

  • Matrix Code Tutorial Help Needed - Symbols wont change

    Please could someone help me out with this Flash problem, I would really appreciate it.
    I have followed the guide at this link to create a matrix code effect. The matrix code font file is available to download from this site also (mCode15).
    Once I get this file up and running and understand how it works, I'm going to tweak it somewhat to suit my needs.
    I  am, however, experiencing some problems getting it to work as described  in the tutorial. I have followed the tutorial to the letter, but when  the flash movie file runs, only the glyph symbol that I used to create the_one and one_pod movie symbols is displayed in the code that scrolls  down screen. I have embedded the font the way it describes and even  added it to the library and set it to export for actionscript using the  linkage option. But the matrix code that rains down is still only one  symbol which never changes.
    Please please help me out with  this as I'm slowly losing my sanity trying to figure it out. I am using  Flash CS3 on a Windows 7 PC to do this and the file is set up up as action script  2.0.
    Many thanks for any help you can provide.
    The Action Script code from the site is included below, this is pasted into the 1st frame.
    // ---------------------------------------------// The Flash Matrix - www.pixelhivedesign.com// ---------------------------------------------// Initialize variables.maxLines = 25;  // Maximum number of lines at once.
    minScale = 10;  // Minimum scale of a line.
    maxScale = 100; // Maximum scale of a line.
    // Create an empty Movieclip to hold the Matrix.theMatrix = createEmptyMovieClip('MatrixCode',1);curLines = 0; // Keeps track of the current number of lines.
    // ----------------------// Generating the Matrix.// ----------------------theMatrix.onEnterFrame = function(){
    // Check that the current number of lines is less than the maximum allowed.
    if(curLines <= maxLines){
    curLines++;  // Increment the number of lines.
    // Create a new line.codeLine   = this.createEmptyMovieClip('codeLine',curLines); // Generate a random scale for the line.// This simulates lines at different distances.
    var ranScale  = Math.round(Math.random() * (maxScale-minScale)) + minScale;codeLine._xscale = codeLine._yscale = ranScale; // Position the line at a random X location.codeLine._x = Math.random() * Stage.width; // Determine line speed based on the distance.codeLine.speed = (codeLine._xscale)/10; // ---------------------------------------------// Creating a line of multiple pods (characters)// ---------------------------------------------codeLine.myCodes = []; // Array to store individual pods.
    numPods = 0;       // Number of pods.
    while(codeLine._height < Stage.height){
    numPods++;  // Increment the number of pods.
    // Attach a single pod to the line of code.pod = codeLine.attachMovie('one_pod','pod'+numPods,numPods);codeLine.myCodes.push(pod);   // store pod.
    // Position pod above the last one (vertical lines)pod._y -= (pod._height+2) * numPods; // Choose a random Matrix character.// Character Codes for lower case letters are between 96 & 123pod.the_one.Neo.text = chr(Math.round(Math.random() * 27) + 96);} // ----------------------------// Initialize the white pulse.// ----------------------------// Store pod position to start at.codeLine.ind = 0;// Store delay between pulses.codeLine.delay = codeLines.myCodes.length; // ------------------------------------// Animating each line of code.// ------------------------------------codeLine.onEnterFrame = function(){
    // -------------------------------// Vertical animation of the line.// -------------------------------// Every frame make the line move down by it's speed.
    this._y += this.speed; // Check if the line of code has animated off the Stage
    if(this._y - this._height >= Stage.height) {
    // Yes, so allow an additional line to be generated.maxLines++;// Remove this line and free memory.
    this.removeMovieClip();}// ----------------------------// Animating the white pulse.// ----------------------------// Get next pod to affect.
    this.curCode = this.myCodes[this.ind];// If the pod is not currently animating, start its animation.
    if(this.curCode._currentframe == 1) this.curCode.play();// Check if we have reached the end of the line.
    if(this.ind < this.myCodes.length and this.delay != 0){
    // No, then move on to next character.
    this.ind++;// Decrease the delay before next pulse.
    this.delay--;
    } else {
    // Yes, then reset the character position.
    this.ind = 0;// Reset the delay before next pulse.
    this.delay = this.myCodes.length;}}}}

    When you dynamically add content, it has no home on the timeline unless you anchor it in one.  If you were to manually place an empty movieclip on the timeline in the lowest layer and then and then create the matrix stuff in there then you would have it living in the background.
    Try creating such a movieclip, located in the upper left corner of the stage and assign it an instance name of "theMatrix"
    Then remove the following lines from your existing code (which is otherwise creating that mc dynamically)...
    // Create an empty Movieclip to hold the Matrix.theMatrix = createEmptyMovieClip('MatrixCode',1);
    That should be all you need to do.

  • Help with a simple pause-code function

    For a week I've been trying to figure out a simple pause-code
    function fror AS 3.0. I need something that pauses AS code for set
    amounts of time. People have tried to help me on this forum, but
    I've still not been able to make the code work.
    Here is what I have at the moment for pause-code (not
    working):
    var intID;
    intID = setInterval(delay, 3000); //this tells flash to wait
    3 seconds
    function delay(){
    clearInterval(intID);
    _root.gotoAndPlay(1); // or do something else...
    The person who supplied me with this code did not include the
    first line "var intID", but as a new flash user, I wasn't sure how
    else to declare intID. Could someone with some flash experience
    walk me through the steps of creating a pause-code function or add
    to the one I have already provided. When I use the above code in my
    flash document, the pause feature does not work at all. It
    essentially skips over the setInterval and clearInterval functions
    and plays the root clip in delay(). I need code meant for AS 3.0
    and I'm becoming increasingly desperate for a response.
    I hope this is understandable and thank you for taking a
    look,
    Sam

    Hello KGlad,
    Thankyou for that information. I had no idea lol. Could you
    please clarify and explain a little more about using the timer
    class to delay execution of code? Possibly provide an example? I
    would be very grateful.
    Thanks,
    Sam

  • Calling simple Java Code from 11g BPM

    Hi,
    I know this has been round the houses but I cant find a satisfactory solution for my scenario. I would like to call some simple java code from BPM (11.1.1.6). I guess I need to expose it as a service but it seems overkill to be via soap so any advice you can give would be much appreciated. Creating a jar that I can call somehow would be perfect.
    This is my scenario:
    - I am creating a Security POC for BPM
    - The BPM Process is exposed as a web service and authenticated using SAML
    - I am testing by calling the WS from OSB
    - I want to be able to get the WLS Principal and display the username and the roles for the launching user, from within the BPM process
    - This is possible using some simple weblogic client api code shown below
    - So all I want to do is call this code from BPM somehow
    - Anyone point me in the right direction ?
    cheers
    Tony
    subject = Security.getCurrentSubject();
    for(Principal p: subject.getPrincipals()) {
    if(p instanceof WLSGroupImpl) {
    groupList.add(p.getName());
    } else if (p instanceof WLSUser) {
    principal = p.getName();
    }

    The problem to communiate java classes and forms solved !
    i have add my .jar file to $OA_JAVA/oracle/apps/fnd/jar and now i can communicate between forms and java.
    I can create an object, i can get simple message from class, but when i try to create
    ServiceFactory factory = ServiceFactory.newInstance();
    ive got ORA-105100...
    can anybody help ?

  • Need assistance converting some AS2 code to AS3

    Hi,
    I have some simple AS2 code that brings in a MovieClip when
    you click a button. This is currently AS2, and I would rather
    convert it to AS3. I also have some code which closes the MovieClip
    upon button Click.
    The code I am currently using is below:

    addMC is the name of one of the event handler functions, not
    the button(s). the button instance names are: addButton and
    removeButton.
    To have three of them, duplicate what you see and have new
    variables, functions, and button names for all three sets, adjusted
    appropriately.
    I'm pretty sure this isn't over yet, I'm just giving you code
    per your defined scenario, which may have a hole or two in it. Try
    it out and see what you really want to do, then come back when you
    find out things need to be tamed in some way or aren't working as
    you want. There are more complicated ways to deal with a situation
    depending on what you really want, and I'm one who prefers to see
    some work done at your end that shows you've tried something (I'm
    not mean, much, I just have this thing about learning by doing).

  • Can anyone explain in simple terms how to set up icloud when I have 2 identities?

    I use my mac.com id for my calendar and contacts, but have a different ID for store purchases and everything else.  I would like to set up my iCloud with a single ID, but I don't want to lose all my historical calendar and contact data, so I need my iCloud tpo import the data from the Mobile.Me 'mac.com' account.
    Everything I have read is confusing....can anyone explain in simple terms how I sert the iCloud up?  I run a Macbook, a Windows 7 PC and an iphone, and I need them all to syns together.
    Any help appreciated.
    CliffWragg

    Welcome to the Apple Community.
    You can drag all your contacts (all at once) and each calendar from address book and iCal to your desktop as a back up/copy. Once you have set up iCloud using the ID for your apps, books and tunes etc, you can add the contacts and calendars to the new account by clicking on the desktop files, iCloud will sync them to your other devices.

  • Do you need to use Actionscript 3 code in Flash player 9 and above?

    Can anyone tell me if I need to use Actionscript 3 code instead of Actionscript 2 code in the following situation:
    I am running a swf file which is contained in a browser window (all files are contained on a CD and I have a 'trust' file set up to let them play properly).  Up until now, I have been using the following Actionscript 2 code to close the browser window (the Actionscript 2 code is on an 'Exit' button within the swf):
    on (release) {
    getURL("javascript:window.close()");
    This Actionscript 2 code has always worked and still works in Flash player 8 and lower.  However, it does nothing when played using Flash player 9.  Can anyone tell me if Flash player 9 won't recognize Actionscript 2 code?  Is it essential to use ONLY Actionscript 3 code if you are using Flash player 9?
    I am having the same problem when I try to launch another html page containing a swf (popped up from the swf contained in the main html window).  I have the following code on the button to launch the popup html window.  It always worked, but suddenly no longer works with Flash player 9.  Here is the code I am using:
    on (release) {
                getURL("javascript:launchWin2('webpage2.html');");
    I have all the necessary background code to launch 'webpage2.html'.  It works everywhere except in Flash player 9.  Can anyone tell me if it is essential to use Actionscript 3 code ONLY on these buttons in Flash player 9?  I am pretty new to Actionscript 3, so any help with syntax would be appreciated. 
    Please note that I don't want to use the projector.
    Thanks!

    You can use both AS2 and AS3 based applications in both Flash 9 and 10.
    As for the issues you describe - perhaps Flash General Forum is a better bet:
    http://forums.adobe.com/community/flash/flash_general

  • What is a redo log file? can anyone explain in simple terms

    I am confused between redo log file and physical datafile can anyone explain in simple terms
    Thank u
    Regards,
    Vijay

    See Overview of Physical Database Structures

  • My iPad conveys that it is disable, and that I need to connect to iTunes.  When I connect to iTunes I get a message that I need to enter my pass code and open my Ipad, but I don't get the number board to open with a password.  How do I fix this?

    My iPad conveys that it is disabled, and that I need to connect to iTunes.  When I connect to iTunes I get a message that I need to enter my pass code and open my Ipad, but I don't get the scree with the number board to open with a password.  How do I fix this?

    You will need to restore it. The sidebar of your iPad appears on itunes even if you dont enter the passcode. There's the option to restore it. More info:
    iTunes: Backing up, updating, and restoring your iPhone, iPad, or iPod touch software

  • My iPad conveys that it is disabled, and that I need to connect to iTunes.  When I connect to iTunes I get a message that I need to enter my pass code and open my Ipad, but I don't get the screen to open with a password.  How do I fix this?

    My iPad conveys that it is disabled, and that I need to connect to iTunes.  When I connect to iTunes I get a message that I need to enter my pass code and open my Ipad, but I don't get the screen to open with a password.  How do I fix this?

    You will need to restore it. It may not sync, but the iPad's sidebar has to appear you can restore it and it will be as the last time ou synced it to iTunes. For more info:
    iTunes: Backing up, updating, and restoring your iPhone, iPad, or iPod touch software

  • Do we need to put the following code in the web-xml for the project to run

    Hi^^^,
    actually I have created a project in Eclipse WTP and I am running it from remote server. Its giving me 404 error when I tried to run it.
    I know 404 error is generally due to some error in deployment descriptor.
    I am going through this tutorial for creating project in eclipse WTP
    this says that I need to include the following code in web-xml. Please look at the quotes below
    "Web modules in J2EE has a deployment descriptor where you configure the web application and its components. This deployment descriptors is called the web.xml. According to the J2EE specification, it must be located in the WEB-INF folder. web.xml must have definitions for the Servlet and the Servlet URI mapping. Enter the following lines into web.xml:"
    "Listing 2. Deployment Descriptor web.xml"
    <servlet>
    <servlet-name>Snoop Servlet</servlet-name>
    <servlet-class>org.eclipse.wtp.tutorial.SnoopServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Snoop Servlet</servlet-name>
    <url-pattern>/snoop/*</url-pattern>
    </servlet-mapping>
    My question is, it is necessary to include the above lines between <servlet> and </servlet-mapping> in web-xml
    thanks and regards,
    Prashant

    pksingh79 wrote:
    actually I have created a project in Eclipse WTP and I am running it from remote server. Its giving me 404 error when I tried to run it.
    I know 404 error is generally due to some error in deployment descriptor. what's the url you've put.
    <servlet>
    <servlet-name>Snoop Servlet</servlet-name>
    <servlet-class>org.eclipse.wtp.tutorial.SnoopServlet</servlet-class>
    </servlet> Every Servlet has to have a <servlet></Servlet> tag in the web.xml
    the <servlet-name>is for the naming the servlet and the <servlet-calss>is for class file of the servlet in your case the .class file is to be in the package of tutorial,if it's not then how the container will no where the calss file is
    <servlet-mapping>
    <servlet-name>Snoop Servlet</servlet-name>
    <url-pattern>/snoop/*</url-pattern>
    </servlet-mapping>You type something in your url likk http://localhost:8080/webappname (Tomcat server),so for url mapping instead of typing the entire class file name ,you just enough have to type what you've put in the <url-mapping> tag and it has to be inside of <servlet-mapping>
    I think the problem is in <url-pattern> change it like /snoop<url-pattern>
    My question is, it is necessary to include the above lines between <servlet> and ></servlet->mapping> in web.xmlSo now you think whether you need something inside <servlet>and </servlet-mapping>

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • I need help getting new authorization codes for digital copies

    I need help getting new authorization codes for digital copies of movies. Can someone help me out?

    There's a lot of results in Google when you search for this but unfortunately refreshing the page doesn't seem to generate a different code anymore. Mine also says already redeemed

Maybe you are looking for

  • Windows Vista and Flash Media Server Streaming Problems

    My company recently started using Flash Media Server to stream audio and video content. My boss just installed Windows Vista Ultimate and now no streaming content will play at all. Simple Flash animations work, but nothing that accesses the Flash Med

  • Issue with Output designer and  Konica bizhub Pro 920 Driver:

    Hi, i would appreciate if someone could help me with the following issue: I have designed a document using Adobe Output Designer and need to print it on Konica printer which uses above driver. Konica is not included in Adobe Presentment Target List s

  • Change customer for PS project

    Hi, I am a PS user. I have a customer wrongly assigned to a project. Can I have this changed? Please advice on the steps in details.

  • [svn:cairngorm3:] 18107: cairngorm3-3.0.16 release for flex3 and flex4

    Revision: 18107 Revision: 18107 Author:   [email protected] Date:     2010-10-08 14:01:31 -0700 (Fri, 08 Oct 2010) Log Message: cairngorm3-3.0.16 release for flex3 and flex4 3.0.16 in flex 4 is Reactor Summary:

  • Working Off Server at work

    I have a new iMac running 10.6.2. Working directly off of a Server at work. Sometimes accessing the files or opening, there is a long delay. Usually better after returning to same location(per session) but not always... When I was running 10.4.11 on