/[pspp]/pspp/src/t-test.q
ViewVC logotype

Diff of /pspp/src/t-test.q

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.40 by blp, Fri Feb 11 08:22:05 2005 UTC revision 1.41 by jmd, Sun Mar 13 06:59:38 2005 UTC
# Line 1917  calculate(const struct casefile *cf, voi Line 1917  calculate(const struct casefile *cf, voi
1917    
1918  }  }
1919    
1920    short which_group(const struct group_statistics *g,
1921                      const struct group_properties *p);
1922    
1923  /* Return -1 if the id of a is less than b; +1 if greater than and  /* Return -1 if the id of a is less than b; +1 if greater than and
1924     0 if equal */     0 if equal */
# Line 1925  compare_group_binary(const struct group_ Line 1927  compare_group_binary(const struct group_
1927                       const struct group_statistics *b,                       const struct group_statistics *b,
1928                       const struct group_properties *p)                       const struct group_properties *p)
1929  {  {
     
1930    short flag_a;    short flag_a;
1931    short flag_b;    short flag_b;
1932      
1933    if ( p->criterion == CMP_LE )    if ( p->criterion == CMP_LE )
1934      {      {
1935          /* less-than-or-equal comparision is not meaningfull for
1936             alpha variables, so we shouldn't ever arrive here */
1937        assert(p->indep_width == 0 ) ;        assert(p->indep_width == 0 ) ;
1938          
1939        flag_a = ( a->id.f < p->v.critical_value ) ;        flag_a = ( a->id.f < p->v.critical_value ) ;
1940        flag_b = ( b->id.f < p->v.critical_value ) ;        flag_b = ( b->id.f < p->v.critical_value ) ;
1941      }      }
1942    else    else
1943      {      {
1944        flag_a = ( a->id.f == p->v.critical_value ) ;        flag_a = which_group(a, p);
1945        flag_b = ( b->id.f == p->v.critical_value ) ;        flag_b = which_group(b, p);
1946      }      }
1947    
1948    if ( flag_a == flag_b)    if (flag_a < flag_b )
1949      return 0 ;      return -1;
1950      
1951    return ( flag_a < flag_b);    return (flag_a > flag_b);
1952  }  }
1953    
1954  /* This is a degenerate case of a hash, since it can only return three possible  /* This is a degenerate case of a hash, since it can only return three possible
# Line 1964  hash_group_binary(const struct group_sta Line 1968  hash_group_binary(const struct group_sta
1968      }      }
1969    else if ( p->criterion == CMP_EQ)    else if ( p->criterion == CMP_EQ)
1970      {      {
1971        if ( 0 == compare_values (&g->id, &p->v.g_value[0], p->indep_width ))        flag = which_group(g,p);
         flag = 0 ;  
       else if ( 0 == compare_values (&g->id, &p->v.g_value[1], p->indep_width ))  
         flag = 1 ;  
       else  
         flag = 2 ;  
1972      }      }
1973    else    else
1974      assert(0);      assert(0);
1975    
1976    return flag;    return flag;
1977  }  }
1978    
1979    /* return 0 if G belongs to group 0,
1980              1 if it belongs to group 1,
1981              2 if it belongs to neither group */
1982    short
1983    which_group(const struct group_statistics *g,
1984                const struct group_properties *p)
1985    {
1986    
1987      if ( 0 == compare_values (&g->id, &p->v.g_value[0], p->indep_width))
1988        return 0;
1989    
1990      if ( 0 == compare_values (&g->id, &p->v.g_value[1], p->indep_width))
1991        return 1;
1992    
1993      return 2;
1994    }
1995                

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26