[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #32168] skewness.m: initialise the output from

From: Pascal Dupuis
Subject: [Octave-bug-tracker] [bug #32168] skewness.m: initialise the output from the input
Date: Tue, 18 Jan 2011 11:01:57 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13


                 Summary: skewness.m: initialise the output from the input
                 Project: GNU Octave
            Submitted by: cdemills
            Submitted on: mar 18 jan 2011 11:01:56 GMT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Pascal Dupuis
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.3.54
        Operating System: GNU/Linux



In the file statistics/base/skewness.m, a test is performed to detect
variables whose std is 0. As the skewness implies taking the inverse of the
std, the skewness for those values is simply set to 0, to avoid division by 0.
This is accomplished at lines 79-83. retval is initialised to be zeros of the
class of the input. For a user-defined class, this fails with
"zeros: invalid data type specified"
Moreover, overloaded funcs for a dataframe object takes care about
propagating meta-information. This way, the line
retval(ind) = x(ind) ./ (c * s(ind) .^ 3)
implies a lot of work, as we're dealing with 3 variables. I thus propose the
enclosed patch. Ideas:

ind = (s > 0); <= keep tracks of thing to process some way/some other way
retval = sum (x .^ 3, dim); <= retval receive all its meta-inf from x

if !isobject(x),
    retval(~ind) = zeros (1, class (x)); <= fast way
    retval(~ind) = 0; %# let the class subsasgn handle the cast

retval(ind) = retval(ind) ./ (c * s(ind) .^ 3);   




File Attachments:

Date: mar 18 jan 2011 11:01:56 GMT  Name: skewness.pat  Size: 665 o   By:



Reply to this item at:


  Message posté via/par Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]