Changeset a795c77 in git


Ignore:
Timestamp:
May 27, 2009, 6:15:14 PM (15 years ago)
Author:
Motsak Oleksandr <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
d7ce08deb30fcdd7bf7c010d4972aa3359545c20
Parents:
eedc8463bb5522124aa9067ea9076f8376db5bba
Message:
*motsak: more sBucket API


git-svn-id: file:///usr/local/Singular/svn/trunk@11848 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/sbuckets.cc

    reedc846 ra795c77  
    88 *  Author:  obachman (Olaf Bachmann)
    99 *  Created: 9/00
    10  *  Version: $Id: sbuckets.cc,v 1.2 2004-05-14 16:26:06 levandov Exp $
     10 *  Version: $Id: sbuckets.cc,v 1.3 2009-05-27 16:15:14 motsak Exp $
    1111 *******************************************************************/
    1212#include "mod2.h"
     
    4141
    4242static omBin sBucket_bin = omGetSpecBin(sizeof(sBucket));
     43
     44
     45//////////////////////////////////////////////////////////////////////////
     46// New API:
     47//
     48
     49/// Returns bucket ring
     50const ring sBucketGetRing(const sBucket_pt bucket)
     51{ return bucket->bucket_ring; }
     52
     53/// Copy sBucket non-intrusive!!!
     54sBucket_pt    sBucketCopy(const sBucket_pt bucket)
     55{
     56  const ring r = bucket->bucket_ring;
     57
     58  sBucket_pt newbucket = sBucketCreate(r);
     59
     60  for(int i = 0; bucket->buckets[i].p != NULL; i++)
     61  {
     62    assume( i < (BIT_SIZEOF_LONG - 3) );
     63    assume( pLength(bucket->buckets[i].p) == bucket->buckets[i].length );
     64
     65    newbucket->buckets[i].p = p_Copy(bucket->buckets[i].p, r);
     66    newbucket->buckets[i].length = bucket->buckets[i].length;
     67
     68    assume( pLength(newbucket->buckets[i].p) == newbucket->buckets[i].length );
     69  }
     70
     71  return newbucket;
     72}
    4373
    4474/////////////////////////////////////////////////////////////////////////////
  • kernel/sbuckets.h

    reedc846 ra795c77  
    1010 *  Author:  obachman (Olaf Bachmann)
    1111 *  Created: 9/00
    12  *  Version: $Id: sbuckets.h,v 1.2 2008-07-04 14:17:15 motsak Exp $
     12 *  Version: $Id: sbuckets.h,v 1.3 2009-05-27 16:15:14 motsak Exp $
    1313 *******************************************************************/
    1414#ifndef S_BUCKETS_H
     
    1616
    1717#include "structs.h"
     18
     19
    1820
    1921//////////////////////////////////////////////////////////////////////////
     
    2325void          sBucketDestroy(sBucket_pt *bucket);
    2426
     27
     28//////////////////////////////////////////////////////////////////////////
     29// New API:
     30//
     31
     32/// Copy sBucket non-intrusive!!!
     33sBucket_pt    sBucketCopy(const sBucket_pt bucket);
     34
     35/// Returns bucket ring
     36const ring sBucketGetRing(const sBucket_pt bucket);
    2537
    2638/////////////////////////////////////////////////////////////////////////////
     
    7183//////////////////////////////////////////////////////////////////////////
    7284///
    73 /// Sorts p with bucektSort: assumes all monomials of p are different
     85/// Sorts p with bucketSort: assumes all monomials of p are different
    7486///
    7587poly sBucketSortMerge(poly p, ring r);
     
    7789//////////////////////////////////////////////////////////////////////////
    7890///
    79 /// Sorts p with bucektSort: p may have equal monomials
     91/// Sorts p with bucketSort: p may have equal monomials
    8092///
    8193poly sBucketSortAdd(poly p, ring r);
  • kernel/summator.cc

    reedc846 ra795c77  
    77 *  Author:  motsak
    88 *  Created:
    9  *  Version: $Id: summator.cc,v 1.4 2008-07-25 16:06:18 motsak Exp $
     9 *  Version: $Id: summator.cc,v 1.5 2009-05-27 16:15:14 motsak Exp $
    1010 *******************************************************************/
    1111
     
    7070    poly out;
    7171    int pLength;
    72    
     72
    7373    sBucketClearAdd(m_temp.m_bucket, &out, &pLength);
    7474    sBucketDestroy(&m_temp.m_bucket);
    7575
    7676    if(out != NULL)
    77       p_Delete(&out, m_basering);   
     77      p_Delete(&out, m_basering);
    7878//    m_temp.m_bucket = NULL;
    7979  }
     
    172172}
    173173
     174
     175
     176CPolynomialSummator::CPolynomialSummator(const CPolynomialSummator& b): m_bUsePolynomial(b.m_bUsePolynomial), m_basering(b.m_basering)
     177{
     178  try{
     179    if(m_bUsePolynomial)
     180      m_temp.m_poly = p_Copy( b.m_temp.m_poly, m_basering);
     181    else
     182      m_temp.m_bucket = sBucketCopy(b.m_temp.m_bucket);
     183  }
     184  catch(...)
     185  {
     186    assume(false);
     187  }
     188}
     189
     190
    174191#endif
  • kernel/summator.h

    reedc846 ra795c77  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: summator.h,v 1.2 2008-07-08 08:18:27 Singular Exp $ */
     6/* $Id: summator.h,v 1.3 2009-05-27 16:15:14 motsak Exp $ */
    77
    88// #include <summator.h> // for CPolynomialSummator class
     
    4848    inline operator poly() { return AddUpAndClear(); }
    4949
    50   private: // no copies of this object at the moment!!!
    51     CPolynomialSummator(const CPolynomialSummator& m);               // Copy constructor
    52     CPolynomialSummator& operator= (const CPolynomialSummator& m);   // Assignment operator
     50    /// Copy constructor
     51    CPolynomialSummator(const CPolynomialSummator&);
     52
     53  private:
     54
     55    /// no assignment operator yet
     56    CPolynomialSummator& operator= (const CPolynomialSummator&);
    5357};
    5458
Note: See TracChangeset for help on using the changeset viewer.