Commit f2cee38f authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Introduce the np_int definition

parent a7749125
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -282,9 +282,9 @@ void cluster(string config_file, string data_file, string output_path) {
    tppoan.open(tppoan_name.c_str(), ios::out | ios::binary);
    if (tppoan.is_open()) {
#ifdef USE_LAPACK
      printf("INFO: should use LAPACK calls.\n");
      printf("INFO: using LAPACK calls.\n");
#else
      printf("INFO: should use fall-back lucin() calls.\n");
      printf("INFO: using fall-back lucin() calls.\n");
#endif
      tppoan.write(reinterpret_cast<char *>(&iavm), sizeof(int));
      tppoan.write(reinterpret_cast<char *>(&isam), sizeof(int));
+9 −5
Original line number Diff line number Diff line
@@ -10,13 +10,17 @@
 * legacy serial function implementation is used as a fall-back.
 */

#ifndef lapack_int
#define lapack_int int64_t
#endif

#ifndef INCLUDE_ALGEBRAIC_H_
#define INCLUDE_ALGEBRAIC_H_

#ifndef np_int
#ifndef lapack_int
#define np_int int64_t
#else
#define np_int lapack_int
#endif
#endif

/*! \brief Perform in-place matrix inversion.
 *
 * \param mat: Matrix of complex. The matrix to be inverted (must be a square matrix).
@@ -25,6 +29,6 @@
 * \param max_size: `lapack_int` The maximum expected size (required by some call-backs,
 * optional, defaults to 0).
 */
void invert_matrix(std::complex<double> **mat, lapack_int size, int &ier, lapack_int max_size=0);
void invert_matrix(std::complex<double> **mat, np_int size, int &ier, np_int max_size=0);

#endif
+9 −1
Original line number Diff line number Diff line
@@ -15,6 +15,14 @@
#ifndef INCLUDE_CLU_SUBS_H_
#define INCLUDE_CLU_SUBS_H_

#ifndef np_int
#ifndef lapack_int
#define np_int int64_t
#else
#define np_int lapack_int
#endif
#endif

/*! \brief Compute the asymmetry-corrected scattering cross-section of a cluster.
 *
 * This function computes the product between the geometrical asymmetry parameter and
@@ -158,7 +166,7 @@ void hjv(
 * \param n: `int64_t`
 * \param ier: `int &`
 */
void lucin(std::complex<double> **am, const int64_t nddmst, int64_t n, int &ier);
void lucin(std::complex<double> **am, const np_int nddmst, np_int n, int &ier);

/*! \brief Compute the average extinction cross-section.
 *
+7 −7
Original line number Diff line number Diff line
@@ -5,26 +5,26 @@

#include <complex>

#ifndef INCLUDE_ALGEBRAIC_H_
#include "../include/algebraic.h"
#endif

#ifndef INCLUDE_LAPACK_CALLS_H_
#include "lapacke.h"
#include "../include/lapack_calls.h"
#endif

#ifndef INCLUDE_ALGEBRAIC_H_
#include "../include/algebraic.h"
#endif

// >>> FALL-BACK FUNCTIONS DECLARATION <<< //
extern void lucin(std::complex<double> **mat, int64_t max_size, int64_t size, int &ier);
extern void lucin(std::complex<double> **mat, np_int max_size, np_int size, int &ier);
// >>>   END OF FALL-BACK FUNCTIONS    <<< //

using namespace std;

void invert_matrix(std::complex<double> **mat, lapack_int size, int &ier, lapack_int max_size) {
void invert_matrix(std::complex<double> **mat, np_int size, int &ier, np_int max_size) {
  ier = 0;
#ifdef USE_LAPACK
  zinvert(mat, size, ier);
#else
  lucin(mat, (int64_t)max_size, (int64_t)size, ier);
  lucin(mat, max_size, size, ier);
#endif
}
+1 −1
Original line number Diff line number Diff line
@@ -892,7 +892,7 @@ void hjv(
  delete[] rfn;
}

void lucin(std::complex<double> **am, const int64_t nddmst, int64_t n, int &ier) {
void lucin(std::complex<double> **am, const np_int nddmst, np_int n, int &ier) {
  /* NDDMST  FIRST DIMENSION OF AM AS DECLARED IN DIMENSION
   *         STATEMENT.
   * N       NUMBER OF ROWS IN AM.
Loading