19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Each element of the left-hand-side of unpasting includes an optional extent specification. An extent specification<br />

low #num describes the indexing and the size of the given part of the matrix. <strong>The</strong> lower extent must be bound, either<br />

before the unpasting, or earlier (left-or-above) in the unpasting. For example, suppose that an algorithm chooses to<br />

break a matrix into 4 pieces, but retain the original indices for each piece:<br />

barnat p,nat q(X : R r 0#p×c 0 #q ) :() = do<br />

[ A r0 #m ×c 0 #n B r 0 #m ×c 0 +n#q−n<br />

C r0 +m#p−m×c 0 #n D r 0 +m#p−m×c 0 +n#q−n ] = X<br />

. . .<br />

end<br />

Unpasting does not directly support non-uniform decomposition, and does not provide any sort of constraint satisfaction<br />

between the extents of the parts. For example, the following decomposition is not legal because it constrains the<br />

split sizes to be equal with respect to unbound nat parameters:<br />

(∗ Not allowed! ∗)<br />

fubarnat m,nat n(X : R m×n ) :() = do<br />

(∗ p and q unbound ∗)<br />

[ A p×q B p×q<br />

C p×q D p×q ] = X<br />

. . .<br />

end<br />

To get this effect, the programmer should compute the constrained values:<br />

fubarnat m,nat n(X : R 2m×2n ) :() = do<br />

[ A m×n B m×n<br />

C m×n D m×n ] = X<br />

. . .<br />

end<br />

Some non-uniform unpastings can be obtained with composition, which can be expressed either by repeated unpasting:<br />

unequalRowsnat m,nat n(X :R 4m×2n ) = do<br />

[ c1 4m×n c2 4m×n ] = X<br />

[ A m×n<br />

C 3m×n ] = c1<br />

[ B 3m×n<br />

D m×n ] = c2<br />

. . .<br />

end<br />

or simply by nesting matrices in the unpasting:<br />

unequalRowsnat m,nat n(X :R 2m×4n ) = do<br />

[ [ A m×n B m×3n ]<br />

[ C m×3n D m×n ] ] = X<br />

. . .<br />

end<br />

60

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!