Navigation

Operators and Keywords

Function List:

C++ API

sparse.cc File Reference

#include <cstdlib>
#include <string>
#include "variables.h"
#include "utils.h"
#include "pager.h"
#include "defun.h"
#include "gripes.h"
#include "quit.h"
#include "unwind-prot.h"
#include "ov-re-sparse.h"
#include "ov-cx-sparse.h"
#include "ov-bool-sparse.h"
Include dependency graph for sparse.cc:

Functions

 DEFUN (issparse, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} issparse (@var{x})\n\ Return true if @var{x} is a sparse matrix.\n\ @seealso{ismatrix}\n\ @end deftypefn")
 DEFUN (sparse, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{s} =} sparse (@var{a})\n\ @deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\ @deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv})\n\ @deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{s}, @var{m}, @var{n}, \"unique\")\n\ @deftypefnx {Loadable Function} {@var{s} =} sparse (@var{m}, @var{n})\n\ Create a sparse matrix from the full matrix or row, column, value triplets.\n\ If @var{a} is a full matrix, convert it to a sparse matrix representation,\n\ removing all zero values in the process.\n\ \n\ Given the integer index vectors @var{i} and @var{j}, a 1-by-@code{nnz} vector\n\ of real of complex values @var{sv}, overall dimensions @var{m} and @var{n}\n\ of the sparse matrix. The argument @code{nzmax} is ignored but accepted for\n\ compatibility with @sc{matlab}. If @var{m} or @var{n} are not specified\n\ their values are derived from the maximum index in the vectors @var{i} and\n\ @var{j} as given by @code{@var{m} = max (@var{i})},\n\ @code{@var{n} = max (@var{j})}.\n\ \n\ @strong{Note}: if multiple values are specified with the same\n\ @var{i}, @var{j} indices, the corresponding values in @var{s} will\n\ be added.\n\ \n\ The following are all equivalent:\n\ \n\ @example\n\ @group\n\ s = sparse (i, j, s, m, n)\n\ s = sparse (i, j, s, m, n, \"summation\")\n\ s = sparse (i, j, s, m, n, \"sum\")\n\ @end group\n\ @end example\n\ \n\ Given the option \"unique\". if more than two values are specified for the\n\ same @var{i}, @var{j} indices, the last specified value will be used.\n\ \n\ @code{sparse(@var{m}, @var{n})} is equivalent to\n\ @code{sparse ([], [], [], @var{m}, @var{n}, 0)}\n\ \n\ If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\ to have a common size.\n\ @seealso{full}\n\ @end deftypefn")
 DEFUN (spalloc, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{s} =} spalloc (@var{m}, @var{n}, @var{nz})\n\ Create an @var{m}-by-@var{n} sparse matrix with pre-allocated space for at\n\ most @var{nz} nonzero elements. This is useful for building the matrix\n\ incrementally by a sequence of indexed assignments. Subsequent indexed\n\ assignments will reuse the pre-allocated memory, provided they are of one of\n\ the simple forms\n\ \n\ @itemize\n\ @item @code{@var{s}(I:J) = @var{x}}\n\ \n\ @item @code{@var{s}(:,I:J) = @var{x}}\n\ \n\ @item @code{@var{s}(K:L,I:J) = @var{x}}\n\ @end itemize\n\ \n\ @b{and} that the following conditions are met:\n\ \n\ @itemize\n\ @item the assignment does not decrease nnz(@var{S}).\n\ \n\ @item after the assignment, nnz(@var{S}) does not exceed @var{nz}.\n\ \n\ @item no index is out of bounds.\n\ @end itemize\n\ \n\ Partial movement of data may still occur, but in general the assignment will\n\ be more memory and time-efficient under these circumstances. In particular,\n\ it is possible to efficiently build a pre-allocated sparse matrix from\n\ contiguous block of columns.\n\ \n\ The amount of pre-allocated memory for a given matrix may be queried using\n\ the function @code{nzmax}.\n\ @seealso{nzmax, sparse}\n\ @end deftypefn")

Function Documentation

DEFUN ( issparse  ,
args   
)
DEFUN ( spalloc  ,
args   
)
DEFUN ( sparse  ,
args   
)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines