#ifndef IPLMATH_H
#define IPLMATH_H

#include <v_lib.h>

void matSubmatrixMinMax(matrix_p data,
	u32_t left,u32_t top,u32_t right,u32_t bottom,
	vec_t *min_ret,
	vec_t *max_ret);
void	matZeroRows(matrix_p m,u32_t row_start,u32_t row_end);
void	matBandReject(matrix_p m,u32_t lo_bound,u32_t hi_bound);
void	matBandPass(matrix_p m,u32_t lo_bound,u32_t hi_bound);
void	matRVMFTZeroRows(matrix_p m,u32_t row_start,u32_t row_end);
void	matRVMFTZeroCols(matrix_p m,u32_t col_start,u32_t col_end);
void	matOffset(matrix_p m,vec_t offset);
void	vecRunningSum(vector_p dest,vector_p src);
void	vecLinSpaced(vector_p dest,vec_t min,vec_t max);
void	matLinSpacedRows(matrix_p dest,vec_t min,vec_t max);
void	matLinSpacedCols(matrix_p dest,vec_t min,vec_t max);
void	matScaleM(matrix_p dest,matrix_p src,matrix_p scale);
void	matUnscaleM(matrix_p dest,matrix_p src,matrix_p divisor);
void	matOffsetM(matrix_p dest,matrix_p src,matrix_p offset);
vboolean matHistogramRange(vector_p dest,matrix_p src,vboolean normalize,
	vector_p histogram_space,vec_t min,vec_t max);
vboolean	matHistogram(vector_p dest,matrix_p src,vboolean normalize,
	vector_p space);
vboolean vecHistogramRange(vector_p dest,vector_p src,vboolean normalize,
	vector_p histogram_space,vec_t min,vec_t max);
vboolean	vecHistogram(vector_p dest,vector_p src,vboolean normalize,
	vector_p space);
vboolean	matGammaCorrection(matrix_p dest,matrix_p src,vector_p gamma,
	vboolean unit_input);
vboolean	matNormalize(matrix_p dest,matrix_p src,vec_t new_min,vec_t new_max);
vboolean	matAdjustContrast(matrix_p dest,matrix_p src,
	vec_t min,vec_t max);
vboolean	vecNormalize(vector_p dest,vector_p src,vec_t new_min,vec_t new_max);
vboolean	vecAdjustContrast(vector_p dest,vector_p src,
	vec_t min,vec_t max);
vboolean	matRVMFTSpectrum(matrix_p dest,matrix_p rvmft);
matrix_p	matExpand(matrix_p src,u32_t new_rows,u32_t new_cols,
	vec_t pad_value);
matrix_p	matExpandPowers2(matrix_p src,vec_t pad_value);
matrix_p	matConvolve3x3(matrix_p src,
	vec3_t filt_row0,vec3_t filt_row1,vec3_t filt_row2);
void		matMirror(matrix_p m,vboolean mirror_x,vboolean mirror_y);
void		vecMirror(vector_p v);
vboolean	vecShift(vector_p v,s32_t amount);

#define matZeroCols(m,col_start,col_end) \
	V_ASSERT(m); \
	matSetRect(m,col_start,0,col_end,(m)->rows - 1,0)

#endif  /* !IPLMATH_H */
