code: def linear_mean(points, weights=None):
      """Compute the weighted linear mean.
  
      The linear mean is the Frechet mean when points:
  
      - lie in a Euclidean space with Euclidean metric,
      - lie in a Minkowski space with Minkowski metric.
  
      Parameters
      ----------
      points : array-like, shape=[n_samples, dim]
          Points to be averaged.
      weights : array-like, shape=[n_samples,]
          Weights associated to the points.
          Optional, default: None.
  
      Returns
      -------
      mean : array-like, shape=[dim,]
          Weighted linear mean of the points.
      """
      if weights is None:
          n_points = gs.shape(points)[0]
          weights = gs.ones(n_points)
      sum_weights = gs.sum(weights)
  
      weighted_points = _scalarmul(weights, points)
  
      mean = gs.sum(weighted_points, axis=0) / sum_weights
      return mean
  
imports: import abc
  import logging
  import math
  from sklearn.base import BaseEstimator
  import geomstats.backend
  import geomstats.errors
  from geomstats.geometry.discrete_curves import ElasticTranslationMetric, SRVTranslationMetric
  from geomstats.geometry.euclidean import EuclideanMetric
  from geomstats.geometry.hypersphere import HypersphereMetric
  from geomstats.geometry.matrices import MatricesMetric
  from geomstats.geometry.minkowski import MinkowskiMetric
label_desc: Use image node_id 8 for calling a global function with example usage: linear_mean(points, weights) and returns: mean