00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_BLOCKMETHODS_H
00027 #define EIGEN_BLOCKMETHODS_H
00028
00029 #ifndef EIGEN_PARSED_BY_DOXYGEN
00030
00031
00032 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
00033 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr;
00034
00035 typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
00036 typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr;
00037
00038 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
00039 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr;
00040
00041 typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
00042 typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr;
00043
00044 template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00045 template<int N> struct ConstNColsBlockXpr { typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00046
00047 template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00048 template<int N> struct ConstNRowsBlockXpr { typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00049
00050
00051 #endif // not EIGEN_PARSED_BY_DOXYGEN
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
00070 {
00071 return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
00072 }
00073
00074
00075 inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const
00076 {
00077 return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols);
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 inline Block<Derived> topRightCorner(Index cRows, Index cCols)
00094 {
00095 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00096 }
00097
00098
00099 inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const
00100 {
00101 return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00102 }
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 template<int CRows, int CCols>
00114 inline Block<Derived, CRows, CCols> topRightCorner()
00115 {
00116 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00117 }
00118
00119
00120 template<int CRows, int CCols>
00121 inline const Block<const Derived, CRows, CCols> topRightCorner() const
00122 {
00123 return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00124 }
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 inline Block<Derived> topLeftCorner(Index cRows, Index cCols)
00140 {
00141 return Block<Derived>(derived(), 0, 0, cRows, cCols);
00142 }
00143
00144
00145 inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const
00146 {
00147 return Block<const Derived>(derived(), 0, 0, cRows, cCols);
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 template<int CRows, int CCols>
00160 inline Block<Derived, CRows, CCols> topLeftCorner()
00161 {
00162 return Block<Derived, CRows, CCols>(derived(), 0, 0);
00163 }
00164
00165
00166 template<int CRows, int CCols>
00167 inline const Block<const Derived, CRows, CCols> topLeftCorner() const
00168 {
00169 return Block<const Derived, CRows, CCols>(derived(), 0, 0);
00170 }
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 inline Block<Derived> bottomRightCorner(Index cRows, Index cCols)
00185 {
00186 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00187 }
00188
00189
00190 inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const
00191 {
00192 return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00193 }
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204 template<int CRows, int CCols>
00205 inline Block<Derived, CRows, CCols> bottomRightCorner()
00206 {
00207 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00208 }
00209
00210
00211 template<int CRows, int CCols>
00212 inline const Block<const Derived, CRows, CCols> bottomRightCorner() const
00213 {
00214 return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00215 }
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols)
00230 {
00231 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00232 }
00233
00234
00235 inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const
00236 {
00237 return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00238 }
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249 template<int CRows, int CCols>
00250 inline Block<Derived, CRows, CCols> bottomLeftCorner()
00251 {
00252 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00253 }
00254
00255
00256 template<int CRows, int CCols>
00257 inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const
00258 {
00259 return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00260 }
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 inline RowsBlockXpr topRows(Index n)
00274 {
00275 return RowsBlockXpr(derived(), 0, 0, n, cols());
00276 }
00277
00278
00279 inline ConstRowsBlockXpr topRows(Index n) const
00280 {
00281 return ConstRowsBlockXpr(derived(), 0, 0, n, cols());
00282 }
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 template<int N>
00294 inline typename NRowsBlockXpr<N>::Type topRows()
00295 {
00296 return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00297 }
00298
00299
00300 template<int N>
00301 inline typename ConstNRowsBlockXpr<N>::Type topRows() const
00302 {
00303 return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 inline RowsBlockXpr bottomRows(Index n)
00318 {
00319 return RowsBlockXpr(derived(), rows() - n, 0, n, cols());
00320 }
00321
00322
00323 inline ConstRowsBlockXpr bottomRows(Index n) const
00324 {
00325 return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols());
00326 }
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337 template<int N>
00338 inline typename NRowsBlockXpr<N>::Type bottomRows()
00339 {
00340 return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00341 }
00342
00343
00344 template<int N>
00345 inline typename ConstNRowsBlockXpr<N>::Type bottomRows() const
00346 {
00347 return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00348 }
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362 inline RowsBlockXpr middleRows(Index startRow, Index numRows)
00363 {
00364 return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
00365 }
00366
00367
00368 inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const
00369 {
00370 return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols());
00371 }
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383 template<int N>
00384 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow)
00385 {
00386 return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00387 }
00388
00389
00390 template<int N>
00391 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const
00392 {
00393 return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00394 }
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 inline ColsBlockXpr leftCols(Index n)
00408 {
00409 return ColsBlockXpr(derived(), 0, 0, rows(), n);
00410 }
00411
00412
00413 inline ConstColsBlockXpr leftCols(Index n) const
00414 {
00415 return ConstColsBlockXpr(derived(), 0, 0, rows(), n);
00416 }
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427 template<int N>
00428 inline typename NColsBlockXpr<N>::Type leftCols()
00429 {
00430 return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00431 }
00432
00433
00434 template<int N>
00435 inline typename ConstNColsBlockXpr<N>::Type leftCols() const
00436 {
00437 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00438 }
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451 inline ColsBlockXpr rightCols(Index n)
00452 {
00453 return ColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00454 }
00455
00456
00457 inline ConstColsBlockXpr rightCols(Index n) const
00458 {
00459 return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00460 }
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471 template<int N>
00472 inline typename NColsBlockXpr<N>::Type rightCols()
00473 {
00474 return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00475 }
00476
00477
00478 template<int N>
00479 inline typename ConstNColsBlockXpr<N>::Type rightCols() const
00480 {
00481 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00482 }
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496 inline ColsBlockXpr middleCols(Index startCol, Index numCols)
00497 {
00498 return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00499 }
00500
00501
00502 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const
00503 {
00504 return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00505 }
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517 template<int N>
00518 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol)
00519 {
00520 return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00521 }
00522
00523
00524 template<int N>
00525 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const
00526 {
00527 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00528 }
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548 template<int BlockRows, int BlockCols>
00549 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
00550 {
00551 return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00552 }
00553
00554
00555 template<int BlockRows, int BlockCols>
00556 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const
00557 {
00558 return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00559 }
00560
00561
00562
00563
00564
00565
00566
00567 inline ColXpr col(Index i)
00568 {
00569 return ColXpr(derived(), i);
00570 }
00571
00572
00573 inline ConstColXpr col(Index i) const
00574 {
00575 return ConstColXpr(derived(), i);
00576 }
00577
00578
00579
00580
00581
00582
00583
00584 inline RowXpr row(Index i)
00585 {
00586 return RowXpr(derived(), i);
00587 }
00588
00589
00590 inline ConstRowXpr row(Index i) const
00591 {
00592 return ConstRowXpr(derived(), i);
00593 }
00594
00595 #endif // EIGEN_BLOCKMETHODS_H