Commit e004048b authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Help vectorization of scale_add.

parent 58a7e4d4
......@@ -462,13 +462,20 @@ void cdf_scale_add(size_t size, double *data, double addoffset, double scalefact
bool laddoffset = IS_NOT_EQUAL(addoffset, 0);
bool lscalefactor = IS_NOT_EQUAL(scalefactor, 1);
if ( laddoffset || lscalefactor )
if ( laddoffset && lscalefactor )
{
for ( size_t i = 0; i < size; ++i )
{
if ( lscalefactor ) data[i] *= scalefactor;
if ( laddoffset ) data[i] += addoffset;
}
for (size_t i = 0; i < size; ++i )
data[i] = data[i] * scalefactor + addoffset;
}
else if (lscalefactor)
{
for (size_t i = 0; i < size; ++i )
data[i] *= scalefactor;
}
else if (laddoffset)
{
for (size_t i = 0; i < size; ++i )
data[i] += addoffset;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment