Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
vec.c File Reference

Simple operations for vectors. More...

#include <math.h>
#include "fasp.h"
#include "fasp_functs.h"

Go to the source code of this file.

Functions

INT fasp_dvec_isnan (dvector *u)
 Check a dvector whether there is NAN. More...
 
dvector fasp_dvec_create (const INT m)
 Create dvector data space of REAL type. More...
 
ivector fasp_ivec_create (const INT m)
 Create vector data space of INT type. More...
 
void fasp_dvec_alloc (const INT m, dvector *u)
 Create dvector data space of REAL type. More...
 
void fasp_ivec_alloc (const INT m, ivector *u)
 Create vector data space of INT type. More...
 
void fasp_dvec_free (dvector *u)
 Free vector data space of REAL type. More...
 
void fasp_ivec_free (ivector *u)
 Free vector data space of INT type. More...
 
void fasp_dvec_null (dvector *x)
 Initialize dvector. More...
 
void fasp_dvec_rand (const INT n, dvector *x)
 Generate random REAL vector in the range from 0 to 1. More...
 
void fasp_dvec_set (INT n, dvector *x, REAL val)
 Initialize dvector x[i]=val for i=0:n-1. More...
 
void fasp_ivec_set (const INT m, ivector *u)
 Set ivector value to be m. More...
 
void fasp_dvec_cp (dvector *x, dvector *y)
 Copy dvector x to dvector y. More...
 
REAL fasp_dvec_maxdiff (dvector *x, dvector *y)
 Maximal difference of two dvector x and y. More...
 
void fasp_dvec_symdiagscale (dvector *b, dvector *diag)
 Symmetric diagonal scaling D^{-1/2}b. More...
 

Detailed Description

Simple operations for vectors.

Note
All structures should be initialized before usage.

Definition in file vec.c.

Function Documentation

void fasp_dvec_alloc ( const INT  m,
dvector u 
)

Create dvector data space of REAL type.

Parameters
mNumber of rows
uPointer to dvector (OUTPUT)
Author
Chensong Zhang
Date
2010/04/06

Definition at line 99 of file vec.c.

void fasp_dvec_cp ( dvector x,
dvector y 
)

Copy dvector x to dvector y.

Parameters
xPointer to dvector
yPointer to dvector (MODIFIED)
Author
Chensong Zhang
Date
11/16/2009

Definition at line 345 of file vec.c.

dvector fasp_dvec_create ( const INT  m)

Create dvector data space of REAL type.

Parameters
mNumber of rows
Returns
u The new dvector
Author
Chensong Zhang
Date
2010/04/06

Definition at line 56 of file vec.c.

void fasp_dvec_free ( dvector u)

Free vector data space of REAL type.

Parameters
uPointer to dvector which needs to be deallocated
Author
Chensong Zhang
Date
2010/04/03

Definition at line 139 of file vec.c.

INT fasp_dvec_isnan ( dvector u)

Check a dvector whether there is NAN.

Parameters
uPointer to dvector
Returns
Return TRUE if there is NAN
Author
Chensong Zhang
Date
2013/03/31

Definition at line 33 of file vec.c.

REAL fasp_dvec_maxdiff ( dvector x,
dvector y 
)

Maximal difference of two dvector x and y.

Parameters
xPointer to dvector
yPointer to dvector
Returns
Maximal norm of x-y
Author
Chensong Zhang
Date
11/16/2009

Modified by chunsheng Feng, Zheng Li

Date
06/30/2012

Definition at line 368 of file vec.c.

void fasp_dvec_null ( dvector x)

Initialize dvector.

Parameters
xPointer to dvector which needs to be initialized
Author
Chensong Zhang
Date
2010/04/03

Definition at line 177 of file vec.c.

void fasp_dvec_rand ( const INT  n,
dvector x 
)

Generate random REAL vector in the range from 0 to 1.

Parameters
nSize of the vector
xPointer to dvector
Note
Sample usage:
dvector xapp;
fasp_dvec_create(100,&xapp);
fasp_dvec_rand(100,&xapp);
fasp_dvec_print(100,&xapp);
Author
Chensong Zhang
Date
11/16/2009

Definition at line 203 of file vec.c.

void fasp_dvec_set ( INT  n,
dvector x,
REAL  val 
)

Initialize dvector x[i]=val for i=0:n-1.

Parameters
nNumber of variables
xPointer to dvector
valInitial value for the vector
Author
Chensong Zhang
Date
11/16/2009

Modified by Chunsheng Feng, Xiaoqiang Yue on 05/23/2012

Definition at line 235 of file vec.c.

void fasp_dvec_symdiagscale ( dvector b,
dvector diag 
)

Symmetric diagonal scaling D^{-1/2}b.

Parameters
bPointer to dvector
diagPointer to dvector: the diagonal entries
Author
Xiaozhe Hu
Date
01/31/2011

Definition at line 421 of file vec.c.

void fasp_ivec_alloc ( const INT  m,
ivector u 
)

Create vector data space of INT type.

Parameters
mNumber of rows
uPointer to ivector (OUTPUT)
Author
Chensong Zhang
Date
2010/04/06

Definition at line 119 of file vec.c.

ivector fasp_ivec_create ( const INT  m)

Create vector data space of INT type.

Parameters
mNumber of rows
Returns
u The new ivector
Author
Chensong Zhang
Date
2010/04/06

Definition at line 78 of file vec.c.

void fasp_ivec_free ( ivector u)

Free vector data space of INT type.

Parameters
uPointer to ivector which needs to be deallocated
Author
Chensong Zhang
Date
2010/04/03
Note
This function is same as fasp_dvec_free except input type.

Definition at line 159 of file vec.c.

void fasp_ivec_set ( const INT  m,
ivector u 
)

Set ivector value to be m.

Parameters
mInteger value of ivector
uPointer to ivector (MODIFIED)
Author
Chensong Zhang
Date
04/03/2010

Modified by Chunsheng Feng, Xiaoqiang Yue

Date
05/23/2012

Definition at line 304 of file vec.c.