Fast Auxiliary Space Preconditioning 2.7.7 Aug/28/2022
Loading...
Searching...
No Matches
AuxVector.c File Reference

Simple vector operations – init, set, copy, etc. More...

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

Go to the source code of this file.

Functions

SHORT fasp_dvec_isnan (const 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_rand (const INT n, dvector *x)
 Generate fake random REAL vector in the range from 0 to 1. More...
 
void fasp_dvec_set (INT n, dvector *x, const REAL val)
 Initialize dvector x[i]=val for i=0:n-1. More...
 
void fasp_ivec_set (INT n, ivector *u, const INT m)
 Set ivector value to be m. More...
 
void fasp_dvec_cp (const dvector *x, dvector *y)
 Copy dvector x to dvector y. More...
 
REAL fasp_dvec_maxdiff (const dvector *x, const dvector *y)
 Maximal difference of two dvector x and y. More...
 
void fasp_dvec_symdiagscale (dvector *b, const dvector *diag)
 Symmetric diagonal scaling D^{-1/2}b. More...
 

Detailed Description

Simple vector operations – init, set, copy, etc.

Note
This file contains Level-0 (Aux) functions. It requires: AuxThreads.c

Copyright (C) 2009–Present by the FASP team. All rights reserved.

Released under the terms of the GNU Lesser General Public License 3.0 or later.

Definition in file AuxVector.c.

Function Documentation

◆ fasp_dvec_alloc()

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 105 of file AuxVector.c.

◆ fasp_dvec_cp()

void fasp_dvec_cp ( const 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 334 of file AuxVector.c.

◆ fasp_dvec_create()

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 62 of file AuxVector.c.

◆ fasp_dvec_free()

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 145 of file AuxVector.c.

◆ fasp_dvec_isnan()

SHORT fasp_dvec_isnan ( const 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 39 of file AuxVector.c.

◆ fasp_dvec_maxdiff()

REAL fasp_dvec_maxdiff ( const dvector x,
const 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 357 of file AuxVector.c.

◆ fasp_dvec_rand()

void fasp_dvec_rand ( const INT  n,
dvector x 
)

Generate fake 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 192 of file AuxVector.c.

◆ fasp_dvec_set()

void fasp_dvec_set ( INT  n,
dvector x,
const 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 222 of file AuxVector.c.

◆ fasp_dvec_symdiagscale()

void fasp_dvec_symdiagscale ( dvector b,
const 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 410 of file AuxVector.c.

◆ fasp_ivec_alloc()

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 125 of file AuxVector.c.

◆ fasp_ivec_create()

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 84 of file AuxVector.c.

◆ fasp_ivec_free()

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 164 of file AuxVector.c.

◆ fasp_ivec_set()

void fasp_ivec_set ( INT  n,
ivector u,
const INT  m 
)

Set ivector value to be m.

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

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

Definition at line 291 of file AuxVector.c.