Graphviz 16.0.1~dev.20260815.2250
Loading...
Searching...
No Matches
general.c File Reference
#include "config.h"
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <sparse/general.h>
#include <errno.h>
#include <util/alloc.h>
#include <util/sort.h>
Include dependency graph for general.c:

Go to the source code of this file.

Functions

double drand (void)
 
double * vector_subtract_to (size_t n, double *x, double *y)
 y = x-y
 
double vector_product (int n, double *x, double *y)
 
double * vector_saxpy (size_t n, double *x, double *y, double beta)
 y = x+beta*y
 
double * vector_saxpy2 (size_t n, double *x, double *y, double beta)
 x = x+beta*y
 
void vector_float_take (size_t n, float *v, size_t m, size_t *p, float **u)
 
static int comp_ascend (const void *s1, const void *s2, void *values)
 
size_t * vector_ordering (size_t n, double *v)
 
double distance_cropped (double *x, int dim, int i, int j)
 
double distance (double *x, int dim, int i, int j)
 
double point_distance (double *p1, double *p2, int dim)
 
char * strip_dir (char *s)
 

Function Documentation

◆ comp_ascend()

static int comp_ascend ( const void *  s1,
const void *  s2,
void *  values 
)
static

compare two double vector values’ indices

Parameters
s1Index of the first value
s2Index of the second value
valuesValues themselves
Returns
Comparison result

Definition at line 71 of file general.c.

References s1().

Referenced by vector_ordering().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance()

double distance ( double *  x,
int  dim,
int  i,
int  j 
)

Definition at line 100 of file general.c.

References dim, and dist().

Referenced by beautify_leaves(), dist_from_foci(), distance_cropped(), distance_to_group(), furtherest_point_in_list(), get_stress(), ideal_distance_matrix(), LIST(), makeDotGraph(), SparseStressMajorizationSmoother_new(), spring_electrical_embedding(), spring_electrical_embedding_fast(), spring_electrical_embedding_slow(), spring_electrical_spring_embedding(), StressMajorizationSmoother2_new(), StressMajorizationSmoother_smooth(), and TriangleSmoother_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance_cropped()

double distance_cropped ( double *  x,
int  dim,
int  i,
int  j 
)

Definition at line 95 of file general.c.

References dim, dist(), distance(), and MINDIST.

Referenced by get_edge_label_matrix(), improve_contiguity(), QuadTree_repulsive_force_interact(), spring_electrical_embedding(), spring_electrical_embedding_slow(), spring_electrical_spring_embedding(), StressMajorizationSmoother2_new(), and TriangleSmoother_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drand()

double drand ( void  )

◆ point_distance()

double point_distance ( double *  p1,
double *  p2,
int  dim 
)

Definition at line 108 of file general.c.

References dim, and dist().

Referenced by QuadTree_get_nearest_internal(), QuadTree_get_supernodes_internal(), and QuadTree_repulsive_force_interact().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ strip_dir()

char * strip_dir ( char *  s)

Definition at line 116 of file general.c.

Referenced by makeDotGraph().

Here is the caller graph for this function:

◆ vector_float_take()

void vector_float_take ( size_t  n,
float *  v,
size_t  m,
size_t *  p,
float **  u 
)

Definition at line 53 of file general.c.

References gv_calloc().

Referenced by map_optimal_coloring().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vector_ordering()

size_t * vector_ordering ( size_t  n,
double *  v 
)

give the position of the smallest, second smallest etc in vector v

Returns
Positional order

Definition at line 84 of file general.c.

References comp_ascend(), gv_calloc(), and gv_sort().

Referenced by country_graph_coloring().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vector_product()

double vector_product ( int  n,
double *  x,
double *  y 
)

Definition at line 34 of file general.c.

Referenced by conjugate_gradient(), power_method(), and StressMajorizationSmoother_smooth().

Here is the caller graph for this function:

◆ vector_saxpy()

double * vector_saxpy ( size_t  n,
double *  x,
double *  y,
double  beta 
)

Definition at line 41 of file general.c.

Referenced by conjugate_gradient().

Here is the caller graph for this function:

◆ vector_saxpy2()

double * vector_saxpy2 ( size_t  n,
double *  x,
double *  y,
double  beta 
)

Definition at line 47 of file general.c.

Referenced by conjugate_gradient().

Here is the caller graph for this function:

◆ vector_subtract_to()

double * vector_subtract_to ( size_t  n,
double *  x,
double *  y 
)

Definition at line 29 of file general.c.

Referenced by conjugate_gradient().

Here is the caller graph for this function: