polylib: vector.h Source File

- Main Page
- Classes
- Files

- File List
- File Members

# vector.h

Go to the documentation of this file.

    00001 /*
    00002     This file is part of PolyLib.
    00003
    00004     PolyLib is free software: you can redistribute it and/or modify
    00005     it under the terms of the GNU General Public License as published by
    00006     the Free Software Foundation, either version 3 of the License, or
    00007     (at your option) any later version.
    00008
    00009     PolyLib is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012     GNU General Public License for more details.
    00013
    00014     You should have received a copy of the GNU General Public License
    00015     along with PolyLib.  If not, see <http://www.gnu.org/licenses/>.
    00016 */
    00017
    00018 #ifndef _vector_H_
    00019 #define _vector_H_
    00020
    00021 #if defined(__cplusplus)
    00022 extern "C" {
    00023 #endif
    00024
    00025 int ConstraintSimplify(Value *old, Value *n, int len, Value* v);
    00026 Value* value_alloc(int want, int *got);
    00027 void value_free(Value *p, int size);
    00028
    00029 extern void Factorial(int n,Value *result);
    00030 extern void Binomial(int n,int p,Value *result);
    00031 extern void CNP(int a,int b,Value *result);
    00032 extern void Gcd(Value a,Value b,Value *result);
    00033 extern int First_Non_Zero(Value *p, unsigned length);
    00034 extern Vector *Vector_Alloc(unsigned length);
    00035 extern void Vector_Free(Vector *vector);
    00036 extern void  Vector_Print(FILE *Dst, const char *Format, Vector *Vec);
    00037 extern Vector *Vector_Read(void);
    00038 extern void Vector_Set(Value *p,int n,unsigned length);
    00039 extern void Vector_Exchange(Value *p1, Value *p2, unsigned length);
    00040 extern void Vector_Copy(Value *p1, Value *p2, unsigned length);
    00041 extern void Vector_Add(Value *p1,Value *p2,Value *p3,unsigned length);
    00042 extern void Vector_Sub(Value *p1,Value *p2,Value *p3,unsigned length);
    00043 extern void Vector_Or(Value *p1,Value *p2,Value *p3,unsigned length);
    00044 extern void Vector_Scale(Value *p1, Value *p2, Value lambda, unsigned
    00045                          length);
    00046 extern void Vector_AntiScale(Value *p1,Value *p2,Value lambda,
    00047                                         unsigned length);
    00048 extern void Vector_Oppose(Value *p1, Value *p2, unsigned length);
    00049 extern void Inner_Product(Value *p1,Value *p2,unsigned length, Value *result);
    00050 extern void Vector_Max(Value *p,unsigned length, Value *result);
    00051 extern void Vector_Min(Value *p,unsigned length, Value *result);
    00052 extern void Vector_Combine(Value *p1,Value *p2,Value *p3,Value
    00053                             lambda, Value mu, unsigned length);
    00054 extern int  Vector_Equal(Value *Vec1,Value *Vec2,unsigned n);
    00055 extern void Vector_Min_Not_Zero(Value *p,unsigned length,int *index,Value
    00056                      *result);
    00057 extern void Vector_Gcd(Value *p,unsigned length,Value *result);
    00058 extern void Vector_Map(Value *p1,Value *p2,Value *p3,unsigned
    00059                        length, Value *(*f)(Value,Value));
    00060 extern void Vector_Normalize(Value *p,unsigned length);
    00061 extern void Vector_Normalize_Positive(Value *p,int length,
    00062                                       int pos);
    00063 extern void Vector_Reduce(Value *p,unsigned length,
    00064                   void(*f)(Value,Value *),Value *result);
    00065 extern void Vector_Sort(Value *vector,unsigned n);
    00066 extern int Vector_IsZero(Value * v, unsigned length);
    00067
    00068 #if defined(__cplusplus)
    00069 }
    00070 #endif
    00071
    00072 #endif /* _vector_H_ */