Skip to content

Commit 0048b17

Browse files
committed
Added the incrementArray function needed by FEAST.
1 parent e2f7a5a commit 0048b17

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ArrayOperations.c

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ void* checkedCalloc(size_t vectorLength, size_t sizeOfType) {
4747
return allocated;
4848
}
4949

50+
void incrementVector(double* vector, int vectorLength) {
51+
int i = 0;
52+
for (i = 0; i < vectorLength; i++)
53+
{
54+
vector[i]++; /*C indexes from 0 not 1*/
55+
}/*for length of array */
56+
}/* incrementVector(double*,int) */
57+
5058
void printDoubleVector(double *vector, int vectorLength)
5159
{
5260
int i;

ArrayOperations.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
**
88
** Author: Adam Pocock
99
** Created 17/2/2010
10-
** Updated - 22/02/2014 - Added checking on calloc.
10+
** Updated - 22/02/2014 - Added checking on calloc, and an increment array function.
1111
**
1212
** Copyright 2010,2014 Adam Pocock, The University Of Manchester
1313
** www.cs.manchester.ac.uk
@@ -41,6 +41,11 @@ extern "C" {
4141
*******************************************************************************/
4242
void* checkedCalloc(size_t vectorLength, size_t sizeOfType);
4343

44+
/*******************************************************************************
45+
** Increments each value in a double array
46+
*******************************************************************************/
47+
void incrementVector(double* vector, int vectorLength);
48+
4449
/*******************************************************************************
4550
** Simple print functions for debugging
4651
*******************************************************************************/

0 commit comments

Comments
 (0)