Commit 83cdf0dc15f5bbf378220d39cd8c35c7e20d1f0b
1 parent
d82f7858
added the ability to identify arguments as numbers
Showing
2 changed files
with
15 additions
and
1 deletions
Show diff stats
stim/math/filters/conv2.h
@@ -46,7 +46,7 @@ namespace stim { | @@ -46,7 +46,7 @@ namespace stim { | ||
46 | } | 46 | } |
47 | 47 | ||
48 | //Performs a convolution of a 2D image using the GPU. All pointers are assumed to be to memory on the current device. | 48 | //Performs a convolution of a 2D image using the GPU. All pointers are assumed to be to memory on the current device. |
49 | - //@param out is a pointer to the output image | 49 | + //@param out is a pointer to the output image, which is of size (sx - kx + 1) x (sy - ky + 1) |
50 | //@param in is a pointer to the input image | 50 | //@param in is a pointer to the input image |
51 | //@param sx is the size of the input image along X | 51 | //@param sx is the size of the input image along X |
52 | //@param sy is the size of the input image along Y | 52 | //@param sy is the size of the input image along Y |
stim/parser/arguments.h
@@ -205,6 +205,20 @@ namespace stim{ | @@ -205,6 +205,20 @@ namespace stim{ | ||
205 | 205 | ||
206 | else return 0; | 206 | else return 0; |
207 | } | 207 | } |
208 | + //returns true if the specified argument can be represented as a number | ||
209 | + bool is_num(size_t n = 0){ | ||
210 | + bool decimal = false; | ||
211 | + for(size_t i = 0; i < vals[n].size(); i++){ | ||
212 | + if(vals[n][i] == '-' && i != 0) return false; | ||
213 | + else if(vals[n][i] == '.'){ | ||
214 | + if(decimal) return false; | ||
215 | + else decimal = true; | ||
216 | + } | ||
217 | + else if(vals[n][i] < '0') return false; | ||
218 | + else if(vals[n][i] > '9') return false; | ||
219 | + } | ||
220 | + return true; | ||
221 | + } | ||
208 | 222 | ||
209 | //get the width of the left column | 223 | //get the width of the left column |
210 | size_t col_width() | 224 | size_t col_width() |