cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstVector
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
14
This software is provided "as is" under an open source license, with
15
no warranty. The complete license can be found in license.txt and
16
http://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
30
#include <
cisstVector/vctFixedSizeConstMatrixBase.h
>
31
41
template
<vct::
size_t
ype _size>
42
class
vctDeterminant
43
{
44
public
:
45
enum
{
SIZE
= _size};
51
template
<vct::str
id
e_type _rowStr
id
e, vct::str
id
e_type _colStr
id
e,
class
_elementType,
class
_dataPtrType>
52
static
_elementType
Compute
(
const
vctFixedSizeConstMatrixBase<_size, _size, _rowStride, _colStride, _elementType, _dataPtrType>
& matrix);
53
};
54
55
56
#ifndef DOXYGEN
57
58
template
<>
59
class
vctDeterminant
<1>
60
{
61
public
:
62
enum
{
SIZE
= 1};
63
template
<vct::str
id
e_type _rowStr
id
e, vct::str
id
e_type _colStr
id
e,
class
_elementType,
class
_dataPtrType>
64
static
_elementType
Compute
(
const
vctFixedSizeConstMatrixBase<SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType>
& matrix)
65
{
66
return
matrix.
Element
(0, 0);
67
}
68
};
69
70
71
template
<>
72
class
vctDeterminant
<2>
73
{
74
public
:
75
enum
{
SIZE
= 2};
76
template
<vct::str
id
e_type _rowStr
id
e, vct::str
id
e_type _colStr
id
e,
class
_elementType,
class
_dataPtrType>
77
static
_elementType
Compute
(
const
vctFixedSizeConstMatrixBase<SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType>
& matrix)
78
{
79
return
matrix.
Element
(0, 0) * matrix.
Element
(1, 1) - matrix.
Element
(0, 1) * matrix.
Element
(1, 0);
80
}
81
};
82
83
84
template
<>
85
class
vctDeterminant
<3>
86
{
87
public
:
88
enum
{
SIZE
= 3};
89
template
<vct::str
id
e_type _rowStr
id
e, vct::str
id
e_type _colStr
id
e,
class
_elementType,
class
_dataPtrType>
90
static
_elementType
Compute
(
const
vctFixedSizeConstMatrixBase<SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType>
& matrix)
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
vctDeterminant< 1 >::SIZE
@ SIZE
Definition
vctDeterminant.h:62
vctDeterminant< 1 >::Compute
static _elementType Compute(const vctFixedSizeConstMatrixBase< SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
Definition
vctDeterminant.h:64
vctDeterminant< 2 >::SIZE
@ SIZE
Definition
vctDeterminant.h:75
vctDeterminant< 2 >::Compute
static _elementType Compute(const vctFixedSizeConstMatrixBase< SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
Definition
vctDeterminant.h:77
vctDeterminant< 3 >::Compute
static _elementType Compute(const vctFixedSizeConstMatrixBase< SIZE, SIZE, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
Definition
vctDeterminant.h:90
vctDeterminant< 3 >::SIZE
@ SIZE
Definition
vctDeterminant.h:88
vctDeterminant
Determinant function for fixed size matrices.
Definition
vctDeterminant.h:43
vctDeterminant::SIZE
@ SIZE
Definition
vctDeterminant.h:45
vctDeterminant::Compute
static _elementType Compute(const vctFixedSizeConstMatrixBase< _size, _size, _rowStride, _colStride, _elementType, _dataPtrType > &matrix)
vctFixedSizeConstMatrixBase
A template for a fixed size matrix with fixed spacing in memory.
Definition
vctFixedSizeConstMatrixBase.h:104
vctFixedSizeConstMatrixBase::Element
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition
vctFixedSizeConstMatrixBase.h:397
vctFixedSizeConstMatrixBase.h
Declaration of vctFixedSizeConstMatrixBase.
Generated by
1.18.0