matrix_ops.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #pragma once
  11. #include <stdbool.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <neatogen/sparsegraph.h>
  16. extern void scadd(double *, int, double, double *);
  17. extern double norm(double *, int);
  18. extern void orthog1(int n, double *vec);
  19. extern void init_vec_orth1(int n, double *vec);
  20. extern void right_mult_with_vector(vtx_data *, int, double *,
  21. double *);
  22. extern void right_mult_with_vector_f(float **, int, double *,
  23. double *);
  24. extern void vectors_subtraction(int, double *, double *, double *);
  25. extern void vectors_addition(int, double *, double *, double *);
  26. extern void vectors_scalar_mult(int, const double *, double, double *);
  27. extern void copy_vector(int n, const double *source, double *dest);
  28. extern double vectors_inner_product(int n, const double *vector1,
  29. const double *vector2);
  30. extern double max_abs(int n, double *vector);
  31. /* sparse matrix extensions: */
  32. extern void right_mult_with_vector_transpose
  33. (double **, int, int, double *, double *);
  34. extern void right_mult_with_vector_d(double **, int, int, double *,
  35. double *);
  36. extern void mult_dense_mat(double **, float **, int, int, int,
  37. float ***C);
  38. extern void mult_dense_mat_d(double **, float **, int, int, int,
  39. double ***CC);
  40. extern void mult_sparse_dense_mat_transpose(vtx_data *, double **, int,
  41. int, float ***);
  42. extern bool power_iteration(double **, int, int, double **, double *);
  43. /*****************************
  44. ** Single precision (float) **
  45. ** version **
  46. *****************************/
  47. extern void orthog1f(int n, float *vec);
  48. extern void right_mult_with_vector_ff(float *, int, float *, float *);
  49. extern void vectors_subtractionf(int, float *, float *, float *);
  50. extern void vectors_additionf(int n, float *vector1, float *vector2,
  51. float *result);
  52. extern void vectors_mult_additionf(int n, float *vector1, float alpha,
  53. float *vector2);
  54. extern void copy_vectorf(int n, float *source, float *dest);
  55. extern double vectors_inner_productf(int n, float *vector1,
  56. float *vector2);
  57. extern void set_vector_val(int n, double val, double *result);
  58. extern void set_vector_valf(int n, float val, float * result);
  59. extern double max_absf(int n, float *vector);
  60. extern void square_vec(int n, float *vec);
  61. extern void invert_vec(int n, float *vec);
  62. extern void sqrt_vecf(int n, float *source, float *target);
  63. extern void invert_sqrt_vec(int n, float *vec);
  64. #ifdef __cplusplus
  65. }
  66. #endif