JasPer  3.0.1
jas_seq.h File Reference

Sequence/Matrix Library. More...

#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_math.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  jas_matrix_t
 Matrix type. More...
 

Functions

static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numrows (const jas_matrix_t *matrix)
 Get the number of rows in a matrix. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numcols (const jas_matrix_t *matrix)
 Get the number of columns in a matrix. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_size (const jas_matrix_t *matrix)
 Get the number of elements in a matrix. More...
 
static JAS_ATTRIBUTE_PURE bool jas_matrix_empty (const jas_matrix_t *matrix)
 Test if a matrix is empty (i.e., contains no elements). More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_get (const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
 Get a matrix element. More...
 
static void jas_matrix_set (jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v)
 Set a matrix element. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_getv (const jas_matrix_t *matrix, jas_matind_t i)
 Get an element from a matrix that is known to be a row or column vector. More...
 
static void jas_matrix_setv (jas_matrix_t *matrix, jas_matind_t i, jas_seqent_t v)
 Set an element in a matrix that is known to be a row or column vector. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_matrix_getref (const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
 Get the address of an element in a matrix. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_matrix_getvref (const jas_matrix_t *matrix, jas_matind_t i)
 Get a reference to a particular row of a 2-D sequence. More...
 
JAS_EXPORT jas_matrix_tjas_matrix_create (jas_matind_t numrows, jas_matind_t numcols)
 Create a matrix with the specified dimensions. More...
 
JAS_EXPORT void jas_matrix_destroy (jas_matrix_t *matrix)
 Destroy a matrix. More...
 
JAS_EXPORT int jas_matrix_resize (jas_matrix_t *matrix, jas_matind_t numrows, jas_matind_t numcols)
 Resize a matrix. The previous contents of the matrix are lost. More...
 
JAS_EXPORT int jas_matrix_output (jas_matrix_t *matrix, FILE *out)
 Write a matrix to a C standard library stream. More...
 
JAS_EXPORT int jas_matrix_bindsub (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r0, jas_matind_t c0, jas_matind_t r1, jas_matind_t c1)
 Create a matrix that references part of another matrix. More...
 
static int jas_matrix_bindrow (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r)
 Create a matrix that is a reference to a row of another matrix. More...
 
static int jas_matrix_bindcol (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t c)
 Create a matrix that is a reference to a column of another matrix. More...
 
JAS_EXPORT void jas_matrix_clip (jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval)
 Clip the values of matrix elements to the specified range. More...
 
JAS_EXPORT void jas_matrix_asl (jas_matrix_t *matrix, unsigned n)
 Arithmetic shift left of all elements in a matrix. More...
 
JAS_EXPORT void jas_matrix_asr (jas_matrix_t *matrix, unsigned n)
 Arithmetic shift right of all elements in a matrix. More...
 
JAS_EXPORT void jas_matrix_divpow2 (jas_matrix_t *matrix, unsigned n)
 Almost-but-not-quite arithmetic shift right of all elements in a matrix. More...
 
JAS_EXPORT void jas_matrix_setall (jas_matrix_t *matrix, jas_seqent_t val)
 Set all elements of a matrix to the specified value. More...
 
static JAS_ATTRIBUTE_PURE size_t jas_matrix_rowstep (const jas_matrix_t *matrix)
 The spacing between rows of a matrix. More...
 
static JAS_ATTRIBUTE_PURE size_t jas_matrix_step (const jas_matrix_t *matrix)
 The spacing between columns of a matrix. More...
 
JAS_EXPORT int jas_matrix_cmp (jas_matrix_t *mat0, jas_matrix_t *mat1)
 Compare two matrices for equality. More...
 
JAS_EXPORT jas_matrix_tjas_matrix_copy (jas_matrix_t *x)
 Copy a matrix. More...
 
JAS_EXPORT jas_matrix_tjas_matrix_input (FILE *)
 Read a matrix from a C standard library stream. More...
 
JAS_EXPORT jas_seq2d_tjas_seq2d_copy (jas_seq2d_t *x)
 Copy a 2-D sequence. More...
 
JAS_EXPORT jas_matrix_tjas_seq2d_create (jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend)
 Create a 2-D sequence. More...
 
static void jas_seq2d_destroy (jas_seq2d_t *s)
 Destroy a 2-D sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xstart (const jas_seq2d_t *s)
 Get the starting x-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_ystart (const jas_seq2d_t *s)
 Get the starting y-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_xend (const jas_seq2d_t *s)
 Get the ending x-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_yend (const jas_seq2d_t *s)
 Get the ending y-coordinate of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_seq2d_getref (const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
 Get a pointer (i.e., reference) to an element of a 2-D sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_seq2d_get (const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
 Get an element of a 2-D sequence. More...
 
static JAS_ATTRIBUTE_PURE size_t jas_seq2d_rowstep (const jas_seq2d_t *s)
 Get the stride between successive rows in the sequence. More...
 
static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_width (const jas_seq2d_t *s)
 Get the number of columns in the sequence. More...
 
static JAS_ATTRIBUTE_PURE unsigned jas_seq2d_height (const jas_seq2d_t *s)
 Get the number of rows in the sequence. More...
 
static void jas_seq2d_setshift (jas_seq2d_t *s, jas_matind_t x, jas_matind_t y)
 Set the shift (i.e., starting x- and y-coordinates) of the sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq2d_size (const jas_seq2d_t *s)
 Get the number of elements in the sequence. More...
 
static JAS_ATTRIBUTE_PURE bool jas_seq2d_empty (const jas_seq2d_t *s)
 Test if the sequence is empty (i.e., contains no elements). More...
 
JAS_EXPORT int jas_seq2d_bindsub (jas_matrix_t *s, jas_matrix_t *s1, jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend)
 Initialize a sequence to reference a subsequence of another sequence. More...
 
static jas_seq_tjas_seq_create (jas_matind_t start, jas_matind_t end)
 Create a 1-D sequence. More...
 
static void jas_seq_destroy (jas_seq_t *seq)
 Destroy a 1-D sequence. More...
 
static void jas_seq_set (jas_seq_t *seq, jas_matind_t i, jas_seqent_t v)
 Set an element of a sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t * jas_seq_getref (const jas_seq_t *seq, jas_matind_t i)
 Get a pointer (i.e., reference) to an element of a sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_seq_get (const jas_seq_t *seq, jas_matind_t i)
 Get an element of a sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_start (const jas_seq_t *seq)
 Get the starting index of a sequence. More...
 
static JAS_ATTRIBUTE_PURE jas_matind_t jas_seq_end (const jas_seq_t *seq)
 Get the ending index of a sequence. More...
 

Detailed Description

Sequence/Matrix Library.