Skip to content

Implement meanvar. Returns the mean and variance of an array #2258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2018

Conversation

umar456
Copy link
Member

@umar456 umar456 commented Aug 4, 2018

This function performs the same number of operations as regular
var but returns the intermediate mean array as well

Addresses #2136

@umar456 umar456 added the feature label Aug 4, 2018
@umar456 umar456 added this to the v3.7.0 milestone Aug 4, 2018
@umar456 umar456 requested a review from 9prady9 August 4, 2018 01:54
calculated. Default is -1 meaning the first non-zero dim
*/
AFAPI void meanvar(array& mean, array& var, const array& in, const array& weights,
const af_var_bias bias = AF_VARIANCE_POPULATION, const dim_t dim=-1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably port this variance bias enum support to other variance computing functions which currently take a boolean

is_same_type<T, char >::value,
float,
typename elseType<T>::type>::type type;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elseType doesn't seem to be used anywhere else, can't we abridge varOutType to the following?

template<typename T>
struct varOutType {
  typedef typename cond_type< is_same_type<T, uintl>::value ||
                              is_same_type<T, intl>::value  ||
                              is_same_type<T, double>::value,
                              double, float >::type type;
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else type is used to handle the cfloat and cdouble case. Those calls return the same type as the input.

This function performs the same number of operations as regular
var but returns the intermediate mean array as well
@9prady9 9prady9 merged commit 022b3ab into arrayfire:master Aug 5, 2018
@9prady9 9prady9 mentioned this pull request Aug 5, 2018
@umar456 umar456 deleted the meanvar branch August 11, 2018 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants