cisst-saw
Loading...
Searching...
No Matches
vctDeterminant.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5
6 Author(s): Ofri Sadowsky
7 Created on: 2004-04-16
8
9 (C) Copyright 2004-2007 Johns Hopkins University (JHU), All Rights
10 Reserved.
11
12--- begin cisst license - do not edit ---
13
14This software is provided "as is" under an open source license, with
15no warranty. The complete license can be found in license.txt and
16http://www.cisst.org/cisst/license.txt.
17
18--- end cisst license ---
19*/
20
21#pragma once
22#ifndef _vctDeterminant_h
23#define _vctDeterminant_h
24
29
31
41template <vct::size_type _size>
43{
44public:
45 enum {SIZE = _size};
51 template <vct::stride_type _rowStride, vct::stride_type _colStride, class _elementType, class _dataPtrType>
53};
54
55
56#ifndef DOXYGEN
57
58template<>
60{
61public:
62 enum {SIZE = 1};
63 template <vct::stride_type _rowStride, vct::stride_type _colStride, class _elementType, class _dataPtrType>
65 {
66 return matrix.Element(0, 0);
67 }
68};
69
70
71template<>
73{
74public:
75 enum {SIZE = 2};
76 template <vct::stride_type _rowStride, vct::stride_type _colStride, class _elementType, class _dataPtrType>
78 {
79 return matrix.Element(0, 0) * matrix.Element(1, 1) - matrix.Element(0, 1) * matrix.Element(1, 0);
80 }
81};
82
83
84template<>
86{
87public:
88 enum {SIZE = 3};
89 template<vct::stride_type _rowStride, vct::stride_type _colStride, class _elementType, class _dataPtrType>
91 {
92 return
93 matrix.Element(0, 0) * ( matrix.Element(1, 1) * matrix.Element(2, 2) - matrix.Element(1, 2) * matrix.Element(2, 1) ) -
94 matrix.Element(0, 1) * ( matrix.Element(1, 0) * matrix.Element(2, 2) - matrix.Element(1, 2) * matrix.Element(2, 0) ) +
95 matrix.Element(0, 2) * ( matrix.Element(1, 0) * matrix.Element(2, 1) - matrix.Element(1, 1) * matrix.Element(2, 0) );
96 }
97};
98
99
100#endif // DOXYGEN
101
102#endif // _vctDeterminant_h
103
@ SIZE
Definition vctDeterminant.h:62
static _elementType Compute(const vctFixedSizeConstMatrixBase< SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
Definition vctDeterminant.h:64
@ SIZE
Definition vctDeterminant.h:75
static _elementType Compute(const vctFixedSizeConstMatrixBase< SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
Definition vctDeterminant.h:77
static _elementType Compute(const vctFixedSizeConstMatrixBase< SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
Definition vctDeterminant.h:90
@ SIZE
Definition vctDeterminant.h:88
Determinant function for fixed size matrices.
Definition vctDeterminant.h:43
@ SIZE
Definition vctDeterminant.h:45
static _elementType Compute(const vctFixedSizeConstMatrixBase< _size, _size, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
A template for a fixed size matrix with fixed spacing in memory.
Definition vctFixedSizeConstMatrixBase.h:104
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition vctFixedSizeConstMatrixBase.h:397
Declaration of vctFixedSizeConstMatrixBase.