Skip to content

Commit

Permalink
Added the incrementArray function needed by FEAST.
Browse files Browse the repository at this point in the history
  • Loading branch information
Craigacp committed Feb 23, 2014
1 parent e2f7a5a commit 0048b17
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ArrayOperations.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ void* checkedCalloc(size_t vectorLength, size_t sizeOfType) {
return allocated;
}

void incrementVector(double* vector, int vectorLength) {
int i = 0;
for (i = 0; i < vectorLength; i++)
{
vector[i]++; /*C indexes from 0 not 1*/
}/*for length of array */
}/* incrementVector(double*,int) */

void printDoubleVector(double *vector, int vectorLength)
{
int i;
Expand Down
7 changes: 6 additions & 1 deletion ArrayOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**
** Author: Adam Pocock
** Created 17/2/2010
** Updated - 22/02/2014 - Added checking on calloc.
** Updated - 22/02/2014 - Added checking on calloc, and an increment array function.
**
** Copyright 2010,2014 Adam Pocock, The University Of Manchester
** www.cs.manchester.ac.uk
Expand Down Expand Up @@ -41,6 +41,11 @@ extern "C" {
*******************************************************************************/
void* checkedCalloc(size_t vectorLength, size_t sizeOfType);

/*******************************************************************************
** Increments each value in a double array
*******************************************************************************/
void incrementVector(double* vector, int vectorLength);

/*******************************************************************************
** Simple print functions for debugging
*******************************************************************************/
Expand Down

0 comments on commit 0048b17

Please sign in to comment.