You are here

function Vector::count in Recommender API 6.2

Same name and namespace in other branches
  1. 7.6 classes/Matrix.php \Vector::count()

Count the number of vectors. This works for SparseVector too. It only counts valid numbers, not the size the vector is supposed to be.

Parameters

$may_cache:

Return value

the count number

3 calls to Vector::count()
Vector::covariance in ./Matrix.php
Compute covariance with $vector. No caching option. Works for RealVector. SparseVector needs additional handling.
Vector::mean in ./Matrix.php
Calculate the mean. This works for SparseMatrix too.
Vector::variance in ./Matrix.php
Calculate the variance. This works for SparseMatrix too.

File

./Matrix.php, line 198

Class

Vector
This is the Vector superclass. @author danithaca

Code

function count($may_cache = FALSE) {
  if (!$may_cache || $this->count === NULL) {

    // triggers counting
    $this->count = count($this->values);
  }
  return $this->count;
}