Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

mmath.h File Reference

More...

#include <magic/mobject.h>
#include <magic/mpackarray.h>
#include <math.h>

Go to the source code of this file.

Defines

#define ROUND_DOUBLE_THRESHOLD   1e-15

Typedefs

typedef PackArray< double > Vector

Functions

 BEGIN_NAMESPACE (MagiC)
int rnd (int range)
double frnd ()
double gaussrnd (double stdv)
double sqr (double x)
double sigmoid (double x)
void swap (double &x, double &y)
bool is_undef (double x)
double sum (const Vector &x)
double min (const Vector &x)
int minIndex (const Vector &x)
double max (const Vector &x)
int maxIndex (const Vector &x)
double avg (const Vector &x)
double stddev (const Vector &x)
double stdmerr (const Vector &x)
Vector histogram (const Vector &x, int n)
void add (Vector &x, double m)
void multiply (Vector &x, double m)
void multiplyToUnity (Vector &x)


Detailed Description

Definition in file mmath.h.


Define Documentation

#define ROUND_DOUBLE_THRESHOLD   1e-15
 

Threshold for rounding values in certain functions.

Definition at line 124 of file mmath.h.


Typedef Documentation

typedef PackArray<double> Vector
 

Vector is just an alias for the PackArray<double>, not even a subclass.

Definition at line 85 of file mmath.h.


Function Documentation

void add Vector   x,
double    m
 

Adds a value to the Vector .

Definition at line 112 of file mmath.cc.

References PackArray::size().

Referenced by multiplyToUnity().

double avg const Vector   x
 

Average of the values in Vector x.

Definition at line 58 of file mmath.cc.

References PackArray::size(), and sum().

Referenced by stddev().

BEGIN_NAMESPACE MagiC   
 

This file is part of the MagiC++ library.

* * Copyright (C) 1998-2002 Marko Grönroos <magi@iki.fi> * *

* This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; see the file COPYING.LIB. If * not, write to the Free Software Foundation, Inc., 59 Temple Place *

  • Suite 330, Boston, MA 02111-1307, USA. * *

double frnd  
 

Returns a double-float random value between 0 and 1.

Definition at line 408 of file mobject.cc.

double gaussrnd double    stdv
 

Returns a normally distributed random value with the given standard deviation.

Definition at line 412 of file mobject.cc.

Vector histogram const Vector   x,
int    n
 

Creates a histogram with n slots of the values in the Vector.

Definition at line 74 of file mmath.cc.

References PackArray::make(), max(), min(), and PackArray::size().

bool is_undef double    x [inline]
 

Retuns if the given value has an "undefined" value.

Definition at line 78 of file mmath.h.

Referenced by max(), maxIndex(), min(), and minIndex().

double max const Vector   x
 

Largest value in Vector x.

Definition at line 39 of file mmath.cc.

References is_undef(), max(), and PackArray::size().

Referenced by histogram(), max(), and maxIndex().

int maxIndex const Vector   x
 

The index of the largest value in Vector x.

Definition at line 47 of file mmath.cc.

References is_undef(), max(), and PackArray::size().

double min const Vector   x
 

Lowest value in Vector x.

Definition at line 20 of file mmath.cc.

References is_undef(), min(), and PackArray::size().

Referenced by histogram(), min(), and minIndex().

int minIndex const Vector   x
 

The index of the lowest value in Vector x.

Definition at line 28 of file mmath.cc.

References is_undef(), min(), and PackArray::size().

void multiply Vector   x,
double    m
 

Multiplies the values in the Vector with a coefficient.

Definition at line 117 of file mmath.cc.

References PackArray::size().

Referenced by multiplyToUnity().

void multiplyToUnity Vector   x
 

Multiplies the values in the Vector so that they sum to 1.0.

Definition at line 122 of file mmath.cc.

References add(), multiply(), PackArray::size(), and sum().

int rnd int    range
 

Returns a random integer value in range 0..range-1.

Definition at line 404 of file mobject.cc.

double sigmoid double    x [inline]
 

Standard sigmoid (logistic) function.

Definition at line 63 of file mmath.h.

double sqr double    x [inline]
 

Square x^2.

Definition at line 52 of file mmath.h.

References sqr().

Referenced by sqr().

double stddev const Vector   x
 

Standard deviation of the values in Vector x.

Definition at line 62 of file mmath.cc.

References avg(), and PackArray::size().

Referenced by stdmerr().

double stdmerr const Vector   x
 

Standard error of the values in Vector x.

Definition at line 70 of file mmath.cc.

References PackArray::size(), and stddev().

double sum const Vector   x
 

Sum of values in Vector x.

Definition at line 13 of file mmath.cc.

References PackArray::size().

Referenced by avg(), Matrix::multiplyToSum(), and multiplyToUnity().

void swap double &    x,
double &    y
[inline]
 

Simple swap operation on doubles.

Definition at line 72 of file mmath.h.


Generated on Thu Feb 10 20:06:43 2005 for LibMagiC by doxygen1.2.18