Add +,-,*,/,neg,pow to CudaMatrix
This commit is contained in:
@@ -11,6 +11,7 @@ struct PowOperator: public thrust::unary_function<float, float>{
|
||||
void setExponent(float v){
|
||||
exponent = v;
|
||||
}
|
||||
|
||||
__host__ __device__
|
||||
float operator()(const float& x) {
|
||||
return powf(x, exponent);
|
||||
@@ -74,12 +75,12 @@ void unaryDiv(float* in1, const float& in2, float* out, unsigned long length){
|
||||
void unaryPow(float* in1, float N,float* out, unsigned long length){
|
||||
if (N == 0.0f)
|
||||
{
|
||||
thrust::fill(out,out+length,0);
|
||||
thrust::fill(thrust::device,out,out+length,1);
|
||||
return;
|
||||
}
|
||||
if (N == 1.0f)
|
||||
{
|
||||
thrust::copy(in1,in1+length,out);
|
||||
thrust::copy(thrust::device,in1,in1+length,out);
|
||||
return;
|
||||
}
|
||||
if (N == 2.0f){
|
||||
|
||||
Reference in New Issue
Block a user