General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information...
-
date post
19-Dec-2015 -
Category
Documents
-
view
214 -
download
0
Transcript of General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information...
![Page 1: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/1.jpg)
General Computer General Computer Science Science
for Engineersfor EngineersCISC 106CISC 106
Lecture 22Lecture 22
Dr. John CavazosComputer and Information Sciences
04/13/2009
![Page 2: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/2.jpg)
Lecture OverviewLecture OverviewSymbolic Debugger (137-140)Date Types
Memory size/efficiency/accuracy
![Page 3: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/3.jpg)
Symbolic DebuggerSymbolic DebuggerOpen m-file to debug in Matlab
editorCan set breakpoints
Where you want execution to suspend
Execute in command window as normal
, 2009 from 1:00 PM to 1:30 PM
![Page 4: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/4.jpg)
Symbolic DebuggerSymbolic DebuggerExecution suspends in editor at
breakpointCan view variables in command
windowCan step through the codeCan continue to next
breakpoint17, 2009 from 1:00 PM to 1:30 PM
![Page 5: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/5.jpg)
Classes of Data TypesClasses of Data Types
![Page 6: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/6.jpg)
Single-Precision floating Single-Precision floating pointpointStores number in 32 bitsBit 31 is sign (0 = positive, 1 =
negative)Bits 0 through 30 for number
(exponent and fraction), 2009 from 1:00 PM to 1:30 PM
![Page 7: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/7.jpg)
Double-Precision (default)Double-Precision (default)Stores number in 64 bits
Bit 63 is sign (0 = positive, 1 = negative)
Bits 0 through 62 for number (exponent and fraction), 2009
from 1:00 PM to 1:30 PM
![Page 8: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/8.jpg)
Integers (Signed Values)Integers (Signed Values)int8 (8 bits) can represent -128 to
127int16, int32, int64
x = int8(200) x ←127
x=int8(-500)x ← -128;
![Page 9: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/9.jpg)
Integers (Unsigned Integers (Unsigned Values)Values)uint8 (8 bits) can represent 0 to
255uint16, uint32, uint64
x = uint8(400) x ←255
x=uint8(-500)x ← 0;
![Page 10: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/10.jpg)
iintmin and intmaxntmin and intmax
intmin(‘uint8’) 0intmax(‘int8’) 127
![Page 11: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/11.jpg)
Integer arraysInteger arrays
array = zeros(100,100, ‘int8’);
Creates a 100-by-100 int8 array initialized to zero.
![Page 12: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/12.jpg)
EfficiencyEfficiency
• If array will only require certain values• Use correct datatype!
• For example:• Images typically only have 0-
255 values• Need only uint8
![Page 13: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.](https://reader036.fdocuments.net/reader036/viewer/2022081519/56649d405503460f94a19fd5/html5/thumbnails/13.jpg)
Efficiency (cont’d)Efficiency (cont’d)
• double requires 8 bytes• uint8 requires 1 byte• Double requires 8 times more
memory to store images!