1 /* matrix/rowcol_source.c
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 QUALIFIED_VIEW(_gsl_vector,view)
21 FUNCTION (gsl_matrix, row) (QUALIFIED_TYPE(gsl_matrix) * m, const size_t i)
23 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
27 GSL_ERROR_VAL ("row index is out of range", GSL_EINVAL, view);
31 TYPE(gsl_vector) v = NULL_VECTOR;
33 v.data = m->data + i * MULTIPLICITY * m->tda;
44 QUALIFIED_VIEW(_gsl_vector,view)
45 FUNCTION (gsl_matrix, column) (QUALIFIED_TYPE(gsl_matrix) * m, const size_t j)
47 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
51 GSL_ERROR_VAL ("column index is out of range", GSL_EINVAL, view);
55 TYPE(gsl_vector) v = NULL_VECTOR;
57 v.data = m->data + j * MULTIPLICITY;
68 QUALIFIED_VIEW(_gsl_vector,view)
69 FUNCTION (gsl_matrix, diagonal) (QUALIFIED_TYPE(gsl_matrix) * m)
71 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
73 TYPE(gsl_vector) v = NULL_VECTOR;
75 v.size = GSL_MIN(m->size1,m->size2);
76 v.stride = m->tda + 1;
84 QUALIFIED_VIEW(_gsl_vector,view)
85 FUNCTION (gsl_matrix, subdiagonal) (QUALIFIED_TYPE(gsl_matrix) * m,
88 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
92 GSL_ERROR_VAL ("subdiagonal index is out of range", GSL_EINVAL, view);
96 TYPE(gsl_vector) v = NULL_VECTOR;
98 v.data = m->data + k * MULTIPLICITY * m->tda;
99 v.size = GSL_MIN(m->size1 - k, m->size2);
100 v.stride = m->tda + 1;
109 QUALIFIED_VIEW(_gsl_vector,view)
110 FUNCTION (gsl_matrix, superdiagonal) (QUALIFIED_TYPE(gsl_matrix) * m,
113 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
118 GSL_ERROR_VAL ("column index is out of range", GSL_EINVAL, view);
122 TYPE(gsl_vector) v = NULL_VECTOR;
124 v.data = m->data + k * MULTIPLICITY;
125 v.size = GSL_MIN(m->size1, m->size2 - k);
126 v.stride = m->tda + 1;
135 QUALIFIED_VIEW(_gsl_vector,view)
136 FUNCTION (gsl_matrix, subrow) (QUALIFIED_TYPE(gsl_matrix) * m, const size_t i, const size_t offset, const size_t n)
138 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
142 GSL_ERROR_VAL ("row index is out of range", GSL_EINVAL, view);
146 GSL_ERROR_VAL ("vector length n must be positive integer",
149 else if (offset + n > m->size1)
151 GSL_ERROR_VAL ("dimension n overflows matrix", GSL_EINVAL, view);
155 TYPE(gsl_vector) v = NULL_VECTOR;
157 v.data = m->data + MULTIPLICITY * (i * m->tda + offset);
168 QUALIFIED_VIEW(_gsl_vector,view)
169 FUNCTION (gsl_matrix, subcolumn) (QUALIFIED_TYPE(gsl_matrix) * m, const size_t j, const size_t offset, const size_t n)
171 QUALIFIED_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
175 GSL_ERROR_VAL ("column index is out of range", GSL_EINVAL, view);
179 GSL_ERROR_VAL ("vector length n must be positive integer",
182 else if (offset + n > m->size2)
184 GSL_ERROR_VAL ("dimension n overflows matrix", GSL_EINVAL, view);
188 TYPE(gsl_vector) v = NULL_VECTOR;
190 v.data = m->data + MULTIPLICITY * (offset * m->tda + j);