|
Packit |
67cb25 |
/* matrix/gsl_matrix_short.h
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* This program is free software; you can redistribute it and/or modify
|
|
Packit |
67cb25 |
* it under the terms of the GNU General Public License as published by
|
|
Packit |
67cb25 |
* the Free Software Foundation; either version 3 of the License, or (at
|
|
Packit |
67cb25 |
* your option) any later version.
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* This program is distributed in the hope that it will be useful, but
|
|
Packit |
67cb25 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
67cb25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
67cb25 |
* General Public License for more details.
|
|
Packit |
67cb25 |
*
|
|
Packit |
67cb25 |
* You should have received a copy of the GNU General Public License
|
|
Packit |
67cb25 |
* along with this program; if not, write to the Free Software
|
|
Packit |
67cb25 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit |
67cb25 |
*/
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#ifndef __GSL_MATRIX_SHORT_H__
|
|
Packit |
67cb25 |
#define __GSL_MATRIX_SHORT_H__
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#include <stdlib.h>
|
|
Packit |
67cb25 |
#include <gsl/gsl_types.h>
|
|
Packit |
67cb25 |
#include <gsl/gsl_errno.h>
|
|
Packit |
67cb25 |
#include <gsl/gsl_inline.h>
|
|
Packit |
67cb25 |
#include <gsl/gsl_check_range.h>
|
|
Packit |
67cb25 |
#include <gsl/gsl_vector_short.h>
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#undef __BEGIN_DECLS
|
|
Packit |
67cb25 |
#undef __END_DECLS
|
|
Packit |
67cb25 |
#ifdef __cplusplus
|
|
Packit |
67cb25 |
# define __BEGIN_DECLS extern "C" {
|
|
Packit |
67cb25 |
# define __END_DECLS }
|
|
Packit |
67cb25 |
#else
|
|
Packit |
67cb25 |
# define __BEGIN_DECLS /* empty */
|
|
Packit |
67cb25 |
# define __END_DECLS /* empty */
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
__BEGIN_DECLS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
typedef struct
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
size_t size1;
|
|
Packit |
67cb25 |
size_t size2;
|
|
Packit |
67cb25 |
size_t tda;
|
|
Packit |
67cb25 |
short * data;
|
|
Packit |
67cb25 |
gsl_block_short * block;
|
|
Packit |
67cb25 |
int owner;
|
|
Packit |
67cb25 |
} gsl_matrix_short;
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
typedef struct
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
gsl_matrix_short matrix;
|
|
Packit |
67cb25 |
} _gsl_matrix_short_view;
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
typedef _gsl_matrix_short_view gsl_matrix_short_view;
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
typedef struct
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
gsl_matrix_short matrix;
|
|
Packit |
67cb25 |
} _gsl_matrix_short_const_view;
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
typedef const _gsl_matrix_short_const_view gsl_matrix_short_const_view;
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/* Allocation */
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
gsl_matrix_short *
|
|
Packit |
67cb25 |
gsl_matrix_short_alloc (const size_t n1, const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
gsl_matrix_short *
|
|
Packit |
67cb25 |
gsl_matrix_short_calloc (const size_t n1, const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
gsl_matrix_short *
|
|
Packit |
67cb25 |
gsl_matrix_short_alloc_from_block (gsl_block_short * b,
|
|
Packit |
67cb25 |
const size_t offset,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2,
|
|
Packit |
67cb25 |
const size_t d2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
gsl_matrix_short *
|
|
Packit |
67cb25 |
gsl_matrix_short_alloc_from_matrix (gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t k1,
|
|
Packit |
67cb25 |
const size_t k2,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
gsl_vector_short *
|
|
Packit |
67cb25 |
gsl_vector_short_alloc_row_from_matrix (gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t i);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
gsl_vector_short *
|
|
Packit |
67cb25 |
gsl_vector_short_alloc_col_from_matrix (gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t j);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
void gsl_matrix_short_free (gsl_matrix_short * m);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/* Views */
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_submatrix (gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t i, const size_t j,
|
|
Packit |
67cb25 |
const size_t n1, const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_row (gsl_matrix_short * m, const size_t i);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_column (gsl_matrix_short * m, const size_t j);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_diagonal (gsl_matrix_short * m);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_subdiagonal (gsl_matrix_short * m, const size_t k);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_superdiagonal (gsl_matrix_short * m, const size_t k);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_subrow (gsl_matrix_short * m, const size_t i,
|
|
Packit |
67cb25 |
const size_t offset, const size_t n);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_subcolumn (gsl_matrix_short * m, const size_t j,
|
|
Packit |
67cb25 |
const size_t offset, const size_t n);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_view_array (short * base,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_view_array_with_tda (short * base,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2,
|
|
Packit |
67cb25 |
const size_t tda);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_view_vector (gsl_vector_short * v,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_view
|
|
Packit |
67cb25 |
gsl_matrix_short_view_vector_with_tda (gsl_vector_short * v,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2,
|
|
Packit |
67cb25 |
const size_t tda);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_submatrix (const gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t i, const size_t j,
|
|
Packit |
67cb25 |
const size_t n1, const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_row (const gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t i);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_column (const gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t j);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_diagonal (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_subdiagonal (const gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t k);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_superdiagonal (const gsl_matrix_short * m,
|
|
Packit |
67cb25 |
const size_t k);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_subrow (const gsl_matrix_short * m, const size_t i,
|
|
Packit |
67cb25 |
const size_t offset, const size_t n);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_vector_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_subcolumn (const gsl_matrix_short * m, const size_t j,
|
|
Packit |
67cb25 |
const size_t offset, const size_t n);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_view_array (const short * base,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_view_array_with_tda (const short * base,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2,
|
|
Packit |
67cb25 |
const size_t tda);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_view_vector (const gsl_vector_short * v,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
_gsl_matrix_short_const_view
|
|
Packit |
67cb25 |
gsl_matrix_short_const_view_vector_with_tda (const gsl_vector_short * v,
|
|
Packit |
67cb25 |
const size_t n1,
|
|
Packit |
67cb25 |
const size_t n2,
|
|
Packit |
67cb25 |
const size_t tda);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/* Operations */
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
void gsl_matrix_short_set_zero (gsl_matrix_short * m);
|
|
Packit |
67cb25 |
void gsl_matrix_short_set_identity (gsl_matrix_short * m);
|
|
Packit |
67cb25 |
void gsl_matrix_short_set_all (gsl_matrix_short * m, short x);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
int gsl_matrix_short_fread (FILE * stream, gsl_matrix_short * m) ;
|
|
Packit |
67cb25 |
int gsl_matrix_short_fwrite (FILE * stream, const gsl_matrix_short * m) ;
|
|
Packit |
67cb25 |
int gsl_matrix_short_fscanf (FILE * stream, gsl_matrix_short * m);
|
|
Packit |
67cb25 |
int gsl_matrix_short_fprintf (FILE * stream, const gsl_matrix_short * m, const char * format);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
int gsl_matrix_short_memcpy(gsl_matrix_short * dest, const gsl_matrix_short * src);
|
|
Packit |
67cb25 |
int gsl_matrix_short_swap(gsl_matrix_short * m1, gsl_matrix_short * m2);
|
|
Packit |
67cb25 |
int gsl_matrix_short_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_short * dest, const gsl_matrix_short * src);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
int gsl_matrix_short_swap_rows(gsl_matrix_short * m, const size_t i, const size_t j);
|
|
Packit |
67cb25 |
int gsl_matrix_short_swap_columns(gsl_matrix_short * m, const size_t i, const size_t j);
|
|
Packit |
67cb25 |
int gsl_matrix_short_swap_rowcol(gsl_matrix_short * m, const size_t i, const size_t j);
|
|
Packit |
67cb25 |
int gsl_matrix_short_transpose (gsl_matrix_short * m);
|
|
Packit |
67cb25 |
int gsl_matrix_short_transpose_memcpy (gsl_matrix_short * dest, const gsl_matrix_short * src);
|
|
Packit |
67cb25 |
int gsl_matrix_short_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_short * dest, const gsl_matrix_short * src);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
short gsl_matrix_short_max (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
short gsl_matrix_short_min (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
void gsl_matrix_short_minmax (const gsl_matrix_short * m, short * min_out, short * max_out);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
void gsl_matrix_short_max_index (const gsl_matrix_short * m, size_t * imax, size_t *jmax);
|
|
Packit |
67cb25 |
void gsl_matrix_short_min_index (const gsl_matrix_short * m, size_t * imin, size_t *jmin);
|
|
Packit |
67cb25 |
void gsl_matrix_short_minmax_index (const gsl_matrix_short * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
int gsl_matrix_short_equal (const gsl_matrix_short * a, const gsl_matrix_short * b);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
int gsl_matrix_short_isnull (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
int gsl_matrix_short_ispos (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
int gsl_matrix_short_isneg (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
int gsl_matrix_short_isnonneg (const gsl_matrix_short * m);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
int gsl_matrix_short_add (gsl_matrix_short * a, const gsl_matrix_short * b);
|
|
Packit |
67cb25 |
int gsl_matrix_short_sub (gsl_matrix_short * a, const gsl_matrix_short * b);
|
|
Packit |
67cb25 |
int gsl_matrix_short_mul_elements (gsl_matrix_short * a, const gsl_matrix_short * b);
|
|
Packit |
67cb25 |
int gsl_matrix_short_div_elements (gsl_matrix_short * a, const gsl_matrix_short * b);
|
|
Packit |
67cb25 |
int gsl_matrix_short_scale (gsl_matrix_short * a, const double x);
|
|
Packit |
67cb25 |
int gsl_matrix_short_add_constant (gsl_matrix_short * a, const double x);
|
|
Packit |
67cb25 |
int gsl_matrix_short_add_diagonal (gsl_matrix_short * a, const double x);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/***********************************************************************/
|
|
Packit |
67cb25 |
/* The functions below are obsolete */
|
|
Packit |
67cb25 |
/***********************************************************************/
|
|
Packit |
67cb25 |
int gsl_matrix_short_get_row(gsl_vector_short * v, const gsl_matrix_short * m, const size_t i);
|
|
Packit |
67cb25 |
int gsl_matrix_short_get_col(gsl_vector_short * v, const gsl_matrix_short * m, const size_t j);
|
|
Packit |
67cb25 |
int gsl_matrix_short_set_row(gsl_matrix_short * m, const size_t i, const gsl_vector_short * v);
|
|
Packit |
67cb25 |
int gsl_matrix_short_set_col(gsl_matrix_short * m, const size_t j, const gsl_vector_short * v);
|
|
Packit |
67cb25 |
/***********************************************************************/
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
/* inline functions if you are using GCC */
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
INLINE_DECL short gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j);
|
|
Packit |
67cb25 |
INLINE_DECL void gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x);
|
|
Packit |
67cb25 |
INLINE_DECL short * gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j);
|
|
Packit |
67cb25 |
INLINE_DECL const short * gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j);
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#ifdef HAVE_INLINE
|
|
Packit |
67cb25 |
INLINE_FUN
|
|
Packit |
67cb25 |
short
|
|
Packit |
67cb25 |
gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
#if GSL_RANGE_CHECK
|
|
Packit |
67cb25 |
if (GSL_RANGE_COND(1))
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
if (i >= m->size1)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
else if (j >= m->size2)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
return m->data[i * m->tda + j] ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
INLINE_FUN
|
|
Packit |
67cb25 |
void
|
|
Packit |
67cb25 |
gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
#if GSL_RANGE_CHECK
|
|
Packit |
67cb25 |
if (GSL_RANGE_COND(1))
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
if (i >= m->size1)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
else if (j >= m->size2)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
m->data[i * m->tda + j] = x ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
INLINE_FUN
|
|
Packit |
67cb25 |
short *
|
|
Packit |
67cb25 |
gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
#if GSL_RANGE_CHECK
|
|
Packit |
67cb25 |
if (GSL_RANGE_COND(1))
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
if (i >= m->size1)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
else if (j >= m->size2)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
return (short *) (m->data + (i * m->tda + j)) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
INLINE_FUN
|
|
Packit |
67cb25 |
const short *
|
|
Packit |
67cb25 |
gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
#if GSL_RANGE_CHECK
|
|
Packit |
67cb25 |
if (GSL_RANGE_COND(1))
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
if (i >= m->size1)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
else if (j >= m->size2)
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
return (const short *) (m->data + (i * m->tda + j)) ;
|
|
Packit |
67cb25 |
}
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#endif
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
__END_DECLS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
#endif /* __GSL_MATRIX_SHORT_H__ */
|