File:  [CENS] / python / pyGiNaC / wrappers / flags.py
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Apr 11 20:31:30 2001 UTC (16 years, 7 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Exposed lots of functions. Documented most important classes/functions. minor_version = 2

# This file is part of the PyGiNaC package.
# http://cens.ioc.ee/projects/pyginac/
#
# $Revision: 1.2 $
# $Id: flags.py,v 1.2 2001-04-11 20:31:30 pearu Exp $
#
# Copyright 2001 Pearu Peterson all rights reserved,
# Pearu Peterson <pearu@cens.ioc.ee>
# Permission to use, modify, and distribute this software is given under the
# terms of the LGPL.  See http://www.fsf.org
#
# NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
#

#TODO:
# All members of enum's should be readonly.

#STARTPROTO

class info_flags:
    """Possible attributes an object can have.
    Answered by class numeric:
      numeric, real, rational, integer, crational, cinteger, positive,
      negative, nonnegative, posint, negint, nonnegint, even, odd,
      prime
    Answered by class relation:
      relation, relation_equal, relation_not_equal, relation_less,
      relation_less_or_equal, relation_greater,
      relation_greater_or_equal
    Answered by class symbol:
      symbol
    Answered by class lst:
      list
    Answered by class exprseq:
      exprseq
    Answered by classes numeric, symbol, add, mul, power:
      polynomial, integer_polynomial, cinteger_polynomial,
      rational_polynomial, crational_polynomial, rational_function,
      algebraic
    Answered by class indexed:
      indexed      - class can carry indices
      has_indices  - object has at least one index
    Answered by class idx:
      idx
    """
class series_options:
    """Flags to control series expansion:

    suppress_branchcut
    """

class determinant_algo:
    """Switch to control algorithm for determinant computation.
    automatic - let the system choose  
    gauss     - Gauss elimiation
    divfree   - Division-free elimination
    laplace   - Laplace (or minor) elimination
    bareiss   - Bareiss fraction-free elimination
    """
    automatic = 0

class expand_options:
    """expand_trigonometric
    expand_indexed
    """
class solve_algo:
    """automatic
    gauss
    divfree
    bareiss
    """
class return_types:
    """commutative
    noncommutative
    noncommutative_composite
    """

#ENDPROTO

wrapperclass = '''
'''

protos = '''
'''

builder = '''
python::class_builder<GiNaC::expand_options> expand_options_class(this_module, "expand_options");
python::class_builder<GiNaC::series_options> series_options_class(this_module, "series_options");
python::class_builder<GiNaC::determinant_algo> determinant_algo_class(this_module, "determinant_algo");
python::class_builder<GiNaC::solve_algo> solve_algo_class(this_module, "solve_algo");
python::class_builder<GiNaC::status_flags> status_flags_class(this_module, "status_flags");
python::class_builder<GiNaC::info_flags> info_flags_class(this_module, "info_flags");
python::class_builder<GiNaC::return_types> return_types_class(this_module, "return_types");
python::class_builder<GiNaC::remember_strategies> remember_strategies_class(this_module, "remember_strategies");

'''

constructors = '''
'''

defs = ''
defs += '  expand_options_class.add(PyInt_FromLong(GiNaC::expand_options::expand_trigonometric), "expand_trigonometric");\n'
defs += '  expand_options_class.add(PyInt_FromLong(GiNaC::expand_options::expand_indexed), "expand_indexed");\n'
defs += '  series_options_class.add(PyInt_FromLong(GiNaC::series_options::suppress_branchcut), "suppress_branchcut");\n'
for f in 'automatic,gauss,divfree,laplace,bareiss'.split(','):
    defs += '  determinant_algo_class.add(PyInt_FromLong(GiNaC::determinant_algo::%s), "%s");\n'%(f,f)
for f in 'automatic,gauss,divfree,bareiss'.split(','):
    defs += '  solve_algo_class.add(PyInt_FromLong(GiNaC::solve_algo::%s), "%s");\n'%(f,f)
for f in 'dynallocated,evaluated,expanded,hash_calculated'.split(','):
    defs += '  status_flags_class.add(PyInt_FromLong(GiNaC::status_flags::%s), "%s");\n'%(f,f)
for f in '''numeric,real,rational,integer,crational,cinteger, 
positive,negative,nonnegative,posint,negint,nonnegint,even,odd,prime, 
relation,relation_equal,relation_not_equal,relation_less,relation_less_or_equal,
relation_greater,relation_greater_or_equal, 
symbol,list,exprseq,polynomial,integer_polynomial,cinteger_polynomial, 
rational_polynomial,crational_polynomial,rational_function,algebraic, 
indexed,has_indices,idx'''.split(','):
    f = f.strip()
    defs += '  info_flags_class.add(PyInt_FromLong(GiNaC::info_flags::%s), "%s");\n'%(f,f)
for f in 'commutative,noncommutative,noncommutative_composite'.split(','):
    defs += '  return_types_class.add(PyInt_FromLong(GiNaC::return_types::%s), "%s");\n'%(f,f)
for f in 'delete_never,delete_lru,delete_lfu,delete_cyclic'.split(','):
    defs += '  remember_strategies_class.add(PyInt_FromLong(GiNaC::remember_strategies::%s), "%s");\n'%(f,f)


implementation = '''
'''

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>