#include "float.h"
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <pthread.h>
#include <sched.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
Go to the source code of this file.
|
void | transpose_array_float (float *array, int n, int d, float *array_transposed) |
|
void | transpose_array_double (double *array, int n, int d, double *array_transposed) |
|
void | transpose_array_int (int *array, int n, int d, int *array_transposed) |
|
int | compare_floats (const void *p1, const void *p2) |
|
int | compare_ints (const void *p1, const void *p2) |
|
elem_type | kth_smallest (elem_type a[], int n, int k) |
|
int | kth_smallest_idx (elem_type a[], int n, int k) |
|
#define ELEM_SWAP |
( |
|
a, |
|
|
|
b |
|
) |
| { register elem_type t=(a);(a)=(b);(b)=t; } |
int compare_floats |
( |
const void * |
p1, |
|
|
const void * |
p2 |
|
) |
| |
Compares two float values
- Parameters
-
Pointer | to first float |
Pointer | to second float |
int compare_ints |
( |
const void * |
p1, |
|
|
const void * |
p2 |
|
) |
| |
Compares to integers
- Parameters
-
Pointer | to first int |
Pointer | to second int |
Function : kth_smallest() In : array of elements, # of elements in the array, rank k Out : one element Job : find the kth smallest element in the array Notice : use the median() macro defined below to get the median.
Reference:
Author: Wirth, Niklaus Title: Algorithms + data structures = programs Publisher: Englewood Cliffs: Prentice-Hall, 1976 Physical description: 366 p. Series: Prentice-Hall Series in Automatic Computation
int kth_smallest_idx |
( |
elem_type |
a[], |
|
|
int |
n, |
|
|
int |
k |
|
) |
| |
Computes the kth smallest index
- Parameters
-
a[] | Array of type elem_type |
n | Number of rows |
Number | of columns |
void transpose_array_double |
( |
double * |
array, |
|
|
int |
n, |
|
|
int |
d, |
|
|
double * |
array_transposed |
|
) |
| |
Transposes a given double array
- Parameters
-
array | Pointer to double array |
n | number of "rows" in a |
d | number of "columns" in a |
array_transposed | The transposed array |
void transpose_array_float |
( |
float * |
array, |
|
|
int |
n, |
|
|
int |
d, |
|
|
float * |
array_transposed |
|
) |
| |
Transposes a given float array
- Parameters
-
array | Pointer to float array |
n | number of "rows" in a |
d | number of "columns" in a |
array_transposed | The transposed array |
void transpose_array_int |
( |
int * |
array, |
|
|
int |
n, |
|
|
int |
d, |
|
|
int * |
array_transposed |
|
) |
| |
Transposes a given int array
- Parameters
-
array | Pointer to int array |
n | number of "rows" in a |
d | number of "columns" in a |
array_transposed | The transposed array |