Merge branch 'master' of mojotrollz.eu:college
This commit is contained in:
commit
8875d3832b
BIN
ss2010/gdi2/exercise/UEbungsblatt_5.pdf
Normal file
BIN
ss2010/gdi2/exercise/UEbungsblatt_5.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/exercise/uebung-1.pdf
Normal file
BIN
ss2010/gdi2/exercise/uebung-1.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/exercise/uebung-2.pdf
Normal file
BIN
ss2010/gdi2/exercise/uebung-2.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/exercise/uebung-3.pdf
Normal file
BIN
ss2010/gdi2/exercise/uebung-3.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/exercise/uebung-4.pdf
Normal file
BIN
ss2010/gdi2/exercise/uebung-4.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
ss2010/gdi2/exercise/uebung-6_update.pdf
Normal file
BIN
ss2010/gdi2/exercise/uebung-6_update.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/exercise/uebung-7.pdf
Normal file
BIN
ss2010/gdi2/exercise/uebung-7.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/P0.pdf
Normal file
BIN
ss2010/gdi2/project/P0.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/P1.pdf
Normal file
BIN
ss2010/gdi2/project/P1.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/P3.pdf
Normal file
BIN
ss2010/gdi2/project/P3.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/Praktikumsaufgabe2.pdf
Normal file
BIN
ss2010/gdi2/project/Praktikumsaufgabe2.pdf
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/Project0.zip
Normal file
BIN
ss2010/gdi2/project/Project0.zip
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/Project1.zip
Normal file
BIN
ss2010/gdi2/project/Project1.zip
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/Project2.zip
Normal file
BIN
ss2010/gdi2/project/Project2.zip
Normal file
Binary file not shown.
BIN
ss2010/gdi2/project/Project3.zip
Normal file
BIN
ss2010/gdi2/project/Project3.zip
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/1.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/1.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/2.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/2.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/3.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/3.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/4.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/4.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/5.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/5.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/6.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/6.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/7.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/7.Uebung.pdf
Normal file
Binary file not shown.
BIN
ss2010/math II/exercise/9.Uebung.pdf
Normal file
BIN
ss2010/math II/exercise/9.Uebung.pdf
Normal file
Binary file not shown.
1124
ss2010/math II/exercise/ueb08.pdf
Normal file
1124
ss2010/math II/exercise/ueb08.pdf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
ss2010/math II/script/MI.pdf
Normal file
BIN
ss2010/math II/script/MI.pdf
Normal file
Binary file not shown.
100
ws2009/ws09.html
Normal file
100
ws2009/ws09.html
Normal file
@ -0,0 +1,100 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<style type="text/css">
|
||||
table { border-width: 1px 1px 1px 1px;
|
||||
border-spacing: 0px;
|
||||
border-style: outset outset outset outset;
|
||||
border-color: black black black black;
|
||||
border-collapse: collapse;
|
||||
background-color: white;
|
||||
}
|
||||
table th { border-width: 1px 1px 1px 1px;
|
||||
padding: 1px 1px 1px 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: black black black black;
|
||||
background-color: white;
|
||||
}
|
||||
table td { border-width: 1px 1px 1px 1px;
|
||||
padding: 1px 5px 1px 5px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: black black black black;
|
||||
background-color: white;
|
||||
}
|
||||
table tr { height: 40px;
|
||||
}
|
||||
</style>
|
||||
</head
|
||||
|
||||
<body>
|
||||
|
||||
<h2>WS 09 - Stundenplan</h2>
|
||||
|
||||
<table border="1">
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Montag</th>
|
||||
<th>Dienstag</th>
|
||||
<th>Mittwoch</th>
|
||||
<th>Donnerstag</th>
|
||||
<th>Freitag</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8:00</td>
|
||||
<td rowspan = "2"></td> <!--Montag-->
|
||||
<td rowspan = "2"></td> <!--Dienstag-->
|
||||
<td rowspan = "2"><b>GDI Vorlesung</b></br>Raum: S101 / A1<br/>Zeit: 8:00 - 9:40</td> <!--Mittwoch-->
|
||||
<td rowspan = "6"></td> <!--Donnerstag-->
|
||||
<td rowspan = "2"><b>GDI Übung</b></br>Raum: S103 / 110<br/>Zeit: 8:00 - 9:40</td> <!--Freitag-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8:55</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>9:50</td>
|
||||
<td><b>Mentorensystem</b></br>Raum: S201 / A213<br/>Zeit: 10:05-10:20</td> <!--Montag-->
|
||||
<td rowspan = "2"><b>Mathe Vorlesung</b></br>Raum: S311 / 08<br/>Zeit: 9:50 - 11:30</td> <!--Dienstag-->
|
||||
<td rowspan = "9"></td> <!--Mittwoch-->
|
||||
<td rowspan = "2"><b>Mathe Vorlesung</b></br>Raum: S311 / 08<br/>Zeit: 9:50 - 11:30</td> <!--Freitag-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>10:45</td>
|
||||
<td rowspan = "2"></td> <!--Montag-->
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11:40</td>
|
||||
<td rowspan = "2"><b>Mathe Übung</b></br>Raum: S103 / 112<br/>Zeit: 11:40 - 13:20</td> <!--Dienstag-->
|
||||
<td rowspan = "7"></td> <!--Freitag-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>12:15</td>
|
||||
<td rowspan = "2"><b>TGDI Vorlesung</b></br>Raum: S206 / 030<br/>Zeit: 12:30 - 14:00</td> <!--Montag-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>13:30</td>
|
||||
<td></td>
|
||||
<td rowspan="2"><b>TGDI Übung</b></br>Raum: S102 / 244<br/>Zeit: 13:30 - 15:10</td> <!--Donnerstag-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td>14:25</td>
|
||||
<td rowspan = "4"></td>
|
||||
<td rowspan = "2"><b>GDI Vorlesung</b></br>Raum: S101 / A1<br/>Zeit: 14:25 - 16:05</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15:20</td>
|
||||
<td><b>Mathe LernGrp</b><br/>Raum: C-Pool<br/>Zeit: 15:20 - 16:15</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16:15</td>
|
||||
<td rowspan = "2"></td>
|
||||
<td rowspan = "2"><b>TDGI Vorlesung</b></br>Raum: S311 / 08<br/>Zeit: 16:15 - 17:55</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>17:55</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
ws2010/gdi3/Material/100_Jahre_Zuse/zuse100.pdf
Normal file
BIN
ws2010/gdi3/Material/100_Jahre_Zuse/zuse100.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Amdahl/Amdahl.pdf
Normal file
BIN
ws2010/gdi3/Material/Amdahl/Amdahl.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/CPUID/241618.pdf
Normal file
BIN
ws2010/gdi3/Material/CPUID/241618.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/CRC/CRC_generators.pdf
Normal file
BIN
ws2010/gdi3/Material/CRC/CRC_generators.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/CSP/cspbook.pdf
Normal file
BIN
ws2010/gdi3/Material/CSP/cspbook.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/IEEE-754/IEEE-754.pdf
Normal file
BIN
ws2010/gdi3/Material/IEEE-754/IEEE-754.pdf
Normal file
Binary file not shown.
199339
ws2010/gdi3/Material/IEEE-754/Q754.129.pdf
Normal file
199339
ws2010/gdi3/Material/IEEE-754/Q754.129.pdf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
ws2010/gdi3/Material/IEEE-754/floating_point_math.pdf
Normal file
BIN
ws2010/gdi3/Material/IEEE-754/floating_point_math.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/IEEE-754/why-ieee.pdf
Normal file
BIN
ws2010/gdi3/Material/IEEE-754/why-ieee.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Moore/moorespaper.pdf
Normal file
BIN
ws2010/gdi3/Material/Moore/moorespaper.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/OpenMP/OpenMP3.0-SummarySpec.pdf
Normal file
BIN
ws2010/gdi3/Material/OpenMP/OpenMP3.0-SummarySpec.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Plankalkuel-Zuse/Plankalkuel.pdf
Normal file
BIN
ws2010/gdi3/Material/Plankalkuel-Zuse/Plankalkuel.pdf
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
ws2010/gdi3/Material/Referenz/ATT-Referenz.pdf
Normal file
BIN
ws2010/gdi3/Material/Referenz/ATT-Referenz.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Referenz/Intel/253665.pdf
Normal file
BIN
ws2010/gdi3/Material/Referenz/Intel/253665.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Referenz/Intel/253666.pdf
Normal file
BIN
ws2010/gdi3/Material/Referenz/Intel/253666.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Referenz/Intel/253667.pdf
Normal file
BIN
ws2010/gdi3/Material/Referenz/Intel/253667.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/SSD/f000252.pdf
Normal file
BIN
ws2010/gdi3/Material/SSD/f000252.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Sprungvorhersage/Jimenez.pdf
Normal file
BIN
ws2010/gdi3/Material/Sprungvorhersage/Jimenez.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Sprungvorhersage/McFarling.pdf
Normal file
BIN
ws2010/gdi3/Material/Sprungvorhersage/McFarling.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Sprungvorhersage/Pan_So_Rahmeh.pdf
Normal file
BIN
ws2010/gdi3/Material/Sprungvorhersage/Pan_So_Rahmeh.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/Sprungvorhersage/Wedig_Rose.pdf
Normal file
BIN
ws2010/gdi3/Material/Sprungvorhersage/Wedig_Rose.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/endianness/endianness05.pdf
Normal file
BIN
ws2010/gdi3/Material/endianness/endianness05.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/gcc/gcc.pdf
Normal file
BIN
ws2010/gdi3/Material/gcc/gcc.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/informationstheorie/shannon1948.pdf
Normal file
BIN
ws2010/gdi3/Material/informationstheorie/shannon1948.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/leibniz/faksimile.pdf
Normal file
BIN
ws2010/gdi3/Material/leibniz/faksimile.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Material/leibniz/leibniz.pdf
Normal file
BIN
ws2010/gdi3/Material/leibniz/leibniz.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-01.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-01.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-01_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-01_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-02.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-02.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-02_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-02_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-03.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-03.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-04.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-04.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-05.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-05.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Praktikum/Praktikum-06.pdf
Normal file
BIN
ws2010/gdi3/Praktikum/Praktikum-06.pdf
Normal file
Binary file not shown.
6
ws2010/gdi3/Praktikum/aufgabe5-1.bf
Normal file
6
ws2010/gdi3/Praktikum/aufgabe5-1.bf
Normal file
@ -0,0 +1,6 @@
|
||||
>++++++++++
|
||||
[>+++++++>++++++++++>+++++++++++>+++++++++++>+++++++++++
|
||||
+>+++>+++++++++++>++++++++++>++++++++++++>+++>+++++++++>
|
||||
++++++++++>++++++++++>+++++++++++>+++><<<<<<<<<<<<<<<<-]
|
||||
>++>--->++>++>+>++>>+>->++>->+>--->++++>+++>
|
||||
<<<<<<<<<<<<<<<<>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.
|
||||
71
ws2010/gdi3/Praktikum/mandelbrot_vorgabe.cpp
Normal file
71
ws2010/gdi3/Praktikum/mandelbrot_vorgabe.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* mandelbrot_vorgabe.cpp
|
||||
*
|
||||
* Created on: 10.01.2011
|
||||
* Author: mk
|
||||
*/
|
||||
|
||||
#define ASCII_WIDTH 50
|
||||
#define ASCII_HEIGHT 35
|
||||
|
||||
class CMandelbrot
|
||||
{
|
||||
public:
|
||||
CMandelbrot();
|
||||
int getASCIImapPoint(int pX, int pY){return asciimap[pX][pY];}
|
||||
void setASCIImapPoint(int pX, int pY, int pValue){asciimap[pX][pY]=pValue;}
|
||||
private:
|
||||
int asciimap[ASCII_WIDTH][ASCII_HEIGHT];
|
||||
double minRe,maxRe,minIm;
|
||||
};
|
||||
|
||||
class CPainter
|
||||
{
|
||||
public:
|
||||
CPainter();
|
||||
private:
|
||||
void printASCIIMandelbrot();
|
||||
};
|
||||
|
||||
/*
|
||||
* returns the Mandelbrot-set as ASCII-art on the command line
|
||||
*/
|
||||
void CPainter::printASCIIMandelbrot()
|
||||
{
|
||||
for(int i=0;i<ASCII_HEIGHT;i++)
|
||||
{
|
||||
for(int j=0;j<ASCII_WIDTH;j++)
|
||||
if(mandelbrot->getASCIImapPoint(j,i)==0)
|
||||
printf(" ");
|
||||
else
|
||||
printf("X");
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* creates a new CMandelbrot object
|
||||
*/
|
||||
CMandelbrot::CMandelbrot()
|
||||
{
|
||||
maxRe = 1.0;
|
||||
minIm = -1.2;
|
||||
minRe = -2.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* check arguments, create all necessary objects
|
||||
*/
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// argv[1] = number of iterations
|
||||
// argv[2] = output mode [0 = disabled; 1 = ASCII]
|
||||
if (argc<3)
|
||||
{
|
||||
printf("wrong number of arguments:\n1. number of iterations\n2. output mode [0 = disabled; 1 = ASCII]\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
60
ws2010/gdi3/Praktikum/matrixgenerator.c
Normal file
60
ws2010/gdi3/Praktikum/matrixgenerator.c
Normal file
@ -0,0 +1,60 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
int doublemode = 0; // 0 = Int, 1 = Float
|
||||
char usage[] = "usage: matrixgenerator size [-mode double]\n";
|
||||
int i,j, k;
|
||||
int matricewidth = 0;
|
||||
|
||||
|
||||
int main (int argc, const char * argv[])
|
||||
{
|
||||
// check Number of arguments
|
||||
if (argc != 2 && argc != 4)
|
||||
{
|
||||
printf("%s", usage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check arguments for double mode
|
||||
if (argc == 4)
|
||||
{
|
||||
if (strcmp(argv[2],"-mode") != 0 || strcmp(argv[3],"double") != 0)
|
||||
{
|
||||
printf("%s", usage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
doublemode = 1;
|
||||
}
|
||||
|
||||
matricewidth = atoi(argv[1]);
|
||||
|
||||
srand ( time(NULL) );
|
||||
|
||||
double number;
|
||||
|
||||
// Float
|
||||
printf("%d\n", matricewidth);
|
||||
for (k = 0; k < 2; k++)
|
||||
{
|
||||
for (i = 0; i < matricewidth; i++)
|
||||
{
|
||||
for (j = 0; j < matricewidth; j++)
|
||||
{
|
||||
if (doublemode)
|
||||
{
|
||||
number = (double) rand() / RAND_MAX;
|
||||
number = 200 * number - 100;
|
||||
printf("%g\n", number);
|
||||
}
|
||||
else
|
||||
printf("%d\n", ( rand() % 200 - 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
95
ws2010/gdi3/Praktikum/posix_threads.cpp
Normal file
95
ws2010/gdi3/Praktikum/posix_threads.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* posix_threads.cpp
|
||||
*
|
||||
* Created on: 10.01.2011
|
||||
* Author: mk
|
||||
*/
|
||||
|
||||
#include <pthread.h> // POSIX-threads
|
||||
#include <time.h> // time operations (to calculate the runtime)
|
||||
#include <stdio.h> // standard IO operations (to print to console)
|
||||
#include <stdlib.h> // general purpose standard library (to generate random numbers)
|
||||
#define NUM_ELEMENTS 1000000 // number of array-elements to add
|
||||
|
||||
pthread_t* threads; // stores the posix-thread-objects
|
||||
int* threadNums; // stores the thread-numbers
|
||||
time_t beginCalc,endCalc; // used to calculate the runtime of the program
|
||||
unsigned long a[NUM_ELEMENTS],b[NUM_ELEMENTS],c[NUM_ELEMENTS]; // arrays to add (c=a+b)
|
||||
int numThreads; // number of threads to create
|
||||
|
||||
/*
|
||||
* fills the arrays with random numbers between 0 and 9
|
||||
*/
|
||||
void fillArrays()
|
||||
{
|
||||
for(unsigned i=0;i<NUM_ELEMENTS;i++)
|
||||
{
|
||||
a[i] = rand() % 10;
|
||||
b[i] = rand() % 10;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* this function is called after a thread has been created by pthread_create
|
||||
*/
|
||||
void* addArrays(void* pThreadNum)
|
||||
{
|
||||
int* threadNum = (int*)pThreadNum;
|
||||
printf("Thread %i started\n",*threadNum);
|
||||
unsigned begin,end; // stores the first and last array index which this thread calculates
|
||||
if(*threadNum == -1) // only one thread, so no POSIX-threads to create
|
||||
{
|
||||
begin = 0;
|
||||
end = NUM_ELEMENTS;
|
||||
}
|
||||
else // calculate the first and last array index this thread has to calculate
|
||||
{
|
||||
begin = (NUM_ELEMENTS/numThreads)**threadNum;
|
||||
end = (NUM_ELEMENTS/numThreads)*(*threadNum+1);
|
||||
}
|
||||
for (unsigned j=0;j<10000;j++) // run 10.000 times to get a runtime long enough to compare
|
||||
for (unsigned i=begin;i<end;i++)
|
||||
c[i] = a[i] + b[i]; // add array elements
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if(argc!=2)
|
||||
{
|
||||
printf("error! first parameter should be: number of threads\n");
|
||||
return -1;
|
||||
}
|
||||
numThreads = atoi(argv[1]); // get number of threads from the first parameter
|
||||
fillArrays(); // fill the arrays with random numbers
|
||||
time(&beginCalc); // store the time at the beginning of the calculation
|
||||
if(numThreads==1) // no POSIX-threads need to be created
|
||||
{
|
||||
int noThreads = -1;
|
||||
addArrays((void*)&noThreads);
|
||||
}
|
||||
else if(numThreads>1)
|
||||
{
|
||||
threads = (pthread_t*)malloc(numThreads*sizeof(pthread_t)); // reserve memory for the threads
|
||||
threadNums = (int*)malloc(numThreads*sizeof(int)); // reserve memory for the thread-numbers
|
||||
for (unsigned i=0;i<numThreads;i++)
|
||||
{
|
||||
threadNums[i] = i;
|
||||
pthread_create(&threads[i],NULL,addArrays,(void *)&threadNums[i]); // create thread
|
||||
}
|
||||
// wait for termination of all threads
|
||||
for(unsigned i=0;i<numThreads;i++)
|
||||
pthread_join(threads[i],NULL);
|
||||
// free memory
|
||||
free(threads);
|
||||
free(threadNums);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("error! number of threads must be positive\n");
|
||||
return -1;
|
||||
}
|
||||
time(&endCalc); // store the time at the end of the calculation
|
||||
double timePassed = difftime(endCalc,beginCalc); // calculate the passed time between beginning and end of the calculation
|
||||
printf("%f seconds passed\n",timePassed);
|
||||
return 0;
|
||||
}
|
||||
135
ws2010/gdi3/Praktikum/prak3.c
Normal file
135
ws2010/gdi3/Praktikum/prak3.c
Normal file
@ -0,0 +1,135 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <omp.h>
|
||||
|
||||
int *matA = 0;
|
||||
int *matB = 0;
|
||||
int *matResult = 0;
|
||||
int matricesize;
|
||||
double *matAdouble = 0;
|
||||
double *matBdouble = 0;
|
||||
double *matResultDouble = 0;
|
||||
|
||||
/*
|
||||
* validate commandline arguments, set global variables as required or inform user of usage and quit the program
|
||||
*/
|
||||
void validateArguments(int argc, const char * argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
||||
printf("two parameters expected: filename mode\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strcmp(argv[2],"assembler") != 0 && strcmp(argv[2],"c_row") != 0 && strcmp(argv[2],"c_double") != 0 && strcmp(argv[2],"c_column") != 0) {
|
||||
printf("Second parameter is invalid.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* read a matrice file into memory
|
||||
*/
|
||||
void readMatricefile(const char *file, char bDouble)
|
||||
{
|
||||
// open file
|
||||
FILE * pFile;
|
||||
char line[16];
|
||||
pFile = fopen(file, "r");
|
||||
|
||||
if (pFile == NULL)
|
||||
{
|
||||
printf("Accessing input file failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Determine matrice size
|
||||
fgets(line, 16, pFile);
|
||||
matricesize = atoi(line);
|
||||
|
||||
// Allocate memory
|
||||
int size = matricesize*matricesize;
|
||||
|
||||
if (bDouble)
|
||||
{
|
||||
// Double required
|
||||
matAdouble = (double*) malloc(size * sizeof(double));
|
||||
matBdouble = (double*) malloc(size * sizeof(double));
|
||||
matResultDouble = (double*) malloc(size * sizeof(double));
|
||||
|
||||
if (matAdouble == NULL || matBdouble == NULL || matResultDouble == NULL)
|
||||
{
|
||||
printf("Error allocating memory.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// continue reading
|
||||
int i = 0;
|
||||
while (fgets(line, 16, pFile) != NULL && i < 2*size)
|
||||
{
|
||||
if (i < size)
|
||||
matAdouble[i] = strtod(line, NULL);
|
||||
else
|
||||
matBdouble[i - size] = strtod(line, NULL);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Integers required
|
||||
matA = (int*) malloc(size * sizeof(int));
|
||||
matB = (int*) malloc(size * sizeof(int));
|
||||
matResult = (int*) malloc(size * sizeof(int));
|
||||
|
||||
if (matA == NULL || matB == NULL || matResult == NULL)
|
||||
{
|
||||
printf("Error allocating memory.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// continue reading
|
||||
int i = 0;
|
||||
while (fgets(line, 16, pFile) != NULL && i < 2*size)
|
||||
{
|
||||
if (i < size)
|
||||
matA[i] = atoi(line);
|
||||
else
|
||||
matB[i - size] = atoi(line);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// done
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
int main (int argc, const char * argv[])
|
||||
{
|
||||
// check we got valid arguments, else quit
|
||||
validateArguments(argc, argv);
|
||||
|
||||
// read input matrice file
|
||||
readMatricefile(argv[1], (strcmp(argv[2],"c_double") == 0) );
|
||||
|
||||
// ---- insert your code here ----
|
||||
|
||||
// clear memory
|
||||
if ((strcmp(argv[2],"c_double") != 0))
|
||||
{
|
||||
free(matA);
|
||||
free(matB);
|
||||
free(matResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(matAdouble);
|
||||
free(matBdouble);
|
||||
free(matResultDouble);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
ws2010/gdi3/Uebung/Uebung-00.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-00.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-00_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-00_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-01.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-01.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-01_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-01_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-02.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-02.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-02_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-02_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-03.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-03.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-03_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-03_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-04.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-04.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-04_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-04_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-05.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-05.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-05_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-05_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-06.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-06.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-06_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-06_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-07.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-07.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-07_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-07_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-08.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-08.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-08_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-08_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-09.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-09.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-09_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-09_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-10.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-10.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-10_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-10_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-11.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-11.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-11_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-11_Loesung.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-12.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-12.pdf
Normal file
Binary file not shown.
BIN
ws2010/gdi3/Uebung/Uebung-12_Loesung.pdf
Normal file
BIN
ws2010/gdi3/Uebung/Uebung-12_Loesung.pdf
Normal file
Binary file not shown.
139
ws2010/gdi3/Uebung/floatingStripped.asm
Normal file
139
ws2010/gdi3/Uebung/floatingStripped.asm
Normal file
@ -0,0 +1,139 @@
|
||||
.data
|
||||
fltout: .string "Wert: %f\n"
|
||||
a: .float 2.76
|
||||
b: .float -3.12
|
||||
c: .float 1.2
|
||||
|
||||
.text
|
||||
.globl main
|
||||
main:
|
||||
# a * b
|
||||
movl a, %eax
|
||||
movl b, %ebx
|
||||
call fltmul
|
||||
call fltprint
|
||||
|
||||
# b + c
|
||||
movl b, %eax
|
||||
movl c, %ebx
|
||||
call fltadd
|
||||
call fltprint
|
||||
|
||||
# c + a
|
||||
movl c, %eax
|
||||
movl a, %ebx
|
||||
call fltadd
|
||||
call fltprint
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
|
||||
/*
|
||||
Addition zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltadd:
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
Multiplikation zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltmul:
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
Ausgabe einer float Zahl via printf
|
||||
Wichtig: printf ist leider nur double kompatibel,
|
||||
daher muss float auf double erweitert werden
|
||||
auch wenn %f genutzt wird!
|
||||
|
||||
Eingabe: %eax
|
||||
Ausgabe: ---
|
||||
*/
|
||||
fltprint:
|
||||
pusha
|
||||
|
||||
call extend # Wegen printf auf double erweitern
|
||||
pushl %edx
|
||||
pushl %eax
|
||||
pushl $fltout
|
||||
call printf
|
||||
addl $12, %esp
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
/*
|
||||
Erweitert ein float in double
|
||||
Eingabe: %eax
|
||||
Ausgabe: %edx:%eax
|
||||
|
||||
Notizen: %ebx enthaelt dauerhaft den float-Wert
|
||||
%ecx:%edx Zwischenergebniss der Erweiterung
|
||||
%edx enthaelt Differenz der Exponenten
|
||||
*/
|
||||
extend:
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
|
||||
movl %eax, %ebx # Sicherung des floats
|
||||
call sign # Vorzeichen extrahieren
|
||||
movl %eax, %ecx # ecx:edx wird double enthalten
|
||||
movl %ebx, %eax
|
||||
call exponent # Exponent extrahieren
|
||||
addl $896, %eax # Exponent erweitern -127 +1023
|
||||
shll $11, %ecx
|
||||
orl %eax, %ecx # An ecx anhaengen
|
||||
movl %ebx, %eax
|
||||
call significand # Mantisse extrahieren
|
||||
movl %eax, %edx
|
||||
shrl $3, %eax # Nur 20 Bit passen noch dran
|
||||
shll $20, %ecx
|
||||
orl %eax, %ecx
|
||||
shll $29, %edx # Mantisse erweitern
|
||||
movl %edx, %eax # Ausgabe setzen
|
||||
movl %ecx, %edx
|
||||
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
/*
|
||||
Vorzeichen des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
sign:
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
Exponent des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
exponent:
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
Mantisse des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
significand:
|
||||
|
||||
ret
|
||||
33
ws2010/gdi3/Uebung/list.h
Normal file
33
ws2010/gdi3/Uebung/list.h
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct t_ListElement {
|
||||
char *val;
|
||||
struct t_ListElement *next;
|
||||
};
|
||||
|
||||
typedef struct t_ListElement item;
|
||||
|
||||
int searchList(item *head, char *name) {
|
||||
item *curr = head;
|
||||
int pos = 0;
|
||||
while (curr) {
|
||||
if (!strcmp(curr->val, name)) {
|
||||
return pos;
|
||||
}
|
||||
++pos;
|
||||
curr = curr->next;
|
||||
}
|
||||
if (!curr) {
|
||||
return -1;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
item *newListItem(char *name) {
|
||||
item *e = (item *)malloc(sizeof(item));
|
||||
e->val = calloc(strlen(name)+1, sizeof(char));
|
||||
e->next = NULL;
|
||||
strcpy(e->val, name);
|
||||
return e;
|
||||
}
|
||||
30
ws2010/gdi3/Uebung/listExample.c
Normal file
30
ws2010/gdi3/Uebung/listExample.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "list.h"
|
||||
|
||||
int main() {
|
||||
item *curr, *head, *tail;
|
||||
char *names[] = {"i", "val", "curr", "test", "res"};
|
||||
|
||||
int i;
|
||||
for(i = 0; i < 5; i++) {
|
||||
curr = newListItem(names[i]);
|
||||
if (i != 0) {
|
||||
tail->next = curr;
|
||||
} else {
|
||||
head = curr;
|
||||
}
|
||||
tail = curr;
|
||||
}
|
||||
|
||||
int pos = searchList(head, "curr");
|
||||
printf("curr at %d\n", pos);
|
||||
|
||||
pos = searchList(head, "res");
|
||||
printf("res at %d\n", pos);
|
||||
|
||||
pos = searchList(head, "grrrr");
|
||||
printf("grrrr at %d\n", pos);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user