MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
mxSetJc    Examples   See Also

Set the jc array of a sparse mxArray

C Syntax

Arguments

array_ptr
  Pointer to a sparse mxArray.

jc
  Pointer to the jc array.

Description

Use mxSetJc to specify a new jc array for a sparse mxArray. The jc array is an integer array having n+1 elements where n is the number of columns in the sparse mxArray. The values in the jc array have the meanings:

The number of nonzero elements in any column (denoted as column C) is

For example, consider a 7-by-3 sparse mxArray named Sparrow containing six nonzero elements, created by typing

The contents of the ir, jc, and pr arrays are

Subscript
ir
pr
jc
Comment
(2,1)
1
1
0
Column 1 contains 2 entries, at ir[0],ir[1]

(5,1)
4
1
2
Column 2 contains 1 entry, at ir[2]

(3,2)
2
1
3
Column 3 contains 3 entries, at ir[3],ir[4], ir[5]

(2,3)
1
2
6
There are 6 nonzero elements.

(5,3)
4
1


(6,3)
5
1


Now onto a much sparser mxArray. Consider an 8,000 element sparse mxArray named Spacious containing only 3 nonzero elements. The ir, pr, and jc arrays contain

Subscript
ir
pr
jc
Comment
(73,2)
72
1
0
Column 1 contains 0 entries

(50,3)
49
1
0
Column 2 contains 1 entry, at ir[0]

(64,5)
63
1
1
Column 3 contains 1 entry, at ir[1]




2
Column 4 contains 0 entries.




2
Column 5 contains 1 entry, at ir[3]




3
Column 6 contains 0 entries.




3
Column 7 contains 0 entries.




3
Column 8 contains 0 entries.




3
There are 3 nonzero elements.

Example

See the example on the mxSetNzmax reference page.

See Also

mxGetIr, mxGetJc, mxSetIr



[ Previous | Help Desk | Next ]