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

📄 get_range_min.c

📁 稀疏矩阵、链表、图、队列、二叉树、多叉树、排序、遗传算法等的实现
💻 C
字号:
/**************************************************************************
**  SP_GET_RANGE_MIN                                                     **
**                                                                       **
**    Retrieve the minimum range value associated with a passed          **
**  dimension.                                                           **
**                                                                       **
**  INPUT:                                                               **
**    sp -- The sparse matrix from which the range value is to be        **
**          retrieved.                                                   **
**    dim -- The dimension of the minimum range value                    **
**                                                                       **
**  OUTPUT:                                                              **
**    int -- The minimum range value                                     **
**                                                                       **
**  SIDE EFFECTS:                                                        **
**    The error_no field of the sparse matrix can be set to an error if  **
**  an error is encountered.  Whenever an error is encountered, this     **
**  value is set and a NULL pointer is returned.  Thus, if a NULL        **
**  pointer is returned from this function it is important to examine    **
**  the error_no of the associated sparse matrix.                        **
**                                                                       **
**  NOTES:                                                               **
**                                                                       **
**************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include "sparse.h"

int sp_get_range_min(SPARSE_MATRIX *sp, int dim)
/* SPARSE_MATRIX *sp  The sparse matrix from which to retrieve the range 
                        value */
/* int dim            The dimension number */
{
  /* If the sparse matrix is empty, then a range value cannot be retrieved */
  if (sp == (SPARSE_MATRIX *)NULL)
  {
    return(0);
  }

  sp->error_no = SP_NOERR;

  /* Make sure that the dimension specified is legal */
  if ((sp->dimensions < dim) || (dim < (int)1))
  {
    sp->error_no = SP_DIM;
    return(0);
  }

  return(*(sp->hdr_ranges + ((dim - 1) * 2)));
}

⌨️ 快捷键说明

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