~ubuntu-branches/ubuntu/wily/r-cran-rcpparmadillo/wily

« back to all changes in this revision

Viewing changes to inst/include/armadillo_bits/op_normalise_meat.hpp

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2015-08-17 06:00:00 UTC
  • mfrom: (1.1.31)
  • Revision ID: package-import@ubuntu.com-20150817060000-1ai46se2u88axf3u
Tags: 0.5.400.2.0-1
* New upstream release

* debian/control: Set Build-Depends: to current R version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2014 Conrad Sanderson
2
 
// Copyright (C) 2014 NICTA (www.nicta.com.au)
 
1
// Copyright (C) 2014-2015 Conrad Sanderson
 
2
// Copyright (C) 2014-2015 NICTA (www.nicta.com.au)
3
3
// 
4
4
// This Source Code Form is subject to the terms of the Mozilla Public
5
5
// License, v. 2.0. If a copy of the MPL was not distributed with this
15
15
template<typename T1>
16
16
inline
17
17
void
18
 
op_normalise_colvec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_normalise_colvec>& in)
 
18
op_normalise_vec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_normalise_vec>& in)
19
19
  {
20
20
  arma_extra_debug_sigprint();
21
21
  
38
38
template<typename T1>
39
39
inline
40
40
void
41
 
op_normalise_rowvec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_normalise_rowvec>& in)
42
 
  {
43
 
  arma_extra_debug_sigprint();
44
 
  
45
 
  typedef typename T1::pod_type T;
46
 
  
47
 
  const uword p = in.aux_uword_a;
48
 
  
49
 
  arma_debug_check( (p == 0), "normalise(): parameter 'p' must be greater than zero" );
50
 
  
51
 
  const unwrap<T1> tmp(in.m);
52
 
  
53
 
  const T norm_val_a = norm(tmp.M, p);
54
 
  const T norm_val_b = (norm_val_a != T(0)) ? norm_val_a : T(1);
55
 
  
56
 
  out = tmp.M / norm_val_b;
57
 
  }
58
 
 
59
 
 
60
 
 
61
 
template<typename T1>
62
 
inline
63
 
void
64
41
op_normalise_mat::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_normalise_mat>& in)
65
42
  {
66
43
  arma_extra_debug_sigprint();