Pass by Reference vs. Pass by Value
|
|
- Scarlett Barrett
- 5 years ago
- Views:
Transcription
1 Pass by Reference vs. Pass by Value Most methods are passed arguments when they are called. An argument may be a constant or a varable. For example, n the expresson Math.sqrt(33) the constant 33 s passed to the sqrt() method of the Math class. In the expresson Math.sqrt(x) the varable x s passed. Ths s smple enough, however there s an mportant but smple prncple at work here. If a varable s passed, the method receves a copy of the varable's value. The value of the orgnal varable cannot be changed wthn the method. Ths seems reasonable because the method only has a copy of the value; t does not have access to the orgnal varable. Ths process s called pass by value. However, f the varable passed s an object, then the effect s dfferent. Ths dea s explored n detal n ths secton. But frst, let's clarfy the termnology. For brevty, we often say thngs lke, "ths method returns an object...", or "ths method s passed an object as an argument...". As noted earler, ths not qute true. More precsely, we should say, or ths method returns a reference to an object... ths method s passed a reference to an object as an argument... In fact, objects, per se, are never passed to methods or returned by methods. It s always "a reference to an object" that s passed or returned. The term "varable" also deserves clarfcaton. There are two types of varables n Java: those that hold the value of a prmtve data type and those that hold a reference to an object. A varable that holds a reference to an object s an "object varable" although, agan, the prefx "object" s often dropped for brevty. Returnng to the topc of ths secton, pass by value refers to passng a constant or a varable holdng a prmtve data type to a method, and pass by reference refers to passng an object varable to a method. In both cases a copy of the varable s passed to the method. It s a copy of the "value" for a prmtve data type varable; t s a copy of the "reference" for an object varable. So, a method recevng an object varable as an argument receves a copy of the reference to the orgnal object. Here's the clncher: If the method uses that reference to make changes to the object, then the orgnal object s changed. Ths s reasonable because both the orgnal reference and the copy of the reference "refer to" to same thng the orgnal object. There s one excepton: strngs. Snce Strng objects are mmutable n Java, a method that s passed a reference to a Strng object cannot change the orgnal object. Ths dstncton s also brought out n ths secton. Let's explore pass by reference and pass by value through a demo program (see Fgure 1). As a self test, try to determne the output of ths program on your own before proceedng. If understood the precedng dscusson and f you guessed the correct output, you can confdently skp the rest of ths secton. Java Prmer PassByReference-1 Scott MacKenze
2 1 publc class DemoPassByReference 2 { 3 publc statc vod man(strng[] args) 4 { 5 // declare and ntalze varables and objects 6 nt = ; 7 Strng s = ""; 8 StrngBuffer sb = new StrngBuffer("Hello, world"); 9 10 // prnt varable and objects s and sb 11 System.out.prntln(); // prnt t (1) 12 System.out.prntln(s); // prnt t (2) 13 System.out.prntln(sb); // prnt t (3) 14 System.out.prntln(" "); // attempt to change, s, and sb usng methods 17 Method(); 18 smethod(s); 19 sbmethod(sb); 20 System.out.prntln(" "); // prnt varable and objects s and sb (agan) 23 System.out.prntln(); // prnt t (7) 24 System.out.prntln(s); // prnt t (8) System.out.prntln(sb); // prnt t (9) 26 } publc statc vod Method(nt Test) 29 { 30 Test = 9; // change t 31 System.out.prntln(Test); // prnt t (4) 32 return; 33 } publc statc vod smethod(strng stest) 36 { 37 stest = stest.substrng(8, 11); // change t 38 System.out.prntln(sTest); // prnt t (5) 39 return; 40 } publc statc vod sbmethod(strngbuffer sbtest) 43 { 44 sbtest = sbtest.nsert(7, "Java "); // change t 45 System.out.prntln(sbTest); // prnt t (6) 46 return; 47 } 48 } Ths program generates the followng output: Fgure 1. DemoPassByReference.java Java Prmer PassByReference-2 Scott MacKenze
3 Hello, world fun DemoPassByReference begns by declarng and ntalzng three varables: an nt varable named, a Strng object varable named s, and a StrngBuffer object varable named sb (see lnes 6-8). The three are prnted n lnes Then, each varable s passed as an argument to a method. Wthn each method, the copy of the varable exsts as a local varable. The value of the varable or the value of the object referred to by the varable, n the case of the Strng and StrngBuffer object varables s changed and prnted wthn each method (lnes 31, 38, and 45). The prnt statements are numbered to show the order of prntng. Back n the man() method, the three values are prnted agan (lnes 23-). Have a look at the output and see f t s consstent wth our prevous dscusson. It s. Let's examne the treatment of each of the three types of varables used n DemoPassByReference. We'll begn wth the StrngBuffer objects. The pass-by-reference concept s llustrated by the object varables sb and sbtest. In the man() method, a StrngBuffer object s nstantated and ntalzed wth "Hello, world" and a reference to t s assgned to the StrngBuffer object varable sb (lne 8). The memory assgnments for the object and the object varable are llustrated n Fgure 2a. Ths corresponds to the state of the sb and sbtest varables just after lne 8 n Fgure 1. In lne 19, the sbmethod() method s called wth sb as an argument. The method s defned n lnes Wthn the method, a copy of sb exsts as a local varable named sbtest. The memory assgnments just after the sbmethod() begns executon are shown n Fgure 2b. Note that sb and sbtest refer to the same object. Java Prmer PassByReference-3 Scott MacKenze
4 sb sb Hello, world Hello, world sbtest (a) (b) sb sb sbtest (c) (d) Fgure 2. Memory assgnments for call-by-reference example (StrngBuffer objects) In lne 44, the object s modfed usng the nsert() method of the StrngBuffer class. The method s called through the nstance varable sbtest. The memory assgnments just after lne 44 executes are shown n Fgure 2c. After the sbmethod() fnshes executon, control passes back to the man() method and sbtest ceases to exst. The memory assgnments just after lne 19 n Fgure 1 are shown n Fgure 2d. Note that the orgnal object has changed, and that the orgnal object varable, sb, now refers to the updated object. The scenaro played out above, s a typcal example of pass by reference. It demonstrates that methods can change the objects nstantated n other methods when they pass a reference to the object as an argument. A smlar scenaro could be crafted for objects of any of Java's numerous classes. The StrngBuffer class s a good choce for the example, because StrngBuffer objects are tangble, prntable enttes. Other objects are less tangble (e.g., objects of the Random class); however, the same rules apply. A major excepton s, of course, the Strng class, because Strng objects, once nstantated, cannot change. For completeness, let's walk through the memory assgnments for the Strng objects n the DemoPassByReferernce program. A Strng object s nstantated n lne 7 and a reference to t s assgned to the Strng object varable s. The memory assgnments at ths pont are shown n Fgure 3a. Java Prmer PassByReference-4 Scott MacKenze
5 s s stest (a) (b) s s stest (c) fun (d) fun Fgure 3. Memory assgnments for call-by-reference example (Strng objects) In lne 18 the smethod() s called wth s as an argument. The method s defned n lnes Wthn the method, a copy of s exsts as a local varable named stest. The memory assgnments just after the smethod() begns executon are shown n Fgure 3b. Note that s and stest refer to the same object. At ths pont, there s no dfference n how memory was assgned for the Strng or StrngBuffer objects. However, n lne 37, Java's unque treatment of Strng objects surfaces. The substrng() method of the Strng class s called to extract the strng "fun" from the orgnal strng. The result s the nstantaton of a new Strng object. A reference to the new object s assgned to stest. The memory assgnments just after lne 37 executes are shown n Fgure 3c. After the smethod() fnshes executon, control passes back to the man() method and stest ceases to exst. The memory assgnments just after lne 18 n Fgure 1 are shown n Fgure 3d. Note that the orgnal object dd not change. The Strng object contanng "fun" s now redundant and ts space s eventually reclamed. Fnally, let's examne the memory assgnments for the nteger varables n DemoPassByReference. When an nteger varable s passed as an argument to a method, t s passed by value. In the demo program, an nteger varable named s declared and ntalzed wth n lne 6. The memory assgnment s llustrated n Fgure 4a. (a) (b) Test (c) Test Fgure 4. Memory assgnments for call-by-value example (nt varables) In lne 17, Method() s called wth as an argument. The method s defned n lnes Wthn the method, a copy of exsts as a local varable named Test. The memory 9 (d) Java Prmer PassByReference-5 Scott MacKenze
6 assgnments just after Method() begns executon are shown n Fgure 3b. Note that and Test are dstnct: They are two separate varables that happen to hold the same value. Wthn the Method() method, Test s re-assgned the value 9. The memory assgnments just after lne 30 executes are shown n Fgure 4c. After the Method() fnshes executon, control passes back to the man() method and Test ceases to exst. The memory assgnments just after lne 17 n Fgure 1 are shown n Fgure 4d. Note that the value of the orgnal varable dd not change. Java Prmer PassByReference-6 Scott MacKenze
News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example
Unversty of Brtsh Columba CPSC, Intro to Computaton Jan-Apr Tamara Munzner News Assgnment correctons to ASCIIArtste.java posted defntely read WebCT bboards Arrays Lecture, Tue Feb based on sldes by Kurt
More informationNotes on Organizing Java Code: Packages, Visibility, and Scope
Notes on Organzng Java Code: Packages, Vsblty, and Scope CS 112 Wayne Snyder Java programmng n large measure s a process of defnng enttes (.e., packages, classes, methods, or felds) by name and then usng
More informationComplex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following.
Complex Numbers The last topc n ths secton s not really related to most of what we ve done n ths chapter, although t s somewhat related to the radcals secton as we wll see. We also won t need the materal
More informationCMPS 10 Introduction to Computer Science Lecture Notes
CPS 0 Introducton to Computer Scence Lecture Notes Chapter : Algorthm Desgn How should we present algorthms? Natural languages lke Englsh, Spansh, or French whch are rch n nterpretaton and meanng are not
More informationFor instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1)
Secton 1.2 Subsets and the Boolean operatons on sets If every element of the set A s an element of the set B, we say that A s a subset of B, or that A s contaned n B, or that B contans A, and we wrte A
More informationOutline. CIS 110: Introduction to Computer Programming. Review: Interactive Sum. More Cumulative Algorithms. Interactive Sum Trace (2)
Outlne CIS 110: Introducton to Computer Programmng More on Cumulatve Algorthms Processng Text Tacklng Programmng Problems Lecture 11 Text Processng and More On Desgn ( 4.2-4.3) 10/17/2011 CIS 110 (11fa)
More informationA Taste of Java and Object-Oriented Programming
Introducn Computer Scence Shm Schocken IDC Herzlya Lecture 1-2: Lecture 1-2: A Taste Java Object-Orented Programmng A Taste Java OO programmng, Shm Schocken, IDC Herzlya, www.ntro2cs.com slde 1 Lecture
More informationTerminal Window. 11. Section 7 Exercises Program Memory Exercise 7-1 Swap Values in an Array Working memory Global Memory. 2 nd call 3 rd call
11. Secton 7 Exercses Program Memory Exercse 7-1 Swap Values n an Array Workng memory Global Memory class SwapTlYouDrop publc statc vod man (Strng args[ ]) nt = 0; nt a; a = new nt[] 2, 4, 6, 8, 10, 12
More informationIntro. Iterators. 1. Access
Intro Ths mornng I d lke to talk a lttle bt about s and s. We wll start out wth smlartes and dfferences, then we wll see how to draw them n envronment dagrams, and we wll fnsh wth some examples. Happy
More informationOverview. CSC 2400: Computer Systems. Pointers in C. Pointers - Variables that hold memory addresses - Using pointers to do call-by-reference in C
CSC 2400: Comuter Systems Ponters n C Overvew Ponters - Varables that hold memory addresses - Usng onters to do call-by-reference n C Ponters vs. Arrays - Array names are constant onters Ponters and Strngs
More informationAgenda & Reading. Simple If. Decision-Making Statements. COMPSCI 280 S1C Applications Programming. Programming Fundamentals
Agenda & Readng COMPSCI 8 SC Applcatons Programmng Programmng Fundamentals Control Flow Agenda: Decsonmakng statements: Smple If, Ifelse, nested felse, Select Case s Whle, DoWhle/Untl, For, For Each, Nested
More informationMathematics 256 a course in differential equations for engineering students
Mathematcs 56 a course n dfferental equatons for engneerng students Chapter 5. More effcent methods of numercal soluton Euler s method s qute neffcent. Because the error s essentally proportonal to the
More informationBrave New World Pseudocode Reference
Brave New World Pseudocode Reference Pseudocode s a way to descrbe how to accomplsh tasks usng basc steps lke those a computer mght perform. In ths week s lab, you'll see how a form of pseudocode can be
More informationEsc101 Lecture 1 st April, 2008 Generating Permutation
Esc101 Lecture 1 Aprl, 2008 Generatng Permutaton In ths class we wll look at a problem to wrte a program that takes as nput 1,2,...,N and prnts out all possble permutatons of the numbers 1,2,...,N. For
More informationAnalysis of Continuous Beams in General
Analyss of Contnuous Beams n General Contnuous beams consdered here are prsmatc, rgdly connected to each beam segment and supported at varous ponts along the beam. onts are selected at ponts of support,
More informationCompiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz
Compler Desgn Sprng 2014 Regster Allocaton Sample Exercses and Solutons Prof. Pedro C. Dnz USC / Informaton Scences Insttute 4676 Admralty Way, Sute 1001 Marna del Rey, Calforna 90292 pedro@s.edu Regster
More informationParallelism for Nested Loops with Non-uniform and Flow Dependences
Parallelsm for Nested Loops wth Non-unform and Flow Dependences Sam-Jn Jeong Dept. of Informaton & Communcaton Engneerng, Cheonan Unversty, 5, Anseo-dong, Cheonan, Chungnam, 330-80, Korea. seong@cheonan.ac.kr
More informationsuch that is accepted of states in , where Finite Automata Lecture 2-1: Regular Languages be an FA. A string is the transition function,
* Lecture - Regular Languages S Lecture - Fnte Automata where A fnte automaton s a -tuple s a fnte set called the states s a fnte set called the alphabet s the transton functon s the ntal state s the set
More informationAssembler. Building a Modern Computer From First Principles.
Assembler Buldng a Modern Computer From Frst Prncples www.nand2tetrs.org Elements of Computng Systems, Nsan & Schocken, MIT Press, www.nand2tetrs.org, Chapter 6: Assembler slde Where we are at: Human Thought
More informationAn Optimal Algorithm for Prufer Codes *
J. Software Engneerng & Applcatons, 2009, 2: 111-115 do:10.4236/jsea.2009.22016 Publshed Onlne July 2009 (www.scrp.org/journal/jsea) An Optmal Algorthm for Prufer Codes * Xaodong Wang 1, 2, Le Wang 3,
More informationComputer models of motion: Iterative calculations
Computer models o moton: Iteratve calculatons OBJECTIVES In ths actvty you wll learn how to: Create 3D box objects Update the poston o an object teratvely (repeatedly) to anmate ts moton Update the momentum
More informationLoad Balancing for Hex-Cell Interconnection Network
Int. J. Communcatons, Network and System Scences,,, - Publshed Onlne Aprl n ScRes. http://www.scrp.org/journal/jcns http://dx.do.org/./jcns.. Load Balancng for Hex-Cell Interconnecton Network Saher Manaseer,
More informationFROG and TURTLE: Visual Bridges Between Files and Object-Oriented Data y
FROG and TURTLE: Vsual Brdges Between Fles and Object-Orented Data y Vashnav Anjur Yanns E. Ioannds z Mron Lvny Department of Computer Scences, Unversty of Wsconsn, Madson, WI 53706 fvash,yanns,mrong@cs.wsc.edu
More information9. BASIC programming: Control and Repetition
Am: In ths lesson, you wll learn: H. 9. BASIC programmng: Control and Repetton Scenaro: Moz s showng how some nterestng patterns can be generated usng math. Jyot [after seeng the nterestng graphcs]: Usng
More informationHigh level vs Low Level. What is a Computer Program? What does gcc do for you? Program = Instructions + Data. Basic Computer Organization
What s a Computer Program? Descrpton of algorthms and data structures to acheve a specfc ojectve Could e done n any language, even a natural language lke Englsh Programmng language: A Standard notaton
More informationCS 534: Computer Vision Model Fitting
CS 534: Computer Vson Model Fttng Sprng 004 Ahmed Elgammal Dept of Computer Scence CS 534 Model Fttng - 1 Outlnes Model fttng s mportant Least-squares fttng Maxmum lkelhood estmaton MAP estmaton Robust
More informationMidterms Save the Dates!
Unversty of Brtsh Columba CPSC, Intro to Computaton Alan J. Hu Thnkng About Loops Intro to Arrays (Obect References?) Readngs Ths Week: Ch 6 (Ch 7 n old 2 nd ed). Next Week: Ch 7 (Ch 8 n old 2 nd ed).
More informationAP PHYSICS B 2008 SCORING GUIDELINES
AP PHYSICS B 2008 SCORING GUIDELINES General Notes About 2008 AP Physcs Scorng Gudelnes 1. The solutons contan the most common method of solvng the free-response questons and the allocaton of ponts for
More informationTN348: Openlab Module - Colocalization
TN348: Openlab Module - Colocalzaton Topc The Colocalzaton module provdes the faclty to vsualze and quantfy colocalzaton between pars of mages. The Colocalzaton wndow contans a prevew of the two mages
More informationAssignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.
Farrukh Jabeen Algorthms 51 Assgnment #2 Due Date: June 15, 29. Assgnment # 2 Chapter 3 Dscrete Fourer Transforms Implement the FFT for the DFT. Descrbed n sectons 3.1 and 3.2. Delverables: 1. Concse descrpton
More information6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour
6.854 Advanced Algorthms Petar Maymounkov Problem Set 11 (November 23, 2005) Wth: Benjamn Rossman, Oren Wemann, and Pouya Kheradpour Problem 1. We reduce vertex cover to MAX-SAT wth weghts, such that the
More informationReport on On-line Graph Coloring
2003 Fall Semester Comp 670K Onlne Algorthm Report on LO Yuet Me (00086365) cndylo@ust.hk Abstract Onlne algorthm deals wth data that has no future nformaton. Lots of examples demonstrate that onlne algorthm
More informationPriority queues and heaps Professors Clark F. Olson and Carol Zander
Prorty queues and eaps Professors Clark F. Olson and Carol Zander Prorty queues A common abstract data type (ADT) n computer scence s te prorty queue. As you mgt expect from te name, eac tem n te prorty
More informationCHAPTER 2 DECOMPOSITION OF GRAPHS
CHAPTER DECOMPOSITION OF GRAPHS. INTRODUCTION A graph H s called a Supersubdvson of a graph G f H s obtaned from G by replacng every edge uv of G by a bpartte graph,m (m may vary for each edge by dentfyng
More informationMidterms Save the Dates!
Unversty of Brtsh Columba CPSC, Intro to Computaton Alan J. Hu Readngs Ths Week: Ch 6 (Ch 7 n old 2 nd ed). (Remnder: Readngs are absolutely vtal for learnng ths stuff!) Thnkng About Loops Lecture 9 Some
More informationNachos Project 3. Speaker: Sheng-Wei Cheng 2010/12/16
Nachos Project Speaker: Sheng-We Cheng //6 Agenda Motvaton User Programs n Nachos Related Nachos Code for User Programs Project Assgnment Bonus Submsson Agenda Motvaton User Programs n Nachos Related Nachos
More informationLecture #15 Lecture Notes
Lecture #15 Lecture Notes The ocean water column s very much a 3-D spatal entt and we need to represent that structure n an economcal way to deal wth t n calculatons. We wll dscuss one way to do so, emprcal
More informationThis chapter discusses aspects of heat conduction. The equilibrium heat conduction on a rod. In this chapter, Arrays will be discussed.
1 Heat Flow n a Rod Ths chapter dscusses aspects of heat conducton. The equlbrum heat conducton on a rod. In ths chapter, Arrays wll be dscussed. Arrays provde a mechansm for declarng and accessng several
More informationSetup and Use. Version 3.7 2/1/2014
Verson 3.7 2/1/2014 Setup and Use MaestroSoft, Inc. 1750 112th Avenue NE, Sute A200, Bellevue, WA 98004 425.688.0809 / 800.438.6498 Fax: 425.688.0999 www.maestrosoft.com Contents Text2Bd checklst 3 Preparng
More informationIntroduction to Programming. Lecture 13: Container data structures. Container data structures. Topics for this lecture. A basic issue with containers
1 2 Introducton to Programmng Bertrand Meyer Lecture 13: Contaner data structures Last revsed 1 December 2003 Topcs for ths lecture 3 Contaner data structures 4 Contaners and genercty Contan other objects
More informationAlgorithm To Convert A Decimal To A Fraction
Algorthm To Convert A ecmal To A Fracton by John Kennedy Mathematcs epartment Santa Monca College 1900 Pco Blvd. Santa Monca, CA 90405 jrkennedy6@gmal.com Except for ths comment explanng that t s blank
More informationHarvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6)
Harvard Unversty CS 101 Fall 2005, Shmon Schocken Assembler Elements of Computng Systems 1 Assembler (Ch. 6) Why care about assemblers? Because Assemblers employ some nfty trcks Assemblers are the frst
More informationParallel matrix-vector multiplication
Appendx A Parallel matrx-vector multplcaton The reduced transton matrx of the three-dmensonal cage model for gel electrophoress, descrbed n secton 3.2, becomes excessvely large for polymer lengths more
More informationOutline. CIS 110: Intro to Computer Programming. What Do Our Programs Look Like? The Scanner Object. CIS 110 (11fa) - University of Pennsylvania 1
Outlne CIS 110: Intro to Computer Programmng The Scanner Object Introducng Condtonal Statements Cumulatve Algorthms Lecture 10 Interacton and Condtonals ( 3.3, 4.1-4.2) 10/15/2011 CIS 110 (11fa) - Unversty
More informationA SYSTOLIC APPROACH TO LOOP PARTITIONING AND MAPPING INTO FIXED SIZE DISTRIBUTED MEMORY ARCHITECTURES
A SYSOLIC APPROACH O LOOP PARIIONING AND MAPPING INO FIXED SIZE DISRIBUED MEMORY ARCHIECURES Ioanns Drosts, Nektaros Kozrs, George Papakonstantnou and Panayots sanakas Natonal echncal Unversty of Athens
More information5.1 The ISR: Overvieui. chapter
chapter 5 The LC-3 n Chapter 4, we dscussed the basc components of a computer ts memory, ts processng unt, ncludng the assocated temporary storage (usually a set of regsters), nput and output devces, and
More informationImproving Low Density Parity Check Codes Over the Erasure Channel. The Nelder Mead Downhill Simplex Method. Scott Stransky
Improvng Low Densty Party Check Codes Over the Erasure Channel The Nelder Mead Downhll Smplex Method Scott Stransky Programmng n conjuncton wth: Bors Cukalovc 18.413 Fnal Project Sprng 2004 Page 1 Abstract
More information12/2/2009. Announcements. Parametric / Non-parametric. Case-Based Reasoning. Nearest-Neighbor on Images. Nearest-Neighbor Classification
Introducton to Artfcal Intellgence V22.0472-001 Fall 2009 Lecture 24: Nearest-Neghbors & Support Vector Machnes Rob Fergus Dept of Computer Scence, Courant Insttute, NYU Sldes from Danel Yeung, John DeNero
More informationUNIT 2 : INEQUALITIES AND CONVEX SETS
UNT 2 : NEQUALTES AND CONVEX SETS ' Structure 2. ntroducton Objectves, nequaltes and ther Graphs Convex Sets and ther Geometry Noton of Convex Sets Extreme Ponts of Convex Set Hyper Planes and Half Spaces
More informationCHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar
CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vdyanagar Faculty Name: Am D. Trved Class: SYBCA Subject: US03CBCA03 (Advanced Data & Fle Structure) *UNIT 1 (ARRAYS AND TREES) **INTRODUCTION TO ARRAYS If we want
More informationSupport Vector Machines
/9/207 MIST.6060 Busness Intellgence and Data Mnng What are Support Vector Machnes? Support Vector Machnes Support Vector Machnes (SVMs) are supervsed learnng technques that analyze data and recognze patterns.
More informationAMath 483/583 Lecture 21 May 13, Notes: Notes: Jacobi iteration. Notes: Jacobi with OpenMP coarse grain
AMath 483/583 Lecture 21 May 13, 2011 Today: OpenMP and MPI versons of Jacob teraton Gauss-Sedel and SOR teratve methods Next week: More MPI Debuggng and totalvew GPU computng Read: Class notes and references
More informationCS1100 Introduction to Programming
Factoral (n) Recursve Program fact(n) = n*fact(n-) CS00 Introducton to Programmng Recurson and Sortng Madhu Mutyam Department of Computer Scence and Engneerng Indan Insttute of Technology Madras nt fact
More informationy and the total sum of
Lnear regresson Testng for non-lnearty In analytcal chemstry, lnear regresson s commonly used n the constructon of calbraton functons requred for analytcal technques such as gas chromatography, atomc absorpton
More informationProgramming in Fortran 90 : 2017/2018
Programmng n Fortran 90 : 2017/2018 Programmng n Fortran 90 : 2017/2018 Exercse 1 : Evaluaton of functon dependng on nput Wrte a program who evaluate the functon f (x,y) for any two user specfed values
More informationAssembler. Shimon Schocken. Spring Elements of Computing Systems 1 Assembler (Ch. 6) Compiler. abstract interface.
IDC Herzlya Shmon Schocken Assembler Shmon Schocken Sprng 2005 Elements of Computng Systems 1 Assembler (Ch. 6) Where we are at: Human Thought Abstract desgn Chapters 9, 12 abstract nterface H.L. Language
More informationFinal Exam. CSE Section M, Winter p. 1 of 16. Family Name: Given Name(s): Student Number:
Fna Exam CSE 1020 3.0 Secton M, Wnter 2010 p. 1 o 16 Famy Name: Gven Name(s): Student Numer: Gudenes and Instructons: 1. Ths s a 90-mnute exam. You can use the textook, ut no eectronc ads such as cacuators,
More informationReducing Frame Rate for Object Tracking
Reducng Frame Rate for Object Trackng Pavel Korshunov 1 and We Tsang Oo 2 1 Natonal Unversty of Sngapore, Sngapore 11977, pavelkor@comp.nus.edu.sg 2 Natonal Unversty of Sngapore, Sngapore 11977, oowt@comp.nus.edu.sg
More informationShared Running Buffer Based Proxy Caching of Streaming Sessions
Shared Runnng Buffer Based Proxy Cachng of Streamng Sessons Songqng Chen, Bo Shen, Yong Yan, Sujoy Basu Moble and Meda Systems Laboratory HP Laboratores Palo Alto HPL-23-47 March th, 23* E-mal: sqchen@cs.wm.edu,
More informationBiostatistics 615/815
The E-M Algorthm Bostatstcs 615/815 Lecture 17 Last Lecture: The Smplex Method General method for optmzaton Makes few assumptons about functon Crawls towards mnmum Some recommendatons Multple startng ponts
More informationA New Approach For the Ranking of Fuzzy Sets With Different Heights
New pproach For the ankng of Fuzzy Sets Wth Dfferent Heghts Pushpnder Sngh School of Mathematcs Computer pplcatons Thapar Unversty, Patala-7 00 Inda pushpndersnl@gmalcom STCT ankng of fuzzy sets plays
More informationArray transposition in CUDA shared memory
Array transposton n CUDA shared memory Mke Gles February 19, 2014 Abstract Ths short note s nspred by some code wrtten by Jeremy Appleyard for the transposton of data through shared memory. I had some
More informationMachine Learning: Algorithms and Applications
14/05/1 Machne Learnng: Algorthms and Applcatons Florano Zn Free Unversty of Bozen-Bolzano Faculty of Computer Scence Academc Year 011-01 Lecture 10: 14 May 01 Unsupervsed Learnng cont Sldes courtesy of
More informationA Fast Content-Based Multimedia Retrieval Technique Using Compressed Data
A Fast Content-Based Multmeda Retreval Technque Usng Compressed Data Borko Furht and Pornvt Saksobhavvat NSF Multmeda Laboratory Florda Atlantc Unversty, Boca Raton, Florda 3343 ABSTRACT In ths paper,
More informationRandom Variables and Probability Distributions
Random Varables and Probablty Dstrbutons Some Prelmnary Informaton Scales on Measurement IE231 - Lecture Notes 5 Mar 14, 2017 Nomnal scale: These are categorcal values that has no relatonshp of order or
More informationTsinghua University at TAC 2009: Summarizing Multi-documents by Information Distance
Tsnghua Unversty at TAC 2009: Summarzng Mult-documents by Informaton Dstance Chong Long, Mnle Huang, Xaoyan Zhu State Key Laboratory of Intellgent Technology and Systems, Tsnghua Natonal Laboratory for
More informationEdge Detection in Noisy Images Using the Support Vector Machines
Edge Detecton n Nosy Images Usng the Support Vector Machnes Hlaro Gómez-Moreno, Saturnno Maldonado-Bascón, Francsco López-Ferreras Sgnal Theory and Communcatons Department. Unversty of Alcalá Crta. Madrd-Barcelona
More informationSteps for Computing the Dissimilarity, Entropy, Herfindahl-Hirschman and. Accessibility (Gravity with Competition) Indices
Steps for Computng the Dssmlarty, Entropy, Herfndahl-Hrschman and Accessblty (Gravty wth Competton) Indces I. Dssmlarty Index Measurement: The followng formula can be used to measure the evenness between
More informationECONOMICS 452* -- Stata 12 Tutorial 6. Stata 12 Tutorial 6. TOPIC: Representing Multi-Category Categorical Variables with Dummy Variable Regressors
ECONOMICS 45* -- Stata 1 Tutoral 6 Stata 1 Tutoral 6 TOPIC: Representng Mult-Category Categorcal Varables wth Dummy Varable Regressors DATA: wage1_econ45.dta (a Stata-format dataset) TASKS: Stata 1 Tutoral
More informationSupport Vector Machines
Support Vector Machnes Decson surface s a hyperplane (lne n 2D) n feature space (smlar to the Perceptron) Arguably, the most mportant recent dscovery n machne learnng In a nutshell: map the data to a predetermned
More informationSetup and Use. For events not using AuctionMaestro Pro. Version /7/2013
Verson 3.1.2 2/7/2013 Setup and Use For events not usng AuctonMaestro Pro MaestroSoft, Inc. 1750 112th Avenue NE, Sute A200, Bellevue, WA 98004 425.688.0809 / 800.438.6498 Fax: 425.688.0999 www.maestrosoft.com
More informationRamsey numbers of cubes versus cliques
Ramsey numbers of cubes versus clques Davd Conlon Jacob Fox Choongbum Lee Benny Sudakov Abstract The cube graph Q n s the skeleton of the n-dmensonal cube. It s an n-regular graph on 2 n vertces. The Ramsey
More information3D vector computer graphics
3D vector computer graphcs Paolo Varagnolo: freelance engneer Padova Aprl 2016 Prvate Practce ----------------------------------- 1. Introducton Vector 3D model representaton n computer graphcs requres
More informationParallel Numerics. 1 Preconditioning & Iterative Solvers (From 2016)
Technsche Unverstät München WSe 6/7 Insttut für Informatk Prof. Dr. Thomas Huckle Dpl.-Math. Benjamn Uekermann Parallel Numercs Exercse : Prevous Exam Questons Precondtonng & Iteratve Solvers (From 6)
More informationNGPM -- A NSGA-II Program in Matlab
Verson 1.4 LIN Song Aerospace Structural Dynamcs Research Laboratory College of Astronautcs, Northwestern Polytechncal Unversty, Chna Emal: lsssswc@163.com 2011-07-26 Contents Contents... 1. Introducton...
More informationOutline. Midterm Review. Declaring Variables. Main Variable Data Types. Symbolic Constants. Arithmetic Operators. Midterm Review March 24, 2014
Mdterm Revew March 4, 4 Mdterm Revew Larry Caretto Mechancal Engneerng 9 Numercal Analyss of Engneerng Systems March 4, 4 Outlne VBA and MATLAB codng Varable types Control structures (Loopng and Choce)
More informationON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE
Yordzhev K., Kostadnova H. Інформаційні технології в освіті ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE Yordzhev K., Kostadnova H. Some aspects of programmng educaton
More informationCS240: Programming in C. Lecture 12: Polymorphic Sorting
CS240: Programmng n C ecture 12: Polymorphc Sortng Sortng Gven a collecton of tems and a total order over them, sort the collecton under ths order. Total order: every tem s ordered wth respect to every
More informationSequential search. Building Java Programs Chapter 13. Sequential search. Sequential search
Sequental search Buldng Java Programs Chapter 13 Searchng and Sortng sequental search: Locates a target value n an array/lst by examnng each element from start to fnsh. How many elements wll t need to
More informationOn Some Entertaining Applications of the Concept of Set in Computer Science Course
On Some Entertanng Applcatons of the Concept of Set n Computer Scence Course Krasmr Yordzhev *, Hrstna Kostadnova ** * Assocate Professor Krasmr Yordzhev, Ph.D., Faculty of Mathematcs and Natural Scences,
More informationA Binarization Algorithm specialized on Document Images and Photos
A Bnarzaton Algorthm specalzed on Document mages and Photos Ergna Kavalleratou Dept. of nformaton and Communcaton Systems Engneerng Unversty of the Aegean kavalleratou@aegean.gr Abstract n ths paper, a
More informationMath Homotopy Theory Additional notes
Math 527 - Homotopy Theory Addtonal notes Martn Frankland February 4, 2013 The category Top s not Cartesan closed. problem. In these notes, we explan how to remedy that 1 Compactly generated spaces Ths
More informationA Sub-Critical Deficit Round-Robin Scheduler
A Sub-Crtcal Defct ound-obn Scheduler Anton Kos, Sašo Tomažč Unversty of Ljubljana, Faculty of Electrcal Engneerng, Ljubljana, Slovena E-mal: anton.kos@fe.un-lj.s Abstract - A scheduler s an essental element
More informationThe Codesign Challenge
ECE 4530 Codesgn Challenge Fall 2007 Hardware/Software Codesgn The Codesgn Challenge Objectves In the codesgn challenge, your task s to accelerate a gven software reference mplementaton as fast as possble.
More information$OJRULWKPV. (Feodor F. Dragan) Department of Computer Science Kent State University
$GYDQF $OJRULWKPV (Feodor F. Dragan) Department of Computer Scence Kent State Unversty Advanced Algorthms, Feodor F. Dragan, Kent State Unversty Textbook: Thomas Cormen, Charles Lesterson, Ronald Rvest,
More informationCluster Analysis of Electrical Behavior
Journal of Computer and Communcatons, 205, 3, 88-93 Publshed Onlne May 205 n ScRes. http://www.scrp.org/ournal/cc http://dx.do.org/0.4236/cc.205.350 Cluster Analyss of Electrcal Behavor Ln Lu Ln Lu, School
More informationA Geometric Approach for Multi-Degree Spline
L X, Huang ZJ, Lu Z. A geometrc approach for mult-degree splne. JOURNAL OF COMPUTER SCIENCE AND TECHNOLOGY 27(4): 84 850 July 202. DOI 0.007/s390-02-268-2 A Geometrc Approach for Mult-Degree Splne Xn L
More informationReal-time interactive applications
Real-tme nteractve applcatons PC-2-PC phone PC-2-phone Dalpad Net2phone vdeoconference Webcams Now we look at a PC-2-PC Internet phone example n detal Internet phone over best-effort (1) Best effort packet
More informationContext-Specific Bayesian Clustering for Gene Expression Data
Context-Specfc Bayesan Clusterng for Gene Expresson Data Yoseph Barash School of Computer Scence & Engneerng Hebrew Unversty, Jerusalem, 91904, Israel hoan@cs.huj.ac.l Nr Fredman School of Computer Scence
More informationArchitecture Evolution
2IMP25 Software Evoluton Archtecture Evoluton Alexander Serebrenk Announcements Remnder Assgnment 1 deadlne: Feb 19, 23:59. Do not wat tll 23:58 Guest lecture by Prof Vnju postponed to Feb 24. / SET /
More informationParallel Inverse Halftoning by Look-Up Table (LUT) Partitioning
Parallel Inverse Halftonng by Look-Up Table (LUT) Parttonng Umar F. Sddq and Sadq M. Sat umar@ccse.kfupm.edu.sa, sadq@kfupm.edu.sa KFUPM Box: Department of Computer Engneerng, Kng Fahd Unversty of Petroleum
More informationData Representation in Digital Design, a Single Conversion Equation and a Formal Languages Approach
Data Representaton n Dgtal Desgn, a Sngle Converson Equaton and a Formal Languages Approach Hassan Farhat Unversty of Nebraska at Omaha Abstract- In the study of data representaton n dgtal desgn and computer
More informationQuantifying Responsiveness of TCP Aggregates by Using Direct Sequence Spread Spectrum CDMA and Its Application in Congestion Control
Quantfyng Responsveness of TCP Aggregates by Usng Drect Sequence Spread Spectrum CDMA and Its Applcaton n Congeston Control Mehd Kalantar Department of Electrcal and Computer Engneerng Unversty of Maryland,
More informationpresentations Design simple Visual brevity will help a great talk. Shopping Preference Before&After Continued Continued Inside 15% Outside 85%
Shoppng Preference Insde 15% Outsde 85% Desgn smple www.vnewoodparkproject.com presentatons Vsual brevty wll help a great talk. Contnued Contnued Desgn smple presentatons You, not your PowerPont sldes,
More informationPHYSICS-ENHANCED L-SYSTEMS
PHYSICS-ENHANCED L-SYSTEMS Hansrud Noser 1, Stephan Rudolph 2, Peter Stuck 1 1 Department of Informatcs Unversty of Zurch, Wnterthurerstr. 190 CH-8057 Zurch Swtzerland noser(stuck)@f.unzh.ch, http://www.f.unzh.ch/~noser(~stuck)
More informationComparison of Heuristics for Scheduling Independent Tasks on Heterogeneous Distributed Environments
Comparson of Heurstcs for Schedulng Independent Tasks on Heterogeneous Dstrbuted Envronments Hesam Izakan¹, Ath Abraham², Senor Member, IEEE, Václav Snášel³ ¹ Islamc Azad Unversty, Ramsar Branch, Ramsar,
More informationA Fast Visual Tracking Algorithm Based on Circle Pixels Matching
A Fast Vsual Trackng Algorthm Based on Crcle Pxels Matchng Zhqang Hou hou_zhq@sohu.com Chongzhao Han czhan@mal.xjtu.edu.cn Ln Zheng Abstract: A fast vsual trackng algorthm based on crcle pxels matchng
More informationCS221: Algorithms and Data Structures. Priority Queues and Heaps. Alan J. Hu (Borrowing slides from Steve Wolfman)
CS: Algorthms and Data Structures Prorty Queues and Heaps Alan J. Hu (Borrowng sldes from Steve Wolfman) Learnng Goals After ths unt, you should be able to: Provde examples of approprate applcatons for
More informationUSING GRAPHING SKILLS
Name: BOLOGY: Date: _ Class: USNG GRAPHNG SKLLS NTRODUCTON: Recorded data can be plotted on a graph. A graph s a pctoral representaton of nformaton recorded n a data table. t s used to show a relatonshp
More informationDefining Point-Set Surfaces
Defnng Pont-Set Surfaces Nna Amenta Unversty of Calforna at Davs Yong Joo Kl Unversty of Calforna at Davs Abstract The MLS surface [Levn 2003], used for modelng and renderng wth pont clouds, was orgnally
More information