⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.cc

📁 贝叶斯优化算法是一种新的演化算法
💻 CC
字号:
// ################################################################################
//
// name:          utils.cc
//
// author:        Martin Pelikan
//
// purpose:       functions use elsewhere for swapping values of the variables
//                of various data types, and some more miscellaneous utils
//
// last modified: February 1999
//
// ################################################################################

#include <stdio.h>

#include "utils.h"

// ================================================================================
//
// name:          swapInt
//
// function:      swaps the two integers
//
// parameters:    a............a pointer to the first number to exchange
//                b............a pointer to the second number to exchange
//
// returns:       (int) 0
//
// ================================================================================

int swapInt(int *a, int *b)
{
  int aux;
  
  aux = *a;
  *a  = *b;
  *b  = aux;

  return 0;
};

// ================================================================================
//
// name:          swapLong
//
// function:      swaps the two long integers
//
// parameters:    a............a pointer to the first number to exchange
//                b............a pointer to the second number to exchange
//
// returns:       (int) 0
//
// ================================================================================

int swapLong(long *a, long *b)
{
  long aux;
  
  aux = *a;
  *a  = *b;
  *b  = aux;

  return 0;
};

// ================================================================================
//
// name:          swapPointers
//
// function:      swaps the two pointers
//
// parameters:    a............a pointer to the first pointer to exchange
//                b............a pointer to the second pointer to exchange
//
// returns:       (int) 0
//
// ================================================================================

void swapPointers(void **a, void **b)
{
  void *aux;

  aux = *a;
  *a  = *b;
  *b  = aux;
}

// ================================================================================
//
// name:          printSpaces
//
// function:      prints out a certain number of spaces
//
// parameters:    out..........a pointer to the output stream
//                num..........a number of spaces to print out
//
// returns:       (int) 0
//
// ================================================================================

int printSpaces(FILE *out, int num)
{
  int i;
 
  for (i=0; i<num; i++)
    fputc(' ',out);

  return 0;
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -