~ubuntu-branches/debian/sid/gsl/sid

« back to all changes in this revision

Viewing changes to matrix/gsl_matrix_ulong.h

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2008-12-16 06:17:55 UTC
  • mfrom: (1.3.2 upstream) (3.1.15 jaunty)
  • Revision ID: james.westby@ubuntu.com-20081216061755-9la7p0qwrhopk8pl
Tags: 1.12+dfsg-1
* New upstream version released today

* doc/*: As before, removed the 'non-free' documentation to create a 
  source package that complies with Debian's interpretation of what is free. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <stdlib.h>
24
24
#include <gsl/gsl_types.h>
25
25
#include <gsl/gsl_errno.h>
 
26
#include <gsl/gsl_inline.h>
26
27
#include <gsl/gsl_check_range.h>
27
28
#include <gsl/gsl_vector_ulong.h>
28
29
 
204
205
 
205
206
/* Operations */
206
207
 
207
 
unsigned long   gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j);
208
 
void    gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x);
209
 
 
210
 
unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j);
211
 
const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j);
212
 
 
213
208
void gsl_matrix_ulong_set_zero (gsl_matrix_ulong * m);
214
209
void gsl_matrix_ulong_set_identity (gsl_matrix_ulong * m);
215
210
void gsl_matrix_ulong_set_all (gsl_matrix_ulong * m, unsigned long x);
256
251
int gsl_matrix_ulong_get_col(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t j);
257
252
int gsl_matrix_ulong_set_row(gsl_matrix_ulong * m, const size_t i, const gsl_vector_ulong * v);
258
253
int gsl_matrix_ulong_set_col(gsl_matrix_ulong * m, const size_t j, const gsl_vector_ulong * v);
 
254
/***********************************************************************/
259
255
 
260
256
/* inline functions if you are using GCC */
261
257
 
 
258
INLINE_DECL unsigned long   gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j);
 
259
INLINE_DECL void    gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x);
 
260
INLINE_DECL unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j);
 
261
INLINE_DECL const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j);
 
262
 
262
263
#ifdef HAVE_INLINE
263
 
extern inline 
 
264
INLINE_FUN 
264
265
unsigned long
265
266
gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j)
266
267
{
267
268
#if GSL_RANGE_CHECK
268
 
  if (i >= m->size1)
269
 
    {
270
 
      GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
271
 
    }
272
 
  else if (j >= m->size2)
273
 
    {
274
 
      GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
 
269
  if (GSL_RANGE_COND(1)) 
 
270
    {
 
271
      if (i >= m->size1)
 
272
        {
 
273
          GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ;
 
274
        }
 
275
      else if (j >= m->size2)
 
276
        {
 
277
          GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ;
 
278
        }
275
279
    }
276
280
#endif
277
281
  return m->data[i * m->tda + j] ;
278
282
279
283
 
280
 
extern inline 
 
284
INLINE_FUN 
281
285
void
282
286
gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x)
283
287
{
284
288
#if GSL_RANGE_CHECK
285
 
  if (i >= m->size1)
286
 
    {
287
 
      GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
288
 
    }
289
 
  else if (j >= m->size2)
290
 
    {
291
 
      GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
 
289
  if (GSL_RANGE_COND(1)) 
 
290
    {
 
291
      if (i >= m->size1)
 
292
        {
 
293
          GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ;
 
294
        }
 
295
      else if (j >= m->size2)
 
296
        {
 
297
          GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ;
 
298
        }
292
299
    }
293
300
#endif
294
301
  m->data[i * m->tda + j] = x ;
295
302
}
296
303
 
297
 
extern inline 
 
304
INLINE_FUN 
298
305
unsigned long *
299
306
gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j)
300
307
{
301
308
#if GSL_RANGE_CHECK
302
 
  if (i >= m->size1)
303
 
    {
304
 
      GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
305
 
    }
306
 
  else if (j >= m->size2)
307
 
    {
308
 
      GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
 
309
  if (GSL_RANGE_COND(1)) 
 
310
    {
 
311
      if (i >= m->size1)
 
312
        {
 
313
          GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
 
314
        }
 
315
      else if (j >= m->size2)
 
316
        {
 
317
          GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
 
318
        }
309
319
    }
310
320
#endif
311
321
  return (unsigned long *) (m->data + (i * m->tda + j)) ;
312
322
313
323
 
314
 
extern inline 
 
324
INLINE_FUN 
315
325
const unsigned long *
316
326
gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j)
317
327
{
318
328
#if GSL_RANGE_CHECK
319
 
  if (i >= m->size1)
320
 
    {
321
 
      GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
322
 
    }
323
 
  else if (j >= m->size2)
324
 
    {
325
 
      GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
 
329
  if (GSL_RANGE_COND(1)) 
 
330
    {
 
331
      if (i >= m->size1)
 
332
        {
 
333
          GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ;
 
334
        }
 
335
      else if (j >= m->size2)
 
336
        {
 
337
          GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ;
 
338
        }
326
339
    }
327
340
#endif
328
341
  return (const unsigned long *) (m->data + (i * m->tda + j)) ;