split out rcond variants of op_inv
This commit is contained in:
@@ -215,6 +215,7 @@ namespace arma
|
||||
#include "armadillo_bits/op_log_det_bones.hpp"
|
||||
#include "armadillo_bits/op_inv_gen_bones.hpp"
|
||||
#include "armadillo_bits/op_inv_spd_bones.hpp"
|
||||
#include "armadillo_bits/op_inv_rcond_bones.hpp"
|
||||
#include "armadillo_bits/op_htrans_bones.hpp"
|
||||
#include "armadillo_bits/op_max_bones.hpp"
|
||||
#include "armadillo_bits/op_min_bones.hpp"
|
||||
@@ -646,6 +647,7 @@ namespace arma
|
||||
#include "armadillo_bits/op_log_det_meat.hpp"
|
||||
#include "armadillo_bits/op_inv_gen_meat.hpp"
|
||||
#include "armadillo_bits/op_inv_spd_meat.hpp"
|
||||
#include "armadillo_bits/op_inv_rcond_meat.hpp"
|
||||
#include "armadillo_bits/op_htrans_meat.hpp"
|
||||
#include "armadillo_bits/op_max_meat.hpp"
|
||||
#include "armadillo_bits/op_index_max_meat.hpp"
|
||||
|
||||
@@ -201,7 +201,7 @@ inv_sympd
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const bool status = op_inv_spd::apply_direct_rcond(out_inv, out_rcond, X.get_ref());
|
||||
const bool status = op_inv_rcond::apply_direct_spd(out_inv, out_rcond, X.get_ref());
|
||||
|
||||
if(status == false)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
//! \addtogroup op_inv_rcond
|
||||
//! @{
|
||||
|
||||
|
||||
|
||||
class op_inv_rcond
|
||||
: public traits_op_default
|
||||
{
|
||||
public:
|
||||
|
||||
template<typename T1>
|
||||
inline static bool apply_direct_gen(Mat<typename T1::elem_type>& out_inv, typename T1::pod_type& out_rcond, const Base<typename T1::elem_type,T1>& expr);
|
||||
|
||||
template<typename T1>
|
||||
inline static bool apply_direct_spd(Mat<typename T1::elem_type>& out_inv, typename T1::pod_type& out_rcond, const Base<typename T1::elem_type,T1>& expr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
@@ -0,0 +1,88 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
//! \addtogroup op_inv_rcond
|
||||
//! @{
|
||||
|
||||
|
||||
|
||||
template<typename T1>
|
||||
inline
|
||||
bool
|
||||
op_inv_rcond::apply_direct_gen(Mat<typename T1::elem_type>& out_inv, typename T1::pod_type& out_rcond, const Base<typename T1::elem_type,T1>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
// NOTE: this is a temporary and rudimentary implementation
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const Mat<eT> A = expr.get_ref();
|
||||
|
||||
arma_debug_check( (A.is_square() == false), "inv_sympd(): given matrix must be square sized" );
|
||||
|
||||
const bool status = op_inv_gen::apply_direct<T1,false>(out_inv, A, uword(0));
|
||||
|
||||
if(status)
|
||||
{
|
||||
out_rcond = op_cond::rcond(expr.get_ref());
|
||||
}
|
||||
else
|
||||
{
|
||||
out_rcond = T(0);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T1>
|
||||
inline
|
||||
bool
|
||||
op_inv_rcond::apply_direct_spd(Mat<typename T1::elem_type>& out_inv, typename T1::pod_type& out_rcond, const Base<typename T1::elem_type,T1>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
// NOTE: this is a temporary and rudimentary implementation
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const Mat<eT> A = expr.get_ref();
|
||||
|
||||
arma_debug_check( (A.is_square() == false), "inv_sympd(): given matrix must be square sized" );
|
||||
|
||||
const bool status = op_inv_spd::apply_direct<T1,false>(out_inv, A, uword(0));
|
||||
|
||||
if(status)
|
||||
{
|
||||
out_rcond = op_cond::rcond(expr.get_ref());
|
||||
}
|
||||
else
|
||||
{
|
||||
out_rcond = T(0);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
@@ -45,9 +45,6 @@ class op_inv_spd
|
||||
|
||||
template<typename T1, const bool has_user_flags = true>
|
||||
inline static bool apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1::elem_type,T1>& expr, const uword flags);
|
||||
|
||||
template<typename T1>
|
||||
inline static bool apply_direct_rcond(Mat<typename T1::elem_type>& out_inv, typename T1::pod_type& out_rcond, const Base<typename T1::elem_type,T1>& expr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -194,36 +194,4 @@ op_inv_spd::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T
|
||||
|
||||
|
||||
|
||||
template<typename T1>
|
||||
inline
|
||||
bool
|
||||
op_inv_spd::apply_direct_rcond(Mat<typename T1::elem_type>& out_inv, typename T1::pod_type& out_rcond, const Base<typename T1::elem_type,T1>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
// NOTE: this is a temporary and rudimentary implementation
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const Mat<eT> A = expr.get_ref();
|
||||
|
||||
arma_debug_check( (A.is_square() == false), "inv_sympd(): given matrix must be square sized" );
|
||||
|
||||
const bool status = op_inv_spd::apply_direct<T1,false>(out_inv, A, uword(0));
|
||||
|
||||
if(status)
|
||||
{
|
||||
out_rcond = op_cond::rcond(expr.get_ref());
|
||||
}
|
||||
else
|
||||
{
|
||||
out_rcond = T(0);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
Reference in New Issue
Block a user