octave-bug-tracker
[Top][All Lists]
Advanced

[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:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13

URL:
  <http://savannah.gnu.org/bugs/?32168>

                 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

    _______________________________________________________

Details:

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
else
    retval(~ind) = 0; %# let the class subsasgn handle the cast
endif    

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

Regards

Pascal





    _______________________________________________________

File Attachments:


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

<http://savannah.gnu.org/bugs/download.php?file_id=22436>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32168>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

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